예제 #1
0
def git_p4_init(options):
    p4w = p4_wrapper()
    #Login to workspace
    p4w.p4_login(options.port, options.user, options.client, options.passwd)
    #Read client spec
    (res, p4conf) = p4w.p4_client_read()
    p4w.save_state()
    
    if not res:
        return
    #Add client to config
    config_wrapper.new_branch_config(options.branch, p4conf)
    #change root & write client config to p4 & config file
    new_root = ""
    if options.root == None:
        new_root = git_wrapper.get_topdir()+"/.git/p4repo_"+options.branch
        os.mkdir(new_root)
    else:
        new_root = options.root

    p4conf._root =  new_root
    p4w.p4_client_write(p4conf)
    
    p4conf._port = options.port
    p4conf._user = options.user
    p4conf._passwd = options.passwd    
    config_wrapper.set_branch_config(options.branch, p4conf)
    
    if options.nosync != True:
        git_p4_sync(options)
    else:        
        print "Initialized empty git-p4 repository"
    #TODO: set p4 head
        
    p4w.p4_logout()
예제 #2
0
def git_p4_init(options):
    p4w = p4_wrapper()
    #Login to workspace
    p4w.p4_login(options.port, options.user, options.client, options.passwd)
    #Read client spec
    (res, p4conf) = p4w.p4_client_read()
    p4w.save_state()

    if not res:
        return
    #Add client to config
    config_wrapper.new_branch_config(options.branch, p4conf)
    #change root & write client config to p4 & config file
    new_root = ""
    if options.root == None:
        new_root = git_wrapper.get_topdir() + "/.git/p4repo_" + options.branch
        os.mkdir(new_root)
    else:
        new_root = options.root

    p4conf._root = new_root
    p4w.p4_client_write(p4conf)

    p4conf._port = options.port
    p4conf._user = options.user
    p4conf._passwd = options.passwd
    config_wrapper.set_branch_config(options.branch, p4conf)

    if options.nosync != True:
        git_p4_sync(options)
    else:
        print "Initialized empty git-p4 repository"
    #TODO: set p4 head

    p4w.p4_logout()
예제 #3
0
def git_p4_config_write(branch_name, p4config):
    p4w = p4_wrapper()
    
    (p4port, p4user, p4client) = config_wrapper.get_branch_credentials(branch_name)
    p4w.p4_login(p4port, p4user, p4client)
    
    p4config_old = p4w.p4_client_read()
    config_wrapper.set_branch_config(branch_name, p4config)
    p4config_new = config_wrapper.get_branch_config(branch_name)
    p4w.p4_client_write(p4config_new)
    #TODO: add restoring previous config if write was not successfull
    p4w.logout()