comparison mercurial/commands.py @ 16175:280e834c9d15 stable

log: restore cache used by --copies The {filelog -> linkrev -> copyfrom} cache was refactored and broken by: changeset: 10060:f780b1098efc user: Patrick Mezard <pmezard@gmail.com> date: Sun Dec 13 18:06:24 2009 +0100 summary: templatekw: change {file_copies} behaviour, add {file_copies_switch} With --copies, this cache is accessed for every touched file of every revision. Unfortunately it is recreated for every revision, which means filelogs are parsed again. This patch makes the cache global again for all revisions. A couple of indicative timings of "hg log --copies", before and after: hg: 44s / 5s mozilla --limit 10000: 3m51s / 2m32s mozilla: 23m46s / 12m23s I do not know any good tool to trace memory consumption of these runs for comparisons. Watching the full mozilla run in top, the process did not seem to misbehave.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 25 Feb 2012 19:39:55 +0100
parents 807f796e9b1a
children 0bb0b9f22cd7 41bef17e6ad8
comparison
equal deleted inserted replaced
16165:60101427d618 16175:280e834c9d15
3847 3847
3848 matchfn = scmutil.match(repo[None], pats, opts) 3848 matchfn = scmutil.match(repo[None], pats, opts)
3849 limit = cmdutil.loglimit(opts) 3849 limit = cmdutil.loglimit(opts)
3850 count = 0 3850 count = 0
3851 3851
3852 endrev = None 3852 getrenamed, endrev = None, None
3853 if opts.get('copies') and opts.get('rev'): 3853 if opts.get('copies'):
3854 endrev = max(scmutil.revrange(repo, opts.get('rev'))) + 1 3854 if opts.get('rev'):
3855 endrev = max(scmutil.revrange(repo, opts.get('rev'))) + 1
3856 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
3855 3857
3856 df = False 3858 df = False
3857 if opts["date"]: 3859 if opts["date"]:
3858 df = util.matchdate(opts["date"]) 3860 df = util.matchdate(opts["date"])
3859 3861
3893 break 3895 break
3894 else: 3896 else:
3895 return 3897 return
3896 3898
3897 copies = None 3899 copies = None
3898 if opts.get('copies') and rev: 3900 if getrenamed is not None and rev:
3899 copies = [] 3901 copies = []
3900 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
3901 for fn in ctx.files(): 3902 for fn in ctx.files():
3902 rename = getrenamed(fn, rev) 3903 rename = getrenamed(fn, rev)
3903 if rename: 3904 if rename:
3904 copies.append((fn, rename[0])) 3905 copies.append((fn, rename[0]))
3905 3906