Patchwork D3162: bookmarks: introduce a repo._bookmarks.changectx(mark) method and use it

login
register
mail settings
Submitter phabricator
Date April 6, 2018, 11:42 p.m.
Message ID <ac84c782e19e12c949e8833332ade64d@localhost.localdomain>
Download mbox | patch
Permalink /patch/30477/
State Not Applicable
Headers show

Comments

phabricator - April 6, 2018, 11:42 p.m.
martinvonz updated this revision to Diff 7818.
martinvonz retitled this revision from "bookmarks: introduce a repo._bookmarks.ctx(mark) method and use it" to "bookmarks: introduce a repo._bookmarks.changectx(mark) method and use it".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3162?vs=7795&id=7818

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

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: indygreg, mercurial-devel

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -119,6 +119,9 @@ 
     def update(self, *others):
         raise error.ProgrammingError("use 'bookmarks.applychanges' instead")
 
+    def changectx(self, mark):
+        return self._repo[self[mark]]
+
     def applychanges(self, repo, tr, changes):
         """Apply a list of changes to bookmarks
         """
@@ -212,8 +215,8 @@ 
                     return []
                 rev = self._repo[target].rev()
                 anc = self._repo.changelog.ancestors([rev])
-                bmctx = self._repo[self[mark]]
-                divs = [self._repo[b].node() for b in self
+                bmctx = self.changectx(mark)
+                divs = [self[b] for b in self
                         if b.split('@', 1)[0] == mark.split('@', 1)[0]]
 
                 # allow resolving a single divergent bookmark even if moving
@@ -370,11 +373,11 @@ 
     bmchanges = []
     if marks[active] in parents:
         new = repo[node]
-        divs = [repo[b] for b in marks
+        divs = [marks.changectx(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, repo[marks[active]], new):
+        if validdest(repo, marks.changectx(active), new):
             bmchanges.append((active, new.node()))
 
     for bm in divergent2delete(repo, deletefrom, active):