Mercurial > hg
comparison mercurial/changegroup.py @ 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 | 77d25b913f80 |
comparison
equal
deleted
inserted
replaced
27240:94a3d6fdc315 | 27241:ead8e7069998 |
---|---|
696 | 696 |
697 if not fastpathlinkrev: | 697 if not fastpathlinkrev: |
698 def linknodes(unused, fname): | 698 def linknodes(unused, fname): |
699 return fnodes.get(fname, {}) | 699 return fnodes.get(fname, {}) |
700 else: | 700 else: |
701 cln = cl.node | |
701 def linknodes(filerevlog, fname): | 702 def linknodes(filerevlog, fname): |
702 llr = filerevlog.linkrev | 703 llr = filerevlog.linkrev |
703 def genfilenodes(): | 704 fln = filerevlog.node |
704 for r in filerevlog: | 705 revs = ((r, llr(r)) for r in filerevlog) |
705 linkrev = llr(r) | 706 return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs) |
706 if linkrev in clrevs: | |
707 yield filerevlog.node(r), cl.node(linkrev) | |
708 return dict(genfilenodes()) | |
709 | 707 |
710 changedfiles = set() | 708 changedfiles = set() |
711 for x in mfchangedfiles.itervalues(): | 709 for x in mfchangedfiles.itervalues(): |
712 changedfiles.update(x) | 710 changedfiles.update(x) |
713 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs, | 711 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs, |