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