Patchwork update: fix crash on bare update when directaccess is enabled

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 16, 2018, 2:25 p.m.
Message ID <14f119c9ff3630859b64.1516112726@mimosa>
Download mbox | patch
Permalink /patch/26787/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 16, 2018, 2:25 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1516107087 -32400
#      Tue Jan 16 21:51:27 2018 +0900
# Node ID 14f119c9ff3630859b64e207b389c49d68840b96
# Parent  1700a9086c9cd3777a35f3e9212cdc0826d7b26b
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().
Pulkit Goyal - Jan. 16, 2018, 2:28 p.m.
Oops, thanks for the fix. Looks good to me.

On Tue, Jan 16, 2018 at 7:55 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1516107087 -32400
> #      Tue Jan 16 21:51:27 2018 +0900
> # Node ID 14f119c9ff3630859b64e207b389c49d68840b96
> # Parent  1700a9086c9cd3777a35f3e9212cdc0826d7b26b
> 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().
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -5530,7 +5530,8 @@ def update(ui, repo, node=None, rev=None
>
>          # 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():
> diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t
> --- a/tests/test-directaccess.t
> +++ b/tests/test-directaccess.t
> @@ -162,6 +162,9 @@ This should not throw error
>    $ 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Augie Fackler - Jan. 17, 2018, 10:42 p.m.
On Tue, Jan 16, 2018 at 11:25:26PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1516107087 -32400
> #      Tue Jan 16 21:51:27 2018 +0900
> # Node ID 14f119c9ff3630859b64e207b389c49d68840b96
> # Parent  1700a9086c9cd3777a35f3e9212cdc0826d7b26b
> update: fix crash on bare update when directaccess is enabled

queued, thanks

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5530,7 +5530,8 @@  def update(ui, repo, node=None, rev=None
 
         # 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():
diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t
--- a/tests/test-directaccess.t
+++ b/tests/test-directaccess.t
@@ -162,6 +162,9 @@  This should not throw error
   $ 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