scm: unified progress reporting in a structured way

This adds a support for reporting progress from Git in a structured
format. The gitpython already provides somewhat structured progress
reporting, dulwich on the other hand only provides git-like line
messages.

As gitpython uses git binary, it already parse this line format
in a structured way. This PR makes dulwich use the same machinery
to unify progress reporting for both dulwich and gitpython python.

This does add a dependency on gitpython even on dulwich backend,
so I am iffy if we should do this.
The alternative is to translate gitpython's progress reports to
string, and just use string messages as progress reports on both
dulwich and gitpython.
This commit is contained in:
Saugat Pachhai (सौगात)
2021-11-23 19:50:12 +02:00
committed by Ruslan Kuprieiev
parent d95dd27773
commit a0f4e12fb4
12 changed files with 195 additions and 101 deletions
+6 -2
View File
@@ -140,7 +140,9 @@ def test_shallow_clone_branch(erepo_dir):
with repo.open_by_relpath("file") as fd:
assert fd.read() == "branch"
mock_clone.assert_called_with(url, ANY, shallow_branch="branch")
mock_clone.assert_called_with(
url, ANY, shallow_branch="branch", progress=ANY
)
_, shallow = CLONES[url]
assert shallow
@@ -166,7 +168,9 @@ def test_shallow_clone_tag(erepo_dir):
with repo.open_by_relpath("file") as fd:
assert fd.read() == "foo"
mock_clone.assert_called_with(url, ANY, shallow_branch="v1")
mock_clone.assert_called_with(
url, ANY, shallow_branch="v1", progress=ANY
)
_, shallow = CLONES[url]
assert shallow