Index: git_upstream_diff.py |
diff --git a/git_upstream_diff.py b/git_upstream_diff.py |
index 9d9db95fd5d64bb1703f15dd38aa6c9270565370..fa0454e057bac0288e0014ac4a5c83dc07e20715 100755 |
--- a/git_upstream_diff.py |
+++ b/git_upstream_diff.py |
@@ -19,6 +19,9 @@ def main(args): |
help=( |
'Print a colorized wordwise diff ' |
'instead of line-wise diff')) |
+ parser.add_argument('--HEAD', action='store_true', default=False, |
+ help=('Diff against HEAD instead of the working copy.' |
agable
2014/05/07 00:57:48
No space between this period and 'Much...'
iannucci
2014/05/07 01:02:23
Good catch. Done.
|
+ 'Much faster for large repos.')) |
opts, extra_args = parser.parse_known_args(args) |
cur = git.current_branch() |
@@ -34,7 +37,10 @@ def main(args): |
cmd = [git.GIT_EXE, 'diff', '--patience', '-C', '-C'] |
if opts.wordwise: |
cmd += ['--word-diff=color', r'--word-diff-regex=(\w+|[^[:space:]])'] |
- cmd += [git.get_or_create_merge_base(cur, par)] |
+ if opts.HEAD: |
+ cmd += ['%s..%s' % (git.get_or_create_merge_base(cur, par), cur)] |
+ else: |
+ cmd += [git.get_or_create_merge_base(cur, par)] |
cmd += extra_args |