drupalorg-1.0.x-dev/templates/forks/drupalorg-fork-commands.html.twig
templates/forks/drupalorg-fork-commands.html.twig
{#
Available variables:
- issue: Issue array with all the information returned from Gitlab.
- project: Project array that the issue belongs to.
- fork: Current fork.
- issue_specific_branches: Branches array.
- merge_requests: Merge Requests array with all the MR information.
- logged_in: User is logged in or not.
#}
<details>
<summary>{{ 'Show commands'|t }}</summary>
<div class="commands-section">
{% if project %}
<b>{{ 'Start within a Git clone of the project'|t }}</b>
<p class="description">
{{ 'If you already have a clone, you can skip this step.' }}
</p>
{% include 'bluecheese:copy_code_block' with {
code: "git clone #{project.http_url_to_repo}\ncd #{project.path}"
} only %}
{% endif %}
<div>
<b>{{ 'Add & fetch this issue fork’s repository'|t }}</b>
<p class="description">{{ 'Add the fork reference to your local repository.' }}</p>
{% include 'bluecheese:copy_code_block' with {
code: "git remote add #{fork.path} #{fork.ssh_url_to_repo}\ngit fetch #{fork.path}"
} only %}
<p class="description">{{ '<b>Or</b>, if you do not have <a class="gitlab-link" href="https://git.drupalcode.org/-/profile/keys">SSH keys set up on git.drupalcode.org</a>'|t }}:</p>
{% include 'bluecheese:copy_code_block' with {
code: "git remote add #{fork.path} #{fork.http_url_to_repo}\ngit fetch #{fork.path}"
} only %}
{% if issue_specific_branches[fork.id]|length %}
<b>{{ 'Check out the fork @word created for this issue'|t({
'@word': (issue_specific_branches[fork.id]|length > 1) ? 'branches' : 'branch'
}) }}</b>
{% for issue_branch in issue_specific_branches[fork.id] %}
<div class="branch-commands-wrapper">
<h6 class="branch-name">{{ issue_branch.name }}</h6>
<div class="branch-commands">
<p><em>{{ 'First time'|t }}</em></p>
{% include 'bluecheese:copy_code_block' with {
code: "git checkout -b #{issue_branch.name} --track #{fork.path}/#{issue_branch.name}"
} only %}
<p><em>{{ 'If you already have the branch'|t }}</em></p>
{% include 'bluecheese:copy_code_block' with {
code: "git checkout #{issue_branch.name}"
} only %}
<p class="description">{{ '<b>Or</b> push your current local branch from your Git clone'|t }}</p>
{% include 'bluecheese:copy_code_block' with {
code: "git push --set-upstream #{issue_branch.name} HEAD"
} only %}
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>
</details>
