[PATCH V11] update: fix bare --clean to work on new branch (issue5003) (BC)

Yuya Nishihara yuya at tcha.org
Wed May 25 09:32:25 EDT 2016


On Mon, 23 May 2016 07:39:55 +0200, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1459834201 -7200
> #      Tue Apr 05 07:30:01 2016 +0200
> # Node ID 880899828fc8bc6b30876425e87924e4fd8476ee
> # Parent  bdba6a2015d0bc57c6e2beab25d138610dcbf360
> update: fix bare --clean to work on new branch (issue5003) (BC)

Looks mostly good, but many tests failed.

> diff --git a/mercurial/destutil.py b/mercurial/destutil.py
> --- a/mercurial/destutil.py
> +++ b/mercurial/destutil.py
> @@ -95,9 +95,16 @@ def _destupdatebranch(repo, clean, check
>      wc = repo[None]
>      movemark = node = None
>      currentbranch = wc.branch()
> +
> +    if clean and wc.p1():
> +        currentbranch = repo['.'].branch()

(This isn't that important, but...) what should we do for the following
scenario?

  $ cd repo-with-no-default-branch
  $ hg update null
  $ hg branch new-branch
  $ hg update -C

I expect it will discard "new-branch" and move to "default" or tip-most
branch head.

>      if currentbranch in repo.branchmap():
>          heads = repo.branchheads(currentbranch)
>          if heads:
> +            if clean:
> +                repo.ui.warn(_('updating to the head of parent branch %s\n')
> +                             % currentbranch)

We have many "update -C" in our tests, and they are broken. And I don't think
we would want this warning in ordinary cases.

What's the purpose of this warning?


More information about the Mercurial-devel mailing list