[PATCH 3 of 5] bookmark: consistently checknewlabel after checkconflict

Yuya Nishihara yuya at tcha.org
Wed Jan 13 09:11:42 CST 2016


On Sun, 10 Jan 2016 12:57:50 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1451198555 0
> #      Sun Dec 27 06:42:35 2015 +0000
> # Node ID 1fb445a08991a9bce47a19b02aa3752df3d3cb5e
> # Parent  b15de606bd509eba76554071d9e4e40b1a9bb879
> bookmark: consistently checknewlabel after checkconflict
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1112,8 +1112,6 @@
>                  newact = None
>                  for mark in names:
>                      mark = checkformat(mark)
> -                    if not mark in repo._bookmarks:
> -                        scmutil.checknewlabel(repo, mark, 'bookmark')
>                      if newact is None:
>                          newact = mark
>                      if inactive and mark == repo._activebookmark:
> @@ -1123,6 +1121,8 @@
>                      if rev:
>                          tgt = scmutil.revsingle(repo, rev).node()
>                      checkconflict(repo, mark, cur, force, tgt)
> +                    if not mark in repo._bookmarks:
> +                        scmutil.checknewlabel(repo, mark, 'bookmark')

I would rather do checknewlabel() _before_ checkconflict() because
checknewlabel() is more basic validation. But it would be just a personal
preference.


More information about the Mercurial-devel mailing list