The function is now specifically about widening, so we don't need to
check if we're widening.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
The function is now specifically about widening, so we don't need to
check if we're widening.
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/narrow/narrowbundle2.py (95 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| ff8c8e816d85 | 313fa47fe064 | Martin von Zweigbergk | Oct 11 2019, 1:34 AM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| ) | ) | ||||
| if depth is not None: | if depth is not None: | ||||
| depth = int(depth) | depth = int(depth) | ||||
| if depth < 1: | if depth < 1: | ||||
| raise error.Abort(_(b'depth must be positive, got %d') % depth) | raise error.Abort(_(b'depth must be positive, got %d') % depth) | ||||
| heads = set(heads or repo.heads()) | heads = set(heads or repo.heads()) | ||||
| common = set(common or [nullid]) | common = set(common or [nullid]) | ||||
| if known and (oldinclude != newinclude or oldexclude != newexclude): | |||||
| # Steps: | # Steps: | ||||
| # 1. Send kill for "$known & ::common" | # 1. Send kill for "$known & ::common" | ||||
| # | # | ||||
| # 2. Send changegroup for ::common | # 2. Send changegroup for ::common | ||||
| # | # | ||||
| # 3. Proceed. | # 3. Proceed. | ||||
| # | # | ||||
| # In the future, we can send kills for only the specific | # In the future, we can send kills for only the specific | ||||
| # nodes we know should go away or change shape, and then | # nodes we know should go away or change shape, and then | ||||
| # send a data stream that tells the client something like this: | # send a data stream that tells the client something like this: | ||||
| # | # | ||||
| # a) apply this changegroup | # a) apply this changegroup | ||||
| # b) apply nodes XXX, YYY, ZZZ that you already have | # b) apply nodes XXX, YYY, ZZZ that you already have | ||||
| # c) goto a | # c) goto a | ||||
| # | # | ||||
| # until they've built up the full new state. | # until they've built up the full new state. | ||||
| # Convert to revnums and intersect with "common". The client should | # Convert to revnums and intersect with "common". The client should | ||||
| # have made it a subset of "common" already, but let's be safe. | # have made it a subset of "common" already, but let's be safe. | ||||
| known = set(repo.revs(b"%ln & ::%ln", known, common)) | known = set(repo.revs(b"%ln & ::%ln", known, common)) | ||||
| # TODO: we could send only roots() of this set, and the | # TODO: we could send only roots() of this set, and the | ||||
| # list of nodes in common, and the client could work out | # list of nodes in common, and the client could work out | ||||
| # what to strip, instead of us explicitly sending every | # what to strip, instead of us explicitly sending every | ||||
| # single node. | # single node. | ||||
| deadrevs = known | deadrevs = known | ||||
| def genkills(): | def genkills(): | ||||
| for r in deadrevs: | for r in deadrevs: | ||||
| yield _KILLNODESIGNAL | yield _KILLNODESIGNAL | ||||
| yield repo.changelog.node(r) | yield repo.changelog.node(r) | ||||
| yield _DONESIGNAL | yield _DONESIGNAL | ||||
| bundler.newpart(_CHANGESPECPART, data=genkills()) | bundler.newpart(_CHANGESPECPART, data=genkills()) | ||||
| newvisit, newfull, newellipsis = exchange._computeellipsis( | newvisit, newfull, newellipsis = exchange._computeellipsis( | ||||
| repo, set(), common, known, newmatch | repo, set(), common, known, newmatch | ||||
| ) | ) | ||||
| if newvisit: | if newvisit: | ||||
| packer = changegroup.getbundler( | packer = changegroup.getbundler( | ||||
| version, | version, | ||||
| repo, | repo, | ||||
| matcher=newmatch, | matcher=newmatch, | ||||
| ellipses=True, | ellipses=True, | ||||
| shallow=depth is not None, | shallow=depth is not None, | ||||
| ellipsisroots=newellipsis, | ellipsisroots=newellipsis, | ||||
| fullnodes=newfull, | fullnodes=newfull, | ||||
| ) | ) | ||||
| cgdata = packer.generate(common, newvisit, False, b'narrow_widen') | cgdata = packer.generate(common, newvisit, False, b'narrow_widen') | ||||
| part = bundler.newpart(b'changegroup', data=cgdata) | part = bundler.newpart(b'changegroup', data=cgdata) | ||||
| part.addparam(b'version', version) | part.addparam(b'version', version) | ||||
| if b'treemanifest' in repo.requirements: | if b'treemanifest' in repo.requirements: | ||||
| part.addparam(b'treemanifest', b'1') | part.addparam(b'treemanifest', b'1') | ||||
| visitnodes, relevant_nodes, ellipsisroots = exchange._computeellipsis( | visitnodes, relevant_nodes, ellipsisroots = exchange._computeellipsis( | ||||
| repo, common, heads, set(), newmatch, depth=depth | repo, common, heads, set(), newmatch, depth=depth | ||||
| ) | ) | ||||
| repo.ui.debug(b'Found %d relevant revs\n' % len(relevant_nodes)) | repo.ui.debug(b'Found %d relevant revs\n' % len(relevant_nodes)) | ||||
| if visitnodes: | if visitnodes: | ||||
| packer = changegroup.getbundler( | packer = changegroup.getbundler( | ||||