mercurial/commands.py
changeset 39989 c9026e9297e3
parent 39932 e743907d0932
child 39990 a91398dc73ab
equal deleted inserted replaced
39988:a8ec8bce14c6 39989:c9026e9297e3
  3021         hexrev = fm.hexfunc(remoterev)
  3021         hexrev = fm.hexfunc(remoterev)
  3022         if default or id:
  3022         if default or id:
  3023             output = [hexrev]
  3023             output = [hexrev]
  3024         fm.data(id=hexrev)
  3024         fm.data(id=hexrev)
  3025 
  3025 
       
  3026         @util.cachefunc
  3026         def getbms():
  3027         def getbms():
  3027             bms = []
  3028             bms = []
  3028 
  3029 
  3029             if 'bookmarks' in peer.listkeys('namespaces'):
  3030             if 'bookmarks' in peer.listkeys('namespaces'):
  3030                 hexremoterev = hex(remoterev)
  3031                 hexremoterev = hex(remoterev)
  3031                 bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems()
  3032                 bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems()
  3032                        if bmr == hexremoterev]
  3033                        if bmr == hexremoterev]
  3033 
  3034 
  3034             return sorted(bms)
  3035             return sorted(bms)
  3035 
  3036 
  3036         bms = getbms()
       
  3037         if bookmarks:
  3037         if bookmarks:
  3038             output.extend(bms)
  3038             output.extend(getbms())
  3039         elif default and not ui.quiet:
  3039         elif default and not ui.quiet:
  3040             # multiple bookmarks for a single parent separated by '/'
  3040             # multiple bookmarks for a single parent separated by '/'
  3041             bm = '/'.join(bms)
  3041             bm = '/'.join(getbms())
  3042             if bm:
  3042             if bm:
  3043                 output.append(bm)
  3043                 output.append(bm)
  3044 
  3044 
  3045         fm.data(node=hex(remoterev))
  3045         fm.data(node=hex(remoterev))
  3046         fm.data(bookmarks=fm.formatlist(bms, name='bookmark'))
  3046         if 'bookmarks' in fm.datahint():
       
  3047             fm.data(bookmarks=fm.formatlist(getbms(), name='bookmark'))
  3047     else:
  3048     else:
  3048         if rev:
  3049         if rev:
  3049             repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
  3050             repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
  3050         ctx = scmutil.revsingle(repo, rev, None)
  3051         ctx = scmutil.revsingle(repo, rev, None)
  3051 
  3052