| 1 |
#require no-windows |
| 2 |
|
| 3 |
$ . "$TESTDIR/remotefilelog-library.sh" |
| 4 |
|
| 5 |
Set up an extension to make sure remotefilelog clientsetup() runs |
| 6 |
unconditionally even if we have never used a local shallow repo. |
| 7 |
This mimics behavior when using remotefilelog with chg. clientsetup() can be |
| 8 |
triggered due to a shallow repo, and then the code can later interact with |
| 9 |
non-shallow repositories. |
| 10 |
|
| 11 |
$ cat > setupremotefilelog.py << EOF |
| 12 |
> from mercurial import extensions |
| 13 |
> def extsetup(ui): |
| 14 |
> remotefilelog = extensions.find(b'remotefilelog') |
| 15 |
> remotefilelog.onetimeclientsetup(ui) |
| 16 |
> EOF |
| 17 |
|
| 18 |
Set up the master repository to pull from. |
| 19 |
|
| 20 |
$ hg init master |
| 21 |
$ cd master |
| 22 |
$ cat >> .hg/hgrc <<EOF |
| 23 |
> [remotefilelog] |
| 24 |
> server=True |
| 25 |
> EOF |
| 26 |
$ echo x > x |
| 27 |
$ hg commit -qAm x |
| 28 |
|
| 29 |
$ cd .. |
| 30 |
|
| 31 |
$ hg clone ssh://user@dummy/master child -q |
| 32 |
|
| 33 |
We should see the remotefilelog capability here, which advertises that |
| 34 |
the server supports our custom getfiles method. |
| 35 |
|
| 36 |
$ cd master |
| 37 |
$ echo 'hello' | hg -R . serve --stdio | grep capa | identifyrflcaps |
| 38 |
exp-remotefilelog-ssh-getfiles-1 |
| 39 |
x_rfl_getfile |
| 40 |
x_rfl_getflogheads |
| 41 |
$ echo 'capabilities' | hg -R . serve --stdio | identifyrflcaps ; echo |
| 42 |
exp-remotefilelog-ssh-getfiles-1 |
| 43 |
x_rfl_getfile |
| 44 |
x_rfl_getflogheads |
| 45 |
|
| 46 |
|
| 47 |
Pull to the child repository. Use our custom setupremotefilelog extension |
| 48 |
to ensure that remotefilelog.onetimeclientsetup() gets triggered. (Without |
| 49 |
using chg it normally would not be run in this case since the local repository |
| 50 |
is not shallow.) |
| 51 |
|
| 52 |
$ echo y > y |
| 53 |
$ hg commit -qAm y |
| 54 |
|
| 55 |
$ cd ../child |
| 56 |
$ hg pull --config extensions.setuprfl=$TESTTMP/setupremotefilelog.py |
| 57 |
pulling from ssh://user@dummy/master |
| 58 |
searching for changes |
| 59 |
adding changesets |
| 60 |
adding manifests |
| 61 |
adding file changes |
| 62 |
added 1 changesets with 1 changes to 1 files |
| 63 |
new changesets d34c38483be9 |
| 64 |
(run 'hg update' to get a working copy) |
| 65 |
|
| 66 |
$ hg up |
| 67 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 68 |
|
| 69 |
$ cat y |
| 70 |
y |
| 71 |
|
| 72 |
Test that bundle works in a non-remotefilelog repo w/ remotefilelog loaded |
| 73 |
|
| 74 |
$ echo y >> y |
| 75 |
$ hg commit -qAm "modify y" |
| 76 |
$ hg bundle --base ".^" --rev . mybundle.hg --config extensions.setuprfl=$TESTTMP/setupremotefilelog.py |
| 77 |
1 changesets found |
| 78 |
|
| 79 |
$ cd .. |