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

Unified Diff: scm.py

Issue 501171: Add full_move flag to GIT.GenerateDiff and Factor out FindGclientRootDir into gclient_utils. (Closed)
Patch Set: Created 11 years 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 | « gclient_utils.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 2e135558801223059bba50f4fa0b892f1f7e5571..db4711e366bb7b1472d067248dd51e139b777493 100644
--- a/scm.py
+++ b/scm.py
@@ -177,12 +177,17 @@ class GIT(object):
return upstream_branch
@staticmethod
- def GenerateDiff(cwd, branch=None):
- """Diffs against the upstream branch or optionally another branch."""
+ def GenerateDiff(cwd, branch=None, full_move=False):
+ """Diffs against the upstream branch or optionally another branch.
+
+ full_move means that move or copy operations should completely recreate the
+ files, usually in the prospect to apply the patch for a try job."""
if not branch:
branch = GIT.GetUpstream(cwd)
- diff = GIT.Capture(['diff-tree', '-p', '--no-prefix', branch, 'HEAD'],
- cwd).splitlines(True)
+ command = ['diff-tree', '-p', '--no-prefix', branch, 'HEAD']
+ if not full_move:
+ command.append('-C')
+ diff = GIT.Capture(command, cwd).splitlines(True)
for i in range(len(diff)):
# In the case of added files, replace /dev/null with the path to the
# file being added.
@@ -524,7 +529,9 @@ class SVN(object):
"""Diffs a single file.
Be sure to be in the appropriate directory before calling to have the
- expected relative path."""
+ expected relative path.
+ full_move means that move or copy operations should completely recreate the
+ files, usually in the prospect to apply the patch for a try job."""
# Use svn info output instead of os.path.isdir because the latter fails
# when the file is deleted.
if SVN.CaptureInfo(filename).get("Node Kind") == "directory":
« no previous file with comments | « gclient_utils.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698