Show More
@@ -1,1149 +1,1158 b'' | |||
|
1 | 1 | # configitems.py - centralized declaration of configuration option |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import functools |
|
11 | 11 | import re |
|
12 | 12 | |
|
13 | 13 | from . import ( |
|
14 | 14 | encoding, |
|
15 | 15 | error, |
|
16 | 16 | ) |
|
17 | 17 | |
|
18 | 18 | def loadconfigtable(ui, extname, configtable): |
|
19 | 19 | """update config item known to the ui with the extension ones""" |
|
20 | 20 | for section, items in configtable.items(): |
|
21 | 21 | knownitems = ui._knownconfig.setdefault(section, itemregister()) |
|
22 | 22 | knownkeys = set(knownitems) |
|
23 | 23 | newkeys = set(items) |
|
24 | 24 | for key in sorted(knownkeys & newkeys): |
|
25 | 25 | msg = "extension '%s' overwrite config item '%s.%s'" |
|
26 | 26 | msg %= (extname, section, key) |
|
27 | 27 | ui.develwarn(msg, config='warn-config') |
|
28 | 28 | |
|
29 | 29 | knownitems.update(items) |
|
30 | 30 | |
|
31 | 31 | class configitem(object): |
|
32 | 32 | """represent a known config item |
|
33 | 33 | |
|
34 | 34 | :section: the official config section where to find this item, |
|
35 | 35 | :name: the official name within the section, |
|
36 | 36 | :default: default value for this item, |
|
37 | 37 | :alias: optional list of tuples as alternatives, |
|
38 | 38 | :generic: this is a generic definition, match name using regular expression. |
|
39 | 39 | """ |
|
40 | 40 | |
|
41 | 41 | def __init__(self, section, name, default=None, alias=(), |
|
42 | 42 | generic=False, priority=0): |
|
43 | 43 | self.section = section |
|
44 | 44 | self.name = name |
|
45 | 45 | self.default = default |
|
46 | 46 | self.alias = list(alias) |
|
47 | 47 | self.generic = generic |
|
48 | 48 | self.priority = priority |
|
49 | 49 | self._re = None |
|
50 | 50 | if generic: |
|
51 | 51 | self._re = re.compile(self.name) |
|
52 | 52 | |
|
53 | 53 | class itemregister(dict): |
|
54 | 54 | """A specialized dictionary that can handle wild-card selection""" |
|
55 | 55 | |
|
56 | 56 | def __init__(self): |
|
57 | 57 | super(itemregister, self).__init__() |
|
58 | 58 | self._generics = set() |
|
59 | 59 | |
|
60 | 60 | def update(self, other): |
|
61 | 61 | super(itemregister, self).update(other) |
|
62 | 62 | self._generics.update(other._generics) |
|
63 | 63 | |
|
64 | 64 | def __setitem__(self, key, item): |
|
65 | 65 | super(itemregister, self).__setitem__(key, item) |
|
66 | 66 | if item.generic: |
|
67 | 67 | self._generics.add(item) |
|
68 | 68 | |
|
69 | 69 | def get(self, key): |
|
70 | 70 | baseitem = super(itemregister, self).get(key) |
|
71 | 71 | if baseitem is not None and not baseitem.generic: |
|
72 | 72 | return baseitem |
|
73 | 73 | |
|
74 | 74 | # search for a matching generic item |
|
75 | 75 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) |
|
76 | 76 | for item in generics: |
|
77 | 77 | # we use 'match' instead of 'search' to make the matching simpler |
|
78 | 78 | # for people unfamiliar with regular expression. Having the match |
|
79 | 79 | # rooted to the start of the string will produce less surprising |
|
80 | 80 | # result for user writing simple regex for sub-attribute. |
|
81 | 81 | # |
|
82 | 82 | # For example using "color\..*" match produces an unsurprising |
|
83 | 83 | # result, while using search could suddenly match apparently |
|
84 | 84 | # unrelated configuration that happens to contains "color." |
|
85 | 85 | # anywhere. This is a tradeoff where we favor requiring ".*" on |
|
86 | 86 | # some match to avoid the need to prefix most pattern with "^". |
|
87 | 87 | # The "^" seems more error prone. |
|
88 | 88 | if item._re.match(key): |
|
89 | 89 | return item |
|
90 | 90 | |
|
91 | 91 | return None |
|
92 | 92 | |
|
93 | 93 | coreitems = {} |
|
94 | 94 | |
|
95 | 95 | def _register(configtable, *args, **kwargs): |
|
96 | 96 | item = configitem(*args, **kwargs) |
|
97 | 97 | section = configtable.setdefault(item.section, itemregister()) |
|
98 | 98 | if item.name in section: |
|
99 | 99 | msg = "duplicated config item registration for '%s.%s'" |
|
100 | 100 | raise error.ProgrammingError(msg % (item.section, item.name)) |
|
101 | 101 | section[item.name] = item |
|
102 | 102 | |
|
103 | 103 | # special value for case where the default is derived from other values |
|
104 | 104 | dynamicdefault = object() |
|
105 | 105 | |
|
106 | 106 | # Registering actual config items |
|
107 | 107 | |
|
108 | 108 | def getitemregister(configtable): |
|
109 | 109 | f = functools.partial(_register, configtable) |
|
110 | 110 | # export pseudo enum as configitem.* |
|
111 | 111 | f.dynamicdefault = dynamicdefault |
|
112 | 112 | return f |
|
113 | 113 | |
|
114 | 114 | coreconfigitem = getitemregister(coreitems) |
|
115 | 115 | |
|
116 | 116 | coreconfigitem('alias', '.*', |
|
117 | 117 | default=None, |
|
118 | 118 | generic=True, |
|
119 | 119 | ) |
|
120 | 120 | coreconfigitem('annotate', 'nodates', |
|
121 | 121 | default=False, |
|
122 | 122 | ) |
|
123 | 123 | coreconfigitem('annotate', 'showfunc', |
|
124 | 124 | default=False, |
|
125 | 125 | ) |
|
126 | 126 | coreconfigitem('annotate', 'unified', |
|
127 | 127 | default=None, |
|
128 | 128 | ) |
|
129 | 129 | coreconfigitem('annotate', 'git', |
|
130 | 130 | default=False, |
|
131 | 131 | ) |
|
132 | 132 | coreconfigitem('annotate', 'ignorews', |
|
133 | 133 | default=False, |
|
134 | 134 | ) |
|
135 | 135 | coreconfigitem('annotate', 'ignorewsamount', |
|
136 | 136 | default=False, |
|
137 | 137 | ) |
|
138 | 138 | coreconfigitem('annotate', 'ignoreblanklines', |
|
139 | 139 | default=False, |
|
140 | 140 | ) |
|
141 | 141 | coreconfigitem('annotate', 'ignorewseol', |
|
142 | 142 | default=False, |
|
143 | 143 | ) |
|
144 | 144 | coreconfigitem('annotate', 'nobinary', |
|
145 | 145 | default=False, |
|
146 | 146 | ) |
|
147 | 147 | coreconfigitem('annotate', 'noprefix', |
|
148 | 148 | default=False, |
|
149 | 149 | ) |
|
150 | 150 | coreconfigitem('auth', 'cookiefile', |
|
151 | 151 | default=None, |
|
152 | 152 | ) |
|
153 | 153 | # bookmarks.pushing: internal hack for discovery |
|
154 | 154 | coreconfigitem('bookmarks', 'pushing', |
|
155 | 155 | default=list, |
|
156 | 156 | ) |
|
157 | 157 | # bundle.mainreporoot: internal hack for bundlerepo |
|
158 | 158 | coreconfigitem('bundle', 'mainreporoot', |
|
159 | 159 | default='', |
|
160 | 160 | ) |
|
161 | 161 | # bundle.reorder: experimental config |
|
162 | 162 | coreconfigitem('bundle', 'reorder', |
|
163 | 163 | default='auto', |
|
164 | 164 | ) |
|
165 | 165 | coreconfigitem('censor', 'policy', |
|
166 | 166 | default='abort', |
|
167 | 167 | ) |
|
168 | 168 | coreconfigitem('chgserver', 'idletimeout', |
|
169 | 169 | default=3600, |
|
170 | 170 | ) |
|
171 | 171 | coreconfigitem('chgserver', 'skiphash', |
|
172 | 172 | default=False, |
|
173 | 173 | ) |
|
174 | 174 | coreconfigitem('cmdserver', 'log', |
|
175 | 175 | default=None, |
|
176 | 176 | ) |
|
177 | 177 | coreconfigitem('color', '.*', |
|
178 | 178 | default=None, |
|
179 | 179 | generic=True, |
|
180 | 180 | ) |
|
181 | 181 | coreconfigitem('color', 'mode', |
|
182 | 182 | default='auto', |
|
183 | 183 | ) |
|
184 | 184 | coreconfigitem('color', 'pagermode', |
|
185 | 185 | default=dynamicdefault, |
|
186 | 186 | ) |
|
187 | 187 | coreconfigitem('commands', 'show.aliasprefix', |
|
188 | 188 | default=list, |
|
189 | 189 | ) |
|
190 | 190 | coreconfigitem('commands', 'status.relative', |
|
191 | 191 | default=False, |
|
192 | 192 | ) |
|
193 | 193 | coreconfigitem('commands', 'status.skipstates', |
|
194 | 194 | default=[], |
|
195 | 195 | ) |
|
196 | 196 | coreconfigitem('commands', 'status.verbose', |
|
197 | 197 | default=False, |
|
198 | 198 | ) |
|
199 | 199 | coreconfigitem('commands', 'update.check', |
|
200 | 200 | default=None, |
|
201 | 201 | # Deprecated, remove after 4.4 release |
|
202 | 202 | alias=[('experimental', 'updatecheck')] |
|
203 | 203 | ) |
|
204 | 204 | coreconfigitem('commands', 'update.requiredest', |
|
205 | 205 | default=False, |
|
206 | 206 | ) |
|
207 | 207 | coreconfigitem('committemplate', '.*', |
|
208 | 208 | default=None, |
|
209 | 209 | generic=True, |
|
210 | 210 | ) |
|
211 | 211 | coreconfigitem('debug', 'dirstate.delaywrite', |
|
212 | 212 | default=0, |
|
213 | 213 | ) |
|
214 | 214 | coreconfigitem('defaults', '.*', |
|
215 | 215 | default=None, |
|
216 | 216 | generic=True, |
|
217 | 217 | ) |
|
218 | 218 | coreconfigitem('devel', 'all-warnings', |
|
219 | 219 | default=False, |
|
220 | 220 | ) |
|
221 | 221 | coreconfigitem('devel', 'bundle2.debug', |
|
222 | 222 | default=False, |
|
223 | 223 | ) |
|
224 | 224 | coreconfigitem('devel', 'cache-vfs', |
|
225 | 225 | default=None, |
|
226 | 226 | ) |
|
227 | 227 | coreconfigitem('devel', 'check-locks', |
|
228 | 228 | default=False, |
|
229 | 229 | ) |
|
230 | 230 | coreconfigitem('devel', 'check-relroot', |
|
231 | 231 | default=False, |
|
232 | 232 | ) |
|
233 | 233 | coreconfigitem('devel', 'default-date', |
|
234 | 234 | default=None, |
|
235 | 235 | ) |
|
236 | 236 | coreconfigitem('devel', 'deprec-warn', |
|
237 | 237 | default=False, |
|
238 | 238 | ) |
|
239 | 239 | coreconfigitem('devel', 'disableloaddefaultcerts', |
|
240 | 240 | default=False, |
|
241 | 241 | ) |
|
242 | 242 | coreconfigitem('devel', 'warn-empty-changegroup', |
|
243 | 243 | default=False, |
|
244 | 244 | ) |
|
245 | 245 | coreconfigitem('devel', 'legacy.exchange', |
|
246 | 246 | default=list, |
|
247 | 247 | ) |
|
248 | 248 | coreconfigitem('devel', 'servercafile', |
|
249 | 249 | default='', |
|
250 | 250 | ) |
|
251 | 251 | coreconfigitem('devel', 'serverexactprotocol', |
|
252 | 252 | default='', |
|
253 | 253 | ) |
|
254 | 254 | coreconfigitem('devel', 'serverrequirecert', |
|
255 | 255 | default=False, |
|
256 | 256 | ) |
|
257 | 257 | coreconfigitem('devel', 'strip-obsmarkers', |
|
258 | 258 | default=True, |
|
259 | 259 | ) |
|
260 | 260 | coreconfigitem('devel', 'warn-config', |
|
261 | 261 | default=None, |
|
262 | 262 | ) |
|
263 | 263 | coreconfigitem('devel', 'warn-config-default', |
|
264 | 264 | default=None, |
|
265 | 265 | ) |
|
266 | 266 | coreconfigitem('devel', 'user.obsmarker', |
|
267 | 267 | default=None, |
|
268 | 268 | ) |
|
269 | 269 | coreconfigitem('devel', 'warn-config-unknown', |
|
270 | 270 | default=None, |
|
271 | 271 | ) |
|
272 | 272 | coreconfigitem('diff', 'nodates', |
|
273 | 273 | default=False, |
|
274 | 274 | ) |
|
275 | 275 | coreconfigitem('diff', 'showfunc', |
|
276 | 276 | default=False, |
|
277 | 277 | ) |
|
278 | 278 | coreconfigitem('diff', 'unified', |
|
279 | 279 | default=None, |
|
280 | 280 | ) |
|
281 | 281 | coreconfigitem('diff', 'git', |
|
282 | 282 | default=False, |
|
283 | 283 | ) |
|
284 | 284 | coreconfigitem('diff', 'ignorews', |
|
285 | 285 | default=False, |
|
286 | 286 | ) |
|
287 | 287 | coreconfigitem('diff', 'ignorewsamount', |
|
288 | 288 | default=False, |
|
289 | 289 | ) |
|
290 | 290 | coreconfigitem('diff', 'ignoreblanklines', |
|
291 | 291 | default=False, |
|
292 | 292 | ) |
|
293 | 293 | coreconfigitem('diff', 'ignorewseol', |
|
294 | 294 | default=False, |
|
295 | 295 | ) |
|
296 | 296 | coreconfigitem('diff', 'nobinary', |
|
297 | 297 | default=False, |
|
298 | 298 | ) |
|
299 | 299 | coreconfigitem('diff', 'noprefix', |
|
300 | 300 | default=False, |
|
301 | 301 | ) |
|
302 | 302 | coreconfigitem('email', 'bcc', |
|
303 | 303 | default=None, |
|
304 | 304 | ) |
|
305 | 305 | coreconfigitem('email', 'cc', |
|
306 | 306 | default=None, |
|
307 | 307 | ) |
|
308 | 308 | coreconfigitem('email', 'charsets', |
|
309 | 309 | default=list, |
|
310 | 310 | ) |
|
311 | 311 | coreconfigitem('email', 'from', |
|
312 | 312 | default=None, |
|
313 | 313 | ) |
|
314 | 314 | coreconfigitem('email', 'method', |
|
315 | 315 | default='smtp', |
|
316 | 316 | ) |
|
317 | 317 | coreconfigitem('email', 'reply-to', |
|
318 | 318 | default=None, |
|
319 | 319 | ) |
|
320 | 320 | coreconfigitem('email', 'to', |
|
321 | 321 | default=None, |
|
322 | 322 | ) |
|
323 | 323 | coreconfigitem('experimental', 'archivemetatemplate', |
|
324 | 324 | default=dynamicdefault, |
|
325 | 325 | ) |
|
326 | 326 | coreconfigitem('experimental', 'bundle-phases', |
|
327 | 327 | default=False, |
|
328 | 328 | ) |
|
329 | 329 | coreconfigitem('experimental', 'bundle2-advertise', |
|
330 | 330 | default=True, |
|
331 | 331 | ) |
|
332 | 332 | coreconfigitem('experimental', 'bundle2-output-capture', |
|
333 | 333 | default=False, |
|
334 | 334 | ) |
|
335 | 335 | coreconfigitem('experimental', 'bundle2.pushback', |
|
336 | 336 | default=False, |
|
337 | 337 | ) |
|
338 | 338 | coreconfigitem('experimental', 'bundle2lazylocking', |
|
339 | 339 | default=False, |
|
340 | 340 | ) |
|
341 | 341 | coreconfigitem('experimental', 'bundlecomplevel', |
|
342 | 342 | default=None, |
|
343 | 343 | ) |
|
344 | 344 | coreconfigitem('experimental', 'changegroup3', |
|
345 | 345 | default=False, |
|
346 | 346 | ) |
|
347 | 347 | coreconfigitem('experimental', 'clientcompressionengines', |
|
348 | 348 | default=list, |
|
349 | 349 | ) |
|
350 | 350 | coreconfigitem('experimental', 'copytrace', |
|
351 | 351 | default='on', |
|
352 | 352 | ) |
|
353 | 353 | coreconfigitem('experimental', 'copytrace.movecandidateslimit', |
|
354 | 354 | default=100, |
|
355 | 355 | ) |
|
356 | 356 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', |
|
357 | 357 | default=100, |
|
358 | 358 | ) |
|
359 | 359 | coreconfigitem('experimental', 'crecordtest', |
|
360 | 360 | default=None, |
|
361 | 361 | ) |
|
362 | 362 | coreconfigitem('experimental', 'editortmpinhg', |
|
363 | 363 | default=False, |
|
364 | 364 | ) |
|
365 | 365 | coreconfigitem('experimental', 'evolution', |
|
366 | 366 | default=list, |
|
367 | 367 | ) |
|
368 | 368 | coreconfigitem('experimental', 'evolution.allowdivergence', |
|
369 | 369 | default=False, |
|
370 | 370 | alias=[('experimental', 'allowdivergence')] |
|
371 | 371 | ) |
|
372 | 372 | coreconfigitem('experimental', 'evolution.allowunstable', |
|
373 | 373 | default=None, |
|
374 | 374 | ) |
|
375 | 375 | coreconfigitem('experimental', 'evolution.createmarkers', |
|
376 | 376 | default=None, |
|
377 | 377 | ) |
|
378 | 378 | coreconfigitem('experimental', 'evolution.effect-flags', |
|
379 | 379 | default=False, |
|
380 | 380 | alias=[('experimental', 'effect-flags')] |
|
381 | 381 | ) |
|
382 | 382 | coreconfigitem('experimental', 'evolution.exchange', |
|
383 | 383 | default=None, |
|
384 | 384 | ) |
|
385 | 385 | coreconfigitem('experimental', 'evolution.bundle-obsmarker', |
|
386 | 386 | default=False, |
|
387 | 387 | ) |
|
388 | 388 | coreconfigitem('experimental', 'evolution.track-operation', |
|
389 | 389 | default=True, |
|
390 | 390 | ) |
|
391 | 391 | coreconfigitem('experimental', 'maxdeltachainspan', |
|
392 | 392 | default=-1, |
|
393 | 393 | ) |
|
394 | 394 | coreconfigitem('experimental', 'mmapindexthreshold', |
|
395 | 395 | default=None, |
|
396 | 396 | ) |
|
397 | 397 | coreconfigitem('experimental', 'nonnormalparanoidcheck', |
|
398 | 398 | default=False, |
|
399 | 399 | ) |
|
400 | 400 | coreconfigitem('experimental', 'exportableenviron', |
|
401 | 401 | default=list, |
|
402 | 402 | ) |
|
403 | 403 | coreconfigitem('experimental', 'extendedheader.index', |
|
404 | 404 | default=None, |
|
405 | 405 | ) |
|
406 | 406 | coreconfigitem('experimental', 'extendedheader.similarity', |
|
407 | 407 | default=False, |
|
408 | 408 | ) |
|
409 | 409 | coreconfigitem('experimental', 'format.compression', |
|
410 | 410 | default='zlib', |
|
411 | 411 | ) |
|
412 | 412 | coreconfigitem('experimental', 'graphshorten', |
|
413 | 413 | default=False, |
|
414 | 414 | ) |
|
415 | 415 | coreconfigitem('experimental', 'graphstyle.parent', |
|
416 | 416 | default=dynamicdefault, |
|
417 | 417 | ) |
|
418 | 418 | coreconfigitem('experimental', 'graphstyle.missing', |
|
419 | 419 | default=dynamicdefault, |
|
420 | 420 | ) |
|
421 | 421 | coreconfigitem('experimental', 'graphstyle.grandparent', |
|
422 | 422 | default=dynamicdefault, |
|
423 | 423 | ) |
|
424 | 424 | coreconfigitem('experimental', 'hook-track-tags', |
|
425 | 425 | default=False, |
|
426 | 426 | ) |
|
427 | 427 | coreconfigitem('experimental', 'httppostargs', |
|
428 | 428 | default=False, |
|
429 | 429 | ) |
|
430 | 430 | coreconfigitem('experimental', 'manifestv2', |
|
431 | 431 | default=False, |
|
432 | 432 | ) |
|
433 | 433 | coreconfigitem('experimental', 'mergedriver', |
|
434 | 434 | default=None, |
|
435 | 435 | ) |
|
436 | 436 | coreconfigitem('experimental', 'obsmarkers-exchange-debug', |
|
437 | 437 | default=False, |
|
438 | 438 | ) |
|
439 | 439 | coreconfigitem('experimental', 'rebase.multidest', |
|
440 | 440 | default=False, |
|
441 | 441 | ) |
|
442 | 442 | coreconfigitem('experimental', 'revertalternateinteractivemode', |
|
443 | 443 | default=True, |
|
444 | 444 | ) |
|
445 | 445 | coreconfigitem('experimental', 'revlogv2', |
|
446 | 446 | default=None, |
|
447 | 447 | ) |
|
448 | 448 | coreconfigitem('experimental', 'spacemovesdown', |
|
449 | 449 | default=False, |
|
450 | 450 | ) |
|
451 | 451 | coreconfigitem('experimental', 'sparse-read', |
|
452 | 452 | default=False, |
|
453 | 453 | ) |
|
454 | 454 | coreconfigitem('experimental', 'sparse-read.density-threshold', |
|
455 | 455 | default=0.25, |
|
456 | 456 | ) |
|
457 | 457 | coreconfigitem('experimental', 'sparse-read.min-gap-size', |
|
458 | 458 | default='256K', |
|
459 | 459 | ) |
|
460 | 460 | coreconfigitem('experimental', 'treemanifest', |
|
461 | 461 | default=False, |
|
462 | 462 | ) |
|
463 | 463 | coreconfigitem('extensions', '.*', |
|
464 | 464 | default=None, |
|
465 | 465 | generic=True, |
|
466 | 466 | ) |
|
467 | 467 | coreconfigitem('extdata', '.*', |
|
468 | 468 | default=None, |
|
469 | 469 | generic=True, |
|
470 | 470 | ) |
|
471 | 471 | coreconfigitem('format', 'aggressivemergedeltas', |
|
472 | 472 | default=False, |
|
473 | 473 | ) |
|
474 | 474 | coreconfigitem('format', 'chunkcachesize', |
|
475 | 475 | default=None, |
|
476 | 476 | ) |
|
477 | 477 | coreconfigitem('format', 'dotencode', |
|
478 | 478 | default=True, |
|
479 | 479 | ) |
|
480 | 480 | coreconfigitem('format', 'generaldelta', |
|
481 | 481 | default=False, |
|
482 | 482 | ) |
|
483 | 483 | coreconfigitem('format', 'manifestcachesize', |
|
484 | 484 | default=None, |
|
485 | 485 | ) |
|
486 | 486 | coreconfigitem('format', 'maxchainlen', |
|
487 | 487 | default=None, |
|
488 | 488 | ) |
|
489 | 489 | coreconfigitem('format', 'obsstore-version', |
|
490 | 490 | default=None, |
|
491 | 491 | ) |
|
492 | 492 | coreconfigitem('format', 'usefncache', |
|
493 | 493 | default=True, |
|
494 | 494 | ) |
|
495 | 495 | coreconfigitem('format', 'usegeneraldelta', |
|
496 | 496 | default=True, |
|
497 | 497 | ) |
|
498 | 498 | coreconfigitem('format', 'usestore', |
|
499 | 499 | default=True, |
|
500 | 500 | ) |
|
501 | 501 | coreconfigitem('fsmonitor', 'warn_when_unused', |
|
502 | 502 | default=True, |
|
503 | 503 | ) |
|
504 | 504 | coreconfigitem('fsmonitor', 'warn_update_file_count', |
|
505 | 505 | default=50000, |
|
506 | 506 | ) |
|
507 | 507 | coreconfigitem('hooks', '.*', |
|
508 | 508 | default=dynamicdefault, |
|
509 | 509 | generic=True, |
|
510 | 510 | ) |
|
511 | 511 | coreconfigitem('hgweb-paths', '.*', |
|
512 | 512 | default=list, |
|
513 | 513 | generic=True, |
|
514 | 514 | ) |
|
515 | 515 | coreconfigitem('hostfingerprints', '.*', |
|
516 | 516 | default=list, |
|
517 | 517 | generic=True, |
|
518 | 518 | ) |
|
519 | 519 | coreconfigitem('hostsecurity', 'ciphers', |
|
520 | 520 | default=None, |
|
521 | 521 | ) |
|
522 | 522 | coreconfigitem('hostsecurity', 'disabletls10warning', |
|
523 | 523 | default=False, |
|
524 | 524 | ) |
|
525 | 525 | coreconfigitem('hostsecurity', 'minimumprotocol', |
|
526 | 526 | default=dynamicdefault, |
|
527 | 527 | ) |
|
528 | 528 | coreconfigitem('hostsecurity', '.*:minimumprotocol$', |
|
529 | 529 | default=dynamicdefault, |
|
530 | 530 | generic=True, |
|
531 | 531 | ) |
|
532 | 532 | coreconfigitem('hostsecurity', '.*:ciphers$', |
|
533 | 533 | default=dynamicdefault, |
|
534 | 534 | generic=True, |
|
535 | 535 | ) |
|
536 | 536 | coreconfigitem('hostsecurity', '.*:fingerprints$', |
|
537 | 537 | default=list, |
|
538 | 538 | generic=True, |
|
539 | 539 | ) |
|
540 | 540 | coreconfigitem('hostsecurity', '.*:verifycertsfile$', |
|
541 | 541 | default=None, |
|
542 | 542 | generic=True, |
|
543 | 543 | ) |
|
544 | 544 | |
|
545 | 545 | coreconfigitem('http_proxy', 'always', |
|
546 | 546 | default=False, |
|
547 | 547 | ) |
|
548 | 548 | coreconfigitem('http_proxy', 'host', |
|
549 | 549 | default=None, |
|
550 | 550 | ) |
|
551 | 551 | coreconfigitem('http_proxy', 'no', |
|
552 | 552 | default=list, |
|
553 | 553 | ) |
|
554 | 554 | coreconfigitem('http_proxy', 'passwd', |
|
555 | 555 | default=None, |
|
556 | 556 | ) |
|
557 | 557 | coreconfigitem('http_proxy', 'user', |
|
558 | 558 | default=None, |
|
559 | 559 | ) |
|
560 | 560 | coreconfigitem('logtoprocess', 'commandexception', |
|
561 | 561 | default=None, |
|
562 | 562 | ) |
|
563 | 563 | coreconfigitem('logtoprocess', 'commandfinish', |
|
564 | 564 | default=None, |
|
565 | 565 | ) |
|
566 | 566 | coreconfigitem('logtoprocess', 'command', |
|
567 | 567 | default=None, |
|
568 | 568 | ) |
|
569 | 569 | coreconfigitem('logtoprocess', 'develwarn', |
|
570 | 570 | default=None, |
|
571 | 571 | ) |
|
572 | 572 | coreconfigitem('logtoprocess', 'uiblocked', |
|
573 | 573 | default=None, |
|
574 | 574 | ) |
|
575 | 575 | coreconfigitem('merge', 'checkunknown', |
|
576 | 576 | default='abort', |
|
577 | 577 | ) |
|
578 | 578 | coreconfigitem('merge', 'checkignored', |
|
579 | 579 | default='abort', |
|
580 | 580 | ) |
|
581 | 581 | coreconfigitem('experimental', 'merge.checkpathconflicts', |
|
582 | 582 | default=False, |
|
583 | 583 | ) |
|
584 | 584 | coreconfigitem('merge', 'followcopies', |
|
585 | 585 | default=True, |
|
586 | 586 | ) |
|
587 | 587 | coreconfigitem('merge', 'on-failure', |
|
588 | 588 | default='continue', |
|
589 | 589 | ) |
|
590 | 590 | coreconfigitem('merge', 'preferancestor', |
|
591 | 591 | default=lambda: ['*'], |
|
592 | 592 | ) |
|
593 | 593 | coreconfigitem('merge-tools', '.*', |
|
594 | 594 | default=None, |
|
595 | 595 | generic=True, |
|
596 | 596 | ) |
|
597 | 597 | coreconfigitem('merge-tools', br'.*\.args$', |
|
598 | 598 | default="$local $base $other", |
|
599 | 599 | generic=True, |
|
600 | 600 | priority=-1, |
|
601 | 601 | ) |
|
602 | 602 | coreconfigitem('merge-tools', br'.*\.binary$', |
|
603 | 603 | default=False, |
|
604 | 604 | generic=True, |
|
605 | 605 | priority=-1, |
|
606 | 606 | ) |
|
607 | 607 | coreconfigitem('merge-tools', br'.*\.check$', |
|
608 | 608 | default=list, |
|
609 | 609 | generic=True, |
|
610 | 610 | priority=-1, |
|
611 | 611 | ) |
|
612 | 612 | coreconfigitem('merge-tools', br'.*\.checkchanged$', |
|
613 | 613 | default=False, |
|
614 | 614 | generic=True, |
|
615 | 615 | priority=-1, |
|
616 | 616 | ) |
|
617 | 617 | coreconfigitem('merge-tools', br'.*\.executable$', |
|
618 | 618 | default=dynamicdefault, |
|
619 | 619 | generic=True, |
|
620 | 620 | priority=-1, |
|
621 | 621 | ) |
|
622 | 622 | coreconfigitem('merge-tools', br'.*\.fixeol$', |
|
623 | 623 | default=False, |
|
624 | 624 | generic=True, |
|
625 | 625 | priority=-1, |
|
626 | 626 | ) |
|
627 | 627 | coreconfigitem('merge-tools', br'.*\.gui$', |
|
628 | 628 | default=False, |
|
629 | 629 | generic=True, |
|
630 | 630 | priority=-1, |
|
631 | 631 | ) |
|
632 | 632 | coreconfigitem('merge-tools', br'.*\.priority$', |
|
633 | 633 | default=0, |
|
634 | 634 | generic=True, |
|
635 | 635 | priority=-1, |
|
636 | 636 | ) |
|
637 | 637 | coreconfigitem('merge-tools', br'.*\.premerge$', |
|
638 | 638 | default=dynamicdefault, |
|
639 | 639 | generic=True, |
|
640 | 640 | priority=-1, |
|
641 | 641 | ) |
|
642 | 642 | coreconfigitem('merge-tools', br'.*\.symlink$', |
|
643 | 643 | default=False, |
|
644 | 644 | generic=True, |
|
645 | 645 | priority=-1, |
|
646 | 646 | ) |
|
647 | 647 | coreconfigitem('pager', 'attend-.*', |
|
648 | 648 | default=dynamicdefault, |
|
649 | 649 | generic=True, |
|
650 | 650 | ) |
|
651 | 651 | coreconfigitem('pager', 'ignore', |
|
652 | 652 | default=list, |
|
653 | 653 | ) |
|
654 | 654 | coreconfigitem('pager', 'pager', |
|
655 | 655 | default=dynamicdefault, |
|
656 | 656 | ) |
|
657 | 657 | coreconfigitem('patch', 'eol', |
|
658 | 658 | default='strict', |
|
659 | 659 | ) |
|
660 | 660 | coreconfigitem('patch', 'fuzz', |
|
661 | 661 | default=2, |
|
662 | 662 | ) |
|
663 | 663 | coreconfigitem('paths', 'default', |
|
664 | 664 | default=None, |
|
665 | 665 | ) |
|
666 | 666 | coreconfigitem('paths', 'default-push', |
|
667 | 667 | default=None, |
|
668 | 668 | ) |
|
669 | 669 | coreconfigitem('paths', '.*', |
|
670 | 670 | default=None, |
|
671 | 671 | generic=True, |
|
672 | 672 | ) |
|
673 | 673 | coreconfigitem('phases', 'checksubrepos', |
|
674 | 674 | default='follow', |
|
675 | 675 | ) |
|
676 | 676 | coreconfigitem('phases', 'new-commit', |
|
677 | 677 | default='draft', |
|
678 | 678 | ) |
|
679 | 679 | coreconfigitem('phases', 'publish', |
|
680 | 680 | default=True, |
|
681 | 681 | ) |
|
682 | 682 | coreconfigitem('profiling', 'enabled', |
|
683 | 683 | default=False, |
|
684 | 684 | ) |
|
685 | 685 | coreconfigitem('profiling', 'format', |
|
686 | 686 | default='text', |
|
687 | 687 | ) |
|
688 | 688 | coreconfigitem('profiling', 'freq', |
|
689 | 689 | default=1000, |
|
690 | 690 | ) |
|
691 | 691 | coreconfigitem('profiling', 'limit', |
|
692 | 692 | default=30, |
|
693 | 693 | ) |
|
694 | 694 | coreconfigitem('profiling', 'nested', |
|
695 | 695 | default=0, |
|
696 | 696 | ) |
|
697 | 697 | coreconfigitem('profiling', 'output', |
|
698 | 698 | default=None, |
|
699 | 699 | ) |
|
700 | 700 | coreconfigitem('profiling', 'showmax', |
|
701 | 701 | default=0.999, |
|
702 | 702 | ) |
|
703 | 703 | coreconfigitem('profiling', 'showmin', |
|
704 | 704 | default=dynamicdefault, |
|
705 | 705 | ) |
|
706 | 706 | coreconfigitem('profiling', 'sort', |
|
707 | 707 | default='inlinetime', |
|
708 | 708 | ) |
|
709 | 709 | coreconfigitem('profiling', 'statformat', |
|
710 | 710 | default='hotpath', |
|
711 | 711 | ) |
|
712 | 712 | coreconfigitem('profiling', 'type', |
|
713 | 713 | default='stat', |
|
714 | 714 | ) |
|
715 | 715 | coreconfigitem('progress', 'assume-tty', |
|
716 | 716 | default=False, |
|
717 | 717 | ) |
|
718 | 718 | coreconfigitem('progress', 'changedelay', |
|
719 | 719 | default=1, |
|
720 | 720 | ) |
|
721 | 721 | coreconfigitem('progress', 'clear-complete', |
|
722 | 722 | default=True, |
|
723 | 723 | ) |
|
724 | 724 | coreconfigitem('progress', 'debug', |
|
725 | 725 | default=False, |
|
726 | 726 | ) |
|
727 | 727 | coreconfigitem('progress', 'delay', |
|
728 | 728 | default=3, |
|
729 | 729 | ) |
|
730 | 730 | coreconfigitem('progress', 'disable', |
|
731 | 731 | default=False, |
|
732 | 732 | ) |
|
733 | 733 | coreconfigitem('progress', 'estimateinterval', |
|
734 | 734 | default=60.0, |
|
735 | 735 | ) |
|
736 | 736 | coreconfigitem('progress', 'format', |
|
737 | 737 | default=lambda: ['topic', 'bar', 'number', 'estimate'], |
|
738 | 738 | ) |
|
739 | 739 | coreconfigitem('progress', 'refresh', |
|
740 | 740 | default=0.1, |
|
741 | 741 | ) |
|
742 | 742 | coreconfigitem('progress', 'width', |
|
743 | 743 | default=dynamicdefault, |
|
744 | 744 | ) |
|
745 | 745 | coreconfigitem('push', 'pushvars.server', |
|
746 | 746 | default=False, |
|
747 | 747 | ) |
|
748 | 748 | coreconfigitem('server', 'bundle1', |
|
749 | 749 | default=True, |
|
750 | 750 | ) |
|
751 | 751 | coreconfigitem('server', 'bundle1gd', |
|
752 | 752 | default=None, |
|
753 | 753 | ) |
|
754 | 754 | coreconfigitem('server', 'bundle1.pull', |
|
755 | 755 | default=None, |
|
756 | 756 | ) |
|
757 | 757 | coreconfigitem('server', 'bundle1gd.pull', |
|
758 | 758 | default=None, |
|
759 | 759 | ) |
|
760 | 760 | coreconfigitem('server', 'bundle1.push', |
|
761 | 761 | default=None, |
|
762 | 762 | ) |
|
763 | 763 | coreconfigitem('server', 'bundle1gd.push', |
|
764 | 764 | default=None, |
|
765 | 765 | ) |
|
766 | 766 | coreconfigitem('server', 'compressionengines', |
|
767 | 767 | default=list, |
|
768 | 768 | ) |
|
769 | 769 | coreconfigitem('server', 'concurrent-push-mode', |
|
770 | 770 | default='strict', |
|
771 | 771 | ) |
|
772 | 772 | coreconfigitem('server', 'disablefullbundle', |
|
773 | 773 | default=False, |
|
774 | 774 | ) |
|
775 | 775 | coreconfigitem('server', 'maxhttpheaderlen', |
|
776 | 776 | default=1024, |
|
777 | 777 | ) |
|
778 | 778 | coreconfigitem('server', 'preferuncompressed', |
|
779 | 779 | default=False, |
|
780 | 780 | ) |
|
781 | 781 | coreconfigitem('server', 'uncompressed', |
|
782 | 782 | default=True, |
|
783 | 783 | ) |
|
784 | 784 | coreconfigitem('server', 'uncompressedallowsecret', |
|
785 | 785 | default=False, |
|
786 | 786 | ) |
|
787 | 787 | coreconfigitem('server', 'validate', |
|
788 | 788 | default=False, |
|
789 | 789 | ) |
|
790 | 790 | coreconfigitem('server', 'zliblevel', |
|
791 | 791 | default=-1, |
|
792 | 792 | ) |
|
793 | 793 | coreconfigitem('smtp', 'host', |
|
794 | 794 | default=None, |
|
795 | 795 | ) |
|
796 | 796 | coreconfigitem('smtp', 'local_hostname', |
|
797 | 797 | default=None, |
|
798 | 798 | ) |
|
799 | 799 | coreconfigitem('smtp', 'password', |
|
800 | 800 | default=None, |
|
801 | 801 | ) |
|
802 | 802 | coreconfigitem('smtp', 'port', |
|
803 | 803 | default=dynamicdefault, |
|
804 | 804 | ) |
|
805 | 805 | coreconfigitem('smtp', 'tls', |
|
806 | 806 | default='none', |
|
807 | 807 | ) |
|
808 | 808 | coreconfigitem('smtp', 'username', |
|
809 | 809 | default=None, |
|
810 | 810 | ) |
|
811 | 811 | coreconfigitem('sparse', 'missingwarning', |
|
812 | 812 | default=True, |
|
813 | 813 | ) |
|
814 | 814 | coreconfigitem('subrepos', 'allowed', |
|
815 | 815 | default=dynamicdefault, # to make backporting simpler |
|
816 | 816 | ) |
|
817 | coreconfigitem('subrepos', 'hg:allowed', | |
|
818 | default=dynamicdefault, | |
|
819 | ) | |
|
820 | coreconfigitem('subrepos', 'git:allowed', | |
|
821 | default=dynamicdefault, | |
|
822 | ) | |
|
823 | coreconfigitem('subrepos', 'svn:allowed', | |
|
824 | default=dynamicdefault, | |
|
825 | ) | |
|
817 | 826 | coreconfigitem('templates', '.*', |
|
818 | 827 | default=None, |
|
819 | 828 | generic=True, |
|
820 | 829 | ) |
|
821 | 830 | coreconfigitem('trusted', 'groups', |
|
822 | 831 | default=list, |
|
823 | 832 | ) |
|
824 | 833 | coreconfigitem('trusted', 'users', |
|
825 | 834 | default=list, |
|
826 | 835 | ) |
|
827 | 836 | coreconfigitem('ui', '_usedassubrepo', |
|
828 | 837 | default=False, |
|
829 | 838 | ) |
|
830 | 839 | coreconfigitem('ui', 'allowemptycommit', |
|
831 | 840 | default=False, |
|
832 | 841 | ) |
|
833 | 842 | coreconfigitem('ui', 'archivemeta', |
|
834 | 843 | default=True, |
|
835 | 844 | ) |
|
836 | 845 | coreconfigitem('ui', 'askusername', |
|
837 | 846 | default=False, |
|
838 | 847 | ) |
|
839 | 848 | coreconfigitem('ui', 'clonebundlefallback', |
|
840 | 849 | default=False, |
|
841 | 850 | ) |
|
842 | 851 | coreconfigitem('ui', 'clonebundleprefers', |
|
843 | 852 | default=list, |
|
844 | 853 | ) |
|
845 | 854 | coreconfigitem('ui', 'clonebundles', |
|
846 | 855 | default=True, |
|
847 | 856 | ) |
|
848 | 857 | coreconfigitem('ui', 'color', |
|
849 | 858 | default='auto', |
|
850 | 859 | ) |
|
851 | 860 | coreconfigitem('ui', 'commitsubrepos', |
|
852 | 861 | default=False, |
|
853 | 862 | ) |
|
854 | 863 | coreconfigitem('ui', 'debug', |
|
855 | 864 | default=False, |
|
856 | 865 | ) |
|
857 | 866 | coreconfigitem('ui', 'debugger', |
|
858 | 867 | default=None, |
|
859 | 868 | ) |
|
860 | 869 | coreconfigitem('ui', 'editor', |
|
861 | 870 | default=dynamicdefault, |
|
862 | 871 | ) |
|
863 | 872 | coreconfigitem('ui', 'fallbackencoding', |
|
864 | 873 | default=None, |
|
865 | 874 | ) |
|
866 | 875 | coreconfigitem('ui', 'forcecwd', |
|
867 | 876 | default=None, |
|
868 | 877 | ) |
|
869 | 878 | coreconfigitem('ui', 'forcemerge', |
|
870 | 879 | default=None, |
|
871 | 880 | ) |
|
872 | 881 | coreconfigitem('ui', 'formatdebug', |
|
873 | 882 | default=False, |
|
874 | 883 | ) |
|
875 | 884 | coreconfigitem('ui', 'formatjson', |
|
876 | 885 | default=False, |
|
877 | 886 | ) |
|
878 | 887 | coreconfigitem('ui', 'formatted', |
|
879 | 888 | default=None, |
|
880 | 889 | ) |
|
881 | 890 | coreconfigitem('ui', 'graphnodetemplate', |
|
882 | 891 | default=None, |
|
883 | 892 | ) |
|
884 | 893 | coreconfigitem('ui', 'http2debuglevel', |
|
885 | 894 | default=None, |
|
886 | 895 | ) |
|
887 | 896 | coreconfigitem('ui', 'interactive', |
|
888 | 897 | default=None, |
|
889 | 898 | ) |
|
890 | 899 | coreconfigitem('ui', 'interface', |
|
891 | 900 | default=None, |
|
892 | 901 | ) |
|
893 | 902 | coreconfigitem('ui', 'interface.chunkselector', |
|
894 | 903 | default=None, |
|
895 | 904 | ) |
|
896 | 905 | coreconfigitem('ui', 'logblockedtimes', |
|
897 | 906 | default=False, |
|
898 | 907 | ) |
|
899 | 908 | coreconfigitem('ui', 'logtemplate', |
|
900 | 909 | default=None, |
|
901 | 910 | ) |
|
902 | 911 | coreconfigitem('ui', 'merge', |
|
903 | 912 | default=None, |
|
904 | 913 | ) |
|
905 | 914 | coreconfigitem('ui', 'mergemarkers', |
|
906 | 915 | default='basic', |
|
907 | 916 | ) |
|
908 | 917 | coreconfigitem('ui', 'mergemarkertemplate', |
|
909 | 918 | default=('{node|short} ' |
|
910 | 919 | '{ifeq(tags, "tip", "", ' |
|
911 | 920 | 'ifeq(tags, "", "", "{tags} "))}' |
|
912 | 921 | '{if(bookmarks, "{bookmarks} ")}' |
|
913 | 922 | '{ifeq(branch, "default", "", "{branch} ")}' |
|
914 | 923 | '- {author|user}: {desc|firstline}') |
|
915 | 924 | ) |
|
916 | 925 | coreconfigitem('ui', 'nontty', |
|
917 | 926 | default=False, |
|
918 | 927 | ) |
|
919 | 928 | coreconfigitem('ui', 'origbackuppath', |
|
920 | 929 | default=None, |
|
921 | 930 | ) |
|
922 | 931 | coreconfigitem('ui', 'paginate', |
|
923 | 932 | default=True, |
|
924 | 933 | ) |
|
925 | 934 | coreconfigitem('ui', 'patch', |
|
926 | 935 | default=None, |
|
927 | 936 | ) |
|
928 | 937 | coreconfigitem('ui', 'portablefilenames', |
|
929 | 938 | default='warn', |
|
930 | 939 | ) |
|
931 | 940 | coreconfigitem('ui', 'promptecho', |
|
932 | 941 | default=False, |
|
933 | 942 | ) |
|
934 | 943 | coreconfigitem('ui', 'quiet', |
|
935 | 944 | default=False, |
|
936 | 945 | ) |
|
937 | 946 | coreconfigitem('ui', 'quietbookmarkmove', |
|
938 | 947 | default=False, |
|
939 | 948 | ) |
|
940 | 949 | coreconfigitem('ui', 'remotecmd', |
|
941 | 950 | default='hg', |
|
942 | 951 | ) |
|
943 | 952 | coreconfigitem('ui', 'report_untrusted', |
|
944 | 953 | default=True, |
|
945 | 954 | ) |
|
946 | 955 | coreconfigitem('ui', 'rollback', |
|
947 | 956 | default=True, |
|
948 | 957 | ) |
|
949 | 958 | coreconfigitem('ui', 'slash', |
|
950 | 959 | default=False, |
|
951 | 960 | ) |
|
952 | 961 | coreconfigitem('ui', 'ssh', |
|
953 | 962 | default='ssh', |
|
954 | 963 | ) |
|
955 | 964 | coreconfigitem('ui', 'statuscopies', |
|
956 | 965 | default=False, |
|
957 | 966 | ) |
|
958 | 967 | coreconfigitem('ui', 'strict', |
|
959 | 968 | default=False, |
|
960 | 969 | ) |
|
961 | 970 | coreconfigitem('ui', 'style', |
|
962 | 971 | default='', |
|
963 | 972 | ) |
|
964 | 973 | coreconfigitem('ui', 'supportcontact', |
|
965 | 974 | default=None, |
|
966 | 975 | ) |
|
967 | 976 | coreconfigitem('ui', 'textwidth', |
|
968 | 977 | default=78, |
|
969 | 978 | ) |
|
970 | 979 | coreconfigitem('ui', 'timeout', |
|
971 | 980 | default='600', |
|
972 | 981 | ) |
|
973 | 982 | coreconfigitem('ui', 'traceback', |
|
974 | 983 | default=False, |
|
975 | 984 | ) |
|
976 | 985 | coreconfigitem('ui', 'tweakdefaults', |
|
977 | 986 | default=False, |
|
978 | 987 | ) |
|
979 | 988 | coreconfigitem('ui', 'usehttp2', |
|
980 | 989 | default=False, |
|
981 | 990 | ) |
|
982 | 991 | coreconfigitem('ui', 'username', |
|
983 | 992 | alias=[('ui', 'user')] |
|
984 | 993 | ) |
|
985 | 994 | coreconfigitem('ui', 'verbose', |
|
986 | 995 | default=False, |
|
987 | 996 | ) |
|
988 | 997 | coreconfigitem('verify', 'skipflags', |
|
989 | 998 | default=None, |
|
990 | 999 | ) |
|
991 | 1000 | coreconfigitem('web', 'allowbz2', |
|
992 | 1001 | default=False, |
|
993 | 1002 | ) |
|
994 | 1003 | coreconfigitem('web', 'allowgz', |
|
995 | 1004 | default=False, |
|
996 | 1005 | ) |
|
997 | 1006 | coreconfigitem('web', 'allowpull', |
|
998 | 1007 | default=True, |
|
999 | 1008 | ) |
|
1000 | 1009 | coreconfigitem('web', 'allow_push', |
|
1001 | 1010 | default=list, |
|
1002 | 1011 | ) |
|
1003 | 1012 | coreconfigitem('web', 'allowzip', |
|
1004 | 1013 | default=False, |
|
1005 | 1014 | ) |
|
1006 | 1015 | coreconfigitem('web', 'archivesubrepos', |
|
1007 | 1016 | default=False, |
|
1008 | 1017 | ) |
|
1009 | 1018 | coreconfigitem('web', 'cache', |
|
1010 | 1019 | default=True, |
|
1011 | 1020 | ) |
|
1012 | 1021 | coreconfigitem('web', 'contact', |
|
1013 | 1022 | default=None, |
|
1014 | 1023 | ) |
|
1015 | 1024 | coreconfigitem('web', 'deny_push', |
|
1016 | 1025 | default=list, |
|
1017 | 1026 | ) |
|
1018 | 1027 | coreconfigitem('web', 'guessmime', |
|
1019 | 1028 | default=False, |
|
1020 | 1029 | ) |
|
1021 | 1030 | coreconfigitem('web', 'hidden', |
|
1022 | 1031 | default=False, |
|
1023 | 1032 | ) |
|
1024 | 1033 | coreconfigitem('web', 'labels', |
|
1025 | 1034 | default=list, |
|
1026 | 1035 | ) |
|
1027 | 1036 | coreconfigitem('web', 'logoimg', |
|
1028 | 1037 | default='hglogo.png', |
|
1029 | 1038 | ) |
|
1030 | 1039 | coreconfigitem('web', 'logourl', |
|
1031 | 1040 | default='https://mercurial-scm.org/', |
|
1032 | 1041 | ) |
|
1033 | 1042 | coreconfigitem('web', 'accesslog', |
|
1034 | 1043 | default='-', |
|
1035 | 1044 | ) |
|
1036 | 1045 | coreconfigitem('web', 'address', |
|
1037 | 1046 | default='', |
|
1038 | 1047 | ) |
|
1039 | 1048 | coreconfigitem('web', 'allow_archive', |
|
1040 | 1049 | default=list, |
|
1041 | 1050 | ) |
|
1042 | 1051 | coreconfigitem('web', 'allow_read', |
|
1043 | 1052 | default=list, |
|
1044 | 1053 | ) |
|
1045 | 1054 | coreconfigitem('web', 'baseurl', |
|
1046 | 1055 | default=None, |
|
1047 | 1056 | ) |
|
1048 | 1057 | coreconfigitem('web', 'cacerts', |
|
1049 | 1058 | default=None, |
|
1050 | 1059 | ) |
|
1051 | 1060 | coreconfigitem('web', 'certificate', |
|
1052 | 1061 | default=None, |
|
1053 | 1062 | ) |
|
1054 | 1063 | coreconfigitem('web', 'collapse', |
|
1055 | 1064 | default=False, |
|
1056 | 1065 | ) |
|
1057 | 1066 | coreconfigitem('web', 'csp', |
|
1058 | 1067 | default=None, |
|
1059 | 1068 | ) |
|
1060 | 1069 | coreconfigitem('web', 'deny_read', |
|
1061 | 1070 | default=list, |
|
1062 | 1071 | ) |
|
1063 | 1072 | coreconfigitem('web', 'descend', |
|
1064 | 1073 | default=True, |
|
1065 | 1074 | ) |
|
1066 | 1075 | coreconfigitem('web', 'description', |
|
1067 | 1076 | default="", |
|
1068 | 1077 | ) |
|
1069 | 1078 | coreconfigitem('web', 'encoding', |
|
1070 | 1079 | default=lambda: encoding.encoding, |
|
1071 | 1080 | ) |
|
1072 | 1081 | coreconfigitem('web', 'errorlog', |
|
1073 | 1082 | default='-', |
|
1074 | 1083 | ) |
|
1075 | 1084 | coreconfigitem('web', 'ipv6', |
|
1076 | 1085 | default=False, |
|
1077 | 1086 | ) |
|
1078 | 1087 | coreconfigitem('web', 'maxchanges', |
|
1079 | 1088 | default=10, |
|
1080 | 1089 | ) |
|
1081 | 1090 | coreconfigitem('web', 'maxfiles', |
|
1082 | 1091 | default=10, |
|
1083 | 1092 | ) |
|
1084 | 1093 | coreconfigitem('web', 'maxshortchanges', |
|
1085 | 1094 | default=60, |
|
1086 | 1095 | ) |
|
1087 | 1096 | coreconfigitem('web', 'motd', |
|
1088 | 1097 | default='', |
|
1089 | 1098 | ) |
|
1090 | 1099 | coreconfigitem('web', 'name', |
|
1091 | 1100 | default=dynamicdefault, |
|
1092 | 1101 | ) |
|
1093 | 1102 | coreconfigitem('web', 'port', |
|
1094 | 1103 | default=8000, |
|
1095 | 1104 | ) |
|
1096 | 1105 | coreconfigitem('web', 'prefix', |
|
1097 | 1106 | default='', |
|
1098 | 1107 | ) |
|
1099 | 1108 | coreconfigitem('web', 'push_ssl', |
|
1100 | 1109 | default=True, |
|
1101 | 1110 | ) |
|
1102 | 1111 | coreconfigitem('web', 'refreshinterval', |
|
1103 | 1112 | default=20, |
|
1104 | 1113 | ) |
|
1105 | 1114 | coreconfigitem('web', 'staticurl', |
|
1106 | 1115 | default=None, |
|
1107 | 1116 | ) |
|
1108 | 1117 | coreconfigitem('web', 'stripes', |
|
1109 | 1118 | default=1, |
|
1110 | 1119 | ) |
|
1111 | 1120 | coreconfigitem('web', 'style', |
|
1112 | 1121 | default='paper', |
|
1113 | 1122 | ) |
|
1114 | 1123 | coreconfigitem('web', 'templates', |
|
1115 | 1124 | default=None, |
|
1116 | 1125 | ) |
|
1117 | 1126 | coreconfigitem('web', 'view', |
|
1118 | 1127 | default='served', |
|
1119 | 1128 | ) |
|
1120 | 1129 | coreconfigitem('worker', 'backgroundclose', |
|
1121 | 1130 | default=dynamicdefault, |
|
1122 | 1131 | ) |
|
1123 | 1132 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
1124 | 1133 | # should give us enough headway. |
|
1125 | 1134 | coreconfigitem('worker', 'backgroundclosemaxqueue', |
|
1126 | 1135 | default=384, |
|
1127 | 1136 | ) |
|
1128 | 1137 | coreconfigitem('worker', 'backgroundcloseminfilecount', |
|
1129 | 1138 | default=2048, |
|
1130 | 1139 | ) |
|
1131 | 1140 | coreconfigitem('worker', 'backgroundclosethreadcount', |
|
1132 | 1141 | default=4, |
|
1133 | 1142 | ) |
|
1134 | 1143 | coreconfigitem('worker', 'numcpus', |
|
1135 | 1144 | default=None, |
|
1136 | 1145 | ) |
|
1137 | 1146 | |
|
1138 | 1147 | # Rebase related configuration moved to core because other extension are doing |
|
1139 | 1148 | # strange things. For example, shelve import the extensions to reuse some bit |
|
1140 | 1149 | # without formally loading it. |
|
1141 | 1150 | coreconfigitem('commands', 'rebase.requiredest', |
|
1142 | 1151 | default=False, |
|
1143 | 1152 | ) |
|
1144 | 1153 | coreconfigitem('experimental', 'rebaseskipobsolete', |
|
1145 | 1154 | default=True, |
|
1146 | 1155 | ) |
|
1147 | 1156 | coreconfigitem('rebase', 'singletransaction', |
|
1148 | 1157 | default=False, |
|
1149 | 1158 | ) |
@@ -1,2557 +1,2577 b'' | |||
|
1 | 1 | The Mercurial system uses a set of configuration files to control |
|
2 | 2 | aspects of its behavior. |
|
3 | 3 | |
|
4 | 4 | Troubleshooting |
|
5 | 5 | =============== |
|
6 | 6 | |
|
7 | 7 | If you're having problems with your configuration, |
|
8 | 8 | :hg:`config --debug` can help you understand what is introducing |
|
9 | 9 | a setting into your environment. |
|
10 | 10 | |
|
11 | 11 | See :hg:`help config.syntax` and :hg:`help config.files` |
|
12 | 12 | for information about how and where to override things. |
|
13 | 13 | |
|
14 | 14 | Structure |
|
15 | 15 | ========= |
|
16 | 16 | |
|
17 | 17 | The configuration files use a simple ini-file format. A configuration |
|
18 | 18 | file consists of sections, led by a ``[section]`` header and followed |
|
19 | 19 | by ``name = value`` entries:: |
|
20 | 20 | |
|
21 | 21 | [ui] |
|
22 | 22 | username = Firstname Lastname <firstname.lastname@example.net> |
|
23 | 23 | verbose = True |
|
24 | 24 | |
|
25 | 25 | The above entries will be referred to as ``ui.username`` and |
|
26 | 26 | ``ui.verbose``, respectively. See :hg:`help config.syntax`. |
|
27 | 27 | |
|
28 | 28 | Files |
|
29 | 29 | ===== |
|
30 | 30 | |
|
31 | 31 | Mercurial reads configuration data from several files, if they exist. |
|
32 | 32 | These files do not exist by default and you will have to create the |
|
33 | 33 | appropriate configuration files yourself: |
|
34 | 34 | |
|
35 | 35 | Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
36 | 36 | |
|
37 | 37 | Global configuration like the username setting is typically put into: |
|
38 | 38 | |
|
39 | 39 | .. container:: windows |
|
40 | 40 | |
|
41 | 41 | - ``%USERPROFILE%\mercurial.ini`` (on Windows) |
|
42 | 42 | |
|
43 | 43 | .. container:: unix.plan9 |
|
44 | 44 | |
|
45 | 45 | - ``$HOME/.hgrc`` (on Unix, Plan9) |
|
46 | 46 | |
|
47 | 47 | The names of these files depend on the system on which Mercurial is |
|
48 | 48 | installed. ``*.rc`` files from a single directory are read in |
|
49 | 49 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
50 | 50 | paths are given below, settings from earlier paths override later |
|
51 | 51 | ones. |
|
52 | 52 | |
|
53 | 53 | .. container:: verbose.unix |
|
54 | 54 | |
|
55 | 55 | On Unix, the following files are consulted: |
|
56 | 56 | |
|
57 | 57 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
58 | 58 | - ``$HOME/.hgrc`` (per-user) |
|
59 | 59 | - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user) |
|
60 | 60 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
61 | 61 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
62 | 62 | - ``/etc/mercurial/hgrc`` (per-system) |
|
63 | 63 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
64 | 64 | - ``<internal>/default.d/*.rc`` (defaults) |
|
65 | 65 | |
|
66 | 66 | .. container:: verbose.windows |
|
67 | 67 | |
|
68 | 68 | On Windows, the following files are consulted: |
|
69 | 69 | |
|
70 | 70 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
71 | 71 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
72 | 72 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
73 | 73 | - ``%HOME%\.hgrc`` (per-user) |
|
74 | 74 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
75 | 75 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) |
|
76 | 76 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
77 | 77 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
78 | 78 | - ``<internal>/default.d/*.rc`` (defaults) |
|
79 | 79 | |
|
80 | 80 | .. note:: |
|
81 | 81 | |
|
82 | 82 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
83 | 83 | is used when running 32-bit Python on 64-bit Windows. |
|
84 | 84 | |
|
85 | 85 | .. container:: windows |
|
86 | 86 | |
|
87 | 87 | On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. |
|
88 | 88 | |
|
89 | 89 | .. container:: verbose.plan9 |
|
90 | 90 | |
|
91 | 91 | On Plan9, the following files are consulted: |
|
92 | 92 | |
|
93 | 93 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
94 | 94 | - ``$home/lib/hgrc`` (per-user) |
|
95 | 95 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
96 | 96 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
97 | 97 | - ``/lib/mercurial/hgrc`` (per-system) |
|
98 | 98 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
99 | 99 | - ``<internal>/default.d/*.rc`` (defaults) |
|
100 | 100 | |
|
101 | 101 | Per-repository configuration options only apply in a |
|
102 | 102 | particular repository. This file is not version-controlled, and |
|
103 | 103 | will not get transferred during a "clone" operation. Options in |
|
104 | 104 | this file override options in all other configuration files. |
|
105 | 105 | |
|
106 | 106 | .. container:: unix.plan9 |
|
107 | 107 | |
|
108 | 108 | On Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
109 | 109 | belong to a trusted user or to a trusted group. See |
|
110 | 110 | :hg:`help config.trusted` for more details. |
|
111 | 111 | |
|
112 | 112 | Per-user configuration file(s) are for the user running Mercurial. Options |
|
113 | 113 | in these files apply to all Mercurial commands executed by this user in any |
|
114 | 114 | directory. Options in these files override per-system and per-installation |
|
115 | 115 | options. |
|
116 | 116 | |
|
117 | 117 | Per-installation configuration files are searched for in the |
|
118 | 118 | directory where Mercurial is installed. ``<install-root>`` is the |
|
119 | 119 | parent directory of the **hg** executable (or symlink) being run. |
|
120 | 120 | |
|
121 | 121 | .. container:: unix.plan9 |
|
122 | 122 | |
|
123 | 123 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial |
|
124 | 124 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these |
|
125 | 125 | files apply to all Mercurial commands executed by any user in any |
|
126 | 126 | directory. |
|
127 | 127 | |
|
128 | 128 | Per-installation configuration files are for the system on |
|
129 | 129 | which Mercurial is running. Options in these files apply to all |
|
130 | 130 | Mercurial commands executed by any user in any directory. Registry |
|
131 | 131 | keys contain PATH-like strings, every part of which must reference |
|
132 | 132 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
133 | 133 | be read. Mercurial checks each of these locations in the specified |
|
134 | 134 | order until one or more configuration files are detected. |
|
135 | 135 | |
|
136 | 136 | Per-system configuration files are for the system on which Mercurial |
|
137 | 137 | is running. Options in these files apply to all Mercurial commands |
|
138 | 138 | executed by any user in any directory. Options in these files |
|
139 | 139 | override per-installation options. |
|
140 | 140 | |
|
141 | 141 | Mercurial comes with some default configuration. The default configuration |
|
142 | 142 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
143 | 143 | configuration files should never be edited by users or administrators but can |
|
144 | 144 | be overridden in other configuration files. So far the directory only contains |
|
145 | 145 | merge tool configuration but packagers can also put other default configuration |
|
146 | 146 | there. |
|
147 | 147 | |
|
148 | 148 | Syntax |
|
149 | 149 | ====== |
|
150 | 150 | |
|
151 | 151 | A configuration file consists of sections, led by a ``[section]`` header |
|
152 | 152 | and followed by ``name = value`` entries (sometimes called |
|
153 | 153 | ``configuration keys``):: |
|
154 | 154 | |
|
155 | 155 | [spam] |
|
156 | 156 | eggs=ham |
|
157 | 157 | green= |
|
158 | 158 | eggs |
|
159 | 159 | |
|
160 | 160 | Each line contains one entry. If the lines that follow are indented, |
|
161 | 161 | they are treated as continuations of that entry. Leading whitespace is |
|
162 | 162 | removed from values. Empty lines are skipped. Lines beginning with |
|
163 | 163 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
164 | 164 | |
|
165 | 165 | Configuration keys can be set multiple times, in which case Mercurial |
|
166 | 166 | will use the value that was configured last. As an example:: |
|
167 | 167 | |
|
168 | 168 | [spam] |
|
169 | 169 | eggs=large |
|
170 | 170 | ham=serrano |
|
171 | 171 | eggs=small |
|
172 | 172 | |
|
173 | 173 | This would set the configuration key named ``eggs`` to ``small``. |
|
174 | 174 | |
|
175 | 175 | It is also possible to define a section multiple times. A section can |
|
176 | 176 | be redefined on the same and/or on different configuration files. For |
|
177 | 177 | example:: |
|
178 | 178 | |
|
179 | 179 | [foo] |
|
180 | 180 | eggs=large |
|
181 | 181 | ham=serrano |
|
182 | 182 | eggs=small |
|
183 | 183 | |
|
184 | 184 | [bar] |
|
185 | 185 | eggs=ham |
|
186 | 186 | green= |
|
187 | 187 | eggs |
|
188 | 188 | |
|
189 | 189 | [foo] |
|
190 | 190 | ham=prosciutto |
|
191 | 191 | eggs=medium |
|
192 | 192 | bread=toasted |
|
193 | 193 | |
|
194 | 194 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
195 | 195 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
196 | 196 | respectively. As you can see there only thing that matters is the last |
|
197 | 197 | value that was set for each of the configuration keys. |
|
198 | 198 | |
|
199 | 199 | If a configuration key is set multiple times in different |
|
200 | 200 | configuration files the final value will depend on the order in which |
|
201 | 201 | the different configuration files are read, with settings from earlier |
|
202 | 202 | paths overriding later ones as described on the ``Files`` section |
|
203 | 203 | above. |
|
204 | 204 | |
|
205 | 205 | A line of the form ``%include file`` will include ``file`` into the |
|
206 | 206 | current configuration file. The inclusion is recursive, which means |
|
207 | 207 | that included files can include other files. Filenames are relative to |
|
208 | 208 | the configuration file in which the ``%include`` directive is found. |
|
209 | 209 | Environment variables and ``~user`` constructs are expanded in |
|
210 | 210 | ``file``. This lets you do something like:: |
|
211 | 211 | |
|
212 | 212 | %include ~/.hgrc.d/$HOST.rc |
|
213 | 213 | |
|
214 | 214 | to include a different configuration file on each computer you use. |
|
215 | 215 | |
|
216 | 216 | A line with ``%unset name`` will remove ``name`` from the current |
|
217 | 217 | section, if it has been set previously. |
|
218 | 218 | |
|
219 | 219 | The values are either free-form text strings, lists of text strings, |
|
220 | 220 | or Boolean values. Boolean values can be set to true using any of "1", |
|
221 | 221 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
222 | 222 | (all case insensitive). |
|
223 | 223 | |
|
224 | 224 | List values are separated by whitespace or comma, except when values are |
|
225 | 225 | placed in double quotation marks:: |
|
226 | 226 | |
|
227 | 227 | allow_read = "John Doe, PhD", brian, betty |
|
228 | 228 | |
|
229 | 229 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
230 | 230 | quotation marks at the beginning of a word is counted as a quotation |
|
231 | 231 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
232 | 232 | |
|
233 | 233 | Sections |
|
234 | 234 | ======== |
|
235 | 235 | |
|
236 | 236 | This section describes the different sections that may appear in a |
|
237 | 237 | Mercurial configuration file, the purpose of each section, its possible |
|
238 | 238 | keys, and their possible values. |
|
239 | 239 | |
|
240 | 240 | ``alias`` |
|
241 | 241 | --------- |
|
242 | 242 | |
|
243 | 243 | Defines command aliases. |
|
244 | 244 | |
|
245 | 245 | Aliases allow you to define your own commands in terms of other |
|
246 | 246 | commands (or aliases), optionally including arguments. Positional |
|
247 | 247 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
248 | 248 | are expanded by Mercurial before execution. Positional arguments not |
|
249 | 249 | already used by ``$N`` in the definition are put at the end of the |
|
250 | 250 | command to be executed. |
|
251 | 251 | |
|
252 | 252 | Alias definitions consist of lines of the form:: |
|
253 | 253 | |
|
254 | 254 | <alias> = <command> [<argument>]... |
|
255 | 255 | |
|
256 | 256 | For example, this definition:: |
|
257 | 257 | |
|
258 | 258 | latest = log --limit 5 |
|
259 | 259 | |
|
260 | 260 | creates a new command ``latest`` that shows only the five most recent |
|
261 | 261 | changesets. You can define subsequent aliases using earlier ones:: |
|
262 | 262 | |
|
263 | 263 | stable5 = latest -b stable |
|
264 | 264 | |
|
265 | 265 | .. note:: |
|
266 | 266 | |
|
267 | 267 | It is possible to create aliases with the same names as |
|
268 | 268 | existing commands, which will then override the original |
|
269 | 269 | definitions. This is almost always a bad idea! |
|
270 | 270 | |
|
271 | 271 | An alias can start with an exclamation point (``!``) to make it a |
|
272 | 272 | shell alias. A shell alias is executed with the shell and will let you |
|
273 | 273 | run arbitrary commands. As an example, :: |
|
274 | 274 | |
|
275 | 275 | echo = !echo $@ |
|
276 | 276 | |
|
277 | 277 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
278 | 278 | terminal. A better example might be:: |
|
279 | 279 | |
|
280 | 280 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f |
|
281 | 281 | |
|
282 | 282 | which will make ``hg purge`` delete all unknown files in the |
|
283 | 283 | repository in the same manner as the purge extension. |
|
284 | 284 | |
|
285 | 285 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
286 | 286 | expand to the command arguments. Unmatched arguments are |
|
287 | 287 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
288 | 288 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
289 | 289 | arguments quoted individually and separated by a space. These expansions |
|
290 | 290 | happen before the command is passed to the shell. |
|
291 | 291 | |
|
292 | 292 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
293 | 293 | the path of the Mercurial that was used to execute the alias. This is |
|
294 | 294 | useful when you want to call further Mercurial commands in a shell |
|
295 | 295 | alias, as was done above for the purge alias. In addition, |
|
296 | 296 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
297 | 297 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
298 | 298 | |
|
299 | 299 | .. note:: |
|
300 | 300 | |
|
301 | 301 | Some global configuration options such as ``-R`` are |
|
302 | 302 | processed before shell aliases and will thus not be passed to |
|
303 | 303 | aliases. |
|
304 | 304 | |
|
305 | 305 | |
|
306 | 306 | ``annotate`` |
|
307 | 307 | ------------ |
|
308 | 308 | |
|
309 | 309 | Settings used when displaying file annotations. All values are |
|
310 | 310 | Booleans and default to False. See :hg:`help config.diff` for |
|
311 | 311 | related options for the diff command. |
|
312 | 312 | |
|
313 | 313 | ``ignorews`` |
|
314 | 314 | Ignore white space when comparing lines. |
|
315 | 315 | |
|
316 | 316 | ``ignorewseol`` |
|
317 | 317 | Ignore white space at the end of a line when comparing lines. |
|
318 | 318 | |
|
319 | 319 | ``ignorewsamount`` |
|
320 | 320 | Ignore changes in the amount of white space. |
|
321 | 321 | |
|
322 | 322 | ``ignoreblanklines`` |
|
323 | 323 | Ignore changes whose lines are all blank. |
|
324 | 324 | |
|
325 | 325 | |
|
326 | 326 | ``auth`` |
|
327 | 327 | -------- |
|
328 | 328 | |
|
329 | 329 | Authentication credentials and other authentication-like configuration |
|
330 | 330 | for HTTP connections. This section allows you to store usernames and |
|
331 | 331 | passwords for use when logging *into* HTTP servers. See |
|
332 | 332 | :hg:`help config.web` if you want to configure *who* can login to |
|
333 | 333 | your HTTP server. |
|
334 | 334 | |
|
335 | 335 | The following options apply to all hosts. |
|
336 | 336 | |
|
337 | 337 | ``cookiefile`` |
|
338 | 338 | Path to a file containing HTTP cookie lines. Cookies matching a |
|
339 | 339 | host will be sent automatically. |
|
340 | 340 | |
|
341 | 341 | The file format uses the Mozilla cookies.txt format, which defines cookies |
|
342 | 342 | on their own lines. Each line contains 7 fields delimited by the tab |
|
343 | 343 | character (domain, is_domain_cookie, path, is_secure, expires, name, |
|
344 | 344 | value). For more info, do an Internet search for "Netscape cookies.txt |
|
345 | 345 | format." |
|
346 | 346 | |
|
347 | 347 | Note: the cookies parser does not handle port numbers on domains. You |
|
348 | 348 | will need to remove ports from the domain for the cookie to be recognized. |
|
349 | 349 | This could result in a cookie being disclosed to an unwanted server. |
|
350 | 350 | |
|
351 | 351 | The cookies file is read-only. |
|
352 | 352 | |
|
353 | 353 | Other options in this section are grouped by name and have the following |
|
354 | 354 | format:: |
|
355 | 355 | |
|
356 | 356 | <name>.<argument> = <value> |
|
357 | 357 | |
|
358 | 358 | where ``<name>`` is used to group arguments into authentication |
|
359 | 359 | entries. Example:: |
|
360 | 360 | |
|
361 | 361 | foo.prefix = hg.intevation.de/mercurial |
|
362 | 362 | foo.username = foo |
|
363 | 363 | foo.password = bar |
|
364 | 364 | foo.schemes = http https |
|
365 | 365 | |
|
366 | 366 | bar.prefix = secure.example.org |
|
367 | 367 | bar.key = path/to/file.key |
|
368 | 368 | bar.cert = path/to/file.cert |
|
369 | 369 | bar.schemes = https |
|
370 | 370 | |
|
371 | 371 | Supported arguments: |
|
372 | 372 | |
|
373 | 373 | ``prefix`` |
|
374 | 374 | Either ``*`` or a URI prefix with or without the scheme part. |
|
375 | 375 | The authentication entry with the longest matching prefix is used |
|
376 | 376 | (where ``*`` matches everything and counts as a match of length |
|
377 | 377 | 1). If the prefix doesn't include a scheme, the match is performed |
|
378 | 378 | against the URI with its scheme stripped as well, and the schemes |
|
379 | 379 | argument, q.v., is then subsequently consulted. |
|
380 | 380 | |
|
381 | 381 | ``username`` |
|
382 | 382 | Optional. Username to authenticate with. If not given, and the |
|
383 | 383 | remote site requires basic or digest authentication, the user will |
|
384 | 384 | be prompted for it. Environment variables are expanded in the |
|
385 | 385 | username letting you do ``foo.username = $USER``. If the URI |
|
386 | 386 | includes a username, only ``[auth]`` entries with a matching |
|
387 | 387 | username or without a username will be considered. |
|
388 | 388 | |
|
389 | 389 | ``password`` |
|
390 | 390 | Optional. Password to authenticate with. If not given, and the |
|
391 | 391 | remote site requires basic or digest authentication, the user |
|
392 | 392 | will be prompted for it. |
|
393 | 393 | |
|
394 | 394 | ``key`` |
|
395 | 395 | Optional. PEM encoded client certificate key file. Environment |
|
396 | 396 | variables are expanded in the filename. |
|
397 | 397 | |
|
398 | 398 | ``cert`` |
|
399 | 399 | Optional. PEM encoded client certificate chain file. Environment |
|
400 | 400 | variables are expanded in the filename. |
|
401 | 401 | |
|
402 | 402 | ``schemes`` |
|
403 | 403 | Optional. Space separated list of URI schemes to use this |
|
404 | 404 | authentication entry with. Only used if the prefix doesn't include |
|
405 | 405 | a scheme. Supported schemes are http and https. They will match |
|
406 | 406 | static-http and static-https respectively, as well. |
|
407 | 407 | (default: https) |
|
408 | 408 | |
|
409 | 409 | If no suitable authentication entry is found, the user is prompted |
|
410 | 410 | for credentials as usual if required by the remote. |
|
411 | 411 | |
|
412 | 412 | ``color`` |
|
413 | 413 | --------- |
|
414 | 414 | |
|
415 | 415 | Configure the Mercurial color mode. For details about how to define your custom |
|
416 | 416 | effect and style see :hg:`help color`. |
|
417 | 417 | |
|
418 | 418 | ``mode`` |
|
419 | 419 | String: control the method used to output color. One of ``auto``, ``ansi``, |
|
420 | 420 | ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will |
|
421 | 421 | use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a |
|
422 | 422 | terminal. Any invalid value will disable color. |
|
423 | 423 | |
|
424 | 424 | ``pagermode`` |
|
425 | 425 | String: optional override of ``color.mode`` used with pager. |
|
426 | 426 | |
|
427 | 427 | On some systems, terminfo mode may cause problems when using |
|
428 | 428 | color with ``less -R`` as a pager program. less with the -R option |
|
429 | 429 | will only display ECMA-48 color codes, and terminfo mode may sometimes |
|
430 | 430 | emit codes that less doesn't understand. You can work around this by |
|
431 | 431 | either using ansi mode (or auto mode), or by using less -r (which will |
|
432 | 432 | pass through all terminal control codes, not just color control |
|
433 | 433 | codes). |
|
434 | 434 | |
|
435 | 435 | On some systems (such as MSYS in Windows), the terminal may support |
|
436 | 436 | a different color mode than the pager program. |
|
437 | 437 | |
|
438 | 438 | ``commands`` |
|
439 | 439 | ------------ |
|
440 | 440 | |
|
441 | 441 | ``status.relative`` |
|
442 | 442 | Make paths in :hg:`status` output relative to the current directory. |
|
443 | 443 | (default: False) |
|
444 | 444 | |
|
445 | 445 | ``update.check`` |
|
446 | 446 | Determines what level of checking :hg:`update` will perform before moving |
|
447 | 447 | to a destination revision. Valid values are ``abort``, ``none``, |
|
448 | 448 | ``linear``, and ``noconflict``. ``abort`` always fails if the working |
|
449 | 449 | directory has uncommitted changes. ``none`` performs no checking, and may |
|
450 | 450 | result in a merge with uncommitted changes. ``linear`` allows any update |
|
451 | 451 | as long as it follows a straight line in the revision history, and may |
|
452 | 452 | trigger a merge with uncommitted changes. ``noconflict`` will allow any |
|
453 | 453 | update which would not trigger a merge with uncommitted changes, if any |
|
454 | 454 | are present. |
|
455 | 455 | (default: ``linear``) |
|
456 | 456 | |
|
457 | 457 | ``update.requiredest`` |
|
458 | 458 | Require that the user pass a destination when running :hg:`update`. |
|
459 | 459 | For example, :hg:`update .::` will be allowed, but a plain :hg:`update` |
|
460 | 460 | will be disallowed. |
|
461 | 461 | (default: False) |
|
462 | 462 | |
|
463 | 463 | ``committemplate`` |
|
464 | 464 | ------------------ |
|
465 | 465 | |
|
466 | 466 | ``changeset`` |
|
467 | 467 | String: configuration in this section is used as the template to |
|
468 | 468 | customize the text shown in the editor when committing. |
|
469 | 469 | |
|
470 | 470 | In addition to pre-defined template keywords, commit log specific one |
|
471 | 471 | below can be used for customization: |
|
472 | 472 | |
|
473 | 473 | ``extramsg`` |
|
474 | 474 | String: Extra message (typically 'Leave message empty to abort |
|
475 | 475 | commit.'). This may be changed by some commands or extensions. |
|
476 | 476 | |
|
477 | 477 | For example, the template configuration below shows as same text as |
|
478 | 478 | one shown by default:: |
|
479 | 479 | |
|
480 | 480 | [committemplate] |
|
481 | 481 | changeset = {desc}\n\n |
|
482 | 482 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
483 | 483 | HG: {extramsg} |
|
484 | 484 | HG: -- |
|
485 | 485 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
486 | 486 | "HG: branch merge\n") |
|
487 | 487 | }HG: branch '{branch}'\n{if(activebookmark, |
|
488 | 488 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
489 | 489 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
490 | 490 | "HG: added {file}\n" }{file_mods % |
|
491 | 491 | "HG: changed {file}\n" }{file_dels % |
|
492 | 492 | "HG: removed {file}\n" }{if(files, "", |
|
493 | 493 | "HG: no files changed\n")} |
|
494 | 494 | |
|
495 | 495 | ``diff()`` |
|
496 | 496 | String: show the diff (see :hg:`help templates` for detail) |
|
497 | 497 | |
|
498 | 498 | Sometimes it is helpful to show the diff of the changeset in the editor without |
|
499 | 499 | having to prefix 'HG: ' to each line so that highlighting works correctly. For |
|
500 | 500 | this, Mercurial provides a special string which will ignore everything below |
|
501 | 501 | it:: |
|
502 | 502 | |
|
503 | 503 | HG: ------------------------ >8 ------------------------ |
|
504 | 504 | |
|
505 | 505 | For example, the template configuration below will show the diff below the |
|
506 | 506 | extra message:: |
|
507 | 507 | |
|
508 | 508 | [committemplate] |
|
509 | 509 | changeset = {desc}\n\n |
|
510 | 510 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
511 | 511 | HG: {extramsg} |
|
512 | 512 | HG: ------------------------ >8 ------------------------ |
|
513 | 513 | HG: Do not touch the line above. |
|
514 | 514 | HG: Everything below will be removed. |
|
515 | 515 | {diff()} |
|
516 | 516 | |
|
517 | 517 | .. note:: |
|
518 | 518 | |
|
519 | 519 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
520 | 520 | detail), this customization should be configured carefully, to |
|
521 | 521 | avoid showing broken characters. |
|
522 | 522 | |
|
523 | 523 | For example, if a multibyte character ending with backslash (0x5c) is |
|
524 | 524 | followed by the ASCII character 'n' in the customized template, |
|
525 | 525 | the sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
526 | 526 | (and the multibyte character is broken, too). |
|
527 | 527 | |
|
528 | 528 | Customized template is used for commands below (``--edit`` may be |
|
529 | 529 | required): |
|
530 | 530 | |
|
531 | 531 | - :hg:`backout` |
|
532 | 532 | - :hg:`commit` |
|
533 | 533 | - :hg:`fetch` (for merge commit only) |
|
534 | 534 | - :hg:`graft` |
|
535 | 535 | - :hg:`histedit` |
|
536 | 536 | - :hg:`import` |
|
537 | 537 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
538 | 538 | - :hg:`rebase` |
|
539 | 539 | - :hg:`shelve` |
|
540 | 540 | - :hg:`sign` |
|
541 | 541 | - :hg:`tag` |
|
542 | 542 | - :hg:`transplant` |
|
543 | 543 | |
|
544 | 544 | Configuring items below instead of ``changeset`` allows showing |
|
545 | 545 | customized message only for specific actions, or showing different |
|
546 | 546 | messages for each action. |
|
547 | 547 | |
|
548 | 548 | - ``changeset.backout`` for :hg:`backout` |
|
549 | 549 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
550 | 550 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
551 | 551 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
552 | 552 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
553 | 553 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
554 | 554 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
555 | 555 | - ``changeset.graft`` for :hg:`graft` |
|
556 | 556 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
557 | 557 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
558 | 558 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
559 | 559 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
560 | 560 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
561 | 561 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
562 | 562 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
563 | 563 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
564 | 564 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
565 | 565 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
566 | 566 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
567 | 567 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
568 | 568 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
569 | 569 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
570 | 570 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
571 | 571 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
572 | 572 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
573 | 573 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
574 | 574 | |
|
575 | 575 | These dot-separated lists of names are treated as hierarchical ones. |
|
576 | 576 | For example, ``changeset.tag.remove`` customizes the commit message |
|
577 | 577 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
578 | 578 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
579 | 579 | |
|
580 | 580 | When the external editor is invoked for a commit, the corresponding |
|
581 | 581 | dot-separated list of names without the ``changeset.`` prefix |
|
582 | 582 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment |
|
583 | 583 | variable. |
|
584 | 584 | |
|
585 | 585 | In this section, items other than ``changeset`` can be referred from |
|
586 | 586 | others. For example, the configuration to list committed files up |
|
587 | 587 | below can be referred as ``{listupfiles}``:: |
|
588 | 588 | |
|
589 | 589 | [committemplate] |
|
590 | 590 | listupfiles = {file_adds % |
|
591 | 591 | "HG: added {file}\n" }{file_mods % |
|
592 | 592 | "HG: changed {file}\n" }{file_dels % |
|
593 | 593 | "HG: removed {file}\n" }{if(files, "", |
|
594 | 594 | "HG: no files changed\n")} |
|
595 | 595 | |
|
596 | 596 | ``decode/encode`` |
|
597 | 597 | ----------------- |
|
598 | 598 | |
|
599 | 599 | Filters for transforming files on checkout/checkin. This would |
|
600 | 600 | typically be used for newline processing or other |
|
601 | 601 | localization/canonicalization of files. |
|
602 | 602 | |
|
603 | 603 | Filters consist of a filter pattern followed by a filter command. |
|
604 | 604 | Filter patterns are globs by default, rooted at the repository root. |
|
605 | 605 | For example, to match any file ending in ``.txt`` in the root |
|
606 | 606 | directory only, use the pattern ``*.txt``. To match any file ending |
|
607 | 607 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
608 | 608 | For each file only the first matching filter applies. |
|
609 | 609 | |
|
610 | 610 | The filter command can start with a specifier, either ``pipe:`` or |
|
611 | 611 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
612 | 612 | |
|
613 | 613 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
614 | 614 | data on stdout. |
|
615 | 615 | |
|
616 | 616 | Pipe example:: |
|
617 | 617 | |
|
618 | 618 | [encode] |
|
619 | 619 | # uncompress gzip files on checkin to improve delta compression |
|
620 | 620 | # note: not necessarily a good idea, just an example |
|
621 | 621 | *.gz = pipe: gunzip |
|
622 | 622 | |
|
623 | 623 | [decode] |
|
624 | 624 | # recompress gzip files when writing them to the working dir (we |
|
625 | 625 | # can safely omit "pipe:", because it's the default) |
|
626 | 626 | *.gz = gzip |
|
627 | 627 | |
|
628 | 628 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
629 | 629 | with the name of a temporary file that contains the data to be |
|
630 | 630 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
631 | 631 | of an empty temporary file, where the filtered data must be written by |
|
632 | 632 | the command. |
|
633 | 633 | |
|
634 | 634 | .. container:: windows |
|
635 | 635 | |
|
636 | 636 | .. note:: |
|
637 | 637 | |
|
638 | 638 | The tempfile mechanism is recommended for Windows systems, |
|
639 | 639 | where the standard shell I/O redirection operators often have |
|
640 | 640 | strange effects and may corrupt the contents of your files. |
|
641 | 641 | |
|
642 | 642 | This filter mechanism is used internally by the ``eol`` extension to |
|
643 | 643 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
644 | 644 | format. We suggest you use the ``eol`` extension for convenience. |
|
645 | 645 | |
|
646 | 646 | |
|
647 | 647 | ``defaults`` |
|
648 | 648 | ------------ |
|
649 | 649 | |
|
650 | 650 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
651 | 651 | |
|
652 | 652 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
653 | 653 | default options/arguments to pass to the specified commands. |
|
654 | 654 | |
|
655 | 655 | The following example makes :hg:`log` run in verbose mode, and |
|
656 | 656 | :hg:`status` show only the modified files, by default:: |
|
657 | 657 | |
|
658 | 658 | [defaults] |
|
659 | 659 | log = -v |
|
660 | 660 | status = -m |
|
661 | 661 | |
|
662 | 662 | The actual commands, instead of their aliases, must be used when |
|
663 | 663 | defining command defaults. The command defaults will also be applied |
|
664 | 664 | to the aliases of the commands defined. |
|
665 | 665 | |
|
666 | 666 | |
|
667 | 667 | ``diff`` |
|
668 | 668 | -------- |
|
669 | 669 | |
|
670 | 670 | Settings used when displaying diffs. Everything except for ``unified`` |
|
671 | 671 | is a Boolean and defaults to False. See :hg:`help config.annotate` |
|
672 | 672 | for related options for the annotate command. |
|
673 | 673 | |
|
674 | 674 | ``git`` |
|
675 | 675 | Use git extended diff format. |
|
676 | 676 | |
|
677 | 677 | ``nobinary`` |
|
678 | 678 | Omit git binary patches. |
|
679 | 679 | |
|
680 | 680 | ``nodates`` |
|
681 | 681 | Don't include dates in diff headers. |
|
682 | 682 | |
|
683 | 683 | ``noprefix`` |
|
684 | 684 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
685 | 685 | |
|
686 | 686 | ``showfunc`` |
|
687 | 687 | Show which function each change is in. |
|
688 | 688 | |
|
689 | 689 | ``ignorews`` |
|
690 | 690 | Ignore white space when comparing lines. |
|
691 | 691 | |
|
692 | 692 | ``ignorewsamount`` |
|
693 | 693 | Ignore changes in the amount of white space. |
|
694 | 694 | |
|
695 | 695 | ``ignoreblanklines`` |
|
696 | 696 | Ignore changes whose lines are all blank. |
|
697 | 697 | |
|
698 | 698 | ``unified`` |
|
699 | 699 | Number of lines of context to show. |
|
700 | 700 | |
|
701 | 701 | ``email`` |
|
702 | 702 | --------- |
|
703 | 703 | |
|
704 | 704 | Settings for extensions that send email messages. |
|
705 | 705 | |
|
706 | 706 | ``from`` |
|
707 | 707 | Optional. Email address to use in "From" header and SMTP envelope |
|
708 | 708 | of outgoing messages. |
|
709 | 709 | |
|
710 | 710 | ``to`` |
|
711 | 711 | Optional. Comma-separated list of recipients' email addresses. |
|
712 | 712 | |
|
713 | 713 | ``cc`` |
|
714 | 714 | Optional. Comma-separated list of carbon copy recipients' |
|
715 | 715 | email addresses. |
|
716 | 716 | |
|
717 | 717 | ``bcc`` |
|
718 | 718 | Optional. Comma-separated list of blind carbon copy recipients' |
|
719 | 719 | email addresses. |
|
720 | 720 | |
|
721 | 721 | ``method`` |
|
722 | 722 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
723 | 723 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
724 | 724 | Otherwise, use as name of program to run that acts like sendmail |
|
725 | 725 | (takes ``-f`` option for sender, list of recipients on command line, |
|
726 | 726 | message on stdin). Normally, setting this to ``sendmail`` or |
|
727 | 727 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
728 | 728 | |
|
729 | 729 | ``charsets`` |
|
730 | 730 | Optional. Comma-separated list of character sets considered |
|
731 | 731 | convenient for recipients. Addresses, headers, and parts not |
|
732 | 732 | containing patches of outgoing messages will be encoded in the |
|
733 | 733 | first character set to which conversion from local encoding |
|
734 | 734 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
735 | 735 | conversion fails, the text in question is sent as is. |
|
736 | 736 | (default: '') |
|
737 | 737 | |
|
738 | 738 | Order of outgoing email character sets: |
|
739 | 739 | |
|
740 | 740 | 1. ``us-ascii``: always first, regardless of settings |
|
741 | 741 | 2. ``email.charsets``: in order given by user |
|
742 | 742 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
743 | 743 | 4. ``$HGENCODING``: if not in email.charsets |
|
744 | 744 | 5. ``utf-8``: always last, regardless of settings |
|
745 | 745 | |
|
746 | 746 | Email example:: |
|
747 | 747 | |
|
748 | 748 | [email] |
|
749 | 749 | from = Joseph User <joe.user@example.com> |
|
750 | 750 | method = /usr/sbin/sendmail |
|
751 | 751 | # charsets for western Europeans |
|
752 | 752 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
753 | 753 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
754 | 754 | |
|
755 | 755 | |
|
756 | 756 | ``extensions`` |
|
757 | 757 | -------------- |
|
758 | 758 | |
|
759 | 759 | Mercurial has an extension mechanism for adding new features. To |
|
760 | 760 | enable an extension, create an entry for it in this section. |
|
761 | 761 | |
|
762 | 762 | If you know that the extension is already in Python's search path, |
|
763 | 763 | you can give the name of the module, followed by ``=``, with nothing |
|
764 | 764 | after the ``=``. |
|
765 | 765 | |
|
766 | 766 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
767 | 767 | the path to the ``.py`` file (including the file name extension) that |
|
768 | 768 | defines the extension. |
|
769 | 769 | |
|
770 | 770 | To explicitly disable an extension that is enabled in an hgrc of |
|
771 | 771 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
772 | 772 | or ``foo = !`` when path is not supplied. |
|
773 | 773 | |
|
774 | 774 | Example for ``~/.hgrc``:: |
|
775 | 775 | |
|
776 | 776 | [extensions] |
|
777 | 777 | # (the churn extension will get loaded from Mercurial's path) |
|
778 | 778 | churn = |
|
779 | 779 | # (this extension will get loaded from the file specified) |
|
780 | 780 | myfeature = ~/.hgext/myfeature.py |
|
781 | 781 | |
|
782 | 782 | |
|
783 | 783 | ``format`` |
|
784 | 784 | ---------- |
|
785 | 785 | |
|
786 | 786 | ``usegeneraldelta`` |
|
787 | 787 | Enable or disable the "generaldelta" repository format which improves |
|
788 | 788 | repository compression by allowing "revlog" to store delta against arbitrary |
|
789 | 789 | revision instead of the previous stored one. This provides significant |
|
790 | 790 | improvement for repositories with branches. |
|
791 | 791 | |
|
792 | 792 | Repositories with this on-disk format require Mercurial version 1.9. |
|
793 | 793 | |
|
794 | 794 | Enabled by default. |
|
795 | 795 | |
|
796 | 796 | ``dotencode`` |
|
797 | 797 | Enable or disable the "dotencode" repository format which enhances |
|
798 | 798 | the "fncache" repository format (which has to be enabled to use |
|
799 | 799 | dotencode) to avoid issues with filenames starting with ._ on |
|
800 | 800 | Mac OS X and spaces on Windows. |
|
801 | 801 | |
|
802 | 802 | Repositories with this on-disk format require Mercurial version 1.7. |
|
803 | 803 | |
|
804 | 804 | Enabled by default. |
|
805 | 805 | |
|
806 | 806 | ``usefncache`` |
|
807 | 807 | Enable or disable the "fncache" repository format which enhances |
|
808 | 808 | the "store" repository format (which has to be enabled to use |
|
809 | 809 | fncache) to allow longer filenames and avoids using Windows |
|
810 | 810 | reserved names, e.g. "nul". |
|
811 | 811 | |
|
812 | 812 | Repositories with this on-disk format require Mercurial version 1.1. |
|
813 | 813 | |
|
814 | 814 | Enabled by default. |
|
815 | 815 | |
|
816 | 816 | ``usestore`` |
|
817 | 817 | Enable or disable the "store" repository format which improves |
|
818 | 818 | compatibility with systems that fold case or otherwise mangle |
|
819 | 819 | filenames. Disabling this option will allow you to store longer filenames |
|
820 | 820 | in some situations at the expense of compatibility. |
|
821 | 821 | |
|
822 | 822 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
823 | 823 | |
|
824 | 824 | Enabled by default. |
|
825 | 825 | |
|
826 | 826 | ``graph`` |
|
827 | 827 | --------- |
|
828 | 828 | |
|
829 | 829 | Web graph view configuration. This section let you change graph |
|
830 | 830 | elements display properties by branches, for instance to make the |
|
831 | 831 | ``default`` branch stand out. |
|
832 | 832 | |
|
833 | 833 | Each line has the following format:: |
|
834 | 834 | |
|
835 | 835 | <branch>.<argument> = <value> |
|
836 | 836 | |
|
837 | 837 | where ``<branch>`` is the name of the branch being |
|
838 | 838 | customized. Example:: |
|
839 | 839 | |
|
840 | 840 | [graph] |
|
841 | 841 | # 2px width |
|
842 | 842 | default.width = 2 |
|
843 | 843 | # red color |
|
844 | 844 | default.color = FF0000 |
|
845 | 845 | |
|
846 | 846 | Supported arguments: |
|
847 | 847 | |
|
848 | 848 | ``width`` |
|
849 | 849 | Set branch edges width in pixels. |
|
850 | 850 | |
|
851 | 851 | ``color`` |
|
852 | 852 | Set branch edges color in hexadecimal RGB notation. |
|
853 | 853 | |
|
854 | 854 | ``hooks`` |
|
855 | 855 | --------- |
|
856 | 856 | |
|
857 | 857 | Commands or Python functions that get automatically executed by |
|
858 | 858 | various actions such as starting or finishing a commit. Multiple |
|
859 | 859 | hooks can be run for the same action by appending a suffix to the |
|
860 | 860 | action. Overriding a site-wide hook can be done by changing its |
|
861 | 861 | value or setting it to an empty string. Hooks can be prioritized |
|
862 | 862 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
863 | 863 | and setting the priority. The default priority is 0. |
|
864 | 864 | |
|
865 | 865 | Example ``.hg/hgrc``:: |
|
866 | 866 | |
|
867 | 867 | [hooks] |
|
868 | 868 | # update working directory after adding changesets |
|
869 | 869 | changegroup.update = hg update |
|
870 | 870 | # do not use the site-wide hook |
|
871 | 871 | incoming = |
|
872 | 872 | incoming.email = /my/email/hook |
|
873 | 873 | incoming.autobuild = /my/build/hook |
|
874 | 874 | # force autobuild hook to run before other incoming hooks |
|
875 | 875 | priority.incoming.autobuild = 1 |
|
876 | 876 | |
|
877 | 877 | Most hooks are run with environment variables set that give useful |
|
878 | 878 | additional information. For each hook below, the environment variables |
|
879 | 879 | it is passed are listed with names in the form ``$HG_foo``. The |
|
880 | 880 | ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks. |
|
881 | 881 | They contain the type of hook which triggered the run and the full name |
|
882 | 882 | of the hook in the config, respectively. In the example above, this will |
|
883 | 883 | be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``. |
|
884 | 884 | |
|
885 | 885 | ``changegroup`` |
|
886 | 886 | Run after a changegroup has been added via push, pull or unbundle. The ID of |
|
887 | 887 | the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``. |
|
888 | 888 | The URL from which changes came is in ``$HG_URL``. |
|
889 | 889 | |
|
890 | 890 | ``commit`` |
|
891 | 891 | Run after a changeset has been created in the local repository. The ID |
|
892 | 892 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
893 | 893 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
894 | 894 | |
|
895 | 895 | ``incoming`` |
|
896 | 896 | Run after a changeset has been pulled, pushed, or unbundled into |
|
897 | 897 | the local repository. The ID of the newly arrived changeset is in |
|
898 | 898 | ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``. |
|
899 | 899 | |
|
900 | 900 | ``outgoing`` |
|
901 | 901 | Run after sending changes from the local repository to another. The ID of |
|
902 | 902 | first changeset sent is in ``$HG_NODE``. The source of operation is in |
|
903 | 903 | ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`. |
|
904 | 904 | |
|
905 | 905 | ``post-<command>`` |
|
906 | 906 | Run after successful invocations of the associated command. The |
|
907 | 907 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
908 | 908 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
909 | 909 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
910 | 910 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
911 | 911 | dictionary of options (with unspecified options set to their defaults). |
|
912 | 912 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
913 | 913 | |
|
914 | 914 | ``fail-<command>`` |
|
915 | 915 | Run after a failed invocation of an associated command. The contents |
|
916 | 916 | of the command line are passed as ``$HG_ARGS``. Parsed command line |
|
917 | 917 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain |
|
918 | 918 | string representations of the python data internally passed to |
|
919 | 919 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified |
|
920 | 920 | options set to their defaults). ``$HG_PATS`` is a list of arguments. |
|
921 | 921 | Hook failure is ignored. |
|
922 | 922 | |
|
923 | 923 | ``pre-<command>`` |
|
924 | 924 | Run before executing the associated command. The contents of the |
|
925 | 925 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
926 | 926 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
927 | 927 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
928 | 928 | is a dictionary of options (with unspecified options set to their |
|
929 | 929 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
930 | 930 | failure, the command doesn't execute and Mercurial returns the failure |
|
931 | 931 | code. |
|
932 | 932 | |
|
933 | 933 | ``prechangegroup`` |
|
934 | 934 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
935 | 935 | status 0 allows the changegroup to proceed. A non-zero status will |
|
936 | 936 | cause the push, pull or unbundle to fail. The URL from which changes |
|
937 | 937 | will come is in ``$HG_URL``. |
|
938 | 938 | |
|
939 | 939 | ``precommit`` |
|
940 | 940 | Run before starting a local commit. Exit status 0 allows the |
|
941 | 941 | commit to proceed. A non-zero status will cause the commit to fail. |
|
942 | 942 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
943 | 943 | |
|
944 | 944 | ``prelistkeys`` |
|
945 | 945 | Run before listing pushkeys (like bookmarks) in the |
|
946 | 946 | repository. A non-zero status will cause failure. The key namespace is |
|
947 | 947 | in ``$HG_NAMESPACE``. |
|
948 | 948 | |
|
949 | 949 | ``preoutgoing`` |
|
950 | 950 | Run before collecting changes to send from the local repository to |
|
951 | 951 | another. A non-zero status will cause failure. This lets you prevent |
|
952 | 952 | pull over HTTP or SSH. It can also prevent propagating commits (via |
|
953 | 953 | local pull, push (outbound) or bundle commands), but not completely, |
|
954 | 954 | since you can just copy files instead. The source of operation is in |
|
955 | 955 | ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote |
|
956 | 956 | SSH or HTTP repository. If "push", "pull" or "bundle", the operation |
|
957 | 957 | is happening on behalf of a repository on same system. |
|
958 | 958 | |
|
959 | 959 | ``prepushkey`` |
|
960 | 960 | Run before a pushkey (like a bookmark) is added to the |
|
961 | 961 | repository. A non-zero status will cause the key to be rejected. The |
|
962 | 962 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
963 | 963 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
964 | 964 | ``$HG_NEW``. |
|
965 | 965 | |
|
966 | 966 | ``pretag`` |
|
967 | 967 | Run before creating a tag. Exit status 0 allows the tag to be |
|
968 | 968 | created. A non-zero status will cause the tag to fail. The ID of the |
|
969 | 969 | changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The |
|
970 | 970 | tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``. |
|
971 | 971 | |
|
972 | 972 | ``pretxnopen`` |
|
973 | 973 | Run before any new repository transaction is open. The reason for the |
|
974 | 974 | transaction will be in ``$HG_TXNNAME``, and a unique identifier for the |
|
975 | 975 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the |
|
976 | 976 | transaction from being opened. |
|
977 | 977 | |
|
978 | 978 | ``pretxnclose`` |
|
979 | 979 | Run right before the transaction is actually finalized. Any repository change |
|
980 | 980 | will be visible to the hook program. This lets you validate the transaction |
|
981 | 981 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
982 | 982 | status will cause the transaction to be rolled back. The reason for the |
|
983 | 983 | transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for |
|
984 | 984 | the transaction will be in ``HG_TXNID``. The rest of the available data will |
|
985 | 985 | vary according the transaction type. New changesets will add ``$HG_NODE`` |
|
986 | 986 | (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last |
|
987 | 987 | added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and |
|
988 | 988 | phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1`` |
|
989 | 989 | respectively, etc. |
|
990 | 990 | |
|
991 | 991 | ``pretxnclose-bookmark`` |
|
992 | 992 | Run right before a bookmark change is actually finalized. Any repository |
|
993 | 993 | change will be visible to the hook program. This lets you validate the |
|
994 | 994 | transaction content or change it. Exit status 0 allows the commit to |
|
995 | 995 | proceed. A non-zero status will cause the transaction to be rolled back. |
|
996 | 996 | The name of the bookmark will be available in ``$HG_BOOKMARK``, the new |
|
997 | 997 | bookmark location will be available in ``$HG_NODE`` while the previous |
|
998 | 998 | location will be available in ``$HG_OLDNODE``. In case of a bookmark |
|
999 | 999 | creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE`` |
|
1000 | 1000 | will be empty. |
|
1001 | 1001 | In addition, the reason for the transaction opening will be in |
|
1002 | 1002 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1003 | 1003 | ``HG_TXNID``. |
|
1004 | 1004 | |
|
1005 | 1005 | ``pretxnclose-phase`` |
|
1006 | 1006 | Run right before a phase change is actually finalized. Any repository change |
|
1007 | 1007 | will be visible to the hook program. This lets you validate the transaction |
|
1008 | 1008 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1009 | 1009 | status will cause the transaction to be rolled back. The hook is called |
|
1010 | 1010 | multiple times, once for each revision affected by a phase change. |
|
1011 | 1011 | The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE`` |
|
1012 | 1012 | while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE`` |
|
1013 | 1013 | will be empty. In addition, the reason for the transaction opening will be in |
|
1014 | 1014 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1015 | 1015 | ``HG_TXNID``. The hook is also run for newly added revisions. In this case |
|
1016 | 1016 | the ``$HG_OLDPHASE`` entry will be empty. |
|
1017 | 1017 | |
|
1018 | 1018 | ``txnclose`` |
|
1019 | 1019 | Run after any repository transaction has been committed. At this |
|
1020 | 1020 | point, the transaction can no longer be rolled back. The hook will run |
|
1021 | 1021 | after the lock is released. See :hg:`help config.hooks.pretxnclose` for |
|
1022 | 1022 | details about available variables. |
|
1023 | 1023 | |
|
1024 | 1024 | ``txnclose-bookmark`` |
|
1025 | 1025 | Run after any bookmark change has been committed. At this point, the |
|
1026 | 1026 | transaction can no longer be rolled back. The hook will run after the lock |
|
1027 | 1027 | is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details |
|
1028 | 1028 | about available variables. |
|
1029 | 1029 | |
|
1030 | 1030 | ``txnclose-phase`` |
|
1031 | 1031 | Run after any phase change has been committed. At this point, the |
|
1032 | 1032 | transaction can no longer be rolled back. The hook will run after the lock |
|
1033 | 1033 | is released. See :hg:`help config.hooks.pretxnclose-phase` for details about |
|
1034 | 1034 | available variables. |
|
1035 | 1035 | |
|
1036 | 1036 | ``txnabort`` |
|
1037 | 1037 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` |
|
1038 | 1038 | for details about available variables. |
|
1039 | 1039 | |
|
1040 | 1040 | ``pretxnchangegroup`` |
|
1041 | 1041 | Run after a changegroup has been added via push, pull or unbundle, but before |
|
1042 | 1042 | the transaction has been committed. The changegroup is visible to the hook |
|
1043 | 1043 | program. This allows validation of incoming changes before accepting them. |
|
1044 | 1044 | The ID of the first new changeset is in ``$HG_NODE`` and last is in |
|
1045 | 1045 | ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero |
|
1046 | 1046 | status will cause the transaction to be rolled back, and the push, pull or |
|
1047 | 1047 | unbundle will fail. The URL that was the source of changes is in ``$HG_URL``. |
|
1048 | 1048 | |
|
1049 | 1049 | ``pretxncommit`` |
|
1050 | 1050 | Run after a changeset has been created, but before the transaction is |
|
1051 | 1051 | committed. The changeset is visible to the hook program. This allows |
|
1052 | 1052 | validation of the commit message and changes. Exit status 0 allows the |
|
1053 | 1053 | commit to proceed. A non-zero status will cause the transaction to |
|
1054 | 1054 | be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent |
|
1055 | 1055 | changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1056 | 1056 | |
|
1057 | 1057 | ``preupdate`` |
|
1058 | 1058 | Run before updating the working directory. Exit status 0 allows |
|
1059 | 1059 | the update to proceed. A non-zero status will prevent the update. |
|
1060 | 1060 | The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a |
|
1061 | 1061 | merge, the ID of second new parent is in ``$HG_PARENT2``. |
|
1062 | 1062 | |
|
1063 | 1063 | ``listkeys`` |
|
1064 | 1064 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
1065 | 1065 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
1066 | 1066 | dictionary containing the keys and values. |
|
1067 | 1067 | |
|
1068 | 1068 | ``pushkey`` |
|
1069 | 1069 | Run after a pushkey (like a bookmark) is added to the |
|
1070 | 1070 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
1071 | 1071 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
1072 | 1072 | value is in ``$HG_NEW``. |
|
1073 | 1073 | |
|
1074 | 1074 | ``tag`` |
|
1075 | 1075 | Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``. |
|
1076 | 1076 | The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in |
|
1077 | 1077 | the repository if ``$HG_LOCAL=0``. |
|
1078 | 1078 | |
|
1079 | 1079 | ``update`` |
|
1080 | 1080 | Run after updating the working directory. The changeset ID of first |
|
1081 | 1081 | new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new |
|
1082 | 1082 | parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
1083 | 1083 | update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``. |
|
1084 | 1084 | |
|
1085 | 1085 | .. note:: |
|
1086 | 1086 | |
|
1087 | 1087 | It is generally better to use standard hooks rather than the |
|
1088 | 1088 | generic pre- and post- command hooks, as they are guaranteed to be |
|
1089 | 1089 | called in the appropriate contexts for influencing transactions. |
|
1090 | 1090 | Also, hooks like "commit" will be called in all contexts that |
|
1091 | 1091 | generate a commit (e.g. tag) and not just the commit command. |
|
1092 | 1092 | |
|
1093 | 1093 | .. note:: |
|
1094 | 1094 | |
|
1095 | 1095 | Environment variables with empty values may not be passed to |
|
1096 | 1096 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
1097 | 1097 | will have an empty value under Unix-like platforms for non-merge |
|
1098 | 1098 | changesets, while it will not be available at all under Windows. |
|
1099 | 1099 | |
|
1100 | 1100 | The syntax for Python hooks is as follows:: |
|
1101 | 1101 | |
|
1102 | 1102 | hookname = python:modulename.submodule.callable |
|
1103 | 1103 | hookname = python:/path/to/python/module.py:callable |
|
1104 | 1104 | |
|
1105 | 1105 | Python hooks are run within the Mercurial process. Each hook is |
|
1106 | 1106 | called with at least three keyword arguments: a ui object (keyword |
|
1107 | 1107 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
1108 | 1108 | keyword that tells what kind of hook is used. Arguments listed as |
|
1109 | 1109 | environment variables above are passed as keyword arguments, with no |
|
1110 | 1110 | ``HG_`` prefix, and names in lower case. |
|
1111 | 1111 | |
|
1112 | 1112 | If a Python hook returns a "true" value or raises an exception, this |
|
1113 | 1113 | is treated as a failure. |
|
1114 | 1114 | |
|
1115 | 1115 | |
|
1116 | 1116 | ``hostfingerprints`` |
|
1117 | 1117 | -------------------- |
|
1118 | 1118 | |
|
1119 | 1119 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) |
|
1120 | 1120 | |
|
1121 | 1121 | Fingerprints of the certificates of known HTTPS servers. |
|
1122 | 1122 | |
|
1123 | 1123 | A HTTPS connection to a server with a fingerprint configured here will |
|
1124 | 1124 | only succeed if the servers certificate matches the fingerprint. |
|
1125 | 1125 | This is very similar to how ssh known hosts works. |
|
1126 | 1126 | |
|
1127 | 1127 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
1128 | 1128 | Multiple values can be specified (separated by spaces or commas). This can |
|
1129 | 1129 | be used to define both old and new fingerprints while a host transitions |
|
1130 | 1130 | to a new certificate. |
|
1131 | 1131 | |
|
1132 | 1132 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
1133 | 1133 | |
|
1134 | 1134 | For example:: |
|
1135 | 1135 | |
|
1136 | 1136 | [hostfingerprints] |
|
1137 | 1137 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1138 | 1138 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1139 | 1139 | |
|
1140 | 1140 | ``hostsecurity`` |
|
1141 | 1141 | ---------------- |
|
1142 | 1142 | |
|
1143 | 1143 | Used to specify global and per-host security settings for connecting to |
|
1144 | 1144 | other machines. |
|
1145 | 1145 | |
|
1146 | 1146 | The following options control default behavior for all hosts. |
|
1147 | 1147 | |
|
1148 | 1148 | ``ciphers`` |
|
1149 | 1149 | Defines the cryptographic ciphers to use for connections. |
|
1150 | 1150 | |
|
1151 | 1151 | Value must be a valid OpenSSL Cipher List Format as documented at |
|
1152 | 1152 | https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT. |
|
1153 | 1153 | |
|
1154 | 1154 | This setting is for advanced users only. Setting to incorrect values |
|
1155 | 1155 | can significantly lower connection security or decrease performance. |
|
1156 | 1156 | You have been warned. |
|
1157 | 1157 | |
|
1158 | 1158 | This option requires Python 2.7. |
|
1159 | 1159 | |
|
1160 | 1160 | ``minimumprotocol`` |
|
1161 | 1161 | Defines the minimum channel encryption protocol to use. |
|
1162 | 1162 | |
|
1163 | 1163 | By default, the highest version of TLS supported by both client and server |
|
1164 | 1164 | is used. |
|
1165 | 1165 | |
|
1166 | 1166 | Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``. |
|
1167 | 1167 | |
|
1168 | 1168 | When running on an old Python version, only ``tls1.0`` is allowed since |
|
1169 | 1169 | old versions of Python only support up to TLS 1.0. |
|
1170 | 1170 | |
|
1171 | 1171 | When running a Python that supports modern TLS versions, the default is |
|
1172 | 1172 | ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this |
|
1173 | 1173 | weakens security and should only be used as a feature of last resort if |
|
1174 | 1174 | a server does not support TLS 1.1+. |
|
1175 | 1175 | |
|
1176 | 1176 | Options in the ``[hostsecurity]`` section can have the form |
|
1177 | 1177 | ``hostname``:``setting``. This allows multiple settings to be defined on a |
|
1178 | 1178 | per-host basis. |
|
1179 | 1179 | |
|
1180 | 1180 | The following per-host settings can be defined. |
|
1181 | 1181 | |
|
1182 | 1182 | ``ciphers`` |
|
1183 | 1183 | This behaves like ``ciphers`` as described above except it only applies |
|
1184 | 1184 | to the host on which it is defined. |
|
1185 | 1185 | |
|
1186 | 1186 | ``fingerprints`` |
|
1187 | 1187 | A list of hashes of the DER encoded peer/remote certificate. Values have |
|
1188 | 1188 | the form ``algorithm``:``fingerprint``. e.g. |
|
1189 | 1189 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. |
|
1190 | 1190 | In addition, colons (``:``) can appear in the fingerprint part. |
|
1191 | 1191 | |
|
1192 | 1192 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, |
|
1193 | 1193 | ``sha512``. |
|
1194 | 1194 | |
|
1195 | 1195 | Use of ``sha256`` or ``sha512`` is preferred. |
|
1196 | 1196 | |
|
1197 | 1197 | If a fingerprint is specified, the CA chain is not validated for this |
|
1198 | 1198 | host and Mercurial will require the remote certificate to match one |
|
1199 | 1199 | of the fingerprints specified. This means if the server updates its |
|
1200 | 1200 | certificate, Mercurial will abort until a new fingerprint is defined. |
|
1201 | 1201 | This can provide stronger security than traditional CA-based validation |
|
1202 | 1202 | at the expense of convenience. |
|
1203 | 1203 | |
|
1204 | 1204 | This option takes precedence over ``verifycertsfile``. |
|
1205 | 1205 | |
|
1206 | 1206 | ``minimumprotocol`` |
|
1207 | 1207 | This behaves like ``minimumprotocol`` as described above except it |
|
1208 | 1208 | only applies to the host on which it is defined. |
|
1209 | 1209 | |
|
1210 | 1210 | ``verifycertsfile`` |
|
1211 | 1211 | Path to file a containing a list of PEM encoded certificates used to |
|
1212 | 1212 | verify the server certificate. Environment variables and ``~user`` |
|
1213 | 1213 | constructs are expanded in the filename. |
|
1214 | 1214 | |
|
1215 | 1215 | The server certificate or the certificate's certificate authority (CA) |
|
1216 | 1216 | must match a certificate from this file or certificate verification |
|
1217 | 1217 | will fail and connections to the server will be refused. |
|
1218 | 1218 | |
|
1219 | 1219 | If defined, only certificates provided by this file will be used: |
|
1220 | 1220 | ``web.cacerts`` and any system/default certificates will not be |
|
1221 | 1221 | used. |
|
1222 | 1222 | |
|
1223 | 1223 | This option has no effect if the per-host ``fingerprints`` option |
|
1224 | 1224 | is set. |
|
1225 | 1225 | |
|
1226 | 1226 | The format of the file is as follows:: |
|
1227 | 1227 | |
|
1228 | 1228 | -----BEGIN CERTIFICATE----- |
|
1229 | 1229 | ... (certificate in base64 PEM encoding) ... |
|
1230 | 1230 | -----END CERTIFICATE----- |
|
1231 | 1231 | -----BEGIN CERTIFICATE----- |
|
1232 | 1232 | ... (certificate in base64 PEM encoding) ... |
|
1233 | 1233 | -----END CERTIFICATE----- |
|
1234 | 1234 | |
|
1235 | 1235 | For example:: |
|
1236 | 1236 | |
|
1237 | 1237 | [hostsecurity] |
|
1238 | 1238 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 |
|
1239 | 1239 | hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1240 | 1240 | hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2 |
|
1241 | 1241 | foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem |
|
1242 | 1242 | |
|
1243 | 1243 | To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1 |
|
1244 | 1244 | when connecting to ``hg.example.com``:: |
|
1245 | 1245 | |
|
1246 | 1246 | [hostsecurity] |
|
1247 | 1247 | minimumprotocol = tls1.2 |
|
1248 | 1248 | hg.example.com:minimumprotocol = tls1.1 |
|
1249 | 1249 | |
|
1250 | 1250 | ``http_proxy`` |
|
1251 | 1251 | -------------- |
|
1252 | 1252 | |
|
1253 | 1253 | Used to access web-based Mercurial repositories through a HTTP |
|
1254 | 1254 | proxy. |
|
1255 | 1255 | |
|
1256 | 1256 | ``host`` |
|
1257 | 1257 | Host name and (optional) port of the proxy server, for example |
|
1258 | 1258 | "myproxy:8000". |
|
1259 | 1259 | |
|
1260 | 1260 | ``no`` |
|
1261 | 1261 | Optional. Comma-separated list of host names that should bypass |
|
1262 | 1262 | the proxy. |
|
1263 | 1263 | |
|
1264 | 1264 | ``passwd`` |
|
1265 | 1265 | Optional. Password to authenticate with at the proxy server. |
|
1266 | 1266 | |
|
1267 | 1267 | ``user`` |
|
1268 | 1268 | Optional. User name to authenticate with at the proxy server. |
|
1269 | 1269 | |
|
1270 | 1270 | ``always`` |
|
1271 | 1271 | Optional. Always use the proxy, even for localhost and any entries |
|
1272 | 1272 | in ``http_proxy.no``. (default: False) |
|
1273 | 1273 | |
|
1274 | 1274 | ``merge`` |
|
1275 | 1275 | --------- |
|
1276 | 1276 | |
|
1277 | 1277 | This section specifies behavior during merges and updates. |
|
1278 | 1278 | |
|
1279 | 1279 | ``checkignored`` |
|
1280 | 1280 | Controls behavior when an ignored file on disk has the same name as a tracked |
|
1281 | 1281 | file in the changeset being merged or updated to, and has different |
|
1282 | 1282 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, |
|
1283 | 1283 | abort on such files. With ``warn``, warn on such files and back them up as |
|
1284 | 1284 | ``.orig``. With ``ignore``, don't print a warning and back them up as |
|
1285 | 1285 | ``.orig``. (default: ``abort``) |
|
1286 | 1286 | |
|
1287 | 1287 | ``checkunknown`` |
|
1288 | 1288 | Controls behavior when an unknown file that isn't ignored has the same name |
|
1289 | 1289 | as a tracked file in the changeset being merged or updated to, and has |
|
1290 | 1290 | different contents. Similar to ``merge.checkignored``, except for files that |
|
1291 | 1291 | are not ignored. (default: ``abort``) |
|
1292 | 1292 | |
|
1293 | 1293 | ``on-failure`` |
|
1294 | 1294 | When set to ``continue`` (the default), the merge process attempts to |
|
1295 | 1295 | merge all unresolved files using the merge chosen tool, regardless of |
|
1296 | 1296 | whether previous file merge attempts during the process succeeded or not. |
|
1297 | 1297 | Setting this to ``prompt`` will prompt after any merge failure continue |
|
1298 | 1298 | or halt the merge process. Setting this to ``halt`` will automatically |
|
1299 | 1299 | halt the merge process on any merge tool failure. The merge process |
|
1300 | 1300 | can be restarted by using the ``resolve`` command. When a merge is |
|
1301 | 1301 | halted, the repository is left in a normal ``unresolved`` merge state. |
|
1302 | 1302 | (default: ``continue``) |
|
1303 | 1303 | |
|
1304 | 1304 | ``merge-patterns`` |
|
1305 | 1305 | ------------------ |
|
1306 | 1306 | |
|
1307 | 1307 | This section specifies merge tools to associate with particular file |
|
1308 | 1308 | patterns. Tools matched here will take precedence over the default |
|
1309 | 1309 | merge tool. Patterns are globs by default, rooted at the repository |
|
1310 | 1310 | root. |
|
1311 | 1311 | |
|
1312 | 1312 | Example:: |
|
1313 | 1313 | |
|
1314 | 1314 | [merge-patterns] |
|
1315 | 1315 | **.c = kdiff3 |
|
1316 | 1316 | **.jpg = myimgmerge |
|
1317 | 1317 | |
|
1318 | 1318 | ``merge-tools`` |
|
1319 | 1319 | --------------- |
|
1320 | 1320 | |
|
1321 | 1321 | This section configures external merge tools to use for file-level |
|
1322 | 1322 | merges. This section has likely been preconfigured at install time. |
|
1323 | 1323 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1324 | 1324 | Also see :hg:`help merge-tools` for more details. |
|
1325 | 1325 | |
|
1326 | 1326 | Example ``~/.hgrc``:: |
|
1327 | 1327 | |
|
1328 | 1328 | [merge-tools] |
|
1329 | 1329 | # Override stock tool location |
|
1330 | 1330 | kdiff3.executable = ~/bin/kdiff3 |
|
1331 | 1331 | # Specify command line |
|
1332 | 1332 | kdiff3.args = $base $local $other -o $output |
|
1333 | 1333 | # Give higher priority |
|
1334 | 1334 | kdiff3.priority = 1 |
|
1335 | 1335 | |
|
1336 | 1336 | # Changing the priority of preconfigured tool |
|
1337 | 1337 | meld.priority = 0 |
|
1338 | 1338 | |
|
1339 | 1339 | # Disable a preconfigured tool |
|
1340 | 1340 | vimdiff.disabled = yes |
|
1341 | 1341 | |
|
1342 | 1342 | # Define new tool |
|
1343 | 1343 | myHtmlTool.args = -m $local $other $base $output |
|
1344 | 1344 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1345 | 1345 | myHtmlTool.priority = 1 |
|
1346 | 1346 | |
|
1347 | 1347 | Supported arguments: |
|
1348 | 1348 | |
|
1349 | 1349 | ``priority`` |
|
1350 | 1350 | The priority in which to evaluate this tool. |
|
1351 | 1351 | (default: 0) |
|
1352 | 1352 | |
|
1353 | 1353 | ``executable`` |
|
1354 | 1354 | Either just the name of the executable or its pathname. |
|
1355 | 1355 | |
|
1356 | 1356 | .. container:: windows |
|
1357 | 1357 | |
|
1358 | 1358 | On Windows, the path can use environment variables with ${ProgramFiles} |
|
1359 | 1359 | syntax. |
|
1360 | 1360 | |
|
1361 | 1361 | (default: the tool name) |
|
1362 | 1362 | |
|
1363 | 1363 | ``args`` |
|
1364 | 1364 | The arguments to pass to the tool executable. You can refer to the |
|
1365 | 1365 | files being merged as well as the output file through these |
|
1366 | 1366 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning |
|
1367 | 1367 | of ``$local`` and ``$other`` can vary depending on which action is being |
|
1368 | 1368 | performed. During and update or merge, ``$local`` represents the original |
|
1369 | 1369 | state of the file, while ``$other`` represents the commit you are updating |
|
1370 | 1370 | to or the commit you are merging with. During a rebase ``$local`` |
|
1371 | 1371 | represents the destination of the rebase, and ``$other`` represents the |
|
1372 | 1372 | commit being rebased. |
|
1373 | 1373 | (default: ``$local $base $other``) |
|
1374 | 1374 | |
|
1375 | 1375 | ``premerge`` |
|
1376 | 1376 | Attempt to run internal non-interactive 3-way merge tool before |
|
1377 | 1377 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
1378 | 1378 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1379 | 1379 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1380 | 1380 | about the base of the merge in the marker (see internal :merge3 in |
|
1381 | 1381 | :hg:`help merge-tools`). |
|
1382 | 1382 | (default: True) |
|
1383 | 1383 | |
|
1384 | 1384 | ``binary`` |
|
1385 | 1385 | This tool can merge binary files. (default: False, unless tool |
|
1386 | 1386 | was selected by file pattern match) |
|
1387 | 1387 | |
|
1388 | 1388 | ``symlink`` |
|
1389 | 1389 | This tool can merge symlinks. (default: False) |
|
1390 | 1390 | |
|
1391 | 1391 | ``check`` |
|
1392 | 1392 | A list of merge success-checking options: |
|
1393 | 1393 | |
|
1394 | 1394 | ``changed`` |
|
1395 | 1395 | Ask whether merge was successful when the merged file shows no changes. |
|
1396 | 1396 | ``conflicts`` |
|
1397 | 1397 | Check whether there are conflicts even though the tool reported success. |
|
1398 | 1398 | ``prompt`` |
|
1399 | 1399 | Always prompt for merge success, regardless of success reported by tool. |
|
1400 | 1400 | |
|
1401 | 1401 | ``fixeol`` |
|
1402 | 1402 | Attempt to fix up EOL changes caused by the merge tool. |
|
1403 | 1403 | (default: False) |
|
1404 | 1404 | |
|
1405 | 1405 | ``gui`` |
|
1406 | 1406 | This tool requires a graphical interface to run. (default: False) |
|
1407 | 1407 | |
|
1408 | 1408 | .. container:: windows |
|
1409 | 1409 | |
|
1410 | 1410 | ``regkey`` |
|
1411 | 1411 | Windows registry key which describes install location of this |
|
1412 | 1412 | tool. Mercurial will search for this key first under |
|
1413 | 1413 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1414 | 1414 | (default: None) |
|
1415 | 1415 | |
|
1416 | 1416 | ``regkeyalt`` |
|
1417 | 1417 | An alternate Windows registry key to try if the first key is not |
|
1418 | 1418 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1419 | 1419 | semantics of the primary key. The most common use for this key |
|
1420 | 1420 | is to search for 32bit applications on 64bit operating systems. |
|
1421 | 1421 | (default: None) |
|
1422 | 1422 | |
|
1423 | 1423 | ``regname`` |
|
1424 | 1424 | Name of value to read from specified registry key. |
|
1425 | 1425 | (default: the unnamed (default) value) |
|
1426 | 1426 | |
|
1427 | 1427 | ``regappend`` |
|
1428 | 1428 | String to append to the value read from the registry, typically |
|
1429 | 1429 | the executable name of the tool. |
|
1430 | 1430 | (default: None) |
|
1431 | 1431 | |
|
1432 | 1432 | ``pager`` |
|
1433 | 1433 | --------- |
|
1434 | 1434 | |
|
1435 | 1435 | Setting used to control when to paginate and with what external tool. See |
|
1436 | 1436 | :hg:`help pager` for details. |
|
1437 | 1437 | |
|
1438 | 1438 | ``pager`` |
|
1439 | 1439 | Define the external tool used as pager. |
|
1440 | 1440 | |
|
1441 | 1441 | If no pager is set, Mercurial uses the environment variable $PAGER. |
|
1442 | 1442 | If neither pager.pager, nor $PAGER is set, a default pager will be |
|
1443 | 1443 | used, typically `less` on Unix and `more` on Windows. Example:: |
|
1444 | 1444 | |
|
1445 | 1445 | [pager] |
|
1446 | 1446 | pager = less -FRX |
|
1447 | 1447 | |
|
1448 | 1448 | ``ignore`` |
|
1449 | 1449 | List of commands to disable the pager for. Example:: |
|
1450 | 1450 | |
|
1451 | 1451 | [pager] |
|
1452 | 1452 | ignore = version, help, update |
|
1453 | 1453 | |
|
1454 | 1454 | ``patch`` |
|
1455 | 1455 | --------- |
|
1456 | 1456 | |
|
1457 | 1457 | Settings used when applying patches, for instance through the 'import' |
|
1458 | 1458 | command or with Mercurial Queues extension. |
|
1459 | 1459 | |
|
1460 | 1460 | ``eol`` |
|
1461 | 1461 | When set to 'strict' patch content and patched files end of lines |
|
1462 | 1462 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1463 | 1463 | lines are ignored when patching and the result line endings are |
|
1464 | 1464 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1465 | 1465 | ``auto``, end of lines are again ignored while patching but line |
|
1466 | 1466 | endings in patched files are normalized to their original setting |
|
1467 | 1467 | on a per-file basis. If target file does not exist or has no end |
|
1468 | 1468 | of line, patch line endings are preserved. |
|
1469 | 1469 | (default: strict) |
|
1470 | 1470 | |
|
1471 | 1471 | ``fuzz`` |
|
1472 | 1472 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1473 | 1473 | controls how much context the patcher is allowed to ignore when |
|
1474 | 1474 | trying to apply a patch. |
|
1475 | 1475 | (default: 2) |
|
1476 | 1476 | |
|
1477 | 1477 | ``paths`` |
|
1478 | 1478 | --------- |
|
1479 | 1479 | |
|
1480 | 1480 | Assigns symbolic names and behavior to repositories. |
|
1481 | 1481 | |
|
1482 | 1482 | Options are symbolic names defining the URL or directory that is the |
|
1483 | 1483 | location of the repository. Example:: |
|
1484 | 1484 | |
|
1485 | 1485 | [paths] |
|
1486 | 1486 | my_server = https://example.com/my_repo |
|
1487 | 1487 | local_path = /home/me/repo |
|
1488 | 1488 | |
|
1489 | 1489 | These symbolic names can be used from the command line. To pull |
|
1490 | 1490 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1491 | 1491 | :hg:`push local_path`. |
|
1492 | 1492 | |
|
1493 | 1493 | Options containing colons (``:``) denote sub-options that can influence |
|
1494 | 1494 | behavior for that specific path. Example:: |
|
1495 | 1495 | |
|
1496 | 1496 | [paths] |
|
1497 | 1497 | my_server = https://example.com/my_path |
|
1498 | 1498 | my_server:pushurl = ssh://example.com/my_path |
|
1499 | 1499 | |
|
1500 | 1500 | The following sub-options can be defined: |
|
1501 | 1501 | |
|
1502 | 1502 | ``pushurl`` |
|
1503 | 1503 | The URL to use for push operations. If not defined, the location |
|
1504 | 1504 | defined by the path's main entry is used. |
|
1505 | 1505 | |
|
1506 | 1506 | ``pushrev`` |
|
1507 | 1507 | A revset defining which revisions to push by default. |
|
1508 | 1508 | |
|
1509 | 1509 | When :hg:`push` is executed without a ``-r`` argument, the revset |
|
1510 | 1510 | defined by this sub-option is evaluated to determine what to push. |
|
1511 | 1511 | |
|
1512 | 1512 | For example, a value of ``.`` will push the working directory's |
|
1513 | 1513 | revision by default. |
|
1514 | 1514 | |
|
1515 | 1515 | Revsets specifying bookmarks will not result in the bookmark being |
|
1516 | 1516 | pushed. |
|
1517 | 1517 | |
|
1518 | 1518 | The following special named paths exist: |
|
1519 | 1519 | |
|
1520 | 1520 | ``default`` |
|
1521 | 1521 | The URL or directory to use when no source or remote is specified. |
|
1522 | 1522 | |
|
1523 | 1523 | :hg:`clone` will automatically define this path to the location the |
|
1524 | 1524 | repository was cloned from. |
|
1525 | 1525 | |
|
1526 | 1526 | ``default-push`` |
|
1527 | 1527 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1528 | 1528 | ``default:pushurl`` should be used instead. |
|
1529 | 1529 | |
|
1530 | 1530 | ``phases`` |
|
1531 | 1531 | ---------- |
|
1532 | 1532 | |
|
1533 | 1533 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1534 | 1534 | information about working with phases. |
|
1535 | 1535 | |
|
1536 | 1536 | ``publish`` |
|
1537 | 1537 | Controls draft phase behavior when working as a server. When true, |
|
1538 | 1538 | pushed changesets are set to public in both client and server and |
|
1539 | 1539 | pulled or cloned changesets are set to public in the client. |
|
1540 | 1540 | (default: True) |
|
1541 | 1541 | |
|
1542 | 1542 | ``new-commit`` |
|
1543 | 1543 | Phase of newly-created commits. |
|
1544 | 1544 | (default: draft) |
|
1545 | 1545 | |
|
1546 | 1546 | ``checksubrepos`` |
|
1547 | 1547 | Check the phase of the current revision of each subrepository. Allowed |
|
1548 | 1548 | values are "ignore", "follow" and "abort". For settings other than |
|
1549 | 1549 | "ignore", the phase of the current revision of each subrepository is |
|
1550 | 1550 | checked before committing the parent repository. If any of those phases is |
|
1551 | 1551 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1552 | 1552 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1553 | 1553 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1554 | 1554 | used for the parent repository commit (if set to "follow"). |
|
1555 | 1555 | (default: follow) |
|
1556 | 1556 | |
|
1557 | 1557 | |
|
1558 | 1558 | ``profiling`` |
|
1559 | 1559 | ------------- |
|
1560 | 1560 | |
|
1561 | 1561 | Specifies profiling type, format, and file output. Two profilers are |
|
1562 | 1562 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1563 | 1563 | profiler (named ``stat``). |
|
1564 | 1564 | |
|
1565 | 1565 | In this section description, 'profiling data' stands for the raw data |
|
1566 | 1566 | collected during profiling, while 'profiling report' stands for a |
|
1567 | 1567 | statistical text report generated from the profiling data. The |
|
1568 | 1568 | profiling is done using lsprof. |
|
1569 | 1569 | |
|
1570 | 1570 | ``enabled`` |
|
1571 | 1571 | Enable the profiler. |
|
1572 | 1572 | (default: false) |
|
1573 | 1573 | |
|
1574 | 1574 | This is equivalent to passing ``--profile`` on the command line. |
|
1575 | 1575 | |
|
1576 | 1576 | ``type`` |
|
1577 | 1577 | The type of profiler to use. |
|
1578 | 1578 | (default: stat) |
|
1579 | 1579 | |
|
1580 | 1580 | ``ls`` |
|
1581 | 1581 | Use Python's built-in instrumenting profiler. This profiler |
|
1582 | 1582 | works on all platforms, but each line number it reports is the |
|
1583 | 1583 | first line of a function. This restriction makes it difficult to |
|
1584 | 1584 | identify the expensive parts of a non-trivial function. |
|
1585 | 1585 | ``stat`` |
|
1586 | 1586 | Use a statistical profiler, statprof. This profiler is most |
|
1587 | 1587 | useful for profiling commands that run for longer than about 0.1 |
|
1588 | 1588 | seconds. |
|
1589 | 1589 | |
|
1590 | 1590 | ``format`` |
|
1591 | 1591 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1592 | 1592 | (default: text) |
|
1593 | 1593 | |
|
1594 | 1594 | ``text`` |
|
1595 | 1595 | Generate a profiling report. When saving to a file, it should be |
|
1596 | 1596 | noted that only the report is saved, and the profiling data is |
|
1597 | 1597 | not kept. |
|
1598 | 1598 | ``kcachegrind`` |
|
1599 | 1599 | Format profiling data for kcachegrind use: when saving to a |
|
1600 | 1600 | file, the generated file can directly be loaded into |
|
1601 | 1601 | kcachegrind. |
|
1602 | 1602 | |
|
1603 | 1603 | ``statformat`` |
|
1604 | 1604 | Profiling format for the ``stat`` profiler. |
|
1605 | 1605 | (default: hotpath) |
|
1606 | 1606 | |
|
1607 | 1607 | ``hotpath`` |
|
1608 | 1608 | Show a tree-based display containing the hot path of execution (where |
|
1609 | 1609 | most time was spent). |
|
1610 | 1610 | ``bymethod`` |
|
1611 | 1611 | Show a table of methods ordered by how frequently they are active. |
|
1612 | 1612 | ``byline`` |
|
1613 | 1613 | Show a table of lines in files ordered by how frequently they are active. |
|
1614 | 1614 | ``json`` |
|
1615 | 1615 | Render profiling data as JSON. |
|
1616 | 1616 | |
|
1617 | 1617 | ``frequency`` |
|
1618 | 1618 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1619 | 1619 | (default: 1000) |
|
1620 | 1620 | |
|
1621 | 1621 | ``output`` |
|
1622 | 1622 | File path where profiling data or report should be saved. If the |
|
1623 | 1623 | file exists, it is replaced. (default: None, data is printed on |
|
1624 | 1624 | stderr) |
|
1625 | 1625 | |
|
1626 | 1626 | ``sort`` |
|
1627 | 1627 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1628 | 1628 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1629 | 1629 | ``inlinetime``. |
|
1630 | 1630 | (default: inlinetime) |
|
1631 | 1631 | |
|
1632 | 1632 | ``limit`` |
|
1633 | 1633 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1634 | 1634 | (default: 30) |
|
1635 | 1635 | |
|
1636 | 1636 | ``nested`` |
|
1637 | 1637 | Show at most this number of lines of drill-down info after each main entry. |
|
1638 | 1638 | This can help explain the difference between Total and Inline. |
|
1639 | 1639 | Specific to the ``ls`` instrumenting profiler. |
|
1640 | 1640 | (default: 5) |
|
1641 | 1641 | |
|
1642 | 1642 | ``showmin`` |
|
1643 | 1643 | Minimum fraction of samples an entry must have for it to be displayed. |
|
1644 | 1644 | Can be specified as a float between ``0.0`` and ``1.0`` or can have a |
|
1645 | 1645 | ``%`` afterwards to allow values up to ``100``. e.g. ``5%``. |
|
1646 | 1646 | |
|
1647 | 1647 | Only used by the ``stat`` profiler. |
|
1648 | 1648 | |
|
1649 | 1649 | For the ``hotpath`` format, default is ``0.05``. |
|
1650 | 1650 | For the ``chrome`` format, default is ``0.005``. |
|
1651 | 1651 | |
|
1652 | 1652 | The option is unused on other formats. |
|
1653 | 1653 | |
|
1654 | 1654 | ``showmax`` |
|
1655 | 1655 | Maximum fraction of samples an entry can have before it is ignored in |
|
1656 | 1656 | display. Values format is the same as ``showmin``. |
|
1657 | 1657 | |
|
1658 | 1658 | Only used by the ``stat`` profiler. |
|
1659 | 1659 | |
|
1660 | 1660 | For the ``chrome`` format, default is ``0.999``. |
|
1661 | 1661 | |
|
1662 | 1662 | The option is unused on other formats. |
|
1663 | 1663 | |
|
1664 | 1664 | ``progress`` |
|
1665 | 1665 | ------------ |
|
1666 | 1666 | |
|
1667 | 1667 | Mercurial commands can draw progress bars that are as informative as |
|
1668 | 1668 | possible. Some progress bars only offer indeterminate information, while others |
|
1669 | 1669 | have a definite end point. |
|
1670 | 1670 | |
|
1671 | 1671 | ``delay`` |
|
1672 | 1672 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1673 | 1673 | |
|
1674 | 1674 | ``changedelay`` |
|
1675 | 1675 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1676 | 1676 | that value will be used instead. (default: 1) |
|
1677 | 1677 | |
|
1678 | 1678 | ``estimateinterval`` |
|
1679 | 1679 | Maximum sampling interval in seconds for speed and estimated time |
|
1680 | 1680 | calculation. (default: 60) |
|
1681 | 1681 | |
|
1682 | 1682 | ``refresh`` |
|
1683 | 1683 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1684 | 1684 | |
|
1685 | 1685 | ``format`` |
|
1686 | 1686 | Format of the progress bar. |
|
1687 | 1687 | |
|
1688 | 1688 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1689 | 1689 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the |
|
1690 | 1690 | last 20 characters of the item, but this can be changed by adding either |
|
1691 | 1691 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the |
|
1692 | 1692 | first num characters. |
|
1693 | 1693 | |
|
1694 | 1694 | (default: topic bar number estimate) |
|
1695 | 1695 | |
|
1696 | 1696 | ``width`` |
|
1697 | 1697 | If set, the maximum width of the progress information (that is, min(width, |
|
1698 | 1698 | term width) will be used). |
|
1699 | 1699 | |
|
1700 | 1700 | ``clear-complete`` |
|
1701 | 1701 | Clear the progress bar after it's done. (default: True) |
|
1702 | 1702 | |
|
1703 | 1703 | ``disable`` |
|
1704 | 1704 | If true, don't show a progress bar. |
|
1705 | 1705 | |
|
1706 | 1706 | ``assume-tty`` |
|
1707 | 1707 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1708 | 1708 | |
|
1709 | 1709 | ``rebase`` |
|
1710 | 1710 | ---------- |
|
1711 | 1711 | |
|
1712 | 1712 | ``evolution.allowdivergence`` |
|
1713 | 1713 | Default to False, when True allow creating divergence when performing |
|
1714 | 1714 | rebase of obsolete changesets. |
|
1715 | 1715 | |
|
1716 | 1716 | ``revsetalias`` |
|
1717 | 1717 | --------------- |
|
1718 | 1718 | |
|
1719 | 1719 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1720 | 1720 | |
|
1721 | 1721 | ``server`` |
|
1722 | 1722 | ---------- |
|
1723 | 1723 | |
|
1724 | 1724 | Controls generic server settings. |
|
1725 | 1725 | |
|
1726 | 1726 | ``compressionengines`` |
|
1727 | 1727 | List of compression engines and their relative priority to advertise |
|
1728 | 1728 | to clients. |
|
1729 | 1729 | |
|
1730 | 1730 | The order of compression engines determines their priority, the first |
|
1731 | 1731 | having the highest priority. If a compression engine is not listed |
|
1732 | 1732 | here, it won't be advertised to clients. |
|
1733 | 1733 | |
|
1734 | 1734 | If not set (the default), built-in defaults are used. Run |
|
1735 | 1735 | :hg:`debuginstall` to list available compression engines and their |
|
1736 | 1736 | default wire protocol priority. |
|
1737 | 1737 | |
|
1738 | 1738 | Older Mercurial clients only support zlib compression and this setting |
|
1739 | 1739 | has no effect for legacy clients. |
|
1740 | 1740 | |
|
1741 | 1741 | ``uncompressed`` |
|
1742 | 1742 | Whether to allow clients to clone a repository using the |
|
1743 | 1743 | uncompressed streaming protocol. This transfers about 40% more |
|
1744 | 1744 | data than a regular clone, but uses less memory and CPU on both |
|
1745 | 1745 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1746 | 1746 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1747 | 1747 | regular clone. Over most WAN connections (anything slower than |
|
1748 | 1748 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1749 | 1749 | extra data transfer overhead. This mode will also temporarily hold |
|
1750 | 1750 | the write lock while determining what data to transfer. |
|
1751 | 1751 | (default: True) |
|
1752 | 1752 | |
|
1753 | 1753 | ``uncompressedallowsecret`` |
|
1754 | 1754 | Whether to allow stream clones when the repository contains secret |
|
1755 | 1755 | changesets. (default: False) |
|
1756 | 1756 | |
|
1757 | 1757 | ``preferuncompressed`` |
|
1758 | 1758 | When set, clients will try to use the uncompressed streaming |
|
1759 | 1759 | protocol. (default: False) |
|
1760 | 1760 | |
|
1761 | 1761 | ``disablefullbundle`` |
|
1762 | 1762 | When set, servers will refuse attempts to do pull-based clones. |
|
1763 | 1763 | If this option is set, ``preferuncompressed`` and/or clone bundles |
|
1764 | 1764 | are highly recommended. Partial clones will still be allowed. |
|
1765 | 1765 | (default: False) |
|
1766 | 1766 | |
|
1767 | 1767 | ``concurrent-push-mode`` |
|
1768 | 1768 | Level of allowed race condition between two pushing clients. |
|
1769 | 1769 | |
|
1770 | 1770 | - 'strict': push is abort if another client touched the repository |
|
1771 | 1771 | while the push was preparing. (default) |
|
1772 | 1772 | - 'check-related': push is only aborted if it affects head that got also |
|
1773 | 1773 | affected while the push was preparing. |
|
1774 | 1774 | |
|
1775 | 1775 | This requires compatible client (version 4.3 and later). Old client will |
|
1776 | 1776 | use 'strict'. |
|
1777 | 1777 | |
|
1778 | 1778 | ``validate`` |
|
1779 | 1779 | Whether to validate the completeness of pushed changesets by |
|
1780 | 1780 | checking that all new file revisions specified in manifests are |
|
1781 | 1781 | present. (default: False) |
|
1782 | 1782 | |
|
1783 | 1783 | ``maxhttpheaderlen`` |
|
1784 | 1784 | Instruct HTTP clients not to send request headers longer than this |
|
1785 | 1785 | many bytes. (default: 1024) |
|
1786 | 1786 | |
|
1787 | 1787 | ``bundle1`` |
|
1788 | 1788 | Whether to allow clients to push and pull using the legacy bundle1 |
|
1789 | 1789 | exchange format. (default: True) |
|
1790 | 1790 | |
|
1791 | 1791 | ``bundle1gd`` |
|
1792 | 1792 | Like ``bundle1`` but only used if the repository is using the |
|
1793 | 1793 | *generaldelta* storage format. (default: True) |
|
1794 | 1794 | |
|
1795 | 1795 | ``bundle1.push`` |
|
1796 | 1796 | Whether to allow clients to push using the legacy bundle1 exchange |
|
1797 | 1797 | format. (default: True) |
|
1798 | 1798 | |
|
1799 | 1799 | ``bundle1gd.push`` |
|
1800 | 1800 | Like ``bundle1.push`` but only used if the repository is using the |
|
1801 | 1801 | *generaldelta* storage format. (default: True) |
|
1802 | 1802 | |
|
1803 | 1803 | ``bundle1.pull`` |
|
1804 | 1804 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
1805 | 1805 | format. (default: True) |
|
1806 | 1806 | |
|
1807 | 1807 | ``bundle1gd.pull`` |
|
1808 | 1808 | Like ``bundle1.pull`` but only used if the repository is using the |
|
1809 | 1809 | *generaldelta* storage format. (default: True) |
|
1810 | 1810 | |
|
1811 | 1811 | Large repositories using the *generaldelta* storage format should |
|
1812 | 1812 | consider setting this option because converting *generaldelta* |
|
1813 | 1813 | repositories to the exchange format required by the bundle1 data |
|
1814 | 1814 | format can consume a lot of CPU. |
|
1815 | 1815 | |
|
1816 | 1816 | ``zliblevel`` |
|
1817 | 1817 | Integer between ``-1`` and ``9`` that controls the zlib compression level |
|
1818 | 1818 | for wire protocol commands that send zlib compressed output (notably the |
|
1819 | 1819 | commands that send repository history data). |
|
1820 | 1820 | |
|
1821 | 1821 | The default (``-1``) uses the default zlib compression level, which is |
|
1822 | 1822 | likely equivalent to ``6``. ``0`` means no compression. ``9`` means |
|
1823 | 1823 | maximum compression. |
|
1824 | 1824 | |
|
1825 | 1825 | Setting this option allows server operators to make trade-offs between |
|
1826 | 1826 | bandwidth and CPU used. Lowering the compression lowers CPU utilization |
|
1827 | 1827 | but sends more bytes to clients. |
|
1828 | 1828 | |
|
1829 | 1829 | This option only impacts the HTTP server. |
|
1830 | 1830 | |
|
1831 | 1831 | ``zstdlevel`` |
|
1832 | 1832 | Integer between ``1`` and ``22`` that controls the zstd compression level |
|
1833 | 1833 | for wire protocol commands. ``1`` is the minimal amount of compression and |
|
1834 | 1834 | ``22`` is the highest amount of compression. |
|
1835 | 1835 | |
|
1836 | 1836 | The default (``3``) should be significantly faster than zlib while likely |
|
1837 | 1837 | delivering better compression ratios. |
|
1838 | 1838 | |
|
1839 | 1839 | This option only impacts the HTTP server. |
|
1840 | 1840 | |
|
1841 | 1841 | See also ``server.zliblevel``. |
|
1842 | 1842 | |
|
1843 | 1843 | ``smtp`` |
|
1844 | 1844 | -------- |
|
1845 | 1845 | |
|
1846 | 1846 | Configuration for extensions that need to send email messages. |
|
1847 | 1847 | |
|
1848 | 1848 | ``host`` |
|
1849 | 1849 | Host name of mail server, e.g. "mail.example.com". |
|
1850 | 1850 | |
|
1851 | 1851 | ``port`` |
|
1852 | 1852 | Optional. Port to connect to on mail server. (default: 465 if |
|
1853 | 1853 | ``tls`` is smtps; 25 otherwise) |
|
1854 | 1854 | |
|
1855 | 1855 | ``tls`` |
|
1856 | 1856 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1857 | 1857 | smtps or none. (default: none) |
|
1858 | 1858 | |
|
1859 | 1859 | ``username`` |
|
1860 | 1860 | Optional. User name for authenticating with the SMTP server. |
|
1861 | 1861 | (default: None) |
|
1862 | 1862 | |
|
1863 | 1863 | ``password`` |
|
1864 | 1864 | Optional. Password for authenticating with the SMTP server. If not |
|
1865 | 1865 | specified, interactive sessions will prompt the user for a |
|
1866 | 1866 | password; non-interactive sessions will fail. (default: None) |
|
1867 | 1867 | |
|
1868 | 1868 | ``local_hostname`` |
|
1869 | 1869 | Optional. The hostname that the sender can use to identify |
|
1870 | 1870 | itself to the MTA. |
|
1871 | 1871 | |
|
1872 | 1872 | |
|
1873 | 1873 | ``subpaths`` |
|
1874 | 1874 | ------------ |
|
1875 | 1875 | |
|
1876 | 1876 | Subrepository source URLs can go stale if a remote server changes name |
|
1877 | 1877 | or becomes temporarily unavailable. This section lets you define |
|
1878 | 1878 | rewrite rules of the form:: |
|
1879 | 1879 | |
|
1880 | 1880 | <pattern> = <replacement> |
|
1881 | 1881 | |
|
1882 | 1882 | where ``pattern`` is a regular expression matching a subrepository |
|
1883 | 1883 | source URL and ``replacement`` is the replacement string used to |
|
1884 | 1884 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1885 | 1885 | ``replacements``. For instance:: |
|
1886 | 1886 | |
|
1887 | 1887 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1888 | 1888 | |
|
1889 | 1889 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1890 | 1890 | |
|
1891 | 1891 | Relative subrepository paths are first made absolute, and the |
|
1892 | 1892 | rewrite rules are then applied on the full (absolute) path. If ``pattern`` |
|
1893 | 1893 | doesn't match the full path, an attempt is made to apply it on the |
|
1894 | 1894 | relative path alone. The rules are applied in definition order. |
|
1895 | 1895 | |
|
1896 | 1896 | ``subrepos`` |
|
1897 | 1897 | ------------ |
|
1898 | 1898 | |
|
1899 | 1899 | This section contains options that control the behavior of the |
|
1900 | 1900 | subrepositories feature. See also :hg:`help subrepos`. |
|
1901 | 1901 | |
|
1902 | Security note: auditing in Mercurial is known to be insufficient to | |
|
1903 | prevent clone-time code execution with carefully constructed Git | |
|
1904 | subrepos. It is unknown if a similar detect is present in Subversion | |
|
1905 | subrepos. Both Git and Subversion subrepos are disabled by default | |
|
1906 | out of security concerns. These subrepo types can be enabled using | |
|
1907 | the respective options below. | |
|
1908 | ||
|
1902 | 1909 | ``allowed`` |
|
1903 |
|
|
|
1904 | directory. | |
|
1905 | ||
|
1906 | When disallowed, any commands including :hg:`update` will fail if | |
|
1907 | subrepositories are involved. | |
|
1908 | ||
|
1909 | Security note: auditing in Mercurial is known to be insufficient | |
|
1910 | to prevent clone-time code execution with carefully constructed | |
|
1911 | Git subrepos. It is unknown if a similar defect is present in | |
|
1912 | Subversion subrepos, so both are disabled by default out of an | |
|
1913 | abundance of caution. Re-enable such subrepos via this setting | |
|
1914 | with caution. | |
|
1915 | (default: `hg`) | |
|
1910 | Whether subrepositories are allowed in the working directory. | |
|
1911 | ||
|
1912 | When false, commands involving subrepositories (like :hg:`update`) | |
|
1913 | will fail for all subrepository types. | |
|
1914 | (default: true) | |
|
1915 | ||
|
1916 | ``hg:allowed`` | |
|
1917 | Whether Mercurial subrepositories are allowed in the working | |
|
1918 | directory. This option only has an effect if ``subrepos.allowed`` | |
|
1919 | is true. | |
|
1920 | (default: true) | |
|
1921 | ||
|
1922 | ``git:allowed`` | |
|
1923 | Whether Git subrepositories are allowed in the working directory. | |
|
1924 | This option only has an effect if ``subrepos.allowed`` is true. | |
|
1925 | ||
|
1926 | See the security note above before enabling Git subrepos. | |
|
1927 | (default: false) | |
|
1928 | ||
|
1929 | ``svn:allowed`` | |
|
1930 | Whether Subversion subrepositories are allowed in the working | |
|
1931 | directory. This option only has an effect if ``subrepos.allowed`` | |
|
1932 | is true. | |
|
1933 | ||
|
1934 | See the security note above before enabling Subversion subrepos. | |
|
1935 | (default: false) | |
|
1916 | 1936 | |
|
1917 | 1937 | ``templatealias`` |
|
1918 | 1938 | ----------------- |
|
1919 | 1939 | |
|
1920 | 1940 | Alias definitions for templates. See :hg:`help templates` for details. |
|
1921 | 1941 | |
|
1922 | 1942 | ``templates`` |
|
1923 | 1943 | ------------- |
|
1924 | 1944 | |
|
1925 | 1945 | Use the ``[templates]`` section to define template strings. |
|
1926 | 1946 | See :hg:`help templates` for details. |
|
1927 | 1947 | |
|
1928 | 1948 | ``trusted`` |
|
1929 | 1949 | ----------- |
|
1930 | 1950 | |
|
1931 | 1951 | Mercurial will not use the settings in the |
|
1932 | 1952 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1933 | 1953 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1934 | 1954 | commands to be run. This issue is often encountered when configuring |
|
1935 | 1955 | hooks or extensions for shared repositories or servers. However, |
|
1936 | 1956 | the web interface will use some safe settings from the ``[web]`` |
|
1937 | 1957 | section. |
|
1938 | 1958 | |
|
1939 | 1959 | This section specifies what users and groups are trusted. The |
|
1940 | 1960 | current user is always trusted. To trust everybody, list a user or a |
|
1941 | 1961 | group with name ``*``. These settings must be placed in an |
|
1942 | 1962 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1943 | 1963 | user or service running Mercurial. |
|
1944 | 1964 | |
|
1945 | 1965 | ``users`` |
|
1946 | 1966 | Comma-separated list of trusted users. |
|
1947 | 1967 | |
|
1948 | 1968 | ``groups`` |
|
1949 | 1969 | Comma-separated list of trusted groups. |
|
1950 | 1970 | |
|
1951 | 1971 | |
|
1952 | 1972 | ``ui`` |
|
1953 | 1973 | ------ |
|
1954 | 1974 | |
|
1955 | 1975 | User interface controls. |
|
1956 | 1976 | |
|
1957 | 1977 | ``archivemeta`` |
|
1958 | 1978 | Whether to include the .hg_archival.txt file containing meta data |
|
1959 | 1979 | (hashes for the repository base and for tip) in archives created |
|
1960 | 1980 | by the :hg:`archive` command or downloaded via hgweb. |
|
1961 | 1981 | (default: True) |
|
1962 | 1982 | |
|
1963 | 1983 | ``askusername`` |
|
1964 | 1984 | Whether to prompt for a username when committing. If True, and |
|
1965 | 1985 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1966 | 1986 | be prompted to enter a username. If no username is entered, the |
|
1967 | 1987 | default ``USER@HOST`` is used instead. |
|
1968 | 1988 | (default: False) |
|
1969 | 1989 | |
|
1970 | 1990 | ``clonebundles`` |
|
1971 | 1991 | Whether the "clone bundles" feature is enabled. |
|
1972 | 1992 | |
|
1973 | 1993 | When enabled, :hg:`clone` may download and apply a server-advertised |
|
1974 | 1994 | bundle file from a URL instead of using the normal exchange mechanism. |
|
1975 | 1995 | |
|
1976 | 1996 | This can likely result in faster and more reliable clones. |
|
1977 | 1997 | |
|
1978 | 1998 | (default: True) |
|
1979 | 1999 | |
|
1980 | 2000 | ``clonebundlefallback`` |
|
1981 | 2001 | Whether failure to apply an advertised "clone bundle" from a server |
|
1982 | 2002 | should result in fallback to a regular clone. |
|
1983 | 2003 | |
|
1984 | 2004 | This is disabled by default because servers advertising "clone |
|
1985 | 2005 | bundles" often do so to reduce server load. If advertised bundles |
|
1986 | 2006 | start mass failing and clients automatically fall back to a regular |
|
1987 | 2007 | clone, this would add significant and unexpected load to the server |
|
1988 | 2008 | since the server is expecting clone operations to be offloaded to |
|
1989 | 2009 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
1990 | 2010 | clients don't overwhelm the server when "clone bundle" application |
|
1991 | 2011 | fails. |
|
1992 | 2012 | |
|
1993 | 2013 | (default: False) |
|
1994 | 2014 | |
|
1995 | 2015 | ``clonebundleprefers`` |
|
1996 | 2016 | Defines preferences for which "clone bundles" to use. |
|
1997 | 2017 | |
|
1998 | 2018 | Servers advertising "clone bundles" may advertise multiple available |
|
1999 | 2019 | bundles. Each bundle may have different attributes, such as the bundle |
|
2000 | 2020 | type and compression format. This option is used to prefer a particular |
|
2001 | 2021 | bundle over another. |
|
2002 | 2022 | |
|
2003 | 2023 | The following keys are defined by Mercurial: |
|
2004 | 2024 | |
|
2005 | 2025 | BUNDLESPEC |
|
2006 | 2026 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. |
|
2007 | 2027 | e.g. ``gzip-v2`` or ``bzip2-v1``. |
|
2008 | 2028 | |
|
2009 | 2029 | COMPRESSION |
|
2010 | 2030 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. |
|
2011 | 2031 | |
|
2012 | 2032 | Server operators may define custom keys. |
|
2013 | 2033 | |
|
2014 | 2034 | Example values: ``COMPRESSION=bzip2``, |
|
2015 | 2035 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. |
|
2016 | 2036 | |
|
2017 | 2037 | By default, the first bundle advertised by the server is used. |
|
2018 | 2038 | |
|
2019 | 2039 | ``color`` |
|
2020 | 2040 | When to colorize output. Possible value are Boolean ("yes" or "no"), or |
|
2021 | 2041 | "debug", or "always". (default: "yes"). "yes" will use color whenever it |
|
2022 | 2042 | seems possible. See :hg:`help color` for details. |
|
2023 | 2043 | |
|
2024 | 2044 | ``commitsubrepos`` |
|
2025 | 2045 | Whether to commit modified subrepositories when committing the |
|
2026 | 2046 | parent repository. If False and one subrepository has uncommitted |
|
2027 | 2047 | changes, abort the commit. |
|
2028 | 2048 | (default: False) |
|
2029 | 2049 | |
|
2030 | 2050 | ``debug`` |
|
2031 | 2051 | Print debugging information. (default: False) |
|
2032 | 2052 | |
|
2033 | 2053 | ``editor`` |
|
2034 | 2054 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
2035 | 2055 | |
|
2036 | 2056 | ``fallbackencoding`` |
|
2037 | 2057 | Encoding to try if it's not possible to decode the changelog using |
|
2038 | 2058 | UTF-8. (default: ISO-8859-1) |
|
2039 | 2059 | |
|
2040 | 2060 | ``graphnodetemplate`` |
|
2041 | 2061 | The template used to print changeset nodes in an ASCII revision graph. |
|
2042 | 2062 | (default: ``{graphnode}``) |
|
2043 | 2063 | |
|
2044 | 2064 | ``ignore`` |
|
2045 | 2065 | A file to read per-user ignore patterns from. This file should be |
|
2046 | 2066 | in the same format as a repository-wide .hgignore file. Filenames |
|
2047 | 2067 | are relative to the repository root. This option supports hook syntax, |
|
2048 | 2068 | so if you want to specify multiple ignore files, you can do so by |
|
2049 | 2069 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
2050 | 2070 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
2051 | 2071 | |
|
2052 | 2072 | ``interactive`` |
|
2053 | 2073 | Allow to prompt the user. (default: True) |
|
2054 | 2074 | |
|
2055 | 2075 | ``interface`` |
|
2056 | 2076 | Select the default interface for interactive features (default: text). |
|
2057 | 2077 | Possible values are 'text' and 'curses'. |
|
2058 | 2078 | |
|
2059 | 2079 | ``interface.chunkselector`` |
|
2060 | 2080 | Select the interface for change recording (e.g. :hg:`commit -i`). |
|
2061 | 2081 | Possible values are 'text' and 'curses'. |
|
2062 | 2082 | This config overrides the interface specified by ui.interface. |
|
2063 | 2083 | |
|
2064 | 2084 | ``logtemplate`` |
|
2065 | 2085 | Template string for commands that print changesets. |
|
2066 | 2086 | |
|
2067 | 2087 | ``merge`` |
|
2068 | 2088 | The conflict resolution program to use during a manual merge. |
|
2069 | 2089 | For more information on merge tools see :hg:`help merge-tools`. |
|
2070 | 2090 | For configuring merge tools see the ``[merge-tools]`` section. |
|
2071 | 2091 | |
|
2072 | 2092 | ``mergemarkers`` |
|
2073 | 2093 | Sets the merge conflict marker label styling. The ``detailed`` |
|
2074 | 2094 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
2075 | 2095 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
2076 | 2096 | One of ``basic`` or ``detailed``. |
|
2077 | 2097 | (default: ``basic``) |
|
2078 | 2098 | |
|
2079 | 2099 | ``mergemarkertemplate`` |
|
2080 | 2100 | The template used to print the commit description next to each conflict |
|
2081 | 2101 | marker during merge conflicts. See :hg:`help templates` for the template |
|
2082 | 2102 | format. |
|
2083 | 2103 | |
|
2084 | 2104 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
2085 | 2105 | the first line of the commit description. |
|
2086 | 2106 | |
|
2087 | 2107 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
2088 | 2108 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
2089 | 2109 | managed files. At template expansion, non-ASCII characters use the encoding |
|
2090 | 2110 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
2091 | 2111 | environment variables that govern your locale. If the encoding of the merge |
|
2092 | 2112 | markers is different from the encoding of the merged files, |
|
2093 | 2113 | serious problems may occur. |
|
2094 | 2114 | |
|
2095 | 2115 | ``origbackuppath`` |
|
2096 | 2116 | The path to a directory used to store generated .orig files. If the path is |
|
2097 | 2117 | not a directory, one will be created. If set, files stored in this |
|
2098 | 2118 | directory have the same name as the original file and do not have a .orig |
|
2099 | 2119 | suffix. |
|
2100 | 2120 | |
|
2101 | 2121 | ``paginate`` |
|
2102 | 2122 | Control the pagination of command output (default: True). See :hg:`help pager` |
|
2103 | 2123 | for details. |
|
2104 | 2124 | |
|
2105 | 2125 | ``patch`` |
|
2106 | 2126 | An optional external tool that ``hg import`` and some extensions |
|
2107 | 2127 | will use for applying patches. By default Mercurial uses an |
|
2108 | 2128 | internal patch utility. The external tool must work as the common |
|
2109 | 2129 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
2110 | 2130 | argument to strip patch headers, a ``-d`` argument to specify the |
|
2111 | 2131 | current directory, a file name to patch, and a patch file to take |
|
2112 | 2132 | from stdin. |
|
2113 | 2133 | |
|
2114 | 2134 | It is possible to specify a patch tool together with extra |
|
2115 | 2135 | arguments. For example, setting this option to ``patch --merge`` |
|
2116 | 2136 | will use the ``patch`` program with its 2-way merge option. |
|
2117 | 2137 | |
|
2118 | 2138 | ``portablefilenames`` |
|
2119 | 2139 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
2120 | 2140 | (default: ``warn``) |
|
2121 | 2141 | |
|
2122 | 2142 | ``warn`` |
|
2123 | 2143 | Print a warning message on POSIX platforms, if a file with a non-portable |
|
2124 | 2144 | filename is added (e.g. a file with a name that can't be created on |
|
2125 | 2145 | Windows because it contains reserved parts like ``AUX``, reserved |
|
2126 | 2146 | characters like ``:``, or would cause a case collision with an existing |
|
2127 | 2147 | file). |
|
2128 | 2148 | |
|
2129 | 2149 | ``ignore`` |
|
2130 | 2150 | Don't print a warning. |
|
2131 | 2151 | |
|
2132 | 2152 | ``abort`` |
|
2133 | 2153 | The command is aborted. |
|
2134 | 2154 | |
|
2135 | 2155 | ``true`` |
|
2136 | 2156 | Alias for ``warn``. |
|
2137 | 2157 | |
|
2138 | 2158 | ``false`` |
|
2139 | 2159 | Alias for ``ignore``. |
|
2140 | 2160 | |
|
2141 | 2161 | .. container:: windows |
|
2142 | 2162 | |
|
2143 | 2163 | On Windows, this configuration option is ignored and the command aborted. |
|
2144 | 2164 | |
|
2145 | 2165 | ``quiet`` |
|
2146 | 2166 | Reduce the amount of output printed. |
|
2147 | 2167 | (default: False) |
|
2148 | 2168 | |
|
2149 | 2169 | ``remotecmd`` |
|
2150 | 2170 | Remote command to use for clone/push/pull operations. |
|
2151 | 2171 | (default: ``hg``) |
|
2152 | 2172 | |
|
2153 | 2173 | ``report_untrusted`` |
|
2154 | 2174 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
2155 | 2175 | trusted user or group. |
|
2156 | 2176 | (default: True) |
|
2157 | 2177 | |
|
2158 | 2178 | ``slash`` |
|
2159 | 2179 | Display paths using a slash (``/``) as the path separator. This |
|
2160 | 2180 | only makes a difference on systems where the default path |
|
2161 | 2181 | separator is not the slash character (e.g. Windows uses the |
|
2162 | 2182 | backslash character (``\``)). |
|
2163 | 2183 | (default: False) |
|
2164 | 2184 | |
|
2165 | 2185 | ``statuscopies`` |
|
2166 | 2186 | Display copies in the status command. |
|
2167 | 2187 | |
|
2168 | 2188 | ``ssh`` |
|
2169 | 2189 | Command to use for SSH connections. (default: ``ssh``) |
|
2170 | 2190 | |
|
2171 | 2191 | ``strict`` |
|
2172 | 2192 | Require exact command names, instead of allowing unambiguous |
|
2173 | 2193 | abbreviations. (default: False) |
|
2174 | 2194 | |
|
2175 | 2195 | ``style`` |
|
2176 | 2196 | Name of style to use for command output. |
|
2177 | 2197 | |
|
2178 | 2198 | ``supportcontact`` |
|
2179 | 2199 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
2180 | 2200 | large organisation with its own Mercurial deployment process and crash |
|
2181 | 2201 | reports should be addressed to your internal support. |
|
2182 | 2202 | |
|
2183 | 2203 | ``textwidth`` |
|
2184 | 2204 | Maximum width of help text. A longer line generated by ``hg help`` or |
|
2185 | 2205 | ``hg subcommand --help`` will be broken after white space to get this |
|
2186 | 2206 | width or the terminal width, whichever comes first. |
|
2187 | 2207 | A non-positive value will disable this and the terminal width will be |
|
2188 | 2208 | used. (default: 78) |
|
2189 | 2209 | |
|
2190 | 2210 | ``timeout`` |
|
2191 | 2211 | The timeout used when a lock is held (in seconds), a negative value |
|
2192 | 2212 | means no timeout. (default: 600) |
|
2193 | 2213 | |
|
2194 | 2214 | ``traceback`` |
|
2195 | 2215 | Mercurial always prints a traceback when an unknown exception |
|
2196 | 2216 | occurs. Setting this to True will make Mercurial print a traceback |
|
2197 | 2217 | on all exceptions, even those recognized by Mercurial (such as |
|
2198 | 2218 | IOError or MemoryError). (default: False) |
|
2199 | 2219 | |
|
2200 | 2220 | ``tweakdefaults`` |
|
2201 | 2221 | |
|
2202 | 2222 | By default Mercurial's behavior changes very little from release |
|
2203 | 2223 | to release, but over time the recommended config settings |
|
2204 | 2224 | shift. Enable this config to opt in to get automatic tweaks to |
|
2205 | 2225 | Mercurial's behavior over time. This config setting will have no |
|
2206 | 2226 | effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does |
|
2207 | 2227 | not include ``tweakdefaults``. (default: False) |
|
2208 | 2228 | |
|
2209 | 2229 | ``username`` |
|
2210 | 2230 | The committer of a changeset created when running "commit". |
|
2211 | 2231 | Typically a person's name and email address, e.g. ``Fred Widget |
|
2212 | 2232 | <fred@example.com>``. Environment variables in the |
|
2213 | 2233 | username are expanded. |
|
2214 | 2234 | |
|
2215 | 2235 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
2216 | 2236 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
2217 | 2237 | system hgrc, it has to be specified manually or in a different |
|
2218 | 2238 | hgrc file) |
|
2219 | 2239 | |
|
2220 | 2240 | ``verbose`` |
|
2221 | 2241 | Increase the amount of output printed. (default: False) |
|
2222 | 2242 | |
|
2223 | 2243 | |
|
2224 | 2244 | ``web`` |
|
2225 | 2245 | ------- |
|
2226 | 2246 | |
|
2227 | 2247 | Web interface configuration. The settings in this section apply to |
|
2228 | 2248 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
2229 | 2249 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
2230 | 2250 | and WSGI). |
|
2231 | 2251 | |
|
2232 | 2252 | The Mercurial webserver does no authentication (it does not prompt for |
|
2233 | 2253 | usernames and passwords to validate *who* users are), but it does do |
|
2234 | 2254 | authorization (it grants or denies access for *authenticated users* |
|
2235 | 2255 | based on settings in this section). You must either configure your |
|
2236 | 2256 | webserver to do authentication for you, or disable the authorization |
|
2237 | 2257 | checks. |
|
2238 | 2258 | |
|
2239 | 2259 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
2240 | 2260 | you want it to accept pushes from anybody, you can use the following |
|
2241 | 2261 | command line:: |
|
2242 | 2262 | |
|
2243 | 2263 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
2244 | 2264 | |
|
2245 | 2265 | Note that this will allow anybody to push anything to the server and |
|
2246 | 2266 | that this should not be used for public servers. |
|
2247 | 2267 | |
|
2248 | 2268 | The full set of options is: |
|
2249 | 2269 | |
|
2250 | 2270 | ``accesslog`` |
|
2251 | 2271 | Where to output the access log. (default: stdout) |
|
2252 | 2272 | |
|
2253 | 2273 | ``address`` |
|
2254 | 2274 | Interface address to bind to. (default: all) |
|
2255 | 2275 | |
|
2256 | 2276 | ``allow_archive`` |
|
2257 | 2277 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
2258 | 2278 | (default: empty) |
|
2259 | 2279 | |
|
2260 | 2280 | ``allowbz2`` |
|
2261 | 2281 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
2262 | 2282 | revisions. |
|
2263 | 2283 | (default: False) |
|
2264 | 2284 | |
|
2265 | 2285 | ``allowgz`` |
|
2266 | 2286 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
2267 | 2287 | revisions. |
|
2268 | 2288 | (default: False) |
|
2269 | 2289 | |
|
2270 | 2290 | ``allowpull`` |
|
2271 | 2291 | Whether to allow pulling from the repository. (default: True) |
|
2272 | 2292 | |
|
2273 | 2293 | ``allow_push`` |
|
2274 | 2294 | Whether to allow pushing to the repository. If empty or not set, |
|
2275 | 2295 | pushing is not allowed. If the special value ``*``, any remote |
|
2276 | 2296 | user can push, including unauthenticated users. Otherwise, the |
|
2277 | 2297 | remote user must have been authenticated, and the authenticated |
|
2278 | 2298 | user name must be present in this list. The contents of the |
|
2279 | 2299 | allow_push list are examined after the deny_push list. |
|
2280 | 2300 | |
|
2281 | 2301 | ``allow_read`` |
|
2282 | 2302 | If the user has not already been denied repository access due to |
|
2283 | 2303 | the contents of deny_read, this list determines whether to grant |
|
2284 | 2304 | repository access to the user. If this list is not empty, and the |
|
2285 | 2305 | user is unauthenticated or not present in the list, then access is |
|
2286 | 2306 | denied for the user. If the list is empty or not set, then access |
|
2287 | 2307 | is permitted to all users by default. Setting allow_read to the |
|
2288 | 2308 | special value ``*`` is equivalent to it not being set (i.e. access |
|
2289 | 2309 | is permitted to all users). The contents of the allow_read list are |
|
2290 | 2310 | examined after the deny_read list. |
|
2291 | 2311 | |
|
2292 | 2312 | ``allowzip`` |
|
2293 | 2313 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
2294 | 2314 | revisions. This feature creates temporary files. |
|
2295 | 2315 | (default: False) |
|
2296 | 2316 | |
|
2297 | 2317 | ``archivesubrepos`` |
|
2298 | 2318 | Whether to recurse into subrepositories when archiving. |
|
2299 | 2319 | (default: False) |
|
2300 | 2320 | |
|
2301 | 2321 | ``baseurl`` |
|
2302 | 2322 | Base URL to use when publishing URLs in other locations, so |
|
2303 | 2323 | third-party tools like email notification hooks can construct |
|
2304 | 2324 | URLs. Example: ``http://hgserver/repos/``. |
|
2305 | 2325 | |
|
2306 | 2326 | ``cacerts`` |
|
2307 | 2327 | Path to file containing a list of PEM encoded certificate |
|
2308 | 2328 | authority certificates. Environment variables and ``~user`` |
|
2309 | 2329 | constructs are expanded in the filename. If specified on the |
|
2310 | 2330 | client, then it will verify the identity of remote HTTPS servers |
|
2311 | 2331 | with these certificates. |
|
2312 | 2332 | |
|
2313 | 2333 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
2314 | 2334 | command line. |
|
2315 | 2335 | |
|
2316 | 2336 | You can use OpenSSL's CA certificate file if your platform has |
|
2317 | 2337 | one. On most Linux systems this will be |
|
2318 | 2338 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
2319 | 2339 | generate this file manually. The form must be as follows:: |
|
2320 | 2340 | |
|
2321 | 2341 | -----BEGIN CERTIFICATE----- |
|
2322 | 2342 | ... (certificate in base64 PEM encoding) ... |
|
2323 | 2343 | -----END CERTIFICATE----- |
|
2324 | 2344 | -----BEGIN CERTIFICATE----- |
|
2325 | 2345 | ... (certificate in base64 PEM encoding) ... |
|
2326 | 2346 | -----END CERTIFICATE----- |
|
2327 | 2347 | |
|
2328 | 2348 | ``cache`` |
|
2329 | 2349 | Whether to support caching in hgweb. (default: True) |
|
2330 | 2350 | |
|
2331 | 2351 | ``certificate`` |
|
2332 | 2352 | Certificate to use when running :hg:`serve`. |
|
2333 | 2353 | |
|
2334 | 2354 | ``collapse`` |
|
2335 | 2355 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
2336 | 2356 | a single level alongside repositories in the current path. With |
|
2337 | 2357 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
2338 | 2358 | the current path are grouped behind navigable directory entries that |
|
2339 | 2359 | lead to the locations of these repositories. In effect, this setting |
|
2340 | 2360 | collapses each collection of repositories found within a subdirectory |
|
2341 | 2361 | into a single entry for that subdirectory. (default: False) |
|
2342 | 2362 | |
|
2343 | 2363 | ``comparisoncontext`` |
|
2344 | 2364 | Number of lines of context to show in side-by-side file comparison. If |
|
2345 | 2365 | negative or the value ``full``, whole files are shown. (default: 5) |
|
2346 | 2366 | |
|
2347 | 2367 | This setting can be overridden by a ``context`` request parameter to the |
|
2348 | 2368 | ``comparison`` command, taking the same values. |
|
2349 | 2369 | |
|
2350 | 2370 | ``contact`` |
|
2351 | 2371 | Name or email address of the person in charge of the repository. |
|
2352 | 2372 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
2353 | 2373 | |
|
2354 | 2374 | ``csp`` |
|
2355 | 2375 | Send a ``Content-Security-Policy`` HTTP header with this value. |
|
2356 | 2376 | |
|
2357 | 2377 | The value may contain a special string ``%nonce%``, which will be replaced |
|
2358 | 2378 | by a randomly-generated one-time use value. If the value contains |
|
2359 | 2379 | ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the |
|
2360 | 2380 | one-time property of the nonce. This nonce will also be inserted into |
|
2361 | 2381 | ``<script>`` elements containing inline JavaScript. |
|
2362 | 2382 | |
|
2363 | 2383 | Note: lots of HTML content sent by the server is derived from repository |
|
2364 | 2384 | data. Please consider the potential for malicious repository data to |
|
2365 | 2385 | "inject" itself into generated HTML content as part of your security |
|
2366 | 2386 | threat model. |
|
2367 | 2387 | |
|
2368 | 2388 | ``deny_push`` |
|
2369 | 2389 | Whether to deny pushing to the repository. If empty or not set, |
|
2370 | 2390 | push is not denied. If the special value ``*``, all remote users are |
|
2371 | 2391 | denied push. Otherwise, unauthenticated users are all denied, and |
|
2372 | 2392 | any authenticated user name present in this list is also denied. The |
|
2373 | 2393 | contents of the deny_push list are examined before the allow_push list. |
|
2374 | 2394 | |
|
2375 | 2395 | ``deny_read`` |
|
2376 | 2396 | Whether to deny reading/viewing of the repository. If this list is |
|
2377 | 2397 | not empty, unauthenticated users are all denied, and any |
|
2378 | 2398 | authenticated user name present in this list is also denied access to |
|
2379 | 2399 | the repository. If set to the special value ``*``, all remote users |
|
2380 | 2400 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
2381 | 2401 | the determination of repository access depends on the presence and |
|
2382 | 2402 | content of the allow_read list (see description). If both |
|
2383 | 2403 | deny_read and allow_read are empty or not set, then access is |
|
2384 | 2404 | permitted to all users by default. If the repository is being |
|
2385 | 2405 | served via hgwebdir, denied users will not be able to see it in |
|
2386 | 2406 | the list of repositories. The contents of the deny_read list have |
|
2387 | 2407 | priority over (are examined before) the contents of the allow_read |
|
2388 | 2408 | list. |
|
2389 | 2409 | |
|
2390 | 2410 | ``descend`` |
|
2391 | 2411 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
2392 | 2412 | directly in the current path will be shown (other repositories are still |
|
2393 | 2413 | available from the index corresponding to their containing path). |
|
2394 | 2414 | |
|
2395 | 2415 | ``description`` |
|
2396 | 2416 | Textual description of the repository's purpose or contents. |
|
2397 | 2417 | (default: "unknown") |
|
2398 | 2418 | |
|
2399 | 2419 | ``encoding`` |
|
2400 | 2420 | Character encoding name. (default: the current locale charset) |
|
2401 | 2421 | Example: "UTF-8". |
|
2402 | 2422 | |
|
2403 | 2423 | ``errorlog`` |
|
2404 | 2424 | Where to output the error log. (default: stderr) |
|
2405 | 2425 | |
|
2406 | 2426 | ``guessmime`` |
|
2407 | 2427 | Control MIME types for raw download of file content. |
|
2408 | 2428 | Set to True to let hgweb guess the content type from the file |
|
2409 | 2429 | extension. This will serve HTML files as ``text/html`` and might |
|
2410 | 2430 | allow cross-site scripting attacks when serving untrusted |
|
2411 | 2431 | repositories. (default: False) |
|
2412 | 2432 | |
|
2413 | 2433 | ``hidden`` |
|
2414 | 2434 | Whether to hide the repository in the hgwebdir index. |
|
2415 | 2435 | (default: False) |
|
2416 | 2436 | |
|
2417 | 2437 | ``ipv6`` |
|
2418 | 2438 | Whether to use IPv6. (default: False) |
|
2419 | 2439 | |
|
2420 | 2440 | ``labels`` |
|
2421 | 2441 | List of string *labels* associated with the repository. |
|
2422 | 2442 | |
|
2423 | 2443 | Labels are exposed as a template keyword and can be used to customize |
|
2424 | 2444 | output. e.g. the ``index`` template can group or filter repositories |
|
2425 | 2445 | by labels and the ``summary`` template can display additional content |
|
2426 | 2446 | if a specific label is present. |
|
2427 | 2447 | |
|
2428 | 2448 | ``logoimg`` |
|
2429 | 2449 | File name of the logo image that some templates display on each page. |
|
2430 | 2450 | The file name is relative to ``staticurl``. That is, the full path to |
|
2431 | 2451 | the logo image is "staticurl/logoimg". |
|
2432 | 2452 | If unset, ``hglogo.png`` will be used. |
|
2433 | 2453 | |
|
2434 | 2454 | ``logourl`` |
|
2435 | 2455 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
2436 | 2456 | will be used. |
|
2437 | 2457 | |
|
2438 | 2458 | ``maxchanges`` |
|
2439 | 2459 | Maximum number of changes to list on the changelog. (default: 10) |
|
2440 | 2460 | |
|
2441 | 2461 | ``maxfiles`` |
|
2442 | 2462 | Maximum number of files to list per changeset. (default: 10) |
|
2443 | 2463 | |
|
2444 | 2464 | ``maxshortchanges`` |
|
2445 | 2465 | Maximum number of changes to list on the shortlog, graph or filelog |
|
2446 | 2466 | pages. (default: 60) |
|
2447 | 2467 | |
|
2448 | 2468 | ``name`` |
|
2449 | 2469 | Repository name to use in the web interface. |
|
2450 | 2470 | (default: current working directory) |
|
2451 | 2471 | |
|
2452 | 2472 | ``port`` |
|
2453 | 2473 | Port to listen on. (default: 8000) |
|
2454 | 2474 | |
|
2455 | 2475 | ``prefix`` |
|
2456 | 2476 | Prefix path to serve from. (default: '' (server root)) |
|
2457 | 2477 | |
|
2458 | 2478 | ``push_ssl`` |
|
2459 | 2479 | Whether to require that inbound pushes be transported over SSL to |
|
2460 | 2480 | prevent password sniffing. (default: True) |
|
2461 | 2481 | |
|
2462 | 2482 | ``refreshinterval`` |
|
2463 | 2483 | How frequently directory listings re-scan the filesystem for new |
|
2464 | 2484 | repositories, in seconds. This is relevant when wildcards are used |
|
2465 | 2485 | to define paths. Depending on how much filesystem traversal is |
|
2466 | 2486 | required, refreshing may negatively impact performance. |
|
2467 | 2487 | |
|
2468 | 2488 | Values less than or equal to 0 always refresh. |
|
2469 | 2489 | (default: 20) |
|
2470 | 2490 | |
|
2471 | 2491 | ``staticurl`` |
|
2472 | 2492 | Base URL to use for static files. If unset, static files (e.g. the |
|
2473 | 2493 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
2474 | 2494 | this setting to serve them directly with the HTTP server. |
|
2475 | 2495 | Example: ``http://hgserver/static/``. |
|
2476 | 2496 | |
|
2477 | 2497 | ``stripes`` |
|
2478 | 2498 | How many lines a "zebra stripe" should span in multi-line output. |
|
2479 | 2499 | Set to 0 to disable. (default: 1) |
|
2480 | 2500 | |
|
2481 | 2501 | ``style`` |
|
2482 | 2502 | Which template map style to use. The available options are the names of |
|
2483 | 2503 | subdirectories in the HTML templates path. (default: ``paper``) |
|
2484 | 2504 | Example: ``monoblue``. |
|
2485 | 2505 | |
|
2486 | 2506 | ``templates`` |
|
2487 | 2507 | Where to find the HTML templates. The default path to the HTML templates |
|
2488 | 2508 | can be obtained from ``hg debuginstall``. |
|
2489 | 2509 | |
|
2490 | 2510 | ``websub`` |
|
2491 | 2511 | ---------- |
|
2492 | 2512 | |
|
2493 | 2513 | Web substitution filter definition. You can use this section to |
|
2494 | 2514 | define a set of regular expression substitution patterns which |
|
2495 | 2515 | let you automatically modify the hgweb server output. |
|
2496 | 2516 | |
|
2497 | 2517 | The default hgweb templates only apply these substitution patterns |
|
2498 | 2518 | on the revision description fields. You can apply them anywhere |
|
2499 | 2519 | you want when you create your own templates by adding calls to the |
|
2500 | 2520 | "websub" filter (usually after calling the "escape" filter). |
|
2501 | 2521 | |
|
2502 | 2522 | This can be used, for example, to convert issue references to links |
|
2503 | 2523 | to your issue tracker, or to convert "markdown-like" syntax into |
|
2504 | 2524 | HTML (see the examples below). |
|
2505 | 2525 | |
|
2506 | 2526 | Each entry in this section names a substitution filter. |
|
2507 | 2527 | The value of each entry defines the substitution expression itself. |
|
2508 | 2528 | The websub expressions follow the old interhg extension syntax, |
|
2509 | 2529 | which in turn imitates the Unix sed replacement syntax:: |
|
2510 | 2530 | |
|
2511 | 2531 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
2512 | 2532 | |
|
2513 | 2533 | You can use any separator other than "/". The final "i" is optional |
|
2514 | 2534 | and indicates that the search must be case insensitive. |
|
2515 | 2535 | |
|
2516 | 2536 | Examples:: |
|
2517 | 2537 | |
|
2518 | 2538 | [websub] |
|
2519 | 2539 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
2520 | 2540 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
2521 | 2541 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
2522 | 2542 | |
|
2523 | 2543 | ``worker`` |
|
2524 | 2544 | ---------- |
|
2525 | 2545 | |
|
2526 | 2546 | Parallel master/worker configuration. We currently perform working |
|
2527 | 2547 | directory updates in parallel on Unix-like systems, which greatly |
|
2528 | 2548 | helps performance. |
|
2529 | 2549 | |
|
2530 | 2550 | ``numcpus`` |
|
2531 | 2551 | Number of CPUs to use for parallel operations. A zero or |
|
2532 | 2552 | negative value is treated as ``use the default``. |
|
2533 | 2553 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
2534 | 2554 | |
|
2535 | 2555 | ``backgroundclose`` |
|
2536 | 2556 | Whether to enable closing file handles on background threads during certain |
|
2537 | 2557 | operations. Some platforms aren't very efficient at closing file |
|
2538 | 2558 | handles that have been written or appended to. By performing file closing |
|
2539 | 2559 | on background threads, file write rate can increase substantially. |
|
2540 | 2560 | (default: true on Windows, false elsewhere) |
|
2541 | 2561 | |
|
2542 | 2562 | ``backgroundcloseminfilecount`` |
|
2543 | 2563 | Minimum number of files required to trigger background file closing. |
|
2544 | 2564 | Operations not writing this many files won't start background close |
|
2545 | 2565 | threads. |
|
2546 | 2566 | (default: 2048) |
|
2547 | 2567 | |
|
2548 | 2568 | ``backgroundclosemaxqueue`` |
|
2549 | 2569 | The maximum number of opened file handles waiting to be closed in the |
|
2550 | 2570 | background. This option only has an effect if ``backgroundclose`` is |
|
2551 | 2571 | enabled. |
|
2552 | 2572 | (default: 384) |
|
2553 | 2573 | |
|
2554 | 2574 | ``backgroundclosethreadcount`` |
|
2555 | 2575 | Number of threads to process background file closes. Only relevant if |
|
2556 | 2576 | ``backgroundclose`` is enabled. |
|
2557 | 2577 | (default: 4) |
@@ -1,2049 +1,2063 b'' | |||
|
1 | 1 | # subrepo.py - sub-repository handling for Mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2009-2010 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import copy |
|
11 | 11 | import errno |
|
12 | 12 | import hashlib |
|
13 | 13 | import os |
|
14 | 14 | import posixpath |
|
15 | 15 | import re |
|
16 | 16 | import stat |
|
17 | 17 | import subprocess |
|
18 | 18 | import sys |
|
19 | 19 | import tarfile |
|
20 | 20 | import xml.dom.minidom |
|
21 | 21 | |
|
22 | 22 | |
|
23 | 23 | from .i18n import _ |
|
24 | 24 | from . import ( |
|
25 | 25 | cmdutil, |
|
26 | 26 | config, |
|
27 | 27 | encoding, |
|
28 | 28 | error, |
|
29 | 29 | exchange, |
|
30 | 30 | filemerge, |
|
31 | 31 | match as matchmod, |
|
32 | 32 | node, |
|
33 | 33 | pathutil, |
|
34 | 34 | phases, |
|
35 | 35 | pycompat, |
|
36 | 36 | scmutil, |
|
37 | 37 | util, |
|
38 | 38 | vfs as vfsmod, |
|
39 | 39 | ) |
|
40 | 40 | |
|
41 | 41 | hg = None |
|
42 | 42 | propertycache = util.propertycache |
|
43 | 43 | |
|
44 | 44 | nullstate = ('', '', 'empty') |
|
45 | 45 | |
|
46 | 46 | def _expandedabspath(path): |
|
47 | 47 | ''' |
|
48 | 48 | get a path or url and if it is a path expand it and return an absolute path |
|
49 | 49 | ''' |
|
50 | 50 | expandedpath = util.urllocalpath(util.expandpath(path)) |
|
51 | 51 | u = util.url(expandedpath) |
|
52 | 52 | if not u.scheme: |
|
53 | 53 | path = util.normpath(os.path.abspath(u.path)) |
|
54 | 54 | return path |
|
55 | 55 | |
|
56 | 56 | def _getstorehashcachename(remotepath): |
|
57 | 57 | '''get a unique filename for the store hash cache of a remote repository''' |
|
58 | 58 | return hashlib.sha1(_expandedabspath(remotepath)).hexdigest()[0:12] |
|
59 | 59 | |
|
60 | 60 | class SubrepoAbort(error.Abort): |
|
61 | 61 | """Exception class used to avoid handling a subrepo error more than once""" |
|
62 | 62 | def __init__(self, *args, **kw): |
|
63 | 63 | self.subrepo = kw.pop('subrepo', None) |
|
64 | 64 | self.cause = kw.pop('cause', None) |
|
65 | 65 | error.Abort.__init__(self, *args, **kw) |
|
66 | 66 | |
|
67 | 67 | def annotatesubrepoerror(func): |
|
68 | 68 | def decoratedmethod(self, *args, **kargs): |
|
69 | 69 | try: |
|
70 | 70 | res = func(self, *args, **kargs) |
|
71 | 71 | except SubrepoAbort as ex: |
|
72 | 72 | # This exception has already been handled |
|
73 | 73 | raise ex |
|
74 | 74 | except error.Abort as ex: |
|
75 | 75 | subrepo = subrelpath(self) |
|
76 | 76 | errormsg = str(ex) + ' ' + _('(in subrepository "%s")') % subrepo |
|
77 | 77 | # avoid handling this exception by raising a SubrepoAbort exception |
|
78 | 78 | raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo, |
|
79 | 79 | cause=sys.exc_info()) |
|
80 | 80 | return res |
|
81 | 81 | return decoratedmethod |
|
82 | 82 | |
|
83 | 83 | def state(ctx, ui): |
|
84 | 84 | """return a state dict, mapping subrepo paths configured in .hgsub |
|
85 | 85 | to tuple: (source from .hgsub, revision from .hgsubstate, kind |
|
86 | 86 | (key in types dict)) |
|
87 | 87 | """ |
|
88 | 88 | p = config.config() |
|
89 | 89 | repo = ctx.repo() |
|
90 | 90 | def read(f, sections=None, remap=None): |
|
91 | 91 | if f in ctx: |
|
92 | 92 | try: |
|
93 | 93 | data = ctx[f].data() |
|
94 | 94 | except IOError as err: |
|
95 | 95 | if err.errno != errno.ENOENT: |
|
96 | 96 | raise |
|
97 | 97 | # handle missing subrepo spec files as removed |
|
98 | 98 | ui.warn(_("warning: subrepo spec file \'%s\' not found\n") % |
|
99 | 99 | repo.pathto(f)) |
|
100 | 100 | return |
|
101 | 101 | p.parse(f, data, sections, remap, read) |
|
102 | 102 | else: |
|
103 | 103 | raise error.Abort(_("subrepo spec file \'%s\' not found") % |
|
104 | 104 | repo.pathto(f)) |
|
105 | 105 | if '.hgsub' in ctx: |
|
106 | 106 | read('.hgsub') |
|
107 | 107 | |
|
108 | 108 | for path, src in ui.configitems('subpaths'): |
|
109 | 109 | p.set('subpaths', path, src, ui.configsource('subpaths', path)) |
|
110 | 110 | |
|
111 | 111 | rev = {} |
|
112 | 112 | if '.hgsubstate' in ctx: |
|
113 | 113 | try: |
|
114 | 114 | for i, l in enumerate(ctx['.hgsubstate'].data().splitlines()): |
|
115 | 115 | l = l.lstrip() |
|
116 | 116 | if not l: |
|
117 | 117 | continue |
|
118 | 118 | try: |
|
119 | 119 | revision, path = l.split(" ", 1) |
|
120 | 120 | except ValueError: |
|
121 | 121 | raise error.Abort(_("invalid subrepository revision " |
|
122 | 122 | "specifier in \'%s\' line %d") |
|
123 | 123 | % (repo.pathto('.hgsubstate'), (i + 1))) |
|
124 | 124 | rev[path] = revision |
|
125 | 125 | except IOError as err: |
|
126 | 126 | if err.errno != errno.ENOENT: |
|
127 | 127 | raise |
|
128 | 128 | |
|
129 | 129 | def remap(src): |
|
130 | 130 | for pattern, repl in p.items('subpaths'): |
|
131 | 131 | # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub |
|
132 | 132 | # does a string decode. |
|
133 | 133 | repl = util.escapestr(repl) |
|
134 | 134 | # However, we still want to allow back references to go |
|
135 | 135 | # through unharmed, so we turn r'\\1' into r'\1'. Again, |
|
136 | 136 | # extra escapes are needed because re.sub string decodes. |
|
137 | 137 | repl = re.sub(br'\\\\([0-9]+)', br'\\\1', repl) |
|
138 | 138 | try: |
|
139 | 139 | src = re.sub(pattern, repl, src, 1) |
|
140 | 140 | except re.error as e: |
|
141 | 141 | raise error.Abort(_("bad subrepository pattern in %s: %s") |
|
142 | 142 | % (p.source('subpaths', pattern), e)) |
|
143 | 143 | return src |
|
144 | 144 | |
|
145 | 145 | state = {} |
|
146 | 146 | for path, src in p[''].items(): |
|
147 | 147 | kind = 'hg' |
|
148 | 148 | if src.startswith('['): |
|
149 | 149 | if ']' not in src: |
|
150 | 150 | raise error.Abort(_('missing ] in subrepository source')) |
|
151 | 151 | kind, src = src.split(']', 1) |
|
152 | 152 | kind = kind[1:] |
|
153 | 153 | src = src.lstrip() # strip any extra whitespace after ']' |
|
154 | 154 | |
|
155 | 155 | if not util.url(src).isabs(): |
|
156 | 156 | parent = _abssource(repo, abort=False) |
|
157 | 157 | if parent: |
|
158 | 158 | parent = util.url(parent) |
|
159 | 159 | parent.path = posixpath.join(parent.path or '', src) |
|
160 | 160 | parent.path = posixpath.normpath(parent.path) |
|
161 | 161 | joined = str(parent) |
|
162 | 162 | # Remap the full joined path and use it if it changes, |
|
163 | 163 | # else remap the original source. |
|
164 | 164 | remapped = remap(joined) |
|
165 | 165 | if remapped == joined: |
|
166 | 166 | src = remap(src) |
|
167 | 167 | else: |
|
168 | 168 | src = remapped |
|
169 | 169 | |
|
170 | 170 | src = remap(src) |
|
171 | 171 | state[util.pconvert(path)] = (src.strip(), rev.get(path, ''), kind) |
|
172 | 172 | |
|
173 | 173 | return state |
|
174 | 174 | |
|
175 | 175 | def writestate(repo, state): |
|
176 | 176 | """rewrite .hgsubstate in (outer) repo with these subrepo states""" |
|
177 | 177 | lines = ['%s %s\n' % (state[s][1], s) for s in sorted(state) |
|
178 | 178 | if state[s][1] != nullstate[1]] |
|
179 | 179 | repo.wwrite('.hgsubstate', ''.join(lines), '') |
|
180 | 180 | |
|
181 | 181 | def submerge(repo, wctx, mctx, actx, overwrite, labels=None): |
|
182 | 182 | """delegated from merge.applyupdates: merging of .hgsubstate file |
|
183 | 183 | in working context, merging context and ancestor context""" |
|
184 | 184 | if mctx == actx: # backwards? |
|
185 | 185 | actx = wctx.p1() |
|
186 | 186 | s1 = wctx.substate |
|
187 | 187 | s2 = mctx.substate |
|
188 | 188 | sa = actx.substate |
|
189 | 189 | sm = {} |
|
190 | 190 | |
|
191 | 191 | repo.ui.debug("subrepo merge %s %s %s\n" % (wctx, mctx, actx)) |
|
192 | 192 | |
|
193 | 193 | def debug(s, msg, r=""): |
|
194 | 194 | if r: |
|
195 | 195 | r = "%s:%s:%s" % r |
|
196 | 196 | repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
|
197 | 197 | |
|
198 | 198 | promptssrc = filemerge.partextras(labels) |
|
199 | 199 | for s, l in sorted(s1.iteritems()): |
|
200 | 200 | prompts = None |
|
201 | 201 | a = sa.get(s, nullstate) |
|
202 | 202 | ld = l # local state with possible dirty flag for compares |
|
203 | 203 | if wctx.sub(s).dirty(): |
|
204 | 204 | ld = (l[0], l[1] + "+") |
|
205 | 205 | if wctx == actx: # overwrite |
|
206 | 206 | a = ld |
|
207 | 207 | |
|
208 | 208 | prompts = promptssrc.copy() |
|
209 | 209 | prompts['s'] = s |
|
210 | 210 | if s in s2: |
|
211 | 211 | r = s2[s] |
|
212 | 212 | if ld == r or r == a: # no change or local is newer |
|
213 | 213 | sm[s] = l |
|
214 | 214 | continue |
|
215 | 215 | elif ld == a: # other side changed |
|
216 | 216 | debug(s, "other changed, get", r) |
|
217 | 217 | wctx.sub(s).get(r, overwrite) |
|
218 | 218 | sm[s] = r |
|
219 | 219 | elif ld[0] != r[0]: # sources differ |
|
220 | 220 | prompts['lo'] = l[0] |
|
221 | 221 | prompts['ro'] = r[0] |
|
222 | 222 | if repo.ui.promptchoice( |
|
223 | 223 | _(' subrepository sources for %(s)s differ\n' |
|
224 | 224 | 'use (l)ocal%(l)s source (%(lo)s)' |
|
225 | 225 | ' or (r)emote%(o)s source (%(ro)s)?' |
|
226 | 226 | '$$ &Local $$ &Remote') % prompts, 0): |
|
227 | 227 | debug(s, "prompt changed, get", r) |
|
228 | 228 | wctx.sub(s).get(r, overwrite) |
|
229 | 229 | sm[s] = r |
|
230 | 230 | elif ld[1] == a[1]: # local side is unchanged |
|
231 | 231 | debug(s, "other side changed, get", r) |
|
232 | 232 | wctx.sub(s).get(r, overwrite) |
|
233 | 233 | sm[s] = r |
|
234 | 234 | else: |
|
235 | 235 | debug(s, "both sides changed") |
|
236 | 236 | srepo = wctx.sub(s) |
|
237 | 237 | prompts['sl'] = srepo.shortid(l[1]) |
|
238 | 238 | prompts['sr'] = srepo.shortid(r[1]) |
|
239 | 239 | option = repo.ui.promptchoice( |
|
240 | 240 | _(' subrepository %(s)s diverged (local revision: %(sl)s, ' |
|
241 | 241 | 'remote revision: %(sr)s)\n' |
|
242 | 242 | '(M)erge, keep (l)ocal%(l)s or keep (r)emote%(o)s?' |
|
243 | 243 | '$$ &Merge $$ &Local $$ &Remote') |
|
244 | 244 | % prompts, 0) |
|
245 | 245 | if option == 0: |
|
246 | 246 | wctx.sub(s).merge(r) |
|
247 | 247 | sm[s] = l |
|
248 | 248 | debug(s, "merge with", r) |
|
249 | 249 | elif option == 1: |
|
250 | 250 | sm[s] = l |
|
251 | 251 | debug(s, "keep local subrepo revision", l) |
|
252 | 252 | else: |
|
253 | 253 | wctx.sub(s).get(r, overwrite) |
|
254 | 254 | sm[s] = r |
|
255 | 255 | debug(s, "get remote subrepo revision", r) |
|
256 | 256 | elif ld == a: # remote removed, local unchanged |
|
257 | 257 | debug(s, "remote removed, remove") |
|
258 | 258 | wctx.sub(s).remove() |
|
259 | 259 | elif a == nullstate: # not present in remote or ancestor |
|
260 | 260 | debug(s, "local added, keep") |
|
261 | 261 | sm[s] = l |
|
262 | 262 | continue |
|
263 | 263 | else: |
|
264 | 264 | if repo.ui.promptchoice( |
|
265 | 265 | _(' local%(l)s changed subrepository %(s)s' |
|
266 | 266 | ' which remote%(o)s removed\n' |
|
267 | 267 | 'use (c)hanged version or (d)elete?' |
|
268 | 268 | '$$ &Changed $$ &Delete') % prompts, 0): |
|
269 | 269 | debug(s, "prompt remove") |
|
270 | 270 | wctx.sub(s).remove() |
|
271 | 271 | |
|
272 | 272 | for s, r in sorted(s2.items()): |
|
273 | 273 | prompts = None |
|
274 | 274 | if s in s1: |
|
275 | 275 | continue |
|
276 | 276 | elif s not in sa: |
|
277 | 277 | debug(s, "remote added, get", r) |
|
278 | 278 | mctx.sub(s).get(r) |
|
279 | 279 | sm[s] = r |
|
280 | 280 | elif r != sa[s]: |
|
281 | 281 | prompts = promptssrc.copy() |
|
282 | 282 | prompts['s'] = s |
|
283 | 283 | if repo.ui.promptchoice( |
|
284 | 284 | _(' remote%(o)s changed subrepository %(s)s' |
|
285 | 285 | ' which local%(l)s removed\n' |
|
286 | 286 | 'use (c)hanged version or (d)elete?' |
|
287 | 287 | '$$ &Changed $$ &Delete') % prompts, 0) == 0: |
|
288 | 288 | debug(s, "prompt recreate", r) |
|
289 | 289 | mctx.sub(s).get(r) |
|
290 | 290 | sm[s] = r |
|
291 | 291 | |
|
292 | 292 | # record merged .hgsubstate |
|
293 | 293 | writestate(repo, sm) |
|
294 | 294 | return sm |
|
295 | 295 | |
|
296 | 296 | def _updateprompt(ui, sub, dirty, local, remote): |
|
297 | 297 | if dirty: |
|
298 | 298 | msg = (_(' subrepository sources for %s differ\n' |
|
299 | 299 | 'use (l)ocal source (%s) or (r)emote source (%s)?' |
|
300 | 300 | '$$ &Local $$ &Remote') |
|
301 | 301 | % (subrelpath(sub), local, remote)) |
|
302 | 302 | else: |
|
303 | 303 | msg = (_(' subrepository sources for %s differ (in checked out ' |
|
304 | 304 | 'version)\n' |
|
305 | 305 | 'use (l)ocal source (%s) or (r)emote source (%s)?' |
|
306 | 306 | '$$ &Local $$ &Remote') |
|
307 | 307 | % (subrelpath(sub), local, remote)) |
|
308 | 308 | return ui.promptchoice(msg, 0) |
|
309 | 309 | |
|
310 | 310 | def reporelpath(repo): |
|
311 | 311 | """return path to this (sub)repo as seen from outermost repo""" |
|
312 | 312 | parent = repo |
|
313 | 313 | while util.safehasattr(parent, '_subparent'): |
|
314 | 314 | parent = parent._subparent |
|
315 | 315 | return repo.root[len(pathutil.normasprefix(parent.root)):] |
|
316 | 316 | |
|
317 | 317 | def subrelpath(sub): |
|
318 | 318 | """return path to this subrepo as seen from outermost repo""" |
|
319 | 319 | return sub._relpath |
|
320 | 320 | |
|
321 | 321 | def _abssource(repo, push=False, abort=True): |
|
322 | 322 | """return pull/push path of repo - either based on parent repo .hgsub info |
|
323 | 323 | or on the top repo config. Abort or return None if no source found.""" |
|
324 | 324 | if util.safehasattr(repo, '_subparent'): |
|
325 | 325 | source = util.url(repo._subsource) |
|
326 | 326 | if source.isabs(): |
|
327 | 327 | return str(source) |
|
328 | 328 | source.path = posixpath.normpath(source.path) |
|
329 | 329 | parent = _abssource(repo._subparent, push, abort=False) |
|
330 | 330 | if parent: |
|
331 | 331 | parent = util.url(util.pconvert(parent)) |
|
332 | 332 | parent.path = posixpath.join(parent.path or '', source.path) |
|
333 | 333 | parent.path = posixpath.normpath(parent.path) |
|
334 | 334 | return str(parent) |
|
335 | 335 | else: # recursion reached top repo |
|
336 | 336 | if util.safehasattr(repo, '_subtoppath'): |
|
337 | 337 | return repo._subtoppath |
|
338 | 338 | if push and repo.ui.config('paths', 'default-push'): |
|
339 | 339 | return repo.ui.config('paths', 'default-push') |
|
340 | 340 | if repo.ui.config('paths', 'default'): |
|
341 | 341 | return repo.ui.config('paths', 'default') |
|
342 | 342 | if repo.shared(): |
|
343 | 343 | # chop off the .hg component to get the default path form |
|
344 | 344 | return os.path.dirname(repo.sharedpath) |
|
345 | 345 | if abort: |
|
346 | 346 | raise error.Abort(_("default path for subrepository not found")) |
|
347 | 347 | |
|
348 | 348 | def _sanitize(ui, vfs, ignore): |
|
349 | 349 | for dirname, dirs, names in vfs.walk(): |
|
350 | 350 | for i, d in enumerate(dirs): |
|
351 | 351 | if d.lower() == ignore: |
|
352 | 352 | del dirs[i] |
|
353 | 353 | break |
|
354 | 354 | if vfs.basename(dirname).lower() != '.hg': |
|
355 | 355 | continue |
|
356 | 356 | for f in names: |
|
357 | 357 | if f.lower() == 'hgrc': |
|
358 | 358 | ui.warn(_("warning: removing potentially hostile 'hgrc' " |
|
359 | 359 | "in '%s'\n") % vfs.join(dirname)) |
|
360 | 360 | vfs.unlink(vfs.reljoin(dirname, f)) |
|
361 | 361 | |
|
362 | 362 | def _auditsubrepopath(repo, path): |
|
363 | 363 | # auditor doesn't check if the path itself is a symlink |
|
364 | 364 | pathutil.pathauditor(repo.root)(path) |
|
365 | 365 | if repo.wvfs.islink(path): |
|
366 | 366 | raise error.Abort(_("subrepo '%s' traverses symbolic link") % path) |
|
367 | 367 | |
|
368 | SUBREPO_ALLOWED_DEFAULTS = { | |
|
369 | 'hg': True, | |
|
370 | 'git': False, | |
|
371 | 'svn': False, | |
|
372 | } | |
|
373 | ||
|
368 | 374 | def _checktype(ui, kind): |
|
369 | if kind not in ui.configlist('subrepos', 'allowed', ['hg']): | |
|
370 | raise error.Abort(_("subrepo type %s not allowed") % kind, | |
|
375 | # subrepos.allowed is a master kill switch. If disabled, subrepos are | |
|
376 | # disabled period. | |
|
377 | if not ui.configbool('subrepos', 'allowed', True): | |
|
378 | raise error.Abort(_('subrepos not enabled'), | |
|
371 | 379 | hint=_("see 'hg help config.subrepos' for details")) |
|
380 | ||
|
381 | default = SUBREPO_ALLOWED_DEFAULTS.get(kind, False) | |
|
382 | if not ui.configbool('subrepos', '%s:allowed' % kind, default): | |
|
383 | raise error.Abort(_('%s subrepos not allowed') % kind, | |
|
384 | hint=_("see 'hg help config.subrepos' for details")) | |
|
385 | ||
|
372 | 386 | if kind not in types: |
|
373 | 387 | raise error.Abort(_('unknown subrepo type %s') % kind) |
|
374 | 388 | |
|
375 | 389 | def subrepo(ctx, path, allowwdir=False, allowcreate=True): |
|
376 | 390 | """return instance of the right subrepo class for subrepo in path""" |
|
377 | 391 | # subrepo inherently violates our import layering rules |
|
378 | 392 | # because it wants to make repo objects from deep inside the stack |
|
379 | 393 | # so we manually delay the circular imports to not break |
|
380 | 394 | # scripts that don't use our demand-loading |
|
381 | 395 | global hg |
|
382 | 396 | from . import hg as h |
|
383 | 397 | hg = h |
|
384 | 398 | |
|
385 | 399 | repo = ctx.repo() |
|
386 | 400 | _auditsubrepopath(repo, path) |
|
387 | 401 | state = ctx.substate[path] |
|
388 | 402 | _checktype(repo.ui, state[2]) |
|
389 | 403 | if allowwdir: |
|
390 | 404 | state = (state[0], ctx.subrev(path), state[2]) |
|
391 | 405 | return types[state[2]](ctx, path, state[:2], allowcreate) |
|
392 | 406 | |
|
393 | 407 | def nullsubrepo(ctx, path, pctx): |
|
394 | 408 | """return an empty subrepo in pctx for the extant subrepo in ctx""" |
|
395 | 409 | # subrepo inherently violates our import layering rules |
|
396 | 410 | # because it wants to make repo objects from deep inside the stack |
|
397 | 411 | # so we manually delay the circular imports to not break |
|
398 | 412 | # scripts that don't use our demand-loading |
|
399 | 413 | global hg |
|
400 | 414 | from . import hg as h |
|
401 | 415 | hg = h |
|
402 | 416 | |
|
403 | 417 | repo = ctx.repo() |
|
404 | 418 | _auditsubrepopath(repo, path) |
|
405 | 419 | state = ctx.substate[path] |
|
406 | 420 | _checktype(repo.ui, state[2]) |
|
407 | 421 | subrev = '' |
|
408 | 422 | if state[2] == 'hg': |
|
409 | 423 | subrev = "0" * 40 |
|
410 | 424 | return types[state[2]](pctx, path, (state[0], subrev), True) |
|
411 | 425 | |
|
412 | 426 | def newcommitphase(ui, ctx): |
|
413 | 427 | commitphase = phases.newcommitphase(ui) |
|
414 | 428 | substate = getattr(ctx, "substate", None) |
|
415 | 429 | if not substate: |
|
416 | 430 | return commitphase |
|
417 | 431 | check = ui.config('phases', 'checksubrepos') |
|
418 | 432 | if check not in ('ignore', 'follow', 'abort'): |
|
419 | 433 | raise error.Abort(_('invalid phases.checksubrepos configuration: %s') |
|
420 | 434 | % (check)) |
|
421 | 435 | if check == 'ignore': |
|
422 | 436 | return commitphase |
|
423 | 437 | maxphase = phases.public |
|
424 | 438 | maxsub = None |
|
425 | 439 | for s in sorted(substate): |
|
426 | 440 | sub = ctx.sub(s) |
|
427 | 441 | subphase = sub.phase(substate[s][1]) |
|
428 | 442 | if maxphase < subphase: |
|
429 | 443 | maxphase = subphase |
|
430 | 444 | maxsub = s |
|
431 | 445 | if commitphase < maxphase: |
|
432 | 446 | if check == 'abort': |
|
433 | 447 | raise error.Abort(_("can't commit in %s phase" |
|
434 | 448 | " conflicting %s from subrepository %s") % |
|
435 | 449 | (phases.phasenames[commitphase], |
|
436 | 450 | phases.phasenames[maxphase], maxsub)) |
|
437 | 451 | ui.warn(_("warning: changes are committed in" |
|
438 | 452 | " %s phase from subrepository %s\n") % |
|
439 | 453 | (phases.phasenames[maxphase], maxsub)) |
|
440 | 454 | return maxphase |
|
441 | 455 | return commitphase |
|
442 | 456 | |
|
443 | 457 | # subrepo classes need to implement the following abstract class: |
|
444 | 458 | |
|
445 | 459 | class abstractsubrepo(object): |
|
446 | 460 | |
|
447 | 461 | def __init__(self, ctx, path): |
|
448 | 462 | """Initialize abstractsubrepo part |
|
449 | 463 | |
|
450 | 464 | ``ctx`` is the context referring this subrepository in the |
|
451 | 465 | parent repository. |
|
452 | 466 | |
|
453 | 467 | ``path`` is the path to this subrepository as seen from |
|
454 | 468 | innermost repository. |
|
455 | 469 | """ |
|
456 | 470 | self.ui = ctx.repo().ui |
|
457 | 471 | self._ctx = ctx |
|
458 | 472 | self._path = path |
|
459 | 473 | |
|
460 | 474 | def addwebdirpath(self, serverpath, webconf): |
|
461 | 475 | """Add the hgwebdir entries for this subrepo, and any of its subrepos. |
|
462 | 476 | |
|
463 | 477 | ``serverpath`` is the path component of the URL for this repo. |
|
464 | 478 | |
|
465 | 479 | ``webconf`` is the dictionary of hgwebdir entries. |
|
466 | 480 | """ |
|
467 | 481 | pass |
|
468 | 482 | |
|
469 | 483 | def storeclean(self, path): |
|
470 | 484 | """ |
|
471 | 485 | returns true if the repository has not changed since it was last |
|
472 | 486 | cloned from or pushed to a given repository. |
|
473 | 487 | """ |
|
474 | 488 | return False |
|
475 | 489 | |
|
476 | 490 | def dirty(self, ignoreupdate=False, missing=False): |
|
477 | 491 | """returns true if the dirstate of the subrepo is dirty or does not |
|
478 | 492 | match current stored state. If ignoreupdate is true, only check |
|
479 | 493 | whether the subrepo has uncommitted changes in its dirstate. If missing |
|
480 | 494 | is true, check for deleted files. |
|
481 | 495 | """ |
|
482 | 496 | raise NotImplementedError |
|
483 | 497 | |
|
484 | 498 | def dirtyreason(self, ignoreupdate=False, missing=False): |
|
485 | 499 | """return reason string if it is ``dirty()`` |
|
486 | 500 | |
|
487 | 501 | Returned string should have enough information for the message |
|
488 | 502 | of exception. |
|
489 | 503 | |
|
490 | 504 | This returns None, otherwise. |
|
491 | 505 | """ |
|
492 | 506 | if self.dirty(ignoreupdate=ignoreupdate, missing=missing): |
|
493 | 507 | return _('uncommitted changes in subrepository "%s"' |
|
494 | 508 | ) % subrelpath(self) |
|
495 | 509 | |
|
496 | 510 | def bailifchanged(self, ignoreupdate=False, hint=None): |
|
497 | 511 | """raise Abort if subrepository is ``dirty()`` |
|
498 | 512 | """ |
|
499 | 513 | dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate, |
|
500 | 514 | missing=True) |
|
501 | 515 | if dirtyreason: |
|
502 | 516 | raise error.Abort(dirtyreason, hint=hint) |
|
503 | 517 | |
|
504 | 518 | def basestate(self): |
|
505 | 519 | """current working directory base state, disregarding .hgsubstate |
|
506 | 520 | state and working directory modifications""" |
|
507 | 521 | raise NotImplementedError |
|
508 | 522 | |
|
509 | 523 | def checknested(self, path): |
|
510 | 524 | """check if path is a subrepository within this repository""" |
|
511 | 525 | return False |
|
512 | 526 | |
|
513 | 527 | def commit(self, text, user, date): |
|
514 | 528 | """commit the current changes to the subrepo with the given |
|
515 | 529 | log message. Use given user and date if possible. Return the |
|
516 | 530 | new state of the subrepo. |
|
517 | 531 | """ |
|
518 | 532 | raise NotImplementedError |
|
519 | 533 | |
|
520 | 534 | def phase(self, state): |
|
521 | 535 | """returns phase of specified state in the subrepository. |
|
522 | 536 | """ |
|
523 | 537 | return phases.public |
|
524 | 538 | |
|
525 | 539 | def remove(self): |
|
526 | 540 | """remove the subrepo |
|
527 | 541 | |
|
528 | 542 | (should verify the dirstate is not dirty first) |
|
529 | 543 | """ |
|
530 | 544 | raise NotImplementedError |
|
531 | 545 | |
|
532 | 546 | def get(self, state, overwrite=False): |
|
533 | 547 | """run whatever commands are needed to put the subrepo into |
|
534 | 548 | this state |
|
535 | 549 | """ |
|
536 | 550 | raise NotImplementedError |
|
537 | 551 | |
|
538 | 552 | def merge(self, state): |
|
539 | 553 | """merge currently-saved state with the new state.""" |
|
540 | 554 | raise NotImplementedError |
|
541 | 555 | |
|
542 | 556 | def push(self, opts): |
|
543 | 557 | """perform whatever action is analogous to 'hg push' |
|
544 | 558 | |
|
545 | 559 | This may be a no-op on some systems. |
|
546 | 560 | """ |
|
547 | 561 | raise NotImplementedError |
|
548 | 562 | |
|
549 | 563 | def add(self, ui, match, prefix, explicitonly, **opts): |
|
550 | 564 | return [] |
|
551 | 565 | |
|
552 | 566 | def addremove(self, matcher, prefix, opts, dry_run, similarity): |
|
553 | 567 | self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) |
|
554 | 568 | return 1 |
|
555 | 569 | |
|
556 | 570 | def cat(self, match, fm, fntemplate, prefix, **opts): |
|
557 | 571 | return 1 |
|
558 | 572 | |
|
559 | 573 | def status(self, rev2, **opts): |
|
560 | 574 | return scmutil.status([], [], [], [], [], [], []) |
|
561 | 575 | |
|
562 | 576 | def diff(self, ui, diffopts, node2, match, prefix, **opts): |
|
563 | 577 | pass |
|
564 | 578 | |
|
565 | 579 | def outgoing(self, ui, dest, opts): |
|
566 | 580 | return 1 |
|
567 | 581 | |
|
568 | 582 | def incoming(self, ui, source, opts): |
|
569 | 583 | return 1 |
|
570 | 584 | |
|
571 | 585 | def files(self): |
|
572 | 586 | """return filename iterator""" |
|
573 | 587 | raise NotImplementedError |
|
574 | 588 | |
|
575 | 589 | def filedata(self, name, decode): |
|
576 | 590 | """return file data, optionally passed through repo decoders""" |
|
577 | 591 | raise NotImplementedError |
|
578 | 592 | |
|
579 | 593 | def fileflags(self, name): |
|
580 | 594 | """return file flags""" |
|
581 | 595 | return '' |
|
582 | 596 | |
|
583 | 597 | def getfileset(self, expr): |
|
584 | 598 | """Resolve the fileset expression for this repo""" |
|
585 | 599 | return set() |
|
586 | 600 | |
|
587 | 601 | def printfiles(self, ui, m, fm, fmt, subrepos): |
|
588 | 602 | """handle the files command for this subrepo""" |
|
589 | 603 | return 1 |
|
590 | 604 | |
|
591 | 605 | def archive(self, archiver, prefix, match=None, decode=True): |
|
592 | 606 | if match is not None: |
|
593 | 607 | files = [f for f in self.files() if match(f)] |
|
594 | 608 | else: |
|
595 | 609 | files = self.files() |
|
596 | 610 | total = len(files) |
|
597 | 611 | relpath = subrelpath(self) |
|
598 | 612 | self.ui.progress(_('archiving (%s)') % relpath, 0, |
|
599 | 613 | unit=_('files'), total=total) |
|
600 | 614 | for i, name in enumerate(files): |
|
601 | 615 | flags = self.fileflags(name) |
|
602 | 616 | mode = 'x' in flags and 0o755 or 0o644 |
|
603 | 617 | symlink = 'l' in flags |
|
604 | 618 | archiver.addfile(prefix + self._path + '/' + name, |
|
605 | 619 | mode, symlink, self.filedata(name, decode)) |
|
606 | 620 | self.ui.progress(_('archiving (%s)') % relpath, i + 1, |
|
607 | 621 | unit=_('files'), total=total) |
|
608 | 622 | self.ui.progress(_('archiving (%s)') % relpath, None) |
|
609 | 623 | return total |
|
610 | 624 | |
|
611 | 625 | def walk(self, match): |
|
612 | 626 | ''' |
|
613 | 627 | walk recursively through the directory tree, finding all files |
|
614 | 628 | matched by the match function |
|
615 | 629 | ''' |
|
616 | 630 | |
|
617 | 631 | def forget(self, match, prefix): |
|
618 | 632 | return ([], []) |
|
619 | 633 | |
|
620 | 634 | def removefiles(self, matcher, prefix, after, force, subrepos, warnings): |
|
621 | 635 | """remove the matched files from the subrepository and the filesystem, |
|
622 | 636 | possibly by force and/or after the file has been removed from the |
|
623 | 637 | filesystem. Return 0 on success, 1 on any warning. |
|
624 | 638 | """ |
|
625 | 639 | warnings.append(_("warning: removefiles not implemented (%s)") |
|
626 | 640 | % self._path) |
|
627 | 641 | return 1 |
|
628 | 642 | |
|
629 | 643 | def revert(self, substate, *pats, **opts): |
|
630 | 644 | self.ui.warn(_('%s: reverting %s subrepos is unsupported\n') \ |
|
631 | 645 | % (substate[0], substate[2])) |
|
632 | 646 | return [] |
|
633 | 647 | |
|
634 | 648 | def shortid(self, revid): |
|
635 | 649 | return revid |
|
636 | 650 | |
|
637 | 651 | def unshare(self): |
|
638 | 652 | ''' |
|
639 | 653 | convert this repository from shared to normal storage. |
|
640 | 654 | ''' |
|
641 | 655 | |
|
642 | 656 | def verify(self): |
|
643 | 657 | '''verify the integrity of the repository. Return 0 on success or |
|
644 | 658 | warning, 1 on any error. |
|
645 | 659 | ''' |
|
646 | 660 | return 0 |
|
647 | 661 | |
|
648 | 662 | @propertycache |
|
649 | 663 | def wvfs(self): |
|
650 | 664 | """return vfs to access the working directory of this subrepository |
|
651 | 665 | """ |
|
652 | 666 | return vfsmod.vfs(self._ctx.repo().wvfs.join(self._path)) |
|
653 | 667 | |
|
654 | 668 | @propertycache |
|
655 | 669 | def _relpath(self): |
|
656 | 670 | """return path to this subrepository as seen from outermost repository |
|
657 | 671 | """ |
|
658 | 672 | return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path) |
|
659 | 673 | |
|
660 | 674 | class hgsubrepo(abstractsubrepo): |
|
661 | 675 | def __init__(self, ctx, path, state, allowcreate): |
|
662 | 676 | super(hgsubrepo, self).__init__(ctx, path) |
|
663 | 677 | self._state = state |
|
664 | 678 | r = ctx.repo() |
|
665 | 679 | root = r.wjoin(path) |
|
666 | 680 | create = allowcreate and not r.wvfs.exists('%s/.hg' % path) |
|
667 | 681 | self._repo = hg.repository(r.baseui, root, create=create) |
|
668 | 682 | |
|
669 | 683 | # Propagate the parent's --hidden option |
|
670 | 684 | if r is r.unfiltered(): |
|
671 | 685 | self._repo = self._repo.unfiltered() |
|
672 | 686 | |
|
673 | 687 | self.ui = self._repo.ui |
|
674 | 688 | for s, k in [('ui', 'commitsubrepos')]: |
|
675 | 689 | v = r.ui.config(s, k) |
|
676 | 690 | if v: |
|
677 | 691 | self.ui.setconfig(s, k, v, 'subrepo') |
|
678 | 692 | # internal config: ui._usedassubrepo |
|
679 | 693 | self.ui.setconfig('ui', '_usedassubrepo', 'True', 'subrepo') |
|
680 | 694 | self._initrepo(r, state[0], create) |
|
681 | 695 | |
|
682 | 696 | @annotatesubrepoerror |
|
683 | 697 | def addwebdirpath(self, serverpath, webconf): |
|
684 | 698 | cmdutil.addwebdirpath(self._repo, subrelpath(self), webconf) |
|
685 | 699 | |
|
686 | 700 | def storeclean(self, path): |
|
687 | 701 | with self._repo.lock(): |
|
688 | 702 | return self._storeclean(path) |
|
689 | 703 | |
|
690 | 704 | def _storeclean(self, path): |
|
691 | 705 | clean = True |
|
692 | 706 | itercache = self._calcstorehash(path) |
|
693 | 707 | for filehash in self._readstorehashcache(path): |
|
694 | 708 | if filehash != next(itercache, None): |
|
695 | 709 | clean = False |
|
696 | 710 | break |
|
697 | 711 | if clean: |
|
698 | 712 | # if not empty: |
|
699 | 713 | # the cached and current pull states have a different size |
|
700 | 714 | clean = next(itercache, None) is None |
|
701 | 715 | return clean |
|
702 | 716 | |
|
703 | 717 | def _calcstorehash(self, remotepath): |
|
704 | 718 | '''calculate a unique "store hash" |
|
705 | 719 | |
|
706 | 720 | This method is used to to detect when there are changes that may |
|
707 | 721 | require a push to a given remote path.''' |
|
708 | 722 | # sort the files that will be hashed in increasing (likely) file size |
|
709 | 723 | filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i') |
|
710 | 724 | yield '# %s\n' % _expandedabspath(remotepath) |
|
711 | 725 | vfs = self._repo.vfs |
|
712 | 726 | for relname in filelist: |
|
713 | 727 | filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest() |
|
714 | 728 | yield '%s = %s\n' % (relname, filehash) |
|
715 | 729 | |
|
716 | 730 | @propertycache |
|
717 | 731 | def _cachestorehashvfs(self): |
|
718 | 732 | return vfsmod.vfs(self._repo.vfs.join('cache/storehash')) |
|
719 | 733 | |
|
720 | 734 | def _readstorehashcache(self, remotepath): |
|
721 | 735 | '''read the store hash cache for a given remote repository''' |
|
722 | 736 | cachefile = _getstorehashcachename(remotepath) |
|
723 | 737 | return self._cachestorehashvfs.tryreadlines(cachefile, 'r') |
|
724 | 738 | |
|
725 | 739 | def _cachestorehash(self, remotepath): |
|
726 | 740 | '''cache the current store hash |
|
727 | 741 | |
|
728 | 742 | Each remote repo requires its own store hash cache, because a subrepo |
|
729 | 743 | store may be "clean" versus a given remote repo, but not versus another |
|
730 | 744 | ''' |
|
731 | 745 | cachefile = _getstorehashcachename(remotepath) |
|
732 | 746 | with self._repo.lock(): |
|
733 | 747 | storehash = list(self._calcstorehash(remotepath)) |
|
734 | 748 | vfs = self._cachestorehashvfs |
|
735 | 749 | vfs.writelines(cachefile, storehash, mode='w', notindexed=True) |
|
736 | 750 | |
|
737 | 751 | def _getctx(self): |
|
738 | 752 | '''fetch the context for this subrepo revision, possibly a workingctx |
|
739 | 753 | ''' |
|
740 | 754 | if self._ctx.rev() is None: |
|
741 | 755 | return self._repo[None] # workingctx if parent is workingctx |
|
742 | 756 | else: |
|
743 | 757 | rev = self._state[1] |
|
744 | 758 | return self._repo[rev] |
|
745 | 759 | |
|
746 | 760 | @annotatesubrepoerror |
|
747 | 761 | def _initrepo(self, parentrepo, source, create): |
|
748 | 762 | self._repo._subparent = parentrepo |
|
749 | 763 | self._repo._subsource = source |
|
750 | 764 | |
|
751 | 765 | if create: |
|
752 | 766 | lines = ['[paths]\n'] |
|
753 | 767 | |
|
754 | 768 | def addpathconfig(key, value): |
|
755 | 769 | if value: |
|
756 | 770 | lines.append('%s = %s\n' % (key, value)) |
|
757 | 771 | self.ui.setconfig('paths', key, value, 'subrepo') |
|
758 | 772 | |
|
759 | 773 | defpath = _abssource(self._repo, abort=False) |
|
760 | 774 | defpushpath = _abssource(self._repo, True, abort=False) |
|
761 | 775 | addpathconfig('default', defpath) |
|
762 | 776 | if defpath != defpushpath: |
|
763 | 777 | addpathconfig('default-push', defpushpath) |
|
764 | 778 | |
|
765 | 779 | fp = self._repo.vfs("hgrc", "w", text=True) |
|
766 | 780 | try: |
|
767 | 781 | fp.write(''.join(lines)) |
|
768 | 782 | finally: |
|
769 | 783 | fp.close() |
|
770 | 784 | |
|
771 | 785 | @annotatesubrepoerror |
|
772 | 786 | def add(self, ui, match, prefix, explicitonly, **opts): |
|
773 | 787 | return cmdutil.add(ui, self._repo, match, |
|
774 | 788 | self.wvfs.reljoin(prefix, self._path), |
|
775 | 789 | explicitonly, **opts) |
|
776 | 790 | |
|
777 | 791 | @annotatesubrepoerror |
|
778 | 792 | def addremove(self, m, prefix, opts, dry_run, similarity): |
|
779 | 793 | # In the same way as sub directories are processed, once in a subrepo, |
|
780 | 794 | # always entry any of its subrepos. Don't corrupt the options that will |
|
781 | 795 | # be used to process sibling subrepos however. |
|
782 | 796 | opts = copy.copy(opts) |
|
783 | 797 | opts['subrepos'] = True |
|
784 | 798 | return scmutil.addremove(self._repo, m, |
|
785 | 799 | self.wvfs.reljoin(prefix, self._path), opts, |
|
786 | 800 | dry_run, similarity) |
|
787 | 801 | |
|
788 | 802 | @annotatesubrepoerror |
|
789 | 803 | def cat(self, match, fm, fntemplate, prefix, **opts): |
|
790 | 804 | rev = self._state[1] |
|
791 | 805 | ctx = self._repo[rev] |
|
792 | 806 | return cmdutil.cat(self.ui, self._repo, ctx, match, fm, fntemplate, |
|
793 | 807 | prefix, **opts) |
|
794 | 808 | |
|
795 | 809 | @annotatesubrepoerror |
|
796 | 810 | def status(self, rev2, **opts): |
|
797 | 811 | try: |
|
798 | 812 | rev1 = self._state[1] |
|
799 | 813 | ctx1 = self._repo[rev1] |
|
800 | 814 | ctx2 = self._repo[rev2] |
|
801 | 815 | return self._repo.status(ctx1, ctx2, **opts) |
|
802 | 816 | except error.RepoLookupError as inst: |
|
803 | 817 | self.ui.warn(_('warning: error "%s" in subrepository "%s"\n') |
|
804 | 818 | % (inst, subrelpath(self))) |
|
805 | 819 | return scmutil.status([], [], [], [], [], [], []) |
|
806 | 820 | |
|
807 | 821 | @annotatesubrepoerror |
|
808 | 822 | def diff(self, ui, diffopts, node2, match, prefix, **opts): |
|
809 | 823 | try: |
|
810 | 824 | node1 = node.bin(self._state[1]) |
|
811 | 825 | # We currently expect node2 to come from substate and be |
|
812 | 826 | # in hex format |
|
813 | 827 | if node2 is not None: |
|
814 | 828 | node2 = node.bin(node2) |
|
815 | 829 | cmdutil.diffordiffstat(ui, self._repo, diffopts, |
|
816 | 830 | node1, node2, match, |
|
817 | 831 | prefix=posixpath.join(prefix, self._path), |
|
818 | 832 | listsubrepos=True, **opts) |
|
819 | 833 | except error.RepoLookupError as inst: |
|
820 | 834 | self.ui.warn(_('warning: error "%s" in subrepository "%s"\n') |
|
821 | 835 | % (inst, subrelpath(self))) |
|
822 | 836 | |
|
823 | 837 | @annotatesubrepoerror |
|
824 | 838 | def archive(self, archiver, prefix, match=None, decode=True): |
|
825 | 839 | self._get(self._state + ('hg',)) |
|
826 | 840 | total = abstractsubrepo.archive(self, archiver, prefix, match) |
|
827 | 841 | rev = self._state[1] |
|
828 | 842 | ctx = self._repo[rev] |
|
829 | 843 | for subpath in ctx.substate: |
|
830 | 844 | s = subrepo(ctx, subpath, True) |
|
831 | 845 | submatch = matchmod.subdirmatcher(subpath, match) |
|
832 | 846 | total += s.archive(archiver, prefix + self._path + '/', submatch, |
|
833 | 847 | decode) |
|
834 | 848 | return total |
|
835 | 849 | |
|
836 | 850 | @annotatesubrepoerror |
|
837 | 851 | def dirty(self, ignoreupdate=False, missing=False): |
|
838 | 852 | r = self._state[1] |
|
839 | 853 | if r == '' and not ignoreupdate: # no state recorded |
|
840 | 854 | return True |
|
841 | 855 | w = self._repo[None] |
|
842 | 856 | if r != w.p1().hex() and not ignoreupdate: |
|
843 | 857 | # different version checked out |
|
844 | 858 | return True |
|
845 | 859 | return w.dirty(missing=missing) # working directory changed |
|
846 | 860 | |
|
847 | 861 | def basestate(self): |
|
848 | 862 | return self._repo['.'].hex() |
|
849 | 863 | |
|
850 | 864 | def checknested(self, path): |
|
851 | 865 | return self._repo._checknested(self._repo.wjoin(path)) |
|
852 | 866 | |
|
853 | 867 | @annotatesubrepoerror |
|
854 | 868 | def commit(self, text, user, date): |
|
855 | 869 | # don't bother committing in the subrepo if it's only been |
|
856 | 870 | # updated |
|
857 | 871 | if not self.dirty(True): |
|
858 | 872 | return self._repo['.'].hex() |
|
859 | 873 | self.ui.debug("committing subrepo %s\n" % subrelpath(self)) |
|
860 | 874 | n = self._repo.commit(text, user, date) |
|
861 | 875 | if not n: |
|
862 | 876 | return self._repo['.'].hex() # different version checked out |
|
863 | 877 | return node.hex(n) |
|
864 | 878 | |
|
865 | 879 | @annotatesubrepoerror |
|
866 | 880 | def phase(self, state): |
|
867 | 881 | return self._repo[state].phase() |
|
868 | 882 | |
|
869 | 883 | @annotatesubrepoerror |
|
870 | 884 | def remove(self): |
|
871 | 885 | # we can't fully delete the repository as it may contain |
|
872 | 886 | # local-only history |
|
873 | 887 | self.ui.note(_('removing subrepo %s\n') % subrelpath(self)) |
|
874 | 888 | hg.clean(self._repo, node.nullid, False) |
|
875 | 889 | |
|
876 | 890 | def _get(self, state): |
|
877 | 891 | source, revision, kind = state |
|
878 | 892 | parentrepo = self._repo._subparent |
|
879 | 893 | |
|
880 | 894 | if revision in self._repo.unfiltered(): |
|
881 | 895 | # Allow shared subrepos tracked at null to setup the sharedpath |
|
882 | 896 | if len(self._repo) != 0 or not parentrepo.shared(): |
|
883 | 897 | return True |
|
884 | 898 | self._repo._subsource = source |
|
885 | 899 | srcurl = _abssource(self._repo) |
|
886 | 900 | other = hg.peer(self._repo, {}, srcurl) |
|
887 | 901 | if len(self._repo) == 0: |
|
888 | 902 | # use self._repo.vfs instead of self.wvfs to remove .hg only |
|
889 | 903 | self._repo.vfs.rmtree() |
|
890 | 904 | if parentrepo.shared(): |
|
891 | 905 | self.ui.status(_('sharing subrepo %s from %s\n') |
|
892 | 906 | % (subrelpath(self), srcurl)) |
|
893 | 907 | shared = hg.share(self._repo._subparent.baseui, |
|
894 | 908 | other, self._repo.root, |
|
895 | 909 | update=False, bookmarks=False) |
|
896 | 910 | self._repo = shared.local() |
|
897 | 911 | else: |
|
898 | 912 | self.ui.status(_('cloning subrepo %s from %s\n') |
|
899 | 913 | % (subrelpath(self), srcurl)) |
|
900 | 914 | other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
|
901 | 915 | other, self._repo.root, |
|
902 | 916 | update=False) |
|
903 | 917 | self._repo = cloned.local() |
|
904 | 918 | self._initrepo(parentrepo, source, create=True) |
|
905 | 919 | self._cachestorehash(srcurl) |
|
906 | 920 | else: |
|
907 | 921 | self.ui.status(_('pulling subrepo %s from %s\n') |
|
908 | 922 | % (subrelpath(self), srcurl)) |
|
909 | 923 | cleansub = self.storeclean(srcurl) |
|
910 | 924 | exchange.pull(self._repo, other) |
|
911 | 925 | if cleansub: |
|
912 | 926 | # keep the repo clean after pull |
|
913 | 927 | self._cachestorehash(srcurl) |
|
914 | 928 | return False |
|
915 | 929 | |
|
916 | 930 | @annotatesubrepoerror |
|
917 | 931 | def get(self, state, overwrite=False): |
|
918 | 932 | inrepo = self._get(state) |
|
919 | 933 | source, revision, kind = state |
|
920 | 934 | repo = self._repo |
|
921 | 935 | repo.ui.debug("getting subrepo %s\n" % self._path) |
|
922 | 936 | if inrepo: |
|
923 | 937 | urepo = repo.unfiltered() |
|
924 | 938 | ctx = urepo[revision] |
|
925 | 939 | if ctx.hidden(): |
|
926 | 940 | urepo.ui.warn( |
|
927 | 941 | _('revision %s in subrepository "%s" is hidden\n') \ |
|
928 | 942 | % (revision[0:12], self._path)) |
|
929 | 943 | repo = urepo |
|
930 | 944 | hg.updaterepo(repo, revision, overwrite) |
|
931 | 945 | |
|
932 | 946 | @annotatesubrepoerror |
|
933 | 947 | def merge(self, state): |
|
934 | 948 | self._get(state) |
|
935 | 949 | cur = self._repo['.'] |
|
936 | 950 | dst = self._repo[state[1]] |
|
937 | 951 | anc = dst.ancestor(cur) |
|
938 | 952 | |
|
939 | 953 | def mergefunc(): |
|
940 | 954 | if anc == cur and dst.branch() == cur.branch(): |
|
941 | 955 | self.ui.debug('updating subrepository "%s"\n' |
|
942 | 956 | % subrelpath(self)) |
|
943 | 957 | hg.update(self._repo, state[1]) |
|
944 | 958 | elif anc == dst: |
|
945 | 959 | self.ui.debug('skipping subrepository "%s"\n' |
|
946 | 960 | % subrelpath(self)) |
|
947 | 961 | else: |
|
948 | 962 | self.ui.debug('merging subrepository "%s"\n' % subrelpath(self)) |
|
949 | 963 | hg.merge(self._repo, state[1], remind=False) |
|
950 | 964 | |
|
951 | 965 | wctx = self._repo[None] |
|
952 | 966 | if self.dirty(): |
|
953 | 967 | if anc != dst: |
|
954 | 968 | if _updateprompt(self.ui, self, wctx.dirty(), cur, dst): |
|
955 | 969 | mergefunc() |
|
956 | 970 | else: |
|
957 | 971 | mergefunc() |
|
958 | 972 | else: |
|
959 | 973 | mergefunc() |
|
960 | 974 | |
|
961 | 975 | @annotatesubrepoerror |
|
962 | 976 | def push(self, opts): |
|
963 | 977 | force = opts.get('force') |
|
964 | 978 | newbranch = opts.get('new_branch') |
|
965 | 979 | ssh = opts.get('ssh') |
|
966 | 980 | |
|
967 | 981 | # push subrepos depth-first for coherent ordering |
|
968 | 982 | c = self._repo[''] |
|
969 | 983 | subs = c.substate # only repos that are committed |
|
970 | 984 | for s in sorted(subs): |
|
971 | 985 | if c.sub(s).push(opts) == 0: |
|
972 | 986 | return False |
|
973 | 987 | |
|
974 | 988 | dsturl = _abssource(self._repo, True) |
|
975 | 989 | if not force: |
|
976 | 990 | if self.storeclean(dsturl): |
|
977 | 991 | self.ui.status( |
|
978 | 992 | _('no changes made to subrepo %s since last push to %s\n') |
|
979 | 993 | % (subrelpath(self), dsturl)) |
|
980 | 994 | return None |
|
981 | 995 | self.ui.status(_('pushing subrepo %s to %s\n') % |
|
982 | 996 | (subrelpath(self), dsturl)) |
|
983 | 997 | other = hg.peer(self._repo, {'ssh': ssh}, dsturl) |
|
984 | 998 | res = exchange.push(self._repo, other, force, newbranch=newbranch) |
|
985 | 999 | |
|
986 | 1000 | # the repo is now clean |
|
987 | 1001 | self._cachestorehash(dsturl) |
|
988 | 1002 | return res.cgresult |
|
989 | 1003 | |
|
990 | 1004 | @annotatesubrepoerror |
|
991 | 1005 | def outgoing(self, ui, dest, opts): |
|
992 | 1006 | if 'rev' in opts or 'branch' in opts: |
|
993 | 1007 | opts = copy.copy(opts) |
|
994 | 1008 | opts.pop('rev', None) |
|
995 | 1009 | opts.pop('branch', None) |
|
996 | 1010 | return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts) |
|
997 | 1011 | |
|
998 | 1012 | @annotatesubrepoerror |
|
999 | 1013 | def incoming(self, ui, source, opts): |
|
1000 | 1014 | if 'rev' in opts or 'branch' in opts: |
|
1001 | 1015 | opts = copy.copy(opts) |
|
1002 | 1016 | opts.pop('rev', None) |
|
1003 | 1017 | opts.pop('branch', None) |
|
1004 | 1018 | return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts) |
|
1005 | 1019 | |
|
1006 | 1020 | @annotatesubrepoerror |
|
1007 | 1021 | def files(self): |
|
1008 | 1022 | rev = self._state[1] |
|
1009 | 1023 | ctx = self._repo[rev] |
|
1010 | 1024 | return ctx.manifest().keys() |
|
1011 | 1025 | |
|
1012 | 1026 | def filedata(self, name, decode): |
|
1013 | 1027 | rev = self._state[1] |
|
1014 | 1028 | data = self._repo[rev][name].data() |
|
1015 | 1029 | if decode: |
|
1016 | 1030 | data = self._repo.wwritedata(name, data) |
|
1017 | 1031 | return data |
|
1018 | 1032 | |
|
1019 | 1033 | def fileflags(self, name): |
|
1020 | 1034 | rev = self._state[1] |
|
1021 | 1035 | ctx = self._repo[rev] |
|
1022 | 1036 | return ctx.flags(name) |
|
1023 | 1037 | |
|
1024 | 1038 | @annotatesubrepoerror |
|
1025 | 1039 | def printfiles(self, ui, m, fm, fmt, subrepos): |
|
1026 | 1040 | # If the parent context is a workingctx, use the workingctx here for |
|
1027 | 1041 | # consistency. |
|
1028 | 1042 | if self._ctx.rev() is None: |
|
1029 | 1043 | ctx = self._repo[None] |
|
1030 | 1044 | else: |
|
1031 | 1045 | rev = self._state[1] |
|
1032 | 1046 | ctx = self._repo[rev] |
|
1033 | 1047 | return cmdutil.files(ui, ctx, m, fm, fmt, subrepos) |
|
1034 | 1048 | |
|
1035 | 1049 | @annotatesubrepoerror |
|
1036 | 1050 | def getfileset(self, expr): |
|
1037 | 1051 | if self._ctx.rev() is None: |
|
1038 | 1052 | ctx = self._repo[None] |
|
1039 | 1053 | else: |
|
1040 | 1054 | rev = self._state[1] |
|
1041 | 1055 | ctx = self._repo[rev] |
|
1042 | 1056 | |
|
1043 | 1057 | files = ctx.getfileset(expr) |
|
1044 | 1058 | |
|
1045 | 1059 | for subpath in ctx.substate: |
|
1046 | 1060 | sub = ctx.sub(subpath) |
|
1047 | 1061 | |
|
1048 | 1062 | try: |
|
1049 | 1063 | files.extend(subpath + '/' + f for f in sub.getfileset(expr)) |
|
1050 | 1064 | except error.LookupError: |
|
1051 | 1065 | self.ui.status(_("skipping missing subrepository: %s\n") |
|
1052 | 1066 | % self.wvfs.reljoin(reporelpath(self), subpath)) |
|
1053 | 1067 | return files |
|
1054 | 1068 | |
|
1055 | 1069 | def walk(self, match): |
|
1056 | 1070 | ctx = self._repo[None] |
|
1057 | 1071 | return ctx.walk(match) |
|
1058 | 1072 | |
|
1059 | 1073 | @annotatesubrepoerror |
|
1060 | 1074 | def forget(self, match, prefix): |
|
1061 | 1075 | return cmdutil.forget(self.ui, self._repo, match, |
|
1062 | 1076 | self.wvfs.reljoin(prefix, self._path), True) |
|
1063 | 1077 | |
|
1064 | 1078 | @annotatesubrepoerror |
|
1065 | 1079 | def removefiles(self, matcher, prefix, after, force, subrepos, warnings): |
|
1066 | 1080 | return cmdutil.remove(self.ui, self._repo, matcher, |
|
1067 | 1081 | self.wvfs.reljoin(prefix, self._path), |
|
1068 | 1082 | after, force, subrepos) |
|
1069 | 1083 | |
|
1070 | 1084 | @annotatesubrepoerror |
|
1071 | 1085 | def revert(self, substate, *pats, **opts): |
|
1072 | 1086 | # reverting a subrepo is a 2 step process: |
|
1073 | 1087 | # 1. if the no_backup is not set, revert all modified |
|
1074 | 1088 | # files inside the subrepo |
|
1075 | 1089 | # 2. update the subrepo to the revision specified in |
|
1076 | 1090 | # the corresponding substate dictionary |
|
1077 | 1091 | self.ui.status(_('reverting subrepo %s\n') % substate[0]) |
|
1078 | 1092 | if not opts.get('no_backup'): |
|
1079 | 1093 | # Revert all files on the subrepo, creating backups |
|
1080 | 1094 | # Note that this will not recursively revert subrepos |
|
1081 | 1095 | # We could do it if there was a set:subrepos() predicate |
|
1082 | 1096 | opts = opts.copy() |
|
1083 | 1097 | opts['date'] = None |
|
1084 | 1098 | opts['rev'] = substate[1] |
|
1085 | 1099 | |
|
1086 | 1100 | self.filerevert(*pats, **opts) |
|
1087 | 1101 | |
|
1088 | 1102 | # Update the repo to the revision specified in the given substate |
|
1089 | 1103 | if not opts.get('dry_run'): |
|
1090 | 1104 | self.get(substate, overwrite=True) |
|
1091 | 1105 | |
|
1092 | 1106 | def filerevert(self, *pats, **opts): |
|
1093 | 1107 | ctx = self._repo[opts['rev']] |
|
1094 | 1108 | parents = self._repo.dirstate.parents() |
|
1095 | 1109 | if opts.get('all'): |
|
1096 | 1110 | pats = ['set:modified()'] |
|
1097 | 1111 | else: |
|
1098 | 1112 | pats = [] |
|
1099 | 1113 | cmdutil.revert(self.ui, self._repo, ctx, parents, *pats, **opts) |
|
1100 | 1114 | |
|
1101 | 1115 | def shortid(self, revid): |
|
1102 | 1116 | return revid[:12] |
|
1103 | 1117 | |
|
1104 | 1118 | @annotatesubrepoerror |
|
1105 | 1119 | def unshare(self): |
|
1106 | 1120 | # subrepo inherently violates our import layering rules |
|
1107 | 1121 | # because it wants to make repo objects from deep inside the stack |
|
1108 | 1122 | # so we manually delay the circular imports to not break |
|
1109 | 1123 | # scripts that don't use our demand-loading |
|
1110 | 1124 | global hg |
|
1111 | 1125 | from . import hg as h |
|
1112 | 1126 | hg = h |
|
1113 | 1127 | |
|
1114 | 1128 | # Nothing prevents a user from sharing in a repo, and then making that a |
|
1115 | 1129 | # subrepo. Alternately, the previous unshare attempt may have failed |
|
1116 | 1130 | # part way through. So recurse whether or not this layer is shared. |
|
1117 | 1131 | if self._repo.shared(): |
|
1118 | 1132 | self.ui.status(_("unsharing subrepo '%s'\n") % self._relpath) |
|
1119 | 1133 | |
|
1120 | 1134 | hg.unshare(self.ui, self._repo) |
|
1121 | 1135 | |
|
1122 | 1136 | def verify(self): |
|
1123 | 1137 | try: |
|
1124 | 1138 | rev = self._state[1] |
|
1125 | 1139 | ctx = self._repo.unfiltered()[rev] |
|
1126 | 1140 | if ctx.hidden(): |
|
1127 | 1141 | # Since hidden revisions aren't pushed/pulled, it seems worth an |
|
1128 | 1142 | # explicit warning. |
|
1129 | 1143 | ui = self._repo.ui |
|
1130 | 1144 | ui.warn(_("subrepo '%s' is hidden in revision %s\n") % |
|
1131 | 1145 | (self._relpath, node.short(self._ctx.node()))) |
|
1132 | 1146 | return 0 |
|
1133 | 1147 | except error.RepoLookupError: |
|
1134 | 1148 | # A missing subrepo revision may be a case of needing to pull it, so |
|
1135 | 1149 | # don't treat this as an error. |
|
1136 | 1150 | self._repo.ui.warn(_("subrepo '%s' not found in revision %s\n") % |
|
1137 | 1151 | (self._relpath, node.short(self._ctx.node()))) |
|
1138 | 1152 | return 0 |
|
1139 | 1153 | |
|
1140 | 1154 | @propertycache |
|
1141 | 1155 | def wvfs(self): |
|
1142 | 1156 | """return own wvfs for efficiency and consistency |
|
1143 | 1157 | """ |
|
1144 | 1158 | return self._repo.wvfs |
|
1145 | 1159 | |
|
1146 | 1160 | @propertycache |
|
1147 | 1161 | def _relpath(self): |
|
1148 | 1162 | """return path to this subrepository as seen from outermost repository |
|
1149 | 1163 | """ |
|
1150 | 1164 | # Keep consistent dir separators by avoiding vfs.join(self._path) |
|
1151 | 1165 | return reporelpath(self._repo) |
|
1152 | 1166 | |
|
1153 | 1167 | class svnsubrepo(abstractsubrepo): |
|
1154 | 1168 | def __init__(self, ctx, path, state, allowcreate): |
|
1155 | 1169 | super(svnsubrepo, self).__init__(ctx, path) |
|
1156 | 1170 | self._state = state |
|
1157 | 1171 | self._exe = util.findexe('svn') |
|
1158 | 1172 | if not self._exe: |
|
1159 | 1173 | raise error.Abort(_("'svn' executable not found for subrepo '%s'") |
|
1160 | 1174 | % self._path) |
|
1161 | 1175 | |
|
1162 | 1176 | def _svncommand(self, commands, filename='', failok=False): |
|
1163 | 1177 | cmd = [self._exe] |
|
1164 | 1178 | extrakw = {} |
|
1165 | 1179 | if not self.ui.interactive(): |
|
1166 | 1180 | # Making stdin be a pipe should prevent svn from behaving |
|
1167 | 1181 | # interactively even if we can't pass --non-interactive. |
|
1168 | 1182 | extrakw['stdin'] = subprocess.PIPE |
|
1169 | 1183 | # Starting in svn 1.5 --non-interactive is a global flag |
|
1170 | 1184 | # instead of being per-command, but we need to support 1.4 so |
|
1171 | 1185 | # we have to be intelligent about what commands take |
|
1172 | 1186 | # --non-interactive. |
|
1173 | 1187 | if commands[0] in ('update', 'checkout', 'commit'): |
|
1174 | 1188 | cmd.append('--non-interactive') |
|
1175 | 1189 | cmd.extend(commands) |
|
1176 | 1190 | if filename is not None: |
|
1177 | 1191 | path = self.wvfs.reljoin(self._ctx.repo().origroot, |
|
1178 | 1192 | self._path, filename) |
|
1179 | 1193 | cmd.append(path) |
|
1180 | 1194 | env = dict(encoding.environ) |
|
1181 | 1195 | # Avoid localized output, preserve current locale for everything else. |
|
1182 | 1196 | lc_all = env.get('LC_ALL') |
|
1183 | 1197 | if lc_all: |
|
1184 | 1198 | env['LANG'] = lc_all |
|
1185 | 1199 | del env['LC_ALL'] |
|
1186 | 1200 | env['LC_MESSAGES'] = 'C' |
|
1187 | 1201 | p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds, |
|
1188 | 1202 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
|
1189 | 1203 | universal_newlines=True, env=env, **extrakw) |
|
1190 | 1204 | stdout, stderr = p.communicate() |
|
1191 | 1205 | stderr = stderr.strip() |
|
1192 | 1206 | if not failok: |
|
1193 | 1207 | if p.returncode: |
|
1194 | 1208 | raise error.Abort(stderr or 'exited with code %d' |
|
1195 | 1209 | % p.returncode) |
|
1196 | 1210 | if stderr: |
|
1197 | 1211 | self.ui.warn(stderr + '\n') |
|
1198 | 1212 | return stdout, stderr |
|
1199 | 1213 | |
|
1200 | 1214 | @propertycache |
|
1201 | 1215 | def _svnversion(self): |
|
1202 | 1216 | output, err = self._svncommand(['--version', '--quiet'], filename=None) |
|
1203 | 1217 | m = re.search(br'^(\d+)\.(\d+)', output) |
|
1204 | 1218 | if not m: |
|
1205 | 1219 | raise error.Abort(_('cannot retrieve svn tool version')) |
|
1206 | 1220 | return (int(m.group(1)), int(m.group(2))) |
|
1207 | 1221 | |
|
1208 | 1222 | def _wcrevs(self): |
|
1209 | 1223 | # Get the working directory revision as well as the last |
|
1210 | 1224 | # commit revision so we can compare the subrepo state with |
|
1211 | 1225 | # both. We used to store the working directory one. |
|
1212 | 1226 | output, err = self._svncommand(['info', '--xml']) |
|
1213 | 1227 | doc = xml.dom.minidom.parseString(output) |
|
1214 | 1228 | entries = doc.getElementsByTagName('entry') |
|
1215 | 1229 | lastrev, rev = '0', '0' |
|
1216 | 1230 | if entries: |
|
1217 | 1231 | rev = str(entries[0].getAttribute('revision')) or '0' |
|
1218 | 1232 | commits = entries[0].getElementsByTagName('commit') |
|
1219 | 1233 | if commits: |
|
1220 | 1234 | lastrev = str(commits[0].getAttribute('revision')) or '0' |
|
1221 | 1235 | return (lastrev, rev) |
|
1222 | 1236 | |
|
1223 | 1237 | def _wcrev(self): |
|
1224 | 1238 | return self._wcrevs()[0] |
|
1225 | 1239 | |
|
1226 | 1240 | def _wcchanged(self): |
|
1227 | 1241 | """Return (changes, extchanges, missing) where changes is True |
|
1228 | 1242 | if the working directory was changed, extchanges is |
|
1229 | 1243 | True if any of these changes concern an external entry and missing |
|
1230 | 1244 | is True if any change is a missing entry. |
|
1231 | 1245 | """ |
|
1232 | 1246 | output, err = self._svncommand(['status', '--xml']) |
|
1233 | 1247 | externals, changes, missing = [], [], [] |
|
1234 | 1248 | doc = xml.dom.minidom.parseString(output) |
|
1235 | 1249 | for e in doc.getElementsByTagName('entry'): |
|
1236 | 1250 | s = e.getElementsByTagName('wc-status') |
|
1237 | 1251 | if not s: |
|
1238 | 1252 | continue |
|
1239 | 1253 | item = s[0].getAttribute('item') |
|
1240 | 1254 | props = s[0].getAttribute('props') |
|
1241 | 1255 | path = e.getAttribute('path') |
|
1242 | 1256 | if item == 'external': |
|
1243 | 1257 | externals.append(path) |
|
1244 | 1258 | elif item == 'missing': |
|
1245 | 1259 | missing.append(path) |
|
1246 | 1260 | if (item not in ('', 'normal', 'unversioned', 'external') |
|
1247 | 1261 | or props not in ('', 'none', 'normal')): |
|
1248 | 1262 | changes.append(path) |
|
1249 | 1263 | for path in changes: |
|
1250 | 1264 | for ext in externals: |
|
1251 | 1265 | if path == ext or path.startswith(ext + pycompat.ossep): |
|
1252 | 1266 | return True, True, bool(missing) |
|
1253 | 1267 | return bool(changes), False, bool(missing) |
|
1254 | 1268 | |
|
1255 | 1269 | def dirty(self, ignoreupdate=False, missing=False): |
|
1256 | 1270 | wcchanged = self._wcchanged() |
|
1257 | 1271 | changed = wcchanged[0] or (missing and wcchanged[2]) |
|
1258 | 1272 | if not changed: |
|
1259 | 1273 | if self._state[1] in self._wcrevs() or ignoreupdate: |
|
1260 | 1274 | return False |
|
1261 | 1275 | return True |
|
1262 | 1276 | |
|
1263 | 1277 | def basestate(self): |
|
1264 | 1278 | lastrev, rev = self._wcrevs() |
|
1265 | 1279 | if lastrev != rev: |
|
1266 | 1280 | # Last committed rev is not the same than rev. We would |
|
1267 | 1281 | # like to take lastrev but we do not know if the subrepo |
|
1268 | 1282 | # URL exists at lastrev. Test it and fallback to rev it |
|
1269 | 1283 | # is not there. |
|
1270 | 1284 | try: |
|
1271 | 1285 | self._svncommand(['list', '%s@%s' % (self._state[0], lastrev)]) |
|
1272 | 1286 | return lastrev |
|
1273 | 1287 | except error.Abort: |
|
1274 | 1288 | pass |
|
1275 | 1289 | return rev |
|
1276 | 1290 | |
|
1277 | 1291 | @annotatesubrepoerror |
|
1278 | 1292 | def commit(self, text, user, date): |
|
1279 | 1293 | # user and date are out of our hands since svn is centralized |
|
1280 | 1294 | changed, extchanged, missing = self._wcchanged() |
|
1281 | 1295 | if not changed: |
|
1282 | 1296 | return self.basestate() |
|
1283 | 1297 | if extchanged: |
|
1284 | 1298 | # Do not try to commit externals |
|
1285 | 1299 | raise error.Abort(_('cannot commit svn externals')) |
|
1286 | 1300 | if missing: |
|
1287 | 1301 | # svn can commit with missing entries but aborting like hg |
|
1288 | 1302 | # seems a better approach. |
|
1289 | 1303 | raise error.Abort(_('cannot commit missing svn entries')) |
|
1290 | 1304 | commitinfo, err = self._svncommand(['commit', '-m', text]) |
|
1291 | 1305 | self.ui.status(commitinfo) |
|
1292 | 1306 | newrev = re.search('Committed revision ([0-9]+).', commitinfo) |
|
1293 | 1307 | if not newrev: |
|
1294 | 1308 | if not commitinfo.strip(): |
|
1295 | 1309 | # Sometimes, our definition of "changed" differs from |
|
1296 | 1310 | # svn one. For instance, svn ignores missing files |
|
1297 | 1311 | # when committing. If there are only missing files, no |
|
1298 | 1312 | # commit is made, no output and no error code. |
|
1299 | 1313 | raise error.Abort(_('failed to commit svn changes')) |
|
1300 | 1314 | raise error.Abort(commitinfo.splitlines()[-1]) |
|
1301 | 1315 | newrev = newrev.groups()[0] |
|
1302 | 1316 | self.ui.status(self._svncommand(['update', '-r', newrev])[0]) |
|
1303 | 1317 | return newrev |
|
1304 | 1318 | |
|
1305 | 1319 | @annotatesubrepoerror |
|
1306 | 1320 | def remove(self): |
|
1307 | 1321 | if self.dirty(): |
|
1308 | 1322 | self.ui.warn(_('not removing repo %s because ' |
|
1309 | 1323 | 'it has changes.\n') % self._path) |
|
1310 | 1324 | return |
|
1311 | 1325 | self.ui.note(_('removing subrepo %s\n') % self._path) |
|
1312 | 1326 | |
|
1313 | 1327 | self.wvfs.rmtree(forcibly=True) |
|
1314 | 1328 | try: |
|
1315 | 1329 | pwvfs = self._ctx.repo().wvfs |
|
1316 | 1330 | pwvfs.removedirs(pwvfs.dirname(self._path)) |
|
1317 | 1331 | except OSError: |
|
1318 | 1332 | pass |
|
1319 | 1333 | |
|
1320 | 1334 | @annotatesubrepoerror |
|
1321 | 1335 | def get(self, state, overwrite=False): |
|
1322 | 1336 | if overwrite: |
|
1323 | 1337 | self._svncommand(['revert', '--recursive']) |
|
1324 | 1338 | args = ['checkout'] |
|
1325 | 1339 | if self._svnversion >= (1, 5): |
|
1326 | 1340 | args.append('--force') |
|
1327 | 1341 | # The revision must be specified at the end of the URL to properly |
|
1328 | 1342 | # update to a directory which has since been deleted and recreated. |
|
1329 | 1343 | args.append('%s@%s' % (state[0], state[1])) |
|
1330 | 1344 | |
|
1331 | 1345 | # SEC: check that the ssh url is safe |
|
1332 | 1346 | util.checksafessh(state[0]) |
|
1333 | 1347 | |
|
1334 | 1348 | status, err = self._svncommand(args, failok=True) |
|
1335 | 1349 | _sanitize(self.ui, self.wvfs, '.svn') |
|
1336 | 1350 | if not re.search('Checked out revision [0-9]+.', status): |
|
1337 | 1351 | if ('is already a working copy for a different URL' in err |
|
1338 | 1352 | and (self._wcchanged()[:2] == (False, False))): |
|
1339 | 1353 | # obstructed but clean working copy, so just blow it away. |
|
1340 | 1354 | self.remove() |
|
1341 | 1355 | self.get(state, overwrite=False) |
|
1342 | 1356 | return |
|
1343 | 1357 | raise error.Abort((status or err).splitlines()[-1]) |
|
1344 | 1358 | self.ui.status(status) |
|
1345 | 1359 | |
|
1346 | 1360 | @annotatesubrepoerror |
|
1347 | 1361 | def merge(self, state): |
|
1348 | 1362 | old = self._state[1] |
|
1349 | 1363 | new = state[1] |
|
1350 | 1364 | wcrev = self._wcrev() |
|
1351 | 1365 | if new != wcrev: |
|
1352 | 1366 | dirty = old == wcrev or self._wcchanged()[0] |
|
1353 | 1367 | if _updateprompt(self.ui, self, dirty, wcrev, new): |
|
1354 | 1368 | self.get(state, False) |
|
1355 | 1369 | |
|
1356 | 1370 | def push(self, opts): |
|
1357 | 1371 | # push is a no-op for SVN |
|
1358 | 1372 | return True |
|
1359 | 1373 | |
|
1360 | 1374 | @annotatesubrepoerror |
|
1361 | 1375 | def files(self): |
|
1362 | 1376 | output = self._svncommand(['list', '--recursive', '--xml'])[0] |
|
1363 | 1377 | doc = xml.dom.minidom.parseString(output) |
|
1364 | 1378 | paths = [] |
|
1365 | 1379 | for e in doc.getElementsByTagName('entry'): |
|
1366 | 1380 | kind = str(e.getAttribute('kind')) |
|
1367 | 1381 | if kind != 'file': |
|
1368 | 1382 | continue |
|
1369 | 1383 | name = ''.join(c.data for c |
|
1370 | 1384 | in e.getElementsByTagName('name')[0].childNodes |
|
1371 | 1385 | if c.nodeType == c.TEXT_NODE) |
|
1372 | 1386 | paths.append(name.encode('utf-8')) |
|
1373 | 1387 | return paths |
|
1374 | 1388 | |
|
1375 | 1389 | def filedata(self, name, decode): |
|
1376 | 1390 | return self._svncommand(['cat'], name)[0] |
|
1377 | 1391 | |
|
1378 | 1392 | |
|
1379 | 1393 | class gitsubrepo(abstractsubrepo): |
|
1380 | 1394 | def __init__(self, ctx, path, state, allowcreate): |
|
1381 | 1395 | super(gitsubrepo, self).__init__(ctx, path) |
|
1382 | 1396 | self._state = state |
|
1383 | 1397 | self._abspath = ctx.repo().wjoin(path) |
|
1384 | 1398 | self._subparent = ctx.repo() |
|
1385 | 1399 | self._ensuregit() |
|
1386 | 1400 | |
|
1387 | 1401 | def _ensuregit(self): |
|
1388 | 1402 | try: |
|
1389 | 1403 | self._gitexecutable = 'git' |
|
1390 | 1404 | out, err = self._gitnodir(['--version']) |
|
1391 | 1405 | except OSError as e: |
|
1392 | 1406 | genericerror = _("error executing git for subrepo '%s': %s") |
|
1393 | 1407 | notfoundhint = _("check git is installed and in your PATH") |
|
1394 | 1408 | if e.errno != errno.ENOENT: |
|
1395 | 1409 | raise error.Abort(genericerror % ( |
|
1396 | 1410 | self._path, encoding.strtolocal(e.strerror))) |
|
1397 | 1411 | elif pycompat.iswindows: |
|
1398 | 1412 | try: |
|
1399 | 1413 | self._gitexecutable = 'git.cmd' |
|
1400 | 1414 | out, err = self._gitnodir(['--version']) |
|
1401 | 1415 | except OSError as e2: |
|
1402 | 1416 | if e2.errno == errno.ENOENT: |
|
1403 | 1417 | raise error.Abort(_("couldn't find 'git' or 'git.cmd'" |
|
1404 | 1418 | " for subrepo '%s'") % self._path, |
|
1405 | 1419 | hint=notfoundhint) |
|
1406 | 1420 | else: |
|
1407 | 1421 | raise error.Abort(genericerror % (self._path, |
|
1408 | 1422 | encoding.strtolocal(e2.strerror))) |
|
1409 | 1423 | else: |
|
1410 | 1424 | raise error.Abort(_("couldn't find git for subrepo '%s'") |
|
1411 | 1425 | % self._path, hint=notfoundhint) |
|
1412 | 1426 | versionstatus = self._checkversion(out) |
|
1413 | 1427 | if versionstatus == 'unknown': |
|
1414 | 1428 | self.ui.warn(_('cannot retrieve git version\n')) |
|
1415 | 1429 | elif versionstatus == 'abort': |
|
1416 | 1430 | raise error.Abort(_('git subrepo requires at least 1.6.0 or later')) |
|
1417 | 1431 | elif versionstatus == 'warning': |
|
1418 | 1432 | self.ui.warn(_('git subrepo requires at least 1.6.0 or later\n')) |
|
1419 | 1433 | |
|
1420 | 1434 | @staticmethod |
|
1421 | 1435 | def _gitversion(out): |
|
1422 | 1436 | m = re.search(br'^git version (\d+)\.(\d+)\.(\d+)', out) |
|
1423 | 1437 | if m: |
|
1424 | 1438 | return (int(m.group(1)), int(m.group(2)), int(m.group(3))) |
|
1425 | 1439 | |
|
1426 | 1440 | m = re.search(br'^git version (\d+)\.(\d+)', out) |
|
1427 | 1441 | if m: |
|
1428 | 1442 | return (int(m.group(1)), int(m.group(2)), 0) |
|
1429 | 1443 | |
|
1430 | 1444 | return -1 |
|
1431 | 1445 | |
|
1432 | 1446 | @staticmethod |
|
1433 | 1447 | def _checkversion(out): |
|
1434 | 1448 | '''ensure git version is new enough |
|
1435 | 1449 | |
|
1436 | 1450 | >>> _checkversion = gitsubrepo._checkversion |
|
1437 | 1451 | >>> _checkversion(b'git version 1.6.0') |
|
1438 | 1452 | 'ok' |
|
1439 | 1453 | >>> _checkversion(b'git version 1.8.5') |
|
1440 | 1454 | 'ok' |
|
1441 | 1455 | >>> _checkversion(b'git version 1.4.0') |
|
1442 | 1456 | 'abort' |
|
1443 | 1457 | >>> _checkversion(b'git version 1.5.0') |
|
1444 | 1458 | 'warning' |
|
1445 | 1459 | >>> _checkversion(b'git version 1.9-rc0') |
|
1446 | 1460 | 'ok' |
|
1447 | 1461 | >>> _checkversion(b'git version 1.9.0.265.g81cdec2') |
|
1448 | 1462 | 'ok' |
|
1449 | 1463 | >>> _checkversion(b'git version 1.9.0.GIT') |
|
1450 | 1464 | 'ok' |
|
1451 | 1465 | >>> _checkversion(b'git version 12345') |
|
1452 | 1466 | 'unknown' |
|
1453 | 1467 | >>> _checkversion(b'no') |
|
1454 | 1468 | 'unknown' |
|
1455 | 1469 | ''' |
|
1456 | 1470 | version = gitsubrepo._gitversion(out) |
|
1457 | 1471 | # git 1.4.0 can't work at all, but 1.5.X can in at least some cases, |
|
1458 | 1472 | # despite the docstring comment. For now, error on 1.4.0, warn on |
|
1459 | 1473 | # 1.5.0 but attempt to continue. |
|
1460 | 1474 | if version == -1: |
|
1461 | 1475 | return 'unknown' |
|
1462 | 1476 | if version < (1, 5, 0): |
|
1463 | 1477 | return 'abort' |
|
1464 | 1478 | elif version < (1, 6, 0): |
|
1465 | 1479 | return 'warning' |
|
1466 | 1480 | return 'ok' |
|
1467 | 1481 | |
|
1468 | 1482 | def _gitcommand(self, commands, env=None, stream=False): |
|
1469 | 1483 | return self._gitdir(commands, env=env, stream=stream)[0] |
|
1470 | 1484 | |
|
1471 | 1485 | def _gitdir(self, commands, env=None, stream=False): |
|
1472 | 1486 | return self._gitnodir(commands, env=env, stream=stream, |
|
1473 | 1487 | cwd=self._abspath) |
|
1474 | 1488 | |
|
1475 | 1489 | def _gitnodir(self, commands, env=None, stream=False, cwd=None): |
|
1476 | 1490 | """Calls the git command |
|
1477 | 1491 | |
|
1478 | 1492 | The methods tries to call the git command. versions prior to 1.6.0 |
|
1479 | 1493 | are not supported and very probably fail. |
|
1480 | 1494 | """ |
|
1481 | 1495 | self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands))) |
|
1482 | 1496 | if env is None: |
|
1483 | 1497 | env = encoding.environ.copy() |
|
1484 | 1498 | # disable localization for Git output (issue5176) |
|
1485 | 1499 | env['LC_ALL'] = 'C' |
|
1486 | 1500 | # fix for Git CVE-2015-7545 |
|
1487 | 1501 | if 'GIT_ALLOW_PROTOCOL' not in env: |
|
1488 | 1502 | env['GIT_ALLOW_PROTOCOL'] = 'file:git:http:https:ssh' |
|
1489 | 1503 | # unless ui.quiet is set, print git's stderr, |
|
1490 | 1504 | # which is mostly progress and useful info |
|
1491 | 1505 | errpipe = None |
|
1492 | 1506 | if self.ui.quiet: |
|
1493 | 1507 | errpipe = open(os.devnull, 'w') |
|
1494 | 1508 | if self.ui._colormode and len(commands) and commands[0] == "diff": |
|
1495 | 1509 | # insert the argument in the front, |
|
1496 | 1510 | # the end of git diff arguments is used for paths |
|
1497 | 1511 | commands.insert(1, '--color') |
|
1498 | 1512 | p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1, |
|
1499 | 1513 | cwd=cwd, env=env, close_fds=util.closefds, |
|
1500 | 1514 | stdout=subprocess.PIPE, stderr=errpipe) |
|
1501 | 1515 | if stream: |
|
1502 | 1516 | return p.stdout, None |
|
1503 | 1517 | |
|
1504 | 1518 | retdata = p.stdout.read().strip() |
|
1505 | 1519 | # wait for the child to exit to avoid race condition. |
|
1506 | 1520 | p.wait() |
|
1507 | 1521 | |
|
1508 | 1522 | if p.returncode != 0 and p.returncode != 1: |
|
1509 | 1523 | # there are certain error codes that are ok |
|
1510 | 1524 | command = commands[0] |
|
1511 | 1525 | if command in ('cat-file', 'symbolic-ref'): |
|
1512 | 1526 | return retdata, p.returncode |
|
1513 | 1527 | # for all others, abort |
|
1514 | 1528 | raise error.Abort(_('git %s error %d in %s') % |
|
1515 | 1529 | (command, p.returncode, self._relpath)) |
|
1516 | 1530 | |
|
1517 | 1531 | return retdata, p.returncode |
|
1518 | 1532 | |
|
1519 | 1533 | def _gitmissing(self): |
|
1520 | 1534 | return not self.wvfs.exists('.git') |
|
1521 | 1535 | |
|
1522 | 1536 | def _gitstate(self): |
|
1523 | 1537 | return self._gitcommand(['rev-parse', 'HEAD']) |
|
1524 | 1538 | |
|
1525 | 1539 | def _gitcurrentbranch(self): |
|
1526 | 1540 | current, err = self._gitdir(['symbolic-ref', 'HEAD', '--quiet']) |
|
1527 | 1541 | if err: |
|
1528 | 1542 | current = None |
|
1529 | 1543 | return current |
|
1530 | 1544 | |
|
1531 | 1545 | def _gitremote(self, remote): |
|
1532 | 1546 | out = self._gitcommand(['remote', 'show', '-n', remote]) |
|
1533 | 1547 | line = out.split('\n')[1] |
|
1534 | 1548 | i = line.index('URL: ') + len('URL: ') |
|
1535 | 1549 | return line[i:] |
|
1536 | 1550 | |
|
1537 | 1551 | def _githavelocally(self, revision): |
|
1538 | 1552 | out, code = self._gitdir(['cat-file', '-e', revision]) |
|
1539 | 1553 | return code == 0 |
|
1540 | 1554 | |
|
1541 | 1555 | def _gitisancestor(self, r1, r2): |
|
1542 | 1556 | base = self._gitcommand(['merge-base', r1, r2]) |
|
1543 | 1557 | return base == r1 |
|
1544 | 1558 | |
|
1545 | 1559 | def _gitisbare(self): |
|
1546 | 1560 | return self._gitcommand(['config', '--bool', 'core.bare']) == 'true' |
|
1547 | 1561 | |
|
1548 | 1562 | def _gitupdatestat(self): |
|
1549 | 1563 | """This must be run before git diff-index. |
|
1550 | 1564 | diff-index only looks at changes to file stat; |
|
1551 | 1565 | this command looks at file contents and updates the stat.""" |
|
1552 | 1566 | self._gitcommand(['update-index', '-q', '--refresh']) |
|
1553 | 1567 | |
|
1554 | 1568 | def _gitbranchmap(self): |
|
1555 | 1569 | '''returns 2 things: |
|
1556 | 1570 | a map from git branch to revision |
|
1557 | 1571 | a map from revision to branches''' |
|
1558 | 1572 | branch2rev = {} |
|
1559 | 1573 | rev2branch = {} |
|
1560 | 1574 | |
|
1561 | 1575 | out = self._gitcommand(['for-each-ref', '--format', |
|
1562 | 1576 | '%(objectname) %(refname)']) |
|
1563 | 1577 | for line in out.split('\n'): |
|
1564 | 1578 | revision, ref = line.split(' ') |
|
1565 | 1579 | if (not ref.startswith('refs/heads/') and |
|
1566 | 1580 | not ref.startswith('refs/remotes/')): |
|
1567 | 1581 | continue |
|
1568 | 1582 | if ref.startswith('refs/remotes/') and ref.endswith('/HEAD'): |
|
1569 | 1583 | continue # ignore remote/HEAD redirects |
|
1570 | 1584 | branch2rev[ref] = revision |
|
1571 | 1585 | rev2branch.setdefault(revision, []).append(ref) |
|
1572 | 1586 | return branch2rev, rev2branch |
|
1573 | 1587 | |
|
1574 | 1588 | def _gittracking(self, branches): |
|
1575 | 1589 | 'return map of remote branch to local tracking branch' |
|
1576 | 1590 | # assumes no more than one local tracking branch for each remote |
|
1577 | 1591 | tracking = {} |
|
1578 | 1592 | for b in branches: |
|
1579 | 1593 | if b.startswith('refs/remotes/'): |
|
1580 | 1594 | continue |
|
1581 | 1595 | bname = b.split('/', 2)[2] |
|
1582 | 1596 | remote = self._gitcommand(['config', 'branch.%s.remote' % bname]) |
|
1583 | 1597 | if remote: |
|
1584 | 1598 | ref = self._gitcommand(['config', 'branch.%s.merge' % bname]) |
|
1585 | 1599 | tracking['refs/remotes/%s/%s' % |
|
1586 | 1600 | (remote, ref.split('/', 2)[2])] = b |
|
1587 | 1601 | return tracking |
|
1588 | 1602 | |
|
1589 | 1603 | def _abssource(self, source): |
|
1590 | 1604 | if '://' not in source: |
|
1591 | 1605 | # recognize the scp syntax as an absolute source |
|
1592 | 1606 | colon = source.find(':') |
|
1593 | 1607 | if colon != -1 and '/' not in source[:colon]: |
|
1594 | 1608 | return source |
|
1595 | 1609 | self._subsource = source |
|
1596 | 1610 | return _abssource(self) |
|
1597 | 1611 | |
|
1598 | 1612 | def _fetch(self, source, revision): |
|
1599 | 1613 | if self._gitmissing(): |
|
1600 | 1614 | # SEC: check for safe ssh url |
|
1601 | 1615 | util.checksafessh(source) |
|
1602 | 1616 | |
|
1603 | 1617 | source = self._abssource(source) |
|
1604 | 1618 | self.ui.status(_('cloning subrepo %s from %s\n') % |
|
1605 | 1619 | (self._relpath, source)) |
|
1606 | 1620 | self._gitnodir(['clone', source, self._abspath]) |
|
1607 | 1621 | if self._githavelocally(revision): |
|
1608 | 1622 | return |
|
1609 | 1623 | self.ui.status(_('pulling subrepo %s from %s\n') % |
|
1610 | 1624 | (self._relpath, self._gitremote('origin'))) |
|
1611 | 1625 | # try only origin: the originally cloned repo |
|
1612 | 1626 | self._gitcommand(['fetch']) |
|
1613 | 1627 | if not self._githavelocally(revision): |
|
1614 | 1628 | raise error.Abort(_('revision %s does not exist in subrepository ' |
|
1615 | 1629 | '"%s"\n') % (revision, self._relpath)) |
|
1616 | 1630 | |
|
1617 | 1631 | @annotatesubrepoerror |
|
1618 | 1632 | def dirty(self, ignoreupdate=False, missing=False): |
|
1619 | 1633 | if self._gitmissing(): |
|
1620 | 1634 | return self._state[1] != '' |
|
1621 | 1635 | if self._gitisbare(): |
|
1622 | 1636 | return True |
|
1623 | 1637 | if not ignoreupdate and self._state[1] != self._gitstate(): |
|
1624 | 1638 | # different version checked out |
|
1625 | 1639 | return True |
|
1626 | 1640 | # check for staged changes or modified files; ignore untracked files |
|
1627 | 1641 | self._gitupdatestat() |
|
1628 | 1642 | out, code = self._gitdir(['diff-index', '--quiet', 'HEAD']) |
|
1629 | 1643 | return code == 1 |
|
1630 | 1644 | |
|
1631 | 1645 | def basestate(self): |
|
1632 | 1646 | return self._gitstate() |
|
1633 | 1647 | |
|
1634 | 1648 | @annotatesubrepoerror |
|
1635 | 1649 | def get(self, state, overwrite=False): |
|
1636 | 1650 | source, revision, kind = state |
|
1637 | 1651 | if not revision: |
|
1638 | 1652 | self.remove() |
|
1639 | 1653 | return |
|
1640 | 1654 | self._fetch(source, revision) |
|
1641 | 1655 | # if the repo was set to be bare, unbare it |
|
1642 | 1656 | if self._gitisbare(): |
|
1643 | 1657 | self._gitcommand(['config', 'core.bare', 'false']) |
|
1644 | 1658 | if self._gitstate() == revision: |
|
1645 | 1659 | self._gitcommand(['reset', '--hard', 'HEAD']) |
|
1646 | 1660 | return |
|
1647 | 1661 | elif self._gitstate() == revision: |
|
1648 | 1662 | if overwrite: |
|
1649 | 1663 | # first reset the index to unmark new files for commit, because |
|
1650 | 1664 | # reset --hard will otherwise throw away files added for commit, |
|
1651 | 1665 | # not just unmark them. |
|
1652 | 1666 | self._gitcommand(['reset', 'HEAD']) |
|
1653 | 1667 | self._gitcommand(['reset', '--hard', 'HEAD']) |
|
1654 | 1668 | return |
|
1655 | 1669 | branch2rev, rev2branch = self._gitbranchmap() |
|
1656 | 1670 | |
|
1657 | 1671 | def checkout(args): |
|
1658 | 1672 | cmd = ['checkout'] |
|
1659 | 1673 | if overwrite: |
|
1660 | 1674 | # first reset the index to unmark new files for commit, because |
|
1661 | 1675 | # the -f option will otherwise throw away files added for |
|
1662 | 1676 | # commit, not just unmark them. |
|
1663 | 1677 | self._gitcommand(['reset', 'HEAD']) |
|
1664 | 1678 | cmd.append('-f') |
|
1665 | 1679 | self._gitcommand(cmd + args) |
|
1666 | 1680 | _sanitize(self.ui, self.wvfs, '.git') |
|
1667 | 1681 | |
|
1668 | 1682 | def rawcheckout(): |
|
1669 | 1683 | # no branch to checkout, check it out with no branch |
|
1670 | 1684 | self.ui.warn(_('checking out detached HEAD in ' |
|
1671 | 1685 | 'subrepository "%s"\n') % self._relpath) |
|
1672 | 1686 | self.ui.warn(_('check out a git branch if you intend ' |
|
1673 | 1687 | 'to make changes\n')) |
|
1674 | 1688 | checkout(['-q', revision]) |
|
1675 | 1689 | |
|
1676 | 1690 | if revision not in rev2branch: |
|
1677 | 1691 | rawcheckout() |
|
1678 | 1692 | return |
|
1679 | 1693 | branches = rev2branch[revision] |
|
1680 | 1694 | firstlocalbranch = None |
|
1681 | 1695 | for b in branches: |
|
1682 | 1696 | if b == 'refs/heads/master': |
|
1683 | 1697 | # master trumps all other branches |
|
1684 | 1698 | checkout(['refs/heads/master']) |
|
1685 | 1699 | return |
|
1686 | 1700 | if not firstlocalbranch and not b.startswith('refs/remotes/'): |
|
1687 | 1701 | firstlocalbranch = b |
|
1688 | 1702 | if firstlocalbranch: |
|
1689 | 1703 | checkout([firstlocalbranch]) |
|
1690 | 1704 | return |
|
1691 | 1705 | |
|
1692 | 1706 | tracking = self._gittracking(branch2rev.keys()) |
|
1693 | 1707 | # choose a remote branch already tracked if possible |
|
1694 | 1708 | remote = branches[0] |
|
1695 | 1709 | if remote not in tracking: |
|
1696 | 1710 | for b in branches: |
|
1697 | 1711 | if b in tracking: |
|
1698 | 1712 | remote = b |
|
1699 | 1713 | break |
|
1700 | 1714 | |
|
1701 | 1715 | if remote not in tracking: |
|
1702 | 1716 | # create a new local tracking branch |
|
1703 | 1717 | local = remote.split('/', 3)[3] |
|
1704 | 1718 | checkout(['-b', local, remote]) |
|
1705 | 1719 | elif self._gitisancestor(branch2rev[tracking[remote]], remote): |
|
1706 | 1720 | # When updating to a tracked remote branch, |
|
1707 | 1721 | # if the local tracking branch is downstream of it, |
|
1708 | 1722 | # a normal `git pull` would have performed a "fast-forward merge" |
|
1709 | 1723 | # which is equivalent to updating the local branch to the remote. |
|
1710 | 1724 | # Since we are only looking at branching at update, we need to |
|
1711 | 1725 | # detect this situation and perform this action lazily. |
|
1712 | 1726 | if tracking[remote] != self._gitcurrentbranch(): |
|
1713 | 1727 | checkout([tracking[remote]]) |
|
1714 | 1728 | self._gitcommand(['merge', '--ff', remote]) |
|
1715 | 1729 | _sanitize(self.ui, self.wvfs, '.git') |
|
1716 | 1730 | else: |
|
1717 | 1731 | # a real merge would be required, just checkout the revision |
|
1718 | 1732 | rawcheckout() |
|
1719 | 1733 | |
|
1720 | 1734 | @annotatesubrepoerror |
|
1721 | 1735 | def commit(self, text, user, date): |
|
1722 | 1736 | if self._gitmissing(): |
|
1723 | 1737 | raise error.Abort(_("subrepo %s is missing") % self._relpath) |
|
1724 | 1738 | cmd = ['commit', '-a', '-m', text] |
|
1725 | 1739 | env = encoding.environ.copy() |
|
1726 | 1740 | if user: |
|
1727 | 1741 | cmd += ['--author', user] |
|
1728 | 1742 | if date: |
|
1729 | 1743 | # git's date parser silently ignores when seconds < 1e9 |
|
1730 | 1744 | # convert to ISO8601 |
|
1731 | 1745 | env['GIT_AUTHOR_DATE'] = util.datestr(date, |
|
1732 | 1746 | '%Y-%m-%dT%H:%M:%S %1%2') |
|
1733 | 1747 | self._gitcommand(cmd, env=env) |
|
1734 | 1748 | # make sure commit works otherwise HEAD might not exist under certain |
|
1735 | 1749 | # circumstances |
|
1736 | 1750 | return self._gitstate() |
|
1737 | 1751 | |
|
1738 | 1752 | @annotatesubrepoerror |
|
1739 | 1753 | def merge(self, state): |
|
1740 | 1754 | source, revision, kind = state |
|
1741 | 1755 | self._fetch(source, revision) |
|
1742 | 1756 | base = self._gitcommand(['merge-base', revision, self._state[1]]) |
|
1743 | 1757 | self._gitupdatestat() |
|
1744 | 1758 | out, code = self._gitdir(['diff-index', '--quiet', 'HEAD']) |
|
1745 | 1759 | |
|
1746 | 1760 | def mergefunc(): |
|
1747 | 1761 | if base == revision: |
|
1748 | 1762 | self.get(state) # fast forward merge |
|
1749 | 1763 | elif base != self._state[1]: |
|
1750 | 1764 | self._gitcommand(['merge', '--no-commit', revision]) |
|
1751 | 1765 | _sanitize(self.ui, self.wvfs, '.git') |
|
1752 | 1766 | |
|
1753 | 1767 | if self.dirty(): |
|
1754 | 1768 | if self._gitstate() != revision: |
|
1755 | 1769 | dirty = self._gitstate() == self._state[1] or code != 0 |
|
1756 | 1770 | if _updateprompt(self.ui, self, dirty, |
|
1757 | 1771 | self._state[1][:7], revision[:7]): |
|
1758 | 1772 | mergefunc() |
|
1759 | 1773 | else: |
|
1760 | 1774 | mergefunc() |
|
1761 | 1775 | |
|
1762 | 1776 | @annotatesubrepoerror |
|
1763 | 1777 | def push(self, opts): |
|
1764 | 1778 | force = opts.get('force') |
|
1765 | 1779 | |
|
1766 | 1780 | if not self._state[1]: |
|
1767 | 1781 | return True |
|
1768 | 1782 | if self._gitmissing(): |
|
1769 | 1783 | raise error.Abort(_("subrepo %s is missing") % self._relpath) |
|
1770 | 1784 | # if a branch in origin contains the revision, nothing to do |
|
1771 | 1785 | branch2rev, rev2branch = self._gitbranchmap() |
|
1772 | 1786 | if self._state[1] in rev2branch: |
|
1773 | 1787 | for b in rev2branch[self._state[1]]: |
|
1774 | 1788 | if b.startswith('refs/remotes/origin/'): |
|
1775 | 1789 | return True |
|
1776 | 1790 | for b, revision in branch2rev.iteritems(): |
|
1777 | 1791 | if b.startswith('refs/remotes/origin/'): |
|
1778 | 1792 | if self._gitisancestor(self._state[1], revision): |
|
1779 | 1793 | return True |
|
1780 | 1794 | # otherwise, try to push the currently checked out branch |
|
1781 | 1795 | cmd = ['push'] |
|
1782 | 1796 | if force: |
|
1783 | 1797 | cmd.append('--force') |
|
1784 | 1798 | |
|
1785 | 1799 | current = self._gitcurrentbranch() |
|
1786 | 1800 | if current: |
|
1787 | 1801 | # determine if the current branch is even useful |
|
1788 | 1802 | if not self._gitisancestor(self._state[1], current): |
|
1789 | 1803 | self.ui.warn(_('unrelated git branch checked out ' |
|
1790 | 1804 | 'in subrepository "%s"\n') % self._relpath) |
|
1791 | 1805 | return False |
|
1792 | 1806 | self.ui.status(_('pushing branch %s of subrepository "%s"\n') % |
|
1793 | 1807 | (current.split('/', 2)[2], self._relpath)) |
|
1794 | 1808 | ret = self._gitdir(cmd + ['origin', current]) |
|
1795 | 1809 | return ret[1] == 0 |
|
1796 | 1810 | else: |
|
1797 | 1811 | self.ui.warn(_('no branch checked out in subrepository "%s"\n' |
|
1798 | 1812 | 'cannot push revision %s\n') % |
|
1799 | 1813 | (self._relpath, self._state[1])) |
|
1800 | 1814 | return False |
|
1801 | 1815 | |
|
1802 | 1816 | @annotatesubrepoerror |
|
1803 | 1817 | def add(self, ui, match, prefix, explicitonly, **opts): |
|
1804 | 1818 | if self._gitmissing(): |
|
1805 | 1819 | return [] |
|
1806 | 1820 | |
|
1807 | 1821 | (modified, added, removed, |
|
1808 | 1822 | deleted, unknown, ignored, clean) = self.status(None, unknown=True, |
|
1809 | 1823 | clean=True) |
|
1810 | 1824 | |
|
1811 | 1825 | tracked = set() |
|
1812 | 1826 | # dirstates 'amn' warn, 'r' is added again |
|
1813 | 1827 | for l in (modified, added, deleted, clean): |
|
1814 | 1828 | tracked.update(l) |
|
1815 | 1829 | |
|
1816 | 1830 | # Unknown files not of interest will be rejected by the matcher |
|
1817 | 1831 | files = unknown |
|
1818 | 1832 | files.extend(match.files()) |
|
1819 | 1833 | |
|
1820 | 1834 | rejected = [] |
|
1821 | 1835 | |
|
1822 | 1836 | files = [f for f in sorted(set(files)) if match(f)] |
|
1823 | 1837 | for f in files: |
|
1824 | 1838 | exact = match.exact(f) |
|
1825 | 1839 | command = ["add"] |
|
1826 | 1840 | if exact: |
|
1827 | 1841 | command.append("-f") #should be added, even if ignored |
|
1828 | 1842 | if ui.verbose or not exact: |
|
1829 | 1843 | ui.status(_('adding %s\n') % match.rel(f)) |
|
1830 | 1844 | |
|
1831 | 1845 | if f in tracked: # hg prints 'adding' even if already tracked |
|
1832 | 1846 | if exact: |
|
1833 | 1847 | rejected.append(f) |
|
1834 | 1848 | continue |
|
1835 | 1849 | if not opts.get(r'dry_run'): |
|
1836 | 1850 | self._gitcommand(command + [f]) |
|
1837 | 1851 | |
|
1838 | 1852 | for f in rejected: |
|
1839 | 1853 | ui.warn(_("%s already tracked!\n") % match.abs(f)) |
|
1840 | 1854 | |
|
1841 | 1855 | return rejected |
|
1842 | 1856 | |
|
1843 | 1857 | @annotatesubrepoerror |
|
1844 | 1858 | def remove(self): |
|
1845 | 1859 | if self._gitmissing(): |
|
1846 | 1860 | return |
|
1847 | 1861 | if self.dirty(): |
|
1848 | 1862 | self.ui.warn(_('not removing repo %s because ' |
|
1849 | 1863 | 'it has changes.\n') % self._relpath) |
|
1850 | 1864 | return |
|
1851 | 1865 | # we can't fully delete the repository as it may contain |
|
1852 | 1866 | # local-only history |
|
1853 | 1867 | self.ui.note(_('removing subrepo %s\n') % self._relpath) |
|
1854 | 1868 | self._gitcommand(['config', 'core.bare', 'true']) |
|
1855 | 1869 | for f, kind in self.wvfs.readdir(): |
|
1856 | 1870 | if f == '.git': |
|
1857 | 1871 | continue |
|
1858 | 1872 | if kind == stat.S_IFDIR: |
|
1859 | 1873 | self.wvfs.rmtree(f) |
|
1860 | 1874 | else: |
|
1861 | 1875 | self.wvfs.unlink(f) |
|
1862 | 1876 | |
|
1863 | 1877 | def archive(self, archiver, prefix, match=None, decode=True): |
|
1864 | 1878 | total = 0 |
|
1865 | 1879 | source, revision = self._state |
|
1866 | 1880 | if not revision: |
|
1867 | 1881 | return total |
|
1868 | 1882 | self._fetch(source, revision) |
|
1869 | 1883 | |
|
1870 | 1884 | # Parse git's native archive command. |
|
1871 | 1885 | # This should be much faster than manually traversing the trees |
|
1872 | 1886 | # and objects with many subprocess calls. |
|
1873 | 1887 | tarstream = self._gitcommand(['archive', revision], stream=True) |
|
1874 | 1888 | tar = tarfile.open(fileobj=tarstream, mode='r|') |
|
1875 | 1889 | relpath = subrelpath(self) |
|
1876 | 1890 | self.ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files')) |
|
1877 | 1891 | for i, info in enumerate(tar): |
|
1878 | 1892 | if info.isdir(): |
|
1879 | 1893 | continue |
|
1880 | 1894 | if match and not match(info.name): |
|
1881 | 1895 | continue |
|
1882 | 1896 | if info.issym(): |
|
1883 | 1897 | data = info.linkname |
|
1884 | 1898 | else: |
|
1885 | 1899 | data = tar.extractfile(info).read() |
|
1886 | 1900 | archiver.addfile(prefix + self._path + '/' + info.name, |
|
1887 | 1901 | info.mode, info.issym(), data) |
|
1888 | 1902 | total += 1 |
|
1889 | 1903 | self.ui.progress(_('archiving (%s)') % relpath, i + 1, |
|
1890 | 1904 | unit=_('files')) |
|
1891 | 1905 | self.ui.progress(_('archiving (%s)') % relpath, None) |
|
1892 | 1906 | return total |
|
1893 | 1907 | |
|
1894 | 1908 | |
|
1895 | 1909 | @annotatesubrepoerror |
|
1896 | 1910 | def cat(self, match, fm, fntemplate, prefix, **opts): |
|
1897 | 1911 | rev = self._state[1] |
|
1898 | 1912 | if match.anypats(): |
|
1899 | 1913 | return 1 #No support for include/exclude yet |
|
1900 | 1914 | |
|
1901 | 1915 | if not match.files(): |
|
1902 | 1916 | return 1 |
|
1903 | 1917 | |
|
1904 | 1918 | # TODO: add support for non-plain formatter (see cmdutil.cat()) |
|
1905 | 1919 | for f in match.files(): |
|
1906 | 1920 | output = self._gitcommand(["show", "%s:%s" % (rev, f)]) |
|
1907 | 1921 | fp = cmdutil.makefileobj(self._subparent, fntemplate, |
|
1908 | 1922 | self._ctx.node(), |
|
1909 | 1923 | pathname=self.wvfs.reljoin(prefix, f)) |
|
1910 | 1924 | fp.write(output) |
|
1911 | 1925 | fp.close() |
|
1912 | 1926 | return 0 |
|
1913 | 1927 | |
|
1914 | 1928 | |
|
1915 | 1929 | @annotatesubrepoerror |
|
1916 | 1930 | def status(self, rev2, **opts): |
|
1917 | 1931 | rev1 = self._state[1] |
|
1918 | 1932 | if self._gitmissing() or not rev1: |
|
1919 | 1933 | # if the repo is missing, return no results |
|
1920 | 1934 | return scmutil.status([], [], [], [], [], [], []) |
|
1921 | 1935 | modified, added, removed = [], [], [] |
|
1922 | 1936 | self._gitupdatestat() |
|
1923 | 1937 | if rev2: |
|
1924 | 1938 | command = ['diff-tree', '--no-renames', '-r', rev1, rev2] |
|
1925 | 1939 | else: |
|
1926 | 1940 | command = ['diff-index', '--no-renames', rev1] |
|
1927 | 1941 | out = self._gitcommand(command) |
|
1928 | 1942 | for line in out.split('\n'): |
|
1929 | 1943 | tab = line.find('\t') |
|
1930 | 1944 | if tab == -1: |
|
1931 | 1945 | continue |
|
1932 | 1946 | status, f = line[tab - 1], line[tab + 1:] |
|
1933 | 1947 | if status == 'M': |
|
1934 | 1948 | modified.append(f) |
|
1935 | 1949 | elif status == 'A': |
|
1936 | 1950 | added.append(f) |
|
1937 | 1951 | elif status == 'D': |
|
1938 | 1952 | removed.append(f) |
|
1939 | 1953 | |
|
1940 | 1954 | deleted, unknown, ignored, clean = [], [], [], [] |
|
1941 | 1955 | |
|
1942 | 1956 | command = ['status', '--porcelain', '-z'] |
|
1943 | 1957 | if opts.get(r'unknown'): |
|
1944 | 1958 | command += ['--untracked-files=all'] |
|
1945 | 1959 | if opts.get(r'ignored'): |
|
1946 | 1960 | command += ['--ignored'] |
|
1947 | 1961 | out = self._gitcommand(command) |
|
1948 | 1962 | |
|
1949 | 1963 | changedfiles = set() |
|
1950 | 1964 | changedfiles.update(modified) |
|
1951 | 1965 | changedfiles.update(added) |
|
1952 | 1966 | changedfiles.update(removed) |
|
1953 | 1967 | for line in out.split('\0'): |
|
1954 | 1968 | if not line: |
|
1955 | 1969 | continue |
|
1956 | 1970 | st = line[0:2] |
|
1957 | 1971 | #moves and copies show 2 files on one line |
|
1958 | 1972 | if line.find('\0') >= 0: |
|
1959 | 1973 | filename1, filename2 = line[3:].split('\0') |
|
1960 | 1974 | else: |
|
1961 | 1975 | filename1 = line[3:] |
|
1962 | 1976 | filename2 = None |
|
1963 | 1977 | |
|
1964 | 1978 | changedfiles.add(filename1) |
|
1965 | 1979 | if filename2: |
|
1966 | 1980 | changedfiles.add(filename2) |
|
1967 | 1981 | |
|
1968 | 1982 | if st == '??': |
|
1969 | 1983 | unknown.append(filename1) |
|
1970 | 1984 | elif st == '!!': |
|
1971 | 1985 | ignored.append(filename1) |
|
1972 | 1986 | |
|
1973 | 1987 | if opts.get(r'clean'): |
|
1974 | 1988 | out = self._gitcommand(['ls-files']) |
|
1975 | 1989 | for f in out.split('\n'): |
|
1976 | 1990 | if not f in changedfiles: |
|
1977 | 1991 | clean.append(f) |
|
1978 | 1992 | |
|
1979 | 1993 | return scmutil.status(modified, added, removed, deleted, |
|
1980 | 1994 | unknown, ignored, clean) |
|
1981 | 1995 | |
|
1982 | 1996 | @annotatesubrepoerror |
|
1983 | 1997 | def diff(self, ui, diffopts, node2, match, prefix, **opts): |
|
1984 | 1998 | node1 = self._state[1] |
|
1985 | 1999 | cmd = ['diff', '--no-renames'] |
|
1986 | 2000 | if opts[r'stat']: |
|
1987 | 2001 | cmd.append('--stat') |
|
1988 | 2002 | else: |
|
1989 | 2003 | # for Git, this also implies '-p' |
|
1990 | 2004 | cmd.append('-U%d' % diffopts.context) |
|
1991 | 2005 | |
|
1992 | 2006 | gitprefix = self.wvfs.reljoin(prefix, self._path) |
|
1993 | 2007 | |
|
1994 | 2008 | if diffopts.noprefix: |
|
1995 | 2009 | cmd.extend(['--src-prefix=%s/' % gitprefix, |
|
1996 | 2010 | '--dst-prefix=%s/' % gitprefix]) |
|
1997 | 2011 | else: |
|
1998 | 2012 | cmd.extend(['--src-prefix=a/%s/' % gitprefix, |
|
1999 | 2013 | '--dst-prefix=b/%s/' % gitprefix]) |
|
2000 | 2014 | |
|
2001 | 2015 | if diffopts.ignorews: |
|
2002 | 2016 | cmd.append('--ignore-all-space') |
|
2003 | 2017 | if diffopts.ignorewsamount: |
|
2004 | 2018 | cmd.append('--ignore-space-change') |
|
2005 | 2019 | if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \ |
|
2006 | 2020 | and diffopts.ignoreblanklines: |
|
2007 | 2021 | cmd.append('--ignore-blank-lines') |
|
2008 | 2022 | |
|
2009 | 2023 | cmd.append(node1) |
|
2010 | 2024 | if node2: |
|
2011 | 2025 | cmd.append(node2) |
|
2012 | 2026 | |
|
2013 | 2027 | output = "" |
|
2014 | 2028 | if match.always(): |
|
2015 | 2029 | output += self._gitcommand(cmd) + '\n' |
|
2016 | 2030 | else: |
|
2017 | 2031 | st = self.status(node2)[:3] |
|
2018 | 2032 | files = [f for sublist in st for f in sublist] |
|
2019 | 2033 | for f in files: |
|
2020 | 2034 | if match(f): |
|
2021 | 2035 | output += self._gitcommand(cmd + ['--', f]) + '\n' |
|
2022 | 2036 | |
|
2023 | 2037 | if output.strip(): |
|
2024 | 2038 | ui.write(output) |
|
2025 | 2039 | |
|
2026 | 2040 | @annotatesubrepoerror |
|
2027 | 2041 | def revert(self, substate, *pats, **opts): |
|
2028 | 2042 | self.ui.status(_('reverting subrepo %s\n') % substate[0]) |
|
2029 | 2043 | if not opts.get(r'no_backup'): |
|
2030 | 2044 | status = self.status(None) |
|
2031 | 2045 | names = status.modified |
|
2032 | 2046 | for name in names: |
|
2033 | 2047 | bakname = scmutil.origpath(self.ui, self._subparent, name) |
|
2034 | 2048 | self.ui.note(_('saving current version of %s as %s\n') % |
|
2035 | 2049 | (name, bakname)) |
|
2036 | 2050 | self.wvfs.rename(name, bakname) |
|
2037 | 2051 | |
|
2038 | 2052 | if not opts.get(r'dry_run'): |
|
2039 | 2053 | self.get(substate, overwrite=True) |
|
2040 | 2054 | return [] |
|
2041 | 2055 | |
|
2042 | 2056 | def shortid(self, revid): |
|
2043 | 2057 | return revid[:7] |
|
2044 | 2058 | |
|
2045 | 2059 | types = { |
|
2046 | 2060 | 'hg': hgsubrepo, |
|
2047 | 2061 | 'svn': svnsubrepo, |
|
2048 | 2062 | 'git': gitsubrepo, |
|
2049 | 2063 | } |
@@ -1,1171 +1,1171 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | 3 | $ echo "[core]" >> $HOME/.gitconfig |
|
4 | 4 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
5 | 5 | $ echo "[core]" >> $HOME/.gitconfig |
|
6 | 6 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
7 | 7 | $ echo "[extensions]" >> $HGRCPATH |
|
8 | 8 | $ echo "convert=" >> $HGRCPATH |
|
9 | 9 | $ cat >> $HGRCPATH <<EOF |
|
10 | 10 | > [subrepos] |
|
11 |
> allowed = |
|
|
11 | > git:allowed = true | |
|
12 | 12 | > EOF |
|
13 | 13 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
14 | 14 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
15 | 15 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE |
|
16 | 16 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
17 | 17 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
18 | 18 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
19 | 19 | $ INVALIDID1=afd12345af |
|
20 | 20 | $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86 |
|
21 | 21 | $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357 |
|
22 | 22 | $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da |
|
23 | 23 | $ count=10 |
|
24 | 24 | $ commit() |
|
25 | 25 | > { |
|
26 | 26 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
27 | 27 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
28 | 28 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" |
|
29 | 29 | > count=`expr $count + 1` |
|
30 | 30 | > } |
|
31 | 31 | $ mkdir git-repo |
|
32 | 32 | $ cd git-repo |
|
33 | 33 | $ git init-db >/dev/null 2>/dev/null |
|
34 | 34 | $ echo a > a |
|
35 | 35 | $ mkdir d |
|
36 | 36 | $ echo b > d/b |
|
37 | 37 | $ git add a d |
|
38 | 38 | $ commit -a -m t1 |
|
39 | 39 | |
|
40 | 40 | Remove the directory, then try to replace it with a file (issue754) |
|
41 | 41 | |
|
42 | 42 | $ git rm -f d/b |
|
43 | 43 | rm 'd/b' |
|
44 | 44 | $ commit -m t2 |
|
45 | 45 | $ echo d > d |
|
46 | 46 | $ git add d |
|
47 | 47 | $ commit -m t3 |
|
48 | 48 | $ echo b >> a |
|
49 | 49 | $ commit -a -m t4.1 |
|
50 | 50 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null |
|
51 | 51 | $ echo c > a |
|
52 | 52 | $ echo a >> a |
|
53 | 53 | $ commit -a -m t4.2 |
|
54 | 54 | $ git checkout master >/dev/null 2>/dev/null |
|
55 | 55 | $ git pull --no-commit . other > /dev/null 2>/dev/null |
|
56 | 56 | $ commit -m 'Merge branch other' |
|
57 | 57 | $ cd .. |
|
58 | 58 | $ hg convert --config extensions.progress= --config progress.assume-tty=1 \ |
|
59 | 59 | > --config progress.delay=0 --config progress.changedelay=0 \ |
|
60 | 60 | > --config progress.refresh=0 --config progress.width=60 \ |
|
61 | 61 | > --config progress.format='topic, bar, number' --datesort git-repo |
|
62 | 62 | \r (no-eol) (esc) |
|
63 | 63 | scanning [======> ] 1/6\r (no-eol) (esc) |
|
64 | 64 | scanning [=============> ] 2/6\r (no-eol) (esc) |
|
65 | 65 | scanning [=====================> ] 3/6\r (no-eol) (esc) |
|
66 | 66 | scanning [============================> ] 4/6\r (no-eol) (esc) |
|
67 | 67 | scanning [===================================> ] 5/6\r (no-eol) (esc) |
|
68 | 68 | scanning [===========================================>] 6/6\r (no-eol) (esc) |
|
69 | 69 | \r (no-eol) (esc) |
|
70 | 70 | \r (no-eol) (esc) |
|
71 | 71 | converting [ ] 0/6\r (no-eol) (esc) |
|
72 | 72 | getting files [==================> ] 1/2\r (no-eol) (esc) |
|
73 | 73 | getting files [======================================>] 2/2\r (no-eol) (esc) |
|
74 | 74 | \r (no-eol) (esc) |
|
75 | 75 | \r (no-eol) (esc) |
|
76 | 76 | converting [======> ] 1/6\r (no-eol) (esc) |
|
77 | 77 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
78 | 78 | \r (no-eol) (esc) |
|
79 | 79 | \r (no-eol) (esc) |
|
80 | 80 | converting [=============> ] 2/6\r (no-eol) (esc) |
|
81 | 81 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
82 | 82 | \r (no-eol) (esc) |
|
83 | 83 | \r (no-eol) (esc) |
|
84 | 84 | converting [====================> ] 3/6\r (no-eol) (esc) |
|
85 | 85 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
86 | 86 | \r (no-eol) (esc) |
|
87 | 87 | \r (no-eol) (esc) |
|
88 | 88 | converting [===========================> ] 4/6\r (no-eol) (esc) |
|
89 | 89 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
90 | 90 | \r (no-eol) (esc) |
|
91 | 91 | \r (no-eol) (esc) |
|
92 | 92 | converting [==================================> ] 5/6\r (no-eol) (esc) |
|
93 | 93 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
94 | 94 | \r (no-eol) (esc) |
|
95 | 95 | assuming destination git-repo-hg |
|
96 | 96 | initializing destination git-repo-hg repository |
|
97 | 97 | scanning source... |
|
98 | 98 | sorting... |
|
99 | 99 | converting... |
|
100 | 100 | 5 t1 |
|
101 | 101 | 4 t2 |
|
102 | 102 | 3 t3 |
|
103 | 103 | 2 t4.1 |
|
104 | 104 | 1 t4.2 |
|
105 | 105 | 0 Merge branch other |
|
106 | 106 | updating bookmarks |
|
107 | 107 | $ hg up -q -R git-repo-hg |
|
108 | 108 | $ hg -R git-repo-hg tip -v |
|
109 | 109 | changeset: 5:c78094926be2 |
|
110 | 110 | bookmark: master |
|
111 | 111 | tag: tip |
|
112 | 112 | parent: 3:f5f5cb45432b |
|
113 | 113 | parent: 4:4e174f80c67c |
|
114 | 114 | user: test <test@example.org> |
|
115 | 115 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
116 | 116 | files: a |
|
117 | 117 | description: |
|
118 | 118 | Merge branch other |
|
119 | 119 | |
|
120 | 120 | |
|
121 | 121 | $ count=10 |
|
122 | 122 | $ mkdir git-repo2 |
|
123 | 123 | $ cd git-repo2 |
|
124 | 124 | $ git init-db >/dev/null 2>/dev/null |
|
125 | 125 | $ echo foo > foo |
|
126 | 126 | $ git add foo |
|
127 | 127 | $ commit -a -m 'add foo' |
|
128 | 128 | $ echo >> foo |
|
129 | 129 | $ commit -a -m 'change foo' |
|
130 | 130 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null |
|
131 | 131 | $ echo quux >> quux |
|
132 | 132 | $ git add quux |
|
133 | 133 | $ commit -a -m 'add quux' |
|
134 | 134 | $ echo bar > bar |
|
135 | 135 | $ git add bar |
|
136 | 136 | $ commit -a -m 'add bar' |
|
137 | 137 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null |
|
138 | 138 | $ echo baz > baz |
|
139 | 139 | $ git add baz |
|
140 | 140 | $ commit -a -m 'add baz' |
|
141 | 141 | $ git checkout master >/dev/null 2>/dev/null |
|
142 | 142 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null |
|
143 | 143 | $ commit -m 'Octopus merge' |
|
144 | 144 | $ echo bar >> bar |
|
145 | 145 | $ commit -a -m 'change bar' |
|
146 | 146 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null |
|
147 | 147 | $ echo >> foo |
|
148 | 148 | $ commit -a -m 'change foo' |
|
149 | 149 | $ git checkout master >/dev/null 2>/dev/null |
|
150 | 150 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null |
|
151 | 151 | $ commit -m 'Discard change to foo' |
|
152 | 152 | $ cd .. |
|
153 | 153 | $ glog() |
|
154 | 154 | > { |
|
155 | 155 | > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
156 | 156 | > } |
|
157 | 157 | $ splitrepo() |
|
158 | 158 | > { |
|
159 | 159 | > msg="$1" |
|
160 | 160 | > files="$2" |
|
161 | 161 | > opts=$3 |
|
162 | 162 | > echo "% $files: $msg" |
|
163 | 163 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
164 | 164 | > fmap="$prefix.fmap" |
|
165 | 165 | > repo="$prefix.repo" |
|
166 | 166 | > for i in $files; do |
|
167 | 167 | > echo "include $i" >> "$fmap" |
|
168 | 168 | > done |
|
169 | 169 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
170 | 170 | > hg up -q -R "$repo" |
|
171 | 171 | > glog -R "$repo" |
|
172 | 172 | > hg -R "$repo" manifest --debug |
|
173 | 173 | > } |
|
174 | 174 | |
|
175 | 175 | full conversion |
|
176 | 176 | |
|
177 | 177 | $ hg convert --datesort git-repo2 fullrepo \ |
|
178 | 178 | > --config extensions.progress= --config progress.assume-tty=1 \ |
|
179 | 179 | > --config progress.delay=0 --config progress.changedelay=0 \ |
|
180 | 180 | > --config progress.refresh=0 --config progress.width=60 \ |
|
181 | 181 | > --config progress.format='topic, bar, number' |
|
182 | 182 | \r (no-eol) (esc) |
|
183 | 183 | scanning [===> ] 1/9\r (no-eol) (esc) |
|
184 | 184 | scanning [========> ] 2/9\r (no-eol) (esc) |
|
185 | 185 | scanning [=============> ] 3/9\r (no-eol) (esc) |
|
186 | 186 | scanning [==================> ] 4/9\r (no-eol) (esc) |
|
187 | 187 | scanning [=======================> ] 5/9\r (no-eol) (esc) |
|
188 | 188 | scanning [============================> ] 6/9\r (no-eol) (esc) |
|
189 | 189 | scanning [=================================> ] 7/9\r (no-eol) (esc) |
|
190 | 190 | scanning [======================================> ] 8/9\r (no-eol) (esc) |
|
191 | 191 | scanning [===========================================>] 9/9\r (no-eol) (esc) |
|
192 | 192 | \r (no-eol) (esc) |
|
193 | 193 | \r (no-eol) (esc) |
|
194 | 194 | converting [ ] 0/9\r (no-eol) (esc) |
|
195 | 195 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
196 | 196 | \r (no-eol) (esc) |
|
197 | 197 | \r (no-eol) (esc) |
|
198 | 198 | converting [===> ] 1/9\r (no-eol) (esc) |
|
199 | 199 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
200 | 200 | \r (no-eol) (esc) |
|
201 | 201 | \r (no-eol) (esc) |
|
202 | 202 | converting [========> ] 2/9\r (no-eol) (esc) |
|
203 | 203 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
204 | 204 | \r (no-eol) (esc) |
|
205 | 205 | \r (no-eol) (esc) |
|
206 | 206 | converting [=============> ] 3/9\r (no-eol) (esc) |
|
207 | 207 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
208 | 208 | \r (no-eol) (esc) |
|
209 | 209 | \r (no-eol) (esc) |
|
210 | 210 | converting [=================> ] 4/9\r (no-eol) (esc) |
|
211 | 211 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
212 | 212 | \r (no-eol) (esc) |
|
213 | 213 | \r (no-eol) (esc) |
|
214 | 214 | converting [======================> ] 5/9\r (no-eol) (esc) |
|
215 | 215 | getting files [===> ] 1/8\r (no-eol) (esc) |
|
216 | 216 | getting files [========> ] 2/8\r (no-eol) (esc) |
|
217 | 217 | getting files [=============> ] 3/8\r (no-eol) (esc) |
|
218 | 218 | getting files [==================> ] 4/8\r (no-eol) (esc) |
|
219 | 219 | getting files [=======================> ] 5/8\r (no-eol) (esc) |
|
220 | 220 | getting files [============================> ] 6/8\r (no-eol) (esc) |
|
221 | 221 | getting files [=================================> ] 7/8\r (no-eol) (esc) |
|
222 | 222 | getting files [======================================>] 8/8\r (no-eol) (esc) |
|
223 | 223 | \r (no-eol) (esc) |
|
224 | 224 | \r (no-eol) (esc) |
|
225 | 225 | converting [===========================> ] 6/9\r (no-eol) (esc) |
|
226 | 226 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
227 | 227 | \r (no-eol) (esc) |
|
228 | 228 | \r (no-eol) (esc) |
|
229 | 229 | converting [===============================> ] 7/9\r (no-eol) (esc) |
|
230 | 230 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
231 | 231 | \r (no-eol) (esc) |
|
232 | 232 | \r (no-eol) (esc) |
|
233 | 233 | converting [====================================> ] 8/9\r (no-eol) (esc) |
|
234 | 234 | getting files [==================> ] 1/2\r (no-eol) (esc) |
|
235 | 235 | getting files [======================================>] 2/2\r (no-eol) (esc) |
|
236 | 236 | \r (no-eol) (esc) |
|
237 | 237 | initializing destination fullrepo repository |
|
238 | 238 | scanning source... |
|
239 | 239 | sorting... |
|
240 | 240 | converting... |
|
241 | 241 | 8 add foo |
|
242 | 242 | 7 change foo |
|
243 | 243 | 6 add quux |
|
244 | 244 | 5 add bar |
|
245 | 245 | 4 add baz |
|
246 | 246 | 3 Octopus merge |
|
247 | 247 | 2 change bar |
|
248 | 248 | 1 change foo |
|
249 | 249 | 0 Discard change to foo |
|
250 | 250 | updating bookmarks |
|
251 | 251 | $ hg up -q -R fullrepo |
|
252 | 252 | $ glog -R fullrepo |
|
253 | 253 | @ 9 "Discard change to foo" files: foo |
|
254 | 254 | |\ |
|
255 | 255 | | o 8 "change foo" files: foo |
|
256 | 256 | | | |
|
257 | 257 | o | 7 "change bar" files: bar |
|
258 | 258 | |/ |
|
259 | 259 | o 6 "(octopus merge fixup)" files: |
|
260 | 260 | |\ |
|
261 | 261 | | o 5 "Octopus merge" files: baz |
|
262 | 262 | | |\ |
|
263 | 263 | o | | 4 "add baz" files: baz |
|
264 | 264 | | | | |
|
265 | 265 | +---o 3 "add bar" files: bar |
|
266 | 266 | | | |
|
267 | 267 | o | 2 "add quux" files: quux |
|
268 | 268 | | | |
|
269 | 269 | | o 1 "change foo" files: foo |
|
270 | 270 | |/ |
|
271 | 271 | o 0 "add foo" files: foo |
|
272 | 272 | |
|
273 | 273 | $ hg -R fullrepo manifest --debug |
|
274 | 274 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
275 | 275 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
276 | 276 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
277 | 277 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
278 | 278 | $ splitrepo 'octopus merge' 'foo bar baz' |
|
279 | 279 | % foo bar baz: octopus merge |
|
280 | 280 | @ 8 "Discard change to foo" files: foo |
|
281 | 281 | |\ |
|
282 | 282 | | o 7 "change foo" files: foo |
|
283 | 283 | | | |
|
284 | 284 | o | 6 "change bar" files: bar |
|
285 | 285 | |/ |
|
286 | 286 | o 5 "(octopus merge fixup)" files: |
|
287 | 287 | |\ |
|
288 | 288 | | o 4 "Octopus merge" files: baz |
|
289 | 289 | | |\ |
|
290 | 290 | o | | 3 "add baz" files: baz |
|
291 | 291 | | | | |
|
292 | 292 | +---o 2 "add bar" files: bar |
|
293 | 293 | | | |
|
294 | 294 | | o 1 "change foo" files: foo |
|
295 | 295 | |/ |
|
296 | 296 | o 0 "add foo" files: foo |
|
297 | 297 | |
|
298 | 298 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
299 | 299 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
300 | 300 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
301 | 301 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
302 | 302 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
303 | 303 | @ 6 "Discard change to foo" files: foo |
|
304 | 304 | | |
|
305 | 305 | o 5 "change foo" files: foo |
|
306 | 306 | | |
|
307 | 307 | o 4 "Octopus merge" files: |
|
308 | 308 | |\ |
|
309 | 309 | | o 3 "add baz" files: baz |
|
310 | 310 | | | |
|
311 | 311 | | o 2 "add quux" files: quux |
|
312 | 312 | | | |
|
313 | 313 | o | 1 "change foo" files: foo |
|
314 | 314 | |/ |
|
315 | 315 | o 0 "add foo" files: foo |
|
316 | 316 | |
|
317 | 317 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
318 | 318 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
319 | 319 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
320 | 320 | |
|
321 | 321 | test importing git renames and copies |
|
322 | 322 | |
|
323 | 323 | $ cd git-repo2 |
|
324 | 324 | $ git mv foo foo-renamed |
|
325 | 325 | since bar is not touched in this commit, this copy will not be detected |
|
326 | 326 | $ cp bar bar-copied |
|
327 | 327 | $ cp baz baz-copied |
|
328 | 328 | $ cp baz baz-copied2 |
|
329 | 329 | $ cp baz ba-copy |
|
330 | 330 | $ echo baz2 >> baz |
|
331 | 331 | $ git add bar-copied baz-copied baz-copied2 ba-copy |
|
332 | 332 | $ commit -a -m 'rename and copy' |
|
333 | 333 | $ cd .. |
|
334 | 334 | |
|
335 | 335 | input validation |
|
336 | 336 | $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo |
|
337 | 337 | abort: convert.git.similarity is not a valid integer ('foo') |
|
338 | 338 | [255] |
|
339 | 339 | $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo |
|
340 | 340 | abort: similarity must be between 0 and 100 |
|
341 | 341 | [255] |
|
342 | 342 | $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo |
|
343 | 343 | abort: similarity must be between 0 and 100 |
|
344 | 344 | [255] |
|
345 | 345 | |
|
346 | 346 | $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo |
|
347 | 347 | $ hg -R fullrepo status -C --change master |
|
348 | 348 | M baz |
|
349 | 349 | A ba-copy |
|
350 | 350 | baz |
|
351 | 351 | A bar-copied |
|
352 | 352 | A baz-copied |
|
353 | 353 | baz |
|
354 | 354 | A baz-copied2 |
|
355 | 355 | baz |
|
356 | 356 | A foo-renamed |
|
357 | 357 | foo |
|
358 | 358 | R foo |
|
359 | 359 | |
|
360 | 360 | Ensure that the modification to the copy source was preserved |
|
361 | 361 | (there was a bug where if the copy dest was alphabetically prior to the copy |
|
362 | 362 | source, the copy source took the contents of the copy dest) |
|
363 | 363 | $ hg cat -r tip fullrepo/baz |
|
364 | 364 | baz |
|
365 | 365 | baz2 |
|
366 | 366 | |
|
367 | 367 | $ cd git-repo2 |
|
368 | 368 | $ echo bar2 >> bar |
|
369 | 369 | $ commit -a -m 'change bar' |
|
370 | 370 | $ cp bar bar-copied2 |
|
371 | 371 | $ git add bar-copied2 |
|
372 | 372 | $ commit -a -m 'copy with no changes' |
|
373 | 373 | $ cd .. |
|
374 | 374 | |
|
375 | 375 | $ hg -q convert --config convert.git.similarity=100 \ |
|
376 | 376 | > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo |
|
377 | 377 | $ hg -R fullrepo status -C --change master |
|
378 | 378 | A bar-copied2 |
|
379 | 379 | bar |
|
380 | 380 | |
|
381 | 381 | renamelimit config option works |
|
382 | 382 | |
|
383 | 383 | $ cd git-repo2 |
|
384 | 384 | $ cat >> copy-source << EOF |
|
385 | 385 | > sc0 |
|
386 | 386 | > sc1 |
|
387 | 387 | > sc2 |
|
388 | 388 | > sc3 |
|
389 | 389 | > sc4 |
|
390 | 390 | > sc5 |
|
391 | 391 | > sc6 |
|
392 | 392 | > EOF |
|
393 | 393 | $ git add copy-source |
|
394 | 394 | $ commit -m 'add copy-source' |
|
395 | 395 | $ cp copy-source source-copy0 |
|
396 | 396 | $ echo 0 >> source-copy0 |
|
397 | 397 | $ cp copy-source source-copy1 |
|
398 | 398 | $ echo 1 >> source-copy1 |
|
399 | 399 | $ git add source-copy0 source-copy1 |
|
400 | 400 | $ commit -a -m 'copy copy-source 2 times' |
|
401 | 401 | $ cd .. |
|
402 | 402 | |
|
403 | 403 | $ hg -q convert --config convert.git.renamelimit=1 \ |
|
404 | 404 | > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2 |
|
405 | 405 | $ hg -R fullrepo2 status -C --change master |
|
406 | 406 | A source-copy0 |
|
407 | 407 | A source-copy1 |
|
408 | 408 | |
|
409 | 409 | $ hg -q convert --config convert.git.renamelimit=100 \ |
|
410 | 410 | > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3 |
|
411 | 411 | $ hg -R fullrepo3 status -C --change master |
|
412 | 412 | A source-copy0 |
|
413 | 413 | copy-source |
|
414 | 414 | A source-copy1 |
|
415 | 415 | copy-source |
|
416 | 416 | |
|
417 | 417 | test binary conversion (issue1359) |
|
418 | 418 | |
|
419 | 419 | $ count=19 |
|
420 | 420 | $ mkdir git-repo3 |
|
421 | 421 | $ cd git-repo3 |
|
422 | 422 | $ git init-db >/dev/null 2>/dev/null |
|
423 | 423 | $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' |
|
424 | 424 | $ git add b |
|
425 | 425 | $ commit -a -m addbinary |
|
426 | 426 | $ cd .. |
|
427 | 427 | |
|
428 | 428 | convert binary file |
|
429 | 429 | |
|
430 | 430 | $ hg convert git-repo3 git-repo3-hg |
|
431 | 431 | initializing destination git-repo3-hg repository |
|
432 | 432 | scanning source... |
|
433 | 433 | sorting... |
|
434 | 434 | converting... |
|
435 | 435 | 0 addbinary |
|
436 | 436 | updating bookmarks |
|
437 | 437 | $ cd git-repo3-hg |
|
438 | 438 | $ hg up -C |
|
439 | 439 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
440 | 440 | $ $PYTHON -c 'print len(file("b", "rb").read())' |
|
441 | 441 | 4096 |
|
442 | 442 | $ cd .. |
|
443 | 443 | |
|
444 | 444 | test author vs committer |
|
445 | 445 | |
|
446 | 446 | $ mkdir git-repo4 |
|
447 | 447 | $ cd git-repo4 |
|
448 | 448 | $ git init-db >/dev/null 2>/dev/null |
|
449 | 449 | $ echo >> foo |
|
450 | 450 | $ git add foo |
|
451 | 451 | $ commit -a -m addfoo |
|
452 | 452 | $ echo >> foo |
|
453 | 453 | $ GIT_AUTHOR_NAME="nottest" |
|
454 | 454 | $ commit -a -m addfoo2 |
|
455 | 455 | $ cd .. |
|
456 | 456 | |
|
457 | 457 | convert author committer |
|
458 | 458 | |
|
459 | 459 | $ hg convert git-repo4 git-repo4-hg |
|
460 | 460 | initializing destination git-repo4-hg repository |
|
461 | 461 | scanning source... |
|
462 | 462 | sorting... |
|
463 | 463 | converting... |
|
464 | 464 | 1 addfoo |
|
465 | 465 | 0 addfoo2 |
|
466 | 466 | updating bookmarks |
|
467 | 467 | $ hg -R git-repo4-hg log -v |
|
468 | 468 | changeset: 1:d63e967f93da |
|
469 | 469 | bookmark: master |
|
470 | 470 | tag: tip |
|
471 | 471 | user: nottest <test@example.org> |
|
472 | 472 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
473 | 473 | files: foo |
|
474 | 474 | description: |
|
475 | 475 | addfoo2 |
|
476 | 476 | |
|
477 | 477 | committer: test <test@example.org> |
|
478 | 478 | |
|
479 | 479 | |
|
480 | 480 | changeset: 0:0735477b0224 |
|
481 | 481 | user: test <test@example.org> |
|
482 | 482 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
483 | 483 | files: foo |
|
484 | 484 | description: |
|
485 | 485 | addfoo |
|
486 | 486 | |
|
487 | 487 | |
|
488 | 488 | |
|
489 | 489 | Various combinations of committeractions fail |
|
490 | 490 | |
|
491 | 491 | $ hg --config convert.git.committeractions=messagedifferent,messagealways convert git-repo4 bad-committer |
|
492 | 492 | initializing destination bad-committer repository |
|
493 | 493 | abort: committeractions cannot define both messagedifferent and messagealways |
|
494 | 494 | [255] |
|
495 | 495 | |
|
496 | 496 | $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer |
|
497 | 497 | initializing destination bad-committer repository |
|
498 | 498 | abort: committeractions cannot define both dropcommitter and replaceauthor |
|
499 | 499 | [255] |
|
500 | 500 | |
|
501 | 501 | $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer |
|
502 | 502 | initializing destination bad-committer repository |
|
503 | 503 | abort: committeractions cannot define both dropcommitter and messagealways |
|
504 | 504 | [255] |
|
505 | 505 | |
|
506 | 506 | custom prefix on messagedifferent works |
|
507 | 507 | |
|
508 | 508 | $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix |
|
509 | 509 | initializing destination git-repo4-hg-messagedifferentprefix repository |
|
510 | 510 | scanning source... |
|
511 | 511 | sorting... |
|
512 | 512 | converting... |
|
513 | 513 | 1 addfoo |
|
514 | 514 | 0 addfoo2 |
|
515 | 515 | updating bookmarks |
|
516 | 516 | |
|
517 | 517 | $ hg -R git-repo4-hg-messagedifferentprefix log -v |
|
518 | 518 | changeset: 1:2fe0c98a109d |
|
519 | 519 | bookmark: master |
|
520 | 520 | tag: tip |
|
521 | 521 | user: nottest <test@example.org> |
|
522 | 522 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
523 | 523 | files: foo |
|
524 | 524 | description: |
|
525 | 525 | addfoo2 |
|
526 | 526 | |
|
527 | 527 | different: test <test@example.org> |
|
528 | 528 | |
|
529 | 529 | |
|
530 | 530 | changeset: 0:0735477b0224 |
|
531 | 531 | user: test <test@example.org> |
|
532 | 532 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
533 | 533 | files: foo |
|
534 | 534 | description: |
|
535 | 535 | addfoo |
|
536 | 536 | |
|
537 | 537 | |
|
538 | 538 | |
|
539 | 539 | messagealways will always add the "committer: " line even if committer identical |
|
540 | 540 | |
|
541 | 541 | $ hg --config convert.git.committeractions=messagealways convert git-repo4 git-repo4-hg-messagealways |
|
542 | 542 | initializing destination git-repo4-hg-messagealways repository |
|
543 | 543 | scanning source... |
|
544 | 544 | sorting... |
|
545 | 545 | converting... |
|
546 | 546 | 1 addfoo |
|
547 | 547 | 0 addfoo2 |
|
548 | 548 | updating bookmarks |
|
549 | 549 | |
|
550 | 550 | $ hg -R git-repo4-hg-messagealways log -v |
|
551 | 551 | changeset: 1:8db057d8cd37 |
|
552 | 552 | bookmark: master |
|
553 | 553 | tag: tip |
|
554 | 554 | user: nottest <test@example.org> |
|
555 | 555 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
556 | 556 | files: foo |
|
557 | 557 | description: |
|
558 | 558 | addfoo2 |
|
559 | 559 | |
|
560 | 560 | committer: test <test@example.org> |
|
561 | 561 | |
|
562 | 562 | |
|
563 | 563 | changeset: 0:8f71fe9c98be |
|
564 | 564 | user: test <test@example.org> |
|
565 | 565 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
566 | 566 | files: foo |
|
567 | 567 | description: |
|
568 | 568 | addfoo |
|
569 | 569 | |
|
570 | 570 | committer: test <test@example.org> |
|
571 | 571 | |
|
572 | 572 | |
|
573 | 573 | |
|
574 | 574 | custom prefix on messagealways works |
|
575 | 575 | |
|
576 | 576 | $ hg --config convert.git.committeractions=messagealways=always: convert git-repo4 git-repo4-hg-messagealwaysprefix |
|
577 | 577 | initializing destination git-repo4-hg-messagealwaysprefix repository |
|
578 | 578 | scanning source... |
|
579 | 579 | sorting... |
|
580 | 580 | converting... |
|
581 | 581 | 1 addfoo |
|
582 | 582 | 0 addfoo2 |
|
583 | 583 | updating bookmarks |
|
584 | 584 | |
|
585 | 585 | $ hg -R git-repo4-hg-messagealwaysprefix log -v |
|
586 | 586 | changeset: 1:83c17174de79 |
|
587 | 587 | bookmark: master |
|
588 | 588 | tag: tip |
|
589 | 589 | user: nottest <test@example.org> |
|
590 | 590 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
591 | 591 | files: foo |
|
592 | 592 | description: |
|
593 | 593 | addfoo2 |
|
594 | 594 | |
|
595 | 595 | always: test <test@example.org> |
|
596 | 596 | |
|
597 | 597 | |
|
598 | 598 | changeset: 0:2ac9bcb3534a |
|
599 | 599 | user: test <test@example.org> |
|
600 | 600 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
601 | 601 | files: foo |
|
602 | 602 | description: |
|
603 | 603 | addfoo |
|
604 | 604 | |
|
605 | 605 | always: test <test@example.org> |
|
606 | 606 | |
|
607 | 607 | |
|
608 | 608 | |
|
609 | 609 | replaceauthor replaces author with committer |
|
610 | 610 | |
|
611 | 611 | $ hg --config convert.git.committeractions=replaceauthor convert git-repo4 git-repo4-hg-replaceauthor |
|
612 | 612 | initializing destination git-repo4-hg-replaceauthor repository |
|
613 | 613 | scanning source... |
|
614 | 614 | sorting... |
|
615 | 615 | converting... |
|
616 | 616 | 1 addfoo |
|
617 | 617 | 0 addfoo2 |
|
618 | 618 | updating bookmarks |
|
619 | 619 | |
|
620 | 620 | $ hg -R git-repo4-hg-replaceauthor log -v |
|
621 | 621 | changeset: 1:122c1d8999ea |
|
622 | 622 | bookmark: master |
|
623 | 623 | tag: tip |
|
624 | 624 | user: test <test@example.org> |
|
625 | 625 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
626 | 626 | files: foo |
|
627 | 627 | description: |
|
628 | 628 | addfoo2 |
|
629 | 629 | |
|
630 | 630 | |
|
631 | 631 | changeset: 0:0735477b0224 |
|
632 | 632 | user: test <test@example.org> |
|
633 | 633 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
634 | 634 | files: foo |
|
635 | 635 | description: |
|
636 | 636 | addfoo |
|
637 | 637 | |
|
638 | 638 | |
|
639 | 639 | |
|
640 | 640 | dropcommitter removes the committer |
|
641 | 641 | |
|
642 | 642 | $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter |
|
643 | 643 | initializing destination git-repo4-hg-dropcommitter repository |
|
644 | 644 | scanning source... |
|
645 | 645 | sorting... |
|
646 | 646 | converting... |
|
647 | 647 | 1 addfoo |
|
648 | 648 | 0 addfoo2 |
|
649 | 649 | updating bookmarks |
|
650 | 650 | |
|
651 | 651 | $ hg -R git-repo4-hg-dropcommitter log -v |
|
652 | 652 | changeset: 1:190b2da396cc |
|
653 | 653 | bookmark: master |
|
654 | 654 | tag: tip |
|
655 | 655 | user: nottest <test@example.org> |
|
656 | 656 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
657 | 657 | files: foo |
|
658 | 658 | description: |
|
659 | 659 | addfoo2 |
|
660 | 660 | |
|
661 | 661 | |
|
662 | 662 | changeset: 0:0735477b0224 |
|
663 | 663 | user: test <test@example.org> |
|
664 | 664 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
665 | 665 | files: foo |
|
666 | 666 | description: |
|
667 | 667 | addfoo |
|
668 | 668 | |
|
669 | 669 | |
|
670 | 670 | |
|
671 | 671 | --sourceorder should fail |
|
672 | 672 | |
|
673 | 673 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
674 | 674 | initializing destination git-repo4-sourcesort-hg repository |
|
675 | 675 | abort: --sourcesort is not supported by this data source |
|
676 | 676 | [255] |
|
677 | 677 | |
|
678 | 678 | test converting certain branches |
|
679 | 679 | |
|
680 | 680 | $ mkdir git-testrevs |
|
681 | 681 | $ cd git-testrevs |
|
682 | 682 | $ git init |
|
683 | 683 | Initialized empty Git repository in $TESTTMP/git-testrevs/.git/ |
|
684 | 684 | $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null |
|
685 | 685 | $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null |
|
686 | 686 | $ git checkout -b goodbranch 'HEAD^' |
|
687 | 687 | Switched to a new branch 'goodbranch' |
|
688 | 688 | $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null |
|
689 | 689 | $ git checkout -b badbranch 'HEAD^' |
|
690 | 690 | Switched to a new branch 'badbranch' |
|
691 | 691 | $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null |
|
692 | 692 | $ cd .. |
|
693 | 693 | $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch |
|
694 | 694 | initializing destination hg-testrevs repository |
|
695 | 695 | scanning source... |
|
696 | 696 | sorting... |
|
697 | 697 | converting... |
|
698 | 698 | 2 first |
|
699 | 699 | 1 good branch commit |
|
700 | 700 | 0 master commit |
|
701 | 701 | updating bookmarks |
|
702 | 702 | $ cd hg-testrevs |
|
703 | 703 | $ hg log -G -T '{rev} {bookmarks}' |
|
704 | 704 | o 2 master |
|
705 | 705 | | |
|
706 | 706 | | o 1 goodbranch |
|
707 | 707 | |/ |
|
708 | 708 | o 0 |
|
709 | 709 | |
|
710 | 710 | $ cd .. |
|
711 | 711 | |
|
712 | 712 | test sub modules |
|
713 | 713 | |
|
714 | 714 | $ mkdir git-repo5 |
|
715 | 715 | $ cd git-repo5 |
|
716 | 716 | $ git init-db >/dev/null 2>/dev/null |
|
717 | 717 | $ echo 'sub' >> foo |
|
718 | 718 | $ git add foo |
|
719 | 719 | $ commit -a -m 'addfoo' |
|
720 | 720 | $ BASE=`pwd` |
|
721 | 721 | $ cd .. |
|
722 | 722 | $ mkdir git-repo6 |
|
723 | 723 | $ cd git-repo6 |
|
724 | 724 | $ git init-db >/dev/null 2>/dev/null |
|
725 | 725 | $ git submodule add ${BASE} >/dev/null 2>/dev/null |
|
726 | 726 | $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null |
|
727 | 727 | |
|
728 | 728 | test non-tab whitespace .gitmodules |
|
729 | 729 | |
|
730 | 730 | $ cat >> .gitmodules <<EOF |
|
731 | 731 | > [submodule "git-repo5"] |
|
732 | 732 | > path = git-repo5 |
|
733 | 733 | > url = git-repo5 |
|
734 | 734 | > EOF |
|
735 | 735 | $ git commit -q -a -m "weird white space submodule" |
|
736 | 736 | $ cd .. |
|
737 | 737 | $ hg convert git-repo6 hg-repo6 |
|
738 | 738 | initializing destination hg-repo6 repository |
|
739 | 739 | scanning source... |
|
740 | 740 | sorting... |
|
741 | 741 | converting... |
|
742 | 742 | 1 addsubmodule |
|
743 | 743 | 0 weird white space submodule |
|
744 | 744 | updating bookmarks |
|
745 | 745 | |
|
746 | 746 | $ rm -rf hg-repo6 |
|
747 | 747 | $ cd git-repo6 |
|
748 | 748 | $ git reset --hard 'HEAD^' > /dev/null |
|
749 | 749 | |
|
750 | 750 | test missing .gitmodules |
|
751 | 751 | |
|
752 | 752 | $ git submodule add ../git-repo4 >/dev/null 2>/dev/null |
|
753 | 753 | $ git checkout HEAD .gitmodules |
|
754 | 754 | $ git rm .gitmodules |
|
755 | 755 | rm '.gitmodules' |
|
756 | 756 | $ git commit -q -m "remove .gitmodules" .gitmodules |
|
757 | 757 | $ git commit -q -m "missing .gitmodules" |
|
758 | 758 | $ cd .. |
|
759 | 759 | $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist" |
|
760 | 760 | initializing destination hg-repo6 repository |
|
761 | 761 | scanning source... |
|
762 | 762 | sorting... |
|
763 | 763 | converting... |
|
764 | 764 | 2 addsubmodule |
|
765 | 765 | 1 remove .gitmodules |
|
766 | 766 | 0 missing .gitmodules |
|
767 | 767 | warning: cannot read submodules config file in * (glob) |
|
768 | 768 | updating bookmarks |
|
769 | 769 | $ rm -rf hg-repo6 |
|
770 | 770 | $ cd git-repo6 |
|
771 | 771 | $ rm -rf git-repo4 |
|
772 | 772 | $ git reset --hard 'HEAD^^' > /dev/null |
|
773 | 773 | $ cd .. |
|
774 | 774 | |
|
775 | 775 | test invalid splicemap1 |
|
776 | 776 | |
|
777 | 777 | $ cat > splicemap <<EOF |
|
778 | 778 | > $VALIDID1 |
|
779 | 779 | > EOF |
|
780 | 780 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg |
|
781 | 781 | initializing destination git-repo2-splicemap1-hg repository |
|
782 | 782 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
783 | 783 | [255] |
|
784 | 784 | |
|
785 | 785 | test invalid splicemap2 |
|
786 | 786 | |
|
787 | 787 | $ cat > splicemap <<EOF |
|
788 | 788 | > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2 |
|
789 | 789 | > EOF |
|
790 | 790 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg |
|
791 | 791 | initializing destination git-repo2-splicemap2-hg repository |
|
792 | 792 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
793 | 793 | [255] |
|
794 | 794 | |
|
795 | 795 | test invalid splicemap3 |
|
796 | 796 | |
|
797 | 797 | $ cat > splicemap <<EOF |
|
798 | 798 | > $INVALIDID1 $INVALIDID2 |
|
799 | 799 | > EOF |
|
800 | 800 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg |
|
801 | 801 | initializing destination git-repo2-splicemap3-hg repository |
|
802 | 802 | abort: splicemap entry afd12345af is not a valid revision identifier |
|
803 | 803 | [255] |
|
804 | 804 | |
|
805 | 805 | convert sub modules |
|
806 | 806 | $ hg convert git-repo6 git-repo6-hg |
|
807 | 807 | initializing destination git-repo6-hg repository |
|
808 | 808 | scanning source... |
|
809 | 809 | sorting... |
|
810 | 810 | converting... |
|
811 | 811 | 0 addsubmodule |
|
812 | 812 | updating bookmarks |
|
813 | 813 | $ hg -R git-repo6-hg log -v |
|
814 | 814 | changeset: 0:* (glob) |
|
815 | 815 | bookmark: master |
|
816 | 816 | tag: tip |
|
817 | 817 | user: nottest <test@example.org> |
|
818 | 818 | date: Mon Jan 01 00:00:23 2007 +0000 |
|
819 | 819 | files: .hgsub .hgsubstate |
|
820 | 820 | description: |
|
821 | 821 | addsubmodule |
|
822 | 822 | |
|
823 | 823 | committer: test <test@example.org> |
|
824 | 824 | |
|
825 | 825 | |
|
826 | 826 | |
|
827 | 827 | $ cd git-repo6-hg |
|
828 | 828 | $ hg up >/dev/null 2>/dev/null |
|
829 | 829 | $ cat .hgsubstate |
|
830 | 830 | * git-repo5 (glob) |
|
831 | 831 | $ cd git-repo5 |
|
832 | 832 | $ cat foo |
|
833 | 833 | sub |
|
834 | 834 | |
|
835 | 835 | $ cd ../.. |
|
836 | 836 | |
|
837 | 837 | make sure rename detection doesn't break removing and adding gitmodules |
|
838 | 838 | |
|
839 | 839 | $ cd git-repo6 |
|
840 | 840 | $ git mv .gitmodules .gitmodules-renamed |
|
841 | 841 | $ commit -a -m 'rename .gitmodules' |
|
842 | 842 | $ git mv .gitmodules-renamed .gitmodules |
|
843 | 843 | $ commit -a -m 'rename .gitmodules back' |
|
844 | 844 | $ cd .. |
|
845 | 845 | |
|
846 | 846 | $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg |
|
847 | 847 | $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n" |
|
848 | 848 | rename .gitmodules |
|
849 | 849 | $ hg -R git-repo6-hg status -C --change 'tip^' |
|
850 | 850 | A .gitmodules-renamed |
|
851 | 851 | R .hgsub |
|
852 | 852 | R .hgsubstate |
|
853 | 853 | $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n" |
|
854 | 854 | rename .gitmodules back |
|
855 | 855 | $ hg -R git-repo6-hg status -C --change tip |
|
856 | 856 | A .hgsub |
|
857 | 857 | A .hgsubstate |
|
858 | 858 | R .gitmodules-renamed |
|
859 | 859 | |
|
860 | 860 | convert the revision removing '.gitmodules' itself (and related |
|
861 | 861 | submodules) |
|
862 | 862 | |
|
863 | 863 | $ cd git-repo6 |
|
864 | 864 | $ git rm .gitmodules |
|
865 | 865 | rm '.gitmodules' |
|
866 | 866 | $ git rm --cached git-repo5 |
|
867 | 867 | rm 'git-repo5' |
|
868 | 868 | $ commit -a -m 'remove .gitmodules and submodule git-repo5' |
|
869 | 869 | $ cd .. |
|
870 | 870 | |
|
871 | 871 | $ hg convert -q git-repo6 git-repo6-hg |
|
872 | 872 | $ hg -R git-repo6-hg tip -T "{desc|firstline}\n" |
|
873 | 873 | remove .gitmodules and submodule git-repo5 |
|
874 | 874 | $ hg -R git-repo6-hg tip -T "{file_dels}\n" |
|
875 | 875 | .hgsub .hgsubstate |
|
876 | 876 | |
|
877 | 877 | skip submodules in the conversion |
|
878 | 878 | |
|
879 | 879 | $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True |
|
880 | 880 | $ hg -R no-submodules manifest --all |
|
881 | 881 | .gitmodules-renamed |
|
882 | 882 | |
|
883 | 883 | convert using a different remote prefix |
|
884 | 884 | $ git init git-repo7 |
|
885 | 885 | Initialized empty Git repository in $TESTTMP/git-repo7/.git/ |
|
886 | 886 | $ cd git-repo7 |
|
887 | 887 | TODO: it'd be nice to use (?) lines instead of grep -v to handle the |
|
888 | 888 | git output variance, but that doesn't currently work in the middle of |
|
889 | 889 | a block, so do this for now. |
|
890 | 890 | $ touch a && git add a && git commit -am "commit a" | grep -v changed |
|
891 | 891 | [master (root-commit) 8ae5f69] commit a |
|
892 | 892 | Author: nottest <test@example.org> |
|
893 | 893 | create mode 100644 a |
|
894 | 894 | $ cd .. |
|
895 | 895 | $ git clone git-repo7 git-repo7-client |
|
896 | 896 | Cloning into 'git-repo7-client'... |
|
897 | 897 | done. |
|
898 | 898 | $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7 |
|
899 | 899 | initializing destination hg-repo7 repository |
|
900 | 900 | scanning source... |
|
901 | 901 | sorting... |
|
902 | 902 | converting... |
|
903 | 903 | 0 commit a |
|
904 | 904 | updating bookmarks |
|
905 | 905 | $ hg -R hg-repo7 bookmarks |
|
906 | 906 | master 0:03bf38caa4c6 |
|
907 | 907 | origin/master 0:03bf38caa4c6 |
|
908 | 908 | |
|
909 | 909 | Run convert when the remote branches have changed |
|
910 | 910 | (there was an old bug where the local convert read branches from the server) |
|
911 | 911 | |
|
912 | 912 | $ cd git-repo7 |
|
913 | 913 | $ echo a >> a |
|
914 | 914 | $ git commit -q -am "move master forward" |
|
915 | 915 | $ cd .. |
|
916 | 916 | $ rm -rf hg-repo7 |
|
917 | 917 | $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7 |
|
918 | 918 | initializing destination hg-repo7 repository |
|
919 | 919 | scanning source... |
|
920 | 920 | sorting... |
|
921 | 921 | converting... |
|
922 | 922 | 0 commit a |
|
923 | 923 | updating bookmarks |
|
924 | 924 | $ hg -R hg-repo7 bookmarks |
|
925 | 925 | master 0:03bf38caa4c6 |
|
926 | 926 | origin/master 0:03bf38caa4c6 |
|
927 | 927 | |
|
928 | 928 | damaged git repository tests: |
|
929 | 929 | In case the hard-coded hashes change, the following commands can be used to |
|
930 | 930 | list the hashes and their corresponding types in the repository: |
|
931 | 931 | cd git-repo4/.git/objects |
|
932 | 932 | find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t |
|
933 | 933 | cd ../../.. |
|
934 | 934 | |
|
935 | 935 | damage git repository by renaming a commit object |
|
936 | 936 | $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
|
937 | 937 | $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp |
|
938 | 938 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
939 | 939 | abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git (glob) |
|
940 | 940 | $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ |
|
941 | 941 | damage git repository by renaming a blob object |
|
942 | 942 | |
|
943 | 943 | $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc |
|
944 | 944 | $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp |
|
945 | 945 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
946 | 946 | abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc |
|
947 | 947 | $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ |
|
948 | 948 | damage git repository by renaming a tree object |
|
949 | 949 | |
|
950 | 950 | $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635 |
|
951 | 951 | $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp |
|
952 | 952 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
953 | 953 | abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
|
954 | 954 | |
|
955 | 955 | #if no-windows git19 |
|
956 | 956 | |
|
957 | 957 | test for escaping the repo name (CVE-2016-3069) |
|
958 | 958 | |
|
959 | 959 | $ git init '`echo pwned >COMMAND-INJECTION`' |
|
960 | 960 | Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/ |
|
961 | 961 | $ cd '`echo pwned >COMMAND-INJECTION`' |
|
962 | 962 | $ git commit -q --allow-empty -m 'empty' |
|
963 | 963 | $ cd .. |
|
964 | 964 | $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted' |
|
965 | 965 | initializing destination converted repository |
|
966 | 966 | scanning source... |
|
967 | 967 | sorting... |
|
968 | 968 | converting... |
|
969 | 969 | 0 empty |
|
970 | 970 | updating bookmarks |
|
971 | 971 | $ test -f COMMAND-INJECTION |
|
972 | 972 | [1] |
|
973 | 973 | |
|
974 | 974 | test for safely passing paths to git (CVE-2016-3105) |
|
975 | 975 | |
|
976 | 976 | $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' |
|
977 | 977 | Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/ |
|
978 | 978 | $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' |
|
979 | 979 | $ git commit -q --allow-empty -m 'empty' |
|
980 | 980 | $ cd .. |
|
981 | 981 | $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext' |
|
982 | 982 | initializing destination converted-git-ext repository |
|
983 | 983 | scanning source... |
|
984 | 984 | sorting... |
|
985 | 985 | converting... |
|
986 | 986 | 0 empty |
|
987 | 987 | updating bookmarks |
|
988 | 988 | $ test -f GIT-EXT-COMMAND-INJECTION |
|
989 | 989 | [1] |
|
990 | 990 | |
|
991 | 991 | #endif |
|
992 | 992 | |
|
993 | 993 | Conversion of extra commit metadata to extras works |
|
994 | 994 | |
|
995 | 995 | $ git init gitextras >/dev/null 2>/dev/null |
|
996 | 996 | $ cd gitextras |
|
997 | 997 | $ touch foo |
|
998 | 998 | $ git add foo |
|
999 | 999 | $ commit -m initial |
|
1000 | 1000 | $ echo 1 > foo |
|
1001 | 1001 | $ tree=`git write-tree` |
|
1002 | 1002 | |
|
1003 | 1003 | Git doesn't provider a user-facing API to write extra metadata into the |
|
1004 | 1004 | commit, so create the commit object by hand |
|
1005 | 1005 | |
|
1006 | 1006 | $ git hash-object -t commit -w --stdin << EOF |
|
1007 | 1007 | > tree ${tree} |
|
1008 | 1008 | > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1 |
|
1009 | 1009 | > author test <test@example.com> 1000000000 +0000 |
|
1010 | 1010 | > committer test <test@example.com> 1000000000 +0000 |
|
1011 | 1011 | > extra-1 extra-1 |
|
1012 | 1012 | > extra-2 extra-2 with space |
|
1013 | 1013 | > convert_revision 0000aaaabbbbccccddddeeee |
|
1014 | 1014 | > |
|
1015 | 1015 | > message with extras |
|
1016 | 1016 | > EOF |
|
1017 | 1017 | 8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1018 | 1018 | |
|
1019 | 1019 | $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null |
|
1020 | 1020 | |
|
1021 | 1021 | $ cd .. |
|
1022 | 1022 | |
|
1023 | 1023 | convert will not retain custom metadata keys by default |
|
1024 | 1024 | |
|
1025 | 1025 | $ hg convert gitextras hgextras1 |
|
1026 | 1026 | initializing destination hgextras1 repository |
|
1027 | 1027 | scanning source... |
|
1028 | 1028 | sorting... |
|
1029 | 1029 | converting... |
|
1030 | 1030 | 1 initial |
|
1031 | 1031 | 0 message with extras |
|
1032 | 1032 | updating bookmarks |
|
1033 | 1033 | |
|
1034 | 1034 | $ hg -R hgextras1 log --debug -r 1 |
|
1035 | 1035 | changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09 |
|
1036 | 1036 | bookmark: master |
|
1037 | 1037 | tag: tip |
|
1038 | 1038 | phase: draft |
|
1039 | 1039 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1040 | 1040 | parent: -1:0000000000000000000000000000000000000000 |
|
1041 | 1041 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1042 | 1042 | user: test <test@example.com> |
|
1043 | 1043 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1044 | 1044 | extra: branch=default |
|
1045 | 1045 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1046 | 1046 | description: |
|
1047 | 1047 | message with extras |
|
1048 | 1048 | |
|
1049 | 1049 | |
|
1050 | 1050 | |
|
1051 | 1051 | Attempting to convert a banned extra is disallowed |
|
1052 | 1052 | |
|
1053 | 1053 | $ hg convert --config convert.git.extrakeys=tree,parent gitextras hgextras-banned |
|
1054 | 1054 | initializing destination hgextras-banned repository |
|
1055 | 1055 | abort: copying of extra key is forbidden: parent, tree |
|
1056 | 1056 | [255] |
|
1057 | 1057 | |
|
1058 | 1058 | Converting a specific extra works |
|
1059 | 1059 | |
|
1060 | 1060 | $ hg convert --config convert.git.extrakeys=extra-1 gitextras hgextras2 |
|
1061 | 1061 | initializing destination hgextras2 repository |
|
1062 | 1062 | scanning source... |
|
1063 | 1063 | sorting... |
|
1064 | 1064 | converting... |
|
1065 | 1065 | 1 initial |
|
1066 | 1066 | 0 message with extras |
|
1067 | 1067 | updating bookmarks |
|
1068 | 1068 | |
|
1069 | 1069 | $ hg -R hgextras2 log --debug -r 1 |
|
1070 | 1070 | changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391 |
|
1071 | 1071 | bookmark: master |
|
1072 | 1072 | tag: tip |
|
1073 | 1073 | phase: draft |
|
1074 | 1074 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1075 | 1075 | parent: -1:0000000000000000000000000000000000000000 |
|
1076 | 1076 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1077 | 1077 | user: test <test@example.com> |
|
1078 | 1078 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1079 | 1079 | extra: branch=default |
|
1080 | 1080 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1081 | 1081 | extra: extra-1=extra-1 |
|
1082 | 1082 | description: |
|
1083 | 1083 | message with extras |
|
1084 | 1084 | |
|
1085 | 1085 | |
|
1086 | 1086 | |
|
1087 | 1087 | Converting multiple extras works |
|
1088 | 1088 | |
|
1089 | 1089 | $ hg convert --config convert.git.extrakeys=extra-1,extra-2 gitextras hgextras3 |
|
1090 | 1090 | initializing destination hgextras3 repository |
|
1091 | 1091 | scanning source... |
|
1092 | 1092 | sorting... |
|
1093 | 1093 | converting... |
|
1094 | 1094 | 1 initial |
|
1095 | 1095 | 0 message with extras |
|
1096 | 1096 | updating bookmarks |
|
1097 | 1097 | |
|
1098 | 1098 | $ hg -R hgextras3 log --debug -r 1 |
|
1099 | 1099 | changeset: 1:0105af33379e7b6491501fd34141b7af700fe125 |
|
1100 | 1100 | bookmark: master |
|
1101 | 1101 | tag: tip |
|
1102 | 1102 | phase: draft |
|
1103 | 1103 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1104 | 1104 | parent: -1:0000000000000000000000000000000000000000 |
|
1105 | 1105 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1106 | 1106 | user: test <test@example.com> |
|
1107 | 1107 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1108 | 1108 | extra: branch=default |
|
1109 | 1109 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1110 | 1110 | extra: extra-1=extra-1 |
|
1111 | 1111 | extra: extra-2=extra-2 with space |
|
1112 | 1112 | description: |
|
1113 | 1113 | message with extras |
|
1114 | 1114 | |
|
1115 | 1115 | |
|
1116 | 1116 | |
|
1117 | 1117 | convert.git.saverev can be disabled to prevent convert_revision from being written |
|
1118 | 1118 | |
|
1119 | 1119 | $ hg convert --config convert.git.saverev=false gitextras hgextras4 |
|
1120 | 1120 | initializing destination hgextras4 repository |
|
1121 | 1121 | scanning source... |
|
1122 | 1122 | sorting... |
|
1123 | 1123 | converting... |
|
1124 | 1124 | 1 initial |
|
1125 | 1125 | 0 message with extras |
|
1126 | 1126 | updating bookmarks |
|
1127 | 1127 | |
|
1128 | 1128 | $ hg -R hgextras4 log --debug -r 1 |
|
1129 | 1129 | changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c |
|
1130 | 1130 | bookmark: master |
|
1131 | 1131 | tag: tip |
|
1132 | 1132 | phase: draft |
|
1133 | 1133 | parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d |
|
1134 | 1134 | parent: -1:0000000000000000000000000000000000000000 |
|
1135 | 1135 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1136 | 1136 | user: test <test@example.com> |
|
1137 | 1137 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1138 | 1138 | extra: branch=default |
|
1139 | 1139 | description: |
|
1140 | 1140 | message with extras |
|
1141 | 1141 | |
|
1142 | 1142 | |
|
1143 | 1143 | |
|
1144 | 1144 | convert.git.saverev and convert.git.extrakeys can be combined to preserve |
|
1145 | 1145 | convert_revision from source |
|
1146 | 1146 | |
|
1147 | 1147 | $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5 |
|
1148 | 1148 | initializing destination hgextras5 repository |
|
1149 | 1149 | scanning source... |
|
1150 | 1150 | sorting... |
|
1151 | 1151 | converting... |
|
1152 | 1152 | 1 initial |
|
1153 | 1153 | 0 message with extras |
|
1154 | 1154 | updating bookmarks |
|
1155 | 1155 | |
|
1156 | 1156 | $ hg -R hgextras5 log --debug -r 1 |
|
1157 | 1157 | changeset: 1:574d85931544d4542007664fee3747360e85ee28 |
|
1158 | 1158 | bookmark: master |
|
1159 | 1159 | tag: tip |
|
1160 | 1160 | phase: draft |
|
1161 | 1161 | parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d |
|
1162 | 1162 | parent: -1:0000000000000000000000000000000000000000 |
|
1163 | 1163 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1164 | 1164 | user: test <test@example.com> |
|
1165 | 1165 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1166 | 1166 | extra: branch=default |
|
1167 | 1167 | extra: convert_revision=0000aaaabbbbccccddddeeee |
|
1168 | 1168 | description: |
|
1169 | 1169 | message with extras |
|
1170 | 1170 | |
|
1171 | 1171 |
@@ -1,55 +1,56 b'' | |||
|
1 | 1 | #require svn13 |
|
2 | 2 | |
|
3 | 3 | $ cat <<EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > mq = |
|
6 | 6 | > [diff] |
|
7 | 7 | > nodates = 1 |
|
8 | 8 | > [subrepos] |
|
9 |
> allowed = |
|
|
9 | > allowed = true | |
|
10 | > svn:allowed = true | |
|
10 | 11 | > EOF |
|
11 | 12 | |
|
12 | 13 | fn to create new repository, and cd into it |
|
13 | 14 | $ mkrepo() { |
|
14 | 15 | > hg init $1 |
|
15 | 16 | > cd $1 |
|
16 | 17 | > hg qinit |
|
17 | 18 | > } |
|
18 | 19 | |
|
19 | 20 | |
|
20 | 21 | handle svn subrepos safely |
|
21 | 22 | |
|
22 | 23 | $ svnadmin create svn-repo-2499 |
|
23 | 24 | |
|
24 | 25 | $ SVNREPOPATH=`pwd`/svn-repo-2499/project |
|
25 | 26 | #if windows |
|
26 | 27 | $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
27 | 28 | #else |
|
28 | 29 | $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
29 | 30 | #endif |
|
30 | 31 | |
|
31 | 32 | $ mkdir -p svn-project-2499/trunk |
|
32 | 33 | $ svn import -qm 'init project' svn-project-2499 "$SVNREPOURL" |
|
33 | 34 | |
|
34 | 35 | qnew on repo w/svn subrepo |
|
35 | 36 | $ mkrepo repo-2499-svn-subrepo |
|
36 | 37 | $ svn co "$SVNREPOURL"/trunk sub |
|
37 | 38 | Checked out revision 1. |
|
38 | 39 | $ echo 'sub = [svn]sub' >> .hgsub |
|
39 | 40 | $ hg add .hgsub |
|
40 | 41 | $ hg status -S -X '**/format' |
|
41 | 42 | A .hgsub |
|
42 | 43 | $ hg qnew -m0 0.diff |
|
43 | 44 | $ cd sub |
|
44 | 45 | $ echo a > a |
|
45 | 46 | $ svn add a |
|
46 | 47 | A a |
|
47 | 48 | $ svn st |
|
48 | 49 | A* a (glob) |
|
49 | 50 | $ cd .. |
|
50 | 51 | $ hg status -S # doesn't show status for svn subrepos (yet) |
|
51 | 52 | $ hg qnew -m1 1.diff |
|
52 | 53 | abort: uncommitted changes in subrepository "sub" |
|
53 | 54 | [255] |
|
54 | 55 | |
|
55 | 56 | $ cd .. |
@@ -1,1262 +1,1254 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | 3 | make git commits repeatable |
|
4 | 4 | |
|
5 | 5 | $ cat >> $HGRCPATH <<EOF |
|
6 | 6 | > [defaults] |
|
7 | 7 | > commit = -d "0 0" |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | $ echo "[core]" >> $HOME/.gitconfig |
|
11 | 11 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
12 | 12 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
13 | 13 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
14 | 14 | $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE |
|
15 | 15 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
16 | 16 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
17 | 17 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
18 | 18 | $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM |
|
19 | 19 | |
|
20 | 20 | root hg repo |
|
21 | 21 | |
|
22 | 22 | $ hg init t |
|
23 | 23 | $ cd t |
|
24 | 24 | $ echo a > a |
|
25 | 25 | $ hg add a |
|
26 | 26 | $ hg commit -m a |
|
27 | 27 | $ cd .. |
|
28 | 28 | |
|
29 | 29 | new external git repo |
|
30 | 30 | |
|
31 | 31 | $ mkdir gitroot |
|
32 | 32 | $ cd gitroot |
|
33 | 33 | $ git init -q |
|
34 | 34 | $ echo g > g |
|
35 | 35 | $ git add g |
|
36 | 36 | $ git commit -q -m g |
|
37 | 37 | |
|
38 | 38 | add subrepo clone |
|
39 | 39 | |
|
40 | 40 | $ cd ../t |
|
41 | 41 | $ echo 's = [git]../gitroot' > .hgsub |
|
42 | 42 | $ git clone -q ../gitroot s |
|
43 | 43 | $ hg add .hgsub |
|
44 | 44 | |
|
45 | 45 | git subrepo is disabled by default |
|
46 | 46 | |
|
47 | 47 | $ hg commit -m 'new git subrepo' |
|
48 |
abort: |
|
|
48 | abort: git subrepos not allowed | |
|
49 | 49 | (see 'hg help config.subrepos' for details) |
|
50 | 50 | [255] |
|
51 | 51 | |
|
52 | 52 | so enable it |
|
53 | 53 | |
|
54 | 54 | $ cat >> $HGRCPATH <<EOF |
|
55 | 55 | > [subrepos] |
|
56 |
> allowed = |
|
|
56 | > git:allowed = true | |
|
57 | 57 | > EOF |
|
58 | 58 | |
|
59 | 59 | $ hg commit -m 'new git subrepo' |
|
60 | 60 | |
|
61 | 61 | $ hg debugsub |
|
62 | 62 | path s |
|
63 | 63 | source ../gitroot |
|
64 | 64 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
65 | 65 | |
|
66 | 66 | record a new commit from upstream from a different branch |
|
67 | 67 | |
|
68 | 68 | $ cd ../gitroot |
|
69 | 69 | $ git checkout -q -b testing |
|
70 | 70 | $ echo gg >> g |
|
71 | 71 | $ git commit -q -a -m gg |
|
72 | 72 | |
|
73 | 73 | $ cd ../t/s |
|
74 | 74 | $ git pull -q >/dev/null 2>/dev/null |
|
75 | 75 | $ git checkout -q -b testing origin/testing >/dev/null |
|
76 | 76 | |
|
77 | 77 | $ cd .. |
|
78 | 78 | $ hg status --subrepos |
|
79 | 79 | M s/g |
|
80 | 80 | $ hg commit -m 'update git subrepo' |
|
81 | 81 | $ hg debugsub |
|
82 | 82 | path s |
|
83 | 83 | source ../gitroot |
|
84 | 84 | revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a |
|
85 | 85 | |
|
86 | 86 | make $GITROOT pushable, by replacing it with a clone with nothing checked out |
|
87 | 87 | |
|
88 | 88 | $ cd .. |
|
89 | 89 | $ git clone gitroot gitrootbare --bare -q |
|
90 | 90 | $ rm -rf gitroot |
|
91 | 91 | $ mv gitrootbare gitroot |
|
92 | 92 | |
|
93 | 93 | clone root |
|
94 | 94 | |
|
95 | 95 | $ cd t |
|
96 | 96 | $ hg clone . ../tc 2> /dev/null |
|
97 | 97 | updating to branch default |
|
98 | 98 | cloning subrepo s from $TESTTMP/gitroot |
|
99 | 99 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
100 | 100 | $ cd ../tc |
|
101 | 101 | $ hg debugsub |
|
102 | 102 | path s |
|
103 | 103 | source ../gitroot |
|
104 | 104 | revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a |
|
105 | 105 | $ cd .. |
|
106 | 106 | |
|
107 | 107 | clone with subrepo disabled (update should fail) |
|
108 | 108 | |
|
109 | $ hg clone t -U tc2 --config subrepos.allowed= | |
|
110 | $ hg update -R tc2 --config subrepos.allowed= | |
|
111 |
abort: subrepo |
|
|
109 | $ hg clone t -U tc2 --config subrepos.allowed=false | |
|
110 | $ hg update -R tc2 --config subrepos.allowed=false | |
|
111 | abort: subrepos not enabled | |
|
112 | 112 | (see 'hg help config.subrepos' for details) |
|
113 | 113 | [255] |
|
114 | 114 | $ ls tc2 |
|
115 | 115 | a |
|
116 | 116 | |
|
117 | $ hg clone t tc3 --config subrepos.allowed= | |
|
117 | $ hg clone t tc3 --config subrepos.allowed=false | |
|
118 | 118 | updating to branch default |
|
119 |
abort: subrepo |
|
|
119 | abort: subrepos not enabled | |
|
120 | 120 | (see 'hg help config.subrepos' for details) |
|
121 | 121 | [255] |
|
122 | 122 | $ ls tc3 |
|
123 | 123 | a |
|
124 | 124 | |
|
125 | $ hg clone t tc4 --config subrepos.allowed=hg | |
|
126 | updating to branch default | |
|
127 | abort: subrepo type git not allowed | |
|
128 | (see 'hg help config.subrepos' for details) | |
|
129 | [255] | |
|
130 | $ ls tc4 | |
|
131 | a | |
|
132 | ||
|
133 | 125 | update to previous substate |
|
134 | 126 | |
|
135 | 127 | $ cd tc |
|
136 | 128 | $ hg update 1 -q |
|
137 | 129 | $ cat s/g |
|
138 | 130 | g |
|
139 | 131 | $ hg debugsub |
|
140 | 132 | path s |
|
141 | 133 | source ../gitroot |
|
142 | 134 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
143 | 135 | |
|
144 | 136 | clone root, make local change |
|
145 | 137 | |
|
146 | 138 | $ cd ../t |
|
147 | 139 | $ hg clone . ../ta 2> /dev/null |
|
148 | 140 | updating to branch default |
|
149 | 141 | cloning subrepo s from $TESTTMP/gitroot |
|
150 | 142 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
151 | 143 | |
|
152 | 144 | $ cd ../ta |
|
153 | 145 | $ echo ggg >> s/g |
|
154 | 146 | $ hg status --subrepos |
|
155 | 147 | M s/g |
|
156 | 148 | $ hg diff --subrepos |
|
157 | 149 | diff --git a/s/g b/s/g |
|
158 | 150 | index 089258f..85341ee 100644 |
|
159 | 151 | --- a/s/g |
|
160 | 152 | +++ b/s/g |
|
161 | 153 | @@ -1,2 +1,3 @@ |
|
162 | 154 | g |
|
163 | 155 | gg |
|
164 | 156 | +ggg |
|
165 | 157 | $ hg commit --subrepos -m ggg |
|
166 | 158 | committing subrepository s |
|
167 | 159 | $ hg debugsub |
|
168 | 160 | path s |
|
169 | 161 | source ../gitroot |
|
170 | 162 | revision 79695940086840c99328513acbe35f90fcd55e57 |
|
171 | 163 | |
|
172 | 164 | clone root separately, make different local change |
|
173 | 165 | |
|
174 | 166 | $ cd ../t |
|
175 | 167 | $ hg clone . ../tb 2> /dev/null |
|
176 | 168 | updating to branch default |
|
177 | 169 | cloning subrepo s from $TESTTMP/gitroot |
|
178 | 170 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
179 | 171 | |
|
180 | 172 | $ cd ../tb/s |
|
181 | 173 | $ hg status --subrepos |
|
182 | 174 | $ echo f > f |
|
183 | 175 | $ hg status --subrepos |
|
184 | 176 | ? s/f |
|
185 | 177 | $ hg add . |
|
186 | 178 | adding f |
|
187 | 179 | $ git add f |
|
188 | 180 | $ cd .. |
|
189 | 181 | |
|
190 | 182 | $ hg status --subrepos |
|
191 | 183 | A s/f |
|
192 | 184 | $ hg commit --subrepos -m f |
|
193 | 185 | committing subrepository s |
|
194 | 186 | $ hg debugsub |
|
195 | 187 | path s |
|
196 | 188 | source ../gitroot |
|
197 | 189 | revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
198 | 190 | |
|
199 | 191 | user b push changes |
|
200 | 192 | |
|
201 | 193 | $ hg push 2>/dev/null |
|
202 | 194 | pushing to $TESTTMP/t (glob) |
|
203 | 195 | pushing branch testing of subrepository "s" |
|
204 | 196 | searching for changes |
|
205 | 197 | adding changesets |
|
206 | 198 | adding manifests |
|
207 | 199 | adding file changes |
|
208 | 200 | added 1 changesets with 1 changes to 1 files |
|
209 | 201 | |
|
210 | 202 | user a pulls, merges, commits |
|
211 | 203 | |
|
212 | 204 | $ cd ../ta |
|
213 | 205 | $ hg pull |
|
214 | 206 | pulling from $TESTTMP/t (glob) |
|
215 | 207 | searching for changes |
|
216 | 208 | adding changesets |
|
217 | 209 | adding manifests |
|
218 | 210 | adding file changes |
|
219 | 211 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
220 | 212 | new changesets 089416c11d73 |
|
221 | 213 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
222 | 214 | $ hg merge 2>/dev/null |
|
223 | 215 | subrepository s diverged (local revision: 7969594, remote revision: aa84837) |
|
224 | 216 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m |
|
225 | 217 | pulling subrepo s from $TESTTMP/gitroot |
|
226 | 218 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
227 | 219 | (branch merge, don't forget to commit) |
|
228 | 220 | $ hg st --subrepos s |
|
229 | 221 | A s/f |
|
230 | 222 | $ cat s/f |
|
231 | 223 | f |
|
232 | 224 | $ cat s/g |
|
233 | 225 | g |
|
234 | 226 | gg |
|
235 | 227 | ggg |
|
236 | 228 | $ hg commit --subrepos -m 'merge' |
|
237 | 229 | committing subrepository s |
|
238 | 230 | $ hg status --subrepos --rev 1:5 |
|
239 | 231 | M .hgsubstate |
|
240 | 232 | M s/g |
|
241 | 233 | A s/f |
|
242 | 234 | $ hg debugsub |
|
243 | 235 | path s |
|
244 | 236 | source ../gitroot |
|
245 | 237 | revision f47b465e1bce645dbf37232a00574aa1546ca8d3 |
|
246 | 238 | $ hg push 2>/dev/null |
|
247 | 239 | pushing to $TESTTMP/t (glob) |
|
248 | 240 | pushing branch testing of subrepository "s" |
|
249 | 241 | searching for changes |
|
250 | 242 | adding changesets |
|
251 | 243 | adding manifests |
|
252 | 244 | adding file changes |
|
253 | 245 | added 2 changesets with 2 changes to 1 files |
|
254 | 246 | |
|
255 | 247 | make upstream git changes |
|
256 | 248 | |
|
257 | 249 | $ cd .. |
|
258 | 250 | $ git clone -q gitroot gitclone |
|
259 | 251 | $ cd gitclone |
|
260 | 252 | $ echo ff >> f |
|
261 | 253 | $ git commit -q -a -m ff |
|
262 | 254 | $ echo fff >> f |
|
263 | 255 | $ git commit -q -a -m fff |
|
264 | 256 | $ git push origin testing 2>/dev/null |
|
265 | 257 | |
|
266 | 258 | make and push changes to hg without updating the subrepo |
|
267 | 259 | |
|
268 | 260 | $ cd ../t |
|
269 | 261 | $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.' |
|
270 | 262 | updating to branch default |
|
271 | 263 | cloning subrepo s from $TESTTMP/gitroot |
|
272 | 264 | checking out detached HEAD in subrepository "s" |
|
273 | 265 | check out a git branch if you intend to make changes |
|
274 | 266 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
275 | 267 | $ cd ../td |
|
276 | 268 | $ echo aa >> a |
|
277 | 269 | $ hg commit -m aa |
|
278 | 270 | $ hg push |
|
279 | 271 | pushing to $TESTTMP/t (glob) |
|
280 | 272 | searching for changes |
|
281 | 273 | adding changesets |
|
282 | 274 | adding manifests |
|
283 | 275 | adding file changes |
|
284 | 276 | added 1 changesets with 1 changes to 1 files |
|
285 | 277 | |
|
286 | 278 | sync to upstream git, distribute changes |
|
287 | 279 | |
|
288 | 280 | $ cd ../ta |
|
289 | 281 | $ hg pull -u -q |
|
290 | 282 | $ cd s |
|
291 | 283 | $ git pull -q >/dev/null 2>/dev/null |
|
292 | 284 | $ cd .. |
|
293 | 285 | $ hg commit -m 'git upstream sync' |
|
294 | 286 | $ hg debugsub |
|
295 | 287 | path s |
|
296 | 288 | source ../gitroot |
|
297 | 289 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
298 | 290 | $ hg push -q |
|
299 | 291 | |
|
300 | 292 | $ cd ../tb |
|
301 | 293 | $ hg pull -q |
|
302 | 294 | $ hg update 2>/dev/null |
|
303 | 295 | pulling subrepo s from $TESTTMP/gitroot |
|
304 | 296 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
305 | 297 | $ hg debugsub |
|
306 | 298 | path s |
|
307 | 299 | source ../gitroot |
|
308 | 300 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
309 | 301 | |
|
310 | 302 | create a new git branch |
|
311 | 303 | |
|
312 | 304 | $ cd s |
|
313 | 305 | $ git checkout -b b2 |
|
314 | 306 | Switched to a new branch 'b2' |
|
315 | 307 | $ echo a>a |
|
316 | 308 | $ git add a |
|
317 | 309 | $ git commit -qm 'add a' |
|
318 | 310 | $ cd .. |
|
319 | 311 | $ hg commit -m 'add branch in s' |
|
320 | 312 | |
|
321 | 313 | pulling new git branch should not create tracking branch named 'origin/b2' |
|
322 | 314 | (issue3870) |
|
323 | 315 | $ cd ../td/s |
|
324 | 316 | $ git remote set-url origin $TESTTMP/tb/s |
|
325 | 317 | $ git branch --no-track oldtesting |
|
326 | 318 | $ cd .. |
|
327 | 319 | $ hg pull -q ../tb |
|
328 | 320 | $ hg up |
|
329 | 321 | From $TESTTMP/tb/s |
|
330 | 322 | * [new branch] b2 -> origin/b2 |
|
331 | 323 | Previous HEAD position was f47b465... merge |
|
332 | 324 | Switched to a new branch 'b2' |
|
333 | 325 | pulling subrepo s from $TESTTMP/tb/s |
|
334 | 326 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
335 | 327 | |
|
336 | 328 | update to a revision without the subrepo, keeping the local git repository |
|
337 | 329 | |
|
338 | 330 | $ cd ../t |
|
339 | 331 | $ hg up 0 |
|
340 | 332 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
341 | 333 | $ ls -a s |
|
342 | 334 | . |
|
343 | 335 | .. |
|
344 | 336 | .git |
|
345 | 337 | |
|
346 | 338 | $ hg up 2 |
|
347 | 339 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
348 | 340 | $ ls -a s |
|
349 | 341 | . |
|
350 | 342 | .. |
|
351 | 343 | .git |
|
352 | 344 | g |
|
353 | 345 | |
|
354 | 346 | archive subrepos |
|
355 | 347 | |
|
356 | 348 | $ cd ../tc |
|
357 | 349 | $ hg pull -q |
|
358 | 350 | $ hg archive --subrepos -r 5 ../archive 2>/dev/null |
|
359 | 351 | pulling subrepo s from $TESTTMP/gitroot |
|
360 | 352 | $ cd ../archive |
|
361 | 353 | $ cat s/f |
|
362 | 354 | f |
|
363 | 355 | $ cat s/g |
|
364 | 356 | g |
|
365 | 357 | gg |
|
366 | 358 | ggg |
|
367 | 359 | |
|
368 | 360 | $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null |
|
369 | 361 | $ find ../archive_x | sort | grep -v pax_global_header |
|
370 | 362 | ../archive_x |
|
371 | 363 | ../archive_x/.hg_archival.txt |
|
372 | 364 | ../archive_x/.hgsub |
|
373 | 365 | ../archive_x/.hgsubstate |
|
374 | 366 | ../archive_x/a |
|
375 | 367 | ../archive_x/s |
|
376 | 368 | ../archive_x/s/g |
|
377 | 369 | |
|
378 | 370 | $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null |
|
379 | 371 | $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header |
|
380 | 372 | .hg_archival.txt |
|
381 | 373 | .hgsub |
|
382 | 374 | .hgsubstate |
|
383 | 375 | a |
|
384 | 376 | s/g |
|
385 | 377 | |
|
386 | 378 | create nested repo |
|
387 | 379 | |
|
388 | 380 | $ cd .. |
|
389 | 381 | $ hg init outer |
|
390 | 382 | $ cd outer |
|
391 | 383 | $ echo b>b |
|
392 | 384 | $ hg add b |
|
393 | 385 | $ hg commit -m b |
|
394 | 386 | |
|
395 | 387 | $ hg clone ../t inner 2> /dev/null |
|
396 | 388 | updating to branch default |
|
397 | 389 | cloning subrepo s from $TESTTMP/gitroot |
|
398 | 390 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
399 | 391 | $ echo inner = inner > .hgsub |
|
400 | 392 | $ hg add .hgsub |
|
401 | 393 | $ hg commit -m 'nested sub' |
|
402 | 394 | |
|
403 | 395 | nested commit |
|
404 | 396 | |
|
405 | 397 | $ echo ffff >> inner/s/f |
|
406 | 398 | $ hg status --subrepos |
|
407 | 399 | M inner/s/f |
|
408 | 400 | $ hg commit --subrepos -m nested |
|
409 | 401 | committing subrepository inner |
|
410 | 402 | committing subrepository inner/s (glob) |
|
411 | 403 | |
|
412 | 404 | nested archive |
|
413 | 405 | |
|
414 | 406 | $ hg archive --subrepos ../narchive |
|
415 | 407 | $ ls ../narchive/inner/s | grep -v pax_global_header |
|
416 | 408 | f |
|
417 | 409 | g |
|
418 | 410 | |
|
419 | 411 | relative source expansion |
|
420 | 412 | |
|
421 | 413 | $ cd .. |
|
422 | 414 | $ mkdir d |
|
423 | 415 | $ hg clone t d/t 2> /dev/null |
|
424 | 416 | updating to branch default |
|
425 | 417 | cloning subrepo s from $TESTTMP/gitroot |
|
426 | 418 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
427 | 419 | |
|
428 | 420 | Don't crash if the subrepo is missing |
|
429 | 421 | |
|
430 | 422 | $ hg clone t missing -q |
|
431 | 423 | $ cd missing |
|
432 | 424 | $ rm -rf s |
|
433 | 425 | $ hg status -S |
|
434 | 426 | $ hg sum | grep commit |
|
435 | 427 | commit: 1 subrepos |
|
436 | 428 | $ hg push -q |
|
437 | 429 | abort: subrepo s is missing (in subrepository "s") |
|
438 | 430 | [255] |
|
439 | 431 | $ hg commit --subrepos -qm missing |
|
440 | 432 | abort: subrepo s is missing (in subrepository "s") |
|
441 | 433 | [255] |
|
442 | 434 | |
|
443 | 435 | #if symlink |
|
444 | 436 | Don't crash if subrepo is a broken symlink |
|
445 | 437 | $ ln -s broken s |
|
446 | 438 | $ hg status -S |
|
447 | 439 | abort: subrepo 's' traverses symbolic link |
|
448 | 440 | [255] |
|
449 | 441 | $ hg push -q |
|
450 | 442 | abort: subrepo 's' traverses symbolic link |
|
451 | 443 | [255] |
|
452 | 444 | $ hg commit --subrepos -qm missing |
|
453 | 445 | abort: subrepo 's' traverses symbolic link |
|
454 | 446 | [255] |
|
455 | 447 | $ rm s |
|
456 | 448 | #endif |
|
457 | 449 | |
|
458 | 450 | $ hg update -C 2> /dev/null |
|
459 | 451 | cloning subrepo s from $TESTTMP/gitroot |
|
460 | 452 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
461 | 453 | $ hg sum | grep commit |
|
462 | 454 | commit: (clean) |
|
463 | 455 | |
|
464 | 456 | Don't crash if the .hgsubstate entry is missing |
|
465 | 457 | |
|
466 | 458 | $ hg update 1 -q |
|
467 | 459 | $ hg rm .hgsubstate |
|
468 | 460 | $ hg commit .hgsubstate -m 'no substate' |
|
469 | 461 | nothing changed |
|
470 | 462 | [1] |
|
471 | 463 | $ hg tag -l nosubstate |
|
472 | 464 | $ hg manifest |
|
473 | 465 | .hgsub |
|
474 | 466 | .hgsubstate |
|
475 | 467 | a |
|
476 | 468 | |
|
477 | 469 | $ hg status -S |
|
478 | 470 | R .hgsubstate |
|
479 | 471 | $ hg sum | grep commit |
|
480 | 472 | commit: 1 removed, 1 subrepos (new branch head) |
|
481 | 473 | |
|
482 | 474 | $ hg commit -m 'restore substate' |
|
483 | 475 | nothing changed |
|
484 | 476 | [1] |
|
485 | 477 | $ hg manifest |
|
486 | 478 | .hgsub |
|
487 | 479 | .hgsubstate |
|
488 | 480 | a |
|
489 | 481 | $ hg sum | grep commit |
|
490 | 482 | commit: 1 removed, 1 subrepos (new branch head) |
|
491 | 483 | |
|
492 | 484 | $ hg update -qC nosubstate |
|
493 | 485 | $ ls s |
|
494 | 486 | g |
|
495 | 487 | |
|
496 | 488 | issue3109: false positives in git diff-index |
|
497 | 489 | |
|
498 | 490 | $ hg update -q |
|
499 | 491 | $ touch -t 200001010000 s/g |
|
500 | 492 | $ hg status --subrepos |
|
501 | 493 | $ touch -t 200001010000 s/g |
|
502 | 494 | $ hg sum | grep commit |
|
503 | 495 | commit: (clean) |
|
504 | 496 | |
|
505 | 497 | Check hg update --clean |
|
506 | 498 | $ cd $TESTTMP/ta |
|
507 | 499 | $ echo > s/g |
|
508 | 500 | $ cd s |
|
509 | 501 | $ echo c1 > f1 |
|
510 | 502 | $ echo c1 > f2 |
|
511 | 503 | $ git add f1 |
|
512 | 504 | $ cd .. |
|
513 | 505 | $ hg status -S |
|
514 | 506 | M s/g |
|
515 | 507 | A s/f1 |
|
516 | 508 | ? s/f2 |
|
517 | 509 | $ ls s |
|
518 | 510 | f |
|
519 | 511 | f1 |
|
520 | 512 | f2 |
|
521 | 513 | g |
|
522 | 514 | $ hg update --clean |
|
523 | 515 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
524 | 516 | $ hg status -S |
|
525 | 517 | ? s/f1 |
|
526 | 518 | ? s/f2 |
|
527 | 519 | $ ls s |
|
528 | 520 | f |
|
529 | 521 | f1 |
|
530 | 522 | f2 |
|
531 | 523 | g |
|
532 | 524 | |
|
533 | 525 | Sticky subrepositories, no changes |
|
534 | 526 | $ cd $TESTTMP/ta |
|
535 | 527 | $ hg id -n |
|
536 | 528 | 7 |
|
537 | 529 | $ cd s |
|
538 | 530 | $ git rev-parse HEAD |
|
539 | 531 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
540 | 532 | $ cd .. |
|
541 | 533 | $ hg update 1 > /dev/null 2>&1 |
|
542 | 534 | $ hg id -n |
|
543 | 535 | 1 |
|
544 | 536 | $ cd s |
|
545 | 537 | $ git rev-parse HEAD |
|
546 | 538 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
547 | 539 | $ cd .. |
|
548 | 540 | |
|
549 | 541 | Sticky subrepositories, file changes |
|
550 | 542 | $ touch s/f1 |
|
551 | 543 | $ cd s |
|
552 | 544 | $ git add f1 |
|
553 | 545 | $ cd .. |
|
554 | 546 | $ hg id -n |
|
555 | 547 | 1+ |
|
556 | 548 | $ cd s |
|
557 | 549 | $ git rev-parse HEAD |
|
558 | 550 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
559 | 551 | $ cd .. |
|
560 | 552 | $ hg update 4 |
|
561 | 553 | subrepository s diverged (local revision: da5f5b1, remote revision: aa84837) |
|
562 | 554 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
563 | 555 | subrepository sources for s differ |
|
564 | 556 | use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l |
|
565 | 557 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
566 | 558 | $ hg id -n |
|
567 | 559 | 4+ |
|
568 | 560 | $ cd s |
|
569 | 561 | $ git rev-parse HEAD |
|
570 | 562 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
571 | 563 | $ cd .. |
|
572 | 564 | $ hg update --clean tip > /dev/null 2>&1 |
|
573 | 565 | |
|
574 | 566 | Sticky subrepository, revision updates |
|
575 | 567 | $ hg id -n |
|
576 | 568 | 7 |
|
577 | 569 | $ cd s |
|
578 | 570 | $ git rev-parse HEAD |
|
579 | 571 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
580 | 572 | $ cd .. |
|
581 | 573 | $ cd s |
|
582 | 574 | $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
583 | 575 | Previous HEAD position was 32a3438... fff |
|
584 | 576 | HEAD is now at aa84837... f |
|
585 | 577 | $ cd .. |
|
586 | 578 | $ hg update 1 |
|
587 | 579 | subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1) |
|
588 | 580 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
589 | 581 | subrepository sources for s differ (in checked out version) |
|
590 | 582 | use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l |
|
591 | 583 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
592 | 584 | $ hg id -n |
|
593 | 585 | 1+ |
|
594 | 586 | $ cd s |
|
595 | 587 | $ git rev-parse HEAD |
|
596 | 588 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
597 | 589 | $ cd .. |
|
598 | 590 | |
|
599 | 591 | Sticky subrepository, file changes and revision updates |
|
600 | 592 | $ touch s/f1 |
|
601 | 593 | $ cd s |
|
602 | 594 | $ git add f1 |
|
603 | 595 | $ git rev-parse HEAD |
|
604 | 596 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
605 | 597 | $ cd .. |
|
606 | 598 | $ hg id -n |
|
607 | 599 | 1+ |
|
608 | 600 | $ hg update 7 |
|
609 | 601 | subrepository s diverged (local revision: 32a3438, remote revision: 32a3438) |
|
610 | 602 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
611 | 603 | subrepository sources for s differ |
|
612 | 604 | use (l)ocal source (32a3438) or (r)emote source (32a3438)? l |
|
613 | 605 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
614 | 606 | $ hg id -n |
|
615 | 607 | 7+ |
|
616 | 608 | $ cd s |
|
617 | 609 | $ git rev-parse HEAD |
|
618 | 610 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
619 | 611 | $ cd .. |
|
620 | 612 | |
|
621 | 613 | Sticky repository, update --clean |
|
622 | 614 | $ hg update --clean tip 2>/dev/null |
|
623 | 615 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
624 | 616 | $ hg id -n |
|
625 | 617 | 7 |
|
626 | 618 | $ cd s |
|
627 | 619 | $ git rev-parse HEAD |
|
628 | 620 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
629 | 621 | $ cd .. |
|
630 | 622 | |
|
631 | 623 | Test subrepo already at intended revision: |
|
632 | 624 | $ cd s |
|
633 | 625 | $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
634 | 626 | HEAD is now at 32a3438... fff |
|
635 | 627 | $ cd .. |
|
636 | 628 | $ hg update 1 |
|
637 | 629 | Previous HEAD position was 32a3438... fff |
|
638 | 630 | HEAD is now at da5f5b1... g |
|
639 | 631 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
640 | 632 | $ hg id -n |
|
641 | 633 | 1 |
|
642 | 634 | $ cd s |
|
643 | 635 | $ git rev-parse HEAD |
|
644 | 636 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
645 | 637 | $ cd .. |
|
646 | 638 | |
|
647 | 639 | Test forgetting files, not implemented in git subrepo, used to |
|
648 | 640 | traceback |
|
649 | 641 | #if no-windows |
|
650 | 642 | $ hg forget 'notafile*' |
|
651 | 643 | notafile*: No such file or directory |
|
652 | 644 | [1] |
|
653 | 645 | #else |
|
654 | 646 | $ hg forget 'notafile' |
|
655 | 647 | notafile: * (glob) |
|
656 | 648 | [1] |
|
657 | 649 | #endif |
|
658 | 650 | |
|
659 | 651 | $ cd .. |
|
660 | 652 | |
|
661 | 653 | Test sanitizing ".hg/hgrc" in subrepo |
|
662 | 654 | |
|
663 | 655 | $ cd t |
|
664 | 656 | $ hg tip -q |
|
665 | 657 | 7:af6d2edbb0d3 |
|
666 | 658 | $ hg update -q -C af6d2edbb0d3 |
|
667 | 659 | $ cd s |
|
668 | 660 | $ git checkout -q -b sanitize-test |
|
669 | 661 | $ mkdir .hg |
|
670 | 662 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
671 | 663 | $ mkdir -p sub/.hg |
|
672 | 664 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
673 | 665 | $ git add .hg sub |
|
674 | 666 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update' |
|
675 | 667 | $ git push -q origin sanitize-test |
|
676 | 668 | $ cd .. |
|
677 | 669 | $ grep ' s$' .hgsubstate |
|
678 | 670 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
679 | 671 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
680 | 672 | $ hg parents -q |
|
681 | 673 | 8:3473d20bddcf |
|
682 | 674 | $ grep ' s$' .hgsubstate |
|
683 | 675 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
684 | 676 | $ cd .. |
|
685 | 677 | |
|
686 | 678 | $ hg -R tc pull -q |
|
687 | 679 | $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort |
|
688 | 680 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) |
|
689 | 681 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) |
|
690 | 682 | $ cd tc |
|
691 | 683 | $ hg parents -q |
|
692 | 684 | 8:3473d20bddcf |
|
693 | 685 | $ grep ' s$' .hgsubstate |
|
694 | 686 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
695 | 687 | $ test -f s/.hg/hgrc |
|
696 | 688 | [1] |
|
697 | 689 | $ test -f s/sub/.hg/hgrc |
|
698 | 690 | [1] |
|
699 | 691 | $ cd .. |
|
700 | 692 | |
|
701 | 693 | additional test for "git merge --ff" route: |
|
702 | 694 | |
|
703 | 695 | $ cd t |
|
704 | 696 | $ hg tip -q |
|
705 | 697 | 8:3473d20bddcf |
|
706 | 698 | $ hg update -q -C af6d2edbb0d3 |
|
707 | 699 | $ cd s |
|
708 | 700 | $ git checkout -q testing |
|
709 | 701 | $ mkdir .hg |
|
710 | 702 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
711 | 703 | $ mkdir -p sub/.hg |
|
712 | 704 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
713 | 705 | $ git add .hg sub |
|
714 | 706 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)' |
|
715 | 707 | $ git push -q origin testing |
|
716 | 708 | $ cd .. |
|
717 | 709 | $ grep ' s$' .hgsubstate |
|
718 | 710 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
719 | 711 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
720 | 712 | $ hg parents -q |
|
721 | 713 | 9:ed23f7fe024e |
|
722 | 714 | $ grep ' s$' .hgsubstate |
|
723 | 715 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
724 | 716 | $ cd .. |
|
725 | 717 | |
|
726 | 718 | $ cd tc |
|
727 | 719 | $ hg update -q -C af6d2edbb0d3 |
|
728 | 720 | $ test -f s/.hg/hgrc |
|
729 | 721 | [1] |
|
730 | 722 | $ test -f s/sub/.hg/hgrc |
|
731 | 723 | [1] |
|
732 | 724 | $ cd .. |
|
733 | 725 | $ hg -R tc pull -q |
|
734 | 726 | $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort |
|
735 | 727 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) |
|
736 | 728 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) |
|
737 | 729 | $ cd tc |
|
738 | 730 | $ hg parents -q |
|
739 | 731 | 9:ed23f7fe024e |
|
740 | 732 | $ grep ' s$' .hgsubstate |
|
741 | 733 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
742 | 734 | $ test -f s/.hg/hgrc |
|
743 | 735 | [1] |
|
744 | 736 | $ test -f s/sub/.hg/hgrc |
|
745 | 737 | [1] |
|
746 | 738 | |
|
747 | 739 | Test that sanitizing is omitted in meta data area: |
|
748 | 740 | |
|
749 | 741 | $ mkdir s/.git/.hg |
|
750 | 742 | $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc |
|
751 | 743 | $ hg update -q -C af6d2edbb0d3 |
|
752 | 744 | checking out detached HEAD in subrepository "s" |
|
753 | 745 | check out a git branch if you intend to make changes |
|
754 | 746 | |
|
755 | 747 | check differences made by most recent change |
|
756 | 748 | $ cd s |
|
757 | 749 | $ cat > foobar << EOF |
|
758 | 750 | > woopwoop |
|
759 | 751 | > |
|
760 | 752 | > foo |
|
761 | 753 | > bar |
|
762 | 754 | > EOF |
|
763 | 755 | $ git add foobar |
|
764 | 756 | $ cd .. |
|
765 | 757 | |
|
766 | 758 | $ hg diff --subrepos |
|
767 | 759 | diff --git a/s/foobar b/s/foobar |
|
768 | 760 | new file mode 100644 |
|
769 | 761 | index 0000000..8a5a5e2 |
|
770 | 762 | --- /dev/null |
|
771 | 763 | +++ b/s/foobar |
|
772 | 764 | @@ -0,0 +1,4 @@ |
|
773 | 765 | +woopwoop |
|
774 | 766 | + |
|
775 | 767 | +foo |
|
776 | 768 | +bar |
|
777 | 769 | |
|
778 | 770 | $ hg commit --subrepos -m "Added foobar" |
|
779 | 771 | committing subrepository s |
|
780 | 772 | created new head |
|
781 | 773 | |
|
782 | 774 | $ hg diff -c . --subrepos --nodates |
|
783 | 775 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
784 | 776 | --- a/.hgsubstate |
|
785 | 777 | +++ b/.hgsubstate |
|
786 | 778 | @@ -1,1 +1,1 @@ |
|
787 | 779 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
788 | 780 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
789 | 781 | diff --git a/s/foobar b/s/foobar |
|
790 | 782 | new file mode 100644 |
|
791 | 783 | index 0000000..8a5a5e2 |
|
792 | 784 | --- /dev/null |
|
793 | 785 | +++ b/s/foobar |
|
794 | 786 | @@ -0,0 +1,4 @@ |
|
795 | 787 | +woopwoop |
|
796 | 788 | + |
|
797 | 789 | +foo |
|
798 | 790 | +bar |
|
799 | 791 | |
|
800 | 792 | check output when only diffing the subrepository |
|
801 | 793 | $ hg diff -c . --subrepos s |
|
802 | 794 | diff --git a/s/foobar b/s/foobar |
|
803 | 795 | new file mode 100644 |
|
804 | 796 | index 0000000..8a5a5e2 |
|
805 | 797 | --- /dev/null |
|
806 | 798 | +++ b/s/foobar |
|
807 | 799 | @@ -0,0 +1,4 @@ |
|
808 | 800 | +woopwoop |
|
809 | 801 | + |
|
810 | 802 | +foo |
|
811 | 803 | +bar |
|
812 | 804 | |
|
813 | 805 | check output when diffing something else |
|
814 | 806 | $ hg diff -c . --subrepos .hgsubstate --nodates |
|
815 | 807 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
816 | 808 | --- a/.hgsubstate |
|
817 | 809 | +++ b/.hgsubstate |
|
818 | 810 | @@ -1,1 +1,1 @@ |
|
819 | 811 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
820 | 812 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
821 | 813 | |
|
822 | 814 | add new changes, including whitespace |
|
823 | 815 | $ cd s |
|
824 | 816 | $ cat > foobar << EOF |
|
825 | 817 | > woop woop |
|
826 | 818 | > |
|
827 | 819 | > foo |
|
828 | 820 | > bar |
|
829 | 821 | > EOF |
|
830 | 822 | $ echo foo > barfoo |
|
831 | 823 | $ git add barfoo |
|
832 | 824 | $ cd .. |
|
833 | 825 | |
|
834 | 826 | $ hg diff --subrepos --ignore-all-space |
|
835 | 827 | diff --git a/s/barfoo b/s/barfoo |
|
836 | 828 | new file mode 100644 |
|
837 | 829 | index 0000000..257cc56 |
|
838 | 830 | --- /dev/null |
|
839 | 831 | +++ b/s/barfoo |
|
840 | 832 | @@ -0,0 +1* @@ (glob) |
|
841 | 833 | +foo |
|
842 | 834 | $ hg diff --subrepos s/foobar |
|
843 | 835 | diff --git a/s/foobar b/s/foobar |
|
844 | 836 | index 8a5a5e2..bd5812a 100644 |
|
845 | 837 | --- a/s/foobar |
|
846 | 838 | +++ b/s/foobar |
|
847 | 839 | @@ -1,4 +1,4 @@ |
|
848 | 840 | -woopwoop |
|
849 | 841 | +woop woop |
|
850 | 842 | |
|
851 | 843 | foo |
|
852 | 844 | bar |
|
853 | 845 | |
|
854 | 846 | execute a diffstat |
|
855 | 847 | the output contains a regex, because git 1.7.10 and 1.7.11 |
|
856 | 848 | change the amount of whitespace |
|
857 | 849 | $ hg diff --subrepos --stat |
|
858 | 850 | \s*barfoo |\s*1 + (re) |
|
859 | 851 | \s*foobar |\s*2 +- (re) |
|
860 | 852 | 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re) |
|
861 | 853 | |
|
862 | 854 | adding an include should ignore the other elements |
|
863 | 855 | $ hg diff --subrepos -I s/foobar |
|
864 | 856 | diff --git a/s/foobar b/s/foobar |
|
865 | 857 | index 8a5a5e2..bd5812a 100644 |
|
866 | 858 | --- a/s/foobar |
|
867 | 859 | +++ b/s/foobar |
|
868 | 860 | @@ -1,4 +1,4 @@ |
|
869 | 861 | -woopwoop |
|
870 | 862 | +woop woop |
|
871 | 863 | |
|
872 | 864 | foo |
|
873 | 865 | bar |
|
874 | 866 | |
|
875 | 867 | adding an exclude should ignore this element |
|
876 | 868 | $ hg diff --subrepos -X s/foobar |
|
877 | 869 | diff --git a/s/barfoo b/s/barfoo |
|
878 | 870 | new file mode 100644 |
|
879 | 871 | index 0000000..257cc56 |
|
880 | 872 | --- /dev/null |
|
881 | 873 | +++ b/s/barfoo |
|
882 | 874 | @@ -0,0 +1* @@ (glob) |
|
883 | 875 | +foo |
|
884 | 876 | |
|
885 | 877 | moving a file should show a removal and an add |
|
886 | 878 | $ hg revert --all |
|
887 | 879 | reverting subrepo ../gitroot |
|
888 | 880 | $ cd s |
|
889 | 881 | $ git mv foobar woop |
|
890 | 882 | $ cd .. |
|
891 | 883 | $ hg diff --subrepos |
|
892 | 884 | diff --git a/s/foobar b/s/foobar |
|
893 | 885 | deleted file mode 100644 |
|
894 | 886 | index 8a5a5e2..0000000 |
|
895 | 887 | --- a/s/foobar |
|
896 | 888 | +++ /dev/null |
|
897 | 889 | @@ -1,4 +0,0 @@ |
|
898 | 890 | -woopwoop |
|
899 | 891 | - |
|
900 | 892 | -foo |
|
901 | 893 | -bar |
|
902 | 894 | diff --git a/s/woop b/s/woop |
|
903 | 895 | new file mode 100644 |
|
904 | 896 | index 0000000..8a5a5e2 |
|
905 | 897 | --- /dev/null |
|
906 | 898 | +++ b/s/woop |
|
907 | 899 | @@ -0,0 +1,4 @@ |
|
908 | 900 | +woopwoop |
|
909 | 901 | + |
|
910 | 902 | +foo |
|
911 | 903 | +bar |
|
912 | 904 | $ rm s/woop |
|
913 | 905 | |
|
914 | 906 | revert the subrepository |
|
915 | 907 | $ hg revert --all |
|
916 | 908 | reverting subrepo ../gitroot |
|
917 | 909 | |
|
918 | 910 | $ hg status --subrepos |
|
919 | 911 | ? s/barfoo |
|
920 | 912 | ? s/foobar.orig |
|
921 | 913 | |
|
922 | 914 | $ mv s/foobar.orig s/foobar |
|
923 | 915 | |
|
924 | 916 | $ hg revert --no-backup s |
|
925 | 917 | reverting subrepo ../gitroot |
|
926 | 918 | |
|
927 | 919 | $ hg status --subrepos |
|
928 | 920 | ? s/barfoo |
|
929 | 921 | |
|
930 | 922 | revert moves orig files to the right place |
|
931 | 923 | $ echo 'bloop' > s/foobar |
|
932 | 924 | $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups' |
|
933 | 925 | reverting subrepo ../gitroot |
|
934 | 926 | creating directory: $TESTTMP/tc/.hg/origbackups (glob) |
|
935 | 927 | saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar (glob) |
|
936 | 928 | $ ls .hg/origbackups |
|
937 | 929 | foobar |
|
938 | 930 | $ rm -rf .hg/origbackups |
|
939 | 931 | |
|
940 | 932 | show file at specific revision |
|
941 | 933 | $ cat > s/foobar << EOF |
|
942 | 934 | > woop woop |
|
943 | 935 | > fooo bar |
|
944 | 936 | > EOF |
|
945 | 937 | $ hg commit --subrepos -m "updated foobar" |
|
946 | 938 | committing subrepository s |
|
947 | 939 | $ cat > s/foobar << EOF |
|
948 | 940 | > current foobar |
|
949 | 941 | > (should not be visible using hg cat) |
|
950 | 942 | > EOF |
|
951 | 943 | |
|
952 | 944 | $ hg cat -r . s/foobar |
|
953 | 945 | woop woop |
|
954 | 946 | fooo bar (no-eol) |
|
955 | 947 | $ hg cat -r "parents(.)" s/foobar > catparents |
|
956 | 948 | |
|
957 | 949 | $ mkdir -p tmp/s |
|
958 | 950 | |
|
959 | 951 | $ hg cat -r "parents(.)" --output tmp/%% s/foobar |
|
960 | 952 | $ diff tmp/% catparents |
|
961 | 953 | |
|
962 | 954 | $ hg cat -r "parents(.)" --output tmp/%s s/foobar |
|
963 | 955 | $ diff tmp/foobar catparents |
|
964 | 956 | |
|
965 | 957 | $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar |
|
966 | 958 | $ diff tmp/s/otherfoobar catparents |
|
967 | 959 | |
|
968 | 960 | $ hg cat -r "parents(.)" --output tmp/%p s/foobar |
|
969 | 961 | $ diff tmp/s/foobar catparents |
|
970 | 962 | |
|
971 | 963 | $ hg cat -r "parents(.)" --output tmp/%H s/foobar |
|
972 | 964 | $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents |
|
973 | 965 | |
|
974 | 966 | $ hg cat -r "parents(.)" --output tmp/%R s/foobar |
|
975 | 967 | $ diff tmp/10 catparents |
|
976 | 968 | |
|
977 | 969 | $ hg cat -r "parents(.)" --output tmp/%h s/foobar |
|
978 | 970 | $ diff tmp/255ee8cf690e catparents |
|
979 | 971 | |
|
980 | 972 | $ rm tmp/10 |
|
981 | 973 | $ hg cat -r "parents(.)" --output tmp/%r s/foobar |
|
982 | 974 | $ diff tmp/10 catparents |
|
983 | 975 | |
|
984 | 976 | $ mkdir tmp/tc |
|
985 | 977 | $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar |
|
986 | 978 | $ diff tmp/tc/foobar catparents |
|
987 | 979 | |
|
988 | 980 | cleanup |
|
989 | 981 | $ rm -r tmp |
|
990 | 982 | $ rm catparents |
|
991 | 983 | |
|
992 | 984 | add git files, using either files or patterns |
|
993 | 985 | $ echo "hsss! hsssssssh!" > s/snake.python |
|
994 | 986 | $ echo "ccc" > s/c.c |
|
995 | 987 | $ echo "cpp" > s/cpp.cpp |
|
996 | 988 | |
|
997 | 989 | $ hg add s/snake.python s/c.c s/cpp.cpp |
|
998 | 990 | $ hg st --subrepos s |
|
999 | 991 | M s/foobar |
|
1000 | 992 | A s/c.c |
|
1001 | 993 | A s/cpp.cpp |
|
1002 | 994 | A s/snake.python |
|
1003 | 995 | ? s/barfoo |
|
1004 | 996 | $ hg revert s |
|
1005 | 997 | reverting subrepo ../gitroot |
|
1006 | 998 | |
|
1007 | 999 | $ hg add --subrepos "glob:**.python" |
|
1008 | 1000 | adding s/snake.python (glob) |
|
1009 | 1001 | $ hg st --subrepos s |
|
1010 | 1002 | A s/snake.python |
|
1011 | 1003 | ? s/barfoo |
|
1012 | 1004 | ? s/c.c |
|
1013 | 1005 | ? s/cpp.cpp |
|
1014 | 1006 | ? s/foobar.orig |
|
1015 | 1007 | $ hg revert s |
|
1016 | 1008 | reverting subrepo ../gitroot |
|
1017 | 1009 | |
|
1018 | 1010 | $ hg add --subrepos s |
|
1019 | 1011 | adding s/barfoo (glob) |
|
1020 | 1012 | adding s/c.c (glob) |
|
1021 | 1013 | adding s/cpp.cpp (glob) |
|
1022 | 1014 | adding s/foobar.orig (glob) |
|
1023 | 1015 | adding s/snake.python (glob) |
|
1024 | 1016 | $ hg st --subrepos s |
|
1025 | 1017 | A s/barfoo |
|
1026 | 1018 | A s/c.c |
|
1027 | 1019 | A s/cpp.cpp |
|
1028 | 1020 | A s/foobar.orig |
|
1029 | 1021 | A s/snake.python |
|
1030 | 1022 | $ hg revert s |
|
1031 | 1023 | reverting subrepo ../gitroot |
|
1032 | 1024 | make sure everything is reverted correctly |
|
1033 | 1025 | $ hg st --subrepos s |
|
1034 | 1026 | ? s/barfoo |
|
1035 | 1027 | ? s/c.c |
|
1036 | 1028 | ? s/cpp.cpp |
|
1037 | 1029 | ? s/foobar.orig |
|
1038 | 1030 | ? s/snake.python |
|
1039 | 1031 | |
|
1040 | 1032 | $ hg add --subrepos --exclude "path:s/c.c" |
|
1041 | 1033 | adding s/barfoo (glob) |
|
1042 | 1034 | adding s/cpp.cpp (glob) |
|
1043 | 1035 | adding s/foobar.orig (glob) |
|
1044 | 1036 | adding s/snake.python (glob) |
|
1045 | 1037 | $ hg st --subrepos s |
|
1046 | 1038 | A s/barfoo |
|
1047 | 1039 | A s/cpp.cpp |
|
1048 | 1040 | A s/foobar.orig |
|
1049 | 1041 | A s/snake.python |
|
1050 | 1042 | ? s/c.c |
|
1051 | 1043 | $ hg revert --all -q |
|
1052 | 1044 | |
|
1053 | 1045 | .hgignore should not have influence in subrepos |
|
1054 | 1046 | $ cat > .hgignore << EOF |
|
1055 | 1047 | > syntax: glob |
|
1056 | 1048 | > *.python |
|
1057 | 1049 | > EOF |
|
1058 | 1050 | $ hg add .hgignore |
|
1059 | 1051 | $ hg add --subrepos "glob:**.python" s/barfoo |
|
1060 | 1052 | adding s/snake.python (glob) |
|
1061 | 1053 | $ hg st --subrepos s |
|
1062 | 1054 | A s/barfoo |
|
1063 | 1055 | A s/snake.python |
|
1064 | 1056 | ? s/c.c |
|
1065 | 1057 | ? s/cpp.cpp |
|
1066 | 1058 | ? s/foobar.orig |
|
1067 | 1059 | $ hg revert --all -q |
|
1068 | 1060 | |
|
1069 | 1061 | .gitignore should have influence, |
|
1070 | 1062 | except for explicitly added files (no patterns) |
|
1071 | 1063 | $ cat > s/.gitignore << EOF |
|
1072 | 1064 | > *.python |
|
1073 | 1065 | > EOF |
|
1074 | 1066 | $ hg add s/.gitignore |
|
1075 | 1067 | $ hg st --subrepos s |
|
1076 | 1068 | A s/.gitignore |
|
1077 | 1069 | ? s/barfoo |
|
1078 | 1070 | ? s/c.c |
|
1079 | 1071 | ? s/cpp.cpp |
|
1080 | 1072 | ? s/foobar.orig |
|
1081 | 1073 | $ hg st --subrepos s --all |
|
1082 | 1074 | A s/.gitignore |
|
1083 | 1075 | ? s/barfoo |
|
1084 | 1076 | ? s/c.c |
|
1085 | 1077 | ? s/cpp.cpp |
|
1086 | 1078 | ? s/foobar.orig |
|
1087 | 1079 | I s/snake.python |
|
1088 | 1080 | C s/f |
|
1089 | 1081 | C s/foobar |
|
1090 | 1082 | C s/g |
|
1091 | 1083 | $ hg add --subrepos "glob:**.python" |
|
1092 | 1084 | $ hg st --subrepos s |
|
1093 | 1085 | A s/.gitignore |
|
1094 | 1086 | ? s/barfoo |
|
1095 | 1087 | ? s/c.c |
|
1096 | 1088 | ? s/cpp.cpp |
|
1097 | 1089 | ? s/foobar.orig |
|
1098 | 1090 | $ hg add --subrepos s/snake.python |
|
1099 | 1091 | $ hg st --subrepos s |
|
1100 | 1092 | A s/.gitignore |
|
1101 | 1093 | A s/snake.python |
|
1102 | 1094 | ? s/barfoo |
|
1103 | 1095 | ? s/c.c |
|
1104 | 1096 | ? s/cpp.cpp |
|
1105 | 1097 | ? s/foobar.orig |
|
1106 | 1098 | |
|
1107 | 1099 | correctly do a dry run |
|
1108 | 1100 | $ hg add --subrepos s --dry-run |
|
1109 | 1101 | adding s/barfoo (glob) |
|
1110 | 1102 | adding s/c.c (glob) |
|
1111 | 1103 | adding s/cpp.cpp (glob) |
|
1112 | 1104 | adding s/foobar.orig (glob) |
|
1113 | 1105 | $ hg st --subrepos s |
|
1114 | 1106 | A s/.gitignore |
|
1115 | 1107 | A s/snake.python |
|
1116 | 1108 | ? s/barfoo |
|
1117 | 1109 | ? s/c.c |
|
1118 | 1110 | ? s/cpp.cpp |
|
1119 | 1111 | ? s/foobar.orig |
|
1120 | 1112 | |
|
1121 | 1113 | error given when adding an already tracked file |
|
1122 | 1114 | $ hg add s/.gitignore |
|
1123 | 1115 | s/.gitignore already tracked! |
|
1124 | 1116 | [1] |
|
1125 | 1117 | $ hg add s/g |
|
1126 | 1118 | s/g already tracked! |
|
1127 | 1119 | [1] |
|
1128 | 1120 | |
|
1129 | 1121 | removed files can be re-added |
|
1130 | 1122 | removing files using 'rm' or 'git rm' has the same effect, |
|
1131 | 1123 | since we ignore the staging area |
|
1132 | 1124 | $ hg ci --subrepos -m 'snake' |
|
1133 | 1125 | committing subrepository s |
|
1134 | 1126 | $ cd s |
|
1135 | 1127 | $ rm snake.python |
|
1136 | 1128 | (remove leftover .hg so Mercurial doesn't look for a root here) |
|
1137 | 1129 | $ rm -rf .hg |
|
1138 | 1130 | $ hg status --subrepos --all . |
|
1139 | 1131 | R snake.python |
|
1140 | 1132 | ? barfoo |
|
1141 | 1133 | ? c.c |
|
1142 | 1134 | ? cpp.cpp |
|
1143 | 1135 | ? foobar.orig |
|
1144 | 1136 | C .gitignore |
|
1145 | 1137 | C f |
|
1146 | 1138 | C foobar |
|
1147 | 1139 | C g |
|
1148 | 1140 | $ git rm snake.python |
|
1149 | 1141 | rm 'snake.python' |
|
1150 | 1142 | $ hg status --subrepos --all . |
|
1151 | 1143 | R snake.python |
|
1152 | 1144 | ? barfoo |
|
1153 | 1145 | ? c.c |
|
1154 | 1146 | ? cpp.cpp |
|
1155 | 1147 | ? foobar.orig |
|
1156 | 1148 | C .gitignore |
|
1157 | 1149 | C f |
|
1158 | 1150 | C foobar |
|
1159 | 1151 | C g |
|
1160 | 1152 | $ touch snake.python |
|
1161 | 1153 | $ cd .. |
|
1162 | 1154 | $ hg add s/snake.python |
|
1163 | 1155 | $ hg status -S |
|
1164 | 1156 | M s/snake.python |
|
1165 | 1157 | ? .hgignore |
|
1166 | 1158 | ? s/barfoo |
|
1167 | 1159 | ? s/c.c |
|
1168 | 1160 | ? s/cpp.cpp |
|
1169 | 1161 | ? s/foobar.orig |
|
1170 | 1162 | $ hg revert --all -q |
|
1171 | 1163 | |
|
1172 | 1164 | make sure we show changed files, rather than changed subtrees |
|
1173 | 1165 | $ mkdir s/foo |
|
1174 | 1166 | $ touch s/foo/bwuh |
|
1175 | 1167 | $ hg add s/foo/bwuh |
|
1176 | 1168 | $ hg commit -S -m "add bwuh" |
|
1177 | 1169 | committing subrepository s |
|
1178 | 1170 | $ hg status -S --change . |
|
1179 | 1171 | M .hgsubstate |
|
1180 | 1172 | A s/foo/bwuh |
|
1181 | 1173 | ? s/barfoo |
|
1182 | 1174 | ? s/c.c |
|
1183 | 1175 | ? s/cpp.cpp |
|
1184 | 1176 | ? s/foobar.orig |
|
1185 | 1177 | ? s/snake.python.orig |
|
1186 | 1178 | |
|
1187 | 1179 | #if git19 |
|
1188 | 1180 | |
|
1189 | 1181 | test for Git CVE-2016-3068 |
|
1190 | 1182 | $ hg init malicious-subrepository |
|
1191 | 1183 | $ cd malicious-subrepository |
|
1192 | 1184 | $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub |
|
1193 | 1185 | $ git init s |
|
1194 | 1186 | Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/ |
|
1195 | 1187 | $ cd s |
|
1196 | 1188 | $ git commit --allow-empty -m 'empty' |
|
1197 | 1189 | [master (root-commit) 153f934] empty |
|
1198 | 1190 | $ cd .. |
|
1199 | 1191 | $ hg add .hgsub |
|
1200 | 1192 | $ hg commit -m "add subrepo" |
|
1201 | 1193 | $ cd .. |
|
1202 | 1194 | $ rm -f pwned.txt |
|
1203 | 1195 | $ unset GIT_ALLOW_PROTOCOL |
|
1204 | 1196 | $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \ |
|
1205 | 1197 | > malicious-subrepository malicious-subrepository-protected |
|
1206 | 1198 | Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob) |
|
1207 | 1199 | fatal: transport 'ext' not allowed |
|
1208 | 1200 | updating to branch default |
|
1209 | 1201 | cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt |
|
1210 | 1202 | abort: git clone error 128 in s (in subrepository "s") |
|
1211 | 1203 | [255] |
|
1212 | 1204 | $ f -Dq pwned.txt |
|
1213 | 1205 | pwned.txt: file not found |
|
1214 | 1206 | |
|
1215 | 1207 | whitelisting of ext should be respected (that's the git submodule behaviour) |
|
1216 | 1208 | $ rm -f pwned.txt |
|
1217 | 1209 | $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \ |
|
1218 | 1210 | > malicious-subrepository malicious-subrepository-clone-allowed |
|
1219 | 1211 | Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob) |
|
1220 | 1212 | fatal: Could not read from remote repository. |
|
1221 | 1213 | |
|
1222 | 1214 | Please make sure you have the correct access rights |
|
1223 | 1215 | and the repository exists. |
|
1224 | 1216 | updating to branch default |
|
1225 | 1217 | cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt |
|
1226 | 1218 | abort: git clone error 128 in s (in subrepository "s") |
|
1227 | 1219 | [255] |
|
1228 | 1220 | $ f -Dq pwned.txt |
|
1229 | 1221 | pwned: you asked for it |
|
1230 | 1222 | |
|
1231 | 1223 | #endif |
|
1232 | 1224 | |
|
1233 | 1225 | test for ssh exploit with git subrepos 2017-07-25 |
|
1234 | 1226 | |
|
1235 | 1227 | $ hg init malicious-proxycommand |
|
1236 | 1228 | $ cd malicious-proxycommand |
|
1237 | 1229 | $ echo 's = [git]ssh://-oProxyCommand=rm${IFS}non-existent/path' > .hgsub |
|
1238 | 1230 | $ git init s |
|
1239 | 1231 | Initialized empty Git repository in $TESTTMP/tc/malicious-proxycommand/s/.git/ |
|
1240 | 1232 | $ cd s |
|
1241 | 1233 | $ git commit --allow-empty -m 'empty' |
|
1242 | 1234 | [master (root-commit) 153f934] empty |
|
1243 | 1235 | $ cd .. |
|
1244 | 1236 | $ hg add .hgsub |
|
1245 | 1237 | $ hg ci -m 'add subrepo' |
|
1246 | 1238 | $ cd .. |
|
1247 | 1239 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1248 | 1240 | updating to branch default |
|
1249 | 1241 | abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s") |
|
1250 | 1242 | [255] |
|
1251 | 1243 | |
|
1252 | 1244 | also check that a percent encoded '-' (%2D) doesn't work |
|
1253 | 1245 | |
|
1254 | 1246 | $ cd malicious-proxycommand |
|
1255 | 1247 | $ echo 's = [git]ssh://%2DoProxyCommand=rm${IFS}non-existent/path' > .hgsub |
|
1256 | 1248 | $ hg ci -m 'change url to percent encoded' |
|
1257 | 1249 | $ cd .. |
|
1258 | 1250 | $ rm -r malicious-proxycommand-clone |
|
1259 | 1251 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1260 | 1252 | updating to branch default |
|
1261 | 1253 | abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s") |
|
1262 | 1254 | [255] |
@@ -1,696 +1,696 b'' | |||
|
1 | 1 | #require svn15 |
|
2 | 2 | |
|
3 | 3 | $ SVNREPOPATH=`pwd`/svn-repo |
|
4 | 4 | #if windows |
|
5 | 5 | $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
6 | 6 | #else |
|
7 | 7 | $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
8 | 8 | #endif |
|
9 | 9 | |
|
10 | 10 | $ filter_svn_output () { |
|
11 | 11 | > egrep -v 'Committing|Transmitting|Updating|(^$)' || true |
|
12 | 12 | > } |
|
13 | 13 | |
|
14 | 14 | create subversion repo |
|
15 | 15 | |
|
16 | 16 | $ WCROOT="`pwd`/svn-wc" |
|
17 | 17 | $ svnadmin create svn-repo |
|
18 | 18 | $ svn co "$SVNREPOURL" svn-wc |
|
19 | 19 | Checked out revision 0. |
|
20 | 20 | $ cd svn-wc |
|
21 | 21 | $ mkdir src |
|
22 | 22 | $ echo alpha > src/alpha |
|
23 | 23 | $ svn add src |
|
24 | 24 | A src |
|
25 | 25 | A src/alpha (glob) |
|
26 | 26 | $ mkdir externals |
|
27 | 27 | $ echo other > externals/other |
|
28 | 28 | $ svn add externals |
|
29 | 29 | A externals |
|
30 | 30 | A externals/other (glob) |
|
31 | 31 | $ svn ci -qm 'Add alpha' |
|
32 | 32 | $ svn up -q |
|
33 | 33 | $ echo "externals -r1 $SVNREPOURL/externals" > extdef |
|
34 | 34 | $ svn propset -F extdef svn:externals src |
|
35 | 35 | property 'svn:externals' set on 'src' |
|
36 | 36 | $ svn ci -qm 'Setting externals' |
|
37 | 37 | $ cd .. |
|
38 | 38 | |
|
39 | 39 | create hg repo |
|
40 | 40 | |
|
41 | 41 | $ mkdir sub |
|
42 | 42 | $ cd sub |
|
43 | 43 | $ hg init t |
|
44 | 44 | $ cd t |
|
45 | 45 | |
|
46 | 46 | first revision, no sub |
|
47 | 47 | |
|
48 | 48 | $ echo a > a |
|
49 | 49 | $ hg ci -Am0 |
|
50 | 50 | adding a |
|
51 | 51 | |
|
52 | 52 | add first svn sub with leading whitespaces |
|
53 | 53 | |
|
54 | 54 | $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub |
|
55 | 55 | $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub |
|
56 | 56 | $ svn co --quiet "$SVNREPOURL"/src s |
|
57 | 57 | $ mkdir subdir |
|
58 | 58 | $ svn co --quiet "$SVNREPOURL"/src subdir/s |
|
59 | 59 | $ hg add .hgsub |
|
60 | 60 | |
|
61 | 61 | svn subrepo is disabled by default |
|
62 | 62 | |
|
63 | 63 | $ hg ci -m1 |
|
64 |
abort: s |
|
|
64 | abort: svn subrepos not allowed | |
|
65 | 65 | (see 'hg help config.subrepos' for details) |
|
66 | 66 | [255] |
|
67 | 67 | |
|
68 | 68 | so enable it |
|
69 | 69 | |
|
70 | 70 | $ cat >> $HGRCPATH <<EOF |
|
71 | 71 | > [subrepos] |
|
72 |
> allowed = |
|
|
72 | > svn:allowed = true | |
|
73 | 73 | > EOF |
|
74 | 74 | |
|
75 | 75 | $ hg ci -m1 |
|
76 | 76 | |
|
77 | 77 | make sure we avoid empty commits (issue2445) |
|
78 | 78 | |
|
79 | 79 | $ hg sum |
|
80 | 80 | parent: 1:* tip (glob) |
|
81 | 81 | 1 |
|
82 | 82 | branch: default |
|
83 | 83 | commit: (clean) |
|
84 | 84 | update: (current) |
|
85 | 85 | phases: 2 draft |
|
86 | 86 | $ hg ci -moops |
|
87 | 87 | nothing changed |
|
88 | 88 | [1] |
|
89 | 89 | |
|
90 | 90 | debugsub |
|
91 | 91 | |
|
92 | 92 | $ hg debugsub |
|
93 | 93 | path s |
|
94 | 94 | source file://*/svn-repo/src (glob) |
|
95 | 95 | revision 2 |
|
96 | 96 | path subdir/s |
|
97 | 97 | source file://*/svn-repo/src (glob) |
|
98 | 98 | revision 2 |
|
99 | 99 | |
|
100 | 100 | change file in svn and hg, commit |
|
101 | 101 | |
|
102 | 102 | $ echo a >> a |
|
103 | 103 | $ echo alpha >> s/alpha |
|
104 | 104 | $ hg sum |
|
105 | 105 | parent: 1:* tip (glob) |
|
106 | 106 | 1 |
|
107 | 107 | branch: default |
|
108 | 108 | commit: 1 modified, 1 subrepos |
|
109 | 109 | update: (current) |
|
110 | 110 | phases: 2 draft |
|
111 | 111 | $ hg commit --subrepos -m 'Message!' | filter_svn_output |
|
112 | 112 | committing subrepository s |
|
113 | 113 | Sending*s/alpha (glob) |
|
114 | 114 | Committed revision 3. |
|
115 | 115 | Fetching external item into '*s/externals'* (glob) |
|
116 | 116 | External at revision 1. |
|
117 | 117 | At revision 3. |
|
118 | 118 | $ hg debugsub |
|
119 | 119 | path s |
|
120 | 120 | source file://*/svn-repo/src (glob) |
|
121 | 121 | revision 3 |
|
122 | 122 | path subdir/s |
|
123 | 123 | source file://*/svn-repo/src (glob) |
|
124 | 124 | revision 2 |
|
125 | 125 | |
|
126 | 126 | missing svn file, commit should fail |
|
127 | 127 | |
|
128 | 128 | $ rm s/alpha |
|
129 | 129 | $ hg commit --subrepos -m 'abort on missing file' |
|
130 | 130 | committing subrepository s |
|
131 | 131 | abort: cannot commit missing svn entries (in subrepository "s") |
|
132 | 132 | [255] |
|
133 | 133 | $ svn revert s/alpha > /dev/null |
|
134 | 134 | |
|
135 | 135 | add an unrelated revision in svn and update the subrepo to without |
|
136 | 136 | bringing any changes. |
|
137 | 137 | |
|
138 | 138 | $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated' |
|
139 | 139 | $ svn up -q s |
|
140 | 140 | $ hg sum |
|
141 | 141 | parent: 2:* tip (glob) |
|
142 | 142 | Message! |
|
143 | 143 | branch: default |
|
144 | 144 | commit: (clean) |
|
145 | 145 | update: (current) |
|
146 | 146 | phases: 3 draft |
|
147 | 147 | |
|
148 | 148 | $ echo a > s/a |
|
149 | 149 | |
|
150 | 150 | should be empty despite change to s/a |
|
151 | 151 | |
|
152 | 152 | $ hg st |
|
153 | 153 | |
|
154 | 154 | add a commit from svn |
|
155 | 155 | |
|
156 | 156 | $ cd "$WCROOT/src" |
|
157 | 157 | $ svn up -q |
|
158 | 158 | $ echo xyz >> alpha |
|
159 | 159 | $ svn propset svn:mime-type 'text/xml' alpha |
|
160 | 160 | property 'svn:mime-type' set on 'alpha' |
|
161 | 161 | $ svn ci -qm 'amend a from svn' |
|
162 | 162 | $ cd ../../sub/t |
|
163 | 163 | |
|
164 | 164 | this commit from hg will fail |
|
165 | 165 | |
|
166 | 166 | $ echo zzz >> s/alpha |
|
167 | 167 | $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date' |
|
168 | 168 | committing subrepository s |
|
169 | 169 | abort: svn:*Commit failed (details follow): (glob) |
|
170 | 170 | [255] |
|
171 | 171 | $ svn revert -q s/alpha |
|
172 | 172 | |
|
173 | 173 | this commit fails because of meta changes |
|
174 | 174 | |
|
175 | 175 | $ svn propset svn:mime-type 'text/html' s/alpha |
|
176 | 176 | property 'svn:mime-type' set on 's/alpha' (glob) |
|
177 | 177 | $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date' |
|
178 | 178 | committing subrepository s |
|
179 | 179 | abort: svn:*Commit failed (details follow): (glob) |
|
180 | 180 | [255] |
|
181 | 181 | $ svn revert -q s/alpha |
|
182 | 182 | |
|
183 | 183 | this commit fails because of externals changes |
|
184 | 184 | |
|
185 | 185 | $ echo zzz > s/externals/other |
|
186 | 186 | $ hg ci --subrepos -m 'amend externals from hg' |
|
187 | 187 | committing subrepository s |
|
188 | 188 | abort: cannot commit svn externals (in subrepository "s") |
|
189 | 189 | [255] |
|
190 | 190 | $ hg diff --subrepos -r 1:2 | grep -v diff |
|
191 | 191 | --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 |
|
192 | 192 | +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 |
|
193 | 193 | @@ -1,2 +1,2 @@ |
|
194 | 194 | -2 s |
|
195 | 195 | +3 s |
|
196 | 196 | 2 subdir/s |
|
197 | 197 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
198 | 198 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
199 | 199 | @@ -1,1 +1,2 @@ |
|
200 | 200 | a |
|
201 | 201 | +a |
|
202 | 202 | $ svn revert -q s/externals/other |
|
203 | 203 | |
|
204 | 204 | this commit fails because of externals meta changes |
|
205 | 205 | |
|
206 | 206 | $ svn propset svn:mime-type 'text/html' s/externals/other |
|
207 | 207 | property 'svn:mime-type' set on 's/externals/other' (glob) |
|
208 | 208 | $ hg ci --subrepos -m 'amend externals from hg' |
|
209 | 209 | committing subrepository s |
|
210 | 210 | abort: cannot commit svn externals (in subrepository "s") |
|
211 | 211 | [255] |
|
212 | 212 | $ svn revert -q s/externals/other |
|
213 | 213 | |
|
214 | 214 | clone |
|
215 | 215 | |
|
216 | 216 | $ cd .. |
|
217 | 217 | $ hg clone t tc |
|
218 | 218 | updating to branch default |
|
219 | 219 | A tc/s/alpha (glob) |
|
220 | 220 | U tc/s (glob) |
|
221 | 221 | |
|
222 | 222 | Fetching external item into 'tc/s/externals'* (glob) |
|
223 | 223 | A tc/s/externals/other (glob) |
|
224 | 224 | Checked out external at revision 1. |
|
225 | 225 | |
|
226 | 226 | Checked out revision 3. |
|
227 | 227 | A tc/subdir/s/alpha (glob) |
|
228 | 228 | U tc/subdir/s (glob) |
|
229 | 229 | |
|
230 | 230 | Fetching external item into 'tc/subdir/s/externals'* (glob) |
|
231 | 231 | A tc/subdir/s/externals/other (glob) |
|
232 | 232 | Checked out external at revision 1. |
|
233 | 233 | |
|
234 | 234 | Checked out revision 2. |
|
235 | 235 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
236 | 236 | $ cd tc |
|
237 | 237 | |
|
238 | 238 | debugsub in clone |
|
239 | 239 | |
|
240 | 240 | $ hg debugsub |
|
241 | 241 | path s |
|
242 | 242 | source file://*/svn-repo/src (glob) |
|
243 | 243 | revision 3 |
|
244 | 244 | path subdir/s |
|
245 | 245 | source file://*/svn-repo/src (glob) |
|
246 | 246 | revision 2 |
|
247 | 247 | |
|
248 | 248 | verify subrepo is contained within the repo directory |
|
249 | 249 | |
|
250 | 250 | $ $PYTHON -c "import os.path; print os.path.exists('s')" |
|
251 | 251 | True |
|
252 | 252 | |
|
253 | 253 | update to nullrev (must delete the subrepo) |
|
254 | 254 | |
|
255 | 255 | $ hg up null |
|
256 | 256 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
257 | 257 | $ ls |
|
258 | 258 | |
|
259 | 259 | Check hg update --clean |
|
260 | 260 | $ cd "$TESTTMP/sub/t" |
|
261 | 261 | $ cd s |
|
262 | 262 | $ echo c0 > alpha |
|
263 | 263 | $ echo c1 > f1 |
|
264 | 264 | $ echo c1 > f2 |
|
265 | 265 | $ svn add f1 -q |
|
266 | 266 | $ svn status | sort |
|
267 | 267 | |
|
268 | 268 | ? * a (glob) |
|
269 | 269 | ? * f2 (glob) |
|
270 | 270 | A * f1 (glob) |
|
271 | 271 | M * alpha (glob) |
|
272 | 272 | Performing status on external item at 'externals'* (glob) |
|
273 | 273 | X * externals (glob) |
|
274 | 274 | $ cd ../.. |
|
275 | 275 | $ hg -R t update -C |
|
276 | 276 | |
|
277 | 277 | Fetching external item into 't/s/externals'* (glob) |
|
278 | 278 | Checked out external at revision 1. |
|
279 | 279 | |
|
280 | 280 | Checked out revision 3. |
|
281 | 281 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
282 | 282 | $ cd t/s |
|
283 | 283 | $ svn status | sort |
|
284 | 284 | |
|
285 | 285 | ? * a (glob) |
|
286 | 286 | ? * f1 (glob) |
|
287 | 287 | ? * f2 (glob) |
|
288 | 288 | Performing status on external item at 'externals'* (glob) |
|
289 | 289 | X * externals (glob) |
|
290 | 290 | |
|
291 | 291 | Sticky subrepositories, no changes |
|
292 | 292 | $ cd "$TESTTMP/sub/t" |
|
293 | 293 | $ hg id -n |
|
294 | 294 | 2 |
|
295 | 295 | $ cd s |
|
296 | 296 | $ svnversion |
|
297 | 297 | 3 |
|
298 | 298 | $ cd .. |
|
299 | 299 | $ hg update 1 |
|
300 | 300 | U *s/alpha (glob) |
|
301 | 301 | |
|
302 | 302 | Fetching external item into '*s/externals'* (glob) |
|
303 | 303 | Checked out external at revision 1. |
|
304 | 304 | |
|
305 | 305 | Checked out revision 2. |
|
306 | 306 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
307 | 307 | $ hg id -n |
|
308 | 308 | 1 |
|
309 | 309 | $ cd s |
|
310 | 310 | $ svnversion |
|
311 | 311 | 2 |
|
312 | 312 | $ cd .. |
|
313 | 313 | |
|
314 | 314 | Sticky subrepositories, file changes |
|
315 | 315 | $ touch s/f1 |
|
316 | 316 | $ cd s |
|
317 | 317 | $ svn add f1 |
|
318 | 318 | A f1 |
|
319 | 319 | $ cd .. |
|
320 | 320 | $ hg id -n |
|
321 | 321 | 1+ |
|
322 | 322 | $ cd s |
|
323 | 323 | $ svnversion |
|
324 | 324 | 2M |
|
325 | 325 | $ cd .. |
|
326 | 326 | $ hg update tip |
|
327 | 327 | subrepository s diverged (local revision: 2, remote revision: 3) |
|
328 | 328 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
329 | 329 | subrepository sources for s differ |
|
330 | 330 | use (l)ocal source (2) or (r)emote source (3)? l |
|
331 | 331 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
332 | 332 | $ hg id -n |
|
333 | 333 | 2+ |
|
334 | 334 | $ cd s |
|
335 | 335 | $ svnversion |
|
336 | 336 | 2M |
|
337 | 337 | $ cd .. |
|
338 | 338 | $ hg update --clean tip |
|
339 | 339 | U *s/alpha (glob) |
|
340 | 340 | |
|
341 | 341 | Fetching external item into '*s/externals'* (glob) |
|
342 | 342 | Checked out external at revision 1. |
|
343 | 343 | |
|
344 | 344 | Checked out revision 3. |
|
345 | 345 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
346 | 346 | |
|
347 | 347 | Sticky subrepository, revision updates |
|
348 | 348 | $ hg id -n |
|
349 | 349 | 2 |
|
350 | 350 | $ cd s |
|
351 | 351 | $ svnversion |
|
352 | 352 | 3 |
|
353 | 353 | $ cd .. |
|
354 | 354 | $ cd s |
|
355 | 355 | $ svn update -qr 1 |
|
356 | 356 | $ cd .. |
|
357 | 357 | $ hg update 1 |
|
358 | 358 | subrepository s diverged (local revision: 3, remote revision: 2) |
|
359 | 359 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
360 | 360 | subrepository sources for s differ (in checked out version) |
|
361 | 361 | use (l)ocal source (1) or (r)emote source (2)? l |
|
362 | 362 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
363 | 363 | $ hg id -n |
|
364 | 364 | 1+ |
|
365 | 365 | $ cd s |
|
366 | 366 | $ svnversion |
|
367 | 367 | 1 |
|
368 | 368 | $ cd .. |
|
369 | 369 | |
|
370 | 370 | Sticky subrepository, file changes and revision updates |
|
371 | 371 | $ touch s/f1 |
|
372 | 372 | $ cd s |
|
373 | 373 | $ svn add f1 |
|
374 | 374 | A f1 |
|
375 | 375 | $ svnversion |
|
376 | 376 | 1M |
|
377 | 377 | $ cd .. |
|
378 | 378 | $ hg id -n |
|
379 | 379 | 1+ |
|
380 | 380 | $ hg update tip |
|
381 | 381 | subrepository s diverged (local revision: 3, remote revision: 3) |
|
382 | 382 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
383 | 383 | subrepository sources for s differ |
|
384 | 384 | use (l)ocal source (1) or (r)emote source (3)? l |
|
385 | 385 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
386 | 386 | $ hg id -n |
|
387 | 387 | 2+ |
|
388 | 388 | $ cd s |
|
389 | 389 | $ svnversion |
|
390 | 390 | 1M |
|
391 | 391 | $ cd .. |
|
392 | 392 | |
|
393 | 393 | Sticky repository, update --clean |
|
394 | 394 | $ hg update --clean tip | grep -v 's[/\]externals[/\]other' |
|
395 | 395 | U *s/alpha (glob) |
|
396 | 396 | U *s (glob) |
|
397 | 397 | |
|
398 | 398 | Fetching external item into '*s/externals'* (glob) |
|
399 | 399 | Checked out external at revision 1. |
|
400 | 400 | |
|
401 | 401 | Checked out revision 3. |
|
402 | 402 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
403 | 403 | $ hg id -n |
|
404 | 404 | 2 |
|
405 | 405 | $ cd s |
|
406 | 406 | $ svnversion |
|
407 | 407 | 3 |
|
408 | 408 | $ cd .. |
|
409 | 409 | |
|
410 | 410 | Test subrepo already at intended revision: |
|
411 | 411 | $ cd s |
|
412 | 412 | $ svn update -qr 2 |
|
413 | 413 | $ cd .. |
|
414 | 414 | $ hg update 1 |
|
415 | 415 | subrepository s diverged (local revision: 3, remote revision: 2) |
|
416 | 416 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
417 | 417 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
418 | 418 | $ hg id -n |
|
419 | 419 | 1+ |
|
420 | 420 | $ cd s |
|
421 | 421 | $ svnversion |
|
422 | 422 | 2 |
|
423 | 423 | $ cd .. |
|
424 | 424 | |
|
425 | 425 | Test case where subversion would fail to update the subrepo because there |
|
426 | 426 | are unknown directories being replaced by tracked ones (happens with rebase). |
|
427 | 427 | |
|
428 | 428 | $ cd "$WCROOT/src" |
|
429 | 429 | $ mkdir dir |
|
430 | 430 | $ echo epsilon.py > dir/epsilon.py |
|
431 | 431 | $ svn add dir |
|
432 | 432 | A dir |
|
433 | 433 | A dir/epsilon.py (glob) |
|
434 | 434 | $ svn ci -qm 'Add dir/epsilon.py' |
|
435 | 435 | $ cd ../.. |
|
436 | 436 | $ hg init rebaserepo |
|
437 | 437 | $ cd rebaserepo |
|
438 | 438 | $ svn co -r5 --quiet "$SVNREPOURL"/src s |
|
439 | 439 | $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub |
|
440 | 440 | $ hg add .hgsub |
|
441 | 441 | $ hg ci -m addsub |
|
442 | 442 | $ echo a > a |
|
443 | 443 | $ hg add . |
|
444 | 444 | adding a |
|
445 | 445 | $ hg ci -m adda |
|
446 | 446 | $ hg up 0 |
|
447 | 447 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
448 | 448 | $ svn up -qr6 s |
|
449 | 449 | $ hg ci -m updatesub |
|
450 | 450 | created new head |
|
451 | 451 | $ echo pyc > s/dir/epsilon.pyc |
|
452 | 452 | $ hg up 1 |
|
453 | 453 | D *s/dir (glob) |
|
454 | 454 | |
|
455 | 455 | Fetching external item into '*s/externals'* (glob) |
|
456 | 456 | Checked out external at revision 1. |
|
457 | 457 | |
|
458 | 458 | Checked out revision 5. |
|
459 | 459 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
460 | 460 | $ hg up -q 2 |
|
461 | 461 | |
|
462 | 462 | Modify one of the externals to point to a different path so we can |
|
463 | 463 | test having obstructions when switching branches on checkout: |
|
464 | 464 | $ hg checkout tip |
|
465 | 465 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
466 | 466 | $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub |
|
467 | 467 | $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct |
|
468 | 468 | $ hg commit -m 'Start making obstructed working copy' |
|
469 | 469 | $ hg book other |
|
470 | 470 | $ hg co -r 'p1(tip)' |
|
471 | 471 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
472 | 472 | (leaving bookmark other) |
|
473 | 473 | $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub |
|
474 | 474 | $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct |
|
475 | 475 | $ hg commit -m 'Other branch which will be obstructed' |
|
476 | 476 | created new head |
|
477 | 477 | |
|
478 | 478 | Switching back to the head where we have another path mapped to the |
|
479 | 479 | same subrepo should work if the subrepo is clean. |
|
480 | 480 | $ hg co other |
|
481 | 481 | A *obstruct/other (glob) |
|
482 | 482 | Checked out revision 1. |
|
483 | 483 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
484 | 484 | (activating bookmark other) |
|
485 | 485 | |
|
486 | 486 | This is surprising, but is also correct based on the current code: |
|
487 | 487 | $ echo "updating should (maybe) fail" > obstruct/other |
|
488 | 488 | $ hg co tip |
|
489 | 489 | abort: uncommitted changes |
|
490 | 490 | (commit or update --clean to discard changes) |
|
491 | 491 | [255] |
|
492 | 492 | |
|
493 | 493 | Point to a Subversion branch which has since been deleted and recreated |
|
494 | 494 | First, create that condition in the repository. |
|
495 | 495 | |
|
496 | 496 | $ hg ci --subrepos -m cleanup | filter_svn_output |
|
497 | 497 | committing subrepository obstruct |
|
498 | 498 | Sending obstruct/other (glob) |
|
499 | 499 | Committed revision 7. |
|
500 | 500 | At revision 7. |
|
501 | 501 | $ svn mkdir -qm "baseline" $SVNREPOURL/trunk |
|
502 | 502 | $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch |
|
503 | 503 | $ svn co --quiet "$SVNREPOURL"/branch tempwc |
|
504 | 504 | $ cd tempwc |
|
505 | 505 | $ echo "something old" > somethingold |
|
506 | 506 | $ svn add somethingold |
|
507 | 507 | A somethingold |
|
508 | 508 | $ svn ci -qm 'Something old' |
|
509 | 509 | $ svn rm -qm "remove branch" $SVNREPOURL/branch |
|
510 | 510 | $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch |
|
511 | 511 | $ svn up -q |
|
512 | 512 | $ echo "something new" > somethingnew |
|
513 | 513 | $ svn add somethingnew |
|
514 | 514 | A somethingnew |
|
515 | 515 | $ svn ci -qm 'Something new' |
|
516 | 516 | $ cd .. |
|
517 | 517 | $ rm -rf tempwc |
|
518 | 518 | $ svn co "$SVNREPOURL/branch"@10 recreated |
|
519 | 519 | A recreated/somethingold (glob) |
|
520 | 520 | Checked out revision 10. |
|
521 | 521 | $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub |
|
522 | 522 | $ hg ci -m addsub |
|
523 | 523 | $ cd recreated |
|
524 | 524 | $ svn up -q |
|
525 | 525 | $ cd .. |
|
526 | 526 | $ hg ci -m updatesub |
|
527 | 527 | $ hg up -r-2 |
|
528 | 528 | D *recreated/somethingnew (glob) |
|
529 | 529 | A *recreated/somethingold (glob) |
|
530 | 530 | Checked out revision 10. |
|
531 | 531 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
532 | 532 | (leaving bookmark other) |
|
533 | 533 | $ test -f recreated/somethingold |
|
534 | 534 | |
|
535 | 535 | Test archive |
|
536 | 536 | |
|
537 | 537 | $ hg archive -S ../archive-all --debug --config progress.debug=true |
|
538 | 538 | archiving: 0/2 files (0.00%) |
|
539 | 539 | archiving: .hgsub 1/2 files (50.00%) |
|
540 | 540 | archiving: .hgsubstate 2/2 files (100.00%) |
|
541 | 541 | archiving (obstruct): 0/1 files (0.00%) |
|
542 | 542 | archiving (obstruct): 1/1 files (100.00%) |
|
543 | 543 | archiving (recreated): 0/1 files (0.00%) |
|
544 | 544 | archiving (recreated): 1/1 files (100.00%) |
|
545 | 545 | archiving (s): 0/2 files (0.00%) |
|
546 | 546 | archiving (s): 1/2 files (50.00%) |
|
547 | 547 | archiving (s): 2/2 files (100.00%) |
|
548 | 548 | |
|
549 | 549 | $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old |
|
550 | 550 | archiving: 0/2 files (0.00%) |
|
551 | 551 | archiving: .hgsub 1/2 files (50.00%) |
|
552 | 552 | archiving: .hgsubstate 2/2 files (100.00%) |
|
553 | 553 | archiving (obstruct): 0/1 files (0.00%) |
|
554 | 554 | archiving (obstruct): 1/1 files (100.00%) |
|
555 | 555 | archiving (recreated): 0 files |
|
556 | 556 | archiving (s): 0/2 files (0.00%) |
|
557 | 557 | archiving (s): 1/2 files (50.00%) |
|
558 | 558 | archiving (s): 2/2 files (100.00%) |
|
559 | 559 | $ find ../archive-exclude | sort |
|
560 | 560 | ../archive-exclude |
|
561 | 561 | ../archive-exclude/.hg_archival.txt |
|
562 | 562 | ../archive-exclude/.hgsub |
|
563 | 563 | ../archive-exclude/.hgsubstate |
|
564 | 564 | ../archive-exclude/obstruct |
|
565 | 565 | ../archive-exclude/obstruct/other |
|
566 | 566 | ../archive-exclude/s |
|
567 | 567 | ../archive-exclude/s/alpha |
|
568 | 568 | ../archive-exclude/s/dir |
|
569 | 569 | ../archive-exclude/s/dir/epsilon.py |
|
570 | 570 | |
|
571 | 571 | Test forgetting files, not implemented in svn subrepo, used to |
|
572 | 572 | traceback |
|
573 | 573 | |
|
574 | 574 | #if no-windows |
|
575 | 575 | $ hg forget 'notafile*' |
|
576 | 576 | notafile*: No such file or directory |
|
577 | 577 | [1] |
|
578 | 578 | #else |
|
579 | 579 | $ hg forget 'notafile' |
|
580 | 580 | notafile: * (glob) |
|
581 | 581 | [1] |
|
582 | 582 | #endif |
|
583 | 583 | |
|
584 | 584 | Test a subrepo referencing a just moved svn path. Last commit rev will |
|
585 | 585 | be different from the revision, and the path will be different as |
|
586 | 586 | well. |
|
587 | 587 | |
|
588 | 588 | $ cd "$WCROOT" |
|
589 | 589 | $ svn up > /dev/null |
|
590 | 590 | $ mkdir trunk/subdir branches |
|
591 | 591 | $ echo a > trunk/subdir/a |
|
592 | 592 | $ svn add trunk/subdir branches |
|
593 | 593 | A trunk/subdir (glob) |
|
594 | 594 | A trunk/subdir/a (glob) |
|
595 | 595 | A branches |
|
596 | 596 | $ svn ci -qm addsubdir |
|
597 | 597 | $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch |
|
598 | 598 | $ cd .. |
|
599 | 599 | |
|
600 | 600 | $ hg init repo2 |
|
601 | 601 | $ cd repo2 |
|
602 | 602 | $ svn co $SVNREPOURL/branches/somebranch/subdir |
|
603 | 603 | A subdir/a (glob) |
|
604 | 604 | Checked out revision 15. |
|
605 | 605 | $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub |
|
606 | 606 | $ hg add .hgsub |
|
607 | 607 | $ hg ci -m addsub |
|
608 | 608 | $ hg up null |
|
609 | 609 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
610 | 610 | $ hg up |
|
611 | 611 | A *subdir/a (glob) |
|
612 | 612 | Checked out revision 15. |
|
613 | 613 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
614 | 614 | $ cd .. |
|
615 | 615 | |
|
616 | 616 | Test sanitizing ".hg/hgrc" in subrepo |
|
617 | 617 | |
|
618 | 618 | $ cd sub/t |
|
619 | 619 | $ hg update -q -C tip |
|
620 | 620 | $ cd s |
|
621 | 621 | $ mkdir .hg |
|
622 | 622 | $ echo '.hg/hgrc in svn repo' > .hg/hgrc |
|
623 | 623 | $ mkdir -p sub/.hg |
|
624 | 624 | $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc |
|
625 | 625 | $ svn add .hg sub |
|
626 | 626 | A .hg |
|
627 | 627 | A .hg/hgrc (glob) |
|
628 | 628 | A sub |
|
629 | 629 | A sub/.hg (glob) |
|
630 | 630 | A sub/.hg/hgrc (glob) |
|
631 | 631 | $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update' |
|
632 | 632 | $ svn up -q |
|
633 | 633 | $ cd .. |
|
634 | 634 | $ hg commit -S -m 'commit with svn revision including .hg/hgrc' |
|
635 | 635 | $ grep ' s$' .hgsubstate |
|
636 | 636 | 16 s |
|
637 | 637 | $ cd .. |
|
638 | 638 | |
|
639 | 639 | $ hg -R tc pull -u -q 2>&1 | sort |
|
640 | 640 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob) |
|
641 | 641 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob) |
|
642 | 642 | $ cd tc |
|
643 | 643 | $ grep ' s$' .hgsubstate |
|
644 | 644 | 16 s |
|
645 | 645 | $ test -f s/.hg/hgrc |
|
646 | 646 | [1] |
|
647 | 647 | $ test -f s/sub/.hg/hgrc |
|
648 | 648 | [1] |
|
649 | 649 | |
|
650 | 650 | Test that sanitizing is omitted in meta data area: |
|
651 | 651 | |
|
652 | 652 | $ mkdir s/.svn/.hg |
|
653 | 653 | $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc |
|
654 | 654 | $ hg update -q -C '.^1' |
|
655 | 655 | |
|
656 | 656 | $ cd ../.. |
|
657 | 657 | |
|
658 | 658 | SEC: test for ssh exploit |
|
659 | 659 | |
|
660 | 660 | $ hg init ssh-vuln |
|
661 | 661 | $ cd ssh-vuln |
|
662 | 662 | $ echo "s = [svn]$SVNREPOURL/src" >> .hgsub |
|
663 | 663 | $ svn co --quiet "$SVNREPOURL"/src s |
|
664 | 664 | $ hg add .hgsub |
|
665 | 665 | $ hg ci -m1 |
|
666 | 666 | $ echo "s = [svn]svn+ssh://-oProxyCommand=touch%20owned%20nested" > .hgsub |
|
667 | 667 | $ hg ci -m2 |
|
668 | 668 | $ cd .. |
|
669 | 669 | $ hg clone ssh-vuln ssh-vuln-clone |
|
670 | 670 | updating to branch default |
|
671 | 671 | abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s") |
|
672 | 672 | [255] |
|
673 | 673 | |
|
674 | 674 | also check that a percent encoded '-' (%2D) doesn't work |
|
675 | 675 | |
|
676 | 676 | $ cd ssh-vuln |
|
677 | 677 | $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20nested" > .hgsub |
|
678 | 678 | $ hg ci -m3 |
|
679 | 679 | $ cd .. |
|
680 | 680 | $ rm -r ssh-vuln-clone |
|
681 | 681 | $ hg clone ssh-vuln ssh-vuln-clone |
|
682 | 682 | updating to branch default |
|
683 | 683 | abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s") |
|
684 | 684 | [255] |
|
685 | 685 | |
|
686 | 686 | also check that hiding the attack in the username doesn't work: |
|
687 | 687 | |
|
688 | 688 | $ cd ssh-vuln |
|
689 | 689 | $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20foo@example.com/nested" > .hgsub |
|
690 | 690 | $ hg ci -m3 |
|
691 | 691 | $ cd .. |
|
692 | 692 | $ rm -r ssh-vuln-clone |
|
693 | 693 | $ hg clone ssh-vuln ssh-vuln-clone |
|
694 | 694 | updating to branch default |
|
695 | 695 | abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned foo@example.com/nested' (in subrepository "s") |
|
696 | 696 | [255] |
@@ -1,1921 +1,1931 b'' | |||
|
1 | 1 | Let commit recurse into subrepos by default to match pre-2.0 behavior: |
|
2 | 2 | |
|
3 | 3 | $ echo "[ui]" >> $HGRCPATH |
|
4 | 4 | $ echo "commitsubrepos = Yes" >> $HGRCPATH |
|
5 | 5 | |
|
6 | 6 | $ hg init t |
|
7 | 7 | $ cd t |
|
8 | 8 | |
|
9 | 9 | first revision, no sub |
|
10 | 10 | |
|
11 | 11 | $ echo a > a |
|
12 | 12 | $ hg ci -Am0 |
|
13 | 13 | adding a |
|
14 | 14 | |
|
15 | 15 | add first sub |
|
16 | 16 | |
|
17 | 17 | $ echo s = s > .hgsub |
|
18 | 18 | $ hg add .hgsub |
|
19 | 19 | $ hg init s |
|
20 | 20 | $ echo a > s/a |
|
21 | 21 | |
|
22 | 22 | Issue2232: committing a subrepo without .hgsub |
|
23 | 23 | |
|
24 | 24 | $ hg ci -mbad s |
|
25 | 25 | abort: can't commit subrepos without .hgsub |
|
26 | 26 | [255] |
|
27 | 27 | |
|
28 | 28 | $ hg -R s add s/a |
|
29 | 29 | $ hg files -S |
|
30 | 30 | .hgsub |
|
31 | 31 | a |
|
32 | 32 | s/a (glob) |
|
33 | 33 | |
|
34 | 34 | $ hg -R s ci -Ams0 |
|
35 | 35 | $ hg sum |
|
36 | 36 | parent: 0:f7b1eb17ad24 tip |
|
37 | 37 | 0 |
|
38 | 38 | branch: default |
|
39 | 39 | commit: 1 added, 1 subrepos |
|
40 | 40 | update: (current) |
|
41 | 41 | phases: 1 draft |
|
42 | 42 | $ hg ci -m1 |
|
43 | 43 | |
|
44 | 44 | test handling .hgsubstate "added" explicitly. |
|
45 | 45 | |
|
46 | 46 | $ hg parents --template '{node}\n{files}\n' |
|
47 | 47 | 7cf8cfea66e410e8e3336508dfeec07b3192de51 |
|
48 | 48 | .hgsub .hgsubstate |
|
49 | 49 | $ hg rollback -q |
|
50 | 50 | $ hg add .hgsubstate |
|
51 | 51 | $ hg ci -m1 |
|
52 | 52 | $ hg parents --template '{node}\n{files}\n' |
|
53 | 53 | 7cf8cfea66e410e8e3336508dfeec07b3192de51 |
|
54 | 54 | .hgsub .hgsubstate |
|
55 | 55 | |
|
56 | 56 | Subrepopath which overlaps with filepath, does not change warnings in remove() |
|
57 | 57 | |
|
58 | 58 | $ mkdir snot |
|
59 | 59 | $ touch snot/file |
|
60 | 60 | $ hg remove -S snot/file |
|
61 | 61 | not removing snot/file: file is untracked (glob) |
|
62 | 62 | [1] |
|
63 | 63 | $ hg cat snot/filenot |
|
64 | 64 | snot/filenot: no such file in rev 7cf8cfea66e4 (glob) |
|
65 | 65 | [1] |
|
66 | 66 | $ rm -r snot |
|
67 | 67 | |
|
68 | 68 | Revert subrepo and test subrepo fileset keyword: |
|
69 | 69 | |
|
70 | 70 | $ echo b > s/a |
|
71 | 71 | $ hg revert --dry-run "set:subrepo('glob:s*')" |
|
72 | 72 | reverting subrepo s |
|
73 | 73 | reverting s/a (glob) |
|
74 | 74 | $ cat s/a |
|
75 | 75 | b |
|
76 | 76 | $ hg revert "set:subrepo('glob:s*')" |
|
77 | 77 | reverting subrepo s |
|
78 | 78 | reverting s/a (glob) |
|
79 | 79 | $ cat s/a |
|
80 | 80 | a |
|
81 | 81 | $ rm s/a.orig |
|
82 | 82 | |
|
83 | 83 | Revert subrepo with no backup. The "reverting s/a" line is gone since |
|
84 | 84 | we're really running 'hg update' in the subrepo: |
|
85 | 85 | |
|
86 | 86 | $ echo b > s/a |
|
87 | 87 | $ hg revert --no-backup s |
|
88 | 88 | reverting subrepo s |
|
89 | 89 | |
|
90 | 90 | Issue2022: update -C |
|
91 | 91 | |
|
92 | 92 | $ echo b > s/a |
|
93 | 93 | $ hg sum |
|
94 | 94 | parent: 1:7cf8cfea66e4 tip |
|
95 | 95 | 1 |
|
96 | 96 | branch: default |
|
97 | 97 | commit: 1 subrepos |
|
98 | 98 | update: (current) |
|
99 | 99 | phases: 2 draft |
|
100 | 100 | $ hg co -C 1 |
|
101 | 101 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 102 | $ hg sum |
|
103 | 103 | parent: 1:7cf8cfea66e4 tip |
|
104 | 104 | 1 |
|
105 | 105 | branch: default |
|
106 | 106 | commit: (clean) |
|
107 | 107 | update: (current) |
|
108 | 108 | phases: 2 draft |
|
109 | 109 | |
|
110 | 110 | commands that require a clean repo should respect subrepos |
|
111 | 111 | |
|
112 | 112 | $ echo b >> s/a |
|
113 | 113 | $ hg backout tip |
|
114 | 114 | abort: uncommitted changes in subrepository "s" |
|
115 | 115 | [255] |
|
116 | 116 | $ hg revert -C -R s s/a |
|
117 | 117 | |
|
118 | 118 | add sub sub |
|
119 | 119 | |
|
120 | 120 | $ echo ss = ss > s/.hgsub |
|
121 | 121 | $ hg init s/ss |
|
122 | 122 | $ echo a > s/ss/a |
|
123 | 123 | $ hg -R s add s/.hgsub |
|
124 | 124 | $ hg -R s/ss add s/ss/a |
|
125 | 125 | $ hg sum |
|
126 | 126 | parent: 1:7cf8cfea66e4 tip |
|
127 | 127 | 1 |
|
128 | 128 | branch: default |
|
129 | 129 | commit: 1 subrepos |
|
130 | 130 | update: (current) |
|
131 | 131 | phases: 2 draft |
|
132 | 132 | $ hg ci -m2 |
|
133 | 133 | committing subrepository s |
|
134 | 134 | committing subrepository s/ss (glob) |
|
135 | 135 | $ hg sum |
|
136 | 136 | parent: 2:df30734270ae tip |
|
137 | 137 | 2 |
|
138 | 138 | branch: default |
|
139 | 139 | commit: (clean) |
|
140 | 140 | update: (current) |
|
141 | 141 | phases: 3 draft |
|
142 | 142 | |
|
143 | 143 | test handling .hgsubstate "modified" explicitly. |
|
144 | 144 | |
|
145 | 145 | $ hg parents --template '{node}\n{files}\n' |
|
146 | 146 | df30734270ae757feb35e643b7018e818e78a9aa |
|
147 | 147 | .hgsubstate |
|
148 | 148 | $ hg rollback -q |
|
149 | 149 | $ hg status -A .hgsubstate |
|
150 | 150 | M .hgsubstate |
|
151 | 151 | $ hg ci -m2 |
|
152 | 152 | $ hg parents --template '{node}\n{files}\n' |
|
153 | 153 | df30734270ae757feb35e643b7018e818e78a9aa |
|
154 | 154 | .hgsubstate |
|
155 | 155 | |
|
156 | 156 | bump sub rev (and check it is ignored by ui.commitsubrepos) |
|
157 | 157 | |
|
158 | 158 | $ echo b > s/a |
|
159 | 159 | $ hg -R s ci -ms1 |
|
160 | 160 | $ hg --config ui.commitsubrepos=no ci -m3 |
|
161 | 161 | |
|
162 | 162 | leave sub dirty (and check ui.commitsubrepos=no aborts the commit) |
|
163 | 163 | |
|
164 | 164 | $ echo c > s/a |
|
165 | 165 | $ hg --config ui.commitsubrepos=no ci -m4 |
|
166 | 166 | abort: uncommitted changes in subrepository "s" |
|
167 | 167 | (use --subrepos for recursive commit) |
|
168 | 168 | [255] |
|
169 | 169 | $ hg id |
|
170 | 170 | f6affe3fbfaa+ tip |
|
171 | 171 | $ hg -R s ci -mc |
|
172 | 172 | $ hg id |
|
173 | 173 | f6affe3fbfaa+ tip |
|
174 | 174 | $ echo d > s/a |
|
175 | 175 | $ hg ci -m4 |
|
176 | 176 | committing subrepository s |
|
177 | 177 | $ hg tip -R s |
|
178 | 178 | changeset: 4:02dcf1d70411 |
|
179 | 179 | tag: tip |
|
180 | 180 | user: test |
|
181 | 181 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
182 | 182 | summary: 4 |
|
183 | 183 | |
|
184 | 184 | |
|
185 | 185 | check caching |
|
186 | 186 | |
|
187 | 187 | $ hg co 0 |
|
188 | 188 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
189 | 189 | $ hg debugsub |
|
190 | 190 | |
|
191 | 191 | restore |
|
192 | 192 | |
|
193 | 193 | $ hg co |
|
194 | 194 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
195 | 195 | $ hg debugsub |
|
196 | 196 | path s |
|
197 | 197 | source s |
|
198 | 198 | revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef |
|
199 | 199 | |
|
200 | 200 | new branch for merge tests |
|
201 | 201 | |
|
202 | 202 | $ hg co 1 |
|
203 | 203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
204 | 204 | $ echo t = t >> .hgsub |
|
205 | 205 | $ hg init t |
|
206 | 206 | $ echo t > t/t |
|
207 | 207 | $ hg -R t add t |
|
208 | 208 | adding t/t (glob) |
|
209 | 209 | |
|
210 | 210 | 5 |
|
211 | 211 | |
|
212 | 212 | $ hg ci -m5 # add sub |
|
213 | 213 | committing subrepository t |
|
214 | 214 | created new head |
|
215 | 215 | $ echo t2 > t/t |
|
216 | 216 | |
|
217 | 217 | 6 |
|
218 | 218 | |
|
219 | 219 | $ hg st -R s |
|
220 | 220 | $ hg ci -m6 # change sub |
|
221 | 221 | committing subrepository t |
|
222 | 222 | $ hg debugsub |
|
223 | 223 | path s |
|
224 | 224 | source s |
|
225 | 225 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
226 | 226 | path t |
|
227 | 227 | source t |
|
228 | 228 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
229 | 229 | $ echo t3 > t/t |
|
230 | 230 | |
|
231 | 231 | 7 |
|
232 | 232 | |
|
233 | 233 | $ hg ci -m7 # change sub again for conflict test |
|
234 | 234 | committing subrepository t |
|
235 | 235 | $ hg rm .hgsub |
|
236 | 236 | |
|
237 | 237 | 8 |
|
238 | 238 | |
|
239 | 239 | $ hg ci -m8 # remove sub |
|
240 | 240 | |
|
241 | 241 | test handling .hgsubstate "removed" explicitly. |
|
242 | 242 | |
|
243 | 243 | $ hg parents --template '{node}\n{files}\n' |
|
244 | 244 | 96615c1dad2dc8e3796d7332c77ce69156f7b78e |
|
245 | 245 | .hgsub .hgsubstate |
|
246 | 246 | $ hg rollback -q |
|
247 | 247 | $ hg remove .hgsubstate |
|
248 | 248 | $ hg ci -m8 |
|
249 | 249 | $ hg parents --template '{node}\n{files}\n' |
|
250 | 250 | 96615c1dad2dc8e3796d7332c77ce69156f7b78e |
|
251 | 251 | .hgsub .hgsubstate |
|
252 | 252 | |
|
253 | 253 | merge tests |
|
254 | 254 | |
|
255 | 255 | $ hg co -C 3 |
|
256 | 256 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
257 | 257 | $ hg merge 5 # test adding |
|
258 | 258 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
259 | 259 | (branch merge, don't forget to commit) |
|
260 | 260 | $ hg debugsub |
|
261 | 261 | path s |
|
262 | 262 | source s |
|
263 | 263 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
264 | 264 | path t |
|
265 | 265 | source t |
|
266 | 266 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 |
|
267 | 267 | $ hg ci -m9 |
|
268 | 268 | created new head |
|
269 | 269 | $ hg merge 6 --debug # test change |
|
270 | 270 | searching for copies back to rev 2 |
|
271 | 271 | resolving manifests |
|
272 | 272 | branchmerge: True, force: False, partial: False |
|
273 | 273 | ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4 |
|
274 | 274 | starting 4 threads for background file closing (?) |
|
275 | 275 | .hgsubstate: versions differ -> m (premerge) |
|
276 | 276 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec |
|
277 | 277 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg |
|
278 | 278 | getting subrepo t |
|
279 | 279 | resolving manifests |
|
280 | 280 | branchmerge: False, force: False, partial: False |
|
281 | 281 | ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a |
|
282 | 282 | t: remote is newer -> g |
|
283 | 283 | getting t |
|
284 | 284 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
285 | 285 | (branch merge, don't forget to commit) |
|
286 | 286 | $ hg debugsub |
|
287 | 287 | path s |
|
288 | 288 | source s |
|
289 | 289 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
290 | 290 | path t |
|
291 | 291 | source t |
|
292 | 292 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
293 | 293 | $ echo conflict > t/t |
|
294 | 294 | $ hg ci -m10 |
|
295 | 295 | committing subrepository t |
|
296 | 296 | $ HGMERGE=internal:merge hg merge --debug 7 # test conflict |
|
297 | 297 | searching for copies back to rev 2 |
|
298 | 298 | resolving manifests |
|
299 | 299 | branchmerge: True, force: False, partial: False |
|
300 | 300 | ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf |
|
301 | 301 | starting 4 threads for background file closing (?) |
|
302 | 302 | .hgsubstate: versions differ -> m (premerge) |
|
303 | 303 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 |
|
304 | 304 | subrepo t: both sides changed |
|
305 | 305 | subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198) |
|
306 | 306 | starting 4 threads for background file closing (?) |
|
307 | 307 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m |
|
308 | 308 | merging subrepository "t" |
|
309 | 309 | searching for copies back to rev 2 |
|
310 | 310 | resolving manifests |
|
311 | 311 | branchmerge: True, force: False, partial: False |
|
312 | 312 | ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198 |
|
313 | 313 | preserving t for resolve of t |
|
314 | 314 | starting 4 threads for background file closing (?) |
|
315 | 315 | t: versions differ -> m (premerge) |
|
316 | 316 | picked tool ':merge' for t (binary False symlink False changedelete False) |
|
317 | 317 | merging t |
|
318 | 318 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
319 | 319 | t: versions differ -> m (merge) |
|
320 | 320 | picked tool ':merge' for t (binary False symlink False changedelete False) |
|
321 | 321 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
322 | 322 | warning: conflicts while merging t! (edit, then use 'hg resolve --mark') |
|
323 | 323 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
324 | 324 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
325 | 325 | subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg |
|
326 | 326 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
327 | 327 | (branch merge, don't forget to commit) |
|
328 | 328 | |
|
329 | 329 | should conflict |
|
330 | 330 | |
|
331 | 331 | $ cat t/t |
|
332 | 332 | <<<<<<< local: 20a0db6fbf6c - test: 10 |
|
333 | 333 | conflict |
|
334 | 334 | ======= |
|
335 | 335 | t3 |
|
336 | 336 | >>>>>>> other: 7af322bc1198 - test: 7 |
|
337 | 337 | |
|
338 | 338 | 11: remove subrepo t |
|
339 | 339 | |
|
340 | 340 | $ hg co -C 5 |
|
341 | 341 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
342 | 342 | $ hg revert -r 4 .hgsub # remove t |
|
343 | 343 | $ hg ci -m11 |
|
344 | 344 | created new head |
|
345 | 345 | $ hg debugsub |
|
346 | 346 | path s |
|
347 | 347 | source s |
|
348 | 348 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
349 | 349 | |
|
350 | 350 | local removed, remote changed, keep changed |
|
351 | 351 | |
|
352 | 352 | $ hg merge 6 |
|
353 | 353 | remote [merge rev] changed subrepository t which local [working copy] removed |
|
354 | 354 | use (c)hanged version or (d)elete? c |
|
355 | 355 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
356 | 356 | (branch merge, don't forget to commit) |
|
357 | 357 | BROKEN: should include subrepo t |
|
358 | 358 | $ hg debugsub |
|
359 | 359 | path s |
|
360 | 360 | source s |
|
361 | 361 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
362 | 362 | $ cat .hgsubstate |
|
363 | 363 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
364 | 364 | 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t |
|
365 | 365 | $ hg ci -m 'local removed, remote changed, keep changed' |
|
366 | 366 | BROKEN: should include subrepo t |
|
367 | 367 | $ hg debugsub |
|
368 | 368 | path s |
|
369 | 369 | source s |
|
370 | 370 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
371 | 371 | BROKEN: should include subrepo t |
|
372 | 372 | $ cat .hgsubstate |
|
373 | 373 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
374 | 374 | $ cat t/t |
|
375 | 375 | t2 |
|
376 | 376 | |
|
377 | 377 | local removed, remote changed, keep removed |
|
378 | 378 | |
|
379 | 379 | $ hg co -C 11 |
|
380 | 380 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
381 | 381 | $ hg merge --config ui.interactive=true 6 <<EOF |
|
382 | 382 | > d |
|
383 | 383 | > EOF |
|
384 | 384 | remote [merge rev] changed subrepository t which local [working copy] removed |
|
385 | 385 | use (c)hanged version or (d)elete? d |
|
386 | 386 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
387 | 387 | (branch merge, don't forget to commit) |
|
388 | 388 | $ hg debugsub |
|
389 | 389 | path s |
|
390 | 390 | source s |
|
391 | 391 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
392 | 392 | $ cat .hgsubstate |
|
393 | 393 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
394 | 394 | $ hg ci -m 'local removed, remote changed, keep removed' |
|
395 | 395 | created new head |
|
396 | 396 | $ hg debugsub |
|
397 | 397 | path s |
|
398 | 398 | source s |
|
399 | 399 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
400 | 400 | $ cat .hgsubstate |
|
401 | 401 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
402 | 402 | |
|
403 | 403 | local changed, remote removed, keep changed |
|
404 | 404 | |
|
405 | 405 | $ hg co -C 6 |
|
406 | 406 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
407 | 407 | $ hg merge 11 |
|
408 | 408 | local [working copy] changed subrepository t which remote [merge rev] removed |
|
409 | 409 | use (c)hanged version or (d)elete? c |
|
410 | 410 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
411 | 411 | (branch merge, don't forget to commit) |
|
412 | 412 | BROKEN: should include subrepo t |
|
413 | 413 | $ hg debugsub |
|
414 | 414 | path s |
|
415 | 415 | source s |
|
416 | 416 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
417 | 417 | BROKEN: should include subrepo t |
|
418 | 418 | $ cat .hgsubstate |
|
419 | 419 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
420 | 420 | $ hg ci -m 'local changed, remote removed, keep changed' |
|
421 | 421 | created new head |
|
422 | 422 | BROKEN: should include subrepo t |
|
423 | 423 | $ hg debugsub |
|
424 | 424 | path s |
|
425 | 425 | source s |
|
426 | 426 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
427 | 427 | BROKEN: should include subrepo t |
|
428 | 428 | $ cat .hgsubstate |
|
429 | 429 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
430 | 430 | $ cat t/t |
|
431 | 431 | t2 |
|
432 | 432 | |
|
433 | 433 | local changed, remote removed, keep removed |
|
434 | 434 | |
|
435 | 435 | $ hg co -C 6 |
|
436 | 436 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
437 | 437 | $ hg merge --config ui.interactive=true 11 <<EOF |
|
438 | 438 | > d |
|
439 | 439 | > EOF |
|
440 | 440 | local [working copy] changed subrepository t which remote [merge rev] removed |
|
441 | 441 | use (c)hanged version or (d)elete? d |
|
442 | 442 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
443 | 443 | (branch merge, don't forget to commit) |
|
444 | 444 | $ hg debugsub |
|
445 | 445 | path s |
|
446 | 446 | source s |
|
447 | 447 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
448 | 448 | $ cat .hgsubstate |
|
449 | 449 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
450 | 450 | $ hg ci -m 'local changed, remote removed, keep removed' |
|
451 | 451 | created new head |
|
452 | 452 | $ hg debugsub |
|
453 | 453 | path s |
|
454 | 454 | source s |
|
455 | 455 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
456 | 456 | $ cat .hgsubstate |
|
457 | 457 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
458 | 458 | |
|
459 | 459 | clean up to avoid having to fix up the tests below |
|
460 | 460 | |
|
461 | 461 | $ hg co -C 10 |
|
462 | 462 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
463 | 463 | $ cat >> $HGRCPATH <<EOF |
|
464 | 464 | > [extensions] |
|
465 | 465 | > strip= |
|
466 | 466 | > EOF |
|
467 | 467 | $ hg strip -r 11:15 |
|
468 | 468 | saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob) |
|
469 | 469 | |
|
470 | 470 | clone |
|
471 | 471 | |
|
472 | 472 | $ cd .. |
|
473 | 473 | $ hg clone t tc |
|
474 | 474 | updating to branch default |
|
475 | 475 | cloning subrepo s from $TESTTMP/t/s |
|
476 | 476 | cloning subrepo s/ss from $TESTTMP/t/s/ss (glob) |
|
477 | 477 | cloning subrepo t from $TESTTMP/t/t |
|
478 | 478 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
479 | 479 | $ cd tc |
|
480 | 480 | $ hg debugsub |
|
481 | 481 | path s |
|
482 | 482 | source s |
|
483 | 483 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
484 | 484 | path t |
|
485 | 485 | source t |
|
486 | 486 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e |
|
487 | 487 | $ cd .. |
|
488 | 488 | |
|
489 | 489 | clone with subrepo disabled (update should fail) |
|
490 | 490 | |
|
491 | $ hg clone t -U tc2 --config subrepos.allowed= | |
|
492 | $ hg update -R tc2 --config subrepos.allowed= | |
|
493 |
abort: subrepo |
|
|
491 | $ hg clone t -U tc2 --config subrepos.allowed=false | |
|
492 | $ hg update -R tc2 --config subrepos.allowed=false | |
|
493 | abort: subrepos not enabled | |
|
494 | 494 | (see 'hg help config.subrepos' for details) |
|
495 | 495 | [255] |
|
496 | 496 | $ ls tc2 |
|
497 | 497 | a |
|
498 | 498 | |
|
499 | $ hg clone t tc3 --config subrepos.allowed= | |
|
499 | $ hg clone t tc3 --config subrepos.allowed=false | |
|
500 | 500 | updating to branch default |
|
501 |
abort: subrepo |
|
|
501 | abort: subrepos not enabled | |
|
502 | 502 | (see 'hg help config.subrepos' for details) |
|
503 | 503 | [255] |
|
504 | 504 | $ ls tc3 |
|
505 | 505 | a |
|
506 | 506 | |
|
507 | $ hg clone t tc4 --config subrepos.allowed=git | |
|
508 | updating to branch default | |
|
509 | abort: subrepo type hg not allowed | |
|
507 | And again with just the hg type disabled | |
|
508 | ||
|
509 | $ hg clone t -U tc4 --config subrepos.hg:allowed=false | |
|
510 | $ hg update -R tc4 --config subrepos.hg:allowed=false | |
|
511 | abort: hg subrepos not allowed | |
|
510 | 512 | (see 'hg help config.subrepos' for details) |
|
511 | 513 | [255] |
|
512 | 514 | $ ls tc4 |
|
513 | 515 | a |
|
514 | 516 | |
|
517 | $ hg clone t tc5 --config subrepos.hg:allowed=false | |
|
518 | updating to branch default | |
|
519 | abort: hg subrepos not allowed | |
|
520 | (see 'hg help config.subrepos' for details) | |
|
521 | [255] | |
|
522 | $ ls tc5 | |
|
523 | a | |
|
524 | ||
|
515 | 525 | push |
|
516 | 526 | |
|
517 | 527 | $ cd tc |
|
518 | 528 | $ echo bah > t/t |
|
519 | 529 | $ hg ci -m11 |
|
520 | 530 | committing subrepository t |
|
521 | 531 | $ hg push |
|
522 | 532 | pushing to $TESTTMP/t (glob) |
|
523 | 533 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
524 | 534 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
525 | 535 | pushing subrepo t to $TESTTMP/t/t |
|
526 | 536 | searching for changes |
|
527 | 537 | adding changesets |
|
528 | 538 | adding manifests |
|
529 | 539 | adding file changes |
|
530 | 540 | added 1 changesets with 1 changes to 1 files |
|
531 | 541 | searching for changes |
|
532 | 542 | adding changesets |
|
533 | 543 | adding manifests |
|
534 | 544 | adding file changes |
|
535 | 545 | added 1 changesets with 1 changes to 1 files |
|
536 | 546 | |
|
537 | 547 | push -f |
|
538 | 548 | |
|
539 | 549 | $ echo bah > s/a |
|
540 | 550 | $ hg ci -m12 |
|
541 | 551 | committing subrepository s |
|
542 | 552 | $ hg push |
|
543 | 553 | pushing to $TESTTMP/t (glob) |
|
544 | 554 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
545 | 555 | pushing subrepo s to $TESTTMP/t/s |
|
546 | 556 | searching for changes |
|
547 | 557 | abort: push creates new remote head 12a213df6fa9! (in subrepository "s") |
|
548 | 558 | (merge or see 'hg help push' for details about pushing new heads) |
|
549 | 559 | [255] |
|
550 | 560 | $ hg push -f |
|
551 | 561 | pushing to $TESTTMP/t (glob) |
|
552 | 562 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
553 | 563 | searching for changes |
|
554 | 564 | no changes found |
|
555 | 565 | pushing subrepo s to $TESTTMP/t/s |
|
556 | 566 | searching for changes |
|
557 | 567 | adding changesets |
|
558 | 568 | adding manifests |
|
559 | 569 | adding file changes |
|
560 | 570 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
561 | 571 | pushing subrepo t to $TESTTMP/t/t |
|
562 | 572 | searching for changes |
|
563 | 573 | no changes found |
|
564 | 574 | searching for changes |
|
565 | 575 | adding changesets |
|
566 | 576 | adding manifests |
|
567 | 577 | adding file changes |
|
568 | 578 | added 1 changesets with 1 changes to 1 files |
|
569 | 579 | |
|
570 | 580 | check that unmodified subrepos are not pushed |
|
571 | 581 | |
|
572 | 582 | $ hg clone . ../tcc |
|
573 | 583 | updating to branch default |
|
574 | 584 | cloning subrepo s from $TESTTMP/tc/s |
|
575 | 585 | cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob) |
|
576 | 586 | cloning subrepo t from $TESTTMP/tc/t |
|
577 | 587 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
578 | 588 | |
|
579 | 589 | the subrepos on the new clone have nothing to push to its source |
|
580 | 590 | |
|
581 | 591 | $ hg push -R ../tcc . |
|
582 | 592 | pushing to . |
|
583 | 593 | no changes made to subrepo s/ss since last push to s/ss (glob) |
|
584 | 594 | no changes made to subrepo s since last push to s |
|
585 | 595 | no changes made to subrepo t since last push to t |
|
586 | 596 | searching for changes |
|
587 | 597 | no changes found |
|
588 | 598 | [1] |
|
589 | 599 | |
|
590 | 600 | the subrepos on the source do not have a clean store versus the clone target |
|
591 | 601 | because they were never explicitly pushed to the source |
|
592 | 602 | |
|
593 | 603 | $ hg push ../tcc |
|
594 | 604 | pushing to ../tcc |
|
595 | 605 | pushing subrepo s/ss to ../tcc/s/ss (glob) |
|
596 | 606 | searching for changes |
|
597 | 607 | no changes found |
|
598 | 608 | pushing subrepo s to ../tcc/s |
|
599 | 609 | searching for changes |
|
600 | 610 | no changes found |
|
601 | 611 | pushing subrepo t to ../tcc/t |
|
602 | 612 | searching for changes |
|
603 | 613 | no changes found |
|
604 | 614 | searching for changes |
|
605 | 615 | no changes found |
|
606 | 616 | [1] |
|
607 | 617 | |
|
608 | 618 | after push their stores become clean |
|
609 | 619 | |
|
610 | 620 | $ hg push ../tcc |
|
611 | 621 | pushing to ../tcc |
|
612 | 622 | no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob) |
|
613 | 623 | no changes made to subrepo s since last push to ../tcc/s |
|
614 | 624 | no changes made to subrepo t since last push to ../tcc/t |
|
615 | 625 | searching for changes |
|
616 | 626 | no changes found |
|
617 | 627 | [1] |
|
618 | 628 | |
|
619 | 629 | updating a subrepo to a different revision or changing |
|
620 | 630 | its working directory does not make its store dirty |
|
621 | 631 | |
|
622 | 632 | $ hg -R s update '.^' |
|
623 | 633 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
624 | 634 | $ hg push |
|
625 | 635 | pushing to $TESTTMP/t (glob) |
|
626 | 636 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
627 | 637 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
628 | 638 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
629 | 639 | searching for changes |
|
630 | 640 | no changes found |
|
631 | 641 | [1] |
|
632 | 642 | $ echo foo >> s/a |
|
633 | 643 | $ hg push |
|
634 | 644 | pushing to $TESTTMP/t (glob) |
|
635 | 645 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
636 | 646 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
637 | 647 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
638 | 648 | searching for changes |
|
639 | 649 | no changes found |
|
640 | 650 | [1] |
|
641 | 651 | $ hg -R s update -C tip |
|
642 | 652 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
643 | 653 | |
|
644 | 654 | committing into a subrepo makes its store (but not its parent's store) dirty |
|
645 | 655 | |
|
646 | 656 | $ echo foo >> s/ss/a |
|
647 | 657 | $ hg -R s/ss commit -m 'test dirty store detection' |
|
648 | 658 | |
|
649 | 659 | $ hg out -S -r `hg log -r tip -T "{node|short}"` |
|
650 | 660 | comparing with $TESTTMP/t (glob) |
|
651 | 661 | searching for changes |
|
652 | 662 | no changes found |
|
653 | 663 | comparing with $TESTTMP/t/s |
|
654 | 664 | searching for changes |
|
655 | 665 | no changes found |
|
656 | 666 | comparing with $TESTTMP/t/s/ss |
|
657 | 667 | searching for changes |
|
658 | 668 | changeset: 1:79ea5566a333 |
|
659 | 669 | tag: tip |
|
660 | 670 | user: test |
|
661 | 671 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
662 | 672 | summary: test dirty store detection |
|
663 | 673 | |
|
664 | 674 | comparing with $TESTTMP/t/t |
|
665 | 675 | searching for changes |
|
666 | 676 | no changes found |
|
667 | 677 | |
|
668 | 678 | $ hg push |
|
669 | 679 | pushing to $TESTTMP/t (glob) |
|
670 | 680 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
671 | 681 | searching for changes |
|
672 | 682 | adding changesets |
|
673 | 683 | adding manifests |
|
674 | 684 | adding file changes |
|
675 | 685 | added 1 changesets with 1 changes to 1 files |
|
676 | 686 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
677 | 687 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
678 | 688 | searching for changes |
|
679 | 689 | no changes found |
|
680 | 690 | [1] |
|
681 | 691 | |
|
682 | 692 | a subrepo store may be clean versus one repo but not versus another |
|
683 | 693 | |
|
684 | 694 | $ hg push |
|
685 | 695 | pushing to $TESTTMP/t (glob) |
|
686 | 696 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
687 | 697 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
688 | 698 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
689 | 699 | searching for changes |
|
690 | 700 | no changes found |
|
691 | 701 | [1] |
|
692 | 702 | $ hg push ../tcc |
|
693 | 703 | pushing to ../tcc |
|
694 | 704 | pushing subrepo s/ss to ../tcc/s/ss (glob) |
|
695 | 705 | searching for changes |
|
696 | 706 | adding changesets |
|
697 | 707 | adding manifests |
|
698 | 708 | adding file changes |
|
699 | 709 | added 1 changesets with 1 changes to 1 files |
|
700 | 710 | no changes made to subrepo s since last push to ../tcc/s |
|
701 | 711 | no changes made to subrepo t since last push to ../tcc/t |
|
702 | 712 | searching for changes |
|
703 | 713 | no changes found |
|
704 | 714 | [1] |
|
705 | 715 | |
|
706 | 716 | update |
|
707 | 717 | |
|
708 | 718 | $ cd ../t |
|
709 | 719 | $ hg up -C # discard our earlier merge |
|
710 | 720 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
711 | 721 | updated to "c373c8102e68: 12" |
|
712 | 722 | 2 other heads for branch "default" |
|
713 | 723 | $ echo blah > t/t |
|
714 | 724 | $ hg ci -m13 |
|
715 | 725 | committing subrepository t |
|
716 | 726 | |
|
717 | 727 | backout calls revert internally with minimal opts, which should not raise |
|
718 | 728 | KeyError |
|
719 | 729 | |
|
720 | 730 | $ hg backout ".^" --no-commit |
|
721 | 731 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
722 | 732 | changeset c373c8102e68 backed out, don't forget to commit. |
|
723 | 733 | |
|
724 | 734 | $ hg up -C # discard changes |
|
725 | 735 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
726 | 736 | updated to "925c17564ef8: 13" |
|
727 | 737 | 2 other heads for branch "default" |
|
728 | 738 | |
|
729 | 739 | pull |
|
730 | 740 | |
|
731 | 741 | $ cd ../tc |
|
732 | 742 | $ hg pull |
|
733 | 743 | pulling from $TESTTMP/t (glob) |
|
734 | 744 | searching for changes |
|
735 | 745 | adding changesets |
|
736 | 746 | adding manifests |
|
737 | 747 | adding file changes |
|
738 | 748 | added 1 changesets with 1 changes to 1 files |
|
739 | 749 | new changesets 925c17564ef8 |
|
740 | 750 | (run 'hg update' to get a working copy) |
|
741 | 751 | |
|
742 | 752 | should pull t |
|
743 | 753 | |
|
744 | 754 | $ hg incoming -S -r `hg log -r tip -T "{node|short}"` |
|
745 | 755 | comparing with $TESTTMP/t (glob) |
|
746 | 756 | no changes found |
|
747 | 757 | comparing with $TESTTMP/t/s |
|
748 | 758 | searching for changes |
|
749 | 759 | no changes found |
|
750 | 760 | comparing with $TESTTMP/t/s/ss |
|
751 | 761 | searching for changes |
|
752 | 762 | no changes found |
|
753 | 763 | comparing with $TESTTMP/t/t |
|
754 | 764 | searching for changes |
|
755 | 765 | changeset: 5:52c0adc0515a |
|
756 | 766 | tag: tip |
|
757 | 767 | user: test |
|
758 | 768 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
759 | 769 | summary: 13 |
|
760 | 770 | |
|
761 | 771 | |
|
762 | 772 | $ hg up |
|
763 | 773 | pulling subrepo t from $TESTTMP/t/t |
|
764 | 774 | searching for changes |
|
765 | 775 | adding changesets |
|
766 | 776 | adding manifests |
|
767 | 777 | adding file changes |
|
768 | 778 | added 1 changesets with 1 changes to 1 files |
|
769 | 779 | new changesets 52c0adc0515a |
|
770 | 780 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
771 | 781 | updated to "925c17564ef8: 13" |
|
772 | 782 | 2 other heads for branch "default" |
|
773 | 783 | $ cat t/t |
|
774 | 784 | blah |
|
775 | 785 | |
|
776 | 786 | bogus subrepo path aborts |
|
777 | 787 | |
|
778 | 788 | $ echo 'bogus=[boguspath' >> .hgsub |
|
779 | 789 | $ hg ci -m 'bogus subrepo path' |
|
780 | 790 | abort: missing ] in subrepository source |
|
781 | 791 | [255] |
|
782 | 792 | |
|
783 | 793 | Issue1986: merge aborts when trying to merge a subrepo that |
|
784 | 794 | shouldn't need merging |
|
785 | 795 | |
|
786 | 796 | # subrepo layout |
|
787 | 797 | # |
|
788 | 798 | # o 5 br |
|
789 | 799 | # /| |
|
790 | 800 | # o | 4 default |
|
791 | 801 | # | | |
|
792 | 802 | # | o 3 br |
|
793 | 803 | # |/| |
|
794 | 804 | # o | 2 default |
|
795 | 805 | # | | |
|
796 | 806 | # | o 1 br |
|
797 | 807 | # |/ |
|
798 | 808 | # o 0 default |
|
799 | 809 | |
|
800 | 810 | $ cd .. |
|
801 | 811 | $ rm -rf sub |
|
802 | 812 | $ hg init main |
|
803 | 813 | $ cd main |
|
804 | 814 | $ hg init s |
|
805 | 815 | $ cd s |
|
806 | 816 | $ echo a > a |
|
807 | 817 | $ hg ci -Am1 |
|
808 | 818 | adding a |
|
809 | 819 | $ hg branch br |
|
810 | 820 | marked working directory as branch br |
|
811 | 821 | (branches are permanent and global, did you want a bookmark?) |
|
812 | 822 | $ echo a >> a |
|
813 | 823 | $ hg ci -m1 |
|
814 | 824 | $ hg up default |
|
815 | 825 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
816 | 826 | $ echo b > b |
|
817 | 827 | $ hg ci -Am1 |
|
818 | 828 | adding b |
|
819 | 829 | $ hg up br |
|
820 | 830 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
821 | 831 | $ hg merge tip |
|
822 | 832 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
823 | 833 | (branch merge, don't forget to commit) |
|
824 | 834 | $ hg ci -m1 |
|
825 | 835 | $ hg up 2 |
|
826 | 836 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
827 | 837 | $ echo c > c |
|
828 | 838 | $ hg ci -Am1 |
|
829 | 839 | adding c |
|
830 | 840 | $ hg up 3 |
|
831 | 841 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
832 | 842 | $ hg merge 4 |
|
833 | 843 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
834 | 844 | (branch merge, don't forget to commit) |
|
835 | 845 | $ hg ci -m1 |
|
836 | 846 | |
|
837 | 847 | # main repo layout: |
|
838 | 848 | # |
|
839 | 849 | # * <-- try to merge default into br again |
|
840 | 850 | # .`| |
|
841 | 851 | # . o 5 br --> substate = 5 |
|
842 | 852 | # . | |
|
843 | 853 | # o | 4 default --> substate = 4 |
|
844 | 854 | # | | |
|
845 | 855 | # | o 3 br --> substate = 2 |
|
846 | 856 | # |/| |
|
847 | 857 | # o | 2 default --> substate = 2 |
|
848 | 858 | # | | |
|
849 | 859 | # | o 1 br --> substate = 3 |
|
850 | 860 | # |/ |
|
851 | 861 | # o 0 default --> substate = 2 |
|
852 | 862 | |
|
853 | 863 | $ cd .. |
|
854 | 864 | $ echo 's = s' > .hgsub |
|
855 | 865 | $ hg -R s up 2 |
|
856 | 866 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
857 | 867 | $ hg ci -Am1 |
|
858 | 868 | adding .hgsub |
|
859 | 869 | $ hg branch br |
|
860 | 870 | marked working directory as branch br |
|
861 | 871 | (branches are permanent and global, did you want a bookmark?) |
|
862 | 872 | $ echo b > b |
|
863 | 873 | $ hg -R s up 3 |
|
864 | 874 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
865 | 875 | $ hg ci -Am1 |
|
866 | 876 | adding b |
|
867 | 877 | $ hg up default |
|
868 | 878 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
869 | 879 | $ echo c > c |
|
870 | 880 | $ hg ci -Am1 |
|
871 | 881 | adding c |
|
872 | 882 | $ hg up 1 |
|
873 | 883 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
874 | 884 | $ hg merge 2 |
|
875 | 885 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
876 | 886 | (branch merge, don't forget to commit) |
|
877 | 887 | $ hg ci -m1 |
|
878 | 888 | $ hg up 2 |
|
879 | 889 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
880 | 890 | $ hg -R s up 4 |
|
881 | 891 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
882 | 892 | $ echo d > d |
|
883 | 893 | $ hg ci -Am1 |
|
884 | 894 | adding d |
|
885 | 895 | $ hg up 3 |
|
886 | 896 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
887 | 897 | $ hg -R s up 5 |
|
888 | 898 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
889 | 899 | $ echo e > e |
|
890 | 900 | $ hg ci -Am1 |
|
891 | 901 | adding e |
|
892 | 902 | |
|
893 | 903 | $ hg up 5 |
|
894 | 904 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
895 | 905 | $ hg merge 4 # try to merge default into br again |
|
896 | 906 | subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88) |
|
897 | 907 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m |
|
898 | 908 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
899 | 909 | (branch merge, don't forget to commit) |
|
900 | 910 | $ cd .. |
|
901 | 911 | |
|
902 | 912 | test subrepo delete from .hgsubstate |
|
903 | 913 | |
|
904 | 914 | $ hg init testdelete |
|
905 | 915 | $ mkdir testdelete/nested testdelete/nested2 |
|
906 | 916 | $ hg init testdelete/nested |
|
907 | 917 | $ hg init testdelete/nested2 |
|
908 | 918 | $ echo test > testdelete/nested/foo |
|
909 | 919 | $ echo test > testdelete/nested2/foo |
|
910 | 920 | $ hg -R testdelete/nested add |
|
911 | 921 | adding testdelete/nested/foo (glob) |
|
912 | 922 | $ hg -R testdelete/nested2 add |
|
913 | 923 | adding testdelete/nested2/foo (glob) |
|
914 | 924 | $ hg -R testdelete/nested ci -m test |
|
915 | 925 | $ hg -R testdelete/nested2 ci -m test |
|
916 | 926 | $ echo nested = nested > testdelete/.hgsub |
|
917 | 927 | $ echo nested2 = nested2 >> testdelete/.hgsub |
|
918 | 928 | $ hg -R testdelete add |
|
919 | 929 | adding testdelete/.hgsub (glob) |
|
920 | 930 | $ hg -R testdelete ci -m "nested 1 & 2 added" |
|
921 | 931 | $ echo nested = nested > testdelete/.hgsub |
|
922 | 932 | $ hg -R testdelete ci -m "nested 2 deleted" |
|
923 | 933 | $ cat testdelete/.hgsubstate |
|
924 | 934 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
925 | 935 | $ hg -R testdelete remove testdelete/.hgsub |
|
926 | 936 | $ hg -R testdelete ci -m ".hgsub deleted" |
|
927 | 937 | $ cat testdelete/.hgsubstate |
|
928 | 938 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
929 | 939 | |
|
930 | 940 | test repository cloning |
|
931 | 941 | |
|
932 | 942 | $ mkdir mercurial mercurial2 |
|
933 | 943 | $ hg init nested_absolute |
|
934 | 944 | $ echo test > nested_absolute/foo |
|
935 | 945 | $ hg -R nested_absolute add |
|
936 | 946 | adding nested_absolute/foo (glob) |
|
937 | 947 | $ hg -R nested_absolute ci -mtest |
|
938 | 948 | $ cd mercurial |
|
939 | 949 | $ hg init nested_relative |
|
940 | 950 | $ echo test2 > nested_relative/foo2 |
|
941 | 951 | $ hg -R nested_relative add |
|
942 | 952 | adding nested_relative/foo2 (glob) |
|
943 | 953 | $ hg -R nested_relative ci -mtest2 |
|
944 | 954 | $ hg init main |
|
945 | 955 | $ echo "nested_relative = ../nested_relative" > main/.hgsub |
|
946 | 956 | $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub |
|
947 | 957 | $ hg -R main add |
|
948 | 958 | adding main/.hgsub (glob) |
|
949 | 959 | $ hg -R main ci -m "add subrepos" |
|
950 | 960 | $ cd .. |
|
951 | 961 | $ hg clone mercurial/main mercurial2/main |
|
952 | 962 | updating to branch default |
|
953 | 963 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
954 | 964 | $ cat mercurial2/main/nested_absolute/.hg/hgrc \ |
|
955 | 965 | > mercurial2/main/nested_relative/.hg/hgrc |
|
956 | 966 | [paths] |
|
957 | 967 | default = $TESTTMP/mercurial/nested_absolute |
|
958 | 968 | [paths] |
|
959 | 969 | default = $TESTTMP/mercurial/nested_relative |
|
960 | 970 | $ rm -rf mercurial mercurial2 |
|
961 | 971 | |
|
962 | 972 | Issue1977: multirepo push should fail if subrepo push fails |
|
963 | 973 | |
|
964 | 974 | $ hg init repo |
|
965 | 975 | $ hg init repo/s |
|
966 | 976 | $ echo a > repo/s/a |
|
967 | 977 | $ hg -R repo/s ci -Am0 |
|
968 | 978 | adding a |
|
969 | 979 | $ echo s = s > repo/.hgsub |
|
970 | 980 | $ hg -R repo ci -Am1 |
|
971 | 981 | adding .hgsub |
|
972 | 982 | $ hg clone repo repo2 |
|
973 | 983 | updating to branch default |
|
974 | 984 | cloning subrepo s from $TESTTMP/repo/s |
|
975 | 985 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
976 | 986 | $ hg -q -R repo2 pull -u |
|
977 | 987 | $ echo 1 > repo2/s/a |
|
978 | 988 | $ hg -R repo2/s ci -m2 |
|
979 | 989 | $ hg -q -R repo2/s push |
|
980 | 990 | $ hg -R repo2/s up -C 0 |
|
981 | 991 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
982 | 992 | $ echo 2 > repo2/s/b |
|
983 | 993 | $ hg -R repo2/s ci -m3 -A |
|
984 | 994 | adding b |
|
985 | 995 | created new head |
|
986 | 996 | $ hg -R repo2 ci -m3 |
|
987 | 997 | $ hg -q -R repo2 push |
|
988 | 998 | abort: push creates new remote head cc505f09a8b2! (in subrepository "s") |
|
989 | 999 | (merge or see 'hg help push' for details about pushing new heads) |
|
990 | 1000 | [255] |
|
991 | 1001 | $ hg -R repo update |
|
992 | 1002 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
993 | 1003 | |
|
994 | 1004 | test if untracked file is not overwritten |
|
995 | 1005 | |
|
996 | 1006 | (this also tests that updated .hgsubstate is treated as "modified", |
|
997 | 1007 | when 'merge.update()' is aborted before 'merge.recordupdates()', even |
|
998 | 1008 | if none of mode, size and timestamp of it isn't changed on the |
|
999 | 1009 | filesystem (see also issue4583)) |
|
1000 | 1010 | |
|
1001 | 1011 | $ echo issue3276_ok > repo/s/b |
|
1002 | 1012 | $ hg -R repo2 push -f -q |
|
1003 | 1013 | $ touch -t 200001010000 repo/.hgsubstate |
|
1004 | 1014 | |
|
1005 | 1015 | $ cat >> repo/.hg/hgrc <<EOF |
|
1006 | 1016 | > [fakedirstatewritetime] |
|
1007 | 1017 | > # emulate invoking dirstate.write() via repo.status() |
|
1008 | 1018 | > # at 2000-01-01 00:00 |
|
1009 | 1019 | > fakenow = 200001010000 |
|
1010 | 1020 | > |
|
1011 | 1021 | > [extensions] |
|
1012 | 1022 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
1013 | 1023 | > EOF |
|
1014 | 1024 | $ hg -R repo update |
|
1015 | 1025 | b: untracked file differs |
|
1016 | 1026 | abort: untracked files in working directory differ from files in requested revision (in subrepository "s") |
|
1017 | 1027 | [255] |
|
1018 | 1028 | $ cat >> repo/.hg/hgrc <<EOF |
|
1019 | 1029 | > [extensions] |
|
1020 | 1030 | > fakedirstatewritetime = ! |
|
1021 | 1031 | > EOF |
|
1022 | 1032 | |
|
1023 | 1033 | $ cat repo/s/b |
|
1024 | 1034 | issue3276_ok |
|
1025 | 1035 | $ rm repo/s/b |
|
1026 | 1036 | $ touch -t 200001010000 repo/.hgsubstate |
|
1027 | 1037 | $ hg -R repo revert --all |
|
1028 | 1038 | reverting repo/.hgsubstate (glob) |
|
1029 | 1039 | reverting subrepo s |
|
1030 | 1040 | $ hg -R repo update |
|
1031 | 1041 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1032 | 1042 | $ cat repo/s/b |
|
1033 | 1043 | 2 |
|
1034 | 1044 | $ rm -rf repo2 repo |
|
1035 | 1045 | |
|
1036 | 1046 | |
|
1037 | 1047 | Issue1852 subrepos with relative paths always push/pull relative to default |
|
1038 | 1048 | |
|
1039 | 1049 | Prepare a repo with subrepo |
|
1040 | 1050 | |
|
1041 | 1051 | $ hg init issue1852a |
|
1042 | 1052 | $ cd issue1852a |
|
1043 | 1053 | $ hg init sub/repo |
|
1044 | 1054 | $ echo test > sub/repo/foo |
|
1045 | 1055 | $ hg -R sub/repo add sub/repo/foo |
|
1046 | 1056 | $ echo sub/repo = sub/repo > .hgsub |
|
1047 | 1057 | $ hg add .hgsub |
|
1048 | 1058 | $ hg ci -mtest |
|
1049 | 1059 | committing subrepository sub/repo (glob) |
|
1050 | 1060 | $ echo test >> sub/repo/foo |
|
1051 | 1061 | $ hg ci -mtest |
|
1052 | 1062 | committing subrepository sub/repo (glob) |
|
1053 | 1063 | $ hg cat sub/repo/foo |
|
1054 | 1064 | test |
|
1055 | 1065 | test |
|
1056 | 1066 | $ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g' |
|
1057 | 1067 | [ |
|
1058 | 1068 | { |
|
1059 | 1069 | "abspath": "foo", |
|
1060 | 1070 | "data": "test\ntest\n", |
|
1061 | 1071 | "path": "sub/repo/foo" |
|
1062 | 1072 | } |
|
1063 | 1073 | ] |
|
1064 | 1074 | $ mkdir -p tmp/sub/repo |
|
1065 | 1075 | $ hg cat -r 0 --output tmp/%p_p sub/repo/foo |
|
1066 | 1076 | $ cat tmp/sub/repo/foo_p |
|
1067 | 1077 | test |
|
1068 | 1078 | $ mv sub/repo sub_ |
|
1069 | 1079 | $ hg cat sub/repo/baz |
|
1070 | 1080 | skipping missing subrepository: sub/repo |
|
1071 | 1081 | [1] |
|
1072 | 1082 | $ rm -rf sub/repo |
|
1073 | 1083 | $ mv sub_ sub/repo |
|
1074 | 1084 | $ cd .. |
|
1075 | 1085 | |
|
1076 | 1086 | Create repo without default path, pull top repo, and see what happens on update |
|
1077 | 1087 | |
|
1078 | 1088 | $ hg init issue1852b |
|
1079 | 1089 | $ hg -R issue1852b pull issue1852a |
|
1080 | 1090 | pulling from issue1852a |
|
1081 | 1091 | requesting all changes |
|
1082 | 1092 | adding changesets |
|
1083 | 1093 | adding manifests |
|
1084 | 1094 | adding file changes |
|
1085 | 1095 | added 2 changesets with 3 changes to 2 files |
|
1086 | 1096 | new changesets 19487b456929:be5eb94e7215 |
|
1087 | 1097 | (run 'hg update' to get a working copy) |
|
1088 | 1098 | $ hg -R issue1852b update |
|
1089 | 1099 | abort: default path for subrepository not found (in subrepository "sub/repo") (glob) |
|
1090 | 1100 | [255] |
|
1091 | 1101 | |
|
1092 | 1102 | Ensure a full traceback, not just the SubrepoAbort part |
|
1093 | 1103 | |
|
1094 | 1104 | $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort' |
|
1095 | 1105 | raise error.Abort(_("default path for subrepository not found")) |
|
1096 | 1106 | |
|
1097 | 1107 | Pull -u now doesn't help |
|
1098 | 1108 | |
|
1099 | 1109 | $ hg -R issue1852b pull -u issue1852a |
|
1100 | 1110 | pulling from issue1852a |
|
1101 | 1111 | searching for changes |
|
1102 | 1112 | no changes found |
|
1103 | 1113 | |
|
1104 | 1114 | Try the same, but with pull -u |
|
1105 | 1115 | |
|
1106 | 1116 | $ hg init issue1852c |
|
1107 | 1117 | $ hg -R issue1852c pull -r0 -u issue1852a |
|
1108 | 1118 | pulling from issue1852a |
|
1109 | 1119 | adding changesets |
|
1110 | 1120 | adding manifests |
|
1111 | 1121 | adding file changes |
|
1112 | 1122 | added 1 changesets with 2 changes to 2 files |
|
1113 | 1123 | new changesets 19487b456929 |
|
1114 | 1124 | cloning subrepo sub/repo from issue1852a/sub/repo (glob) |
|
1115 | 1125 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1116 | 1126 | |
|
1117 | 1127 | Try to push from the other side |
|
1118 | 1128 | |
|
1119 | 1129 | $ hg -R issue1852a push `pwd`/issue1852c |
|
1120 | 1130 | pushing to $TESTTMP/issue1852c (glob) |
|
1121 | 1131 | pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob) |
|
1122 | 1132 | searching for changes |
|
1123 | 1133 | no changes found |
|
1124 | 1134 | searching for changes |
|
1125 | 1135 | adding changesets |
|
1126 | 1136 | adding manifests |
|
1127 | 1137 | adding file changes |
|
1128 | 1138 | added 1 changesets with 1 changes to 1 files |
|
1129 | 1139 | |
|
1130 | 1140 | Incoming and outgoing should not use the default path: |
|
1131 | 1141 | |
|
1132 | 1142 | $ hg clone -q issue1852a issue1852d |
|
1133 | 1143 | $ hg -R issue1852d outgoing --subrepos issue1852c |
|
1134 | 1144 | comparing with issue1852c |
|
1135 | 1145 | searching for changes |
|
1136 | 1146 | no changes found |
|
1137 | 1147 | comparing with issue1852c/sub/repo |
|
1138 | 1148 | searching for changes |
|
1139 | 1149 | no changes found |
|
1140 | 1150 | [1] |
|
1141 | 1151 | $ hg -R issue1852d incoming --subrepos issue1852c |
|
1142 | 1152 | comparing with issue1852c |
|
1143 | 1153 | searching for changes |
|
1144 | 1154 | no changes found |
|
1145 | 1155 | comparing with issue1852c/sub/repo |
|
1146 | 1156 | searching for changes |
|
1147 | 1157 | no changes found |
|
1148 | 1158 | [1] |
|
1149 | 1159 | |
|
1150 | 1160 | Check that merge of a new subrepo doesn't write the uncommitted state to |
|
1151 | 1161 | .hgsubstate (issue4622) |
|
1152 | 1162 | |
|
1153 | 1163 | $ hg init issue1852a/addedsub |
|
1154 | 1164 | $ echo zzz > issue1852a/addedsub/zz.txt |
|
1155 | 1165 | $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ" |
|
1156 | 1166 | |
|
1157 | 1167 | $ hg clone issue1852a/addedsub issue1852d/addedsub |
|
1158 | 1168 | updating to branch default |
|
1159 | 1169 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1160 | 1170 | |
|
1161 | 1171 | $ echo def > issue1852a/sub/repo/foo |
|
1162 | 1172 | $ hg -R issue1852a ci -SAm 'tweaked subrepo' |
|
1163 | 1173 | adding tmp/sub/repo/foo_p |
|
1164 | 1174 | committing subrepository sub/repo (glob) |
|
1165 | 1175 | |
|
1166 | 1176 | $ echo 'addedsub = addedsub' >> issue1852d/.hgsub |
|
1167 | 1177 | $ echo xyz > issue1852d/sub/repo/foo |
|
1168 | 1178 | $ hg -R issue1852d pull -u |
|
1169 | 1179 | pulling from $TESTTMP/issue1852a (glob) |
|
1170 | 1180 | searching for changes |
|
1171 | 1181 | adding changesets |
|
1172 | 1182 | adding manifests |
|
1173 | 1183 | adding file changes |
|
1174 | 1184 | added 1 changesets with 2 changes to 2 files |
|
1175 | 1185 | new changesets c82b79fdcc5b |
|
1176 | 1186 | subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c) |
|
1177 | 1187 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1178 | 1188 | pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob) |
|
1179 | 1189 | searching for changes |
|
1180 | 1190 | adding changesets |
|
1181 | 1191 | adding manifests |
|
1182 | 1192 | adding file changes |
|
1183 | 1193 | added 1 changesets with 1 changes to 1 files |
|
1184 | 1194 | new changesets 46cd4aac504c |
|
1185 | 1195 | subrepository sources for sub/repo differ (glob) |
|
1186 | 1196 | use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l |
|
1187 | 1197 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1188 | 1198 | $ cat issue1852d/.hgsubstate |
|
1189 | 1199 | f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo |
|
1190 | 1200 | |
|
1191 | 1201 | Check status of files when none of them belong to the first |
|
1192 | 1202 | subrepository: |
|
1193 | 1203 | |
|
1194 | 1204 | $ hg init subrepo-status |
|
1195 | 1205 | $ cd subrepo-status |
|
1196 | 1206 | $ hg init subrepo-1 |
|
1197 | 1207 | $ hg init subrepo-2 |
|
1198 | 1208 | $ cd subrepo-2 |
|
1199 | 1209 | $ touch file |
|
1200 | 1210 | $ hg add file |
|
1201 | 1211 | $ cd .. |
|
1202 | 1212 | $ echo subrepo-1 = subrepo-1 > .hgsub |
|
1203 | 1213 | $ echo subrepo-2 = subrepo-2 >> .hgsub |
|
1204 | 1214 | $ hg add .hgsub |
|
1205 | 1215 | $ hg ci -m 'Added subrepos' |
|
1206 | 1216 | committing subrepository subrepo-2 |
|
1207 | 1217 | $ hg st subrepo-2/file |
|
1208 | 1218 | |
|
1209 | 1219 | Check that share works with subrepo |
|
1210 | 1220 | $ hg --config extensions.share= share . ../shared |
|
1211 | 1221 | updating working directory |
|
1212 | 1222 | sharing subrepo subrepo-1 from $TESTTMP/subrepo-status/subrepo-1 |
|
1213 | 1223 | sharing subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2 |
|
1214 | 1224 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1215 | 1225 | $ find ../shared/* | sort |
|
1216 | 1226 | ../shared/subrepo-1 |
|
1217 | 1227 | ../shared/subrepo-1/.hg |
|
1218 | 1228 | ../shared/subrepo-1/.hg/cache |
|
1219 | 1229 | ../shared/subrepo-1/.hg/cache/storehash |
|
1220 | 1230 | ../shared/subrepo-1/.hg/cache/storehash/* (glob) |
|
1221 | 1231 | ../shared/subrepo-1/.hg/hgrc |
|
1222 | 1232 | ../shared/subrepo-1/.hg/requires |
|
1223 | 1233 | ../shared/subrepo-1/.hg/sharedpath |
|
1224 | 1234 | ../shared/subrepo-2 |
|
1225 | 1235 | ../shared/subrepo-2/.hg |
|
1226 | 1236 | ../shared/subrepo-2/.hg/branch |
|
1227 | 1237 | ../shared/subrepo-2/.hg/cache |
|
1228 | 1238 | ../shared/subrepo-2/.hg/cache/checkisexec (execbit !) |
|
1229 | 1239 | ../shared/subrepo-2/.hg/cache/checklink (symlink !) |
|
1230 | 1240 | ../shared/subrepo-2/.hg/cache/checklink-target (symlink !) |
|
1231 | 1241 | ../shared/subrepo-2/.hg/cache/storehash |
|
1232 | 1242 | ../shared/subrepo-2/.hg/cache/storehash/* (glob) |
|
1233 | 1243 | ../shared/subrepo-2/.hg/dirstate |
|
1234 | 1244 | ../shared/subrepo-2/.hg/hgrc |
|
1235 | 1245 | ../shared/subrepo-2/.hg/requires |
|
1236 | 1246 | ../shared/subrepo-2/.hg/sharedpath |
|
1237 | 1247 | ../shared/subrepo-2/file |
|
1238 | 1248 | $ hg -R ../shared in |
|
1239 | 1249 | abort: repository default not found! |
|
1240 | 1250 | [255] |
|
1241 | 1251 | $ hg -R ../shared/subrepo-2 showconfig paths |
|
1242 | 1252 | paths.default=$TESTTMP/subrepo-status/subrepo-2 |
|
1243 | 1253 | $ hg -R ../shared/subrepo-1 sum --remote |
|
1244 | 1254 | parent: -1:000000000000 tip (empty repository) |
|
1245 | 1255 | branch: default |
|
1246 | 1256 | commit: (clean) |
|
1247 | 1257 | update: (current) |
|
1248 | 1258 | remote: (synced) |
|
1249 | 1259 | |
|
1250 | 1260 | Check hg update --clean |
|
1251 | 1261 | $ cd $TESTTMP/t |
|
1252 | 1262 | $ rm -r t/t.orig |
|
1253 | 1263 | $ hg status -S --all |
|
1254 | 1264 | C .hgsub |
|
1255 | 1265 | C .hgsubstate |
|
1256 | 1266 | C a |
|
1257 | 1267 | C s/.hgsub |
|
1258 | 1268 | C s/.hgsubstate |
|
1259 | 1269 | C s/a |
|
1260 | 1270 | C s/ss/a |
|
1261 | 1271 | C t/t |
|
1262 | 1272 | $ echo c1 > s/a |
|
1263 | 1273 | $ cd s |
|
1264 | 1274 | $ echo c1 > b |
|
1265 | 1275 | $ echo c1 > c |
|
1266 | 1276 | $ hg add b |
|
1267 | 1277 | $ cd .. |
|
1268 | 1278 | $ hg status -S |
|
1269 | 1279 | M s/a |
|
1270 | 1280 | A s/b |
|
1271 | 1281 | ? s/c |
|
1272 | 1282 | $ hg update -C |
|
1273 | 1283 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1274 | 1284 | updated to "925c17564ef8: 13" |
|
1275 | 1285 | 2 other heads for branch "default" |
|
1276 | 1286 | $ hg status -S |
|
1277 | 1287 | ? s/b |
|
1278 | 1288 | ? s/c |
|
1279 | 1289 | |
|
1280 | 1290 | Sticky subrepositories, no changes |
|
1281 | 1291 | $ cd $TESTTMP/t |
|
1282 | 1292 | $ hg id |
|
1283 | 1293 | 925c17564ef8 tip |
|
1284 | 1294 | $ hg -R s id |
|
1285 | 1295 | 12a213df6fa9 tip |
|
1286 | 1296 | $ hg -R t id |
|
1287 | 1297 | 52c0adc0515a tip |
|
1288 | 1298 | $ hg update 11 |
|
1289 | 1299 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1290 | 1300 | $ hg id |
|
1291 | 1301 | 365661e5936a |
|
1292 | 1302 | $ hg -R s id |
|
1293 | 1303 | fc627a69481f |
|
1294 | 1304 | $ hg -R t id |
|
1295 | 1305 | e95bcfa18a35 |
|
1296 | 1306 | |
|
1297 | 1307 | Sticky subrepositories, file changes |
|
1298 | 1308 | $ touch s/f1 |
|
1299 | 1309 | $ touch t/f1 |
|
1300 | 1310 | $ hg add -S s/f1 |
|
1301 | 1311 | $ hg add -S t/f1 |
|
1302 | 1312 | $ hg id |
|
1303 | 1313 | 365661e5936a+ |
|
1304 | 1314 | $ hg -R s id |
|
1305 | 1315 | fc627a69481f+ |
|
1306 | 1316 | $ hg -R t id |
|
1307 | 1317 | e95bcfa18a35+ |
|
1308 | 1318 | $ hg update tip |
|
1309 | 1319 | subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9) |
|
1310 | 1320 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1311 | 1321 | subrepository sources for s differ |
|
1312 | 1322 | use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l |
|
1313 | 1323 | subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a) |
|
1314 | 1324 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1315 | 1325 | subrepository sources for t differ |
|
1316 | 1326 | use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l |
|
1317 | 1327 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1318 | 1328 | $ hg id |
|
1319 | 1329 | 925c17564ef8+ tip |
|
1320 | 1330 | $ hg -R s id |
|
1321 | 1331 | fc627a69481f+ |
|
1322 | 1332 | $ hg -R t id |
|
1323 | 1333 | e95bcfa18a35+ |
|
1324 | 1334 | $ hg update --clean tip |
|
1325 | 1335 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1326 | 1336 | |
|
1327 | 1337 | Sticky subrepository, revision updates |
|
1328 | 1338 | $ hg id |
|
1329 | 1339 | 925c17564ef8 tip |
|
1330 | 1340 | $ hg -R s id |
|
1331 | 1341 | 12a213df6fa9 tip |
|
1332 | 1342 | $ hg -R t id |
|
1333 | 1343 | 52c0adc0515a tip |
|
1334 | 1344 | $ cd s |
|
1335 | 1345 | $ hg update -r -2 |
|
1336 | 1346 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1337 | 1347 | $ cd ../t |
|
1338 | 1348 | $ hg update -r 2 |
|
1339 | 1349 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1340 | 1350 | $ cd .. |
|
1341 | 1351 | $ hg update 10 |
|
1342 | 1352 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) |
|
1343 | 1353 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1344 | 1354 | subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c) |
|
1345 | 1355 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1346 | 1356 | subrepository sources for t differ (in checked out version) |
|
1347 | 1357 | use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l |
|
1348 | 1358 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1349 | 1359 | $ hg id |
|
1350 | 1360 | e45c8b14af55+ |
|
1351 | 1361 | $ hg -R s id |
|
1352 | 1362 | 02dcf1d70411 |
|
1353 | 1363 | $ hg -R t id |
|
1354 | 1364 | 7af322bc1198 |
|
1355 | 1365 | |
|
1356 | 1366 | Sticky subrepository, file changes and revision updates |
|
1357 | 1367 | $ touch s/f1 |
|
1358 | 1368 | $ touch t/f1 |
|
1359 | 1369 | $ hg add -S s/f1 |
|
1360 | 1370 | $ hg add -S t/f1 |
|
1361 | 1371 | $ hg id |
|
1362 | 1372 | e45c8b14af55+ |
|
1363 | 1373 | $ hg -R s id |
|
1364 | 1374 | 02dcf1d70411+ |
|
1365 | 1375 | $ hg -R t id |
|
1366 | 1376 | 7af322bc1198+ |
|
1367 | 1377 | $ hg update tip |
|
1368 | 1378 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9) |
|
1369 | 1379 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1370 | 1380 | subrepository sources for s differ |
|
1371 | 1381 | use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l |
|
1372 | 1382 | subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a) |
|
1373 | 1383 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1374 | 1384 | subrepository sources for t differ |
|
1375 | 1385 | use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l |
|
1376 | 1386 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1377 | 1387 | $ hg id |
|
1378 | 1388 | 925c17564ef8+ tip |
|
1379 | 1389 | $ hg -R s id |
|
1380 | 1390 | 02dcf1d70411+ |
|
1381 | 1391 | $ hg -R t id |
|
1382 | 1392 | 7af322bc1198+ |
|
1383 | 1393 | |
|
1384 | 1394 | Sticky repository, update --clean |
|
1385 | 1395 | $ hg update --clean tip |
|
1386 | 1396 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1387 | 1397 | $ hg id |
|
1388 | 1398 | 925c17564ef8 tip |
|
1389 | 1399 | $ hg -R s id |
|
1390 | 1400 | 12a213df6fa9 tip |
|
1391 | 1401 | $ hg -R t id |
|
1392 | 1402 | 52c0adc0515a tip |
|
1393 | 1403 | |
|
1394 | 1404 | Test subrepo already at intended revision: |
|
1395 | 1405 | $ cd s |
|
1396 | 1406 | $ hg update fc627a69481f |
|
1397 | 1407 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1398 | 1408 | $ cd .. |
|
1399 | 1409 | $ hg update 11 |
|
1400 | 1410 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) |
|
1401 | 1411 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1402 | 1412 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1403 | 1413 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1404 | 1414 | $ hg id -n |
|
1405 | 1415 | 11+ |
|
1406 | 1416 | $ hg -R s id |
|
1407 | 1417 | fc627a69481f |
|
1408 | 1418 | $ hg -R t id |
|
1409 | 1419 | e95bcfa18a35 |
|
1410 | 1420 | |
|
1411 | 1421 | Test that removing .hgsubstate doesn't break anything: |
|
1412 | 1422 | |
|
1413 | 1423 | $ hg rm -f .hgsubstate |
|
1414 | 1424 | $ hg ci -mrm |
|
1415 | 1425 | nothing changed |
|
1416 | 1426 | [1] |
|
1417 | 1427 | $ hg log -vr tip |
|
1418 | 1428 | changeset: 13:925c17564ef8 |
|
1419 | 1429 | tag: tip |
|
1420 | 1430 | user: test |
|
1421 | 1431 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1422 | 1432 | files: .hgsubstate |
|
1423 | 1433 | description: |
|
1424 | 1434 | 13 |
|
1425 | 1435 | |
|
1426 | 1436 | |
|
1427 | 1437 | |
|
1428 | 1438 | Test that removing .hgsub removes .hgsubstate: |
|
1429 | 1439 | |
|
1430 | 1440 | $ hg rm .hgsub |
|
1431 | 1441 | $ hg ci -mrm2 |
|
1432 | 1442 | created new head |
|
1433 | 1443 | $ hg log -vr tip |
|
1434 | 1444 | changeset: 14:2400bccd50af |
|
1435 | 1445 | tag: tip |
|
1436 | 1446 | parent: 11:365661e5936a |
|
1437 | 1447 | user: test |
|
1438 | 1448 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1439 | 1449 | files: .hgsub .hgsubstate |
|
1440 | 1450 | description: |
|
1441 | 1451 | rm2 |
|
1442 | 1452 | |
|
1443 | 1453 | |
|
1444 | 1454 | Test issue3153: diff -S with deleted subrepos |
|
1445 | 1455 | |
|
1446 | 1456 | $ hg diff --nodates -S -c . |
|
1447 | 1457 | diff -r 365661e5936a -r 2400bccd50af .hgsub |
|
1448 | 1458 | --- a/.hgsub |
|
1449 | 1459 | +++ /dev/null |
|
1450 | 1460 | @@ -1,2 +0,0 @@ |
|
1451 | 1461 | -s = s |
|
1452 | 1462 | -t = t |
|
1453 | 1463 | diff -r 365661e5936a -r 2400bccd50af .hgsubstate |
|
1454 | 1464 | --- a/.hgsubstate |
|
1455 | 1465 | +++ /dev/null |
|
1456 | 1466 | @@ -1,2 +0,0 @@ |
|
1457 | 1467 | -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
1458 | 1468 | -e95bcfa18a358dc4936da981ebf4147b4cad1362 t |
|
1459 | 1469 | |
|
1460 | 1470 | Test behavior of add for explicit path in subrepo: |
|
1461 | 1471 | $ cd .. |
|
1462 | 1472 | $ hg init explicit |
|
1463 | 1473 | $ cd explicit |
|
1464 | 1474 | $ echo s = s > .hgsub |
|
1465 | 1475 | $ hg add .hgsub |
|
1466 | 1476 | $ hg init s |
|
1467 | 1477 | $ hg ci -m0 |
|
1468 | 1478 | Adding with an explicit path in a subrepo adds the file |
|
1469 | 1479 | $ echo c1 > f1 |
|
1470 | 1480 | $ echo c2 > s/f2 |
|
1471 | 1481 | $ hg st -S |
|
1472 | 1482 | ? f1 |
|
1473 | 1483 | ? s/f2 |
|
1474 | 1484 | $ hg add s/f2 |
|
1475 | 1485 | $ hg st -S |
|
1476 | 1486 | A s/f2 |
|
1477 | 1487 | ? f1 |
|
1478 | 1488 | $ hg ci -R s -m0 |
|
1479 | 1489 | $ hg ci -Am1 |
|
1480 | 1490 | adding f1 |
|
1481 | 1491 | Adding with an explicit path in a subrepo with -S has the same behavior |
|
1482 | 1492 | $ echo c3 > f3 |
|
1483 | 1493 | $ echo c4 > s/f4 |
|
1484 | 1494 | $ hg st -S |
|
1485 | 1495 | ? f3 |
|
1486 | 1496 | ? s/f4 |
|
1487 | 1497 | $ hg add -S s/f4 |
|
1488 | 1498 | $ hg st -S |
|
1489 | 1499 | A s/f4 |
|
1490 | 1500 | ? f3 |
|
1491 | 1501 | $ hg ci -R s -m1 |
|
1492 | 1502 | $ hg ci -Ama2 |
|
1493 | 1503 | adding f3 |
|
1494 | 1504 | Adding without a path or pattern silently ignores subrepos |
|
1495 | 1505 | $ echo c5 > f5 |
|
1496 | 1506 | $ echo c6 > s/f6 |
|
1497 | 1507 | $ echo c7 > s/f7 |
|
1498 | 1508 | $ hg st -S |
|
1499 | 1509 | ? f5 |
|
1500 | 1510 | ? s/f6 |
|
1501 | 1511 | ? s/f7 |
|
1502 | 1512 | $ hg add |
|
1503 | 1513 | adding f5 |
|
1504 | 1514 | $ hg st -S |
|
1505 | 1515 | A f5 |
|
1506 | 1516 | ? s/f6 |
|
1507 | 1517 | ? s/f7 |
|
1508 | 1518 | $ hg ci -R s -Am2 |
|
1509 | 1519 | adding f6 |
|
1510 | 1520 | adding f7 |
|
1511 | 1521 | $ hg ci -m3 |
|
1512 | 1522 | Adding without a path or pattern with -S also adds files in subrepos |
|
1513 | 1523 | $ echo c8 > f8 |
|
1514 | 1524 | $ echo c9 > s/f9 |
|
1515 | 1525 | $ echo c10 > s/f10 |
|
1516 | 1526 | $ hg st -S |
|
1517 | 1527 | ? f8 |
|
1518 | 1528 | ? s/f10 |
|
1519 | 1529 | ? s/f9 |
|
1520 | 1530 | $ hg add -S |
|
1521 | 1531 | adding f8 |
|
1522 | 1532 | adding s/f10 (glob) |
|
1523 | 1533 | adding s/f9 (glob) |
|
1524 | 1534 | $ hg st -S |
|
1525 | 1535 | A f8 |
|
1526 | 1536 | A s/f10 |
|
1527 | 1537 | A s/f9 |
|
1528 | 1538 | $ hg ci -R s -m3 |
|
1529 | 1539 | $ hg ci -m4 |
|
1530 | 1540 | Adding with a pattern silently ignores subrepos |
|
1531 | 1541 | $ echo c11 > fm11 |
|
1532 | 1542 | $ echo c12 > fn12 |
|
1533 | 1543 | $ echo c13 > s/fm13 |
|
1534 | 1544 | $ echo c14 > s/fn14 |
|
1535 | 1545 | $ hg st -S |
|
1536 | 1546 | ? fm11 |
|
1537 | 1547 | ? fn12 |
|
1538 | 1548 | ? s/fm13 |
|
1539 | 1549 | ? s/fn14 |
|
1540 | 1550 | $ hg add 'glob:**fm*' |
|
1541 | 1551 | adding fm11 |
|
1542 | 1552 | $ hg st -S |
|
1543 | 1553 | A fm11 |
|
1544 | 1554 | ? fn12 |
|
1545 | 1555 | ? s/fm13 |
|
1546 | 1556 | ? s/fn14 |
|
1547 | 1557 | $ hg ci -R s -Am4 |
|
1548 | 1558 | adding fm13 |
|
1549 | 1559 | adding fn14 |
|
1550 | 1560 | $ hg ci -Am5 |
|
1551 | 1561 | adding fn12 |
|
1552 | 1562 | Adding with a pattern with -S also adds matches in subrepos |
|
1553 | 1563 | $ echo c15 > fm15 |
|
1554 | 1564 | $ echo c16 > fn16 |
|
1555 | 1565 | $ echo c17 > s/fm17 |
|
1556 | 1566 | $ echo c18 > s/fn18 |
|
1557 | 1567 | $ hg st -S |
|
1558 | 1568 | ? fm15 |
|
1559 | 1569 | ? fn16 |
|
1560 | 1570 | ? s/fm17 |
|
1561 | 1571 | ? s/fn18 |
|
1562 | 1572 | $ hg add -S 'glob:**fm*' |
|
1563 | 1573 | adding fm15 |
|
1564 | 1574 | adding s/fm17 (glob) |
|
1565 | 1575 | $ hg st -S |
|
1566 | 1576 | A fm15 |
|
1567 | 1577 | A s/fm17 |
|
1568 | 1578 | ? fn16 |
|
1569 | 1579 | ? s/fn18 |
|
1570 | 1580 | $ hg ci -R s -Am5 |
|
1571 | 1581 | adding fn18 |
|
1572 | 1582 | $ hg ci -Am6 |
|
1573 | 1583 | adding fn16 |
|
1574 | 1584 | |
|
1575 | 1585 | Test behavior of forget for explicit path in subrepo: |
|
1576 | 1586 | Forgetting an explicit path in a subrepo untracks the file |
|
1577 | 1587 | $ echo c19 > s/f19 |
|
1578 | 1588 | $ hg add s/f19 |
|
1579 | 1589 | $ hg st -S |
|
1580 | 1590 | A s/f19 |
|
1581 | 1591 | $ hg forget s/f19 |
|
1582 | 1592 | $ hg st -S |
|
1583 | 1593 | ? s/f19 |
|
1584 | 1594 | $ rm s/f19 |
|
1585 | 1595 | $ cd .. |
|
1586 | 1596 | |
|
1587 | 1597 | Courtesy phases synchronisation to publishing server does not block the push |
|
1588 | 1598 | (issue3781) |
|
1589 | 1599 | |
|
1590 | 1600 | $ cp -R main issue3781 |
|
1591 | 1601 | $ cp -R main issue3781-dest |
|
1592 | 1602 | $ cd issue3781-dest/s |
|
1593 | 1603 | $ hg phase tip # show we have draft changeset |
|
1594 | 1604 | 5: draft |
|
1595 | 1605 | $ chmod a-w .hg/store/phaseroots # prevent phase push |
|
1596 | 1606 | $ cd ../../issue3781 |
|
1597 | 1607 | $ cat >> .hg/hgrc << EOF |
|
1598 | 1608 | > [paths] |
|
1599 | 1609 | > default=../issue3781-dest/ |
|
1600 | 1610 | > EOF |
|
1601 | 1611 | $ hg push --config devel.legacy.exchange=bundle1 |
|
1602 | 1612 | pushing to $TESTTMP/issue3781-dest (glob) |
|
1603 | 1613 | pushing subrepo s to $TESTTMP/issue3781-dest/s |
|
1604 | 1614 | searching for changes |
|
1605 | 1615 | no changes found |
|
1606 | 1616 | searching for changes |
|
1607 | 1617 | no changes found |
|
1608 | 1618 | [1] |
|
1609 | 1619 | # clean the push cache |
|
1610 | 1620 | $ rm s/.hg/cache/storehash/* |
|
1611 | 1621 | $ hg push # bundle2+ |
|
1612 | 1622 | pushing to $TESTTMP/issue3781-dest (glob) |
|
1613 | 1623 | pushing subrepo s to $TESTTMP/issue3781-dest/s |
|
1614 | 1624 | searching for changes |
|
1615 | 1625 | no changes found |
|
1616 | 1626 | searching for changes |
|
1617 | 1627 | no changes found |
|
1618 | 1628 | [1] |
|
1619 | 1629 | $ cd .. |
|
1620 | 1630 | |
|
1621 | 1631 | Test phase choice for newly created commit with "phases.subrepochecks" |
|
1622 | 1632 | configuration |
|
1623 | 1633 | |
|
1624 | 1634 | $ cd t |
|
1625 | 1635 | $ hg update -q -r 12 |
|
1626 | 1636 | |
|
1627 | 1637 | $ cat >> s/ss/.hg/hgrc <<EOF |
|
1628 | 1638 | > [phases] |
|
1629 | 1639 | > new-commit = secret |
|
1630 | 1640 | > EOF |
|
1631 | 1641 | $ cat >> s/.hg/hgrc <<EOF |
|
1632 | 1642 | > [phases] |
|
1633 | 1643 | > new-commit = draft |
|
1634 | 1644 | > EOF |
|
1635 | 1645 | $ echo phasecheck1 >> s/ss/a |
|
1636 | 1646 | $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1 |
|
1637 | 1647 | committing subrepository ss |
|
1638 | 1648 | transaction abort! |
|
1639 | 1649 | rollback completed |
|
1640 | 1650 | abort: can't commit in draft phase conflicting secret from subrepository ss |
|
1641 | 1651 | [255] |
|
1642 | 1652 | $ echo phasecheck2 >> s/ss/a |
|
1643 | 1653 | $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2 |
|
1644 | 1654 | committing subrepository ss |
|
1645 | 1655 | $ hg -R s/ss phase tip |
|
1646 | 1656 | 3: secret |
|
1647 | 1657 | $ hg -R s phase tip |
|
1648 | 1658 | 6: draft |
|
1649 | 1659 | $ echo phasecheck3 >> s/ss/a |
|
1650 | 1660 | $ hg -R s commit -S -m phasecheck3 |
|
1651 | 1661 | committing subrepository ss |
|
1652 | 1662 | warning: changes are committed in secret phase from subrepository ss |
|
1653 | 1663 | $ hg -R s/ss phase tip |
|
1654 | 1664 | 4: secret |
|
1655 | 1665 | $ hg -R s phase tip |
|
1656 | 1666 | 7: secret |
|
1657 | 1667 | |
|
1658 | 1668 | $ cat >> t/.hg/hgrc <<EOF |
|
1659 | 1669 | > [phases] |
|
1660 | 1670 | > new-commit = draft |
|
1661 | 1671 | > EOF |
|
1662 | 1672 | $ cat >> .hg/hgrc <<EOF |
|
1663 | 1673 | > [phases] |
|
1664 | 1674 | > new-commit = public |
|
1665 | 1675 | > EOF |
|
1666 | 1676 | $ echo phasecheck4 >> s/ss/a |
|
1667 | 1677 | $ echo phasecheck4 >> t/t |
|
1668 | 1678 | $ hg commit -S -m phasecheck4 |
|
1669 | 1679 | committing subrepository s |
|
1670 | 1680 | committing subrepository s/ss (glob) |
|
1671 | 1681 | warning: changes are committed in secret phase from subrepository ss |
|
1672 | 1682 | committing subrepository t |
|
1673 | 1683 | warning: changes are committed in secret phase from subrepository s |
|
1674 | 1684 | created new head |
|
1675 | 1685 | $ hg -R s/ss phase tip |
|
1676 | 1686 | 5: secret |
|
1677 | 1687 | $ hg -R s phase tip |
|
1678 | 1688 | 8: secret |
|
1679 | 1689 | $ hg -R t phase tip |
|
1680 | 1690 | 6: draft |
|
1681 | 1691 | $ hg phase tip |
|
1682 | 1692 | 15: secret |
|
1683 | 1693 | |
|
1684 | 1694 | $ cd .. |
|
1685 | 1695 | |
|
1686 | 1696 | |
|
1687 | 1697 | Test that commit --secret works on both repo and subrepo (issue4182) |
|
1688 | 1698 | |
|
1689 | 1699 | $ cd main |
|
1690 | 1700 | $ echo secret >> b |
|
1691 | 1701 | $ echo secret >> s/b |
|
1692 | 1702 | $ hg commit --secret --subrepo -m "secret" |
|
1693 | 1703 | committing subrepository s |
|
1694 | 1704 | $ hg phase -r . |
|
1695 | 1705 | 6: secret |
|
1696 | 1706 | $ cd s |
|
1697 | 1707 | $ hg phase -r . |
|
1698 | 1708 | 6: secret |
|
1699 | 1709 | $ cd ../../ |
|
1700 | 1710 | |
|
1701 | 1711 | Test "subrepos" template keyword |
|
1702 | 1712 | |
|
1703 | 1713 | $ cd t |
|
1704 | 1714 | $ hg update -q 15 |
|
1705 | 1715 | $ cat > .hgsub <<EOF |
|
1706 | 1716 | > s = s |
|
1707 | 1717 | > EOF |
|
1708 | 1718 | $ hg commit -m "16" |
|
1709 | 1719 | warning: changes are committed in secret phase from subrepository s |
|
1710 | 1720 | |
|
1711 | 1721 | (addition of ".hgsub" itself) |
|
1712 | 1722 | |
|
1713 | 1723 | $ hg diff --nodates -c 1 .hgsubstate |
|
1714 | 1724 | diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate |
|
1715 | 1725 | --- /dev/null |
|
1716 | 1726 | +++ b/.hgsubstate |
|
1717 | 1727 | @@ -0,0 +1,1 @@ |
|
1718 | 1728 | +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1719 | 1729 | $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1720 | 1730 | f7b1eb17ad24 000000000000 |
|
1721 | 1731 | s |
|
1722 | 1732 | |
|
1723 | 1733 | (modification of existing entry) |
|
1724 | 1734 | |
|
1725 | 1735 | $ hg diff --nodates -c 2 .hgsubstate |
|
1726 | 1736 | diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate |
|
1727 | 1737 | --- a/.hgsubstate |
|
1728 | 1738 | +++ b/.hgsubstate |
|
1729 | 1739 | @@ -1,1 +1,1 @@ |
|
1730 | 1740 | -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1731 | 1741 | +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s |
|
1732 | 1742 | $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1733 | 1743 | 7cf8cfea66e4 000000000000 |
|
1734 | 1744 | s |
|
1735 | 1745 | |
|
1736 | 1746 | (addition of entry) |
|
1737 | 1747 | |
|
1738 | 1748 | $ hg diff --nodates -c 5 .hgsubstate |
|
1739 | 1749 | diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate |
|
1740 | 1750 | --- a/.hgsubstate |
|
1741 | 1751 | +++ b/.hgsubstate |
|
1742 | 1752 | @@ -1,1 +1,2 @@ |
|
1743 | 1753 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1744 | 1754 | +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t |
|
1745 | 1755 | $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1746 | 1756 | 7cf8cfea66e4 000000000000 |
|
1747 | 1757 | t |
|
1748 | 1758 | |
|
1749 | 1759 | (removal of existing entry) |
|
1750 | 1760 | |
|
1751 | 1761 | $ hg diff --nodates -c 16 .hgsubstate |
|
1752 | 1762 | diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate |
|
1753 | 1763 | --- a/.hgsubstate |
|
1754 | 1764 | +++ b/.hgsubstate |
|
1755 | 1765 | @@ -1,2 +1,1 @@ |
|
1756 | 1766 | 0731af8ca9423976d3743119d0865097c07bdc1b s |
|
1757 | 1767 | -e202dc79b04c88a636ea8913d9182a1346d9b3dc t |
|
1758 | 1768 | $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1759 | 1769 | 8bec38d2bd0b 000000000000 |
|
1760 | 1770 | t |
|
1761 | 1771 | |
|
1762 | 1772 | (merging) |
|
1763 | 1773 | |
|
1764 | 1774 | $ hg diff --nodates -c 9 .hgsubstate |
|
1765 | 1775 | diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate |
|
1766 | 1776 | --- a/.hgsubstate |
|
1767 | 1777 | +++ b/.hgsubstate |
|
1768 | 1778 | @@ -1,1 +1,2 @@ |
|
1769 | 1779 | fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
1770 | 1780 | +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t |
|
1771 | 1781 | $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1772 | 1782 | f6affe3fbfaa 1f14a2e2d3ec |
|
1773 | 1783 | t |
|
1774 | 1784 | |
|
1775 | 1785 | (removal of ".hgsub" itself) |
|
1776 | 1786 | |
|
1777 | 1787 | $ hg diff --nodates -c 8 .hgsubstate |
|
1778 | 1788 | diff -r f94576341bcf -r 96615c1dad2d .hgsubstate |
|
1779 | 1789 | --- a/.hgsubstate |
|
1780 | 1790 | +++ /dev/null |
|
1781 | 1791 | @@ -1,2 +0,0 @@ |
|
1782 | 1792 | -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1783 | 1793 | -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t |
|
1784 | 1794 | $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1785 | 1795 | f94576341bcf 000000000000 |
|
1786 | 1796 | |
|
1787 | 1797 | Test that '[paths]' is configured correctly at subrepo creation |
|
1788 | 1798 | |
|
1789 | 1799 | $ cd $TESTTMP/tc |
|
1790 | 1800 | $ cat > .hgsub <<EOF |
|
1791 | 1801 | > # to clear bogus subrepo path 'bogus=[boguspath' |
|
1792 | 1802 | > s = s |
|
1793 | 1803 | > t = t |
|
1794 | 1804 | > EOF |
|
1795 | 1805 | $ hg update -q --clean null |
|
1796 | 1806 | $ rm -rf s t |
|
1797 | 1807 | $ cat >> .hg/hgrc <<EOF |
|
1798 | 1808 | > [paths] |
|
1799 | 1809 | > default-push = /foo/bar |
|
1800 | 1810 | > EOF |
|
1801 | 1811 | $ hg update -q |
|
1802 | 1812 | $ cat s/.hg/hgrc |
|
1803 | 1813 | [paths] |
|
1804 | 1814 | default = $TESTTMP/t/s |
|
1805 | 1815 | default-push = /foo/bar/s |
|
1806 | 1816 | $ cat s/ss/.hg/hgrc |
|
1807 | 1817 | [paths] |
|
1808 | 1818 | default = $TESTTMP/t/s/ss |
|
1809 | 1819 | default-push = /foo/bar/s/ss |
|
1810 | 1820 | $ cat t/.hg/hgrc |
|
1811 | 1821 | [paths] |
|
1812 | 1822 | default = $TESTTMP/t/t |
|
1813 | 1823 | default-push = /foo/bar/t |
|
1814 | 1824 | |
|
1815 | 1825 | $ cd $TESTTMP/t |
|
1816 | 1826 | $ hg up -qC 0 |
|
1817 | 1827 | $ echo 'bar' > bar.txt |
|
1818 | 1828 | $ hg ci -Am 'branch before subrepo add' |
|
1819 | 1829 | adding bar.txt |
|
1820 | 1830 | created new head |
|
1821 | 1831 | $ hg merge -r "first(subrepo('s'))" |
|
1822 | 1832 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1823 | 1833 | (branch merge, don't forget to commit) |
|
1824 | 1834 | $ hg status -S -X '.hgsub*' |
|
1825 | 1835 | A s/a |
|
1826 | 1836 | ? s/b |
|
1827 | 1837 | ? s/c |
|
1828 | 1838 | ? s/f1 |
|
1829 | 1839 | $ hg status -S --rev 'p2()' |
|
1830 | 1840 | A bar.txt |
|
1831 | 1841 | ? s/b |
|
1832 | 1842 | ? s/c |
|
1833 | 1843 | ? s/f1 |
|
1834 | 1844 | $ hg diff -S -X '.hgsub*' --nodates |
|
1835 | 1845 | diff -r 000000000000 s/a |
|
1836 | 1846 | --- /dev/null |
|
1837 | 1847 | +++ b/s/a |
|
1838 | 1848 | @@ -0,0 +1,1 @@ |
|
1839 | 1849 | +a |
|
1840 | 1850 | $ hg diff -S --rev 'p2()' --nodates |
|
1841 | 1851 | diff -r 7cf8cfea66e4 bar.txt |
|
1842 | 1852 | --- /dev/null |
|
1843 | 1853 | +++ b/bar.txt |
|
1844 | 1854 | @@ -0,0 +1,1 @@ |
|
1845 | 1855 | +bar |
|
1846 | 1856 | |
|
1847 | 1857 | $ cd .. |
|
1848 | 1858 | |
|
1849 | 1859 | test for ssh exploit 2017-07-25 |
|
1850 | 1860 | |
|
1851 | 1861 | $ cat >> $HGRCPATH << EOF |
|
1852 | 1862 | > [ui] |
|
1853 | 1863 | > ssh = sh -c "read l; read l; read l" |
|
1854 | 1864 | > EOF |
|
1855 | 1865 | |
|
1856 | 1866 | $ hg init malicious-proxycommand |
|
1857 | 1867 | $ cd malicious-proxycommand |
|
1858 | 1868 | $ echo 's = [hg]ssh://-oProxyCommand=touch${IFS}owned/path' > .hgsub |
|
1859 | 1869 | $ hg init s |
|
1860 | 1870 | $ cd s |
|
1861 | 1871 | $ echo init > init |
|
1862 | 1872 | $ hg add |
|
1863 | 1873 | adding init |
|
1864 | 1874 | $ hg commit -m init |
|
1865 | 1875 | $ cd .. |
|
1866 | 1876 | $ hg add .hgsub |
|
1867 | 1877 | $ hg ci -m 'add subrepo' |
|
1868 | 1878 | $ cd .. |
|
1869 | 1879 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1870 | 1880 | updating to branch default |
|
1871 | 1881 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") |
|
1872 | 1882 | [255] |
|
1873 | 1883 | |
|
1874 | 1884 | also check that a percent encoded '-' (%2D) doesn't work |
|
1875 | 1885 | |
|
1876 | 1886 | $ cd malicious-proxycommand |
|
1877 | 1887 | $ echo 's = [hg]ssh://%2DoProxyCommand=touch${IFS}owned/path' > .hgsub |
|
1878 | 1888 | $ hg ci -m 'change url to percent encoded' |
|
1879 | 1889 | $ cd .. |
|
1880 | 1890 | $ rm -r malicious-proxycommand-clone |
|
1881 | 1891 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1882 | 1892 | updating to branch default |
|
1883 | 1893 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") |
|
1884 | 1894 | [255] |
|
1885 | 1895 | |
|
1886 | 1896 | also check for a pipe |
|
1887 | 1897 | |
|
1888 | 1898 | $ cd malicious-proxycommand |
|
1889 | 1899 | $ echo 's = [hg]ssh://fakehost|touch${IFS}owned/path' > .hgsub |
|
1890 | 1900 | $ hg ci -m 'change url to pipe' |
|
1891 | 1901 | $ cd .. |
|
1892 | 1902 | $ rm -r malicious-proxycommand-clone |
|
1893 | 1903 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1894 | 1904 | updating to branch default |
|
1895 | 1905 | abort: no suitable response from remote hg! |
|
1896 | 1906 | [255] |
|
1897 | 1907 | $ [ ! -f owned ] || echo 'you got owned' |
|
1898 | 1908 | |
|
1899 | 1909 | also check that a percent encoded '|' (%7C) doesn't work |
|
1900 | 1910 | |
|
1901 | 1911 | $ cd malicious-proxycommand |
|
1902 | 1912 | $ echo 's = [hg]ssh://fakehost%7Ctouch%20owned/path' > .hgsub |
|
1903 | 1913 | $ hg ci -m 'change url to percent encoded pipe' |
|
1904 | 1914 | $ cd .. |
|
1905 | 1915 | $ rm -r malicious-proxycommand-clone |
|
1906 | 1916 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1907 | 1917 | updating to branch default |
|
1908 | 1918 | abort: no suitable response from remote hg! |
|
1909 | 1919 | [255] |
|
1910 | 1920 | $ [ ! -f owned ] || echo 'you got owned' |
|
1911 | 1921 | |
|
1912 | 1922 | and bad usernames: |
|
1913 | 1923 | $ cd malicious-proxycommand |
|
1914 | 1924 | $ echo 's = [hg]ssh://-oProxyCommand=touch owned@example.com/path' > .hgsub |
|
1915 | 1925 | $ hg ci -m 'owned username' |
|
1916 | 1926 | $ cd .. |
|
1917 | 1927 | $ rm -r malicious-proxycommand-clone |
|
1918 | 1928 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1919 | 1929 | updating to branch default |
|
1920 | 1930 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s") |
|
1921 | 1931 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now