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

Unified Diff: scm.py

Issue 524046: Add "diff against" support when sending try patches. (Closed)
Patch Set: Created 10 years, 11 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/trychange_unittest.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 eabaad119c02d1bdf308fa48744b353beeb1e619..af11d541da7fbe49dedd54c3495774bab6bf7406 100644
--- a/scm.py
+++ b/scm.py
@@ -550,7 +550,7 @@ class SVN(object):
return output
@staticmethod
- def DiffItem(filename, full_move=False):
+ def DiffItem(filename, full_move=False, revision=None):
"""Diffs a single file.
Be sure to be in the appropriate directory before calling to have the
@@ -570,7 +570,10 @@ class SVN(object):
bogus_dir = tempfile.mkdtemp()
try:
# Grabs the diff data.
- data = SVN.Capture(["diff", "--config-dir", bogus_dir, filename], None)
+ command = ["diff", "--config-dir", bogus_dir, filename]
+ if revision is not None:
bradn 2010/01/07 01:50:13 if not revision:
+ command.extend(['--revision', revision])
+ data = SVN.Capture(command, None)
if data:
pass
elif SVN.IsMoved(filename):
@@ -600,7 +603,7 @@ class SVN(object):
return data
@staticmethod
- def GenerateDiff(filenames, root=None, full_move=False):
+ def GenerateDiff(filenames, root=None, full_move=False, revision=None):
"""Returns a string containing the diff for the given file list.
The files in the list should either be absolute paths or relative to the
@@ -618,7 +621,7 @@ class SVN(object):
try:
os.chdir(root)
diff = "".join(filter(None,
- [SVN.DiffItem(RelativePath(f, root),
+ [SVN.DiffItem(RelativePath(f, root, revision),
full_move=full_move)
for f in filenames]))
finally:
« no previous file with comments | « no previous file | tests/trychange_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698