##// END OF EJS Templates
bookmarks: remove changectx() method from bmstore (API)...
Augie Fackler -
r43248:e3bb2a58 default
parent child Browse files
Show More
@@ -12,6 +12,7 from mercurial import (
12 changegroup,
12 changegroup,
13 error,
13 error,
14 extensions,
14 extensions,
15 node as nodemod,
15 revsetlang,
16 revsetlang,
16 util,
17 util,
17 )
18 )
@@ -48,7 +49,7 def getscratchbranchparts(repo, peer, ou
48 params['bookprevnode'] = ''
49 params['bookprevnode'] = ''
49 bookmarks = repo._bookmarks
50 bookmarks = repo._bookmarks
50 if bookmark in bookmarks:
51 if bookmark in bookmarks:
51 params['bookprevnode'] = bookmarks.changectx(bookmark).hex()
52 params['bookprevnode'] = nodemod.hex(bookmarks[bookmark])
52
53
53 # Do not send pushback bundle2 part with bookmarks if remotenames extension
54 # Do not send pushback bundle2 part with bookmarks if remotenames extension
54 # is enabled. It will be handled manually in `_push()`
55 # is enabled. It will be handled manually in `_push()`
@@ -177,10 +177,6 class bmstore(object):
177 """Return a sorted list of bookmarks pointing to the specified node"""
177 """Return a sorted list of bookmarks pointing to the specified node"""
178 return self._nodemap.get(node, [])
178 return self._nodemap.get(node, [])
179
179
180 def changectx(self, mark):
181 node = self._refmap[mark]
182 return self._repo[node]
183
184 def applychanges(self, repo, tr, changes):
180 def applychanges(self, repo, tr, changes):
185 """Apply a list of changes to bookmarks
181 """Apply a list of changes to bookmarks
186 """
182 """
@@ -271,7 +267,7 class bmstore(object):
271 return []
267 return []
272 rev = self._repo[target].rev()
268 rev = self._repo[target].rev()
273 anc = self._repo.changelog.ancestors([rev])
269 anc = self._repo.changelog.ancestors([rev])
274 bmctx = self.changectx(mark)
270 bmctx = self._repo[self[mark]]
275 divs = [self._refmap[b] for b in self._refmap
271 divs = [self._refmap[b] for b in self._refmap
276 if b.split('@', 1)[0] == mark.split('@', 1)[0]]
272 if b.split('@', 1)[0] == mark.split('@', 1)[0]]
277
273
@@ -412,11 +408,11 def update(repo, parents, node):
412 bmchanges = []
408 bmchanges = []
413 if marks[active] in parents:
409 if marks[active] in parents:
414 new = repo[node]
410 new = repo[node]
415 divs = [marks.changectx(b) for b in marks
411 divs = [repo[marks[b]] for b in marks
416 if b.split('@', 1)[0] == active.split('@', 1)[0]]
412 if b.split('@', 1)[0] == active.split('@', 1)[0]]
417 anc = repo.changelog.ancestors([new.rev()])
413 anc = repo.changelog.ancestors([new.rev()])
418 deletefrom = [b.node() for b in divs if b.rev() in anc or b == new]
414 deletefrom = [b.node() for b in divs if b.rev() in anc or b == new]
419 if validdest(repo, marks.changectx(active), new):
415 if validdest(repo, repo[marks[active]], new):
420 bmchanges.append((active, new.node()))
416 bmchanges.append((active, new.node()))
421
417
422 for bm in divergent2delete(repo, deletefrom, active):
418 for bm in divergent2delete(repo, deletefrom, active):
@@ -301,7 +301,7 def _nowarnheads(pushop):
301 for bm in localbookmarks:
301 for bm in localbookmarks:
302 rnode = remotebookmarks.get(bm)
302 rnode = remotebookmarks.get(bm)
303 if rnode and rnode in repo:
303 if rnode and rnode in repo:
304 lctx, rctx = localbookmarks.changectx(bm), repo[rnode]
304 lctx, rctx = repo[localbookmarks[bm]], repo[rnode]
305 if bookmarks.validdest(repo, rctx, lctx):
305 if bookmarks.validdest(repo, rctx, lctx):
306 bookmarkedheads.add(lctx.node())
306 bookmarkedheads.add(lctx.node())
307 else:
307 else:
General Comments 0
You need to be logged in to leave comments. Login now