Add svndiff tool: runs skdiff over all pending changes in SVN checkout
This is needed for
https://goto.google.com/HowToLandSkiaChangesThatChangeWebkitLayoutTests ,
and will be generally useful beyond that too.
Review URL: https://codereview.appspot.com/6256052
git-svn-id: http://skia.googlecode.com/svn/trunk@4052 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/svn.py b/tools/svn.py
index 1fd1120..5c1fa41 100644
--- a/tools/svn.py
+++ b/tools/svn.py
@@ -64,6 +64,15 @@
files = new_regex.findall(stdout)
return files
+ def GetModifiedFiles(self):
+ """Return a list of files in this dir which are under SVN control, and
+ have been modified.
+ """
+ stdout = self._RunCommand(['svn', 'status'])
+ new_regex = re.compile('^M.....\s+(.+)$', re.MULTILINE)
+ files = new_regex.findall(stdout)
+ return files
+
def AddFiles(self, filenames):
"""Adds these files to SVN control.
@@ -94,3 +103,14 @@
all_files = os.listdir(self._directory)
matching_files = sorted(fnmatch.filter(all_files, filename_pattern))
self.SetProperty(matching_files, property_name, property_value)
+
+ def ExportBaseVersionOfFile(self, file_within_repo, dest_path):
+ """Retrieves a copy of the base version (what you would get if you ran
+ 'svn revert') of a file within the repository.
+
+ @param file_within_repo path to the file within the repo whose base
+ version you wish to obtain
+ @param dest_path destination to which to write the base content
+ """
+ self._RunCommand(['svn', 'export', '--revision', 'BASE',
+ file_within_repo, dest_path])