mercurial/commands.py
changeset 15490 875bb46e35ea
parent 15474 95174c381525
child 15491 c0e42b47ec1a
equal deleted inserted replaced
15489:25ea33fe7e5c 15490:875bb46e35ea
   737     '''
   737     '''
   738     hexfn = ui.debugflag and hex or short
   738     hexfn = ui.debugflag and hex or short
   739     marks = repo._bookmarks
   739     marks = repo._bookmarks
   740     cur   = repo.changectx('.').node()
   740     cur   = repo.changectx('.').node()
   741 
   741 
       
   742     if delete:
       
   743         if mark is None:
       
   744             raise util.Abort(_("bookmark name required"))
       
   745         if mark not in marks:
       
   746             raise util.Abort(_("bookmark '%s' does not exist") % mark)
       
   747         if mark == repo._bookmarkcurrent:
       
   748             bookmarks.setcurrent(repo, None)
       
   749         del marks[mark]
       
   750         bookmarks.write(repo)
       
   751         return
       
   752 
   742     if rename:
   753     if rename:
   743         if rename not in marks:
   754         if rename not in marks:
   744             raise util.Abort(_("bookmark '%s' does not exist") % rename)
   755             raise util.Abort(_("bookmark '%s' does not exist") % rename)
   745         if mark in marks and not force:
   756         if mark in marks and not force:
   746             raise util.Abort(_("bookmark '%s' already exists "
   757             raise util.Abort(_("bookmark '%s' already exists "
   749             raise util.Abort(_("new bookmark name required"))
   760             raise util.Abort(_("new bookmark name required"))
   750         marks[mark] = marks[rename]
   761         marks[mark] = marks[rename]
   751         if repo._bookmarkcurrent == rename and not inactive:
   762         if repo._bookmarkcurrent == rename and not inactive:
   752             bookmarks.setcurrent(repo, mark)
   763             bookmarks.setcurrent(repo, mark)
   753         del marks[rename]
   764         del marks[rename]
   754         bookmarks.write(repo)
       
   755         return
       
   756 
       
   757     if delete:
       
   758         if mark is None:
       
   759             raise util.Abort(_("bookmark name required"))
       
   760         if mark not in marks:
       
   761             raise util.Abort(_("bookmark '%s' does not exist") % mark)
       
   762         if mark == repo._bookmarkcurrent:
       
   763             bookmarks.setcurrent(repo, None)
       
   764         del marks[mark]
       
   765         bookmarks.write(repo)
   765         bookmarks.write(repo)
   766         return
   766         return
   767 
   767 
   768     if mark is not None:
   768     if mark is not None:
   769         if "\n" in mark:
   769         if "\n" in mark: