Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Prepares a merge request description, with link to Jira ticket and current branc

<b>git mr</b> <i>[OPTIONS]</i> <b>menu</b> <i>[SEARCH_TERM]</i>
<b>git mr</b> <i>[OPTIONS]</i> <b>menu</b> <i>update [--current]</i> <i>[SEARCH_TERM]</i>
<b>git mr</b> <i>[OPTIONS]</i> <b>menu</b> <i>edit</i> <i>[SEARCH_TERM]</i>
<b>git mr</b> <i>[OPTIONS]</i> <b>menu</b> <i>status</i> <i>[SEARCH_TERM]</i>

<b>git mr</b> <i>[OPTIONS]</i> <b>(ip|cr|qa|ok)</b> <i>[BRANCH]</i>
Expand Down Expand Up @@ -393,6 +394,7 @@ This view allows navigating through the merge request commits, and comments left
<pre>
<b>git mr</b> <i>[OPTION...]</i> <b>menu</b> <i>[SEARCH_TERM]</i>
<b>git mr</b> <i>[OPTION...]</i> <b>menu</b> <i>up|update [--current]</i> <i>[SEARCH_TERM]</i>
<b>git mr</b> <i>[OPTION...]</i> <b>menu</b> <i>ed|edit</i> <i>[SEARCH_TERM]</i>
<b>git mr</b> <i>[OPTION...]</i> <b>menu</b> <i>st|status</i> <i>[SEARCH_TERM]</i>
</pre>

Expand All @@ -411,6 +413,16 @@ Searches for all (non-closed) merge requests with the current issue code in the
* `git mr menu up|update --current`
Inserts or updates menu in current merge request description only (prompts for confirmation).

* `git mr menu ed|edit`
Opens menu in editor for tweaking before updating related merge request descriptions.
Uses default editor, guessed through `VISUAL` or `EDITOR` environment variables.

![git mr menu edit](doc/git-mr-menu-edit-0.png)

![git mr menu edit](doc/git-mr-menu-edit-1.png)

![git mr menu edit](doc/git-mr-menu-edit-2.png)

* `git mr menu st|status`
Prints menu and status indicators for every related merge request.

Expand Down
4 changes: 3 additions & 1 deletion completion/_git-mr
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ __git-mr_menu_commands() {
local -a commands=(
'status:show menu merge requests status summary'
'update:update menu in related merge request descriptions'
'edit:edit menu before updating in related merge request descriptions'
)
_describe -V -t mr-menu-commands 'mr menu commands' commands
}
Expand All @@ -61,6 +62,7 @@ _git-mr() {
op|open) mr_action="open" ;;
st|status) [[ $mr_action == "menu" ]] && mr_action="menu-status" || mr_action="status" ;;
up|update) [[ $mr_action == "menu" ]] && mr_action="menu-update" || mr_action="update" ;;
ed|edit) [[ $mr_action == "menu" ]] && mr_action="menu-edit" || mr_action="default" ;;
mg|merge) mr_action="merge" ;;
menu) mr_action="menu" ;;
ip|cr|qa|ok) mr_action="transition" ;;
Expand Down Expand Up @@ -89,7 +91,7 @@ _git-mr() {
'(--no-color)'--no-color'[disable terminal colors]'
'(--no-links)'--no-links'[disable terminal hyperlinks]'
);; esac
case $mr_action in default|update|menu-update|transition|merge) opts+=(
case $mr_action in default|update|menu-update|menu-edit|transition|merge) opts+=(
'(-y --yes)'{-y,--yes}'[bypass confirmation prompts ("yes")]'
);; esac
opts+=(
Expand Down
58 changes: 56 additions & 2 deletions doc/generate-sample-output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,51 @@ EOF
echo
}

sample_mr_menu_edit() {
fake_prompt "git mr menu edit"

mr_description="# [XY-1234 Quisque sed](https://jira.example.net/browse/XY-1234)

## Menu

### Feature

Lorem ipsum feature

* Some Project: [Feature/XY-1234 Lorem Ipsum](https://myapp.gitlab.com/some/project/...)
* **Other Project: [Feature/XY-1234 Quisque sed](https://myapp.gitlab.com/other/project/...)**

### Documentation

* Third Project: [Feature/XY-1234 Nunc vestibulum](https://myapp.gitlab.com/third/project/...)

--------------------------------------------------------------------------------


Quisque sed consectetur adipiscing elit.

Pellentesque eu lectus felis. Phasellus maximus, quam quis accumsan varius,
enim nunc egestas ante, ut venenatis nunc eros non lorem. Ut molestie elementum
nisi in sollicitudin.
"

mr_url="https://myapp.gitlab.com/other/project/..."
mr_title="Feature/XY-1234 Quisque sed"
project_name="Other Project"

cat <<EOF

================================================================================
$(terminal_link "$search_url" "$issue_code") (merge request 2/3)
================================================================================
EOF

mr_menu_print_description "$mr_description" "$mr_url" "$mr_title" "$project_name"

echo "$(colorize "Do you want to update the menu in the merge request description?" "lightcyan" "bold") [y/N] "
echo
}

sample_mr_prepare_commit_msg() {

local branch="feature/xy-1234-lorem-ipsum"
Expand Down Expand Up @@ -454,10 +499,18 @@ if [[ "$#" -gt 0 ]]; then
sample_mr_update_links
;;
menu)
# sample_mr_menu
sample_mr_menu
;;
menu-status)
sample_mr_menu_status
# sample_mr_menu_update
;;
menu-update)
sample_mr_menu_update
;;
menu-edit)
sample_mr_menu_edit
;;

merge)
sample_mr_merge
;;
Expand All @@ -478,6 +531,7 @@ else
sample_mr_menu
sample_mr_menu_status
sample_mr_menu_update
sample_mr_menu_edit

sample_mr_merge

Expand Down
Binary file added doc/git-mr-menu-edit-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/git-mr-menu-edit-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/git-mr-menu-edit-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading