Skip to content
Snippets Groups Projects
Commit 8f4addd4fbfc authored by Georges Racinet's avatar Georges Racinet :squid:
Browse files

Merge branch 'topic/stable/debug-default-branch' into 'branch/stable'

GitLab default branch: new logs to investigate problems

See merge request !101
No related branches found
No related tags found
2 merge requests!101GitLab default branch: new logs to investigate problems,!99Merged stable branch into default
Pipeline #81564 passed
......@@ -1065,6 +1065,11 @@
changes = self.heptapod_compare_tags(existing)
prune_reasons, compared = self.compare_exportable(
existing, self.extract_all_gitlab_refs())
if None in compared:
self.ui.warn(
b"A `None` key found its way in compare_exportable results "
b"Full values: prune_reasons=%r, compared=%r" % (
prune_reasons, compared))
changes.update(compared)
self.heptapod_apply_changes(prune_reasons, changes)
......@@ -1128,6 +1133,11 @@
new_named_branch_refs.add(ref)
elif not ref_is_wild_branch(ref):
fallback_new_refs.add(ref)
self.ui.note(
b"Analysis to set default branch. "
b"Named branch candidates: %r, fallback_new_refs: %r" % (
new_named_branch_refs, fallback_new_refs))
candidate_refs = new_named_branch_refs or fallback_new_refs
if not candidate_refs:
return
......
......@@ -17,7 +17,10 @@
import pytest
import re
from dulwich.protocol import ZERO_SHA
from heptapod.gitlab.change import (
ZERO_SHA,
GitLabRefChange,
)
from heptapod.testhelpers import (
RepoWrapper,
)
......@@ -57,6 +60,30 @@
assert re.search(br'prune.*default branch', exc_info.value.args[0])
def test_log_None_in_ref_keys(tmpdir, monkeypatch):
notifs = []
patch_gitlab_hooks(monkeypatch, notifs)
config = common_config()
config['heptapod'] = dict(native=True)
wrapper = RepoWrapper.init(tmpdir.join('repo'), config=config)
wrapper.write_commit('foo')
wrapper.command('gitlab-mirror')
handler = NoGitStateMaintainer(wrapper.repo.ui,
wrapper.repo)
def compare_exportable(existing, exportable):
return None, {None: GitLabRefChange(ref=b'some-bookmark',
before=ZERO_SHA,
after=b'1234f678' * 5)}
handler.compare_exportable = compare_exportable
# just checking that the log works.
handler.update_gitlab_references()
def test_refs_by_type():
head_refs = {b'refs/heads/gl-branch'}
tag_refs = {b'refs/tags/gl-tag'}
......
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