##// END OF EJS Templates
bookmarks: allow moving a bookmark forward to a descendant...
Kevin Bullock -
r18773:56dd55da default
parent child Browse files
Show More
@@ -808,8 +808,15 b' def bookmark(ui, repo, mark=None, rev=No'
808 808 scmutil.checknewlabel(repo, mark, 'bookmark')
809 809 return mark
810 810
811 def checkconflict(repo, mark, force=False):
811 def checkconflict(repo, mark, force=False, target=None):
812 812 if mark in marks and not force:
813 if target:
814 anc = repo.changelog.ancestors([repo[target].rev()])
815 bmctx = repo[marks[mark]]
816 if bmctx.rev() in anc:
817 ui.status(_("moving bookmark '%s' forward from %s\n") %
818 (mark, short(bmctx.node())))
819 return
813 820 raise util.Abort(_("bookmark '%s' already exists "
814 821 "(use -f to force)") % mark)
815 822 if ((mark in repo.branchmap() or mark == repo.dirstate.branch())
@@ -852,11 +859,11 b' def bookmark(ui, repo, mark=None, rev=No'
852 859 if inactive and mark == repo._bookmarkcurrent:
853 860 bookmarks.setcurrent(repo, None)
854 861 return
855 checkconflict(repo, mark, force)
862 tgt = cur
856 863 if rev:
857 marks[mark] = scmutil.revsingle(repo, rev).node()
858 else:
859 marks[mark] = cur
864 tgt = scmutil.revsingle(repo, rev).node()
865 checkconflict(repo, mark, force, tgt)
866 marks[mark] = tgt
860 867 if not inactive and cur == marks[mark]:
861 868 bookmarks.setcurrent(repo, mark)
862 869 marks.write()
@@ -239,8 +239,8 b' bookmark with reserved name'
239 239
240 240 bookmark with existing name
241 241
242 $ hg bookmark Z
243 abort: bookmark 'Z' already exists (use -f to force)
242 $ hg bookmark X2
243 abort: bookmark 'X2' already exists (use -f to force)
244 244 [255]
245 245
246 246 $ hg bookmark -m Y Z
@@ -279,7 +279,13 b' incompatible options'
279 279
280 280 force bookmark with existing name
281 281
282 $ hg bookmark -f Z
282 $ hg bookmark -f X2
283 $ hg bookmark -fr1 X2
284
285 forward bookmark to descendant without --force
286
287 $ hg bookmark Z
288 moving bookmark 'Z' forward from 663762316562
283 289
284 290 list bookmarks
285 291
General Comments 0
You need to be logged in to leave comments. Login now