コード例 #1
0
def rewind_source(name, start_from, no_cascade):
    no_cascade = bool(no_cascade)
    start_from = start_from or 0
    configured = context.get_configured_sources()
    if name not in configured:
        click.echo('source "{}" not configured'.format(name))
        exit(1)
    response = manager.update_source(name, start_from, no_cascade=no_cascade)
    if response['source_updated']:
        click.echo('Source %s updated' % name)
    for projection in response['projections']:
        click.echo('Projection %s updated' % projection)
コード例 #2
0
def update_all(no_cascade):
    configured = context.get_configured_sources()
    for name in configured.keys():
        click.echo('Updating %s' % name)
        response = manager.check_source_updates_available(name)
        if not response['updates_available']:
            click.echo('Local data updated for %s, last update %s' %
                       (name, response['remote_last']))
            continue
        click.echo('Updates available for %s, local: %s, remote: %s' %
                   (name, response['local_last'], response['remote_last']))
        response = manager.update_source(name,
                                         response['local_last'],
                                         no_cascade=no_cascade)
        if response['source_updated']:
            click.echo('Source %s updated' % name)
        for projection in response['projections']:
            click.echo('Projection %s updated' % projection)
コード例 #3
0
def update_source(name, no_cascade):
    configured = context.get_configured_sources()
    if name not in configured:
        click.echo('source "{}" not configured'.format(name))
        exit(1)
    response = manager.check_source_updates_available(name)
    if not response['updates_available']:
        click.echo('Local data updated, last update %s' %
                   response['remote_last'])
        exit()
    click.echo('Updates available, local: %s, remote: %s' %
               (response['local_last'], response['remote_last']))
    response = manager.update_source(name,
                                     response['local_last'],
                                     no_cascade=no_cascade)
    if response['source_updated']:
        click.echo('Source %s updated' % name)
    for projection in response['projections']:
        click.echo('Projection %s updated' % projection)