changeset 858:bb6a013abaed

phases: mark newly created commits from subversion as 'public' to fix #335
author Sean Farley <sean@mcs.anl.gov>
date Tue, 17 Apr 2012 17:44:28 -0500
parents cfee8d1eff88
children 1d07e86f5797
files hgsubversion/svnrepo.py
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnrepo.py
+++ b/hgsubversion/svnrepo.py
@@ -21,6 +21,12 @@ from mercurial import util as hgutil
 from mercurial import httprepo
 import mercurial.repo
 
+try:
+    from mercurial import phases
+    phases.public # defeat demand import
+except ImportError:
+    phases = None
+
 import re
 import util
 import wrappers
@@ -77,7 +83,11 @@ 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."""
-            return self.commitctx(ctxctx(ctx))
+            hash = self.commitctx(ctxctx(ctx))
+            if phases is not None:
+                # set phase to be public
+                self.pushkey('phases', self[hash].hex(), str(phases.draft), str(phases.public))
+            return hash
 
         # TODO use newbranch to allow branch creation in Subversion?
         @remotesvn