Mercurial > hg
comparison mercurial/changegroup.py @ 27240:94a3d6fdc315
changegroup: clean up file lookup function
One case is basically degenerate, so just extract it and make the
function clearer.
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 04 Dec 2015 11:38:02 -0500 |
parents | 65c47779bcb5 |
children | ead8e7069998 |
comparison
equal
deleted
inserted
replaced
27239:65c47779bcb5 | 27240:94a3d6fdc315 |
---|---|
692 yield x | 692 yield x |
693 | 693 |
694 mfs.clear() | 694 mfs.clear() |
695 clrevs = set(cl.rev(x) for x in clnodes) | 695 clrevs = set(cl.rev(x) for x in clnodes) |
696 | 696 |
697 def linknodes(filerevlog, fname): | 697 if not fastpathlinkrev: |
698 if fastpathlinkrev: | 698 def linknodes(unused, fname): |
699 return fnodes.get(fname, {}) | |
700 else: | |
701 def linknodes(filerevlog, fname): | |
699 llr = filerevlog.linkrev | 702 llr = filerevlog.linkrev |
700 def genfilenodes(): | 703 def genfilenodes(): |
701 for r in filerevlog: | 704 for r in filerevlog: |
702 linkrev = llr(r) | 705 linkrev = llr(r) |
703 if linkrev in clrevs: | 706 if linkrev in clrevs: |
704 yield filerevlog.node(r), cl.node(linkrev) | 707 yield filerevlog.node(r), cl.node(linkrev) |
705 return dict(genfilenodes()) | 708 return dict(genfilenodes()) |
706 return fnodes.get(fname, {}) | |
707 | 709 |
708 changedfiles = set() | 710 changedfiles = set() |
709 for x in mfchangedfiles.itervalues(): | 711 for x in mfchangedfiles.itervalues(): |
710 changedfiles.update(x) | 712 changedfiles.update(x) |
711 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs, | 713 for chunk in self.generatefiles(changedfiles, linknodes, commonrevs, |