[PATCH V3] mercurial: fixes update --clean to work on new branch (issue5003)
Yuya Nishihara
yuya at tcha.org
Thu Mar 3 07:48:09 EST 2016
On Tue, 01 Mar 2016 13:41:28 +0100, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1456249877 -3600
> # Tue Feb 23 18:51:17 2016 +0100
> # Node ID e613c6bf045f1d3f291867bace4cbe43dbbb53fa
> # Parent c7f89ad87baef87f00c507545dfd4cc824bc3131
> mercurial: fixes update --clean to work on new branch (issue5003)
Looks good to me. I expect Pierre-Yves will do a last-minute check.
> diff -r c7f89ad87bae -r e613c6bf045f mercurial/destutil.py
> --- a/mercurial/destutil.py Mon Feb 29 17:52:17 2016 -0600
> +++ b/mercurial/destutil.py Tue Feb 23 18:51:17 2016 +0100
> @@ -99,10 +99,15 @@ def _destupdatebranch(repo, clean, check
> if bookmarks.isactivewdirparent(repo):
> movemark = repo['.'].node()
> else:
> - if currentbranch == 'default': # no default branch!
> - node = repo.lookup('tip') # update to tip
> + if clean:
> + node = repo['.'].node()
> + repo.ui.warn(_('uncommited branch %s does not exist yet, '
> + 'updating to parent\n') % currentbranch)
Nit: I would insert "elif clean:" instead of nesting "else"s.
> else:
> - raise error.Abort(_("branch %s not found") % currentbranch)
> + if currentbranch == 'default': # no default branch!
> + node = repo.lookup('tip') # update to tip
> + else:
> + raise error.Abort(_("branch %s not found") % currentbranch)
> return node, movemark, None
More information about the Mercurial-devel
mailing list