Skip to content
Snippets Groups Projects
Commit 141dab17 authored by Georges Racinet's avatar Georges Racinet
Browse files

branch: avoid fallback analysis on empty repos

We've been worried to see so many "defaulting to slow direct
analysis" in the logs (especially in developer setups), as we
are on the verge to rely on the GitLab state files only in some
cases (RHGitaly).

It turns out that all such logs emitted by a local functional tests
run were actually about empty repos
(`heptapod-tests-run --heptapod-remote --heptapod-hg-native=full`).
It will be interesting to check foss.heptapod.net logs. In theory, we
should not see any such warning.

The early returns are of course much simpler, not sure if that
is a performance boost in general, though, since the condition will be
checked for all calls and most of them are not on empty repositories.
parent 32b0304d
No related branches found
No related tags found
2 merge requests!151heptapod#743: making 0.36 the new stable,!149branch: avoid fallback analysis on empty repos
Pipeline #66152 passed
......@@ -104,6 +104,9 @@
:return: a :class:`changectx` or ``None`` if there's no changeset for
the given ``gl_branch``.
"""
if not len(repo):
return None
gl_branches = gitlab_branches(repo)
if gl_branches is not GITLAB_BRANCHES_MISSING:
sha = gl_branches.get(gl_branch)
......@@ -165,6 +168,9 @@
instance, ignoring lookup errors. If ``False``, yield targets as
hexadecimal node ids.
"""
if not len(repo):
return
gl_branches = gitlab_branches(repo)
if gl_branches is not GITLAB_BRANCHES_MISSING:
for branch, sha in gl_branches.items():
......
......@@ -420,6 +420,7 @@
def test_push_unexpected_error(push_fixture):
wrapper, target_wrapper, push = push_fixture
wrapper.commit_file('foo')
# we don't have many ways to trigger internal errors when
# monkeypatch can't work (server is not in the same process):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment