Commit 04d22591 authored by maruel@chromium.org's avatar maruel@chromium.org

Add back support for git mv files.

It was added in r80045 but was overwriten in r82495 when I synced upload.py to
r705 since upstreaming that part staled.

TBR=dpranke
TEST="git mv foo bar; git commit -a; git cl upload" shows 2 files, one A+, one D.
BUG=none

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@84264 0039d316-1c4b-4281-b951-d872f2087c98
parent 3cdb7f36
......@@ -1230,8 +1230,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"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment