Staging instance, all changes can be removed at any time

Skip to content

Eagerly populate the set of local heads in RepoRepresentation.__init__

As dulwich's client.fetch_pack expects an instance of history graph walker with set of known heads, move the local heads caching from determine_wants to the RepoRepresentation initialization logic.

Our previous code would always initialize the graph walker with an empty set of heads (as the graph_walker() method is called before determine_wants() has run, so self.heads was always empty), so we would never actually fetch an incremental pack file.

Test Plan

Added a new test checking that the incremental loads really only fetch new commits.

On an incremental load of chromium.git:

before:

Enumerating objects: 18141323, done.
Counting objects: 100% (4755/4755), done.
Compressing objects: 100% (2733/2733), done.
ERROR:swh.loader.git.loader.GitLoader:Loading failure, updating to `failed` status

after:

Enumerating objects: 1203181, done.
Counting objects: 100% (407/407), done.
Compressing objects: 100% (233/233), done.
Total 1203181 (delta 270), reused 279 (delta 174), pack-reused 1202774

Migrated from D8808 (view on Phabricator)

Merge request reports

Loading