G

git-commit-insert-issue

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

Name Last Update
README.org Loading commit data...
git-commit-insert-issue.el Loading commit data...
img.png Loading commit data...

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, Gitlab and Bitbucket.

Works with individual projects (repo of type username/projectname), groups (groupname/projectname) and forks (where the issues are on the original repo).

Gitlab and Bitbucket: works with private projects.

Bitbucket: install bitbucket.el (in melpa).

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/Bitbucket 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.

For Bitbucket, see its README, but shortly it boils down to

(setq bitbucket-basic-auth "my-basic-auth-token")

or

export BITBUCKET_BASIC_AUTH=my-basic-auth-token

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)

Changelog

v0.3 <2017-04-24 lun.>

  • Add Bitbucket support (Tjaart van der Walt)

v0.2

  • Gitlab support: private and public, individual, groups or forks. We then consider the project url and username of the first remote to appear in the user’s .git/config.
  • ido (with \n) instead of helm
  • auto gitlab login
  • more error handling
  • github-issues dependency in melpa

v0.1 - release on Melpa

  • Github only