[PATCH 1 of 8] chgserver: add fastannotate config section to sensitive list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1 of 8] chgserver: add fastannotate config section to sensitive list

Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1584977814 -19800
#      Mon Mar 23 21:06:54 2020 +0530
# Node ID 84234f1631ab94a978d8b020677b5bba3e39a9f6
# Parent  b0928d1a5c499e34c034edbe56b20679146cd03c
# EXP-Topic chg-test
chgserver: add fastannotate config section to sensitive list

Depending on the config value of `fastannotate.modes`, the fastannotate
extension can do different things in uisetup. Depending on value of
`fastannotate.server`, it can register new wireprotocol capabilities.

This fixes test-fastannotate-hg.t, test-fastannotate-protocol.t and
test-fastannotate.t with chg.

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -83,6 +83,7 @@ def _hashlist(items):
     b'eol',  # uses setconfig('eol', ...)
     b'extdiff',  # uisetup will register new commands
     b'extensions',
+    b'fastannotate',  # affects annotate command and adds fastannonate cmd
     b'schemes',  # extsetup will update global hg.schemes
 ]
 

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 2 of 8] tests: update test-devel-warnings.t output with chg

Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1585033306 -19800
#      Tue Mar 24 12:31:46 2020 +0530
# Node ID 4b7ccb2314fdbd6c5ab7bcc7e7534a2c7f2c913a
# Parent  84234f1631ab94a978d8b020677b5bba3e39a9f6
tests: update test-devel-warnings.t output with chg

The output change was caused by dc9901558e3c6a78bad3f6594b3888f95104c443.

diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t
+++ b/tests/test-devel-warnings.t
@@ -133,6 +133,7 @@
    */mercurial/server.py:* in runservice (glob)
    */mercurial/commandserver.py:* in run (glob)
    */mercurial/commandserver.py:* in _mainloop (glob)
+   */mercurial/commandserver.py:* in _acceptnewconnection (glob)
    */mercurial/commandserver.py:* in _runworker (glob)
    */mercurial/commandserver.py:* in _serverequest (glob)
    */mercurial/commandserver.py:* in serve (glob)
@@ -212,6 +213,7 @@ Stripping from a transaction
    */mercurial/server.py:* in runservice (glob)
    */mercurial/commandserver.py:* in run (glob)
    */mercurial/commandserver.py:* in _mainloop (glob)
+   */mercurial/commandserver.py:* in _acceptnewconnection (glob)
    */mercurial/commandserver.py:* in _runworker (glob)
    */mercurial/commandserver.py:* in _serverequest (glob)
    */mercurial/commandserver.py:* in serve (glob)
@@ -280,6 +282,7 @@ Stripping from a transaction
    */mercurial/server.py:* in runservice (glob)
    */mercurial/commandserver.py:* in run (glob)
    */mercurial/commandserver.py:* in _mainloop (glob)
+   */mercurial/commandserver.py:* in _acceptnewconnection (glob)
    */mercurial/commandserver.py:* in _runworker (glob)
    */mercurial/commandserver.py:* in _serverequest (glob)
    */mercurial/commandserver.py:* in serve (glob)

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 3 of 8] tests: update test-ssh.t output with --chg

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1585034337 -19800
#      Tue Mar 24 12:48:57 2020 +0530
# Node ID 1185d1a02ee1b93490faef3767431a65c6edacda
# Parent  4b7ccb2314fdbd6c5ab7bcc7e7534a2c7f2c913a
tests: update test-ssh.t output with --chg

The output change was caused by d7304434390f5efca405744fa12a6585edae3d83.

diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -327,9 +327,9 @@ try again with remote chg, which should
   remote: adding changesets
   remote: adding manifests
   remote: adding file changes
-  remote: added 1 changesets with 1 changes to 1 files
   remote: KABOOM
   remote: KABOOM IN PROCESS
+  remote: added 1 changesets with 1 changes to 1 files
 
 #endif
 

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 4 of 8] run-tests: add --chg-debug flag to show chg debug output

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1585122608 -19800
#      Wed Mar 25 13:20:08 2020 +0530
# Node ID e31595eeab43977cd927a5a9ab43c371c202bb24
# Parent  1185d1a02ee1b93490faef3767431a65c6edacda
run-tests: add --chg-debug flag to show chg debug output

This has helped me a lot in debugging chg failures in tests.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -531,6 +531,11 @@ def getparser():
         action="store_true",
         help="install and use chg wrapper in place of hg",
     )
