changeset 62:cc5ebdb1e8d4

push_cmd: Further simplified some logic thanks to an improved test.
author Augie Fackler <durin42@gmail.com>
date Thu, 06 Nov 2008 09:24:33 -0600
parents 243c88c47d89
children 2e30b59a9c19
files push_cmd.py tests/test_push_command.py
diffstat 2 files changed, 29 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/push_cmd.py
+++ b/push_cmd.py
@@ -107,11 +107,9 @@ def commit_from_rev(ui, repo, rev_ctx, h
                         added_dirs.append(dirname[:-1])
             else:
                 base_data = parent.filectx(file).data()
-                if 'x' in parent.filectx(file).flags():
-                    if 'svn:executable' in props.setdefault(file, {}):
-                        del props[file]['svn:executable']
-                    else:
-                        props.setdefault(file, {})['svn:executable'] = None
+                if ('x' in parent.filectx(file).flags()
+                    and 'x' not in rev_ctx.filectx(file).flags()):
+                    props.setdefault(file, {})['svn:executable'] = None
                 if ('l' in parent.filectx(file).flags()
                     and 'l' not in rev_ctx.filectx(file).flags()):
                     props.setdefault(file, {})['svn:special'] = None
--- a/tests/test_push_command.py
+++ b/tests/test_push_command.py
@@ -388,6 +388,32 @@ class PushTests(unittest.TestCase):
         self.assertEqual(tip['alpha'].data(), 'bar')
         self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags)
         self.assertEqual(tip['alpha'].flags(), expected_flags)
+        # now test removing the property entirely
+        repo = self.repo
+        def file_callback(repo, memctx, path):
+            return context.memfilectx(path=path,
+                                      data='bar',
+                                      islink=False,
+                                      isexec=False,
+                                      copied=False)
+        ctx = context.memctx(repo,
+                             (repo['default'].node(), node.nullid),
+                             'message',
+                             ['alpha', ],
+                             file_callback,
+                             'author',
+                             '2008-01-01 00:00:00 -0500',
+                             {'branch': 'default', })
+        new_hash = repo.commitctx(ctx)
+        hg.update(repo, repo['tip'].node())
+        push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
+                                              hg_repo_path=self.wc_path,
+                                              svn_url='file://' + self.repo_path)
+        tip = self.repo['tip']
+        self.assertNotEqual(tip.node(), new_hash)
+        self.assertEqual(tip['alpha'].data(), 'bar')
+        self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags)
+        self.assertEqual(tip['alpha'].flags(), '')
 
 
 def suite():