update: fix crash on bare update when directaccess is enabled
authorYuya Nishihara <yuya@tcha.org>
Tue, 16 Jan 2018 21:51:27 +0900
changeset 35681 e29823c6d3e8
parent 35680 077ee15b8493
child 35682 8273c1a47282
update: fix crash on bare update when directaccess is enabled 'rev' may be None. An empty 'rev' string shouldn't also be passed to unhidehashlikerevs().
mercurial/commands.py
tests/test-directaccess.t
--- a/mercurial/commands.py	Tue Jan 16 21:42:42 2018 +0900
+++ b/mercurial/commands.py	Tue Jan 16 21:51:27 2018 +0900
@@ -5530,7 +5530,8 @@
 
         # if we defined a bookmark, we have to remember the original name
         brev = rev
-        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+        if rev:
+            repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
         ctx = scmutil.revsingle(repo, rev, rev)
         rev = ctx.rev()
         if ctx.hidden():
--- a/tests/test-directaccess.t	Tue Jan 16 21:42:42 2018 +0900
+++ b/tests/test-directaccess.t	Tue Jan 16 21:51:27 2018 +0900
@@ -162,6 +162,9 @@
   $ hg up 3
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+  $ hg up
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
 `hg revert`
 
   $ hg revert -r 28ad74 --all