[PATCH 1 of 6] test-lfs: add tests covering local exchanges

Matt Harbison mharbison72 at gmail.com
Wed Dec 27 03:27:53 EST 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1513972434 18000
#      Fri Dec 22 14:53:54 2017 -0500
# Node ID a913ffb7d3e300f2bf4a156ec22c4bdd0f0b6545
# Parent  784a85c87c22b70958f119abcbec138fa8019161
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.

diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -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]


More information about the Mercurial-devel mailing list