##// END OF EJS Templates
bookmark: use 'divergent2delete' in checkconflict...
Boris Feld -
r33513:904894ed default
parent child Browse files
Show More
@@ -183,13 +183,15 b' class bmstore(dict):'
183 183
184 184 If force is supplied, then forcibly move the bookmark to a new commit
185 185 regardless if it is a move forward.
186
187 If divergent bookmark are to be deleted, they will be returned as list.
186 188 """
187 189 cur = self._repo.changectx('.').node()
188 190 if mark in self and not force:
189 191 if target:
190 192 if self[mark] == target and target == cur:
191 193 # re-activating a bookmark
192 return
194 return []
193 195 rev = self._repo[target].rev()
194 196 anc = self._repo.changelog.ancestors([rev])
195 197 bmctx = self._repo[self[mark]]
@@ -200,17 +202,16 b' class bmstore(dict):'
200 202 # the bookmark across branches when a revision is specified
201 203 # that contains a divergent bookmark
202 204 if bmctx.rev() not in anc and target in divs:
203 deletedivergent(self._repo, [target], mark)
204 return
205 return divergent2delete(self._repo, [target], mark)
205 206
206 207 deletefrom = [b for b in divs
207 208 if self._repo[b].rev() in anc or b == target]
208 deletedivergent(self._repo, deletefrom, mark)
209 delbms = divergent2delete(self._repo, deletefrom, mark)
209 210 if validdest(self._repo, bmctx, self._repo[target]):
210 211 self._repo.ui.status(
211 212 _("moving bookmark '%s' forward from %s\n") %
212 213 (mark, short(bmctx.node())))
213 return
214 return delbms
214 215 raise error.Abort(_("bookmark '%s' already exists "
215 216 "(use -f to force)") % mark)
216 217 if ((mark in self._repo.branchmap() or
@@ -228,6 +229,7 b' class bmstore(dict):'
228 229 "(did you leave a -r out of an 'hg bookmark' "
229 230 "command?)\n")
230 231 % mark)
232 return []
231 233
232 234 def _readactive(repo, marks):
233 235 """
@@ -747,8 +749,10 b' def rename(repo, tr, old, new, force=Fal'
747 749 mark = checkformat(repo, new)
748 750 if old not in marks:
749 751 raise error.Abort(_("bookmark '%s' does not exist") % old)
750 marks.checkconflict(mark, force)
751 changes = [(mark, marks[old]), (old, None)]
752 changes = []
753 for bm in marks.checkconflict(mark, force):
754 changes.append((bm, None))
755 changes.extend([(mark, marks[old]), (old, None)])
752 756 marks.applychanges(repo, tr, changes)
753 757 if repo._activebookmark == old and not inactive:
754 758 activate(repo, mark)
@@ -778,7 +782,8 b' def addbookmarks(repo, tr, names, rev=No'
778 782 tgt = cur
779 783 if rev:
780 784 tgt = scmutil.revsingle(repo, rev).node()
781 marks.checkconflict(mark, force, tgt)
785 for bm in marks.checkconflict(mark, force, tgt):
786 changes.append((bm, None))
782 787 changes.append((mark, tgt))
783 788 marks.applychanges(repo, tr, changes)
784 789 if not inactive and cur == marks[newact] and not rev:
General Comments 0
You need to be logged in to leave comments. Login now