Exemple #1
0
def _peersetup(ui, peer):
    if peer.capable("clienttelemetry"):
        logargs = clienttelemetryvaluesfromconfig(ui)
        logargs.update(
            {name: f(ui)
             for name, f in _clienttelemetryfuncs.items()})
        logargs.update(_clienttelemetrydata)
        response = decodeutf8(peer._call("clienttelemetry", **logargs))
        responseitems = response.split()
        peername = responseitems[0] if responseitems else ""
        peer._realhostname = peername
        peerinfo = {}
        for index in range(1, len(responseitems) - 1, 2):
            peerinfo[responseitems[index]] = responseitems[index + 1]
        peer._peerinfo = peerinfo
        blackbox.log(
            {"clienttelemetry": {
                "peername": peername,
                "peerinfo": peerinfo
            }})
        util.info("client-telemetry", peername=peername, **peerinfo)
        ann = ui.configbool("clienttelemetry", "announceremotehostname", None)
        if ann is None:
            ann = not ui.plain() and ui._isatty(ui.ferr)
        if ann and not ui.quiet:
            ui.write_err(_("connected to %s\n") % response)
            perftrace.tracevalue("Server", peername)
            for item, value in peerinfo.items():
                perftrace.tracevalue(f"Server {item}", value)
Exemple #2
0
def _peersetup(ui, peer):
    if peer.capable("clienttelemetry"):
        logargs = {name: f(ui) for name, f in _clienttelemetryfuncs.items()}
        logargs.update(_clienttelemetrydata)
        peername = decodeutf8(peer._call("clienttelemetry", **logargs))
        peer._realhostname = peername
        blackbox.log({"clienttelemetry": {"peername": peername}})
        util.info("client-telemetry", peername=peername)
        ann = ui.configbool("clienttelemetry", "announceremotehostname", None)
        if ann is None:
            ann = not ui.plain() and ui._isatty(ui.ferr)
        if ann and not ui.quiet:
            ui.warn(_("connected to %s\n") % peername)
            perftrace.tracevalue("Server", peername)
Exemple #3
0
def logsyncop(
    repo,
    op,
    version,
    oldheads,
    newheads,
    oldbm,
    newbm,
    oldrbm,
    newrbm,
    oldsnapshots,
    newsnapshots,
):
    oldheadsset = set(oldheads)
    newheadsset = set(newheads)
    oldbmset = set(oldbm)
    newbmset = set(newbm)
    oldrbmset = set(oldrbm)
    newrbmset = set(newrbm)
    oldsnapset = set(oldsnapshots)
    newsnapset = set(newsnapshots)
    addedheads = blackbox.shortlist(
        [h for h in newheads if h not in oldheadsset])
    removedheads = blackbox.shortlist(
        [h for h in oldheads if h not in newheadsset])
    addedbm = blackbox.shortlist([h for h in newbm if h not in oldbmset])
    removedbm = blackbox.shortlist([h for h in oldbm if h not in newbmset])
    addedrbm = blackbox.shortlist([h for h in newrbm if h not in oldrbmset])
    removedrbm = blackbox.shortlist([h for h in oldrbm if h not in newrbmset])
    addedsnaps = blackbox.shortlist(
        [h for h in newsnapshots if h not in oldsnapset])
    removedsnaps = blackbox.shortlist(
        [h for h in oldsnapshots if h not in newsnapset])
    blackbox.log({
        "commit_cloud_sync": {
            "op": op,
            "version": version,
            "added_heads": addedheads,
            "removed_heads": removedheads,
            "added_bookmarks": addedbm,
            "removed_bookmarks": removedbm,
            "added_remote_bookmarks": addedrbm,
            "removed_remote_bookmarks": removedrbm,
            "added_snapshots": addedsnaps,
            "removed_snapshots": removedsnaps,
        }
    })
    util.info("commit-cloud-sync", op=op, version=version)