summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-22 18:29:16 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-22 18:29:16 +0000
commit65eaaba21a385da9b7b04ff31cba80d9bf426bff (patch)
tree0588591b12a93b615185f99cd5c1ee965e3d5dc5
parent0ed0161de805d248220a12fa4bcce590b198f4a4 (diff)
downloadATCD-65eaaba21a385da9b7b04ff31cba80d9bf426bff.tar.gz
Sat Jul 22 18:28:33 UTC 2006 William R. Otte <wotte@dre.vanderbilt.edu>
-rw-r--r--ChangeLog7
-rwxr-xr-xbin/sets-manager.py180
2 files changed, 187 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 343e85205dc..bd5a0c788bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Jul 22 18:28:33 UTC 2006 William R. Otte <wotte@dre.vanderbilt.edu>
+
+ * bin/sets-manager.py
+
+ First cut of a branching script for subverion. Pass --help
+ to get documentation.
+
Fri Jul 21 13:28:31 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
* bin/MakeProjectCreator/config/taoidldefaults.mpb:
diff --git a/bin/sets-manager.py b/bin/sets-manager.py
new file mode 100755
index 00000000000..73c922239f3
--- /dev/null
+++ b/bin/sets-manager.py
@@ -0,0 +1,180 @@
+#!/opt/local/bin/python
+
+""" This script implements branching and tagging in the DOC group
+repository, and automates the process of creating sets. """
+
+import os
+
+def parse_args ():
+ from optparse import OptionParser
+
+ parser = OptionParser ("usage: %prog [optoins] name")
+ parser.add_option ("-A", "--ACE", dest="project", action="store_const",
+ help="Branch/tag only ACE", default=None, const="ace")
+ parser.add_option ("-T", "--TAO", dest="project", action="store_const",
+ help="Branch/tag ACE and TAO", default=None, const="tao")
+ parser.add_option ("-C", "--CIAO", dest="project", action="store_const",
+ help="Branch/tag ACE, TAO, and CIAO", default=None, const="ciao")
+ parser.add_option ("-t", "--tag", dest="action",
+ help="Create a tag", action="store_true", default=None)
+ parser.add_option ("-b", "--branch", dest="action", action="store_false",
+ help="Create a branch", default=None)
+ parser.add_option ("-v", "--verbose", dest="verbose", action="store_true",
+ help="Print out verbose debugging output", default=False)
+ parser.add_option ("-s", "--svn", dest="svn", default="svn",
+ help="Full path to svn binary, if not in path")
+ parser.add_option ("-r", "--repo", dest="repo",
+ default="https://svn.dre.vanderbilt.edu/DOC/ACE/",
+ help="Repository to use, defaults to s.d.v.e/DOC/ACE.")
+ parser.add_option ("--src", dest="source", default="trunk/",
+ help="Path in repository from which to branch, defaults to trunk")
+ parser.add_option ("--dest", dest="dest", default="",
+ help="Specifies a subdirectory of branches or tags in which " +
+ "to place the new branch/tag. dest must already exist.")
+ parser.add_option ("-n", dest="take_action", action="store_false", default=True,
+ help="Take no action")
+ (opts, args) = parser.parse_args ()
+
+ if len(args) != 1:
+ parser.error ("must specify exactly one branch or tag name")
+
+ if opts.action is None:
+ parser.error ("must specify either a branch or tag action")
+
+ if opts.project is None:
+ parser.error ("must specity a project to branch")
+
+ return (opts, args)
+
+def execute (command):
+ from os import system
+
+ if opts.verbose:
+ print "executing " + command
+ if opts.take_action and os.system (command) != 0:
+ raise Exception ("Command failed: " + command)
+
+def svn_copy (source, dest):
+ command = " ".join ([opts.svn,
+ "copy",
+ '-m "branching/tagging"',
+ source,
+ dest])
+ execute (command)
+
+def svn_propset (path, prop, value):
+ command = " ".join ([opts.svn,
+ "propset",
+ prop,
+ "'" + value + "'",
+ path])
+ execute (command)
+
+def svn_mkdir (path):
+ command = " ".join ([opts.svn,
+ "mkdir",
+ '-m "branching/tagging"',
+ path])
+ execute (command)
+
+def svn_mkdir_local (path):
+ command = " ".join ([opts.svn,
+ "mkdir",
+ path])
+ execute (command)
+
+def branch_ACE ():
+ # Perform branching
+ destination = opts.repo + opts.dest
+ svn_copy (opts.repo + opts.source + "/ACE",
+ destination + "modules/ACE")
+ #Create the set
+ svn_mkdir_local ("sets/ACE")
+ svn_propset ("sets/ACE",
+ "svn:externals",
+ "%s\t%s" % ("ACE_wrappers",
+ destination + "modules/ACE"))
+
+def branch_TAO ():
+ branch_ACE ()
+
+ # Perform branching
+ destination = opts.repo + opts.dest
+ svn_copy (opts.repo + opts.source + "/TAO",
+ destination + "modules/TAO")
+
+ #Create the set
+ svn_mkdir_local ("sets/ACE+TAO")
+ svn_propset ("sets/ACE+TAO",
+ "svn:externals",
+ "%s\t%s\n%s\t%s" % ("ACE_wrappers",
+ destination + "modules/ACE",
+ "ACE_wrappers/TAO",
+ destination + "modules/TAO"))
+
+def branch_CIAO ():
+ branch_TAO ()
+
+ #Perform branching
+ destination = opts.repo + opts.dest
+ svn_copy (opts.repo + opts.source + "/CIAO",
+ destination + "modules/CIAO")
+
+ # Create the set
+ svn_mkdir_local ("sets/ACE+TAO+CIAO")
+ svn_propset ("sets/ACE+TAO+CIAO",
+ "svn:externals",
+ "%s\t%s\n%s\t%s\n%s\t%s" %
+ ("ACE_wrappers",
+ destination + "modules/ACE",
+ "ACE_wrappers/TAO",
+ destination + "modules/TAO",
+ "ACE_wrappers/TAO/CIAO",
+ destination + "modules/CIAO"))
+
+def main (opts, args):
+ # Lets make opts global
+ globals ()['opts'] = opts
+
+ path = str ()
+ if opts.action:
+ # True for tag
+ path = "tags/"
+ else: # Branch
+ path = "branches/"
+
+ path += "%s/%s" % (opts.dest, args[0])
+ # Make branch/tag directory
+ svn_mkdir (opts.repo + path)
+
+ # Make modules and sets subdirectory
+ svn_mkdir (opts.repo + path + "/modules")
+ svn_mkdir (opts.repo + path + "/sets")
+
+ # We need a local copy of the sets directory, as svn:externals
+ # can only be modified locally
+ execute ("svn co " + opts.repo + path + "/sets")
+
+ # opts.dest should now be set to path, all of the branching
+ # functions assume dest now points to the branch/tag in which
+ # the copies should be places
+ opts.dest = path + '/'
+
+ {'ace': branch_ACE,
+ 'tao': branch_TAO,
+ 'ciao': branch_CIAO}[opts.project] ()
+
+ # Commit the sets directory
+ execute ('svn commit -m "branching/tagging" sets')
+
+ # remove the sets directory
+ for root, dirs, files in os.walk ('sets', False):
+ for name in files:
+ os.remove (os.path.join (root, name))
+ for name in dirs:
+ os.rmdir (os.path.join (root, name))
+
+if __name__ == "__main__":
+ opts, args = parse_args ()
+ main (opts, args)
+