[PATCH] update: fix check for no rev when a date is given

Idan Kamara idankk86 at gmail.com
Tue Apr 19 06:57:11 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1303214206 -10800
# Node ID 0b37fcad00032da47cdf97c655a22c6370549ca1
# Parent  1184bb274cb3e683e2aabb89d0ebbad322cdb2a2
update: fix check for no rev when a date is given

The previous check caught a corner case in which rev
was pointing to 0.

diff -r 1184bb274cb3 -r 0b37fcad0003 mercurial/commands.py
--- a/mercurial/commands.py	Mon Apr 18 20:52:08 2011 -0500
+++ b/mercurial/commands.py	Tue Apr 19 14:56:46 2011 +0300
@@ -4198,7 +4198,7 @@
             raise util.Abort(_("uncommitted local changes"))
 
     if date:
-        if rev:
+        if rev is not None:
             raise util.Abort(_("you can't specify a revision and a date"))
         rev = cmdutil.finddate(ui, repo, date)
 
diff -r 1184bb274cb3 -r 0b37fcad0003 tests/test-simple-update.t
--- a/tests/test-simple-update.t	Mon Apr 18 20:52:08 2011 -0500
+++ b/tests/test-simple-update.t	Tue Apr 19 14:56:46 2011 +0300
@@ -50,3 +50,8 @@
   $ hg manifest --debug
   6f4310b00b9a147241b071a60c28a650827fb03d 644   foo
 
+update to rev 0 with a date
+
+  $ hg upd -d foo 0
+  abort: you can't specify a revision and a date
+  [255]


More information about the Mercurial-devel mailing list