mercurial/commands.py
changeset 32482 579df5aaa425
parent 32451 bce5ebe72859
child 32486 1df80eff24cf
equal deleted inserted replaced
32481:a87dabb053d0 32482:579df5aaa425
   966                                "(use -f to force)") % mark)
   966                                "(use -f to force)") % mark)
   967         if ((mark in repo.branchmap() or mark == repo.dirstate.branch())
   967         if ((mark in repo.branchmap() or mark == repo.dirstate.branch())
   968             and not force):
   968             and not force):
   969             raise error.Abort(
   969             raise error.Abort(
   970                 _("a bookmark cannot have the name of an existing branch"))
   970                 _("a bookmark cannot have the name of an existing branch"))
   971         if len(mark) > 3 and mark in repo and not force:
   971         if len(mark) > 3 and not force:
   972             repo.ui.warn(
   972             try:
   973                 _("bookmark %s matches a changeset hash\n"
   973                 shadowhash = (mark in repo)
   974                   "(did you leave a -r out of an 'hg bookmark' command?)\n") %
   974             except error.LookupError: # ambiguous identifier
   975                 mark)
   975                 shadowhash = False
       
   976             if shadowhash:
       
   977                 repo.ui.warn(
       
   978                     _("bookmark %s matches a changeset hash\n"
       
   979                       "(did you leave a -r out of an 'hg bookmark' command?)\n")
       
   980                     % mark)
   976 
   981 
   977     if delete and rename:
   982     if delete and rename:
   978         raise error.Abort(_("--delete and --rename are incompatible"))
   983         raise error.Abort(_("--delete and --rename are incompatible"))
   979     if delete and rev:
   984     if delete and rev:
   980         raise error.Abort(_("--rev is incompatible with --delete"))
   985         raise error.Abort(_("--rev is incompatible with --delete"))