# HG changeset patch # User Martin von Zweigbergk # Date 2018-03-26 17:49:01 # Node ID ec37df9042f9f074a90131c5ac83a8803e83d238 # Parent cc9aa88792fe8daf041521710f52be59c69b79eb templatekw: make getrenamed() return only filename, not nodeid No callers cared about the nodeid and I want to make getrenamed() not look up the node (although it's currently free, I hope to store copy info in changesets and not include the nodeid). Differential Revision: https://phab.mercurial-scm.org/D3666 diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -865,7 +865,7 @@ def displaygraph(ui, repo, dag, displaye for fn in ctx.files(): rename = getrenamed(fn, ctx.rev()) if rename: - copies.append((fn, rename[0])) + copies.append((fn, rename)) edges = edgefn(type, char, state, rev, parents) firstedge = next(edges) width = firstedge[2] @@ -893,7 +893,7 @@ def displayrevs(ui, repo, revs, displaye for fn in ctx.files(): rename = getrenamed(fn, rev) if rename: - copies.append((fn, rename[0])) + copies.append((fn, rename)) displayer.show(ctx, copies=copies) displayer.flush(ctx) displayer.close() diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -111,7 +111,7 @@ def getrenamedfn(repo, endrev=None): for i in fl: lr = fl.linkrev(i) renamed = fl.renamed(fl.node(i)) - rcache[fn][lr] = renamed + rcache[fn][lr] = renamed and renamed[0] if lr >= endrev: break if rev in rcache[fn]: @@ -120,7 +120,8 @@ def getrenamedfn(repo, endrev=None): # If linkrev != rev (i.e. rev not found in rcache) fallback to # filectx logic. try: - return repo[rev][fn].renamed() + renamed = repo[rev][fn].renamed() + return renamed and renamed[0] except error.LookupError: return None @@ -318,7 +319,7 @@ def showfilecopies(context, mapping): for fn in ctx.files(): rename = getrenamed(fn, ctx.rev()) if rename: - copies.append((fn, rename[0])) + copies.append((fn, rename)) copies = util.sortdict(copies) return compatdict(context, mapping, 'file_copy', copies,