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

Unified Diff: third_party/upload.py

Issue 6728033: Update upload.py to r690 and include fix for "support for git mv in rietveld" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/upload.py
diff --git a/third_party/upload.py b/third_party/upload.py
index ee2b4c2b4c4432bf84bee80226abc32bc27c2305..cdde7112a5de2c276e2b1b17a043fe0a8b93e376 100755
--- a/third_party/upload.py
+++ b/third_party/upload.py
@@ -1214,8 +1214,19 @@ class GitVCS(VersionControlSystem):
# git config key "diff.external" is used).
env = os.environ.copy()
if 'GIT_EXTERNAL_DIFF' in env: del env['GIT_EXTERNAL_DIFF']
- return RunShell(["git", "diff", "--no-ext-diff", "--full-index", "-M"]
- + extra_args, env=env)
+ # -M/-C will not print the diff for the deleted file when a file is renamed.
+ # This is confusing because the original file will not be shown on the
+ # review when a file is renamed. So first get the diff of all deleted files,
+ # then the diff of everything except deleted files with rename and copy
+ # support enabled.
+ cmd = ["git", "diff", "--no-ext-diff", "--full-index"]
+ diff = RunShell(cmd + ["--diff-filter=D"] + extra_args, env=env,
+ silent_ok=True)
+ diff += RunShell(cmd + ["-C", "--diff-filter=ACMRT"] + extra_args, env=env,
+ silent_ok=True)
+ if not diff:
+ ErrorExit("No output from %s" % (cmd + extra_args))
+ return diff
def GetUnknownFiles(self):
status = RunShell(["git", "ls-files", "--exclude-standard", "--others"],
@@ -1871,7 +1882,7 @@ def GuessVCSName(options):
if returncode == 0:
return (VCS_CVS, None)
except OSError, (errno, message):
- if error != 2:
+ if errno != 2:
raise
return (VCS_UNKNOWN, None)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698