changeset 37346:45a4799174a1

tests: disallow using simple store repo with bundlerepo bundlerepo is... going to be difficult to port to an alternate store because it assumes revlogs for storage and essentially overlays the contents of a bundle onto a fake revlog-like primitive. It will be a good test case for our eventual new storage interface. Refactoring bundlerepo to make it work with non-revlog storage is going to be a bit of work. So for now, let's refuse to use the simple store repo when a bundlerepo is in play. A new test requirement advertising support for treating bundle files as repo instances has been added. Some tests have been made conditional on this feature. Additional tests will be annotated in subsequent commits. Having positive opt-in to repo features will be simpler in the long run because it will allow multiple storage backends to declare feature support and we won't have to annotate each test with the set of repo backends that are supported. Again, we'll probably want better integration between repo features and tests. But this is the easiest we can do at the moment. Differential Revision: https://phab.mercurial-scm.org/D3060
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 04 Apr 2018 11:44:38 -0700
parents b09a25d74592
children e82a59bfc5e8
files tests/hghave.py tests/simplestorerepo.py tests/test-manifest.t tests/test-mq-pull-from-bundle.t tests/test-narrow-strip.t tests/test-obsolete.t tests/test-shelve.t tests/test-treemanifest.t
diffstat 8 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/hghave.py	Wed Apr 04 11:44:38 2018 -0700
@@ -731,12 +731,13 @@
     """
     # Default list provided by core.
     features = {
+        'bundlerepo',
         'revlogstore',
     }
 
     # Features that imply other features.
     implies = {
-        'simplestore': ['-revlogstore'],
+        'simplestore': ['-revlogstore', '-bundlerepo'],
     }
 
     for override in os.environ.get('HGREPOFEATURES', '').split(' '):
@@ -765,3 +766,7 @@
 @check('reposimplestore', 'repository using simple storage extension')
 def has_reposimplestore():
     return 'simplestore' in getrepofeatures()
+
+@check('repobundlerepo', 'whether we can open bundle files as repos')
+def has_repobundlerepo():
+    return 'bundlerepo' in getrepofeatures()
--- a/tests/simplestorerepo.py	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/simplestorerepo.py	Wed Apr 04 11:44:38 2018 -0700
@@ -24,6 +24,7 @@
 )
 from mercurial import (
     ancestor,
+    bundlerepo,
     error,
     filelog,
     mdiff,
@@ -587,6 +588,9 @@
     if not repo.local():
         return
 
+    if isinstance(repo, bundlerepo.bundlerepository):
+        raise error.Abort(_('cannot use simple store with bundlerepo'))
+
     class simplestorerepo(repo.__class__):
         def file(self, f):
             return filestorage(self.svfs, f)
--- a/tests/test-manifest.t	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/test-manifest.t	Wed Apr 04 11:44:38 2018 -0700
@@ -1,3 +1,5 @@
+#require repobundlerepo
+
 Source bundle was generated with the following script:
 
 # hg init
--- a/tests/test-mq-pull-from-bundle.t	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/test-mq-pull-from-bundle.t	Wed Apr 04 11:44:38 2018 -0700
@@ -1,3 +1,5 @@
+#require repobundlerepo
+
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
   > mq=
--- a/tests/test-narrow-strip.t	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/test-narrow-strip.t	Wed Apr 04 11:44:38 2018 -0700
@@ -130,6 +130,8 @@
   $ hg strip 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
+
+#if repobundlerepo
   $ hg incoming .hg/strip-backup/*-backup.hg
   comparing with .hg/strip-backup/*-backup.hg (glob)
   changeset:   0:* (glob)
@@ -161,3 +163,4 @@
   added 3 changesets with 2 changes to 1 files (+1 heads)
   new changesets *:* (glob)
   (run 'hg heads' to see heads, 'hg merge' to merge)
+#endif
--- a/tests/test-obsolete.t	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/test-obsolete.t	Wed Apr 04 11:44:38 2018 -0700
@@ -1244,6 +1244,7 @@
   o  0:4b34ecfb0d56 (draft) [ ] A
   
 
+#if repobundlerepo
   $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg
   comparing with ../repo-bundleoverlay
   searching for changes
@@ -1256,6 +1257,7 @@
   |/
   o  0:4b34ecfb0d56 (draft) [ ] A
   
+#endif
 
 #if serve
 
--- a/tests/test-shelve.t	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/test-shelve.t	Wed Apr 04 11:44:38 2018 -0700
@@ -771,10 +771,12 @@
   $ hg shelve
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+#if repobundlerepo
   $ hg log -G --template '{rev}  {desc|firstline}  {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()'
   o  4  changes to: commit stuff  shelve@localhost
   |
   ~
+#endif
   $ hg log -G --template '{rev}  {desc|firstline}  {author}'
   @  3  commit stuff  test
   |
--- a/tests/test-treemanifest.t	Wed Apr 04 11:31:35 2018 -0700
+++ b/tests/test-treemanifest.t	Wed Apr 04 11:44:38 2018 -0700
@@ -325,6 +325,8 @@
      rev linkrev nodeid       p1           p2
        0       4 064927a0648a 000000000000 000000000000
        1       5 25ecb8cb8618 000000000000 000000000000
+
+#if repobundlerepo
   $ hg incoming .hg/strip-backup/*
   comparing with .hg/strip-backup/*-backup.hg (glob)
   searching for changes
@@ -334,6 +336,8 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     modify dir1/a
   
+#endif
+
   $ hg unbundle .hg/strip-backup/*
   adding changesets
   adding manifests