コード例 #1
0
ファイル: migrate.py プロジェクト: kcpt/content-scripts
if __name__ == '__main__':
    args = parser.parse_args()

    # For each line of the CSV, after migrating the specified widget we commit
    # the SVN repo. We skip the commit if there are errors during the migration.
    # However, if another line of the CSV moves a different widget in the same
    # project without errors we don't want to then commit both the successful
    # and unsuccessful migrations. Track the repos with errors to prevent this.
    # Some errors (unable to find widget or module) don't need to block commit.
    # Dict value indicates if commit blocking error has happened.
    reposWithErrors = {}

    repoSpecs = _getSpecsFromCsv()
    for name, environment, widgetDir, moduleDir, moduleWidgetDir in repoSpecs:
        try:
            repo = svn.ensureRepo(name, svn.MODULE_MIGRATION_UPDATE_SPECS,
                environment=environment)
        except svn.SvnError as e:
            log.error(e.message + '\n')
            # Haven't done any migration, don't worry about skipping future
            # commits.
            reposWithErrors[name + '-' + environment] = False
            continue

        if not moduleWidgetDir:
            moduleWidgetDir = widgetDir

        logging.info('Migrating from widget %s to module %s[%s] in %s-%s',
                     widgetDir, moduleDir, moduleWidgetDir, name, environment)

        widgetAbsolutePath = os.path.join(repo['path'], 'assets', 'widgets',
            widgetDir)
コード例 #2
0
    return results


if __name__ == '__main__':
    args = parser.parse_args()

    if not args.config and not (args.repos and args.modules):
        parser.print_usage()

    repoSpecs = [(name, args.environment, set(args.modules)) for name in \
        args.repos] if args.repos else []
    repoSpecs = repoSpecs + _getRepoSpecsFromCsv()

    for repoName, environment, moduleNames in repoSpecs:
        try:
            repo = svn.ensureRepo(repoName, svn.MODULES_UPDATE_SPECS,
                environment=environment)
        except svn.SvnError as e:
            log.error(e.message + '\n')
            continue

        print('Deleting the following modules from "%s":' %
            repo['path'])
        info = list_modules.getModuleInfo(repo['path'])

        performedDelete = False

        for module in info:
            if module['name'] in moduleNames:
                moduleNames.remove(module['name'])
                if args.dry_run:
                    print('\t"%s"' % module['name'])
コード例 #3
0
ファイル: sync_styles.py プロジェクト: kcpt/content-scripts
    args = parser.parse_args()

    syncSpecs = _getSyncSpecsFromCsv()

    for sourceName, sourceEnv, targetName, targetEnv, excludeFile, \
            pathsToSync in syncSpecs:

        # Validate exclude file.
        if excludeFile and not os.path.isfile(excludeFile):
            logging.error('Exclude file "%s" does not exist. Skipping sync.\n',
                excludeFile)
            continue

        # Update source & target.
        try:
            source = svn.ensureRepo(sourceName, svn.STYLES_UPDATE_SPECS,
                environment=sourceEnv)
        except svn.SvnError as e:
            log.error(e.message)
            log.error('Source repo in error state, unable to copy any styles '
                    'from %s to %s. Skipping\n', sourceName, targetName)
            continue

        try:
            target = svn.ensureRepo(targetName, svn.STYLES_UPDATE_SPECS,
                environment=targetEnv)
        except svn.SvnError as e:
            log.error(e.message)
            log.error('Target repo in error state, unable to copy any styles '
                      'from %s to %s. Skipping\n', sourceName, targetName)
            continue