mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
e8908fa603
Summary: Some tools parse the output of hg, and the addition of the `connected to hostname` line breaks them. Fix this by changing the default behaviour of clienttelemetry to output to stderr, but only when plain and quiet are not set, and when stderr is a tty. Differential Revision: D7616326 fbshipit-source-id: 6eb329c75a7e8cf6e5ab43aa5ac36be82d1d2e7d
49 lines
1.2 KiB
Perl
49 lines
1.2 KiB
Perl
$ cat >> $HGRCPATH << EOF
|
|
> [ui]
|
|
> ssh = $PYTHON "$TESTDIR/dummyssh"
|
|
> [extensions]
|
|
> clienttelemetry=
|
|
> [clienttelemetry]
|
|
> announceremotehostname=true
|
|
> EOF
|
|
|
|
set up the server repo
|
|
$ hg init server
|
|
$ cat >> server/.hg/hgrc << EOF
|
|
> [extensions]
|
|
> sampling=
|
|
> [sampling]
|
|
> filepath = $TESTTMP/sampling.txt
|
|
> key.clienttelemetry = client
|
|
> EOF
|
|
|
|
set up the local repo
|
|
$ hg clone 'ssh://user@dummy/server' local -q
|
|
$ cd local
|
|
$ hg pull
|
|
pulling from ssh://user@dummy/server
|
|
connected to * (glob)
|
|
no changes found
|
|
$ hg pull -q
|
|
$ hg pull --config clienttelemetry.announceremotehostname=False
|
|
pulling from ssh://user@dummy/server
|
|
no changes found
|
|
|
|
check telemetry
|
|
>>> import json
|
|
>>> with open("$TESTTMP/sampling.txt") as f:
|
|
... data = f.read()
|
|
>>> for record in data.strip("\0").split("\0"):
|
|
... parsedrecord = json.loads(record)
|
|
... for key in "command", "fullcommand":
|
|
... print("%s: %s" % (key, parsedrecord["data"]["client_%s" % key]))
|
|
command: clone
|
|
fullcommand: clone 'ssh://user@dummy/server' local -q
|
|
command: pull
|
|
fullcommand: pull
|
|
command: pull
|
|
fullcommand: pull -q
|
|
command: pull
|
|
fullcommand: pull --config 'clienttelemetry.announceremotehostname=False'
|
|
|