Пример #1
0
def checkout_or_update(prj_root, static_config_path, code_svn_path, revision=None):
    # 先获取目录列表,然后对单个目录进行处理
    if not os.path.exists(prj_root) or not os.path.isdir(prj_root):
        get_code(prj_root, static_config_path, code_svn_path, revision)
    else:
        svn_url_info = get_svn_url_info(code_svn_path)
#         pprint.pprint(svn_url_info)
        
        build_file_name = 'local.properties'
        local_build_file = static_config_path + os.sep + build_file_name
        
        child_dirs = []
        for item in svn_url_info:
            child_dir = prj_root + os.sep + item
            child_dirs.append(child_dir)
            
            if not os.path.exists(child_dir) or not os.path.isdir(child_dir):
                os.makedirs(child_dir)
                
                svn.checkout(svn_url_info[item][SourceConfigParser.URL_FLAG], child_dir, revision)
            else:
                child_svn_status = svn.status(child_dir)
                if child_svn_status:
                    svn.revert(child_dir)
                    svn.update(child_dir, revision)
                else:
                    svn.checkout(item, child_dir, revision)
                    
            if SourceConfigParser.PRJ_FLAG == svn_url_info[item][SourceConfigParser.TYPE_FLAG]:        
                myfile.replace_file(local_build_file, child_dir + os.sep + build_file_name)
Пример #2
0
def checkout_or_update_single_item(prj_root, code_svn_url, revision=None):
    path = prj_root

    # 先获取目录列表,然后对单个目录进行处理
    if not os.path.isdir(path):
        os.makedirs(path)
        svn.checkout(code_svn_url, path, revision)
    else:
        svn_status = svn.status(path)
        if svn_status:
            svn.revert(path)
            svn.update(path, revision)
        else:
            svn.checkout(code_svn_url, path, revision)
Пример #3
0
def checkout_or_update_single_item(prj_root, static_config_path, code_svn_url, revision=None):
    path = prj_root
    
    # 先获取目录列表,然后对单个目录进行处理
    if not os.path.exists(path) or not os.path.isdir(path):
        os.makedirs(path)
        svn.checkout(code_svn_url, path, revision)
    else:
        svn_status = svn.status(path)
        if svn_status:
            svn.revert(path)
            svn.update(path, revision)
        else:
            svn.checkout(code_svn_url, path, revision)
                
    build_file_name = 'local.properties'
    local_build_file = static_config_path + os.sep + build_file_name
    target_build_file = path + os.sep + build_file_name
    myfile.replace_file(local_build_file, target_build_file)
Пример #4
0
 def _update(self, _dir):
     # 先撤消更改,再更新代码
     svn.revert(_dir)
     svn.update(_dir)
Пример #5
0
def test_update_with_specified_revision():
    src_dir = r'D:\version_build\pytxxy\pytxxy'
    svn.update(src_dir, 3885)
Пример #6
0
def test_update():
    src_dir = r'D:\version_build\pytxxy\pytxxy'
    svn.update(src_dir)