diff tests/test-remotefilelog-pull-noshallow.t @ 40495:3a333a582d7b

remotefilelog: import pruned-down remotefilelog extension from hg-experimental This is remotefilelog as of my recent patches for compatibility with current tip of hg, minus support for old versions of Mercurial and some FB-specific features like their treemanifest extension and fetching linkrev data from a patched phabricator. The file extutil.py moved from hgext3rd to remotefilelog. This is not yet ready to be landed, consider it a preview for now. Planned changes include: * replace lz4 with zstd * rename some capabilities, requirements and wireproto commands to mark them as experimental * consolidate bits of shallowutil with related functions (eg readfile) I'm certainly open to other (small) changes, but my rough mission is to land this largely as-is so we can use it as a model of the functionality we need going forward for lazy-fetching of file contents from a server. # no-check-commit because of a few foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D4782
author Augie Fackler <augie@google.com>
date Thu, 27 Sep 2018 13:03:19 -0400
parents
children 354acd0dc637
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-remotefilelog-pull-noshallow.t	Thu Sep 27 13:03:19 2018 -0400
@@ -0,0 +1,80 @@
+  $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
+  $ export PYTHONPATH
+
+  $ . "$TESTDIR/remotefilelog-library.sh"
+
+Set up an extension to make sure remotefilelog clientsetup() runs
+unconditionally even if we have never used a local shallow repo.
+This mimics behavior when using remotefilelog with chg.  clientsetup() can be
+triggered due to a shallow repo, and then the code can later interact with
+non-shallow repositories.
+
+  $ cat > setupremotefilelog.py << EOF
+  > from mercurial import extensions
+  > def extsetup(ui):
+  >     remotefilelog = extensions.find('remotefilelog')
+  >     remotefilelog.onetimeclientsetup(ui)
+  > EOF
+
+Set up the master repository to pull from.
+
+  $ hginit master
+  $ cd master
+  $ cat >> .hg/hgrc <<EOF
+  > [remotefilelog]
+  > server=True
+  > EOF
+  $ echo x > x
+  $ hg commit -qAm x
+
+  $ cd ..
+
+  $ hg clone ssh://user@dummy/master child -q
+
+We should see the remotefilelog capability here, which advertises that
+the server supports our custom getfiles method.
+
+  $ cd master
+  $ echo 'hello' | hg -R . serve --stdio | grep capa | identifyrflcaps
+  getfile
+  getflogheads
+  remotefilelog
+  $ echo 'capabilities' | hg -R . serve --stdio | identifyrflcaps ; echo
+  getfile
+  getflogheads
+  remotefilelog
+  
+
+Pull to the child repository.  Use our custom setupremotefilelog extension
+to ensure that remotefilelog.onetimeclientsetup() gets triggered.  (Without
+using chg it normally would not be run in this case since the local repository
+is not shallow.)
+
+  $ echo y > y
+  $ hg commit -qAm y
+
+  $ cd ../child
+  $ hg pull --config extensions.setuprfl=$TESTTMP/setupremotefilelog.py
+  pulling from ssh://user@dummy/master
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  new changesets d34c38483be9
+  (run 'hg update' to get a working copy)
+
+  $ hg up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cat y
+  y
+
+Test that bundle works in a non-remotefilelog repo w/ remotefilelog loaded
+
+  $ echo y >> y
+  $ hg commit -qAm "modify y"
+  $ hg bundle --base ".^" --rev . mybundle.hg --config extensions.setuprfl=$TESTTMP/setupremotefilelog.py
+  1 changesets found
+
+  $ cd ..