[PATCH] update: fix crash on bare update when directaccess is enabled

Pulkit Goyal 7895pulkit at gmail.com
Tue Jan 16 09:28:42 EST 2018


Oops, thanks for the fix. Looks good to me.

On Tue, Jan 16, 2018 at 7:55 PM, Yuya Nishihara <yuya at tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at 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 at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list