D8116: bookmarks: refactor in preparation for next commit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

D8116: bookmarks: refactor in preparation for next commit

marmoute (Pierre-Yves David)
valentin.gatienbaron created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8116

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -460,6 +460,8 @@
             marks.applychanges(repo, tr, bmchanges)
     return bool(bmchanges)
 
+def isdivergent(b):
+    return b'@' in b and not b.endswith(b'@')
 
 def listbinbookmarks(repo):
     # We may try to list bookmarks on a repo type that does not
@@ -469,7 +471,7 @@
     hasnode = repo.changelog.hasnode
     for k, v in pycompat.iteritems(marks):
         # don't expose local divergent bookmarks
-        if hasnode(v) and (b'@' not in k or k.endswith(b'@')):
+        if hasnode(v) and not isdivergent(k):
             yield k, v
 
 



To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8116: bookmarks: refactor in preparation for next commit

marmoute (Pierre-Yves David)
pulkit added a comment.


  Amended the following in flight to `test-check-format.t` happy:
 
    diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
    --- a/mercurial/bookmarks.py
    +++ b/mercurial/bookmarks.py
    @@ -462,9 +462,11 @@ def update(repo, parents, node):
                 marks.applychanges(repo, tr, bmchanges)
         return bool(bmchanges)
     
    +
     def isdivergent(b):
         return b'@' in b and not b.endswith(b'@')
     
    +
     def listbinbookmarks(repo):
         # We may try to list bookmarks on a repo type that does not
         # support it (e.g., statichttprepository).

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8116/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8116

To: valentin.gatienbaron, #hg-reviewers, pulkit
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8116: bookmarks: refactor in preparation for next commit

marmoute (Pierre-Yves David)
In reply to this post by marmoute (Pierre-Yves David)
Closed by commit rHG0275000564c4: bookmarks: refactor in preparation for next commit (authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D8116?vs=20210&id=20271#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8116?vs=20210&id=20271

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8116/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8116

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -463,6 +463,10 @@
     return bool(bmchanges)
 
 
+def isdivergent(b):
+    return b'@' in b and not b.endswith(b'@')
+
+
 def listbinbookmarks(repo):
     # We may try to list bookmarks on a repo type that does not
     # support it (e.g., statichttprepository).
@@ -471,7 +475,7 @@
     hasnode = repo.changelog.hasnode
     for k, v in pycompat.iteritems(marks):
         # don't expose local divergent bookmarks
-        if hasnode(v) and (b'@' not in k or k.endswith(b'@')):
+        if hasnode(v) and not isdivergent(k):
             yield k, v
 
 



To: valentin.gatienbaron, #hg-reviewers, pulkit
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8116: bookmarks: refactor in preparation for next commit

marmoute (Pierre-Yves David)
In reply to this post by marmoute (Pierre-Yves David)
valentin.gatienbaron added a comment.


  Sorry, I had tried installing black, but it was not the right version. After looking some more, `pip3 install black` is what was needed I think.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8116/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8116

To: valentin.gatienbaron, #hg-reviewers, pulkit
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel