changeset 41020:fbd5e2f0bba7 stable

update: do not pass in user revspec as default destination (issue6044) When the revsingle() was introduced at 61c0df2b089a, it couldn't handle revspec=0 (not '0') properly. That's probably why the default was set to rev. This is technically BC since "hg update ''" was identical to "hg update '.'" whereas "hg update -r ''" is "hg update", but I believe that's a bug given no test fails with this change.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 02 Jan 2019 09:41:04 +0900
parents 7542466b94e2
children 70e3e3da24be
files mercurial/commands.py tests/test-simple-update.t
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Dec 30 16:11:06 2018 +0100
+++ b/mercurial/commands.py	Wed Jan 02 09:41:04 2019 +0900
@@ -6038,7 +6038,7 @@
         brev = rev
         if rev:
             repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
-        ctx = scmutil.revsingle(repo, rev, rev)
+        ctx = scmutil.revsingle(repo, rev, default=None)
         rev = ctx.rev()
         hidden = ctx.hidden()
         overrides = {('ui', 'forcemerge'): opts.get(r'tool', '')}
--- a/tests/test-simple-update.t	Sun Dec 30 16:11:06 2018 +0100
+++ b/tests/test-simple-update.t	Wed Jan 02 09:41:04 2019 +0900
@@ -57,6 +57,26 @@
   abort: you can't specify a revision and a date
   [255]
 
+update to default destination (with empty revspec)
+
+  $ hg update -q null
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id
+  30aff43faee1 tip
+
+  $ hg update -q null
+  $ hg update -r ''
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id
+  30aff43faee1 tip
+
+  $ hg update -q null
+  $ hg update ''
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id
+  30aff43faee1 tip
+
   $ cd ..
 
 update with worker processes