test-lfs: add tests covering local exchanges
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 22 Dec 2017 14:53:54 -0500
changeset 35506 67611e06ff08
parent 35505 12a46ad67a3c
child 35507 bbcd2e478391
test-lfs: add tests covering local exchanges The root issue here is that requirements are not exchanged and preserved on push/pull. This can be handled with a changegroup hook. Testing for remote exchanges is much more extensive (it's possible for one process or the other to not have the extension loaded at all), so it is added separately.
tests/test-lfs.t
--- a/tests/test-lfs.t	Wed Dec 27 11:08:32 2017 -0700
+++ b/tests/test-lfs.t	Fri Dec 22 14:53:54 2017 -0500
@@ -56,6 +56,11 @@
   > url=file:$TESTTMP/dummy-remote/
   > EOF
 
+TODO: Push to a local non-lfs repo with the extension enabled should add the
+lfs requirement
+
+  $ grep lfs $TESTTMP/server/.hg/requires
+  [1]
   $ hg push -v | egrep -v '^(uncompressed| )'
   pushing to $TESTTMP/server
   searching for changes
@@ -65,6 +70,8 @@
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
+  $ grep lfs $TESTTMP/server/.hg/requires
+  [1]
 
 # Unknown URL scheme
 
@@ -83,6 +90,12 @@
   > EOF
 
 # Pull from server
+
+TODO: Pulling a local lfs repo into a local non-lfs repo with the extension
+enabled should add the lfs requirement
+
+  $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
+  [1]
   $ hg pull default
   pulling from $TESTTMP/server
   requesting all changes
@@ -92,6 +105,8 @@
   added 2 changesets with 2 changes to 2 files
   new changesets b29ba743f89d:00c137947d30
   (run 'hg update' to get a working copy)
+  $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
+  [1]
 
 # Check the blobstore is not yet populated
   $ [ -d .hg/store/lfs/objects ]
@@ -855,3 +870,45 @@
   $ hg commit -m 'add A' -A A
   $ hg rm A
   $ hg commit -m 'rm A'
+  $ cd ..
+
+TODO: Unbundling adds a requirement to a non-lfs repo, if necessary.
+
+  $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg
+  $ hg bundle -R convert_lfs2 -qr tip --base null lfs.hg
+  $ hg init unbundle
+  $ hg pull -R unbundle -q nolfs.hg
+  $ grep lfs unbundle/.hg/requires
+  [1]
+  $ hg pull -R unbundle -q lfs.hg
+  $ grep lfs unbundle/.hg/requires
+  [1]
+
+  $ hg init no_lfs
+  $ cat >> no_lfs/.hg/hgrc <<EOF
+  > [experimental]
+  > changegroup3 = True
+  > [extensions]
+  > lfs=!
+  > EOF
+  $ cp -R no_lfs no_lfs2
+
+Pushing from a local lfs repo to a local repo without an lfs requirement and
+with lfs disabled, fails.
+
+  $ hg push -R convert_lfs2 no_lfs
+  pushing to no_lfs
+  abort: required features are not supported in the destination: lfs
+  [255]
+  $ grep lfs no_lfs/.hg/requires
+  [1]
+
+Pulling from a local lfs repo to a local repo without an lfs requirement and
+with lfs disabled, fails.
+
+  $ hg pull -R no_lfs2 convert_lfs2
+  pulling from convert_lfs2
+  abort: required features are not supported in the destination: lfs
+  [255]
+  $ grep lfs no_lfs2/.hg/requires
+  [1]