Patchwork [6,of,7] remotedebug: allow to request --profile to the server

login
register
mail settings
Submitter Paul Morelle
Date June 20, 2018, 4:36 p.m.
Message ID <f663c257cf788d3f3d00.1529512587@belenos.localdomain>
Download mbox | patch
Permalink /patch/32349/
State Accepted
Headers show

Comments

Paul Morelle - June 20, 2018, 4:36 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1529492441 -7200
#      Wed Jun 20 13:00:41 2018 +0200
# Node ID f663c257cf788d3f3d00398dbf64d9b572536377
# Parent  fd3f8738e2ca4308a8a8f9e21cc05bb97a7200db
# EXP-Topic remote-debug
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f663c257cf78
remotedebug: allow to request --profile to the server

It is now possible to request --profile output of a server from the client.
Same as for `remote.debug` the server needs to explicitly allow the user to do
so.

Patch

diff -r fd3f8738e2ca -r f663c257cf78 mercurial/configitems.py
--- a/mercurial/configitems.py	Tue Jun 19 19:53:21 2018 +0200
+++ b/mercurial/configitems.py	Wed Jun 20 13:00:41 2018 +0200
@@ -342,6 +342,9 @@ 
 coreconfigitem('devel', 'remote.debug',
     default=False,
 )
+coreconfigitem('devel', 'remote.profile',
+    default=False,
+)
 coreconfigitem('devel', 'servercafile',
     default='',
 )
diff -r fd3f8738e2ca -r f663c257cf78 mercurial/dispatch.py
--- a/mercurial/dispatch.py	Tue Jun 19 19:53:21 2018 +0200
+++ b/mercurial/dispatch.py	Wed Jun 20 13:00:41 2018 +0200
@@ -297,7 +297,7 @@ 
             if not ('*' in rd_access or user in rd_access) and other_args:
                 unsafe()
             while other_args:
-                if other_args[0] == '--debug':
+                if other_args[0] in ('--debug', '--profile'):
                     other_args.pop(0)
                 else:
                     unsafe()
diff -r fd3f8738e2ca -r f663c257cf78 mercurial/sshpeer.py
--- a/mercurial/sshpeer.py	Tue Jun 19 19:53:21 2018 +0200
+++ b/mercurial/sshpeer.py	Wed Jun 20 13:00:41 2018 +0200
@@ -152,6 +152,8 @@ 
     serverspawn %= (_serverquote(remotecmd), _serverquote(path))
     if ui.configbool('devel', 'remote.debug'):
         serverspawn += ' --debug'
+    if ui.configbool('devel', 'remote.profile'):
+        serverspawn += ' --profile'
     cmd = '%s %s %s' % (sshcmd, args, procutil.shellquote(serverspawn))
     ui.debug('running %s\n' % cmd)
     cmd = procutil.quotecommand(cmd)
diff -r fd3f8738e2ca -r f663c257cf78 tests/test-remote-debugging.t
--- a/tests/test-remote-debugging.t	Tue Jun 19 19:53:21 2018 +0200
+++ b/tests/test-remote-debugging.t	Wed Jun 20 13:00:41 2018 +0200
@@ -94,3 +94,29 @@ 
   remote: bundle2-output-bundle: "HG20", 2 parts total
   remote: bundle2-output-part: "listkeys" (params: 1 mandatory) empty payload
   remote: bundle2-output-part: "phase-heads" 24 bytes payload
+
+Test basic remote profile output
+--------------------------------
+
+  $ hg pull --config "devel.remote.profile=yes" | grep -v --extended-regexp 'line +[0-9]+:'
+  pulling from ssh://user@dummy/remote/
+  searching for changes
+  no changes found
+  remote: ---
+  remote: Sample count: * (glob)
+  remote: Total time: * seconds (* wall) (glob)
+
+Test basic combined remote debug option
+---------------------------------------
+
+  $ hg pull --config "devel.remote.debug=yes" --config "devel.remote.profile=yes" | grep -v --extended-regexp 'line +[0-9]+:'
+  pulling from ssh://user@dummy/remote/
+  searching for changes
+  no changes found
+  remote: listing keys for "bookmarks"
+  remote: bundle2-output-bundle: "HG20", 2 parts total
+  remote: bundle2-output-part: "listkeys" (params: 1 mandatory) empty payload
+  remote: bundle2-output-part: "phase-heads" 24 bytes payload
+  remote: ---
+  remote: Sample count: * (glob)
+  remote: Total time: * seconds (* wall) (glob)