[PATCH 2 of 4] commands: allow rev to be a number (including 0)

Simon Heimberg simohe at besonet.ch
Sun Sep 11 10:29:06 CDT 2011


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1315426900 -7200
# Node ID 3410d54800d1cd162b5702c42da447a18c563217
# Parent  37e014596b3ac292d90fa2a92faa06ca390c50ad
commands: allow rev to be a number (including 0)

fixes issue2992

diff -r 37e014596b3a -r 3410d54800d1 mercurial/commands.py
--- a/mercurial/commands.py	Mit Sep 07 18:22:32 2011 +0200
+++ b/mercurial/commands.py	Mit Sep 07 22:21:40 2011 +0200
@@ -380,6 +380,9 @@
 
     Returns 0 on success.
     '''
+
+    if rev == 0:
+        rev = "0"
     if rev and node:
         raise util.Abort(_("please specify just one revision"))
 
@@ -698,6 +701,8 @@
         bookmarks.write(repo)
         return
 
+    if rev == 0:
+        rev = "0" # set a true value
     if mark is not None:
         if "\n" in mark:
             raise util.Abort(_("bookmark name cannot contain newlines"))
@@ -2931,6 +2936,8 @@
         repo = hg.peer(ui, {}, source)
         revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
 
+    if rev == 0:
+        rev = "0"
     if not repo.local():
         if num or branch or tags:
             raise util.Abort(
diff -r 37e014596b3a -r 3410d54800d1 mercurial/hg.py
--- a/mercurial/hg.py	Mit Sep 07 18:22:32 2011 +0200
+++ b/mercurial/hg.py	Mit Sep 07 22:21:40 2011 +0200
@@ -336,7 +336,7 @@
                 raise
 
             revs = None
-            if rev:
+            if rev or rev == 0:
                 if not srcrepo.capable('lookup'):
                     raise util.Abort(_("src repository does not support "
                                        "revision lookup and so doesn't "


More information about the Mercurial-devel mailing list