G

git-commit-insert-issue

In a commit buffer, type "Fixes #" and find the issue from the helm list.

http://melpa.org/packages/git-commit-insert-issue-badge.svg

Search and insert the right issue at “Fixes #”

Goal: In a magit commit buffer, I want to complete the issue when I type “Fixes #”.

For Github and Gitlab.

Usage

Activate the minor mode

M-x git-commit-insert-issue-mode

In a magit commit buffer (git-commit-mode), type “Fixes #” (or any other keyword understood by github, or just a “#” for Gitlab) and choose the issue from the list.

So to always activate it:

(add-hook 'git-commit-mode-hook 'git-commit-insert-issue-mode)

You can also call it with

M-x git-commit-insert-issue-ask-issues

and programmatically doing something like

(--map (insert (concat it "\n"))
       (git-commit-insert-issue-github-issues-format "inkel" "github-issues.el"))

Connect to your Gitlab account

Don’t forget to set your Gitlab credentials:

(setq gitlab-host "https://gitlab.com"
      gitlab-username "foo"
      gitlab-password "password")

normally you would then call M-x gitlab-login, but the lib does it when needed.

Installation

This package is in MELPA, so you can install it with package.el:

M-x package-install RET git-commit-insert-issue RET

(you may need a M-x package-refresh-contents).

Alternatively, you can download this repo and call M-x load-file on the elisp source.

Dependencies

They are all in MELPA.

Feedback on emacs-gitlab: it’s very well written but monolithic and not very flexible. It has functions for every action of the api (glab.el takes another approach, the developer writes the api endpoint) but it seems it wasn’t written for practical stuff in mind. For example, it didn’t have an option to fetch only the opened issues of a project, or optional function arguments to make it easier to develop. See this PR as an example.

Doc is missing, but once you understand that a project can be referenced by “username/project”, it’s easier.

Issues

Issues for github integration of github-issues.el :

(--map (insert (concat it "\n")) (git-commit-insert-issue-github-issues-format "inkel" "github-issues.el"))
#10 - Why not just use the gh package?
#1 - Doesn't work on private repos.

Todo

  • tests
  • cache
  • [X] gitlab integration:
    • [X] Get opened issues from gitlab
    • [X] Get a list of strings with “id - title”
    • [X] choose with ido and insert in buffer: M-x git-commit-insert-issue-gitlab-insert.
    • [X] choose github or gitlab, depending on project.
      • [X] get the remote server in git config
    • [X] make it work for projects in groups (i.e, “emacs-stuff/project” and not “vindarel”.
      • [X] get the group name in git config
    • [±] error handling (bad project name, etc)