diff mercurial/bookmarks.py @ 42980:e3bb2a58af1e

bookmarks: remove changectx() method from bmstore (API) All the callsites of this method have access to the repo, and I'd rather not have to duplicate this across alternative bmstore implementations. Besides, it feels like a bit of a layering violation. .. api:: `mercurial.bookmarks.bmstore` no longer has a convenience method for looking up changectx instances from a bookmark name. Use `repo[repo.bookmarks[name]]` intead of `repo.bookmarks.changectx(name)`. Differential Revision: https://phab.mercurial-scm.org/D6884
author Augie Fackler <augie@google.com>
date Wed, 25 Sep 2019 17:57:16 -0400
parents 08fce968d00b
children 2372284d9457
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Wed Sep 25 13:50:48 2019 -0400
+++ b/mercurial/bookmarks.py	Wed Sep 25 17:57:16 2019 -0400
@@ -177,10 +177,6 @@
         """Return a sorted list of bookmarks pointing to the specified node"""
         return self._nodemap.get(node, [])
 
-    def changectx(self, mark):
-        node = self._refmap[mark]
-        return self._repo[node]
-
     def applychanges(self, repo, tr, changes):
         """Apply a list of changes to bookmarks
         """
@@ -271,7 +267,7 @@
                     return []
                 rev = self._repo[target].rev()
                 anc = self._repo.changelog.ancestors([rev])
-                bmctx = self.changectx(mark)
+                bmctx = self._repo[self[mark]]
                 divs = [self._refmap[b] for b in self._refmap
                         if b.split('@', 1)[0] == mark.split('@', 1)[0]]
 
@@ -412,11 +408,11 @@
     bmchanges = []
     if marks[active] in parents:
         new = repo[node]
-        divs = [marks.changectx(b) for b in marks
+        divs = [repo[marks[b]] for b in marks
                 if b.split('@', 1)[0] == active.split('@', 1)[0]]
         anc = repo.changelog.ancestors([new.rev()])
         deletefrom = [b.node() for b in divs if b.rev() in anc or b == new]
-        if validdest(repo, marks.changectx(active), new):
+        if validdest(repo, repo[marks[active]], new):
             bmchanges.append((active, new.node()))
 
     for bm in divergent2delete(repo, deletefrom, active):