# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1581418436 -32400
#      Tue Feb 11 19:53:56 2020 +0900
# Branch stable
# Node ID 3dcf73d0733d87e7a231809d23da4883f4ab3711
# Parent  84d98fa814a8bab0dd94a133187dc9d42a5e433f
chgserver: spawn new process if schemes change

The schemes extension updates hg.schemes table. It's technically possible
for hg.repository() to look for e.g. ui.schemes instead of depending on
module-local table, but I don't think the change would make much sense
since [schemes] is usually specified in ~/.hgrc and thus it can be considered
static data.

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'schemes',  # extsetup will update global hg.schemes
 ]
 
 _configsectionitems = [
diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -245,6 +245,54 @@ is different when using py3):
   YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
   YYYY/MM/DD HH:MM:SS (PID)> $TESTTMP/extreload/chgsock/server-... is not 
owned, exiting.
 
+global data mutated by schems
+-----------------------------
+
+  $ hg init schemes
+  $ cd schemes
+
+initial state
+
+  $ cat > .hg/hgrc <<'EOF'
+  > [extensions]
+  > schemes =
+  > [schemes]
+  > foo = https://foo.example.org/
+  > EOF
+  $ hg debugexpandscheme foo://expanded
+  https://foo.example.org/expanded
+  $ hg debugexpandscheme bar://unexpanded
+  bar://unexpanded
+
+add bar
+
+  $ cat > .hg/hgrc <<'EOF'
+  > [extensions]
+  > schemes =
+  > [schemes]
+  > foo = https://foo.example.org/
+  > bar = https://bar.example.org/
+  > EOF
+  $ hg debugexpandscheme foo://expanded
+  https://foo.example.org/expanded
+  $ hg debugexpandscheme bar://expanded
+  https://bar.example.org/expanded
+
+remove foo
+
+  $ cat > .hg/hgrc <<'EOF'
+  > [extensions]
+  > schemes =
+  > [schemes]
+  > bar = https://bar.example.org/
+  > EOF
+  $ hg debugexpandscheme foo://unexpanded
+  foo://unexpanded
+  $ hg debugexpandscheme bar://expanded
+  https://bar.example.org/expanded
+
+  $ cd ..
+
 repository cache
 ----------------
 
@@ -317,6 +365,8 @@ shut down servers and restore environmen
 check server log:
 
   $ cat log/server.log | filterlog
+  YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
+  YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
   YYYY/MM/DD HH:MM:SS (PID)> init cached
   YYYY/MM/DD HH:MM:SS (PID)> id -R cached
   YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in  ...s)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to