Mercurial > hg-stable
comparison tests/test-fileset.t @ 25558:daf9f7ee2a5c
convert: support incremental conversion with hg subrepos
This was implied in issue3486, which specifically asked for subrepo support in
lfconvert. Now that lfconvert uses the convert extension internally when going
to normal files, the issue is half fixed. But now even non largefile repos
benefit when other transformations are needed.
Supporting a full subrepo tree conversion from a single command doesn't seem
reasonable, given the number of options that can be provided, and the
transformations that would need to occur when entering a subrepo (consider
'filemap' paths). Instead, this allows the user to incrementally convert each
hg subrepo from bottom up like so:
# so convert knows the dest type when it sees a non empty dest dir
$ hg init converted
$ hg convert orig/sub1 converted/sub1
$ hg convert orig/sub2 converted/sub2
$ hg convert orig converted
This allows different options to be applied to different subrepos more readily.
It assumes the shamap is in the default location in each converted subrepo for
simplicity. It also allows for a subrepo to be cloned into place, in case _it_
doesn't need a conversion. I was able to convert away from using
largefiles/bfiles in several subrepos with this mechanism.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 29 May 2015 13:25:34 -0400 |
parents | ad1d2c952889 |
children | 49fb24f72747 |
comparison
equal
deleted
inserted
replaced
25557:52c552a05414 | 25558:daf9f7ee2a5c |
---|---|
178 $ hg init sub | 178 $ hg init sub |
179 $ echo a > sub/suba | 179 $ echo a > sub/suba |
180 $ hg -R sub add sub/suba | 180 $ hg -R sub add sub/suba |
181 $ hg -R sub ci -m sub | 181 $ hg -R sub ci -m sub |
182 $ echo 'sub = sub' > .hgsub | 182 $ echo 'sub = sub' > .hgsub |
183 $ hg init sub2 | |
184 $ echo b > sub2/b | |
185 $ hg -R sub2 ci -Am sub2 | |
186 adding b | |
187 $ echo 'sub2 = sub2' >> .hgsub | |
183 $ fileset 'subrepo()' | 188 $ fileset 'subrepo()' |
184 $ hg add .hgsub | 189 $ hg add .hgsub |
185 $ fileset 'subrepo()' | 190 $ fileset 'subrepo()' |
186 sub | 191 sub |
192 sub2 | |
187 $ fileset 'subrepo("sub")' | 193 $ fileset 'subrepo("sub")' |
188 sub | 194 sub |
189 $ fileset 'subrepo("glob:*")' | 195 $ fileset 'subrepo("glob:*")' |
190 sub | 196 sub |
197 sub2 | |
191 $ hg ci -m subrepo | 198 $ hg ci -m subrepo |
199 | |
200 Test that .hgsubstate is updated as appropriate during a conversion. The | |
201 saverev property is enough to alter the hashes of the subrepo. | |
202 | |
203 $ hg init ../converted | |
204 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ | |
205 > sub ../converted/sub | |
206 initializing destination ../converted/sub repository | |
207 scanning source... | |
208 sorting... | |
209 converting... | |
210 0 sub | |
211 $ hg clone -U sub2 ../converted/sub2 | |
212 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ | |
213 > . ../converted | |
214 scanning source... | |
215 sorting... | |
216 converting... | |
217 4 addfiles | |
218 3 manychanges | |
219 2 diverging | |
220 1 merge | |
221 0 subrepo | |
222 no ".hgsubstate" updates will be made for "sub2" | |
223 $ hg up -q -R ../converted -r tip | |
224 $ hg --cwd ../converted cat sub/suba sub2/b -r tip | |
225 a | |
226 b | |
227 $ oldnode=`hg log -r tip -T "{node}\n"` | |
228 $ newnode=`hg log -R ../converted -r tip -T "{node}\n"` | |
229 $ [[ "$oldnode" != "$newnode" ]] || echo "nothing changed" | |
192 | 230 |
193 Test with a revision | 231 Test with a revision |
194 | 232 |
195 $ hg log -G --template '{rev} {desc}\n' | 233 $ hg log -G --template '{rev} {desc}\n' |
196 @ 4 subrepo | 234 @ 4 subrepo |
239 $ hg forget 'con.xml' | 277 $ hg forget 'con.xml' |
240 #endif | 278 #endif |
241 | 279 |
242 $ fileset -r4 'subrepo("re:su.*")' | 280 $ fileset -r4 'subrepo("re:su.*")' |
243 sub | 281 sub |
282 sub2 | |
244 $ fileset -r4 'subrepo("sub")' | 283 $ fileset -r4 'subrepo("sub")' |
245 sub | 284 sub |
246 $ fileset -r4 'b2 or c1' | 285 $ fileset -r4 'b2 or c1' |
247 b2 | 286 b2 |
248 c1 | 287 c1 |