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

Merged heads on default branch

That is why it's not so good an idea to make a topic for release
matters (forgot to update after pull). In that precise case, it's
not worth a new version
parents a3cb1972 7b46103e
No related branches found
No related tags found
No related merge requests found
Pipeline #23858 passed
Pipeline: hgitaly

#23859

    ......@@ -151,8 +151,11 @@
    at the right stage of Mercurial transaction end.
    """
    def __init__(self, repo, encoding='utf-8'):
    self.repo = repo
    self.encoding = encoding
    main_repo = hg.sharedreposource(self.repo)
    def init_repo_path_ui(self, repo):
    """Part of instance initialization that needs a repository object.
    A later refactor could transfer this responsibility to callers, but
    would be too much as of this writing.
    """
    main_repo = hg.sharedreposource(repo)
    if main_repo is None:
    ......@@ -158,4 +161,5 @@
    if main_repo is None:
    main_repo = self.repo
    main_repo = repo
    # GitLab FS paths are ASCII
    self.repo_path = pycompat.sysstr(main_repo.root)
    ......@@ -160,4 +164,15 @@
    # GitLab FS paths are ASCII
    self.repo_path = pycompat.sysstr(main_repo.root)
    self.ui = repo.ui
    def __init__(self, repo, encoding='utf-8'):
    self.init_repo_path_ui(repo)
    # Really making sure that we don't use `repo` further (this
    # is important because GitLab hooks must not depend on references that
    # may be alive when registered as Mercurial transaction or locks
    # callbacks, and obsolete at the time the callback is used.
    del repo
    self.encoding = encoding
    self.git_fs_path = self.repo_path[:-3] + '.git'
    url = pycompat.sysstr(
    ......@@ -162,6 +177,6 @@
    self.git_fs_path = self.repo_path[:-3] + '.git'
    url = pycompat.sysstr(
    repo.ui.config(b'heptapod', b'gitlab-internal-api-url',
    self.ui.config(b'heptapod', b'gitlab-internal-api-url',
    b'http://localhost:8080'))
    self.gitlab_internal_api_endpoint = url + '/api/v4/internal'
    ......@@ -169,7 +184,7 @@
    if self.skip():
    return
    secret = repo.ui.config(b'heptapod',
    secret = self.ui.config(b'heptapod',
    b'gitlab-internal-api-secret-file')
    if not secret:
    ......@@ -173,7 +188,7 @@
    b'gitlab-internal-api-secret-file')
    if not secret:
    shell = repo.ui.config(b'heptapod', b'gitlab-shell')
    shell = self.ui.config(b'heptapod', b'gitlab-shell')
    if shell:
    candidate = os.path.join(shell, b'.gitlab_shell_secret')
    if os.path.exists(candidate):
    ......@@ -202,7 +217,7 @@
    return s.encode(self.encoding, 'replace')
    def skip(self):
    env = self.repo.ui.environ
    env = self.ui.environ
    return (
    env.get(b'HEPTAPOD_SKIP_ALL_GITLAB_HOOKS', b'').strip() == b'yes'
    or env.get(b'HEPTAPOD_SKIP_GITLAB_HOOK',
    ......@@ -213,7 +228,7 @@
    if self.skip():
    return SKIP
    base = self.repo.ui.environ
    base = self.ui.environ
    gl_id = base.get(b'HEPTAPOD_USERINFO_ID')
    gl_repo = base.get(b'GL_REPOSITORY')
    ......@@ -266,7 +281,7 @@
    and hence is a :class:`str` instance (Unicode string on Python3)
    """
    if not changes:
    self.repo.ui.debug(
    self.ui.debug(
    b"%s: empty set of changes - nothing to do." % self)
    return 0, b'', ''
    ......@@ -275,7 +290,7 @@
    except ValueError as exc:
    msg = b"%s, not sending notifications!" % pycompat.sysbytes(
    exc.args[0])
    self.repo.ui.warn(b"%s: %s" % (self, msg))
    self.ui.warn(b"%s: %s" % (self, msg))
    return 1, b'', msg
    if env is SKIP:
    ......@@ -279,7 +294,7 @@
    return 1, b'', msg
    if env is SKIP:
    self.repo.ui.note(
    self.ui.note(
    b'%s: bailing (explicitely told not to send)' % self)
    return 0, b'', ''
    ......
    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