changeset 4489:818e8190e867

branching: merge with stable This merge happens before the large test consolidation on stable.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 10 Apr 2019 16:40:58 +0200
parents 6c0992ce05f7 (current diff) d18044dfc584 (diff)
children 7a5c6109ee84
files CHANGELOG hgext3rd/evolve/__init__.py tests/test-evolve-phase-divergence.t
diffstat 5 files changed, 238 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Sun Apr 07 20:00:16 2019 +0200
+++ b/CHANGELOG	Wed Apr 10 16:40:58 2019 +0200
@@ -18,6 +18,8 @@
   * evolve: fix an recoverable state (issue6053)
   * prune: fix error message when pruning public changesets
   * touch: fix error message when touching public changesets
+  * evolve: make sure the extensions are only active on repository that
+            enables it. Double check your server configuration (issue6057)
 
 8.4.0 -- 2019-12-22
 -------------------
--- a/hgext3rd/evolve/__init__.py	Sun Apr 07 20:00:16 2019 +0200
+++ b/hgext3rd/evolve/__init__.py	Wed Apr 10 16:40:58 2019 +0200
@@ -266,8 +266,6 @@
 from mercurial import util
 
 from mercurial import obsolete
-if not obsolete._enabled:
-    obsolete._enabled = True
 
 from mercurial import (
     bookmarks as bookmarksmod,
--- a/tests/test-discovery-obshashrange.t	Sun Apr 07 20:00:16 2019 +0200
+++ b/tests/test-discovery-obshashrange.t	Wed Apr 10 16:40:58 2019 +0200
@@ -1158,3 +1158,64 @@
   saved backup bundle to $TESTTMP/client/.hg/strip-backup/c8d03c1b5e94-b257442b-backup.hg
   $ f -s .hg/cache/evoext*
   .hg/cache/evoext-obscache-00: size=70
+  $ cd ..
+
+Check capabilities advertisement
+================================
+
+  $ hg init with-evolve
+  $ cat << EOF >> with-evolve/.hg/hgrc
+  > [experimental]
+  > evolution.exchange=yes
+  > EOF
+  $ hg init without-evolve
+  $ cat << EOF >> without-evolve/.hg/hgrc
+  > [experimental]
+  > evolution.exchange=no
+  > EOF
+
+  $ hg debugcapabilities ssh://user@dummy/with-evolve | grep _evoext
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities ssh://user@dummy/without-evolve | grep _evoext
+  [1]
+
+Using http:
+
+  $ cat > web.conf << EOF
+  > [paths]
+  > / = *
+  > EOF
+
+(evolve version first)
+
+  $ hg serve --web-conf web.conf -p $HGPORT -d --pid-file hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg debugcapabilities http://localhost:$HGPORT/with-evolve| grep _evoext
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://localhost:$HGPORT/without-evolve| grep _evoext
+  [1]
+
+  $ killdaemons.py
+
+
+(evolve version second)
+
+  $ hg serve --web-conf web.conf -p $HGPORT -d --pid-file hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg debugcapabilities http://localhost:$HGPORT/without-evolve| grep _evoext
+  [1]
+  $ hg debugcapabilities http://localhost:$HGPORT/with-evolve| grep _evoext
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+
+  $ killdaemons.py
--- a/tests/test-evolve-phase-divergence.t	Sun Apr 07 20:00:16 2019 +0200
+++ b/tests/test-evolve-phase-divergence.t	Wed Apr 10 16:40:58 2019 +0200
@@ -1,11 +1,15 @@
 ** Test for handling of phase divergent changesets by `hg evolve` **
 ====================================================================
 
+  $ . $TESTDIR/testlib/common.sh
+
   $ cat >> $HGRCPATH <<EOF
   > [alias]
   > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) {phase}"
   > [extensions]
   > rebase =
+  > [extensions]
+  > evolve =
   > EOF
 
 Setting up a public repo
@@ -33,8 +37,6 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd private
   $ cat >> .hg/hgrc <<EOF
-  > [extensions]
-  > evolve = $evolvepath
   > [ui]
   > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
   > [phases]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extension-isolation.t	Wed Apr 10 16:40:58 2019 +0200
