Example #1
0
def svn2git(target_path, config, options):
    print('Converting package into Git repository. ' +
          'That may take several minutes.')
    rules_path = options.rules_path
    if rules_path is None:
        rules = []
        for pkg_name in options.repos:
            ns = {'package': pkg_name,
                  'package_regex': pkg_name.replace('.', '\\.'),
                  'package_path': pkg_name.replace('.', '/')}
            rules.append(
                config.get('migrate', 'pkg-rules-template').format(**ns))

        ns = {'packages_rules': '\n\n'.join(rules)}
        rules_path = tempfile.mktemp(pkg_name+'.txt')
        with io.open(rules_path, 'w') as file:
            file.write(
                config.get('migrate', 'rules-template').format(**ns))
        print('***** Created rules file: ' + rules_path)

    do([config.get('migrate', 'svn-all-fast-export'),
        '--svn-branches',
        '--add-metadata-notes',
        '--identity-map', config.get('migrate', 'identity-map'),
        '--rules', rules_path,
        '--stats',
        config.get('migrate', 'svn-mirror'),
        ], cwd=target_path, print_stdout=False)
Example #2
0
def push2github(target_path, config, options):
    for pkg_name in options.repos:
        git_path = os.path.join(target_path, pkg_name)
        do(['git', 'remote', 'add', 'origin',
            '[email protected]:%s/%s.git' %(
                    config.get('github', 'organization'), pkg_name)
            ], cwd=git_path)
        do(['git', 'push', '-u', 'origin', '--mirror'], cwd=git_path)
Example #3
0
def update_winegg(config, options):
    for pkg_name in options.repos:
        web_path = config.get('migrate', 'wineggbuilder-path')
        do(['sed', '-i',
            's/%s,.*/%s,git:\/\/github.com\/zopefoundation\/%s.git/g' %(
                    pkg_name, pkg_name, pkg_name),
            os.path.join(web_path, 'project-list.cfg')
            ])
        do(['svn', 'ci', '-m', pkg_name+' moved to GitHub.', web_path])
Example #4
0
def update_ztk(config, options):
    for pkg_name in options.repos:
        do(['sed', '-i',
            's/%s = .*/%s = git \$\{buildout:github\}\/%s/g' %(
                    pkg_name, pkg_name, pkg_name),
            os.path.join(config.get('migrate', 'ztk-path'), 'ztk-sources.cfg')
            ])
        do(['svn', 'ci',
            '-m', pkg_name + ' moved to GitHub.',
            config.get('migrate', 'ztk-path')])
Example #5
0
def clean_svn(config, options):
    for pkg_name in options.repos:
        co_path = tempfile.mkdtemp()
        print('Checking out code from SVN into: ' + co_path)
        pkg_path = os.path.join(co_path, pkg_name+'.svn')
        do(['svn', 'co', '--ignore-externals',
            config.get('migrate', 'svn-repos')+pkg_name+'/trunk',
            pkg_path
            ])
        do(['svn', 'propdel', 'svn:externals', '.'], pkg_path)
        to_delete = [os.path.join(pkg_path, fn)
                     for fn in os.listdir(pkg_path)
                     if fn not in ('.svn',)]
        if len(to_delete):
            do(['svn', 'rm', '--force'] + to_delete)
        moved_path = os.path.join(pkg_path, 'MOVED_TO_GITHUB')
        with io.open(moved_path, 'w') as file:
            file.write("See https://github.com/zopefoundation/"+pkg_name)
        do(['svn', 'add', moved_path])
        do(['svn', 'ci', '-m', 'Moved to GitHub.', pkg_path])