Esempio n. 1
0
def git_p4_config(options):
    if False == config_wrapper.is_p4_repo():
        print "ERROR: No P4 branch in this repository"
        return
    
    #List all p4 branches configuration
    if options.list_all == True:
        git_p4_config_list(None)
        return
    
    #Set branch for next operations & check it
    branch_name = ""    
    if options.branch == None:
        branch_name = git_wrapper.get_current_branch()
    else:
        branch_name = options.branch        
    if config_wrapper.is_p4_branch(branch_name) == False:
        print "ERROR: "+branch_name+" is not P4 branch"
        return
    
    #List selected p4 branch configuration 
    if options.list == True:
        git_p4_config_list(branch_name)
    else:
        p4config = []
        not_p4conf = ["branch", "subcommand", "list", "list_all", "passwd"]
        for name, value in options.__dict__.iteritems():
            if name not in not_p4conf and value != None:
                p4config.append((name, value))
            
        git_p4_config_write(branch_name, p4config)
Esempio n. 2
0
def test_git_p4_init():
    options = argparse.Namespace()
    options.__setattr__("subcommand", "init")
    options.__setattr__("port", "localhost:1818") 
    options.__setattr__("user", "g.pasieka")
    options.__setattr__("client", "test_depot_g.pasieka")
    options.__setattr__("passwd", "zaq12WSX")
    options.__setattr__("branch", "test-branch")
    options.__setattr__("root", None)
    options.__setattr__("nosync", False)
    options.__setattr__("sync", None)
    
    git_p4_init(options)
    
    if git_wrapper.get_current_branch() != options.branch:
        print "ERROR bad branch name after git-p4 init"
        return False
    if git_wrapper.check_head_CL_tag() == None:
        print "ERROR no tag on last commit"
        return False
    if len(git_wrapper.get_all_commits()) <= 1:
        print "ERROR some changelists were not commited"
        return False
    
    return True
Esempio n. 3
0
def test_git_p4_init():
    options = argparse.Namespace()
    options.__setattr__("subcommand", "init")
    options.__setattr__("port", "localhost:1818")
    options.__setattr__("user", "g.pasieka")
    options.__setattr__("client", "test_depot_g.pasieka")
    options.__setattr__("passwd", "zaq12WSX")
    options.__setattr__("branch", "test-branch")
    options.__setattr__("root", None)
    options.__setattr__("nosync", False)
    options.__setattr__("sync", None)

    git_p4_init(options)

    if git_wrapper.get_current_branch() != options.branch:
        print "ERROR bad branch name after git-p4 init"
        return False
    if git_wrapper.check_head_CL_tag() == None:
        print "ERROR no tag on last commit"
        return False
    if len(git_wrapper.get_all_commits()) <= 1:
        print "ERROR some changelists were not commited"
        return False

    return True