@@ -0,0 +1,171 @@
+============================
+Testing extensions isolation
+============================
+
+In this test case, we check that a repository using the extensions can co-exist
+with a repository not using the extension.
+
+  $ . $TESTDIR/testlib/common.sh
+
+Setup
+=====
+
+Create repo
+
+  $ hg init repo-evo
+  $ cat > repo-evo/.hg/hgrc << EOF
+  > [extensions]
+  > evolve=
+  > EOF
+  $ hg init repo-topic
+  $ cat > repo-topic/.hg/hgrc << EOF
+  > [extensions]
+  > topic=
+  > EOF
+  $ hg init repo-both
+  $ cat > repo-both/.hg/hgrc << EOF
+  > [extensions]
+  > evolve=
+  > topic=
+  > EOF
+  $ hg init repo-no-ext
+
+check setup
+
+  $ hg -R repo-evo  help -e evolve | head -n 1
+  warning: --repository ignored
+  evolve extension - extends Mercurial feature related to Changeset Evolution
+  $ hg -R repo-both  help -e evolve | head -n 1
+  warning: --repository ignored
+  evolve extension - extends Mercurial feature related to Changeset Evolution
+  $ hg -R repo-no-ext help -e evolve
+  warning: --repository ignored
+  abort: no such help topic: evolve
+  (try 'hg help --keyword evolve')
+  [255]
+  $ hg -R repo-no-ext help -e topic
+  warning: --repository ignored
+  abort: no such help topic: topic
+  (try 'hg help --keyword topic')
+  [255]
+
+start hgweb dir for all repo
+
+  $ cat > hgweb.conf << EOF
+  > [paths]
+  > / = *
+  > EOF
+
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid --web-conf hgweb.conf -A access.log -E error.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+Test isolation
+--------------
+
+As of 4.9 (and previous version). It seems like extensions are displayed as
+enabled even for repository where they are not supposed to be. See the output
+tagged `no-false`.
+
+(however, topic and evolve are not supposed to affect other repository as shown
+in the rest of this test).
+
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-no-ext/help/extensions' | grep 'enabled extensions' -A 7
+  [1]
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-evo/help/extensions' | grep 'enabled extensions' -A 7
+  enabled extensions:
+  </p>
+  <dl>
+   <dt>evolve
+   <dd>extends Mercurial feature related to Changeset Evolution
+  </dl>
+  <p>
+  disabled extensions:
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-topic/help/extensions' | grep 'enabled extensions' -A 7
+  enabled extensions:
+  </p>
+  <dl>
+   <dt>evolve (no-false !)
+   <dd>extends Mercurial feature related to Changeset Evolution (no-false !)
+   <dt>topic
+   <dd>support for topic branches
+  </dl>
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-both/help/extensions' | grep 'enabled extensions' -A 9
+  enabled extensions:
+  </p>
+  <dl>
+   <dt>evolve
+   <dd>extends Mercurial feature related to Changeset Evolution
+   <dt>topic
+   <dd>support for topic branches
+  </dl>
+  <p>
+  disabled extensions:
+  $ get-with-headers.py $LOCALIP:$HGPORT 'repo-no-ext/help/extensions' | grep 'enabled extensions' -A 9
+  enabled extensions: (no-false !)
+  </p> (no-false !)
+  <dl> (no-false !)
+   <dt>evolve (no-false !)
+   <dd>extends Mercurial feature related to Changeset Evolution (no-false !)
+   <dt>topic (no-false !)
+   <dd>support for topic branches (no-false !)
+  </dl> (no-false !)
+  <p> (no-false !)
+  disabled extensions: (no-false !)
+
+make sure repos don't affect each other (and check both ways)
+
+Check evolve isolation
+-----------------------
+
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+
+Check topic isolation
+---------------------
+
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext'
+    topics
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+
+Check coupled isolation
+-----------------------
+
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-both | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+    topics
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext'
+    topics
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
+    _evoext_getbundle_obscommon
+    _evoext_obshash_0
+    _evoext_obshash_1
+    _evoext_obshashrange_v1
+  $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
+  [1]
+
+Final cleanup
+-------------
+
+  $ cat error.log
+
+  $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS