| 1 |
#require no-windows |
| 2 |
|
| 3 |
$ . "$TESTDIR/remotefilelog-library.sh" |
| 4 |
|
| 5 |
$ hg init master |
| 6 |
$ cd master |
| 7 |
$ cat >> .hg/hgrc <<EOF |
| 8 |
> [remotefilelog] |
| 9 |
> server=True |
| 10 |
> EOF |
| 11 |
$ echo x > x |
| 12 |
$ hg commit -qAm x |
| 13 |
|
| 14 |
$ cd .. |
| 15 |
|
| 16 |
$ hgcloneshallow ssh://user@dummy/master shallow -q |
| 17 |
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
| 18 |
$ hgcloneshallow ssh://user@dummy/master shallow2 -q |
| 19 |
|
| 20 |
We should see the remotefilelog capability here, which advertises that |
| 21 |
the server supports our custom getfiles method. |
| 22 |
|
| 23 |
$ cd master |
| 24 |
$ echo 'hello' | hg -R . serve --stdio | grep capa | identifyrflcaps |
| 25 |
exp-remotefilelog-ssh-getfiles-1 |
| 26 |
x_rfl_getfile |
| 27 |
x_rfl_getflogheads |
| 28 |
$ echo 'capabilities' | hg -R . serve --stdio | identifyrflcaps ; echo |
| 29 |
exp-remotefilelog-ssh-getfiles-1 |
| 30 |
x_rfl_getfile |
| 31 |
x_rfl_getflogheads |
| 32 |
|
| 33 |
# pull to shallow from full |
| 34 |
|
| 35 |
$ echo y > y |
| 36 |
$ hg commit -qAm y |
| 37 |
|
| 38 |
$ cd ../shallow |
| 39 |
$ hg pull |
| 40 |
pulling from ssh://user@dummy/master |
| 41 |
searching for changes |
| 42 |
adding changesets |
| 43 |
adding manifests |
| 44 |
adding file changes |
| 45 |
added 1 changesets with 0 changes to 0 files |
| 46 |
new changesets d34c38483be9 |
| 47 |
(run 'hg update' to get a working copy) |
| 48 |
|
| 49 |
$ hg up |
| 50 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 51 |
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
| 52 |
|
| 53 |
$ cat y |
| 54 |
y |
| 55 |
|
| 56 |
$ cd .. |
| 57 |
|
| 58 |
# pull from shallow to shallow (local) |
| 59 |
|
| 60 |
$ cd shallow |
| 61 |
$ echo z > z |
| 62 |
$ hg commit -qAm z |
| 63 |
$ echo x >> x |
| 64 |
$ echo y >> y |
| 65 |
$ hg commit -qAm xxyy |
| 66 |
$ cd ../shallow2 |
| 67 |
$ clearcache |
| 68 |
$ hg pull ../shallow |
| 69 |
pulling from ../shallow |
| 70 |
searching for changes |
| 71 |
adding changesets |
| 72 |
adding manifests |
| 73 |
adding file changes |
| 74 |
added 3 changesets with 4 changes to 3 files |
| 75 |
new changesets d34c38483be9:d7373980d475 (2 drafts) |
| 76 |
(run 'hg update' to get a working copy) |
| 77 |
2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
| 78 |
|
| 79 |
# pull from shallow to shallow (ssh) |
| 80 |
|
| 81 |
$ hg strip -r 1 |
| 82 |
saved backup bundle to $TESTTMP/shallow2/.hg/strip-backup/d34c38483be9-89d325c9-backup.hg (glob) |
| 83 |
$ hg pull ssh://user@dummy/$TESTTMP/shallow --config remotefilelog.cachepath=${CACHEDIR}2 |
| 84 |
pulling from ssh://user@dummy/$TESTTMP/shallow |
| 85 |
searching for changes |
| 86 |
adding changesets |
| 87 |
adding manifests |
| 88 |
adding file changes |
| 89 |
added 3 changesets with 4 changes to 3 files |
| 90 |
new changesets d34c38483be9:d7373980d475 (2 drafts) |
| 91 |
(run 'hg update' to get a working copy) |
| 92 |
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
| 93 |
|
| 94 |
$ hg up |
| 95 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 96 |
$ cat z |
| 97 |
z |
| 98 |
|
| 99 |
$ hg -R ../shallow strip -qr 3 |
| 100 |
$ hg strip -qr 3 |
| 101 |
$ cd .. |
| 102 |
|
| 103 |
# push from shallow to shallow |
| 104 |
|
| 105 |
$ cd shallow |
| 106 |
$ echo a > a |
| 107 |
$ hg commit -qAm a |
| 108 |
$ hg push ssh://user@dummy/$TESTTMP/shallow2 |
| 109 |
pushing to ssh://user@dummy/$TESTTMP/shallow2 |
| 110 |
searching for changes |
| 111 |
remote: adding changesets |
| 112 |
remote: adding manifests |
| 113 |
remote: adding file changes |
| 114 |
remote: added 1 changesets with 1 changes to 1 files |
| 115 |
|
| 116 |
$ cd ../shallow2 |
| 117 |
$ hg up |
| 118 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 119 |
$ cat a |
| 120 |
a |
| 121 |
|
| 122 |
# verify files are read-only |
| 123 |
|
| 124 |
$ ls -l .hg/store/data |
| 125 |
total * (glob) |
| 126 |
drwxrwxr-x* 11f6ad8ec52a2984abaafd7c3b516503785c2072 (glob) |
| 127 |
drwxrwxr-x* 395df8f7c51f007019cb30201c49e884b46b92fa (glob) |
| 128 |
drwxrwxr-x* 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 (glob) |
| 129 |
drwxrwxr-x* 95cb0bfd2977c761298d9624e4b4d4c72a39974a (glob) |
| 130 |
$ ls -l .hg/store/data/395df8f7c51f007019cb30201c49e884b46b92fa |
| 131 |
total * (glob) |
| 132 |
-r--r--r--* 69a1b67522704ec122181c0890bd16e9d3e7516a (glob) |
| 133 |
-r--r--r--* 69a1b67522704ec122181c0890bd16e9d3e7516a_old (glob) |
| 134 |
$ cd .. |
| 135 |
|
| 136 |
# push from shallow to full |
| 137 |
|
| 138 |
$ cd shallow |
| 139 |
$ hg push |
| 140 |
pushing to ssh://user@dummy/master |
| 141 |
searching for changes |
| 142 |
remote: adding changesets |
| 143 |
remote: adding manifests |
| 144 |
remote: adding file changes |
| 145 |
remote: added 2 changesets with 2 changes to 2 files |
| 146 |
|
| 147 |
$ cd ../master |
| 148 |
$ hg log -l 1 --style compact |
| 149 |
3[tip] 1489bbbc46f0 1970-01-01 00:00 +0000 test |
| 150 |
a |
| 151 |
|
| 152 |
$ hg up |
| 153 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 154 |
$ cat a |
| 155 |
a |
| 156 |
|
| 157 |
# push public commits |
| 158 |
|
| 159 |
$ cd ../shallow |
| 160 |
$ echo p > p |
| 161 |
$ hg commit -qAm p |
| 162 |
$ hg phase -f -p -r . |
| 163 |
$ echo d > d |
| 164 |
$ hg commit -qAm d |
| 165 |
|
| 166 |
$ cd ../shallow2 |
| 167 |
$ hg pull ../shallow |
| 168 |
pulling from ../shallow |
| 169 |
searching for changes |
| 170 |
adding changesets |
| 171 |
adding manifests |
| 172 |
adding file changes |
| 173 |
added 2 changesets with 2 changes to 2 files |
| 174 |
new changesets 3a2e32c04641:cedeb4167c1f (1 drafts) |
| 175 |
2 local changesets published (?) |
| 176 |
(run 'hg update' to get a working copy) |
| 177 |
|
| 178 |
$ cd .. |
| 179 |
|
| 180 |
# Test pushing from shallow to shallow with multiple manifests introducing the |
| 181 |
# same filenode. Test this by constructing two separate histories of file 'c' |
| 182 |
# that share a file node and verifying that the history works after pushing. |
| 183 |
|
| 184 |
$ hg init multimf-master |
| 185 |
$ hgcloneshallow ssh://user@dummy/multimf-master multimf-shallow -q |
| 186 |
$ hgcloneshallow ssh://user@dummy/multimf-master multimf-shallow2 -q |
| 187 |
$ cd multimf-shallow |
| 188 |
$ echo a > a |
| 189 |
$ hg commit -qAm a |
| 190 |
$ echo b > b |
| 191 |
$ hg commit -qAm b |
| 192 |
$ echo c > c |
| 193 |
$ hg commit -qAm c1 |
| 194 |
$ hg up -q 0 |
| 195 |
$ echo c > c |
| 196 |
$ hg commit -qAm c2 |
| 197 |
$ echo cc > c |
| 198 |
$ hg commit -qAm c22 |
| 199 |
$ hg log -G -T '{rev} {desc}\n' |
| 200 |
@ 4 c22 |
| 201 |
| |
| 202 |
o 3 c2 |
| 203 |
| |
| 204 |
| o 2 c1 |
| 205 |
| | |
| 206 |
| o 1 b |
| 207 |
|/ |
| 208 |
o 0 a |
| 209 |
|
| 210 |
|
| 211 |
$ cd ../multimf-shallow2 |
| 212 |
- initial commit to prevent hg pull from being a clone |
| 213 |
$ echo z > z && hg commit -qAm z |
| 214 |
$ hg pull -f ssh://user@dummy/$TESTTMP/multimf-shallow |
| 215 |
pulling from ssh://user@dummy/$TESTTMP/multimf-shallow |
| 216 |
searching for changes |
| 217 |
warning: repository is unrelated |
| 218 |
requesting all changes |
| 219 |
adding changesets |
| 220 |
adding manifests |
| 221 |
adding file changes |
| 222 |
added 5 changesets with 4 changes to 3 files (+2 heads) |
| 223 |
new changesets cb9a9f314b8b:d8f06a4c6d38 (5 drafts) |
| 224 |
(run 'hg heads' to see heads, 'hg merge' to merge) |
| 225 |
|
| 226 |
$ hg up -q 5 |
| 227 |
$ hg log -f -T '{rev}\n' c |
| 228 |
5 |
| 229 |
4 |