Mercurial > hg
changeset 27241:ead8e7069998
changegroup: restate file linknode callback using generator expressions
I think this is slightly clearer, and it nicely avoids an extra nested
function.
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 04 Dec 2015 11:39:03 -0500 |
parents | 94a3d6fdc315 |
children | 58f473908951 |
files | mercurial/changegroup.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Fri Dec 04 11:38:02 2015 -0500 +++ b/mercurial/changegroup.py Fri Dec 04 11:39:03 2015 -0500 @@ -698,14 +698,12 @@ def linknodes(unused, fname): return fnodes.get(fname, {}) else: + cln = cl.node def linknodes(filerevlog, fname): llr = filerevlog.linkrev - def genfilenodes(): - for r in filerevlog: - linkrev = llr(r) - if linkrev in clrevs: - yield filerevlog.node(r), cl.node(linkrev) - return dict(genfilenodes()) + fln = filerevlog.node + revs = ((r, llr(r)) for r in filerevlog) + return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs) changedfiles = set() for x in mfchangedfiles.itervalues():