changeset 15928:3a51eb88046a

mq: ensure mq changesets are set to secret when no phase data are found
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 18 Jan 2012 17:18:38 +0100
parents 2eec74d7ce95
children 4091660dc130
files hgext/mq.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)):