Add Git support to the simple rebaseline tool. Do SVN commands only in an svn checkout.
Review URL: https://codereview.appspot.com/6814099
git-svn-id: http://skia.googlecode.com/svn/trunk@6341 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/rebaseline.py b/tools/rebaseline.py
index 58eeb1d..e907c75 100755
--- a/tools/rebaseline.py
+++ b/tools/rebaseline.py
@@ -43,6 +43,9 @@
testname = sys.argv[1]
+is_svn_checkout = os.path.exists(os.path.join('..', '.svn'))
+is_git_checkout = os.path.exists(os.path.join('..', '.git'))
+
for pair in pairs:
if (pair[0] == 'base-shuttle-win7-intel-angle'):
testtypes = [ 'angle' ]
@@ -63,7 +66,11 @@
outfilename = os.path.join(pair[0], infilename);
cmd = [ 'cp', temp.name, outfilename ]
subprocess.call(cmd);
- cmd = [ 'svn', 'add', '--quiet', outfilename ]
- subprocess.call(cmd)
- cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png', outfilename ];
- subprocess.call(cmd)
+ if is_svn_checkout:
+ cmd = [ 'svn', 'add', '--quiet', outfilename ]
+ subprocess.call(cmd)
+ cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png', outfilename ];
+ subprocess.call(cmd)
+ elif is_git_checkout:
+ cmd = [ 'git', 'add', outfilename ]
+ subprocess.call(cmd)