Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 10011:a9836feb5a8c
changegroupsubset: readdelta() can be used if the previous rev is a parent
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Fri, 04 Dec 2009 17:43:01 +0100 |
parents | 2fce96916d97 |
children | 24ce8f0c0a39 |
comparison
equal
deleted
inserted
replaced
10010:2fce96916d97 | 10011:a9836feb5a8c |
---|---|
1752 return msng_mnfst_set[mnfstnode] | 1752 return msng_mnfst_set[mnfstnode] |
1753 | 1753 |
1754 # A function generating function that sets up the initial environment | 1754 # A function generating function that sets up the initial environment |
1755 # the inner function. | 1755 # the inner function. |
1756 def filenode_collector(changedfiles): | 1756 def filenode_collector(changedfiles): |
1757 next_rev = [0] | |
1758 # This gathers information from each manifestnode included in the | 1757 # This gathers information from each manifestnode included in the |
1759 # changegroup about which filenodes the manifest node references | 1758 # changegroup about which filenodes the manifest node references |
1760 # so we can include those in the changegroup too. | 1759 # so we can include those in the changegroup too. |
1761 # | 1760 # |
1762 # It also remembers which changenode each filenode belongs to. It | 1761 # It also remembers which changenode each filenode belongs to. It |
1763 # does this by assuming the a filenode belongs to the changenode | 1762 # does this by assuming the a filenode belongs to the changenode |
1764 # the first manifest that references it belongs to. | 1763 # the first manifest that references it belongs to. |
1765 def collect_msng_filenodes(mnfstnode): | 1764 def collect_msng_filenodes(mnfstnode): |
1766 r = mnfst.rev(mnfstnode) | 1765 r = mnfst.rev(mnfstnode) |
1767 if r == next_rev[0]: | 1766 if r - 1 in mnfst.parentrevs(r): |
1768 # If the last rev we looked at was the one just previous, | 1767 # If the previous rev is one of the parents, |
1769 # we only need to see a diff. | 1768 # we only need to see a diff. |
1770 deltamf = mnfst.readdelta(mnfstnode) | 1769 deltamf = mnfst.readdelta(mnfstnode) |
1771 # For each line in the delta | 1770 # For each line in the delta |
1772 for f, fnode in deltamf.iteritems(): | 1771 for f, fnode in deltamf.iteritems(): |
1773 f = changedfiles.get(f, None) | 1772 f = changedfiles.get(f, None) |
1792 if fnode is not None: | 1791 if fnode is not None: |
1793 # See comments above. | 1792 # See comments above. |
1794 clnode = msng_mnfst_set[mnfstnode] | 1793 clnode = msng_mnfst_set[mnfstnode] |
1795 ndset = msng_filenode_set.setdefault(f, {}) | 1794 ndset = msng_filenode_set.setdefault(f, {}) |
1796 ndset.setdefault(fnode, clnode) | 1795 ndset.setdefault(fnode, clnode) |
1797 # Remember the revision we hope to see next. | |
1798 next_rev[0] = r + 1 | |
1799 return collect_msng_filenodes | 1796 return collect_msng_filenodes |
1800 | 1797 |
1801 # We have a list of filenodes we think we need for a file, lets remove | 1798 # We have a list of filenodes we think we need for a file, lets remove |
1802 # all those we know the recipient must have. | 1799 # all those we know the recipient must have. |
1803 def prune_filenodes(f, filerevlog): | 1800 def prune_filenodes(f, filerevlog): |