# HG changeset patch # User Augie Fackler # Date 1227627938 21600 # Node ID 5497d1264b4d2d39b97f1d2e0f483eb129f6c466 # Parent a4dcffaa65383cb1df2ce741c036959f4f55b1ae fetch_command: Fix mis-converted executable when svn:executable was set to the empty string. diff --git a/fetch_command.py b/fetch_command.py --- a/fetch_command.py +++ b/fetch_command.py @@ -147,14 +147,12 @@ Cannot display: file marked as a binary property_exec_set_re = re.compile(r'''Property changes on: ([^\n]*) _* (?:Added|Name): svn:executable - \+ \* -''') + \+''') property_exec_removed_re = re.compile(r'''Property changes on: ([^\n]*) _* (?:Deleted|Name): svn:executable - - \* -''') + -''') empty_file_patch_wont_make_re = re.compile(r'''Index: ([^\n]*)\n=*\n(?=Index:)''') @@ -163,14 +161,12 @@ any_file_re = re.compile(r'''^Index: ([^ property_special_set_re = re.compile(r'''Property changes on: ([^\n]*) _* (?:Added|Name): svn:special - \+ \* -''') + \+''') property_special_removed_re = re.compile(r'''Property changes on: ([^\n]*) _* (?:Deleted|Name): svn:special - \- \* -''') + \-''') def stupid_diff_branchrev(ui, svn, hg_editor, branch, r, parentctx, tempdir): """Extract all 'branch' content at a given revision. diff --git a/hg_delta_editor.py b/hg_delta_editor.py --- a/hg_delta_editor.py +++ b/hg_delta_editor.py @@ -627,9 +627,9 @@ class HgChangeReceiver(delta.Editor): @stash_exception_on_self def change_file_prop(self, file_baton, name, value, pool=None): if name == 'svn:executable': - self.current_files_exec[self.current_file] = bool(value) + self.current_files_exec[self.current_file] = bool(value is not None) elif name == 'svn:special': - self.current_files_symlink[self.current_file] = bool(value) + self.current_files_symlink[self.current_file] = bool(value is not None) @stash_exception_on_self def open_directory(self, path, parent_baton, base_revision, dir_pool=None): diff --git a/tests/fixtures/executable_file_empty_prop.svndump b/tests/fixtures/executable_file_empty_prop.svndump new file mode 100644 --- /dev/null +++ b/tests/fixtures/executable_file_empty_prop.svndump @@ -0,0 +1,93 @@ +SVN-fs-dump-format-version: 2 + +UUID: 60adb0cc-4d5c-4038-bbb4-90f4595cf81c + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2008-11-25T15:02:16.557895Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 115 +Content-length: 115 + +K 7 +svn:log +V 15 +Basic structure +K 10 +svn:author +V 5 +Augie +K 8 +svn:date +V 27 +2008-11-25T15:02:45.454954Z +PROPS-END + +Node-path: branches +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: tags +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 2 +Prop-content-length: 103 +Content-length: 103 + +K 7 +svn:log +V 4 +blah +K 10 +svn:author +V 5 +Augie +K 8 +svn:date +V 27 +2008-11-25T15:03:45.151223Z +PROPS-END + +Node-path: trunk/foo +Node-kind: file +Node-action: add +Prop-content-length: 36 +Text-content-length: 4 +Text-content-md5: c157a79031e1c40f85931829bc5fc552 +Content-length: 40 + +K 14 +svn:executable +V 0 + +PROPS-END +bar + + diff --git a/tests/test_fetch_command.py b/tests/test_fetch_command.py --- a/tests/test_fetch_command.py +++ b/tests/test_fetch_command.py @@ -104,7 +104,12 @@ class TestBasicRepoLayout(test_util.Test repo['oldest']) self.assertEqual(node.hex(repo['tip'].node()), '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') - #'1316ef606dda89354ee8c4df725e6264177b5129') + + def test_empty_prop_val_executable(self): + repo = self._load_fixture_and_fetch('executable_file_empty_prop.svndump') + self.assertEqual(node.hex(repo['tip'].node()), + 'b19e2bdd93da30b09c2396cfdb987cc85271249a') + self.assertEqual(repo['tip']['foo'].flags(), 'x') class TestStupidPull(test_util.TestBase): @@ -139,6 +144,17 @@ class TestStupidPull(test_util.TestBase) repo['oldest']) self.assertEqual(node.hex(repo['tip'].node()), '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') + + def test_empty_prop_val_executable(self): + repo = test_util.load_fixture_and_fetch( + 'executable_file_empty_prop.svndump', + self.repo_path, + self.wc_path, + True) + self.assertEqual(repo['tip']['foo'].flags(), 'x') + self.assertEqual(node.hex(repo['tip'].node()), + 'b19e2bdd93da30b09c2396cfdb987cc85271249a') + def suite(): all = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout),