comparison mercurial/commands.py @ 13911:6bc340940c18

bookmarks: change error messages to match those given by 'hg tag' commands
author Idan Kamara <idankk86@gmail.com>
date Thu, 07 Apr 2011 17:57:38 +0300
parents a7cd0eee396b
children 332e400764e5
comparison
equal deleted inserted replaced
13910:93452579df9e 13911:6bc340940c18
505 marks = repo._bookmarks 505 marks = repo._bookmarks
506 cur = repo.changectx('.').node() 506 cur = repo.changectx('.').node()
507 507
508 if rename: 508 if rename:
509 if rename not in marks: 509 if rename not in marks:
510 raise util.Abort(_("a bookmark of this name does not exist")) 510 raise util.Abort(_("bookmark '%s' does not exist") % rename)
511 if mark in marks and not force: 511 if mark in marks and not force:
512 raise util.Abort(_("a bookmark of the same name already exists")) 512 raise util.Abort(_("bookmark '%s' already exists "
513 "(use -f to force)") % mark)
513 if mark is None: 514 if mark is None:
514 raise util.Abort(_("new bookmark name required")) 515 raise util.Abort(_("new bookmark name required"))
515 marks[mark] = marks[rename] 516 marks[mark] = marks[rename]
516 if repo._bookmarkcurrent == rename: 517 if repo._bookmarkcurrent == rename:
517 bookmarks.setcurrent(repo, mark) 518 bookmarks.setcurrent(repo, mark)
521 522
522 if delete: 523 if delete:
523 if mark is None: 524 if mark is None:
524 raise util.Abort(_("bookmark name required")) 525 raise util.Abort(_("bookmark name required"))
525 if mark not in marks: 526 if mark not in marks:
526 raise util.Abort(_("a bookmark of this name does not exist")) 527 raise util.Abort(_("bookmark '%s' does not exist") % mark)
527 if mark == repo._bookmarkcurrent: 528 if mark == repo._bookmarkcurrent:
528 bookmarks.setcurrent(repo, None) 529 bookmarks.setcurrent(repo, None)
529 del marks[mark] 530 del marks[mark]
530 bookmarks.write(repo) 531 bookmarks.write(repo)
531 return 532 return
536 mark = mark.strip() 537 mark = mark.strip()
537 if not mark: 538 if not mark:
538 raise util.Abort(_("bookmark names cannot consist entirely of " 539 raise util.Abort(_("bookmark names cannot consist entirely of "
539 "whitespace")) 540 "whitespace"))
540 if mark in marks and not force: 541 if mark in marks and not force:
541 raise util.Abort(_("a bookmark of the same name already exists")) 542 raise util.Abort(_("bookmark '%s' already exists "
543 "(use -f to force)") % mark)
542 if ((mark in repo.branchtags() or mark == repo.dirstate.branch()) 544 if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
543 and not force): 545 and not force):
544 raise util.Abort( 546 raise util.Abort(
545 _("a bookmark cannot have the name of an existing branch")) 547 _("a bookmark cannot have the name of an existing branch"))
546 if rev: 548 if rev: