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

Merged fixes of 4.8.1

These were made for Heptapod 17.6.2
parents 619676e4 103a3526
No related branches found
No related tags found
1 merge request!114Merged fixes of 4.8.1
Pipeline #97517 passed
Pipeline: hgitaly

#97518

    ......@@ -100,5 +100,6 @@
    051d5d1a5b298a55eaea2f140812353527c1eb2b 4.7.6
    eedd1bdaad2fd98cf68a5c4c05db952096e20bd8 4.7.7
    0592551395b445cf8f1823024a793a65c427c66b 4.8.0
    f34492e3beb2feade9df44809ad051e67e97957a 4.8.1
    66c09471519c8b80e7ab5d93f2c2435000f3b01e 5.0.0
    0dc18d6bd6efb951678b511510bd7d905ebe18bb 5.0.1
    ......@@ -39,6 +39,9 @@
    def is_creation(self):
    return self.before == ZERO_SHA and self.after != ZERO_SHA
    def is_deletion(self):
    return self.after == ZERO_SHA and self.before != ZERO_SHA
    def export_for_hook(self, handler, native=False):
    """Prepare for actual hook sending.
    ......
    ......@@ -119,6 +119,10 @@
    # Methods relying on the expected implemented methods
    #
    @property
    def native(self):
    return self.repo.ui.configbool(b'heptapod', b'native')
    def is_wiki(self):
    """Tell whether self.repo is the storage for a GitLab wiki"""
    return (self.repo.ui.environ.get(b'GL_REPOSITORY', b'')
    ......@@ -855,7 +859,7 @@
    before=before_sha,
    after=after_sha)
    if self.is_wiki():
    if self.is_wiki() and not self.native:
    # GitLab wikis are much hardwired onto 'master' in a Git repo
    on_default = changes.get(gitlab_branch_ref(b'branch/default'))
    if on_default is not None:
    ......@@ -935,7 +939,7 @@
    return
    ui = self.repo.ui
    native = ui.configbool(b'heptapod', b'native')
    native = self.native
    ui.note(b"heptapod_notify_gitlab heptapod.native=%r" % native)
    if native and prune_reasons:
    ......@@ -1153,6 +1157,21 @@
    if default_exists and not ref_is_topic(default_ref):
    return
    # The default GitLab branch might not have been set on Wikis
    # when they went native, see heptapod#1987. For Wikis, the choice
    # is always 'branch/default'.
    branch_default_ref = gitlab_branch_ref(b'branch/default')
    if default_ref is None and self.is_wiki() and self.native:
    change = changes.get(branch_default_ref)
    exists = branch_default_ref in self.gitlab_refs
    if change is not None:
    # mutating boolean clearer than very long condition in `if`
    exists &= not change.is_deletion()
    exists |= change.is_creation()
    if exists:
    self.set_default_gitlab_ref(branch_default_ref)
    return
    new_named_branch_refs = set()
    fallback_new_refs = set()
    for ref, change in pycompat.iteritems(changes):
    ......@@ -1182,7 +1201,6 @@
    )
    return
    branch_default_ref = gitlab_branch_ref(b'branch/default')
    if branch_default_ref in candidate_refs:
    new_default_ref = branch_default_ref
    else:
    ......
    ......@@ -210,9 +210,7 @@
    sha = fixture.ctx1.hex()
    # for wikis, we duplicate `branch/default` as `master`
    changes = {}, {b'refs/heads/branch/default': (ZERO_SHA, sha),
    b'refs/heads/master': (ZERO_SHA, sha),
    }
    changes = {}, {b'refs/heads/branch/default': (ZERO_SHA, sha)}
    assert notifs == [
    ('pre-receive', changes),
    ('post-receive', changes),
    ......
    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