##// END OF EJS Templates
files: speed up `hg files` when no flags change display...
Valentin Gatien-Baron -
r45388:065421e1 default
parent child Browse files
Show More
@@ -2752,15 +2752,28 b' def files(ui, ctx, m, uipathfn, fm, fmt,'
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)
General Comments 0
You need to be logged in to leave comments. Login now