[PATCH 2 of 6] commands: allow rev to be a number (including 0)
Simon Heimberg
simohe at besonet.ch
Sun Sep 11 10:46:22 CDT 2011
# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1315426900 -7200
# Node ID d6e84a781824ee3cce1571bda167a18a6d8f042f
# Parent 37e014596b3ac292d90fa2a92faa06ca390c50ad
commands: allow rev to be a number (including 0)
fixes issue2992
diff -r 37e014596b3a -r d6e84a781824 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"))
@@ -594,7 +597,7 @@
# update state
- if rev:
+ if rev or rev == 0:
nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])]
else:
nodes = [repo.lookup('.')]
@@ -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 d6e84a781824 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