equal
deleted
inserted
replaced
117 return dict.__delitem__(self, key) |
117 return dict.__delitem__(self, key) |
118 |
118 |
119 def update(self, *others): |
119 def update(self, *others): |
120 raise error.ProgrammingError("use 'bookmarks.applychanges' instead") |
120 raise error.ProgrammingError("use 'bookmarks.applychanges' instead") |
121 |
121 |
|
122 def changectx(self, mark): |
|
123 return self._repo[self[mark]] |
|
124 |
122 def applychanges(self, repo, tr, changes): |
125 def applychanges(self, repo, tr, changes): |
123 """Apply a list of changes to bookmarks |
126 """Apply a list of changes to bookmarks |
124 """ |
127 """ |
125 bmchanges = tr.changes.get('bookmarks') |
128 bmchanges = tr.changes.get('bookmarks') |
126 for name, node in changes: |
129 for name, node in changes: |
210 if self[mark] == target and target == cur: |
213 if self[mark] == target and target == cur: |
211 # re-activating a bookmark |
214 # re-activating a bookmark |
212 return [] |
215 return [] |
213 rev = self._repo[target].rev() |
216 rev = self._repo[target].rev() |
214 anc = self._repo.changelog.ancestors([rev]) |
217 anc = self._repo.changelog.ancestors([rev]) |
215 bmctx = self._repo[self[mark]] |
218 bmctx = self.changectx(mark) |
216 divs = [self._repo[b].node() for b in self |
219 divs = [self[b] for b in self |
217 if b.split('@', 1)[0] == mark.split('@', 1)[0]] |
220 if b.split('@', 1)[0] == mark.split('@', 1)[0]] |
218 |
221 |
219 # allow resolving a single divergent bookmark even if moving |
222 # allow resolving a single divergent bookmark even if moving |
220 # the bookmark across branches when a revision is specified |
223 # the bookmark across branches when a revision is specified |
221 # that contains a divergent bookmark |
224 # that contains a divergent bookmark |
368 return False |
371 return False |
369 |
372 |
370 bmchanges = [] |
373 bmchanges = [] |
371 if marks[active] in parents: |
374 if marks[active] in parents: |
372 new = repo[node] |
375 new = repo[node] |
373 divs = [repo[b] for b in marks |
376 divs = [marks.changectx(b) for b in marks |
374 if b.split('@', 1)[0] == active.split('@', 1)[0]] |
377 if b.split('@', 1)[0] == active.split('@', 1)[0]] |
375 anc = repo.changelog.ancestors([new.rev()]) |
378 anc = repo.changelog.ancestors([new.rev()]) |
376 deletefrom = [b.node() for b in divs if b.rev() in anc or b == new] |
379 deletefrom = [b.node() for b in divs if b.rev() in anc or b == new] |
377 if validdest(repo, repo[marks[active]], new): |
380 if validdest(repo, marks.changectx(active), new): |
378 bmchanges.append((active, new.node())) |
381 bmchanges.append((active, new.node())) |
379 |
382 |
380 for bm in divergent2delete(repo, deletefrom, active): |
383 for bm in divergent2delete(repo, deletefrom, active): |
381 bmchanges.append((bm, None)) |
384 bmchanges.append((bm, None)) |
382 |
385 |