mercurial/commands.py
changeset 14188 9029b1a38c30
parent 14168 135e244776f0
child 14189 328422b0380d
equal deleted inserted replaced
14187:9bbaafddfa90 14188:9029b1a38c30
   481                  % (rev, short(node), changesets, tests))
   481                  % (rev, short(node), changesets, tests))
   482         if not noupdate:
   482         if not noupdate:
   483             cmdutil.bail_if_changed(repo)
   483             cmdutil.bail_if_changed(repo)
   484             return hg.clean(repo, node)
   484             return hg.clean(repo, node)
   485 
   485 
   486 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, rename=None):
   486 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False,
       
   487              rename=None, inactive=False):
   487     '''track a line of development with movable markers
   488     '''track a line of development with movable markers
   488 
   489 
   489     Bookmarks are pointers to certain commits that move when
   490     Bookmarks are pointers to certain commits that move when
   490     committing. Bookmarks are local. They can be renamed, copied and
   491     committing. Bookmarks are local. They can be renamed, copied and
   491     deleted. It is possible to use bookmark names in :hg:`merge` and
   492     deleted. It is possible to use bookmark names in :hg:`merge` and
   512             raise util.Abort(_("bookmark '%s' already exists "
   513             raise util.Abort(_("bookmark '%s' already exists "
   513                                "(use -f to force)") % mark)
   514                                "(use -f to force)") % mark)
   514         if mark is None:
   515         if mark is None:
   515             raise util.Abort(_("new bookmark name required"))
   516             raise util.Abort(_("new bookmark name required"))
   516         marks[mark] = marks[rename]
   517         marks[mark] = marks[rename]
   517         if repo._bookmarkcurrent == rename:
   518         if repo._bookmarkcurrent == rename and not inactive:
   518             bookmarks.setcurrent(repo, mark)
   519             bookmarks.setcurrent(repo, mark)
   519         del marks[rename]
   520         del marks[rename]
   520         bookmarks.write(repo)
   521         bookmarks.write(repo)
   521         return
   522         return
   522 
   523 
   547                 _("a bookmark cannot have the name of an existing branch"))
   548                 _("a bookmark cannot have the name of an existing branch"))
   548         if rev:
   549         if rev:
   549             marks[mark] = repo.lookup(rev)
   550             marks[mark] = repo.lookup(rev)
   550         else:
   551         else:
   551             marks[mark] = repo.changectx('.').node()
   552             marks[mark] = repo.changectx('.').node()
   552         if repo.changectx('.').node() == marks[mark]:
   553         if not inactive and repo.changectx('.').node() == marks[mark]:
   553             bookmarks.setcurrent(repo, mark)
   554             bookmarks.setcurrent(repo, mark)
   554         bookmarks.write(repo)
   555         bookmarks.write(repo)
   555         return
   556         return
   556 
   557 
   557     if mark is None:
   558     if mark is None:
  4467     "bookmarks":
  4468     "bookmarks":
  4468         (bookmark,
  4469         (bookmark,
  4469          [('f', 'force', False, _('force')),
  4470          [('f', 'force', False, _('force')),
  4470           ('r', 'rev', '', _('revision'), _('REV')),
  4471           ('r', 'rev', '', _('revision'), _('REV')),
  4471           ('d', 'delete', False, _('delete a given bookmark')),
  4472           ('d', 'delete', False, _('delete a given bookmark')),
  4472           ('m', 'rename', '', _('rename a given bookmark'), _('NAME'))],
  4473           ('m', 'rename', '', _('rename a given bookmark'), _('NAME')),
  4473          _('hg bookmarks [-f] [-d] [-m NAME] [-r REV] [NAME]')),
  4474           ('i', 'inactive', False, _('do not mark a new bookmark active'))],
       
  4475          _('hg bookmarks [-f] [-d] [-i] [-m NAME] [-r REV] [NAME]')),
  4474     "branch":
  4476     "branch":
  4475         (branch,
  4477         (branch,
  4476          [('f', 'force', None,
  4478          [('f', 'force', None,
  4477            _('set branch name even if it shadows an existing branch')),
  4479            _('set branch name even if it shadows an existing branch')),
  4478           ('C', 'clean', None, _('reset branch name to parent branch name'))],
  4480           ('C', 'clean', None, _('reset branch name to parent branch name'))],