Update git stuff start writing histogram task.

This commit is contained in:
Ivan Malison 2014-10-13 02:50:57 -07:00
parent b7ecdbae1c
commit 36fb94e30a
3 changed files with 30 additions and 10 deletions

View File

@ -20,6 +20,7 @@
ignore-untracked="!git untracked | xargs -n1 git ignore" ignore-untracked="!git untracked | xargs -n1 git ignore"
power-clean = clean -ffd power-clean = clean -ffd
db = !"db() { git diff HEAD~"$1"; }; db" db = !"db() { git diff HEAD~"$1"; }; db"
clone = clone --recursive
branches = branch -a branches = branch -a
remotes = remote -v remotes = remote -v
@ -42,6 +43,8 @@
# Diff a file or show it in git's pager if it is untracked # Diff a file or show it in git's pager if it is untracked
du = "!d() { git ls-files $1 --error-unmatch 2>/dev/null 1>/dev/null && git diff $1 || `git config --get core.pager` $1; }; d" du = "!d() { git ls-files $1 --error-unmatch 2>/dev/null 1>/dev/null && git diff $1 || `git config --get core.pager` $1; }; d"
clean-branches = "!r() { git branch -r --merged ${1-origin/master} | xargs -n1 git branch -d; }; r" clean-branches = "!r() { git branch -r --merged ${1-origin/master} | xargs -n1 git branch -d; }; r"
diff-excluding = "!f() { exclude=$1; shift; git diff $1 $2 --name-only | grep -v $exclude | xargs git diff "$@" --; }; f"
aliases = "!f() { git config --get-regexp ^alias | cut -c 7-; }; f"
[core] [core]
# Use custom `.gitignore` and `.gitattributes` # Use custom `.gitignore` and `.gitattributes`
@ -70,14 +73,6 @@
changed = yellow changed = yellow
untracked = red untracked = red
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
[user] [user]
email = IvanMalison@gmail.com email = IvanMalison@gmail.com
name = Ivan Malison name = Ivan Malison

View File

@ -19,8 +19,6 @@ Thumbs.db
# yelp # yelp
TAGS TAGS
run_tests.sh
untracked/
.ropeproject/ .ropeproject/
*.sw* *.sw*

27
resources/python/tasks.py Normal file
View File

@ -0,0 +1,27 @@
import datetime
from invoke import task, run
@task
def histogram(ignore=''):
result = run('git rev-list --all')
date_to_adds = {}
date_to_deletes = {}
for sha in result.stdout.split('\n'):
result = run('git diff-excluding {1} {0}~1 {0} --numstat'.format(sha, ignore), hide=True)
added, deleted = get_total(result.stdout)
iso8601 = run('git log {0} --pretty=format:%ai -1'.format(sha), hide=True).stdout.strip()
commit_date = datetime.datetime.strptime(iso8601, "%Y-%m-%dT%H:%M:%S %z").date()
date_to_adds[commit_date] = date_to_adds.get(commit_date) + added
date_to_deletes[commit_date] = date_to_deletes.get(commit_date) + deleted
print date_to_adds
print date_to_deletes
def get_total(output):
try:
return sum(int(line.split()[0]) for line in output.split('\n')), sum(int(line.split()[1]) for line in output.split('\n'))
except:
import ipdb; ipdb.set_trace()