+    hgconf.add_argument(
+        "--chg-debug",
+        action="store_true",
+        help="show chg debug logs",
+    )
     hgconf.add_argument("--compiler", help="compiler to build with")
     hgconf.add_argument(
         '--extra-config-opt',
@@ -924,6 +929,7 @@ class Test(unittest.TestCase):
         hgcommand=None,
         slowtimeout=None,
         usechg=False,
+        chgdebug=False,
         useipv6=False,
     ):
         """Create a test from parameters.
@@ -979,6 +985,7 @@ class Test(unittest.TestCase):
         self._shell = _sys2bytes(shell)
         self._hgcommand = hgcommand or b'hg'
         self._usechg = usechg
+        self._chgdebug = chgdebug
         self._useipv6 = useipv6
 
         self._aborted = False
@@ -1417,6 +1424,8 @@ class Test(unittest.TestCase):
 
         if self._usechg:
             env['CHGSOCKNAME'] = os.path.join(self._chgsockdir, b'server')
+        if self._chgdebug:
+            env['CHGDEBUG'] = 'true'
 
         return env
 
@@ -3386,6 +3395,7 @@ class TestRunner(object):
             shell=self.options.shell,
             hgcommand=self._hgcommand,
             usechg=bool(self.options.with_chg or self.options.chg),
+            chgdebug=self.options.chg_debug,
             useipv6=useipv6,
             **kwds
         )

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 5 of 8] chgserver: add merge-tools to sensitive config items

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1584987209 -19800
#      Mon Mar 23 23:43:29 2020 +0530
# Node ID b0054c8ead9cffcac97eaac6742b2c9edecf556a
# Parent  e31595eeab43977cd927a5a9ab43c371c202bb24
chgserver: add merge-tools to sensitive config items

Because this can change whether the ui is gui or not.

This fixes test-extdiff.t with chg.

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -80,10 +80,12 @@ def _hashlist(items):
 # sensitive config sections affecting confighash
 _configsections = [
     b'alias',  # affects global state commands.table
+    b'diff-tools',  # affects whether gui or not in extdiff's uisetup
     b'eol',  # uses setconfig('eol', ...)
     b'extdiff',  # uisetup will register new commands
     b'extensions',
     b'fastannotate',  # affects annotate command and adds fastannonate cmd
+    b'merge-tools',  # affects whether gui or not in extdiff's uisetup
     b'schemes',  # extsetup will update global hg.schemes
 ]
 

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 6 of 8] chg: be stricter about checking invocation of `serve` command

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1585043471 -19800
#      Tue Mar 24 15:21:11 2020 +0530
# Node ID 71f078cbf9ea839829229a8935a489200d1f8d36
# Parent  b0054c8ead9cffcac97eaac6742b2c9edecf556a
chg: be stricter about checking invocation of `serve` command

Few tests run serve command in form of `hg -R <repo> serve` which leads to chg
thinking that it's not a serve command and failing tests.

We become more stricter in checking for the serve command.

This fixes test-server-view.t, test-remote-hidden.t, test-remotefilelog-http.t,
test-phases-exchange.t, test-wireproto-content-redirects.t with chg.

diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c
--- a/contrib/chg/chg.c
+++ b/contrib/chg/chg.c
@@ -374,8 +374,7 @@ static int runinstructions(struct cmdser
 
 /*
  * Test whether the command is unsupported or not. This is not designed to
- * cover all cases. But it's fast, does not depend on the server and does
- * not return false positives.
+ * cover all cases. But it's fast, does not depend on the server.
  */
 static int isunsupported(int argc, const char *argv[])
 {
@@ -388,7 +387,12 @@ static int isunsupported(int argc, const
  for (i = 0; i < argc; ++i) {
  if (strcmp(argv[i], "--") == 0)
  break;
- if (i == 0 && strcmp("serve", argv[i]) == 0)
+ /*
+ * there can be false positives but no false negative
+ * we cannot assume `serve` will always be first argument
+ * because global options can be passed before the command name
+ */
+ if (strcmp("serve", argv[i]) == 0)
  state |= SERVE;
  else if (strcmp("-d", argv[i]) == 0 ||
          strcmp("--daemon", argv[i]) == 0)

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 7 of 8] tests: conditionalize test-phases.t output for chg

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1585148595 -19800
#      Wed Mar 25 20:33:15 2020 +0530
# Node ID eedfec1725f230d9d074ffca2d543b119bc18954
# Parent  71f078cbf9ea839829229a8935a489200d1f8d36
tests: conditionalize test-phases.t output for chg

IIUC chg loads the ProgrammingError class which leads to it directly referencing
it in error output. This makes the test pass on chg.

diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -896,11 +896,13 @@ Check we deny its usage on older reposit
   $ hg --config "phases.new-commit=internal" commit -m "my test internal commit" 2>&1 | grep ProgrammingError
   ** ProgrammingError: this repository does not support the internal phase
       raise error.ProgrammingError(msg)
-  mercurial.error.ProgrammingError: this repository does not support the internal phase
+  mercurial.error.ProgrammingError: this repository does not support the internal phase (no-chg !)
+  ProgrammingError: this repository does not support the internal phase (chg !)
   $ hg --config "phases.new-commit=archived" commit -m "my test archived commit" 2>&1 | grep ProgrammingError
   ** ProgrammingError: this repository does not support the archived phase
       raise error.ProgrammingError(msg)
-  mercurial.error.ProgrammingError: this repository does not support the archived phase
+  mercurial.error.ProgrammingError: this repository does not support the archived phase (no-chg !)
+  ProgrammingError: this repository does not support the archived phase (chg !)
 
   $ cd ..
 

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 8 of 8] tests: don't run couple of tests related to extensions loading with chg

Pulkit Goyal
In reply to this post by Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <[hidden email]>
# Date 1585147557 -19800
#      Wed Mar 25 20:15:57 2020 +0530
# Node ID 62c6488a31b1af1a36edf04f7797bc54c7061671
# Parent  eedfec1725f230d9d074ffca2d543b119bc18954
tests: don't run couple of tests related to extensions loading with chg

The couple of files test extensions loading and debugging that. It sets
`devel.debug.extensions` to True to do that.
Either we have to restart chg if this config is set or just don't run these
tests on chg. I tried the first way by adding the config option to chgserver.py
list of config subsections but that does not seem to work.

diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -1,3 +1,4 @@
+#require no-chg
   $ filterlog () {
   >   sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!'
   > }
diff --git a/tests/test-extension-timing.t b/tests/test-extension-timing.t
--- a/tests/test-extension-timing.t
+++ b/tests/test-extension-timing.t
@@ -1,3 +1,5 @@
+#require no-chg
+
 Test basic extension support
 
   $ cat > foobar.py <<EOF

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 6 of 8] chg: be stricter about checking invocation of `serve` command

Yuya Nishihara
In reply to this post by Pulkit Goyal
On Thu, 26 Mar 2020 13:06:53 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <[hidden email]>
> # Date 1585043471 -19800
> #      Tue Mar 24 15:21:11 2020 +0530
> # Node ID 71f078cbf9ea839829229a8935a489200d1f8d36
> # Parent  b0054c8ead9cffcac97eaac6742b2c9edecf556a
> chg: be stricter about checking invocation of `serve` command

Nit: I feel it's less strict.

>  static int isunsupported(int argc, const char *argv[])
>  {
> @@ -388,7 +387,12 @@ static int isunsupported(int argc, const
>   for (i = 0; i < argc; ++i) {
>   if (strcmp(argv[i], "--") == 0)
>   break;
> - if (i == 0 && strcmp("serve", argv[i]) == 0)
> + /*
> + * there can be false positives but no false negative
> + * we cannot assume `serve` will always be first argument
> + * because global options can be passed before the command name
> + */
> + if (strcmp("serve", argv[i]) == 0)
>   state |= SERVE;
>   else if (strcmp("-d", argv[i]) == 0 ||
>           strcmp("--daemon", argv[i]) == 0)

Should be fine since "serve" + "-d" would most likely mean "serve -d" command.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 7 of 8] tests: conditionalize test-phases.t output for chg

Yuya Nishihara
In reply to this post by Pulkit Goyal
On Thu, 26 Mar 2020 13:06:54 +0530, Pulkit Goyal wrote:

> # HG changeset patch
> # User Pulkit Goyal <[hidden email]>
> # Date 1585148595 -19800
> #      Wed Mar 25 20:33:15 2020 +0530
> # Node ID eedfec1725f230d9d074ffca2d543b119bc18954
> # Parent  71f078cbf9ea839829229a8935a489200d1f8d36
> tests: conditionalize test-phases.t output for chg
>
> IIUC chg loads the ProgrammingError class which leads to it directly referencing
> it in error output. This makes the test pass on chg.

Perhaps the exception would be caught at different place and printed
differently.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1 of 8] chgserver: add fastannotate config section to sensitive list

Yuya Nishihara
In reply to this post by Pulkit Goyal
On Thu, 26 Mar 2020 13:06:48 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <[hidden email]>
> # Date 1584977814 -19800
> #      Mon Mar 23 21:06:54 2020 +0530
> # Node ID 84234f1631ab94a978d8b020677b5bba3e39a9f6
> # Parent  b0928d1a5c499e34c034edbe56b20679146cd03c
> # EXP-Topic chg-test
> chgserver: add fastannotate config section to sensitive list

Queued, thanks.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 7 of 8] tests: conditionalize test-phases.t output for chg

Pulkit Goyal
In reply to this post by Yuya Nishihara
On Thu, Mar 26, 2020 at 5:05 PM Yuya Nishihara <[hidden email]> wrote:

>
> On Thu, 26 Mar 2020 13:06:54 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <[hidden email]>
> > # Date 1585148595 -19800
> > #      Wed Mar 25 20:33:15 2020 +0530
> > # Node ID eedfec1725f230d9d074ffca2d543b119bc18954
> > # Parent  71f078cbf9ea839829229a8935a489200d1f8d36
> > tests: conditionalize test-phases.t output for chg
> >
> > IIUC chg loads the ProgrammingError class which leads to it directly referencing
> > it in error output. This makes the test pass on chg.
>
> Perhaps the exception would be caught at different place and printed
> differently.

I see. Fun fact: on py3 with chg, this change is not needed.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel