Patchwork D6884: bookmarks: remove changectx() method from bmstore (API)

login
register
mail settings
Submitter phabricator
Date Sept. 25, 2019, 10:19 p.m.
Message ID <e9f2bca74c758ae02793891d1058ff7f@localhost.localdomain>
Download mbox | patch
Permalink /patch/41774/
State Not Applicable
Headers show

Comments

phabricator - Sept. 25, 2019, 10:19 p.m.
durin42 updated this revision to Diff 16624.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6884?vs=16623&id=16624

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

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

AFFECTED FILES
  hgext/infinitepush/bundleparts.py
  mercurial/bookmarks.py
  mercurial/discovery.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -301,7 +301,7 @@ 
     for bm in localbookmarks:
         rnode = remotebookmarks.get(bm)
         if rnode and rnode in repo:
-            lctx, rctx = localbookmarks.changectx(bm), repo[rnode]
+            lctx, rctx = repo[localbookmarks[bm]], repo[rnode]
             if bookmarks.validdest(repo, rctx, lctx):
                 bookmarkedheads.add(lctx.node())
         else:
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -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):
diff --git a/hgext/infinitepush/bundleparts.py b/hgext/infinitepush/bundleparts.py
--- a/hgext/infinitepush/bundleparts.py
+++ b/hgext/infinitepush/bundleparts.py
@@ -12,6 +12,7 @@ 
     changegroup,
     error,
     extensions,
+    node as nodemod,
     revsetlang,
     util,
 )
@@ -48,7 +49,7 @@ 
         params['bookprevnode'] = ''
         bookmarks = repo._bookmarks
         if bookmark in bookmarks:
-            params['bookprevnode'] = bookmarks.changectx(bookmark).hex()
+            params['bookprevnode'] = nodemod.hex(bookmarks[bookmark])
 
     # Do not send pushback bundle2 part with bookmarks if remotenames extension
     # is enabled. It will be handled manually in `_push()`