Permalink
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (45 sloc) 2.43 KB

## Time-stamp: <2011-12-27 18:11:19 armin> ## This file is best viewed with GNU Emacs Org-mode: http://orgmode.org/

memacs_git

Data Source

Version control systems are quite common to manage all kinds of data with. git is a modern distributed system that has an enormous feature set.

memacs_git.py parses the output of:

git rev-list --all --pretty=raw

If an outfile is specified, only new commits are appended.

Example Invocation

Example with rev-list file:

git rev-list --all --pretty=raw > /tmp/file
./memacs_git.py -f /tmp/file -o /path/to/git-project.org_archive

Example Crontab Entry

Every 60 minutes try to fetch something new from git repository and parse the output

ORG_DIR="/home/user/orgmode/memacs"
MEMACS_DIR="/home/user/git/Memacs"
*/60   *   *   *  *    /home/user/bin/no-power-supply.sh || cd "/home/user/git/Memacs" && git fetch && git rev-list --all --pretty=raw | $MEMACS_DIR/versioning_systems/memacs_git.py -o $ORG_DIR/git-memacs.org_archive

.gitconfig - alias

For easily adding a crontab entry, you can modify your .gitconfig and add an alias like memacs-add-crontab to the [alias] section.

It could look like this: (adjust the paths!)

[alias]
      ...
	memacs-add-crontab = "! crontab -l > /tmp/crontab &&  echo \"*/60   *   *   *  *    /home/user/bin/no-power-supply.sh || cd \"$(git rev-parse --show-toplevel)\" && git fetch && git rev-list --all --pretty=raw | /path/to/memacs/versioning_systems/memacs_git.py -o ~/orgmode/memacs/git-$(basename $(git rev-parse --show-toplevel)).org_archive\n\" >> /tmp/crontab && crontab /tmp/crontab && rm /tmp/crontab"

filter by username

use option

./memacs_git.py <...> -g "Forename Lastname"

or

./memacs_git.py <...> --grep-user "Forename Lastname"

Example Orgmode entries

Whenever user “Bob” commits a change set to an example project, memacs_git can provide an entry like this:

* Memacs for git files           :Memacs:git:
** Bob Bobman: added utf-8 support for stdin
  :PROPERTIES:
  :COMMIT:        5503912cde8ac94346a7c78583e2e6a6b9163582
  :TREE:          845f83f4678963bad0504ce73161312c60de4d2f
  :PARENT:        652601b94e640ea1225c415e603a6c8374219dd1
  :AUTHOR:        Bob Bobman <bob@example.com> 1324463332 +0100
  :CREATED:       <2011-12-21 Wed 11:28:52>
  :COMMITTER:     Bob Bobman <bob@examlpe.com> 1324463332 +0100
  :END: