Skip to content

Commit

Permalink
rebase: don't prefetch dest commits' parents
Browse files Browse the repository at this point in the history
Summary: We don't normally need to read the destination commits' parents' trees. We read the source commits' parents because they are the ancestor commits used for the merge.

Reviewed By: quark-zju

Differential Revision: D65488794

fbshipit-source-id: 0851bcc8666f250ce0c064edd0cf046cd1c983cb
  • Loading branch information
muirdm authored and facebook-github-bot committed Nov 6, 2024
1 parent 1438c97 commit 92709b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 3 additions & 5 deletions eden/scm/sapling/ext/rebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,12 +1011,10 @@ def _finishrebase(self):
def _prefetch(self):
repo = self.repo

# Collect list of all relevant commits: source commits, dest commits, and their
# parent commits.
tofetch = bindings.dag.nameset(
[n for kv in self.destmap.node2node.items() for n in kv]
)
# Collect list of relevant commits: source commits, their parents, and dest commits.
tofetch = bindings.dag.nameset(self.destmap.node2node.keys())
tofetch += repo.changelog.dag.parents(tofetch)
tofetch += self.destmap.node2node.values()

# Batch lazy DAG resolutions.
repo.changelog.filternodes(tofetch)
Expand Down
7 changes: 3 additions & 4 deletions eden/scm/tests/test-rebase-file-fetches.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ Make sure we batch tree fetches well:

$ newclientrepo client2 test:server2
$ hg pull -qr $C
FIXME: we don't need to prefetch anything for D:
$ LOG=file_fetches=trace,tree_fetches=trace hg rebase -q -s $B -d $E
TRACE tree_fetches: attrs=["content"] keys=["@0578004a", "@1d3af747", "@1e081eaa", "@3b9f2e11", "@e2120c7c"]
TRACE tree_fetches: attrs=["content"] keys=["a@05099e49", "a@1da49c91", "a@82fb1620", "a@bc26d404", "a@ce774d7e"]
TRACE tree_fetches: attrs=["content"] keys=["a/b@693cd354", "a/b@7f83a148", "a/b@99574908", "a/b@d48eda77", "a/b@ee58f75d"]
TRACE tree_fetches: attrs=["content"] keys=["@0578004a", "@1e081eaa", "@3b9f2e11", "@e2120c7c"]
TRACE tree_fetches: attrs=["content"] keys=["a@05099e49", "a@1da49c91", "a@82fb1620", "a@ce774d7e"]
TRACE tree_fetches: attrs=["content"] keys=["a/b@693cd354", "a/b@99574908", "a/b@d48eda77", "a/b@ee58f75d"]
TRACE tree_fetches: attrs=["content"] keys=["a/b/c1@0c8dfc95", "a/b/c1@82bbf75d", "a/b/c2@0c8dfc95", "a/b/c2@1570ca89", "a/b/c2@e98395d2", "a/b/c3@cefe4a92"]
TRACE file_fetches: attrs=["history"] length=Some(1) keys=["a/b/c1/file"]
TRACE tree_fetches: attrs=["content"] keys=["@a2e501c5"]
Expand Down

0 comments on commit 92709b9

Please sign in to comment.