mercurial/cmdutil.py
changeset 44861 065421e12248
parent 44856 b7808443ed6a
child 45036 c05ac059749f
equal deleted inserted replaced
44860:5d77f571a563 44861:065421e12248
  2750 
  2750 
  2751 def files(ui, ctx, m, uipathfn, fm, fmt, subrepos):
  2751 def files(ui, ctx, m, uipathfn, fm, fmt, subrepos):
  2752     ret = 1
  2752     ret = 1
  2753 
  2753 
  2754     needsfctx = ui.verbose or {b'size', b'flags'} & fm.datahint()
  2754     needsfctx = ui.verbose or {b'size', b'flags'} & fm.datahint()
  2755     for f in ctx.matches(m):
  2755     if fm.isplain() and not needsfctx:
  2756         fm.startitem()
  2756         # Fast path. The speed-up comes from skipping the formatter, and batching
  2757         fm.context(ctx=ctx)
  2757         # calls to ui.write.
  2758         if needsfctx:
  2758         buf = []
  2759             fc = ctx[f]
  2759         for f in ctx.matches(m):
  2760             fm.write(b'size flags', b'% 10d % 1s ', fc.size(), fc.flags())
  2760             buf.append(fmt % uipathfn(f))
  2761         fm.data(path=f)
  2761             if len(buf) > 100:
  2762         fm.plain(fmt % uipathfn(f))
  2762                 ui.write(b''.join(buf))
  2763         ret = 0
  2763                 del buf[:]
       
  2764             ret = 0
       
  2765         if buf:
       
  2766             ui.write(b''.join(buf))
       
  2767     else:
       
  2768         for f in ctx.matches(m):
       
  2769             fm.startitem()
       
  2770             fm.context(ctx=ctx)
       
  2771             if needsfctx:
       
  2772                 fc = ctx[f]
       
  2773                 fm.write(b'size flags', b'% 10d % 1s ', fc.size(), fc.flags())
       
  2774             fm.data(path=f)
       
  2775             fm.plain(fmt % uipathfn(f))
       
  2776             ret = 0
  2764 
  2777 
  2765     for subpath in sorted(ctx.substate):
  2778     for subpath in sorted(ctx.substate):
  2766         submatch = matchmod.subdirmatcher(subpath, m)
  2779         submatch = matchmod.subdirmatcher(subpath, m)
  2767         subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn)
  2780         subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn)
  2768         if subrepos or m.exact(subpath) or any(submatch.files()):
  2781         if subrepos or m.exact(subpath) or any(submatch.files()):