def changegrouphook(ui, repo, node=None, source=None, **kwargs):
    """Record replication events after a changegroup has been added."""
    start = time.time()

    heads = set(repo.heads())
    pushnodes = []
    pushheads = []

    for rev in range(repo[node].rev(), len(repo)):
        ctx = repo[rev]

        pushnodes.append(ctx.hex())

        if ctx.node() in heads:
            pushheads.append(ctx.hex())

    with ui.kafkainteraction():
        repo.producerlog('CHANGEGROUPHOOK_SENDING')
        vcsrproducer.record_hg_changegroup(ui.replicationproducer,
                                           repo.replicationwireprotopath,
                                           source,
                                           pushnodes,
                                           pushheads,
                                           partition=repo.replicationpartition)
        duration = time.time() - start
        repo.producerlog('CHANGEGROUPHOOK_SENT')
        ui.status(_('recorded changegroup in replication log in %.3fs\n') %
                    duration)
Beispiel #2
0
def changegrouphook(ui, repo, node=None, source=None, **kwargs):
    """Record replication events after a changegroup has been added."""
    start = time.time()

    heads = set(repo.heads())
    pushnodes = []
    pushheads = []

    for rev in range(repo[node].rev(), len(repo)):
        ctx = repo[rev]

        pushnodes.append(ctx.hex())

        if ctx.node() in heads:
            pushheads.append(ctx.hex())

    with ui.kafkainteraction():
        repo.producerlog('CHANGEGROUPHOOK_SENDING')
        vcsrproducer.record_hg_changegroup(ui.replicationproducer,
                                           repo.replicationwireprotopath,
                                           source,
                                           pushnodes,
                                           pushheads,
                                           partition=repo.replicationpartition)
        duration = time.time() - start
        repo.producerlog('CHANGEGROUPHOOK_SENT')
        ui.status(
            _('recorded changegroup in replication log in %.3fs\n') % duration)

        for key, value in sorted(
                repo._replicationinfo['obsolescence'].iteritems()):
            sendpushkeymessage(ui, repo, 'obsolete', key, '', value, 0)
def changegrouphook(ui, repo, node=None, source=None, **kwargs):
    start = time.time()

    heads = set(repo.heads())
    pushnodes = []
    pushheads = []

    for rev in range(repo[node].rev(), len(repo)):
        ctx = repo[rev]

        pushnodes.append(ctx.hex())

        if ctx.node() in heads:
            pushheads.append(ctx.hex())

    vcsrproducer.record_hg_changegroup(ui.replicationproducer,
                                       repo.replicationwireprotopath,
                                       source,
                                       pushnodes,
                                       pushheads,
                                       partition=repo.replicationpartition)
    duration = time.time() - start
    ui.status(_('recorded changegroup in replication log in %.3fs\n') % duration)