Show More
@@ -808,8 +808,15 b' def bookmark(ui, repo, mark=None, rev=No' | |||||
808 | scmutil.checknewlabel(repo, mark, 'bookmark') |
|
808 | scmutil.checknewlabel(repo, mark, 'bookmark') | |
809 | return mark |
|
809 | return mark | |
810 |
|
810 | |||
811 | def checkconflict(repo, mark, force=False): |
|
811 | def checkconflict(repo, mark, force=False, target=None): | |
812 | if mark in marks and not force: |
|
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 | raise util.Abort(_("bookmark '%s' already exists " |
|
820 | raise util.Abort(_("bookmark '%s' already exists " | |
814 | "(use -f to force)") % mark) |
|
821 | "(use -f to force)") % mark) | |
815 | if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) |
|
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 | if inactive and mark == repo._bookmarkcurrent: |
|
859 | if inactive and mark == repo._bookmarkcurrent: | |
853 | bookmarks.setcurrent(repo, None) |
|
860 | bookmarks.setcurrent(repo, None) | |
854 | return |
|
861 | return | |
855 | checkconflict(repo, mark, force) |
|
862 | tgt = cur | |
856 | if rev: |
|
863 | if rev: | |
857 |
|
|
864 | tgt = scmutil.revsingle(repo, rev).node() | |
858 | else: |
|
865 | checkconflict(repo, mark, force, tgt) | |
859 |
|
|
866 | marks[mark] = tgt | |
860 | if not inactive and cur == marks[mark]: |
|
867 | if not inactive and cur == marks[mark]: | |
861 | bookmarks.setcurrent(repo, mark) |
|
868 | bookmarks.setcurrent(repo, mark) | |
862 | marks.write() |
|
869 | marks.write() |
@@ -239,8 +239,8 b' bookmark with reserved name' | |||||
239 |
|
239 | |||
240 | bookmark with existing name |
|
240 | bookmark with existing name | |
241 |
|
241 | |||
242 |
$ hg bookmark |
|
242 | $ hg bookmark X2 | |
243 |
abort: bookmark ' |
|
243 | abort: bookmark 'X2' already exists (use -f to force) | |
244 | [255] |
|
244 | [255] | |
245 |
|
245 | |||
246 | $ hg bookmark -m Y Z |
|
246 | $ hg bookmark -m Y Z | |
@@ -279,7 +279,13 b' incompatible options' | |||||
279 |
|
279 | |||
280 | force bookmark with existing name |
|
280 | force bookmark with existing name | |
281 |
|
281 | |||
282 |
$ hg bookmark -f |
|
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 | list bookmarks |
|
290 | list bookmarks | |
285 |
|
291 |
General Comments 0
You need to be logged in to leave comments.
Login now