Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: git_cl.py

Issue 10795003: Fix stats output to be always the same and coherent with what is committed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 5bd6d1be4db4d54e49cc3abd2c9fe409ba1643c4..fa7007bd2534ae4083b8a7e66296f4b133e7e333 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -135,6 +135,19 @@ def MatchSvnGlob(url, base_url, glob_spec, allow_wildcards):
return None
+def print_stats(args):
+ """Prints statistics about the change to the user."""
+ # --no-ext-diff is broken in some versions of Git, so try to work around
+ # this by overriding the environment (but there is still a problem if the
+ # git config key "diff.external" is used).
+ env = os.environ.copy()
+ if 'GIT_EXTERNAL_DIFF' in env:
+ del env['GIT_EXTERNAL_DIFF']
+ return subprocess2.call(
+ ['git', 'diff', '--no-ext-diff', '--stat', '--find-copies-harder'] + args,
+ env=env)
+
+
class Settings(object):
def __init__(self):
self.default_server = None
@@ -1126,16 +1139,7 @@ def CMDupload(parser, args):
if not options.reviewers and hook_results.reviewers:
options.reviewers = hook_results.reviewers
- # --no-ext-diff is broken in some versions of Git, so try to work around
- # this by overriding the environment (but there is still a problem if the
- # git config key "diff.external" is used).
- env = os.environ.copy()
- if 'GIT_EXTERNAL_DIFF' in env:
- del env['GIT_EXTERNAL_DIFF']
- subprocess2.call(
- ['git', 'diff', '--no-ext-diff', '--stat', '--find-copies-harder'] + args,
- env=env)
-
+ print_stats(args)
if settings.GetIsGerrit():
return GerritUpload(options, args, cl)
return RietveldUpload(options, args, cl)
@@ -1265,7 +1269,7 @@ def SendUpstream(parser, args, cmd):
branches = [base_branch, cl.GetBranchRef()]
if not options.force:
- subprocess2.call(['git', 'diff', '--stat'] + branches)
+ print_stats(branches)
ask_for_data('About to commit; enter to confirm.')
# We want to squash all this branch's commits into one commit with the proper
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698