changeset 12538:c87216e5e43e

mq: added return 0 on success I have added return 0 on success in docstrings of the different not deprecated mq commands.
author Erik Zielke <ez@aragost.com>
date Thu, 23 Sep 2010 16:56:32 +0200
parents 5df8ef0f3f51
children dece1f46f7a2
files hgext/mq.py
diffstat 1 files changed, 58 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Sun Sep 26 23:48:30 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
 
@@ -1780,7 +1782,9 @@
                      summary=opts.get('summary'))
 
 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:
@@ -1828,6 +1832,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:
@@ -1846,7 +1852,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()
@@ -1892,6 +1900,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()
@@ -1953,12 +1963,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:
@@ -1969,7 +1983,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):
@@ -1978,7 +1994,9 @@
     return 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:
@@ -2018,6 +2036,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 successful creation of a new patch.
     """
     msg = cmdutil.logmessage(opts)
     def getmsg():
@@ -2051,6 +2071,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)
@@ -2084,6 +2106,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
@@ -2099,7 +2123,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
 
@@ -2153,7 +2179,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):
@@ -2181,6 +2209,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']
@@ -2231,7 +2261,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:
@@ -2274,6 +2306,8 @@
 
     When -f/--force is applied, all local changes in patched files
     will be lost.
+
+    Return 0 on succces.
     """
     q = repo.mq
     mergeq = None
@@ -2298,6 +2332,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'):
@@ -2315,7 +2351,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
 
@@ -2439,6 +2477,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'):
@@ -2515,7 +2555,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()
@@ -2602,6 +2644,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'))
@@ -2635,6 +2679,8 @@
 
     To delete an existing queue, use --delete. You cannot delete the currently
     active queue.
+
+    Returns 0 on success.
     '''
 
     q = repo.mq