1470 # It also remembers which changenode each filenode belongs to. It |
1470 # It also remembers which changenode each filenode belongs to. It |
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 if mf.deltaparent(r) in mf.parentrevs(r): |
1476 if mf.deltaparent(r) in mf.parentrevs(r): |
1476 # If the previous rev is one of the parents, |
1477 # If the previous rev is one of the parents, |
1477 # we only need to see a diff. |
1478 # we only need to see a diff. |
1478 deltamf = mf.readdelta(mnode) |
1479 deltamf = mf.readdelta(mnode) |
1479 # For each line in the delta |
1480 # For each line in the delta |
1480 for f, fnode in deltamf.iteritems(): |
1481 for f, fnode in deltamf.iteritems(): |
1481 # And if the file is in the list of files we care |
1482 # And if the file is in the list of files we care |
1482 # about. |
1483 # about. |
1483 if f in changedfiles: |
1484 if f in changedfiles: |
1484 # Get the changenode this manifest belongs to |
|
1485 clnode = mfs[mnode] |
|
1486 # Create the set of filenodes for the file if |
1485 # Create the set of filenodes for the file if |
1487 # there isn't one already. |
1486 # there isn't one already. |
1488 ndset = fnodes.setdefault(f, {}) |
1487 fnodes.setdefault(f, {}).setdefault(fnode, clnode) |
1489 # And set the filenode's changelog node to the |
|
1490 # manifest's if it hasn't been set already. |
|
1491 ndset.setdefault(fnode, clnode) |
|
1492 else: |
1488 else: |
1493 # Otherwise we need a full manifest. |
1489 # Otherwise we need a full manifest. |
1494 m = mf.read(mnode) |
1490 m = mf.read(mnode) |
1495 # For every file in we care about. |
1491 # For every file in we care about. |
1496 for f in changedfiles: |
1492 for f in changedfiles: |
1497 fnode = m.get(f, None) |
1493 if f in m: |
1498 # If it's in the manifest |
1494 fnodes.setdefault(f, {}).setdefault(m[f], clnode) |
1499 if fnode is not None: |
|
1500 # See comments above. |
|
1501 clnode = mfs[mnode] |
|
1502 ndset = fnodes.setdefault(f, {}) |
|
1503 ndset.setdefault(fnode, clnode) |
|
1504 return collect |
1495 return collect |
1505 |
1496 |
1506 # If we determine that a particular file or manifest node must be a |
1497 # If we determine that a particular file or manifest node must be a |
1507 # node that the recipient of the changegroup will already have, we can |
1498 # node that the recipient of the changegroup will already have, we can |
1508 # also assume the recipient will have all the parents. This function |
1499 # also assume the recipient will have all the parents. This function |