def main(): parser = ArgParser(usage) parser.add_argument( "module_name", type=str, default="", help="name of module to checkout") args = parser.parse_args() # if len(args) != 1: >>> argparse can't run if args not given <<< # parser.error("Incorrect number of arguments.") module = args.module # import svn client from dls_environment.svn import svnClient svn = svnClient() if args.area == "ioc": assert len(module.split('/')) > 1, 'Missing Technical Area under Beamline' vendor = gitf.vendorModule(module, args.area) vendor_current = os.path.join(vendor, "current") svn.setLogMessage('Searching vendor module branch for last import to "current"') for node in svn.ls(vendor): tt = os.path.join(vendor, os.path.basename(node['name'])) if os.path.basename(node['name']) != "current": diffs = svn.diff('/tmp', vendor_current, svn.Revision(svn.opt_revision_kind.head), tt, svn.Revision(svn.opt_revision_kind.head), True, True, True) if not diffs: print os.path.basename(node['name']) break
def main(): parser = make_parser() args = parser.parse_args() # if len(args) != 4: # parser.error("Incorrect number of arguments.") # setup the environment source = args.source module = args.module_name old = args.old_tag new = args.new_tag if args.area == "ioc": assert len(module.split('/')) > 1, "Missing Technical Area under Beamline" vendor = gitf.vendorModule(module, args.area) vendor_old = os.path.join(vendor, old) vendor_new = os.path.join(vendor, new) vendor_current = os.path.join(vendor, "current") trunk = gitf.devModule(module, args.area) disk_dir = module.split("/")[-1] svn.setLogMessage("Importing vendor source from: " + source) # The directory tree we are importing from must not contain any # .svn directories, otherwise "dls-svn_load_dirs" will fail with # a non-obvious error. for path, subdirs, files in os.walk(args[0]): for tt in subdirs: assert tt != '.svn', "An .svn directory has been found in " + \ source + ", cannot update from here!" # Check for existence of this module in vendor and trunk in the repository for dir in [vendor, trunk, vendor_old]: assert svn.pathcheck(dir), dir + " does not exist in the repository" assert not svn.pathcheck(vendor_new), vendor_new + " already exists in the repository" # check for diffs diffs = svn.diff('/tmp', vendor_current, svn.Revision(svn.opt_revision_kind.head), vendor_old, svn.Revision(svn.opt_revision_kind.head), True, True, True) assert args.force or not diffs, \ "Vendor 'current' of: " + vendor + " is not at revision: " + old + \ "\nUse the -f flag if you are sure you want to do this" print("Importing: " + module + " from: " + source + " to update from version: " + old + " to version: " + new) if os.system('dls-svn-load-dirs.pl -t ' + new + " " + vendor + " current " + source): print("dls-svn-load-dirs.pl command failed") else: print("") print("You probably now want to merge this update into the trunk.") print("Do this by issuing the following commands:") print("") print("svn checkout " + trunk + " " + disk_dir + " > /dev/null") print("svn merge " + vendor_old + " " + vendor_new + " " + disk_dir) print("")
def main(): parser = make_parser() args = parser.parse_args() # if len(args)!=3: # parser.error("Incorrect number of arguments.") # setup the environment source = args.source module = args.module_name version = args.release if args.area == "ioc": assert len(module.split('/')) > 1, "Missing Technical Area under Beamline" vendor = gitf.vendorModule(module, args.area) vendor_current = os.path.join(vendor, "current") vendor_version = os.path.join(vendor, version) trunk = gitf.devModule(module, args.area) disk_dir = module.split("/")[-1] svn.setLogMessage("Importing vendor source from: " + source) # Check for existence of this module in release, vendor and trunk in the repository check_dirs = [trunk, vendor, gitf.prodModule(module, args.area)] for dir in check_dirs: assert not svn.pathcheck(dir), dir + " already exists in the repository" assert os.path.isdir(source), source + " does not exist" assert not os.path.isdir(disk_dir), \ disk_dir + " exists on disk. Choose a different name or move elsewhere" print("Importing vendor source from: " + source) svn.import_(source, vendor_current, "Import of " + module + " from pristine " + version + " source", True) print("Tagging vendor source at version: " + version) svn.copy(vendor_current, vendor_version) # make directory tree if needed svn.mkdir(trunk[:trunk.rfind("/")]) print("Copying vendor source to trunk...") svn.copy(vendor_current, trunk) print("Checking out trunk...") svn.checkout(trunk, disk_dir) print("") print("Please now:") print("(1) Edit configure/RELEASE to put in correct paths") print("(2) Use make to check that it builds") print("(3) Commit with the following comment:") print("\"' + module + ': changed configure/RELEASE to reflect Diamond paths\"") print("")