mercurial/commands.py
changeset 39625 10c5eacd793f
parent 39624 713085b45810
child 39626 6ecfd12f09cd
equal deleted inserted replaced
39624:713085b45810 39625:10c5eacd793f
  2981     opts = pycompat.byteskwargs(opts)
  2981     opts = pycompat.byteskwargs(opts)
  2982     if not repo and not source:
  2982     if not repo and not source:
  2983         raise error.Abort(_("there is no Mercurial repository here "
  2983         raise error.Abort(_("there is no Mercurial repository here "
  2984                            "(.hg not found)"))
  2984                            "(.hg not found)"))
  2985 
  2985 
  2986     if ui.debugflag:
       
  2987         hexfunc = hex
       
  2988     else:
       
  2989         hexfunc = short
       
  2990     default = not (num or id or branch or tags or bookmarks)
  2986     default = not (num or id or branch or tags or bookmarks)
  2991     output = []
  2987     output = []
  2992     revs = []
  2988     revs = []
  2993 
  2989 
  2994     if source:
  2990     if source:
  3008             rev = revs[0]
  3004             rev = revs[0]
  3009         if not rev:
  3005         if not rev:
  3010             rev = "tip"
  3006             rev = "tip"
  3011 
  3007 
  3012         remoterev = peer.lookup(rev)
  3008         remoterev = peer.lookup(rev)
  3013         hexrev = hexfunc(remoterev)
  3009         hexrev = fm.hexfunc(remoterev)
  3014         if default or id:
  3010         if default or id:
  3015             output = [hexrev]
  3011             output = [hexrev]
  3016         fm.data(id=hexrev)
  3012         fm.data(id=hexrev)
  3017 
  3013 
  3018         def getbms():
  3014         def getbms():
  3051             dirty = ""
  3047             dirty = ""
  3052             if ctx.dirty(missing=True, merge=False, branch=False):
  3048             if ctx.dirty(missing=True, merge=False, branch=False):
  3053                 dirty = '+'
  3049                 dirty = '+'
  3054             fm.data(dirty=dirty)
  3050             fm.data(dirty=dirty)
  3055 
  3051 
  3056             hexoutput = [hexfunc(p.node()) for p in parents]
  3052             hexoutput = [fm.hexfunc(p.node()) for p in parents]
  3057             if default or id:
  3053             if default or id:
  3058                 output = ["%s%s" % ('+'.join(hexoutput), dirty)]
  3054                 output = ["%s%s" % ('+'.join(hexoutput), dirty)]
  3059             fm.data(id="%s%s" % ('+'.join(hexoutput), dirty))
  3055             fm.data(id="%s%s" % ('+'.join(hexoutput), dirty))
  3060 
  3056 
  3061             if num:
  3057             if num:
  3068                 fn.data(rev=p.rev())
  3064                 fn.data(rev=p.rev())
  3069                 fn.data(node=p.hex())
  3065                 fn.data(node=p.hex())
  3070                 fn.context(ctx=p)
  3066                 fn.context(ctx=p)
  3071             fn.end()
  3067             fn.end()
  3072         else:
  3068         else:
  3073             hexoutput = hexfunc(ctx.node())
  3069             hexoutput = fm.hexfunc(ctx.node())
  3074             if default or id:
  3070             if default or id:
  3075                 output = [hexoutput]
  3071                 output = [hexoutput]
  3076             fm.data(id=hexoutput)
  3072             fm.data(id=hexoutput)
  3077 
  3073 
  3078             if num:
  3074             if num: