[cig-commits] r5850 - cs/buildbot/trunk/contrib
leif at geodynamics.org
leif at geodynamics.org
Fri Jan 19 18:32:43 PST 2007
Author: leif
Date: 2007-01-19 18:32:43 -0800 (Fri, 19 Jan 2007)
New Revision: 5850
Modified:
cs/buildbot/trunk/contrib/svn_buildbot.py
Log:
Enhanced svn_buildbot.py so that it handles the typical multi-project
SVN repository layout that we use:
projectA/trunk/files..
projectA/branches/branch1/files..
projectA/branches/branch2/files..
projectA/tags/tag1/files..
projectA/tags/tag2/files..
projectB/trunk/files..
...
Modified: cs/buildbot/trunk/contrib/svn_buildbot.py
===================================================================
--- cs/buildbot/trunk/contrib/svn_buildbot.py 2007-01-20 01:46:39 UTC (rev 5849)
+++ cs/buildbot/trunk/contrib/svn_buildbot.py 2007-01-20 02:32:43 UTC (rev 5850)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# this requires python >=2.3 for the 'sets' module.
@@ -110,26 +110,36 @@
return (None, changed_file)
# this version handles repository layouts that look like:
-# trunk/files.. -> trunk
-# branches/branch1/files.. -> branches/branch1
-# branches/branch2/files.. -> branches/branch2
+# projectA/trunk/files..
+# projectA/branches/branch1/files..
+# projectA/branches/branch2/files..
+# projectA/tags/tag1/files..
+# projectA/tags/tag2/files..
+# projectB/trunk/files..
+# ...
#
+
def split_file_branches(changed_file):
- pieces = changed_file.split(os.sep)
- if pieces[0] == 'branches':
- return (os.path.join(*pieces[:2]),
- os.path.join(*pieces[2:]))
- if pieces[0] == 'trunk':
- return (pieces[0], os.path.join(*pieces[1:]))
- ## there are other sibilings of 'trunk' and 'branches'. Pretend they are
- ## all just funny-named branches, and let the Schedulers ignore them.
- #return (pieces[0], os.path.join(*pieces[1:]))
+ filename = changed_file.split(os.sep)
+ branchname = []
+ while filename:
+ piece = filename.pop(0)
+ branchname.append(piece)
+ if piece == 'trunk':
+ break
+ elif piece == 'branches' or piece == 'tags':
+ piece = filename.pop(0)
+ branchname.append(piece)
+ break
+ if not filename:
+ raise RuntimeError("cannot determine branch for '%s'" % changed_file)
+ branchname = os.sep.join(branchname)
+ filename = os.sep.join(filename)
+ return (branchname, filename)
- raise RuntimeError("cannot determine branch for '%s'" % changed_file)
+split_file = split_file_branches
-split_file = split_file_dummy
-
class ChangeSender:
def getChanges(self, opts):
More information about the cig-commits
mailing list