示例#1
0
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("")
def main():

    parser = make_parser()
    args = parser.parse_args()

#    if len(args)!=3:
#        parser.error("Incorrect number of arguments.")

    # setup the environment
    module = args.module_name
    release_number = args.release
    branch_name = args.branch_name
    
    # import svn client
    from dls_environment.svn import svnClient    
    svn = svnClient()
    svn.setLogMessage(module + ": creating bugfix branch " + branch_name)
    
    # setup area
    if args.area == "ioc":
        assert len(module.split('/')) > 1, "Missing Technical Area under Beamline"
    release = os.path.join(gitf.prodModule(module, args.area), release_number)
    branch = os.path.join(gitf.branchModule(module, args.area), branch_name)

    # Check for existence of release in svn, non-existence of branch in svn and current directory
    assert svn.pathcheck(release), 'Repository does not contain "' + release + '"'
    assert not svn.pathcheck(branch), 'Repository already contains "' + branch + '"'
    assert not os.path.isdir(branch.split("/")[-1]), \
        branch.split("/")[-1] + " already exists in this directory. " \
                                "Please choose another name or move elsewhere."

    # Make the module in branch directory if it doesn't exist
    if not svn.pathcheck(gitf.branchModule(module, args.area)):
        svn.mkdir(gitf.branchModule(module, args.area))

    svn.copy(release, branch)
    print 'Created bugfix branch from ' + module + ': ' + \
          release_number + " in " + branch
    
    svn.checkout(branch, branch_name)
    print 'Checked out to ./' + branch_name