changeset 1170:61d4fb78370b stable

pull: fix pull when phases.new-commit=secret This was causing subtle failures during pull. I believe the line where we manually "set phase to public" isn't required any more, but more work is required to verify that behavior on all versions of hg, so we'll do that as a followup on default if needed.
author Augie Fackler <raf@durin42.com>
date Fri, 04 Apr 2014 21:27:55 -0400
parents bab98093051b
children c55b94dc3a48 d6296f901fc7
files hgsubversion/svnrepo.py tests/test_pull.py
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnrepo.py
+++ b/hgsubversion/svnrepo.py
@@ -88,7 +88,12 @@ def generate_repo_class(ui, repo):
     class svnlocalrepo(superclass):
         def svn_commitctx(self, ctx):
             """Commits a ctx, but defeats manifest recycling introduced in hg 1.9."""
-            hash = self.commitctx(ctxctx(ctx))
+            ncbackup = self.ui.backupconfig('phases', 'new-commit')
+            try:
+                self.ui.setconfig('phases', 'new-commit', 'public')
+                hash = self.commitctx(ctxctx(ctx))
+            finally:
+                self.ui.restoreconfig(ncbackup)
             if phases is not None and getattr(self, 'pushkey', False):
                 # set phase to be public
                 self.pushkey('phases', self[hash].hex(), str(phases.draft), str(phases.public))
--- a/tests/test_pull.py
+++ b/tests/test_pull.py
@@ -60,6 +60,13 @@ class TestPull(test_util.TestBase):
         commands.pull(repo.ui, repo)
         self.assertEqual(oldheads, map(node.hex, repo.heads()))
 
+    def test_pull_with_secret_default(self):
+        repo = self._loadupdate('branchtagcollision.svndump',
+                                config={'phases.new-commit': 'secret'})[0]
+        oldheads = map(node.hex, repo.heads())
+        commands.pull(repo.ui, repo)
+        self.assertEqual(oldheads, map(node.hex, repo.heads()))
+
     def test_skip_basic(self):
         repo, repo_path = self._loadupdate('single_rev.svndump')
         self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})