mq: ensure mq changesets are set to secret when no phase data are found
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 18 Jan 2012 17:18:38 +0100
changeset 15928 3a51eb88046a
parent 15927 2eec74d7ce95
child 15929 4091660dc130
mq: ensure mq changesets are set to secret when no phase data are found
hgext/mq.py
--- a/hgext/mq.py	Tue Jan 17 02:26:00 2012 +0100
+++ b/hgext/mq.py	Wed Jan 18 17:18:38 2012 +0100
@@ -3138,6 +3138,13 @@
             raise util.Abort(_('use --create to create a new queue'))
         _setactive(name)
 
+def mqphasedefaults(repo, roots):
+    """callback used to set mq changeset as secret when no phase data exists"""
+    if repo.mq.applied:
+        qbase = repo[repo.mq.applied[0]]
+        roots[phases.secret].add(qbase.node())
+    return roots
+
 def reposetup(ui, repo):
     class mqrepo(repo.__class__):
         @util.propertycache
@@ -3237,6 +3244,8 @@
     if repo.local():
         repo.__class__ = mqrepo
 
+        repo._phasedefaults.append(mqphasedefaults)
+
 def mqimport(orig, ui, repo, *args, **kwargs):
     if (hasattr(repo, 'abortifwdirpatched')
         and not kwargs.get('no_commit', False)):