From df3302b382adeb6e648fed4c61b704ae655b681e Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Thu, 31 Mar 2011 19:27:52 +0000 Subject: [PATCH] Update upload.py to r690 and include fix for "support for git mv in rietveld" I just don't want to wait for http://codereview.appspot.com/4333051 to be committed. R=dpranke@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/6728033 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80045 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/upload.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/third_party/upload.py b/third_party/upload.py index ee2b4c2b4..cdde7112a 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)