[PATCH 1 of 2 V6] update: fix bare update to work on new branch (BC)

Yuya Nishihara yuya at tcha.org
Sat Apr 9 06:26:56 EDT 2016


On Tue, 05 Apr 2016 07:53:17 +0200, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1459832013 -7200
> #      Tue Apr 05 06:53:33 2016 +0200
> # Node ID 7c72d229ded37ba1df4f737d738d1e6f0603e069
> # Parent  ff0d3b6b287f89594bd8d0308fe2810d2a18ea01
> update: fix bare update to work on new branch (BC)

This looks good to me, but I have one question.

> --- a/mercurial/destutil.py	Tue Mar 29 12:29:00 2016 -0500
> +++ b/mercurial/destutil.py	Tue Apr 05 06:53:33 2016 +0200
> @@ -102,11 +102,8 @@ def _destupdatebranch(repo, clean, check
>          if bookmarks.isactivewdirparent(repo):
>              movemark = repo['.'].node()
>      else:
> -        if currentbranch == 'default': # no default branch!
> -            # update to the tipmost non-closed branch head
> -            node = repo.revs('max(head() and not closed())').first()
> -        else:
> -            raise error.Abort(_("branch %s not found") % currentbranch)
> +        if repo['.']:
> +            node = repo['.'].node()

Any reason to skip null parent? If no, I'll drop "if repo['.']".


More information about the Mercurial-devel mailing list