Patchwork bookmarks: don't deactivate on no-op update (issue4901)

login
register
mail settings
Submitter Matt Mackall
Date Oct. 14, 2015, 11:03 p.m.
Message ID <f88c3c5fda6b06ec7cdf.1444863829@ruin.waste.org>
Download mbox | patch
Permalink /patch/11080/
State Accepted
Headers show

Comments

Matt Mackall - Oct. 14, 2015, 11:03 p.m.
# HG changeset patch
# User Matt Mackall <mpm@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)
Ryan McElroy - Oct. 14, 2015, 11:53 p.m.
On 10/14/2015 4:03 PM, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm@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@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
looks good to me
Augie Fackler - Oct. 15, 2015, 1:07 p.m.
On Wed, Oct 14, 2015 at 04:53:54PM -0700, Ryan McElroy wrote:
> On 10/14/2015 4:03 PM, Matt Mackall wrote:
> ># HG changeset patch
> ># User Matt Mackall <mpm@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@selenic.com
> >https://selenic.com/mailman/listinfo/mercurial-devel
> looks good to me

Looks plausible to me, queued on the basis of our combined reviews. Thanks!

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

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