[PATCH] mq: Added return 0 on success

Erik Zielke ez at aragost.com
Fri Sep 24 06:53:45 CDT 2010


# HG changeset patch
# User Erik Zielke <ez at aragost.com>
# Date 1285253792 -7200
# Node ID 6b31785388a233be56ac7c994acddc7f89ae3e38
# Parent  1f97b741e9a08e73b3281903b335cd2f12094e86
mq: Added return 0 on success

I have added return 0 on success in docstrings of
the different not deprecated mq commands.

diff -r 1f97b741e9a0 -r 6b31785388a2 hgext/mq.py
--- a/hgext/mq.py	Thu Sep 23 15:18:10 2010 +0200
+++ b/hgext/mq.py	Thu Sep 23 16:56:32 2010 +0200
@@ -1753,7 +1753,9 @@
     return 0
 
 def applied(ui, repo, patch=None, **opts):
-    """print the patches already applied"""
+    """print the patches already applied
+
+    Returns 0 on success."""
 
     q = repo.mq
 
@@ -1781,7 +1783,9 @@
 
 
 def unapplied(ui, repo, patch=None, **opts):
-    """print the patches not yet applied"""
+    """print the patches not yet applied
+
+    Returns 0 on success."""
 
     q = repo.mq
     if patch:
@@ -1829,6 +1833,8 @@
     To import an existing patch while renaming it::
 
       hg qimport -e existing-patch -n new-name
+
+    Returns 0 if import succeeded.
     """
     q = repo.mq
     try:
@@ -1847,7 +1853,9 @@
 
     This command also creates a series file for ordering patches, and
     an mq-specific .hgignore file in the queue repository, to exclude
-    the status and guards files (these contain mostly transient state)."""
+    the status and guards files (these contain mostly transient state).
+
+    Returns 0 if initialization succeeded."""
     q = repo.mq
     r = q.init(repo, create)
     q.save_dirty()
@@ -1893,6 +1901,8 @@
 
     The patch directory must be a nested Mercurial repository, as
     would be created by :hg:`init --mq`.
+
+    Return 0 on success.
     '''
     def patchdir(repo):
         url = repo.url()
@@ -1954,12 +1964,16 @@
     commands.commit(r.ui, r, *pats, **opts)
 
 def series(ui, repo, **opts):
-    """print the entire series file"""
+    """print the entire series file
+
+    Returns 0 on success."""
     repo.mq.qseries(repo, missing=opts.get('missing'), summary=opts.get('summary'))
     return 0
 
 def top(ui, repo, **opts):
-    """print the name of the current patch"""
+    """print the name of the current patch
+
+    Returns 0 on success."""
     q = repo.mq
     t = q.applied and q.series_end(True) or 0
     if t:
@@ -1970,7 +1984,9 @@
         return 1
 
 def next(ui, repo, **opts):
-    """print the name of the next patch"""
+    """print the name of the next patch
+
+    Returns 0 on success."""
     q = repo.mq
     end = q.series_end()
     if end == len(q.series):
@@ -1979,7 +1995,9 @@
     q.qseries(repo, start=end, length=1, summary=opts.get('summary'))
 
 def prev(ui, repo, **opts):
-    """print the name of the previous patch"""
+    """print the name of the previous patch
+
+    Returns 0 on success."""
     q = repo.mq
     l = len(q.applied)
     if l == 1:
@@ -2019,6 +2037,8 @@
     format. Read the diffs help topic for more information on why this
     is important for preserving permission changes and copy/rename
     information.
+
+    Returns 0 on successfull creation of a new patch.
     """
     msg = cmdutil.logmessage(opts)
     def getmsg():
@@ -2052,6 +2072,8 @@
     use git-style patches (-g/--git or [diff] git=1) to track copies
     and renames. See the diffs help topic for more information on the
     git diff format.
+
+    Returns 0 on success.
     """
     q = repo.mq
     message = cmdutil.logmessage(opts)
@@ -2085,6 +2107,8 @@
     last qrefresh, or :hg:`export qtip` if you want to see changes
     made by the current patch without including changes made since the
     qrefresh.
+
+    Returns 0 on success.
     """
     repo.mq.diff(repo, pats, opts)
     return 0
@@ -2100,7 +2124,9 @@
     removed afterwards.
 
     The header for each folded patch will be concatenated with the
-    current patch header, separated by a line of '* * *'."""
+    current patch header, separated by a line of '* * *'.
+
+    Returns 0 on success."""
 
     q = repo.mq
 
@@ -2154,7 +2180,9 @@
     q.save_dirty()
 
 def goto(ui, repo, patch, **opts):
-    '''push or pop patches until named patch is at top of stack'''
+    '''push or pop patches until named patch is at top of stack
+
+    Returns 0 on success.'''
     q = repo.mq
     patch = q.lookup(patch)
     if q.isapplied(patch):
@@ -2182,6 +2210,8 @@
     To set guards on another patch::
 
       hg qguard other.patch -- +2.6.17 -stable
+
+    Returns 0 on success.
     '''
     def status(idx):
         guards = q.series_guards[idx] or ['unguarded']
@@ -2232,7 +2262,9 @@
         status(q.series.index(q.lookup(patch)))
 
 def header(ui, repo, patch=None):
-    """print the header of the topmost or specified patch"""
+    """print the header of the topmost or specified patch
+
+    Returns 0 on success."""
     q = repo.mq
 
     if patch:
@@ -2275,6 +2307,8 @@
 
     When -f/--force is applied, all local changes in patched files
     will be lost.
+
+    Return 0 on succces.
     """
     q = repo.mq
     mergeq = None
@@ -2299,6 +2333,8 @@
     By default, pops off the top of the patch stack. If given a patch
     name, keeps popping off patches until the named patch is at the
     top of the stack.
+
+    Return 0 on success.
     """
     localupdate = True
     if opts.get('name'):
@@ -2316,7 +2352,9 @@
     """rename a patch
 
     With one argument, renames the current patch to PATCH1.
-    With two arguments, renames PATCH1 to PATCH2."""
+    With two arguments, renames PATCH1 to PATCH2.
+
+    Returns 0 on success."""
 
     q = repo.mq
 
@@ -2440,6 +2478,8 @@
 
     Use the --no-backup option to discard the backup bundle once the
     operation completes.
+
+    Return 0 on success.
     """
     backup = 'all'
     if opts.get('backup'):
@@ -2516,7 +2556,9 @@
     guarded patches.
 
     Use -s/--series to print a list of all guards in the series file
-    (no other arguments needed). Use -v for more information.'''
+    (no other arguments needed). Use -v for more information.
+
+    Returns 0 on success.'''
 
     q = repo.mq
     guards = q.active()
@@ -2603,6 +2645,8 @@
     This can be especially useful if your changes have been applied to
     an upstream repository, or if you are about to push your changes
     to upstream.
+
+    Returns 0 on success.
     """
     if not opts.get('applied') and not revrange:
         raise util.Abort(_('no revisions specified'))
@@ -2636,6 +2680,8 @@
 
     To delete an existing queue, use --delete. You cannot delete the currently
     active queue.
+
+    Returns 0 on success.
     '''
 
     q = repo.mq


More information about the Mercurial-devel mailing list