Chromium Code Reviews| Index: git_upstream_diff.py |
| diff --git a/git_upstream_diff.py b/git_upstream_diff.py |
| index c7fe1f3449cad367d2d629ed24237bb99589dc2a..d8071e34f23913510e027d32270102292dbaee52 100755 |
| --- a/git_upstream_diff.py |
| +++ b/git_upstream_diff.py |
| @@ -9,7 +9,7 @@ import sys |
| import subprocess2 |
| from git_common import current_branch, get_or_create_merge_base, config_list |
|
agable
2014/03/26 15:36:24
Would be good to sort these imports.
iannucci
2014/03/26 18:51:11
Done.
|
| -from git_common import GIT_EXE |
| +from git_common import GIT_EXE, upstream |
| def main(args): |
| default_args = config_list('depot-tools.upstream-diff.default-args') |
| @@ -22,10 +22,20 @@ def main(args): |
| 'instead of line-wise diff')) |
| opts, extra_args = parser.parse_known_args(args) |
| + cur = current_branch() |
| + if not cur or cur == 'HEAD': |
| + print 'fatal: cannot perform git-upstream-diff while not on a branch' |
| + return 1 |
| + |
| + par = upstream(cur) |
| + if not par: |
| + print 'fatal: branch %s has no configured upstream' % cur |
|
agable
2014/03/26 15:36:24
fatal: branch.%s.merge is not configured
?
iannucci
2014/03/26 18:51:11
Yeah, but it's also ...remote. I'm changing to the
|
| + return 1 |
| + |
| cmd = [GIT_EXE, 'diff', '--patience', '-C', '-C'] |
| if opts.wordwise: |
| cmd += ['--word-diff=color', r'--word-diff-regex=(\w+|[^[:space:]])'] |
| - cmd += [get_or_create_merge_base(current_branch())] |
| + cmd += [get_or_create_merge_base(cur, par)] |
| cmd += extra_args |