hgext/bookmarks.py
changeset 7487 63446383dfb7
parent 7484 167853c7e54a
parent 7486 d3b6c6179323
child 7489 9b64589b1112
equal deleted inserted replaced
7484:167853c7e54a 7487:63446383dfb7
   316     if not rev and len(args) > 0:
   316     if not rev and len(args) > 0:
   317         rev = args[0]
   317         rev = args[0]
   318     setcurrent(repo, rev)
   318     setcurrent(repo, rev)
   319     return res
   319     return res
   320 
   320 
   321 def bookmarkonlylog(orig, ui, repo, *args, **opts):
       
   322     'Show revisions that are ancestors of given bookmark'
       
   323     if opts.get('only_bookmark'):
       
   324         if opts.get('rev'):
       
   325             raise util.Abort(_("you cannot use --rev and --only-bookmark"
       
   326                                " options simultaneously"))
       
   327         mark = opts['only_bookmark']
       
   328         if not mark in parse(repo):
       
   329             raise util.Abort(_("invalid bookmark name"))
       
   330         opts['rev'] = ['%s:null' % mark]
       
   331     orig(ui, repo, *args, **opts)
       
   332 
       
   333 def uisetup(ui):
   321 def uisetup(ui):
   334     'Replace push with a decorator to provide --non-bookmarked option'
   322     'Replace push with a decorator to provide --non-bookmarked option'
   335     entry = extensions.wrapcommand(commands.table, 'push', pushnonbookmarked)
   323     entry = extensions.wrapcommand(commands.table, 'push', pushnonbookmarked)
   336     entry[1].append(('', 'non-bookmarked', None, _("push all heads that are not bookmarked")))
   324     entry[1].append(('', 'non-bookmarked', None, _("push all heads that are not bookmarked")))
   337     if ui.configbool('bookmarks', 'track.current'):
   325     if ui.configbool('bookmarks', 'track.current'):
   338         extensions.wrapcommand(commands.table, 'update', updatecurbookmark)
   326         extensions.wrapcommand(commands.table, 'update', updatecurbookmark)
   339     entry = extensions.wrapcommand(commands.table, 'log', bookmarkonlylog)
       
   340     entry[1].append(('B', 'only-bookmark', '',
       
   341                      _("show only ancestors of given bookmark")))
       
   342 
   327 
   343 cmdtable = {
   328 cmdtable = {
   344     "bookmarks":
   329     "bookmarks":
   345         (bookmark,
   330         (bookmark,
   346          [('f', 'force', False, _('force')),
   331          [('f', 'force', False, _('force')),