Coder Social home page Coder Social logo

hfagerlund / git-add-msg Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 142 KB

git extension for automatic Trac ticket updates

License: Other

Shell 58.25% Makefile 1.52% Perl 0.22% HTML 25.63% CSS 2.46% XSLT 1.84% PHP 0.06% Roff 10.02%
bash git-extension trac xml-rpc-api

git-add-msg's Introduction

git-add-msg

A git extension (command line tool) that automatically logs commits to Trac and/or a changelog.

Replaces the following commands:

$ git add -A

and:

$ git commit -am "<insert-your-commit-message-here>"

Also creates a changelog.log file (in your project's root directory), and (optionally) adds a comment in the Trac ticket for each commit.

tl;dr

All of the above is accomplished by running just one command:

$ git add-msg

(Refer to 'Usage' section below.)


Requirements

  • bash version >= 4.2
  • git version >= 1.7
  • (optional) Trac >= v.0.12
  • curl >= 7.21

Testing

(All copyrights for the above remain with their respective owners.)


Installation

$ git clone https://github.com/hfagerlund/git-add-msg.git
$ cd git-add-msg
$ make install DEST_DIR=/path/to/your-git-extensions-directory
  • add the path to <your-git-extensions-directory> to your executable path:
export PATH="$PATH:/path/to/your-git-extensions-directory" #Note: no trailing slash

To uninstall:

Manually remove the following files from <your-git-extensions-directory>:

git-add-msg-config.cfg
git-add-msg-config_sample.cfg
git-add-msg
git-add-msg-trac-service

Configuration

All users:

(OPTIONAL) Rename git-add-msg-config_sample.cfg to git-add-msg-config.cfg in <your-git-extensions-directory>. This step can be skipped (refer to note below).

Note: if a git-add-msg-config.cfg file is not present, it will result in a warning message being displayed when the tool is run (this can be safely ignored if not using Trac).


Trac users only:

(1.) Update git-add-msg-config.cfg (copied from git-add-msg-config_sample.cfg in <your-git-extensions-directory>) with your Trac settings by replacing the following values:

repo="no_repo_specified"         # replace <no_repo_specified> with the **name** of your Trac repository (found in Trac under 'Administration' > 'Manage Repositories' > 'Name')
username="no_username_specified" # (as above, but with your Trac login username)
password="no_password_specified" 
host="no_host_specified"
port="no_port_specified"
instance="no_instance_specified" 

Note: The repository name (ie. value of repo) can also be changed for different Trac tickets via the command line using the -r option (instead of updating it manually) - refer to 'Usage' section below.

(2.) Under the Trac Admin tab, click on Permissions. On the Manage Permissions page, complete the Grant Permission fields as follows:

Subject: Action:
<trac-username> (same as username value in step 1.) XML_RPC

Usage

All users:

$ git add-msg

Follow the prompts to add your Trac ticket number (optional - may be left blank if not using Trac) and commit message.

Done!

Example:
someuser@somehost:~/my-project$ git add-msg
Enter your (Trac) ticket number (without hash OR colon):
221
Enter your commit message (without quote marks; press Enter, then Ctrl+d when done):
updated content
git committing...
[master e10379d] #221: updated content
 1 files changed, 1 insertions(+), 0 deletions(-)
Trac ticket successfully updated.

Trac users:

(Optional configuration) Specify the name of a repository that has been added to Trac as follows:

$ git add-msg -r <repo-name>

Using the -r option automatically generates a link to the changeset in the Trac ticket.

Tests:

Run unit tests (in the /tests directory) using:

$ ./acceptanceTests.sh

Note: make sure that shunit2 has been added to your $PATH.


License

Copyright (c) 2015 Heini Fagerlund. Licensed under the MIT license. (See LICENSE.)


Changelog

  • 0.3.1 - January 29, 2018. New feature: automated installation.
  • 0.2.1 - January 29, 2018. Fixed display of changeset number in auto-generated Trac link.
  • 0.2.0 - January 13, 2016. Deprecated (optional) git status check.
  • 0.1.4 - December 30, 2015. Fixed display of ticket update message.
  • 0.1.3 - December 30, 2015. Newlines in multi-line commit messages now display in Changelog file.
  • 0.1.2 - December 29, 2015. Newlines in multi-line commit messages now display in Trac comments.
  • 0.1.1 - July 15, 2015. Commit messages now support additional characters: &, ", <, and >. Note: ' is removed from messages.
  • 0.1.0 - July 15, 2015. Initial version.

git-add-msg's People

Contributors

hfagerlund avatar

Watchers

 avatar  avatar  avatar

git-add-msg's Issues

End of input needs to be triggered twice

User must press Ctrl-d key combo twice to signify end of commit message, unless the Enter key is pressed first (adding an additional line break at end of commit message).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.