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

Unified Diff: drover.py

Issue 501081: Add a minimum SVN version check to drover, to enforce the 1.5.x requirement. (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: drover.py
===================================================================
--- drover.py (revision 34837)
+++ drover.py (working copy)
@@ -127,6 +127,50 @@
pos = pos + 1
return log
+def getSVNVersionInfo():
+ """Extract version information from SVN"""
+ command = 'svn --version'
+ svn_info = subprocess.Popen(command,
+ shell=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).stdout.readlines()
+ info = {}
+ for line in svn_info:
+ match = re.search(r"svn, version ((\d+)\.(\d+)\.(\d+)) \(r(\d+)\)", line)
+ if match:
+ info['version']=match.group(1)
+ info['major']=int(match.group(2))
+ info['minor']=int(match.group(3))
+ info['patch']=int(match.group(4))
+ info['revision']=match.group(5)
+ return info
+
+ return None
+
+def isMinimumSVNVersion(major, minor, patch=0):
+ """Test for minimum SVN version"""
+ return _isMinimumSVNVersion(getSVNVersionInfo(), major, minor, patch)
+
+def _isMinimumSVNVersion(version, major, minor, patch=0):
+ """Test for minimum SVN version, internal method"""
+ if not version:
+ return False
+
+ if (version['major'] > major):
+ return True
+ elif (version['major'] < major):
+ return False
+
+ if (version['minor'] > minor):
+ return True
+ elif (version['minor'] < minor):
+ return False
+
+ if (version['patch'] >= patch):
+ return True
+ else:
+ return False
+
def checkoutRevision(url, revision, branch_url, revert=False):
files_info = getFileInfo(url, revision)
paths = getBestMergePaths2(files_info, revision)
@@ -370,6 +414,10 @@
if options.branch:
DEFAULT_WORKING += ("_" + options.branch)
+ if not isMinimumSVNVersion(1,5):
+ print "You need to use at least SVN version 1.5.x"
+ sys.exit(1)
+
# Override the default properties if there is a drover.properties file.
global file_pattern_
if os.path.exists("drover.properties"):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698