# HG changeset patch # User Patrick Mezard # Date 2012-02-25 18:39:55 # Node ID 280e834c9d15b0d65a0ee24374671e0cd2147f4e # Parent 60101427d618a0d774d2d1fd29838ec81f3bba7c log: restore cache used by --copies The {filelog -> linkrev -> copyfrom} cache was refactored and broken by: changeset: 10060:f780b1098efc user: Patrick Mezard 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. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3849,9 +3849,11 @@ def log(ui, repo, *pats, **opts): limit = cmdutil.loglimit(opts) count = 0 - endrev = None - if opts.get('copies') and opts.get('rev'): - endrev = max(scmutil.revrange(repo, opts.get('rev'))) + 1 + getrenamed, endrev = None, None + if opts.get('copies'): + if opts.get('rev'): + endrev = max(scmutil.revrange(repo, opts.get('rev'))) + 1 + getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) df = False if opts["date"]: @@ -3895,9 +3897,8 @@ def log(ui, repo, *pats, **opts): return copies = None - if opts.get('copies') and rev: + if getrenamed is not None and rev: copies = [] - getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) for fn in ctx.files(): rename = getrenamed(fn, rev) if rename: