diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -6038,7 +6038,7 @@ def update(ui, repo, node=None, **opts): 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', '')} diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t --- a/tests/test-simple-update.t +++ b/tests/test-simple-update.t @@ -57,6 +57,26 @@ update to rev 0 with a date 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