[PATCH] accept -r REV in more places

Daniel Holth dholth at fastmail.fm
Wed May 16 04:05:42 UTC 2007


# HG changeset patch
# User Daniel Holth <dholth at fastmail.fm>
# Date 1179287579 14400
# Node ID 34413b1ba6d6af783e1adad331abba10bc53e5c7
# Parent  ba22e867cb23fb11f83c37705743e050afd66a6a
accept -r REV in more places
Commands affected:
* update
* merge
* backout

diff -r ba22e867cb23 -r 34413b1ba6d6 mercurial/commands.py
--- a/mercurial/commands.py	Mon May 07 21:44:11 2007 +0900
+++ b/mercurial/commands.py	Tue May 15 23:52:59 2007 -0400
@@ -1829,7 +1829,7 @@ def manifest(ui, repo, rev=None):
             ui.write("%3s " % (m.execf(f) and "755" or "644"))
         ui.write("%s\n" % f)
 
-def merge(ui, repo, node=None, force=None):
+def merge(ui, repo, node=None, force=None, rev=None):
     """merge working directory with another revision
 
     Merge the contents of the current working directory and the
@@ -1842,6 +1842,12 @@ def merge(ui, repo, node=None, force=Non
     the other head is merged with by default.  Otherwise, an explicit
     revision to merge with must be provided.
     """
+
+    if rev and node:
+        raise util.Abort(_("please specify just one revision"))
+
+    if not node:
+        node = rev
 
     if not node:
         heads = repo.heads()
@@ -2555,7 +2561,7 @@ def unbundle(ui, repo, fname, **opts):
     modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
     return postincoming(ui, repo, modheads, opts['update'])
 
-def update(ui, repo, node=None, clean=False, date=None):
+def update(ui, repo, node=None, clean=False, date=None, rev=None):
     """update working directory
 
     Update the working directory to the specified revision, or the
@@ -2571,6 +2577,12 @@ def update(ui, repo, node=None, clean=Fa
     By default, update will refuse to run if doing so would require
     discarding local changes.
     """
+    if rev and node:
+        raise util.Abort(_("please specify just one revision"))
+
+    if not node:
+        node = rev
+
     if date:
         if node:
             raise util.Abort(_("you can't specify a revision and a date"))
@@ -2679,8 +2691,9 @@ table = {
           ('d', 'date', '', _('record datecode as commit date')),
           ('', 'parent', '', _('parent to choose when backing out merge')),
           ('u', 'user', '', _('record user as committer')),
+          ('r', 'rev', '', _('revision to backout')),
          ] + walkopts + commitopts,
-         _('hg backout [OPTION]... REV')),
+         _('hg backout [OPTION]... [-r] REV')),
     "branch": (branch,
                [('f', 'force', None,
                  _('set branch name even if it shadows an existing branch'))],
@@ -2855,8 +2868,10 @@ table = {
     "manifest": (manifest, [], _('hg manifest [REV]')),
     "^merge":
         (merge,
-         [('f', 'force', None, _('force a merge with outstanding changes'))],
-         _('hg merge [-f] [REV]')),
+         [('f', 'force', None, _('force a merge with outstanding changes')),
+          ('r', 'rev', '', _('revision to merge')),
+             ],
+         _('hg merge [-f] [[-r] REV]')),
     "outgoing|out": (outgoing,
          [('M', 'no-merges', None, _('do not show merges')),
           ('f', 'force', None,
@@ -2987,8 +3002,9 @@ table = {
     "^update|up|checkout|co":
         (update,
          [('C', 'clean', None, _('overwrite locally modified files')),
-          ('d', 'date', '', _('tipmost revision matching date'))],
-         _('hg update [-C] [-d DATE] [REV]')),
+          ('d', 'date', '', _('tipmost revision matching date')),
+          ('r', 'rev', '', _('revision'))],
+         _('hg update [-C] [-d DATE] [[-r] REV]')),
     "verify": (verify, [], _('hg verify')),
     "version": (version_, [], _('hg version')),
 }



More information about the Mercurial-devel mailing list