diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig index d8d752c3..9c2a028e 100644 --- a/dotfiles/gitconfig +++ b/dotfiles/gitconfig @@ -20,6 +20,7 @@ ignore-untracked="!git untracked | xargs -n1 git ignore" power-clean = clean -ffd db = !"db() { git diff HEAD~"$1"; }; db" + clone = clone --recursive branches = branch -a remotes = remote -v @@ -42,6 +43,8 @@ # 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" 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] # Use custom `.gitignore` and `.gitattributes` @@ -70,14 +73,6 @@ changed = yellow untracked = red -[url "git@gist.github.com:"] - insteadOf = "gst:" - pushInsteadOf = "gist:" - pushInsteadOf = "git://gist.github.com/" - -[url "git://gist.github.com/"] - insteadOf = "gist:" - [user] email = IvanMalison@gmail.com name = Ivan Malison diff --git a/dotfiles/gitignore b/dotfiles/gitignore index 02c0a869..df717252 100644 --- a/dotfiles/gitignore +++ b/dotfiles/gitignore @@ -19,8 +19,6 @@ Thumbs.db # yelp TAGS -run_tests.sh -untracked/ .ropeproject/ *.sw* diff --git a/resources/python/tasks.py b/resources/python/tasks.py new file mode 100644 index 00000000..5e4113b9 --- /dev/null +++ b/resources/python/tasks.py @@ -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() +