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

Paul Morelle paul.morelle at octobus.net
Wed Jun 20 12:36:27 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at 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.

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)


More information about the Mercurial-devel mailing list