Show More
@@ -968,11 +968,16 def bookmark(ui, repo, *names, **opts): | |||
|
968 | 968 | and not force): |
|
969 | 969 | raise error.Abort( |
|
970 | 970 | _("a bookmark cannot have the name of an existing branch")) |
|
971 |
if len(mark) > 3 and |
|
|
971 | if len(mark) > 3 and not force: | |
|
972 | try: | |
|
973 | shadowhash = (mark in repo) | |
|
974 | except error.LookupError: # ambiguous identifier | |
|
975 | shadowhash = False | |
|
976 | if shadowhash: | |
|
972 | 977 | repo.ui.warn( |
|
973 | 978 | _("bookmark %s matches a changeset hash\n" |
|
974 |
"(did you leave a -r out of an 'hg bookmark' command?)\n") |
|
|
975 | mark) | |
|
979 | "(did you leave a -r out of an 'hg bookmark' command?)\n") | |
|
980 | % mark) | |
|
976 | 981 | |
|
977 | 982 | if delete and rename: |
|
978 | 983 | raise error.Abort(_("--delete and --rename are incompatible")) |
@@ -320,8 +320,36 bookmark with a name that matches a node | |||
|
320 | 320 | $ hg bookmark -d 925d80f479bb |
|
321 | 321 | $ hg bookmark -d db815d6d32e6 |
|
322 | 322 | |
|
323 | $ cd .. | |
|
324 | ||
|
325 | bookmark with a name that matches an ambiguous node id | |
|
326 | ||
|
327 | $ hg init ambiguous | |
|
328 | $ cd ambiguous | |
|
329 | $ echo 0 > a | |
|
330 | $ hg ci -qAm 0 | |
|
331 | $ for i in 1057 2857 4025; do | |
|
332 | > hg up -q 0 | |
|
333 | > echo $i > a | |
|
334 | > hg ci -qm $i | |
|
335 | > done | |
|
336 | $ hg up -q null | |
|
337 | $ hg log -r0: -T '{rev}:{node}\n' | |
|
338 | 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a | |
|
339 | 1:c56256a09cd28e5764f32e8e2810d0f01e2e357a | |
|
340 | 2:c5623987d205cd6d9d8389bfc40fff9dbb670b48 | |
|
341 | 3:c562ddd9c94164376c20b86b0b4991636a3bf84f | |
|
342 | ||
|
343 | $ hg bookmark -r0 c562 | |
|
344 | $ hg bookmarks | |
|
345 | c562 0:b4e73ffab476 | |
|
346 | ||
|
347 | $ cd .. | |
|
348 | ||
|
323 | 349 | incompatible options |
|
324 | 350 | |
|
351 | $ cd repo | |
|
352 | ||
|
325 | 353 | $ hg bookmark -m Y -d Z |
|
326 | 354 | abort: --delete and --rename are incompatible |
|
327 | 355 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now