Commit 240234d5 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Mercurial: parse_gitlab_branch_for_hg

It will be convenient to have such utility methods in a
central place.

--HG--
branch : heptapod-stable
parent 41f30c7cb6a0
......@@ -8,6 +8,16 @@ def hgrc_path
Gitlab.config.mercurial.hgrc.join(":")
end
def parse_gitlab_branch_for_hg(gitlab_branch)
if gitlab_branch.start_with?('branch/')
[gitlab_branch[7..], nil]
elsif gitlab_branch.start_with?('topic/')
branch, _slash, topic = gitlab_branch[6..].rpartition('/')
[branch, topic]
else
raise StandardError, "bookmarks not supported (got #{gitlab_branch})"
end
end
end
end
end
......@@ -179,6 +179,7 @@ def hg_changeset_branch(hgsha)
out.strip
end
# TODO duplication use the one from Mercurial module
def parse_gitlab_branch_for_hg(gitlab_branch)
if gitlab_branch.start_with?('branch/')
[gitlab_branch[7..], nil]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment