[PATCH] bookmarks: don't deactivate on no-op update (issue4901)

Ryan McElroy rm at fb.com
Wed Oct 14 18:53:54 CDT 2015


On 10/14/2015 4:03 PM, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1444863797 18000
> #      Wed Oct 14 18:03:17 2015 -0500
> # Node ID f88c3c5fda6b06ec7cdf3f3aab46155af9c7e864
> # Parent  07db7e95c464537aeb2dd7aba39de0813eaffd04
> bookmarks: don't deactivate on no-op update (issue4901)
>
> diff -r 07db7e95c464 -r f88c3c5fda6b mercurial/commands.py
> --- a/mercurial/commands.py	Tue Oct 13 14:17:15 2015 -0700
> +++ b/mercurial/commands.py	Wed Oct 14 18:03:17 2015 -0500
> @@ -6619,7 +6619,9 @@
>               ret = hg.update(repo, rev)
>   
>           if not ret and movemarkfrom:
> -            if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
> +            if movemarkfrom == repo['.'].node():
> +                pass # no-op update
> +            elif bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
>                   ui.status(_("updating bookmark %s\n") % repo._activebookmark)
>               else:
>                   # this can happen with a non-linear update
> diff -r 07db7e95c464 -r f88c3c5fda6b tests/test-bookmarks.t
> --- a/tests/test-bookmarks.t	Tue Oct 13 14:17:15 2015 -0700
> +++ b/tests/test-bookmarks.t	Wed Oct 14 18:03:17 2015 -0500
> @@ -732,6 +732,19 @@
>     1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>     (activating bookmark four)
>   
> +no-op update doesn't deactive bookmarks
> +
> +  $ hg up
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  $ hg sum
> +  parent: 3:9ba5f110a0b3 tip
> +   y
> +  branch: test
> +  bookmarks: *four
> +  commit: 2 unknown (clean)
> +  update: (current)
> +  phases: 4 draft
> +
>   test clearing divergent bookmarks of linear ancestors
>   
>     $ hg bookmark Z -r 0
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
looks good to me


More information about the Mercurial-devel mailing list