mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 06:47:41 +03:00
introduce a way of requesting unhydrated commits
Summary: introduce a way of requesting unhydrated commits using client telemetry Reviewed By: StanislavGlebik Differential Revision: D27591868 fbshipit-source-id: 7616f9d3b222c2c7f43c2ba930086eb0ec9e15bc
This commit is contained in:
parent
ddf44c5b4d
commit
e11142d243
@ -76,6 +76,15 @@ def wantslfspointers(ui):
|
||||
return str(ui.configbool("lfs", "wantslfspointers"))
|
||||
|
||||
|
||||
@clienttelemetryfunc
|
||||
def wantsunhydratedcommits(ui):
|
||||
"""
|
||||
Tells the server whether this clients wants unhydrated draft commits
|
||||
"""
|
||||
|
||||
return str(ui.configbool("infinitepush", "wantsunhydratedcommits"))
|
||||
|
||||
|
||||
# Client telemetry data is generated before connection and stored here.
|
||||
_clienttelemetrydata = {}
|
||||
|
||||
|
@ -100,6 +100,10 @@ Configs::
|
||||
# Which compression algorithm to use for infinitepush bundles.
|
||||
bundlecompression = ZS
|
||||
|
||||
# Client-side option
|
||||
# Tells the server whether this clients wants unhydrated draft commits
|
||||
wantsunhydratedcommits = True
|
||||
|
||||
[remotenames]
|
||||
# Client-side option
|
||||
# This option should be set only if remotenames extension is enabled.
|
||||
@ -114,6 +118,7 @@ from edenscm.mercurial import (
|
||||
changegroup,
|
||||
discovery,
|
||||
error,
|
||||
registrar,
|
||||
extensions,
|
||||
node as nodemod,
|
||||
pycompat,
|
||||
@ -123,6 +128,9 @@ from edenscm.mercurial.i18n import _
|
||||
|
||||
from . import bundleparts, bundlestore, client, common, infinitepushcommands, server
|
||||
|
||||
configtable = {}
|
||||
configitem = registrar.configitem(configtable)
|
||||
configitem("infinitepush", "wantsunhydratedcommits", default=False)
|
||||
|
||||
cmdtable = infinitepushcommands.cmdtable
|
||||
|
||||
|
@ -31,6 +31,7 @@ set up the local repo
|
||||
$ hg pull -q --config lfs.wantslfspointers=True \
|
||||
> --config clienttelemetryvalues.somevalue=value \
|
||||
> --config clienttelemetryvalues.anothervalue=value2
|
||||
$ hg pull -q --config infinitepush.wantsunhydratedcommits=True
|
||||
|
||||
check telemetry
|
||||
>>> import json
|
||||
@ -38,33 +39,44 @@ check telemetry
|
||||
... data = f.read()
|
||||
>>> for record in data.strip("\0").split("\0"):
|
||||
... parsedrecord = json.loads(record)
|
||||
... for key in "command", "fullcommand", "wantslfspointers", "somevalue", "anothervalue":
|
||||
... for key in "command", "fullcommand", "wantslfspointers", "wantsunhydratedcommits", "somevalue", "anothervalue":
|
||||
... if "client_%s" % key in parsedrecord["data"]:
|
||||
... print("%s: %s" % (key, parsedrecord["data"]["client_%s" % key]))
|
||||
command: clone
|
||||
fullcommand: clone 'ssh://user@dummy/server' local -q
|
||||
wantslfspointers: False
|
||||
wantsunhydratedcommits: False
|
||||
command: pull
|
||||
fullcommand: pull
|
||||
wantslfspointers: False
|
||||
wantsunhydratedcommits: False
|
||||
command: pull
|
||||
fullcommand: pull -q
|
||||
wantslfspointers: False
|
||||
wantsunhydratedcommits: False
|
||||
command: pull
|
||||
fullcommand: pull --config 'clienttelemetry.announceremotehostname=False'
|
||||
wantslfspointers: False
|
||||
wantsunhydratedcommits: False
|
||||
command: pull
|
||||
fullcommand: pull -q --config 'lfs.wantslfspointers=True'
|
||||
wantslfspointers: True
|
||||
wantsunhydratedcommits: False
|
||||
command: pull
|
||||
fullcommand: pull -q --config 'lfs.wantslfspointers=True' --config 'clienttelemetryvalues.somevalue=value'
|
||||
wantslfspointers: True
|
||||
wantsunhydratedcommits: False
|
||||
somevalue: value
|
||||
command: pull
|
||||
fullcommand: pull -q --config 'lfs.wantslfspointers=True' --config 'clienttelemetryvalues.somevalue=value' --config 'clienttelemetryvalues.anothervalue=value2'
|
||||
wantslfspointers: True
|
||||
wantsunhydratedcommits: False
|
||||
somevalue: value
|
||||
anothervalue: value2
|
||||
command: pull
|
||||
fullcommand: pull -q --config 'infinitepush.wantsunhydratedcommits=True'
|
||||
wantslfspointers: False
|
||||
wantsunhydratedcommits: True
|
||||
|
||||
check blackbox
|
||||
$ hg blackbox --pattern '{"clienttelemetry": "_"}'
|
||||
@ -74,3 +86,4 @@ check blackbox
|
||||
* [clienttelemetry] peer name: * (glob)
|
||||
* [clienttelemetry] peer name: * (glob)
|
||||
* [clienttelemetry] peer name: * (glob)
|
||||
* [clienttelemetry] peer name: * (glob)
|
||||
|
Loading…
Reference in New Issue
Block a user