update: use revsingle to enable use of revsets as update targets (issue1993)
authorAugie Fackler <durin42@gmail.com>
Mon, 11 Oct 2010 10:07:42 -0500
changeset 12726 61c0df2b089a
parent 12725 24f16c2c6d41
child 12727 52971985be14
update: use revsingle to enable use of revsets as update targets (issue1993)
mercurial/commands.py
tests/test-1993.t
--- a/mercurial/commands.py	Tue Oct 12 11:02:45 2010 -0500
+++ b/mercurial/commands.py	Mon Oct 11 10:07:42 2010 -0500
@@ -927,7 +927,7 @@
             id, ps = data
             p1 = ps[0]
             if p1 != at:
-                update(ui, repo, node=p1, clean=True)
+                update(ui, repo, node=str(p1), clean=True)
                 at = p1
             if repo.dirstate.branch() != atbranch:
                 branch(ui, repo, atbranch, force=True)
@@ -3790,6 +3790,8 @@
     if not rev:
         rev = node
 
+    rev = cmdutil.revsingle(repo, rev, rev).rev()
+
     if check and clean:
         raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-1993.t	Mon Oct 11 10:07:42 2010 -0500
@@ -0,0 +1,46 @@
+  $ hg init a
+  $ cd a
+  $ echo a > a
+  $ hg ci -Am0
+  adding a
+  $ echo b > b
+  $ hg ci -Am1
+  adding b
+  $ hg tag -r0 default
+  warning: tag default conflicts with existing branch name
+  $ hg log
+  changeset:   2:30a83d1e4a1e
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added tag default for changeset f7b1eb17ad24
+  
+  changeset:   1:925d80f479bb
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     1
+  
+  changeset:   0:f7b1eb17ad24
+  tag:         default
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     0
+  
+  $ hg update 'tag(default)'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg parents
+  changeset:   0:f7b1eb17ad24
+  tag:         default
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     0
+  
+  $ hg update 'branch(default)'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg parents
+  changeset:   2:30a83d1e4a1e
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added tag default for changeset f7b1eb17ad24
+