[PATCH] mq: rename secretcommit to newcommit

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Fri Feb 3 04:36:53 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1327878328 -3600
# Node ID c37388992cfada15d6a56987c975fcf0183697ac
# Parent  35a9121f3246e05b7a4b83564435d0e3fa346160
mq: rename secretcommit to newcommit

This function create secret changeset only when mq.secret is true

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -255,14 +255,15 @@ class patchheader(object):
         for mi in self.message:
             while mi != self.comments[ci]:
                 ci += 1
             del self.comments[ci]
 
-def secretcommit(repo, *args, **kwargs):
-    """helper dedicated to ensure a commit are secret
-
-    It should be used instead of repo.commit inside the mq source
+def newcommit(repo, *args, **kwargs):
+    """helper dedicated to ensure a commit respect mq.secret setting
+
+    It should be used instead of repo.commit inside the mq source for operation
+    creating new changeset.
     """
     if not repo.ui.configbool('mq', 'secret', False):
         return repo.commit(*args, **kwargs)
 
     backup = repo.ui.backupconfig('phases', 'new-commit')
@@ -573,11 +574,11 @@ class queue(object):
 
         ctx = repo[rev]
         ret = hg.merge(repo, rev)
         if ret:
             raise util.Abort(_("update returned %d") % ret)
-        n = secretcommit(repo, ctx.description(), ctx.user(), force=True)
+        n = newcommit(repo, ctx.description(), ctx.user(), force=True)
         if n is None:
             raise util.Abort(_("repo commit failed"))
         try:
             ph = patchheader(mergeq.join(patch), self.plainmode)
         except:
@@ -744,11 +745,11 @@ class queue(object):
                 p1, p2 = repo.dirstate.parents()
                 repo.dirstate.setparents(p1, merge)
 
             match = scmutil.matchfiles(repo, files or [])
             oldtip = repo['tip']
-            n = secretcommit(repo, message, ph.user, ph.date, match=match,
+            n = newcommit(repo, message, ph.user, ph.date, match=match,
                              force=True)
             if repo['tip'] == oldtip:
                 raise util.Abort(_("qpush exactly duplicates child changeset"))
             if n is None:
                 raise util.Abort(_("repository commit failed"))
@@ -985,11 +986,11 @@ class queue(object):
                     if date:
                         p.write("# Date %s %s\n\n" % date)
                 if util.safehasattr(msg, '__call__'):
                     msg = msg()
                 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
-                n = secretcommit(repo, commitmsg, user, date, match=match,
+                n = newcommit(repo, commitmsg, user, date, match=match,
                                  force=True)
                 if n is None:
                     raise util.Abort(_("repo commit failed"))
                 try:
                     self.fullseries[insert:insert] = [patchfn]


More information about the Mercurial-devel mailing list