Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 13712:c4706accf310
changegroupsubset: use manifest.readfast to simplify collector
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 20 Mar 2011 19:43:28 -0500 |
parents | cb8d0bc8c021 |
children | ee4f7109457e |
comparison
equal
deleted
inserted
replaced
13711:ed913fd7837b | 13712:c4706accf310 |
---|---|
1471 # does this by assuming the a filenode belongs to the changenode | 1471 # does this by assuming the a filenode belongs to the changenode |
1472 # the first manifest that references it belongs to. | 1472 # the first manifest that references it belongs to. |
1473 def collect(mnode): | 1473 def collect(mnode): |
1474 r = mf.rev(mnode) | 1474 r = mf.rev(mnode) |
1475 clnode = mfs[mnode] | 1475 clnode = mfs[mnode] |
1476 if mf.deltaparent(r) in mf.parentrevs(r): | 1476 mdata = mf.readfast(mnode) |
1477 # If the previous rev is one of the parents, | 1477 for f in changedfiles: |
1478 # we only need to see a diff. | 1478 if f in mdata: |
1479 deltamf = mf.readdelta(mnode) | 1479 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode) |
1480 # For each line in the delta | 1480 |
1481 for f, fnode in deltamf.iteritems(): | |
1482 # And if the file is in the list of files we care | |
1483 # about. | |
1484 if f in changedfiles: | |
1485 # Create the set of filenodes for the file if | |
1486 # there isn't one already. | |
1487 fnodes.setdefault(f, {}).setdefault(fnode, clnode) | |
1488 else: | |
1489 # Otherwise we need a full manifest. | |
1490 m = mf.read(mnode) | |
1491 # For every file in we care about. | |
1492 for f in changedfiles: | |
1493 if f in m: | |
1494 fnodes.setdefault(f, {}).setdefault(m[f], clnode) | |
1495 return collect | 1481 return collect |
1496 | 1482 |
1497 # If we determine that a particular file or manifest node must be a | 1483 # If we determine that a particular file or manifest node must be a |
1498 # node that the recipient of the changegroup will already have, we can | 1484 # node that the recipient of the changegroup will already have, we can |
1499 # also assume the recipient will have all the parents. This function | 1485 # also assume the recipient will have all the parents. This function |