##// END OF EJS Templates
merge with stable
Pulkit Goyal -
r41601:311f563c merge default draft
parent child Browse files
Show More
@@ -175,3 +175,4 b' a91a2837150bdcb27ae76b3646e6c93cd6a15904'
175 175 1c8c54cf97256f4468da2eb4dbee24f7f3888e71 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlwG+eIQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91YqSD/9IAwdaPrOeiT+DVBW2x33oFeY1X1f5CBG/vCJptalOd2QDIsD0ANEzQHmzV25RKD851v155Txt/BPlkuBfO/kg0BbOoqTpGZk+5CcoFWeyhJct2CxtCLdEpyZ/98/htMR4VfWprCX2GHXPjS813l9pebsN3WgBUOc2VaUdHNRoAGsMVgWC5BWwNP4XSA9oixFL/O4aGLQ6pPfP3vmMFySWXWnIN8gUZ4sm53eKaT0QCICAgzFh+GzRd81uACDfoJn1d8RS9GK+h6j8x0crLY5CpQQy8lRVkokvc0h6XK44ofc57p9GHAOfprHY3DbBhD9H6fLAf5raUsqPkLRYVGqhg8bOsBr3vJ56hiXJYOYPZSYXGjnHRcUrgfPVrY+6mPTeCIQMPmWBHwYH5Tc5TLrPuxxCL4wVywqGbfmIVP+WFUikkykAAwuPOZAswxJJOB0gsnnxcApmTeXRznBXyvzscMlWVZiMjzflKRRJ9V5RI4Fdc6n1wQ4vuLSO4AUnIypIsV6ZFAOBuFKH7x6nPG0tP3FYzcICaMOPbxEx3LStnuU+UuEs6TIxM6IiR3LPiiDGZ2BA2gjJhDxQFV8hAl8KDO3LsYuyUQCv3RTAP+YejH21bIXdnwDlNqy8Hrd53rq7jZsdb2pMVvOZZ3VmIu64f+jVkD/r5msDUkQL3M9jwg==
176 176 197f092b2cd9691e2a55d198f717b231af9be6f9 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAlwz6DUQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91SbtD/47TJkSFuDJrvrpLuZROeR48opM8kPt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kHpSmwquiU6TG6R1dA/ckBK2H90hewtb/jwLlenGugpylLQ2U/NsDdoWRyHNrdB4eUJiWD/BBPXktZQJVja97Js+Vn44ctCkNjui/53xcBQfIYdHGLttIEq56v/yZiSviCcTUhBPRSEdoUg==
@@ -188,3 +188,4 b' a91a2837150bdcb27ae76b3646e6c93cd6a15904'
188 188 1c8c54cf97256f4468da2eb4dbee24f7f3888e71 4.8.1
189 189 197f092b2cd9691e2a55d198f717b231af9be6f9 4.8.2
190 190 593718ff5844cad7a27ee3eb5adad89ac8550949 4.9rc0
191 83377b4b4ae0e9a6b8e579f7b0a693b8cf5c3b10 4.9
@@ -3,7 +3,7 b' Upstream-Name: mercurial'
3 3 Source: https://www.mercurial-scm.org/
4 4
5 5 Files: *
6 Copyright: 2005-2018, Matt Mackall <mpm@selenic.com> and others.
6 Copyright: 2005-2019, Matt Mackall <mpm@selenic.com> and others.
7 7 License: GPL-2+
8 8 This program is free software; you can redistribute it
9 9 and/or modify it under the terms of the GNU General Public
@@ -140,7 +140,7 b' editor = whatever'
140 140 </p>
141 141
142 142 <p>
143 Mercurial is Copyright 2005-2018 Matt Mackall and others. See
143 Mercurial is Copyright 2005-2019 Matt Mackall and others. See
144 144 the <tt>Contributors.txt</tt> file for a list of contributors.
145 145 </p>
146 146
@@ -21,7 +21,7 b''
21 21 #endif
22 22
23 23 [Setup]
24 AppCopyright=Copyright 2005-2018 Matt Mackall and others
24 AppCopyright=Copyright 2005-2019 Matt Mackall and others
25 25 AppName=Mercurial
26 26 AppVersion={#VERSION}
27 27 #if ARCH == "x64"
@@ -45,7 +45,7 b' AppContact=mercurial@mercurial-scm.org'
45 45 DefaultDirName={pf}\Mercurial
46 46 SourceDir=..\..
47 47 VersionInfoDescription=Mercurial distributed SCM (version {#VERSION})
48 VersionInfoCopyright=Copyright 2005-2018 Matt Mackall and others
48 VersionInfoCopyright=Copyright 2005-2019 Matt Mackall and others
49 49 VersionInfoCompany=Matt Mackall and others
50 50 InternalCompressLevel=max
51 51 SolidCompression=true
1 NO CONTENT: modified file, binary diff hidden
@@ -6173,7 +6173,7 b' def version_(ui, **opts):'
6173 6173 util.version())
6174 6174 license = _(
6175 6175 "(see https://mercurial-scm.org for more information)\n"
6176 "\nCopyright (C) 2005-2018 Matt Mackall and others\n"
6176 "\nCopyright (C) 2005-2019 Matt Mackall and others\n"
6177 6177 "This is free software; see the source for copying conditions. "
6178 6178 "There is NO\nwarranty; "
6179 6179 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
@@ -857,6 +857,16 b' https://www.mercurial-scm.org/wiki/Missi'
857 857
858 858 Enabled by default.
859 859
860 ``sparse-revlog``
861 Enable or disable the ``sparse-revlog`` delta strategy. This format improves
862 delta re-use inside revlog. For very branchy repositories, it results in a
863 smaller store. For repositories with many revisions, it also helps
864 performance (by using shortened delta chains.)
865
866 Repositories with this on-disk format require Mercurial version 4.7
867
868 Enabled by default.
869
860 870 ``graph``
861 871 ---------
862 872
@@ -112,7 +112,7 b' Mailing list: https://www.mercurial-scm.'
112 112
113 113 Copying
114 114 """""""
115 Copyright (C) 2005-2018 Matt Mackall.
115 Copyright (C) 2005-2019 Matt Mackall.
116 116 Free use of this software is granted under the terms of the GNU General
117 117 Public License version 2 or any later version.
118 118
@@ -26,7 +26,7 b' See Also'
26 26 Copying
27 27 =======
28 28 This manual page is copyright 2006 Vadim Gelfer.
29 Mercurial is copyright 2005-2018 Matt Mackall.
29 Mercurial is copyright 2005-2019 Matt Mackall.
30 30 Free use of this software is granted under the terms of the GNU General
31 31 Public License version 2 or any later version.
32 32
@@ -34,7 +34,7 b' See Also'
34 34 Copying
35 35 =======
36 36 This manual page is copyright 2005 Bryan O'Sullivan.
37 Mercurial is copyright 2005-2018 Matt Mackall.
37 Mercurial is copyright 2005-2019 Matt Mackall.
38 38 Free use of this software is granted under the terms of the GNU General
39 39 Public License version 2 or any later version.
40 40
@@ -2904,7 +2904,6 b' def newreporequirements(ui, createopts):'
2904 2904
2905 2905 if scmutil.gdinitconfig(ui):
2906 2906 requirements.add('generaldelta')
2907 # experimental config: format.sparse-revlog
2908 2907 if ui.configbool('format', 'sparse-revlog'):
2909 2908 requirements.add(SPARSEREVLOG_REQUIREMENT)
2910 2909 if ui.configbool('experimental', 'treemanifest'):
@@ -497,6 +497,9 b' class revlog(object):'
497 497 else:
498 498 raise error.RevlogError(_('unknown version (%d) in revlog %s') %
499 499 (fmt, self.indexfile))
500 # sparse-revlog can't be on without general-delta (issue6056)
501 if not self._generaldelta:
502 self._sparserevlog = False
500 503
501 504 self._storedeltachains = True
502 505
@@ -755,7 +755,8 b' def _rawgroups(revlog, p1, p2, cachedelt'
755 755 The group order aims at providing fast or small candidates first.
756 756 """
757 757 gdelta = revlog._generaldelta
758 sparse = revlog._sparserevlog
758 # gate sparse behind general-delta because of issue6056
759 sparse = gdelta and revlog._sparserevlog
759 760 curr = len(revlog)
760 761 prev = curr - 1
761 762 deltachain = lambda rev: revlog._deltachain(rev)[0]
@@ -115,6 +115,10 b' def _sanitize(ui, vfs, ignore):'
115 115 vfs.unlink(vfs.reljoin(dirname, f))
116 116
117 117 def _auditsubrepopath(repo, path):
118 # sanity check for potentially unsafe paths such as '~' and '$FOO'
119 if path.startswith('~') or '$' in path or util.expandpath(path) != path:
120 raise error.Abort(_('subrepo path contains illegal component: %s')
121 % path)
118 122 # auditor doesn't check if the path itself is a symlink
119 123 pathutil.pathauditor(repo.root)(path)
120 124 if repo.wvfs.islink(path):
@@ -403,7 +407,16 b' class hgsubrepo(abstractsubrepo):'
403 407 r = ctx.repo()
404 408 root = r.wjoin(path)
405 409 create = allowcreate and not r.wvfs.exists('%s/.hg' % path)
410 # repository constructor does expand variables in path, which is
411 # unsafe since subrepo path might come from untrusted source.
412 if os.path.realpath(util.expandpath(root)) != root:
413 raise error.Abort(_('subrepo path contains illegal component: %s')
414 % path)
406 415 self._repo = hg.repository(r.baseui, root, create=create)
416 if self._repo.root != root:
417 raise error.ProgrammingError('failed to reject unsafe subrepo '
418 'path: %s (expanded to %s)'
419 % (root, self._repo.root))
407 420
408 421 # Propagate the parent's --hidden option
409 422 if r is r.unfiltered():
@@ -1134,7 +1134,7 b' if issetuptools:'
1134 1134 if py2exeloaded:
1135 1135 extra['console'] = [
1136 1136 {'script':'hg',
1137 'copyright':'Copyright (C) 2005-2018 Matt Mackall and others',
1137 'copyright':'Copyright (C) 2005-2019 Matt Mackall and others',
1138 1138 'product_version':version}]
1139 1139 # sub command of 'build' because 'py2exe' does not handle sub_commands
1140 1140 build.sub_commands.insert(0, ('build_hgextindex', None))
This diff has been collapsed as it changes many lines, (530 lines changed) Show them Hide them
@@ -36,6 +36,372 b' on clone (and update):'
36 36 abort: path 'sub/.hg' is inside nested repo 'sub'
37 37 [255]
38 38
39 Test absolute path
40 ------------------
41
42 on commit:
43
44 $ hg init absolutepath
45 $ cd absolutepath
46 $ hg init sub
47 $ echo '/sub = sub' >> .hgsub
48 $ hg ci -qAm 'add subrepo "/sub"'
49 abort: path contains illegal component: /sub
50 [255]
51
52 prepare tampered repo (including the commit above):
53
54 $ hg import --bypass -qm 'add subrepo "/sub"' - <<'EOF'
55 > diff --git a/.hgsub b/.hgsub
56 > new file mode 100644
57 > --- /dev/null
58 > +++ b/.hgsub
59 > @@ -0,0 +1,1 @@
60 > +/sub = sub
61 > diff --git a/.hgsubstate b/.hgsubstate
62 > new file mode 100644
63 > --- /dev/null
64 > +++ b/.hgsubstate
65 > @@ -0,0 +1,1 @@
66 > +0000000000000000000000000000000000000000 /sub
67 > EOF
68 $ cd ..
69
70 on clone (and update):
71
72 $ hg clone -q absolutepath absolutepath2
73 abort: path contains illegal component: /sub
74 [255]
75
76 Test root path
77 --------------
78
79 on commit:
80
81 $ hg init rootpath
82 $ cd rootpath
83 $ hg init sub
84 $ echo '/ = sub' >> .hgsub
85 $ hg ci -qAm 'add subrepo "/"'
86 abort: path ends in directory separator: /
87 [255]
88
89 prepare tampered repo (including the commit above):
90
91 $ hg import --bypass -qm 'add subrepo "/"' - <<'EOF'
92 > diff --git a/.hgsub b/.hgsub
93 > new file mode 100644
94 > --- /dev/null
95 > +++ b/.hgsub
96 > @@ -0,0 +1,1 @@
97 > +/ = sub
98 > diff --git a/.hgsubstate b/.hgsubstate
99 > new file mode 100644
100 > --- /dev/null
101 > +++ b/.hgsubstate
102 > @@ -0,0 +1,1 @@
103 > +0000000000000000000000000000000000000000 /
104 > EOF
105 $ cd ..
106
107 on clone (and update):
108
109 $ hg clone -q rootpath rootpath2
110 abort: path ends in directory separator: /
111 [255]
112
113 Test empty path
114 ---------------
115
116 on commit:
117
118 $ hg init emptypath
119 $ cd emptypath
120 $ hg init sub
121 $ echo '= sub' >> .hgsub
122 $ hg ci -qAm 'add subrepo ""'
123 hg: parse error at .hgsub:1: = sub
124 [255]
125
126 prepare tampered repo (including the commit above):
127
128 $ hg import --bypass -qm 'add subrepo ""' - <<'EOF'
129 > diff --git a/.hgsub b/.hgsub
130 > new file mode 100644
131 > --- /dev/null
132 > +++ b/.hgsub
133 > @@ -0,0 +1,1 @@
134 > += sub
135 > diff --git a/.hgsubstate b/.hgsubstate
136 > new file mode 100644
137 > --- /dev/null
138 > +++ b/.hgsubstate
139 > @@ -0,0 +1,1 @@
140 > +0000000000000000000000000000000000000000
141 > EOF
142 $ cd ..
143
144 on clone (and update):
145
146 $ hg clone -q emptypath emptypath2
147 hg: parse error at .hgsub:1: = sub
148 [255]
149
150 Test current path
151 -----------------
152
153 on commit:
154
155 $ hg init currentpath
156 $ cd currentpath
157 $ hg init sub
158 $ echo '. = sub' >> .hgsub
159 $ hg ci -qAm 'add subrepo "."'
160 abort: subrepo path contains illegal component: .
161 [255]
162
163 prepare tampered repo (including the commit above):
164
165 $ hg import --bypass -qm 'add subrepo "."' - <<'EOF'
166 > diff --git a/.hgsub b/.hgsub
167 > new file mode 100644
168 > --- /dev/null
169 > +++ b/.hgsub
170 > @@ -0,0 +1,1 @@
171 > +.= sub
172 > diff --git a/.hgsubstate b/.hgsubstate
173 > new file mode 100644
174 > --- /dev/null
175 > +++ b/.hgsubstate
176 > @@ -0,0 +1,1 @@
177 > +0000000000000000000000000000000000000000 .
178 > EOF
179 $ cd ..
180
181 on clone (and update):
182
183 $ hg clone -q currentpath currentpath2
184 abort: subrepo path contains illegal component: .
185 [255]
186
187 Test outer path
188 ---------------
189
190 on commit:
191
192 $ mkdir outerpath
193 $ cd outerpath
194 $ hg init main
195 $ cd main
196 $ hg init ../sub
197 $ echo '../sub = ../sub' >> .hgsub
198 $ hg ci -qAm 'add subrepo "../sub"'
199 abort: path contains illegal component: ../sub
200 [255]
201
202 prepare tampered repo (including the commit above):
203
204 $ hg import --bypass -qm 'add subrepo "../sub"' - <<'EOF'
205 > diff --git a/.hgsub b/.hgsub
206 > new file mode 100644
207 > --- /dev/null
208 > +++ b/.hgsub
209 > @@ -0,0 +1,1 @@
210 > +../sub = ../sub
211 > diff --git a/.hgsubstate b/.hgsubstate
212 > new file mode 100644
213 > --- /dev/null
214 > +++ b/.hgsubstate
215 > @@ -0,0 +1,1 @@
216 > +0000000000000000000000000000000000000000 ../sub
217 > EOF
218 $ cd ..
219
220 on clone (and update):
221
222 $ hg clone -q main main2
223 abort: path contains illegal component: ../sub
224 [255]
225 $ cd ..
226
227 Test variable expansion
228 -----------------------
229
230 Subrepository paths shouldn't be expanded, but we fail to handle them
231 properly. Any local repository paths are expanded.
232
233 on commit:
234
235 $ mkdir envvar
236 $ cd envvar
237 $ hg init main
238 $ cd main
239 $ hg init sub1
240 $ cat <<'EOF' > sub1/hgrc
241 > [hooks]
242 > log = echo pwned
243 > EOF
244 $ hg -R sub1 ci -qAm 'add sub1 files'
245 $ hg -R sub1 log -r. -T '{node}\n'
246 39eb4b4d3e096527668784893a9280578a8f38b8
247 $ echo '$SUB = sub1' >> .hgsub
248 $ SUB=sub1 hg ci -qAm 'add subrepo "$SUB"'
249 abort: subrepo path contains illegal component: $SUB
250 [255]
251
252 prepare tampered repo (including the changes above as two commits):
253
254 $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF'
255 > diff --git a/.hgsub b/.hgsub
256 > new file mode 100644
257 > --- /dev/null
258 > +++ b/.hgsub
259 > @@ -0,0 +1,1 @@
260 > +$SUB = sub1
261 > diff --git a/.hgsubstate b/.hgsubstate
262 > new file mode 100644
263 > --- /dev/null
264 > +++ b/.hgsubstate
265 > @@ -0,0 +1,1 @@
266 > +0000000000000000000000000000000000000000 $SUB
267 > EOF
268 $ hg debugsetparents 0
269 $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF'
270 > diff --git a/.hgsubstate b/.hgsubstate
271 > --- a/.hgsubstate
272 > +++ b/.hgsubstate
273 > @@ -1,1 +1,1 @@
274 > -0000000000000000000000000000000000000000 $SUB
275 > +39eb4b4d3e096527668784893a9280578a8f38b8 $SUB
276 > EOF
277 $ cd ..
278
279 on clone (and update) with various substitutions:
280
281 $ hg clone -q main main2
282 abort: subrepo path contains illegal component: $SUB
283 [255]
284 $ ls main2
285
286 $ SUB=sub1 hg clone -q main main3
287 abort: subrepo path contains illegal component: $SUB
288 [255]
289 $ ls main3
290
291 $ SUB=sub2 hg clone -q main main4
292 abort: subrepo path contains illegal component: $SUB
293 [255]
294 $ ls main4
295
296 on clone empty subrepo into .hg, then pull (and update), which at least fails:
297
298 $ SUB=.hg hg clone -qr0 main main5
299 abort: subrepo path contains illegal component: $SUB
300 [255]
301 $ ls main5
302 $ test -d main5/.hg/.hg
303 [1]
304 $ SUB=.hg hg -R main5 pull -u
305 pulling from $TESTTMP/envvar/main
306 searching for changes
307 adding changesets
308 adding manifests
309 adding file changes
310 added 1 changesets with 1 changes to 1 files
311 new changesets 7a2f0e59146f
312 .hgsubstate: untracked file differs
313 abort: untracked files in working directory differ from files in requested revision
314 [255]
315 $ cat main5/.hg/hgrc | grep pwned
316 [1]
317
318 on clone (and update) into .hg, which at least fails:
319
320 $ SUB=.hg hg clone -q main main6
321 abort: subrepo path contains illegal component: $SUB
322 [255]
323 $ ls main6
324 $ cat main6/.hg/hgrc | grep pwned
325 [1]
326
327 on clone (and update) into .hg/* subdir:
328
329 $ SUB=.hg/foo hg clone -q main main7
330 abort: subrepo path contains illegal component: $SUB
331 [255]
332 $ ls main7
333 $ test -d main7/.hg/.hg
334 [1]
335
336 on clone (and update) into outer tree:
337
338 $ SUB=../out-of-tree-write hg clone -q main main8
339 abort: subrepo path contains illegal component: $SUB
340 [255]
341 $ ls main8
342
343 on clone (and update) into e.g. $HOME, which doesn't work since subrepo paths
344 are concatenated prior to variable expansion:
345
346 $ SUB="$TESTTMP/envvar/fakehome" hg clone -q main main9
347 abort: subrepo path contains illegal component: $SUB
348 [255]
349 $ ls main9 | wc -l
350 \s*0 (re)
351
352 $ ls
353 main
354 main2
355 main3
356 main4
357 main5
358 main6
359 main7
360 main8
361 main9
362 $ cd ..
363
364 Test tilde
365 ----------
366
367 The leading tilde may be expanded to $HOME, but it can be a valid subrepo
368 path in theory. However, we want to prohibit it as there might be unsafe
369 handling of such paths.
370
371 on commit:
372
373 $ hg init tilde
374 $ cd tilde
375 $ hg init './~'
376 $ echo '~ = ~' >> .hgsub
377 $ hg ci -qAm 'add subrepo "~"'
378 abort: subrepo path contains illegal component: ~
379 [255]
380
381 prepare tampered repo (including the commit above):
382
383 $ hg import --bypass -qm 'add subrepo "~"' - <<'EOF'
384 > diff --git a/.hgsub b/.hgsub
385 > new file mode 100644
386 > --- /dev/null
387 > +++ b/.hgsub
388 > @@ -0,0 +1,1 @@
389 > +~ = ~
390 > diff --git a/.hgsubstate b/.hgsubstate
391 > new file mode 100644
392 > --- /dev/null
393 > +++ b/.hgsubstate
394 > @@ -0,0 +1,1 @@
395 > +0000000000000000000000000000000000000000 ~
396 > EOF
397 $ cd ..
398
399 on clone (and update):
400
401 $ hg clone -q tilde tilde2
402 abort: subrepo path contains illegal component: ~
403 [255]
404
39 405 Test direct symlink traversal
40 406 -----------------------------
41 407
@@ -130,3 +496,167 b' on clone (and update):'
130 496 root
131 497
132 498 #endif
499
500 Test symlink traversal by variable expansion
501 --------------------------------------------
502
503 #if symlink
504
505 $ FAKEHOME="$TESTTMP/envvarsym/fakehome"
506
507 on commit:
508
509 $ mkdir envvarsym
510 $ cd envvarsym
511 $ hg init main
512 $ cd main
513 $ ln -s "`echo "$FAKEHOME" | sed 's|\(.\)/.*|\1|'`"
514 $ hg ci -qAm 'add symlink to top-level system directory'
515
516 $ hg init sub1
517 $ echo pwned > sub1/pwned
518 $ hg -R sub1 ci -qAm 'add sub1 files'
519 $ hg -R sub1 log -r. -T '{node}\n'
520 f40c9134ba1b6961e12f250868823f0092fb68a8
521 $ echo '$SUB = sub1' >> .hgsub
522 $ SUB="$FAKEHOME" hg ci -qAm 'add subrepo "$SUB"'
523 abort: subrepo path contains illegal component: $SUB
524 [255]
525
526 prepare tampered repo (including the changes above as two commits):
527
528 $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF'
529 > diff --git a/.hgsub b/.hgsub
530 > new file mode 100644
531 > --- /dev/null
532 > +++ b/.hgsub
533 > @@ -0,0 +1,1 @@
534 > +$SUB = sub1
535 > diff --git a/.hgsubstate b/.hgsubstate
536 > new file mode 100644
537 > --- /dev/null
538 > +++ b/.hgsubstate
539 > @@ -0,0 +1,1 @@
540 > +0000000000000000000000000000000000000000 $SUB
541 > EOF
542 $ hg debugsetparents 1
543 $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF'
544 > diff --git a/.hgsubstate b/.hgsubstate
545 > --- a/.hgsubstate
546 > +++ b/.hgsubstate
547 > @@ -1,1 +1,1 @@
548 > -0000000000000000000000000000000000000000 $SUB
549 > +f40c9134ba1b6961e12f250868823f0092fb68a8 $SUB
550 > EOF
551 $ cd ..
552
553 on clone (and update) without fakehome directory:
554
555 $ rm -fR "$FAKEHOME"
556 $ SUB="$FAKEHOME" hg clone -q main main2
557 abort: subrepo path contains illegal component: $SUB
558 [255]
559 $ test -d "$FAKEHOME"
560 [1]
561
562 on clone (and update) with empty fakehome directory:
563
564 $ rm -fR "$FAKEHOME"
565 $ mkdir "$FAKEHOME"
566 $ SUB="$FAKEHOME" hg clone -q main main3
567 abort: subrepo path contains illegal component: $SUB
568 [255]
569 $ ls "$FAKEHOME"
570
571 on clone (and update) with non-empty fakehome directory:
572
573 $ rm -fR "$FAKEHOME"
574 $ mkdir "$FAKEHOME"
575 $ touch "$FAKEHOME/a"
576 $ SUB="$FAKEHOME" hg clone -q main main4
577 abort: subrepo path contains illegal component: $SUB
578 [255]
579 $ ls "$FAKEHOME"
580 a
581
582 on clone empty subrepo with non-empty fakehome directory,
583 then pull (and update):
584
585 $ rm -fR "$FAKEHOME"
586 $ mkdir "$FAKEHOME"
587 $ touch "$FAKEHOME/a"
588 $ SUB="$FAKEHOME" hg clone -qr1 main main5
589 abort: subrepo path contains illegal component: $SUB
590 [255]
591 $ ls "$FAKEHOME"
592 a
593 $ test -d "$FAKEHOME/.hg"
594 [1]
595 $ SUB="$FAKEHOME" hg -R main5 pull -u
596 pulling from $TESTTMP/envvarsym/main
597 searching for changes
598 adding changesets
599 adding manifests
600 adding file changes
601 added 1 changesets with 1 changes to 1 files
602 new changesets * (glob)
603 .hgsubstate: untracked file differs
604 abort: untracked files in working directory differ from files in requested revision
605 [255]
606 $ ls "$FAKEHOME"
607 a
608 $ test -d "$FAKEHOME/.hg"
609 [1]
610
611 on clone empty subrepo with hg-managed fakehome directory,
612 then pull (and update):
613
614 $ rm -fR "$FAKEHOME"
615 $ hg init "$FAKEHOME"
616 $ touch "$FAKEHOME/a"
617 $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file'
618 $ SUB="$FAKEHOME" hg clone -qr1 main main6
619 abort: subrepo path contains illegal component: $SUB
620 [255]
621 $ ls "$FAKEHOME"
622 a
623 $ SUB="$FAKEHOME" hg -R main6 pull -u
624 pulling from $TESTTMP/envvarsym/main
625 searching for changes
626 adding changesets
627 adding manifests
628 adding file changes
629 added 1 changesets with 1 changes to 1 files
630 new changesets * (glob)
631 .hgsubstate: untracked file differs
632 abort: untracked files in working directory differ from files in requested revision
633 [255]
634 $ ls "$FAKEHOME"
635 a
636
637 on clone only symlink with hg-managed fakehome directory,
638 then pull (and update):
639
640 $ rm -fR "$FAKEHOME"
641 $ hg init "$FAKEHOME"
642 $ touch "$FAKEHOME/a"
643 $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file'
644 $ SUB="$FAKEHOME" hg clone -qr0 main main7
645 $ ls "$FAKEHOME"
646 a
647 $ SUB="$FAKEHOME" hg -R main7 pull -uf
648 pulling from $TESTTMP/envvarsym/main
649 searching for changes
650 adding changesets
651 adding manifests
652 adding file changes
653 added 2 changesets with 3 changes to 2 files
654 new changesets * (glob)
655 abort: subrepo path contains illegal component: $SUB
656 [255]
657 $ ls "$FAKEHOME"
658 a
659
660 $ cd ..
661
662 #endif
@@ -1504,6 +1504,8 b' Separate sections from subsections'
1504 1504
1505 1505 "usestore"
1506 1506
1507 "sparse-revlog"
1508
1507 1509 "profiling"
1508 1510 -----------
1509 1511
@@ -268,3 +268,25 b' clone bookmarks'
268 268 exporting bookmark test
269 269 $ hg -R remote-bookmarks bookmarks
270 270 test 0:08b9e9f63b32
271
272 Check format constraint
273 -----------------------
274
275 $ hg init issue6056 --config format.usegeneraldelta=0 --config format.sparse-revlog=0
276 $ cd issue6056
277 $ echo foo > 1
278 $ echo foo > 2
279 $ echo foo > 3
280 $ echo foo > 4
281 $ echo foo > 5
282 $ hg add *
283
284 Build a bogus repository (sparserevlog without general delta)
285
286 $ hg commit -m 'initial changesets'
287 $ echo 'sparserevlog' >> .hg/requires
288 $ for x in `$TESTDIR/seq.py 100`; do
289 > echo $x >> `expr $x % 5 + 1`
290 > hg commit -m $x
291 > done
292 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now