[PATCH] bookmarks: resolve divergent bookmark when moving forward

Stephen Lee sphen.lee at gmail.com
Wed Mar 27 21:14:44 CDT 2013


On Thu, Mar 28, 2013 at 9:41 AM, Sean Farley
<sean.michael.farley at gmail.com> wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1364421288 18000
> #      Wed Mar 27 16:54:48 2013 -0500
> # Node ID 3839baf52f2f24c289487111a95e9e835d1e1c4d
> # Parent  a7d0ddc7540b2691f8a5af8006588a80e582754a
> bookmarks: resolve divergent bookmark when moving forward
>
> This patch handles both cases of moving a bookmark forward 1) when running 'hg
> up' on a bookmark that has descendents, and 2) when running 'hg book NAME' on a
> descendents of a the active bookmark.
>

What do you mean by "handling" these cases? What happens before and
after this patch?
I'm interested in making the bookmark workflow smoother - in what way
does this help?

Thanks,
Steve

> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -182,11 +182,11 @@
>          new = repo[node]
>          if old.descendant(new):
>              marks[cur] = new.node()
>              update = True
>
> -    if deletedivergent(repo, parents, cur):
> +    if deletedivergent(repo, parents, cur) or deletedivergent(repo, node, cur):
>          update = True
>
>      if update:
>          marks.write()
>      return update
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -865,10 +865,11 @@
>          tgt = cur
>          if rev:
>              tgt = scmutil.revsingle(repo, rev).node()
>          checkconflict(repo, mark, force, tgt)
>          marks[mark] = tgt
> +        bookmarks.deletedivergent(repo, [tgt], mark)
>          if not inactive and cur == marks[mark]:
>              bookmarks.setcurrent(repo, mark)
>          elif cur != tgt and mark == repo._bookmarkcurrent:
>              bookmarks.setcurrent(repo, None)
>          marks.write()


More information about the Mercurial-devel mailing list