[PATCH] bookmarks: allow pushkey if new equals current

Augie Fackler raf at durin42.com
Tue Aug 26 14:05:42 CDT 2014


On Tue, Aug 26, 2014 at 06:56:15AM -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1409054321 25200
> #      Tue Aug 26 04:58:41 2014 -0700
> # Node ID c27758084fdb17115211958666f3184282291143
> # Parent  7eef5a87ce3ff761711c69526bf422fdc2dc696d
> bookmarks: allow pushkey if new equals current

Seems reasonable. Queued.

>
> Previously a bookmark pushkey would be rejected if the specified 'old' value
> didn't match the servers 'current' value. This change allows this situation, as
> long as the 'current' server value equals the 'new' pushkey value already.
>
> We are trying to write a hook that forces a server bookmark to move forward,
> using a changegroup hook. If the user also pushed the bookmark, they would get
> an error, since they computed their pushkey (old,new) pair before the server
> moved the bookmark. Long term, bundle2 will let us do this more smartly, but
> this change seems reasonable for now.
>
> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -228,7 +228,8 @@
>      w = repo.wlock()
>      try:
>          marks = repo._bookmarks
> -        if hex(marks.get(key, '')) != old:
> +        existing = hex(marks.get(key, ''))
> +        if existing != old and existing != new:
>              return False
>          if new == '':
>              del marks[key]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list