##// END OF EJS Templates
merge: disable path conflict checking by default (issue5716)...
Siddharth Agarwal -
r34943:2a774cae stable
parent child Browse files
Show More
@@ -1,1146 +1,1146 b''
1 # configitems.py - centralized declaration of configuration option
1 # configitems.py - centralized declaration of configuration option
2 #
2 #
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import functools
10 import functools
11 import re
11 import re
12
12
13 from . import (
13 from . import (
14 encoding,
14 encoding,
15 error,
15 error,
16 )
16 )
17
17
18 def loadconfigtable(ui, extname, configtable):
18 def loadconfigtable(ui, extname, configtable):
19 """update config item known to the ui with the extension ones"""
19 """update config item known to the ui with the extension ones"""
20 for section, items in configtable.items():
20 for section, items in configtable.items():
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
21 knownitems = ui._knownconfig.setdefault(section, itemregister())
22 knownkeys = set(knownitems)
22 knownkeys = set(knownitems)
23 newkeys = set(items)
23 newkeys = set(items)
24 for key in sorted(knownkeys & newkeys):
24 for key in sorted(knownkeys & newkeys):
25 msg = "extension '%s' overwrite config item '%s.%s'"
25 msg = "extension '%s' overwrite config item '%s.%s'"
26 msg %= (extname, section, key)
26 msg %= (extname, section, key)
27 ui.develwarn(msg, config='warn-config')
27 ui.develwarn(msg, config='warn-config')
28
28
29 knownitems.update(items)
29 knownitems.update(items)
30
30
31 class configitem(object):
31 class configitem(object):
32 """represent a known config item
32 """represent a known config item
33
33
34 :section: the official config section where to find this item,
34 :section: the official config section where to find this item,
35 :name: the official name within the section,
35 :name: the official name within the section,
36 :default: default value for this item,
36 :default: default value for this item,
37 :alias: optional list of tuples as alternatives,
37 :alias: optional list of tuples as alternatives,
38 :generic: this is a generic definition, match name using regular expression.
38 :generic: this is a generic definition, match name using regular expression.
39 """
39 """
40
40
41 def __init__(self, section, name, default=None, alias=(),
41 def __init__(self, section, name, default=None, alias=(),
42 generic=False, priority=0):
42 generic=False, priority=0):
43 self.section = section
43 self.section = section
44 self.name = name
44 self.name = name
45 self.default = default
45 self.default = default
46 self.alias = list(alias)
46 self.alias = list(alias)
47 self.generic = generic
47 self.generic = generic
48 self.priority = priority
48 self.priority = priority
49 self._re = None
49 self._re = None
50 if generic:
50 if generic:
51 self._re = re.compile(self.name)
51 self._re = re.compile(self.name)
52
52
53 class itemregister(dict):
53 class itemregister(dict):
54 """A specialized dictionary that can handle wild-card selection"""
54 """A specialized dictionary that can handle wild-card selection"""
55
55
56 def __init__(self):
56 def __init__(self):
57 super(itemregister, self).__init__()
57 super(itemregister, self).__init__()
58 self._generics = set()
58 self._generics = set()
59
59
60 def update(self, other):
60 def update(self, other):
61 super(itemregister, self).update(other)
61 super(itemregister, self).update(other)
62 self._generics.update(other._generics)
62 self._generics.update(other._generics)
63
63
64 def __setitem__(self, key, item):
64 def __setitem__(self, key, item):
65 super(itemregister, self).__setitem__(key, item)
65 super(itemregister, self).__setitem__(key, item)
66 if item.generic:
66 if item.generic:
67 self._generics.add(item)
67 self._generics.add(item)
68
68
69 def get(self, key):
69 def get(self, key):
70 baseitem = super(itemregister, self).get(key)
70 baseitem = super(itemregister, self).get(key)
71 if baseitem is not None and not baseitem.generic:
71 if baseitem is not None and not baseitem.generic:
72 return baseitem
72 return baseitem
73
73
74 # search for a matching generic item
74 # search for a matching generic item
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
75 generics = sorted(self._generics, key=(lambda x: (x.priority, x.name)))
76 for item in generics:
76 for item in generics:
77 # we use 'match' instead of 'search' to make the matching simpler
77 # we use 'match' instead of 'search' to make the matching simpler
78 # for people unfamiliar with regular expression. Having the match
78 # for people unfamiliar with regular expression. Having the match
79 # rooted to the start of the string will produce less surprising
79 # rooted to the start of the string will produce less surprising
80 # result for user writing simple regex for sub-attribute.
80 # result for user writing simple regex for sub-attribute.
81 #
81 #
82 # For example using "color\..*" match produces an unsurprising
82 # For example using "color\..*" match produces an unsurprising
83 # result, while using search could suddenly match apparently
83 # result, while using search could suddenly match apparently
84 # unrelated configuration that happens to contains "color."
84 # unrelated configuration that happens to contains "color."
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
85 # anywhere. This is a tradeoff where we favor requiring ".*" on
86 # some match to avoid the need to prefix most pattern with "^".
86 # some match to avoid the need to prefix most pattern with "^".
87 # The "^" seems more error prone.
87 # The "^" seems more error prone.
88 if item._re.match(key):
88 if item._re.match(key):
89 return item
89 return item
90
90
91 return None
91 return None
92
92
93 coreitems = {}
93 coreitems = {}
94
94
95 def _register(configtable, *args, **kwargs):
95 def _register(configtable, *args, **kwargs):
96 item = configitem(*args, **kwargs)
96 item = configitem(*args, **kwargs)
97 section = configtable.setdefault(item.section, itemregister())
97 section = configtable.setdefault(item.section, itemregister())
98 if item.name in section:
98 if item.name in section:
99 msg = "duplicated config item registration for '%s.%s'"
99 msg = "duplicated config item registration for '%s.%s'"
100 raise error.ProgrammingError(msg % (item.section, item.name))
100 raise error.ProgrammingError(msg % (item.section, item.name))
101 section[item.name] = item
101 section[item.name] = item
102
102
103 # special value for case where the default is derived from other values
103 # special value for case where the default is derived from other values
104 dynamicdefault = object()
104 dynamicdefault = object()
105
105
106 # Registering actual config items
106 # Registering actual config items
107
107
108 def getitemregister(configtable):
108 def getitemregister(configtable):
109 f = functools.partial(_register, configtable)
109 f = functools.partial(_register, configtable)
110 # export pseudo enum as configitem.*
110 # export pseudo enum as configitem.*
111 f.dynamicdefault = dynamicdefault
111 f.dynamicdefault = dynamicdefault
112 return f
112 return f
113
113
114 coreconfigitem = getitemregister(coreitems)
114 coreconfigitem = getitemregister(coreitems)
115
115
116 coreconfigitem('alias', '.*',
116 coreconfigitem('alias', '.*',
117 default=None,
117 default=None,
118 generic=True,
118 generic=True,
119 )
119 )
120 coreconfigitem('annotate', 'nodates',
120 coreconfigitem('annotate', 'nodates',
121 default=False,
121 default=False,
122 )
122 )
123 coreconfigitem('annotate', 'showfunc',
123 coreconfigitem('annotate', 'showfunc',
124 default=False,
124 default=False,
125 )
125 )
126 coreconfigitem('annotate', 'unified',
126 coreconfigitem('annotate', 'unified',
127 default=None,
127 default=None,
128 )
128 )
129 coreconfigitem('annotate', 'git',
129 coreconfigitem('annotate', 'git',
130 default=False,
130 default=False,
131 )
131 )
132 coreconfigitem('annotate', 'ignorews',
132 coreconfigitem('annotate', 'ignorews',
133 default=False,
133 default=False,
134 )
134 )
135 coreconfigitem('annotate', 'ignorewsamount',
135 coreconfigitem('annotate', 'ignorewsamount',
136 default=False,
136 default=False,
137 )
137 )
138 coreconfigitem('annotate', 'ignoreblanklines',
138 coreconfigitem('annotate', 'ignoreblanklines',
139 default=False,
139 default=False,
140 )
140 )
141 coreconfigitem('annotate', 'ignorewseol',
141 coreconfigitem('annotate', 'ignorewseol',
142 default=False,
142 default=False,
143 )
143 )
144 coreconfigitem('annotate', 'nobinary',
144 coreconfigitem('annotate', 'nobinary',
145 default=False,
145 default=False,
146 )
146 )
147 coreconfigitem('annotate', 'noprefix',
147 coreconfigitem('annotate', 'noprefix',
148 default=False,
148 default=False,
149 )
149 )
150 coreconfigitem('auth', 'cookiefile',
150 coreconfigitem('auth', 'cookiefile',
151 default=None,
151 default=None,
152 )
152 )
153 # bookmarks.pushing: internal hack for discovery
153 # bookmarks.pushing: internal hack for discovery
154 coreconfigitem('bookmarks', 'pushing',
154 coreconfigitem('bookmarks', 'pushing',
155 default=list,
155 default=list,
156 )
156 )
157 # bundle.mainreporoot: internal hack for bundlerepo
157 # bundle.mainreporoot: internal hack for bundlerepo
158 coreconfigitem('bundle', 'mainreporoot',
158 coreconfigitem('bundle', 'mainreporoot',
159 default='',
159 default='',
160 )
160 )
161 # bundle.reorder: experimental config
161 # bundle.reorder: experimental config
162 coreconfigitem('bundle', 'reorder',
162 coreconfigitem('bundle', 'reorder',
163 default='auto',
163 default='auto',
164 )
164 )
165 coreconfigitem('censor', 'policy',
165 coreconfigitem('censor', 'policy',
166 default='abort',
166 default='abort',
167 )
167 )
168 coreconfigitem('chgserver', 'idletimeout',
168 coreconfigitem('chgserver', 'idletimeout',
169 default=3600,
169 default=3600,
170 )
170 )
171 coreconfigitem('chgserver', 'skiphash',
171 coreconfigitem('chgserver', 'skiphash',
172 default=False,
172 default=False,
173 )
173 )
174 coreconfigitem('cmdserver', 'log',
174 coreconfigitem('cmdserver', 'log',
175 default=None,
175 default=None,
176 )
176 )
177 coreconfigitem('color', '.*',
177 coreconfigitem('color', '.*',
178 default=None,
178 default=None,
179 generic=True,
179 generic=True,
180 )
180 )
181 coreconfigitem('color', 'mode',
181 coreconfigitem('color', 'mode',
182 default='auto',
182 default='auto',
183 )
183 )
184 coreconfigitem('color', 'pagermode',
184 coreconfigitem('color', 'pagermode',
185 default=dynamicdefault,
185 default=dynamicdefault,
186 )
186 )
187 coreconfigitem('commands', 'show.aliasprefix',
187 coreconfigitem('commands', 'show.aliasprefix',
188 default=list,
188 default=list,
189 )
189 )
190 coreconfigitem('commands', 'status.relative',
190 coreconfigitem('commands', 'status.relative',
191 default=False,
191 default=False,
192 )
192 )
193 coreconfigitem('commands', 'status.skipstates',
193 coreconfigitem('commands', 'status.skipstates',
194 default=[],
194 default=[],
195 )
195 )
196 coreconfigitem('commands', 'status.verbose',
196 coreconfigitem('commands', 'status.verbose',
197 default=False,
197 default=False,
198 )
198 )
199 coreconfigitem('commands', 'update.check',
199 coreconfigitem('commands', 'update.check',
200 default=None,
200 default=None,
201 # Deprecated, remove after 4.4 release
201 # Deprecated, remove after 4.4 release
202 alias=[('experimental', 'updatecheck')]
202 alias=[('experimental', 'updatecheck')]
203 )
203 )
204 coreconfigitem('commands', 'update.requiredest',
204 coreconfigitem('commands', 'update.requiredest',
205 default=False,
205 default=False,
206 )
206 )
207 coreconfigitem('committemplate', '.*',
207 coreconfigitem('committemplate', '.*',
208 default=None,
208 default=None,
209 generic=True,
209 generic=True,
210 )
210 )
211 coreconfigitem('debug', 'dirstate.delaywrite',
211 coreconfigitem('debug', 'dirstate.delaywrite',
212 default=0,
212 default=0,
213 )
213 )
214 coreconfigitem('defaults', '.*',
214 coreconfigitem('defaults', '.*',
215 default=None,
215 default=None,
216 generic=True,
216 generic=True,
217 )
217 )
218 coreconfigitem('devel', 'all-warnings',
218 coreconfigitem('devel', 'all-warnings',
219 default=False,
219 default=False,
220 )
220 )
221 coreconfigitem('devel', 'bundle2.debug',
221 coreconfigitem('devel', 'bundle2.debug',
222 default=False,
222 default=False,
223 )
223 )
224 coreconfigitem('devel', 'cache-vfs',
224 coreconfigitem('devel', 'cache-vfs',
225 default=None,
225 default=None,
226 )
226 )
227 coreconfigitem('devel', 'check-locks',
227 coreconfigitem('devel', 'check-locks',
228 default=False,
228 default=False,
229 )
229 )
230 coreconfigitem('devel', 'check-relroot',
230 coreconfigitem('devel', 'check-relroot',
231 default=False,
231 default=False,
232 )
232 )
233 coreconfigitem('devel', 'default-date',
233 coreconfigitem('devel', 'default-date',
234 default=None,
234 default=None,
235 )
235 )
236 coreconfigitem('devel', 'deprec-warn',
236 coreconfigitem('devel', 'deprec-warn',
237 default=False,
237 default=False,
238 )
238 )
239 coreconfigitem('devel', 'disableloaddefaultcerts',
239 coreconfigitem('devel', 'disableloaddefaultcerts',
240 default=False,
240 default=False,
241 )
241 )
242 coreconfigitem('devel', 'warn-empty-changegroup',
242 coreconfigitem('devel', 'warn-empty-changegroup',
243 default=False,
243 default=False,
244 )
244 )
245 coreconfigitem('devel', 'legacy.exchange',
245 coreconfigitem('devel', 'legacy.exchange',
246 default=list,
246 default=list,
247 )
247 )
248 coreconfigitem('devel', 'servercafile',
248 coreconfigitem('devel', 'servercafile',
249 default='',
249 default='',
250 )
250 )
251 coreconfigitem('devel', 'serverexactprotocol',
251 coreconfigitem('devel', 'serverexactprotocol',
252 default='',
252 default='',
253 )
253 )
254 coreconfigitem('devel', 'serverrequirecert',
254 coreconfigitem('devel', 'serverrequirecert',
255 default=False,
255 default=False,
256 )
256 )
257 coreconfigitem('devel', 'strip-obsmarkers',
257 coreconfigitem('devel', 'strip-obsmarkers',
258 default=True,
258 default=True,
259 )
259 )
260 coreconfigitem('devel', 'warn-config',
260 coreconfigitem('devel', 'warn-config',
261 default=None,
261 default=None,
262 )
262 )
263 coreconfigitem('devel', 'warn-config-default',
263 coreconfigitem('devel', 'warn-config-default',
264 default=None,
264 default=None,
265 )
265 )
266 coreconfigitem('devel', 'user.obsmarker',
266 coreconfigitem('devel', 'user.obsmarker',
267 default=None,
267 default=None,
268 )
268 )
269 coreconfigitem('devel', 'warn-config-unknown',
269 coreconfigitem('devel', 'warn-config-unknown',
270 default=None,
270 default=None,
271 )
271 )
272 coreconfigitem('diff', 'nodates',
272 coreconfigitem('diff', 'nodates',
273 default=False,
273 default=False,
274 )
274 )
275 coreconfigitem('diff', 'showfunc',
275 coreconfigitem('diff', 'showfunc',
276 default=False,
276 default=False,
277 )
277 )
278 coreconfigitem('diff', 'unified',
278 coreconfigitem('diff', 'unified',
279 default=None,
279 default=None,
280 )
280 )
281 coreconfigitem('diff', 'git',
281 coreconfigitem('diff', 'git',
282 default=False,
282 default=False,
283 )
283 )
284 coreconfigitem('diff', 'ignorews',
284 coreconfigitem('diff', 'ignorews',
285 default=False,
285 default=False,
286 )
286 )
287 coreconfigitem('diff', 'ignorewsamount',
287 coreconfigitem('diff', 'ignorewsamount',
288 default=False,
288 default=False,
289 )
289 )
290 coreconfigitem('diff', 'ignoreblanklines',
290 coreconfigitem('diff', 'ignoreblanklines',
291 default=False,
291 default=False,
292 )
292 )
293 coreconfigitem('diff', 'ignorewseol',
293 coreconfigitem('diff', 'ignorewseol',
294 default=False,
294 default=False,
295 )
295 )
296 coreconfigitem('diff', 'nobinary',
296 coreconfigitem('diff', 'nobinary',
297 default=False,
297 default=False,
298 )
298 )
299 coreconfigitem('diff', 'noprefix',
299 coreconfigitem('diff', 'noprefix',
300 default=False,
300 default=False,
301 )
301 )
302 coreconfigitem('email', 'bcc',
302 coreconfigitem('email', 'bcc',
303 default=None,
303 default=None,
304 )
304 )
305 coreconfigitem('email', 'cc',
305 coreconfigitem('email', 'cc',
306 default=None,
306 default=None,
307 )
307 )
308 coreconfigitem('email', 'charsets',
308 coreconfigitem('email', 'charsets',
309 default=list,
309 default=list,
310 )
310 )
311 coreconfigitem('email', 'from',
311 coreconfigitem('email', 'from',
312 default=None,
312 default=None,
313 )
313 )
314 coreconfigitem('email', 'method',
314 coreconfigitem('email', 'method',
315 default='smtp',
315 default='smtp',
316 )
316 )
317 coreconfigitem('email', 'reply-to',
317 coreconfigitem('email', 'reply-to',
318 default=None,
318 default=None,
319 )
319 )
320 coreconfigitem('email', 'to',
320 coreconfigitem('email', 'to',
321 default=None,
321 default=None,
322 )
322 )
323 coreconfigitem('experimental', 'archivemetatemplate',
323 coreconfigitem('experimental', 'archivemetatemplate',
324 default=dynamicdefault,
324 default=dynamicdefault,
325 )
325 )
326 coreconfigitem('experimental', 'bundle-phases',
326 coreconfigitem('experimental', 'bundle-phases',
327 default=False,
327 default=False,
328 )
328 )
329 coreconfigitem('experimental', 'bundle2-advertise',
329 coreconfigitem('experimental', 'bundle2-advertise',
330 default=True,
330 default=True,
331 )
331 )
332 coreconfigitem('experimental', 'bundle2-output-capture',
332 coreconfigitem('experimental', 'bundle2-output-capture',
333 default=False,
333 default=False,
334 )
334 )
335 coreconfigitem('experimental', 'bundle2.pushback',
335 coreconfigitem('experimental', 'bundle2.pushback',
336 default=False,
336 default=False,
337 )
337 )
338 coreconfigitem('experimental', 'bundle2lazylocking',
338 coreconfigitem('experimental', 'bundle2lazylocking',
339 default=False,
339 default=False,
340 )
340 )
341 coreconfigitem('experimental', 'bundlecomplevel',
341 coreconfigitem('experimental', 'bundlecomplevel',
342 default=None,
342 default=None,
343 )
343 )
344 coreconfigitem('experimental', 'changegroup3',
344 coreconfigitem('experimental', 'changegroup3',
345 default=False,
345 default=False,
346 )
346 )
347 coreconfigitem('experimental', 'clientcompressionengines',
347 coreconfigitem('experimental', 'clientcompressionengines',
348 default=list,
348 default=list,
349 )
349 )
350 coreconfigitem('experimental', 'copytrace',
350 coreconfigitem('experimental', 'copytrace',
351 default='on',
351 default='on',
352 )
352 )
353 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
353 coreconfigitem('experimental', 'copytrace.movecandidateslimit',
354 default=100,
354 default=100,
355 )
355 )
356 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
356 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
357 default=100,
357 default=100,
358 )
358 )
359 coreconfigitem('experimental', 'crecordtest',
359 coreconfigitem('experimental', 'crecordtest',
360 default=None,
360 default=None,
361 )
361 )
362 coreconfigitem('experimental', 'editortmpinhg',
362 coreconfigitem('experimental', 'editortmpinhg',
363 default=False,
363 default=False,
364 )
364 )
365 coreconfigitem('experimental', 'evolution',
365 coreconfigitem('experimental', 'evolution',
366 default=list,
366 default=list,
367 )
367 )
368 coreconfigitem('experimental', 'evolution.allowdivergence',
368 coreconfigitem('experimental', 'evolution.allowdivergence',
369 default=False,
369 default=False,
370 alias=[('experimental', 'allowdivergence')]
370 alias=[('experimental', 'allowdivergence')]
371 )
371 )
372 coreconfigitem('experimental', 'evolution.allowunstable',
372 coreconfigitem('experimental', 'evolution.allowunstable',
373 default=None,
373 default=None,
374 )
374 )
375 coreconfigitem('experimental', 'evolution.createmarkers',
375 coreconfigitem('experimental', 'evolution.createmarkers',
376 default=None,
376 default=None,
377 )
377 )
378 coreconfigitem('experimental', 'evolution.effect-flags',
378 coreconfigitem('experimental', 'evolution.effect-flags',
379 default=False,
379 default=False,
380 alias=[('experimental', 'effect-flags')]
380 alias=[('experimental', 'effect-flags')]
381 )
381 )
382 coreconfigitem('experimental', 'evolution.exchange',
382 coreconfigitem('experimental', 'evolution.exchange',
383 default=None,
383 default=None,
384 )
384 )
385 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
385 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
386 default=False,
386 default=False,
387 )
387 )
388 coreconfigitem('experimental', 'evolution.track-operation',
388 coreconfigitem('experimental', 'evolution.track-operation',
389 default=True,
389 default=True,
390 )
390 )
391 coreconfigitem('experimental', 'maxdeltachainspan',
391 coreconfigitem('experimental', 'maxdeltachainspan',
392 default=-1,
392 default=-1,
393 )
393 )
394 coreconfigitem('experimental', 'mmapindexthreshold',
394 coreconfigitem('experimental', 'mmapindexthreshold',
395 default=None,
395 default=None,
396 )
396 )
397 coreconfigitem('experimental', 'nonnormalparanoidcheck',
397 coreconfigitem('experimental', 'nonnormalparanoidcheck',
398 default=False,
398 default=False,
399 )
399 )
400 coreconfigitem('experimental', 'exportableenviron',
400 coreconfigitem('experimental', 'exportableenviron',
401 default=list,
401 default=list,
402 )
402 )
403 coreconfigitem('experimental', 'extendedheader.index',
403 coreconfigitem('experimental', 'extendedheader.index',
404 default=None,
404 default=None,
405 )
405 )
406 coreconfigitem('experimental', 'extendedheader.similarity',
406 coreconfigitem('experimental', 'extendedheader.similarity',
407 default=False,
407 default=False,
408 )
408 )
409 coreconfigitem('experimental', 'format.compression',
409 coreconfigitem('experimental', 'format.compression',
410 default='zlib',
410 default='zlib',
411 )
411 )
412 coreconfigitem('experimental', 'graphshorten',
412 coreconfigitem('experimental', 'graphshorten',
413 default=False,
413 default=False,
414 )
414 )
415 coreconfigitem('experimental', 'graphstyle.parent',
415 coreconfigitem('experimental', 'graphstyle.parent',
416 default=dynamicdefault,
416 default=dynamicdefault,
417 )
417 )
418 coreconfigitem('experimental', 'graphstyle.missing',
418 coreconfigitem('experimental', 'graphstyle.missing',
419 default=dynamicdefault,
419 default=dynamicdefault,
420 )
420 )
421 coreconfigitem('experimental', 'graphstyle.grandparent',
421 coreconfigitem('experimental', 'graphstyle.grandparent',
422 default=dynamicdefault,
422 default=dynamicdefault,
423 )
423 )
424 coreconfigitem('experimental', 'hook-track-tags',
424 coreconfigitem('experimental', 'hook-track-tags',
425 default=False,
425 default=False,
426 )
426 )
427 coreconfigitem('experimental', 'httppostargs',
427 coreconfigitem('experimental', 'httppostargs',
428 default=False,
428 default=False,
429 )
429 )
430 coreconfigitem('experimental', 'manifestv2',
430 coreconfigitem('experimental', 'manifestv2',
431 default=False,
431 default=False,
432 )
432 )
433 coreconfigitem('experimental', 'mergedriver',
433 coreconfigitem('experimental', 'mergedriver',
434 default=None,
434 default=None,
435 )
435 )
436 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
436 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
437 default=False,
437 default=False,
438 )
438 )
439 coreconfigitem('experimental', 'rebase.multidest',
439 coreconfigitem('experimental', 'rebase.multidest',
440 default=False,
440 default=False,
441 )
441 )
442 coreconfigitem('experimental', 'revertalternateinteractivemode',
442 coreconfigitem('experimental', 'revertalternateinteractivemode',
443 default=True,
443 default=True,
444 )
444 )
445 coreconfigitem('experimental', 'revlogv2',
445 coreconfigitem('experimental', 'revlogv2',
446 default=None,
446 default=None,
447 )
447 )
448 coreconfigitem('experimental', 'spacemovesdown',
448 coreconfigitem('experimental', 'spacemovesdown',
449 default=False,
449 default=False,
450 )
450 )
451 coreconfigitem('experimental', 'sparse-read',
451 coreconfigitem('experimental', 'sparse-read',
452 default=False,
452 default=False,
453 )
453 )
454 coreconfigitem('experimental', 'sparse-read.density-threshold',
454 coreconfigitem('experimental', 'sparse-read.density-threshold',
455 default=0.25,
455 default=0.25,
456 )
456 )
457 coreconfigitem('experimental', 'sparse-read.min-gap-size',
457 coreconfigitem('experimental', 'sparse-read.min-gap-size',
458 default='256K',
458 default='256K',
459 )
459 )
460 coreconfigitem('experimental', 'treemanifest',
460 coreconfigitem('experimental', 'treemanifest',
461 default=False,
461 default=False,
462 )
462 )
463 coreconfigitem('extensions', '.*',
463 coreconfigitem('extensions', '.*',
464 default=None,
464 default=None,
465 generic=True,
465 generic=True,
466 )
466 )
467 coreconfigitem('extdata', '.*',
467 coreconfigitem('extdata', '.*',
468 default=None,
468 default=None,
469 generic=True,
469 generic=True,
470 )
470 )
471 coreconfigitem('format', 'aggressivemergedeltas',
471 coreconfigitem('format', 'aggressivemergedeltas',
472 default=False,
472 default=False,
473 )
473 )
474 coreconfigitem('format', 'chunkcachesize',
474 coreconfigitem('format', 'chunkcachesize',
475 default=None,
475 default=None,
476 )
476 )
477 coreconfigitem('format', 'dotencode',
477 coreconfigitem('format', 'dotencode',
478 default=True,
478 default=True,
479 )
479 )
480 coreconfigitem('format', 'generaldelta',
480 coreconfigitem('format', 'generaldelta',
481 default=False,
481 default=False,
482 )
482 )
483 coreconfigitem('format', 'manifestcachesize',
483 coreconfigitem('format', 'manifestcachesize',
484 default=None,
484 default=None,
485 )
485 )
486 coreconfigitem('format', 'maxchainlen',
486 coreconfigitem('format', 'maxchainlen',
487 default=None,
487 default=None,
488 )
488 )
489 coreconfigitem('format', 'obsstore-version',
489 coreconfigitem('format', 'obsstore-version',
490 default=None,
490 default=None,
491 )
491 )
492 coreconfigitem('format', 'usefncache',
492 coreconfigitem('format', 'usefncache',
493 default=True,
493 default=True,
494 )
494 )
495 coreconfigitem('format', 'usegeneraldelta',
495 coreconfigitem('format', 'usegeneraldelta',
496 default=True,
496 default=True,
497 )
497 )
498 coreconfigitem('format', 'usestore',
498 coreconfigitem('format', 'usestore',
499 default=True,
499 default=True,
500 )
500 )
501 coreconfigitem('fsmonitor', 'warn_when_unused',
501 coreconfigitem('fsmonitor', 'warn_when_unused',
502 default=True,
502 default=True,
503 )
503 )
504 coreconfigitem('fsmonitor', 'warn_update_file_count',
504 coreconfigitem('fsmonitor', 'warn_update_file_count',
505 default=50000,
505 default=50000,
506 )
506 )
507 coreconfigitem('hooks', '.*',
507 coreconfigitem('hooks', '.*',
508 default=dynamicdefault,
508 default=dynamicdefault,
509 generic=True,
509 generic=True,
510 )
510 )
511 coreconfigitem('hgweb-paths', '.*',
511 coreconfigitem('hgweb-paths', '.*',
512 default=list,
512 default=list,
513 generic=True,
513 generic=True,
514 )
514 )
515 coreconfigitem('hostfingerprints', '.*',
515 coreconfigitem('hostfingerprints', '.*',
516 default=list,
516 default=list,
517 generic=True,
517 generic=True,
518 )
518 )
519 coreconfigitem('hostsecurity', 'ciphers',
519 coreconfigitem('hostsecurity', 'ciphers',
520 default=None,
520 default=None,
521 )
521 )
522 coreconfigitem('hostsecurity', 'disabletls10warning',
522 coreconfigitem('hostsecurity', 'disabletls10warning',
523 default=False,
523 default=False,
524 )
524 )
525 coreconfigitem('hostsecurity', 'minimumprotocol',
525 coreconfigitem('hostsecurity', 'minimumprotocol',
526 default=dynamicdefault,
526 default=dynamicdefault,
527 )
527 )
528 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
528 coreconfigitem('hostsecurity', '.*:minimumprotocol$',
529 default=dynamicdefault,
529 default=dynamicdefault,
530 generic=True,
530 generic=True,
531 )
531 )
532 coreconfigitem('hostsecurity', '.*:ciphers$',
532 coreconfigitem('hostsecurity', '.*:ciphers$',
533 default=dynamicdefault,
533 default=dynamicdefault,
534 generic=True,
534 generic=True,
535 )
535 )
536 coreconfigitem('hostsecurity', '.*:fingerprints$',
536 coreconfigitem('hostsecurity', '.*:fingerprints$',
537 default=list,
537 default=list,
538 generic=True,
538 generic=True,
539 )
539 )
540 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
540 coreconfigitem('hostsecurity', '.*:verifycertsfile$',
541 default=None,
541 default=None,
542 generic=True,
542 generic=True,
543 )
543 )
544
544
545 coreconfigitem('http_proxy', 'always',
545 coreconfigitem('http_proxy', 'always',
546 default=False,
546 default=False,
547 )
547 )
548 coreconfigitem('http_proxy', 'host',
548 coreconfigitem('http_proxy', 'host',
549 default=None,
549 default=None,
550 )
550 )
551 coreconfigitem('http_proxy', 'no',
551 coreconfigitem('http_proxy', 'no',
552 default=list,
552 default=list,
553 )
553 )
554 coreconfigitem('http_proxy', 'passwd',
554 coreconfigitem('http_proxy', 'passwd',
555 default=None,
555 default=None,
556 )
556 )
557 coreconfigitem('http_proxy', 'user',
557 coreconfigitem('http_proxy', 'user',
558 default=None,
558 default=None,
559 )
559 )
560 coreconfigitem('logtoprocess', 'commandexception',
560 coreconfigitem('logtoprocess', 'commandexception',
561 default=None,
561 default=None,
562 )
562 )
563 coreconfigitem('logtoprocess', 'commandfinish',
563 coreconfigitem('logtoprocess', 'commandfinish',
564 default=None,
564 default=None,
565 )
565 )
566 coreconfigitem('logtoprocess', 'command',
566 coreconfigitem('logtoprocess', 'command',
567 default=None,
567 default=None,
568 )
568 )
569 coreconfigitem('logtoprocess', 'develwarn',
569 coreconfigitem('logtoprocess', 'develwarn',
570 default=None,
570 default=None,
571 )
571 )
572 coreconfigitem('logtoprocess', 'uiblocked',
572 coreconfigitem('logtoprocess', 'uiblocked',
573 default=None,
573 default=None,
574 )
574 )
575 coreconfigitem('merge', 'checkunknown',
575 coreconfigitem('merge', 'checkunknown',
576 default='abort',
576 default='abort',
577 )
577 )
578 coreconfigitem('merge', 'checkignored',
578 coreconfigitem('merge', 'checkignored',
579 default='abort',
579 default='abort',
580 )
580 )
581 coreconfigitem('experimental', 'merge.checkpathconflicts',
581 coreconfigitem('experimental', 'merge.checkpathconflicts',
582 default=True,
582 default=False,
583 )
583 )
584 coreconfigitem('merge', 'followcopies',
584 coreconfigitem('merge', 'followcopies',
585 default=True,
585 default=True,
586 )
586 )
587 coreconfigitem('merge', 'on-failure',
587 coreconfigitem('merge', 'on-failure',
588 default='continue',
588 default='continue',
589 )
589 )
590 coreconfigitem('merge', 'preferancestor',
590 coreconfigitem('merge', 'preferancestor',
591 default=lambda: ['*'],
591 default=lambda: ['*'],
592 )
592 )
593 coreconfigitem('merge-tools', '.*',
593 coreconfigitem('merge-tools', '.*',
594 default=None,
594 default=None,
595 generic=True,
595 generic=True,
596 )
596 )
597 coreconfigitem('merge-tools', br'.*\.args$',
597 coreconfigitem('merge-tools', br'.*\.args$',
598 default="$local $base $other",
598 default="$local $base $other",
599 generic=True,
599 generic=True,
600 priority=-1,
600 priority=-1,
601 )
601 )
602 coreconfigitem('merge-tools', br'.*\.binary$',
602 coreconfigitem('merge-tools', br'.*\.binary$',
603 default=False,
603 default=False,
604 generic=True,
604 generic=True,
605 priority=-1,
605 priority=-1,
606 )
606 )
607 coreconfigitem('merge-tools', br'.*\.check$',
607 coreconfigitem('merge-tools', br'.*\.check$',
608 default=list,
608 default=list,
609 generic=True,
609 generic=True,
610 priority=-1,
610 priority=-1,
611 )
611 )
612 coreconfigitem('merge-tools', br'.*\.checkchanged$',
612 coreconfigitem('merge-tools', br'.*\.checkchanged$',
613 default=False,
613 default=False,
614 generic=True,
614 generic=True,
615 priority=-1,
615 priority=-1,
616 )
616 )
617 coreconfigitem('merge-tools', br'.*\.executable$',
617 coreconfigitem('merge-tools', br'.*\.executable$',
618 default=dynamicdefault,
618 default=dynamicdefault,
619 generic=True,
619 generic=True,
620 priority=-1,
620 priority=-1,
621 )
621 )
622 coreconfigitem('merge-tools', br'.*\.fixeol$',
622 coreconfigitem('merge-tools', br'.*\.fixeol$',
623 default=False,
623 default=False,
624 generic=True,
624 generic=True,
625 priority=-1,
625 priority=-1,
626 )
626 )
627 coreconfigitem('merge-tools', br'.*\.gui$',
627 coreconfigitem('merge-tools', br'.*\.gui$',
628 default=False,
628 default=False,
629 generic=True,
629 generic=True,
630 priority=-1,
630 priority=-1,
631 )
631 )
632 coreconfigitem('merge-tools', br'.*\.priority$',
632 coreconfigitem('merge-tools', br'.*\.priority$',
633 default=0,
633 default=0,
634 generic=True,
634 generic=True,
635 priority=-1,
635 priority=-1,
636 )
636 )
637 coreconfigitem('merge-tools', br'.*\.premerge$',
637 coreconfigitem('merge-tools', br'.*\.premerge$',
638 default=dynamicdefault,
638 default=dynamicdefault,
639 generic=True,
639 generic=True,
640 priority=-1,
640 priority=-1,
641 )
641 )
642 coreconfigitem('merge-tools', br'.*\.symlink$',
642 coreconfigitem('merge-tools', br'.*\.symlink$',
643 default=False,
643 default=False,
644 generic=True,
644 generic=True,
645 priority=-1,
645 priority=-1,
646 )
646 )
647 coreconfigitem('pager', 'attend-.*',
647 coreconfigitem('pager', 'attend-.*',
648 default=dynamicdefault,
648 default=dynamicdefault,
649 generic=True,
649 generic=True,
650 )
650 )
651 coreconfigitem('pager', 'ignore',
651 coreconfigitem('pager', 'ignore',
652 default=list,
652 default=list,
653 )
653 )
654 coreconfigitem('pager', 'pager',
654 coreconfigitem('pager', 'pager',
655 default=dynamicdefault,
655 default=dynamicdefault,
656 )
656 )
657 coreconfigitem('patch', 'eol',
657 coreconfigitem('patch', 'eol',
658 default='strict',
658 default='strict',
659 )
659 )
660 coreconfigitem('patch', 'fuzz',
660 coreconfigitem('patch', 'fuzz',
661 default=2,
661 default=2,
662 )
662 )
663 coreconfigitem('paths', 'default',
663 coreconfigitem('paths', 'default',
664 default=None,
664 default=None,
665 )
665 )
666 coreconfigitem('paths', 'default-push',
666 coreconfigitem('paths', 'default-push',
667 default=None,
667 default=None,
668 )
668 )
669 coreconfigitem('paths', '.*',
669 coreconfigitem('paths', '.*',
670 default=None,
670 default=None,
671 generic=True,
671 generic=True,
672 )
672 )
673 coreconfigitem('phases', 'checksubrepos',
673 coreconfigitem('phases', 'checksubrepos',
674 default='follow',
674 default='follow',
675 )
675 )
676 coreconfigitem('phases', 'new-commit',
676 coreconfigitem('phases', 'new-commit',
677 default='draft',
677 default='draft',
678 )
678 )
679 coreconfigitem('phases', 'publish',
679 coreconfigitem('phases', 'publish',
680 default=True,
680 default=True,
681 )
681 )
682 coreconfigitem('profiling', 'enabled',
682 coreconfigitem('profiling', 'enabled',
683 default=False,
683 default=False,
684 )
684 )
685 coreconfigitem('profiling', 'format',
685 coreconfigitem('profiling', 'format',
686 default='text',
686 default='text',
687 )
687 )
688 coreconfigitem('profiling', 'freq',
688 coreconfigitem('profiling', 'freq',
689 default=1000,
689 default=1000,
690 )
690 )
691 coreconfigitem('profiling', 'limit',
691 coreconfigitem('profiling', 'limit',
692 default=30,
692 default=30,
693 )
693 )
694 coreconfigitem('profiling', 'nested',
694 coreconfigitem('profiling', 'nested',
695 default=0,
695 default=0,
696 )
696 )
697 coreconfigitem('profiling', 'output',
697 coreconfigitem('profiling', 'output',
698 default=None,
698 default=None,
699 )
699 )
700 coreconfigitem('profiling', 'showmax',
700 coreconfigitem('profiling', 'showmax',
701 default=0.999,
701 default=0.999,
702 )
702 )
703 coreconfigitem('profiling', 'showmin',
703 coreconfigitem('profiling', 'showmin',
704 default=dynamicdefault,
704 default=dynamicdefault,
705 )
705 )
706 coreconfigitem('profiling', 'sort',
706 coreconfigitem('profiling', 'sort',
707 default='inlinetime',
707 default='inlinetime',
708 )
708 )
709 coreconfigitem('profiling', 'statformat',
709 coreconfigitem('profiling', 'statformat',
710 default='hotpath',
710 default='hotpath',
711 )
711 )
712 coreconfigitem('profiling', 'type',
712 coreconfigitem('profiling', 'type',
713 default='stat',
713 default='stat',
714 )
714 )
715 coreconfigitem('progress', 'assume-tty',
715 coreconfigitem('progress', 'assume-tty',
716 default=False,
716 default=False,
717 )
717 )
718 coreconfigitem('progress', 'changedelay',
718 coreconfigitem('progress', 'changedelay',
719 default=1,
719 default=1,
720 )
720 )
721 coreconfigitem('progress', 'clear-complete',
721 coreconfigitem('progress', 'clear-complete',
722 default=True,
722 default=True,
723 )
723 )
724 coreconfigitem('progress', 'debug',
724 coreconfigitem('progress', 'debug',
725 default=False,
725 default=False,
726 )
726 )
727 coreconfigitem('progress', 'delay',
727 coreconfigitem('progress', 'delay',
728 default=3,
728 default=3,
729 )
729 )
730 coreconfigitem('progress', 'disable',
730 coreconfigitem('progress', 'disable',
731 default=False,
731 default=False,
732 )
732 )
733 coreconfigitem('progress', 'estimateinterval',
733 coreconfigitem('progress', 'estimateinterval',
734 default=60.0,
734 default=60.0,
735 )
735 )
736 coreconfigitem('progress', 'format',
736 coreconfigitem('progress', 'format',
737 default=lambda: ['topic', 'bar', 'number', 'estimate'],
737 default=lambda: ['topic', 'bar', 'number', 'estimate'],
738 )
738 )
739 coreconfigitem('progress', 'refresh',
739 coreconfigitem('progress', 'refresh',
740 default=0.1,
740 default=0.1,
741 )
741 )
742 coreconfigitem('progress', 'width',
742 coreconfigitem('progress', 'width',
743 default=dynamicdefault,
743 default=dynamicdefault,
744 )
744 )
745 coreconfigitem('push', 'pushvars.server',
745 coreconfigitem('push', 'pushvars.server',
746 default=False,
746 default=False,
747 )
747 )
748 coreconfigitem('server', 'bundle1',
748 coreconfigitem('server', 'bundle1',
749 default=True,
749 default=True,
750 )
750 )
751 coreconfigitem('server', 'bundle1gd',
751 coreconfigitem('server', 'bundle1gd',
752 default=None,
752 default=None,
753 )
753 )
754 coreconfigitem('server', 'bundle1.pull',
754 coreconfigitem('server', 'bundle1.pull',
755 default=None,
755 default=None,
756 )
756 )
757 coreconfigitem('server', 'bundle1gd.pull',
757 coreconfigitem('server', 'bundle1gd.pull',
758 default=None,
758 default=None,
759 )
759 )
760 coreconfigitem('server', 'bundle1.push',
760 coreconfigitem('server', 'bundle1.push',
761 default=None,
761 default=None,
762 )
762 )
763 coreconfigitem('server', 'bundle1gd.push',
763 coreconfigitem('server', 'bundle1gd.push',
764 default=None,
764 default=None,
765 )
765 )
766 coreconfigitem('server', 'compressionengines',
766 coreconfigitem('server', 'compressionengines',
767 default=list,
767 default=list,
768 )
768 )
769 coreconfigitem('server', 'concurrent-push-mode',
769 coreconfigitem('server', 'concurrent-push-mode',
770 default='strict',
770 default='strict',
771 )
771 )
772 coreconfigitem('server', 'disablefullbundle',
772 coreconfigitem('server', 'disablefullbundle',
773 default=False,
773 default=False,
774 )
774 )
775 coreconfigitem('server', 'maxhttpheaderlen',
775 coreconfigitem('server', 'maxhttpheaderlen',
776 default=1024,
776 default=1024,
777 )
777 )
778 coreconfigitem('server', 'preferuncompressed',
778 coreconfigitem('server', 'preferuncompressed',
779 default=False,
779 default=False,
780 )
780 )
781 coreconfigitem('server', 'uncompressed',
781 coreconfigitem('server', 'uncompressed',
782 default=True,
782 default=True,
783 )
783 )
784 coreconfigitem('server', 'uncompressedallowsecret',
784 coreconfigitem('server', 'uncompressedallowsecret',
785 default=False,
785 default=False,
786 )
786 )
787 coreconfigitem('server', 'validate',
787 coreconfigitem('server', 'validate',
788 default=False,
788 default=False,
789 )
789 )
790 coreconfigitem('server', 'zliblevel',
790 coreconfigitem('server', 'zliblevel',
791 default=-1,
791 default=-1,
792 )
792 )
793 coreconfigitem('smtp', 'host',
793 coreconfigitem('smtp', 'host',
794 default=None,
794 default=None,
795 )
795 )
796 coreconfigitem('smtp', 'local_hostname',
796 coreconfigitem('smtp', 'local_hostname',
797 default=None,
797 default=None,
798 )
798 )
799 coreconfigitem('smtp', 'password',
799 coreconfigitem('smtp', 'password',
800 default=None,
800 default=None,
801 )
801 )
802 coreconfigitem('smtp', 'port',
802 coreconfigitem('smtp', 'port',
803 default=dynamicdefault,
803 default=dynamicdefault,
804 )
804 )
805 coreconfigitem('smtp', 'tls',
805 coreconfigitem('smtp', 'tls',
806 default='none',
806 default='none',
807 )
807 )
808 coreconfigitem('smtp', 'username',
808 coreconfigitem('smtp', 'username',
809 default=None,
809 default=None,
810 )
810 )
811 coreconfigitem('sparse', 'missingwarning',
811 coreconfigitem('sparse', 'missingwarning',
812 default=True,
812 default=True,
813 )
813 )
814 coreconfigitem('templates', '.*',
814 coreconfigitem('templates', '.*',
815 default=None,
815 default=None,
816 generic=True,
816 generic=True,
817 )
817 )
818 coreconfigitem('trusted', 'groups',
818 coreconfigitem('trusted', 'groups',
819 default=list,
819 default=list,
820 )
820 )
821 coreconfigitem('trusted', 'users',
821 coreconfigitem('trusted', 'users',
822 default=list,
822 default=list,
823 )
823 )
824 coreconfigitem('ui', '_usedassubrepo',
824 coreconfigitem('ui', '_usedassubrepo',
825 default=False,
825 default=False,
826 )
826 )
827 coreconfigitem('ui', 'allowemptycommit',
827 coreconfigitem('ui', 'allowemptycommit',
828 default=False,
828 default=False,
829 )
829 )
830 coreconfigitem('ui', 'archivemeta',
830 coreconfigitem('ui', 'archivemeta',
831 default=True,
831 default=True,
832 )
832 )
833 coreconfigitem('ui', 'askusername',
833 coreconfigitem('ui', 'askusername',
834 default=False,
834 default=False,
835 )
835 )
836 coreconfigitem('ui', 'clonebundlefallback',
836 coreconfigitem('ui', 'clonebundlefallback',
837 default=False,
837 default=False,
838 )
838 )
839 coreconfigitem('ui', 'clonebundleprefers',
839 coreconfigitem('ui', 'clonebundleprefers',
840 default=list,
840 default=list,
841 )
841 )
842 coreconfigitem('ui', 'clonebundles',
842 coreconfigitem('ui', 'clonebundles',
843 default=True,
843 default=True,
844 )
844 )
845 coreconfigitem('ui', 'color',
845 coreconfigitem('ui', 'color',
846 default='auto',
846 default='auto',
847 )
847 )
848 coreconfigitem('ui', 'commitsubrepos',
848 coreconfigitem('ui', 'commitsubrepos',
849 default=False,
849 default=False,
850 )
850 )
851 coreconfigitem('ui', 'debug',
851 coreconfigitem('ui', 'debug',
852 default=False,
852 default=False,
853 )
853 )
854 coreconfigitem('ui', 'debugger',
854 coreconfigitem('ui', 'debugger',
855 default=None,
855 default=None,
856 )
856 )
857 coreconfigitem('ui', 'editor',
857 coreconfigitem('ui', 'editor',
858 default=dynamicdefault,
858 default=dynamicdefault,
859 )
859 )
860 coreconfigitem('ui', 'fallbackencoding',
860 coreconfigitem('ui', 'fallbackencoding',
861 default=None,
861 default=None,
862 )
862 )
863 coreconfigitem('ui', 'forcecwd',
863 coreconfigitem('ui', 'forcecwd',
864 default=None,
864 default=None,
865 )
865 )
866 coreconfigitem('ui', 'forcemerge',
866 coreconfigitem('ui', 'forcemerge',
867 default=None,
867 default=None,
868 )
868 )
869 coreconfigitem('ui', 'formatdebug',
869 coreconfigitem('ui', 'formatdebug',
870 default=False,
870 default=False,
871 )
871 )
872 coreconfigitem('ui', 'formatjson',
872 coreconfigitem('ui', 'formatjson',
873 default=False,
873 default=False,
874 )
874 )
875 coreconfigitem('ui', 'formatted',
875 coreconfigitem('ui', 'formatted',
876 default=None,
876 default=None,
877 )
877 )
878 coreconfigitem('ui', 'graphnodetemplate',
878 coreconfigitem('ui', 'graphnodetemplate',
879 default=None,
879 default=None,
880 )
880 )
881 coreconfigitem('ui', 'http2debuglevel',
881 coreconfigitem('ui', 'http2debuglevel',
882 default=None,
882 default=None,
883 )
883 )
884 coreconfigitem('ui', 'interactive',
884 coreconfigitem('ui', 'interactive',
885 default=None,
885 default=None,
886 )
886 )
887 coreconfigitem('ui', 'interface',
887 coreconfigitem('ui', 'interface',
888 default=None,
888 default=None,
889 )
889 )
890 coreconfigitem('ui', 'interface.chunkselector',
890 coreconfigitem('ui', 'interface.chunkselector',
891 default=None,
891 default=None,
892 )
892 )
893 coreconfigitem('ui', 'logblockedtimes',
893 coreconfigitem('ui', 'logblockedtimes',
894 default=False,
894 default=False,
895 )
895 )
896 coreconfigitem('ui', 'logtemplate',
896 coreconfigitem('ui', 'logtemplate',
897 default=None,
897 default=None,
898 )
898 )
899 coreconfigitem('ui', 'merge',
899 coreconfigitem('ui', 'merge',
900 default=None,
900 default=None,
901 )
901 )
902 coreconfigitem('ui', 'mergemarkers',
902 coreconfigitem('ui', 'mergemarkers',
903 default='basic',
903 default='basic',
904 )
904 )
905 coreconfigitem('ui', 'mergemarkertemplate',
905 coreconfigitem('ui', 'mergemarkertemplate',
906 default=('{node|short} '
906 default=('{node|short} '
907 '{ifeq(tags, "tip", "", '
907 '{ifeq(tags, "tip", "", '
908 'ifeq(tags, "", "", "{tags} "))}'
908 'ifeq(tags, "", "", "{tags} "))}'
909 '{if(bookmarks, "{bookmarks} ")}'
909 '{if(bookmarks, "{bookmarks} ")}'
910 '{ifeq(branch, "default", "", "{branch} ")}'
910 '{ifeq(branch, "default", "", "{branch} ")}'
911 '- {author|user}: {desc|firstline}')
911 '- {author|user}: {desc|firstline}')
912 )
912 )
913 coreconfigitem('ui', 'nontty',
913 coreconfigitem('ui', 'nontty',
914 default=False,
914 default=False,
915 )
915 )
916 coreconfigitem('ui', 'origbackuppath',
916 coreconfigitem('ui', 'origbackuppath',
917 default=None,
917 default=None,
918 )
918 )
919 coreconfigitem('ui', 'paginate',
919 coreconfigitem('ui', 'paginate',
920 default=True,
920 default=True,
921 )
921 )
922 coreconfigitem('ui', 'patch',
922 coreconfigitem('ui', 'patch',
923 default=None,
923 default=None,
924 )
924 )
925 coreconfigitem('ui', 'portablefilenames',
925 coreconfigitem('ui', 'portablefilenames',
926 default='warn',
926 default='warn',
927 )
927 )
928 coreconfigitem('ui', 'promptecho',
928 coreconfigitem('ui', 'promptecho',
929 default=False,
929 default=False,
930 )
930 )
931 coreconfigitem('ui', 'quiet',
931 coreconfigitem('ui', 'quiet',
932 default=False,
932 default=False,
933 )
933 )
934 coreconfigitem('ui', 'quietbookmarkmove',
934 coreconfigitem('ui', 'quietbookmarkmove',
935 default=False,
935 default=False,
936 )
936 )
937 coreconfigitem('ui', 'remotecmd',
937 coreconfigitem('ui', 'remotecmd',
938 default='hg',
938 default='hg',
939 )
939 )
940 coreconfigitem('ui', 'report_untrusted',
940 coreconfigitem('ui', 'report_untrusted',
941 default=True,
941 default=True,
942 )
942 )
943 coreconfigitem('ui', 'rollback',
943 coreconfigitem('ui', 'rollback',
944 default=True,
944 default=True,
945 )
945 )
946 coreconfigitem('ui', 'slash',
946 coreconfigitem('ui', 'slash',
947 default=False,
947 default=False,
948 )
948 )
949 coreconfigitem('ui', 'ssh',
949 coreconfigitem('ui', 'ssh',
950 default='ssh',
950 default='ssh',
951 )
951 )
952 coreconfigitem('ui', 'statuscopies',
952 coreconfigitem('ui', 'statuscopies',
953 default=False,
953 default=False,
954 )
954 )
955 coreconfigitem('ui', 'strict',
955 coreconfigitem('ui', 'strict',
956 default=False,
956 default=False,
957 )
957 )
958 coreconfigitem('ui', 'style',
958 coreconfigitem('ui', 'style',
959 default='',
959 default='',
960 )
960 )
961 coreconfigitem('ui', 'supportcontact',
961 coreconfigitem('ui', 'supportcontact',
962 default=None,
962 default=None,
963 )
963 )
964 coreconfigitem('ui', 'textwidth',
964 coreconfigitem('ui', 'textwidth',
965 default=78,
965 default=78,
966 )
966 )
967 coreconfigitem('ui', 'timeout',
967 coreconfigitem('ui', 'timeout',
968 default='600',
968 default='600',
969 )
969 )
970 coreconfigitem('ui', 'traceback',
970 coreconfigitem('ui', 'traceback',
971 default=False,
971 default=False,
972 )
972 )
973 coreconfigitem('ui', 'tweakdefaults',
973 coreconfigitem('ui', 'tweakdefaults',
974 default=False,
974 default=False,
975 )
975 )
976 coreconfigitem('ui', 'usehttp2',
976 coreconfigitem('ui', 'usehttp2',
977 default=False,
977 default=False,
978 )
978 )
979 coreconfigitem('ui', 'username',
979 coreconfigitem('ui', 'username',
980 alias=[('ui', 'user')]
980 alias=[('ui', 'user')]
981 )
981 )
982 coreconfigitem('ui', 'verbose',
982 coreconfigitem('ui', 'verbose',
983 default=False,
983 default=False,
984 )
984 )
985 coreconfigitem('verify', 'skipflags',
985 coreconfigitem('verify', 'skipflags',
986 default=None,
986 default=None,
987 )
987 )
988 coreconfigitem('web', 'allowbz2',
988 coreconfigitem('web', 'allowbz2',
989 default=False,
989 default=False,
990 )
990 )
991 coreconfigitem('web', 'allowgz',
991 coreconfigitem('web', 'allowgz',
992 default=False,
992 default=False,
993 )
993 )
994 coreconfigitem('web', 'allowpull',
994 coreconfigitem('web', 'allowpull',
995 default=True,
995 default=True,
996 )
996 )
997 coreconfigitem('web', 'allow_push',
997 coreconfigitem('web', 'allow_push',
998 default=list,
998 default=list,
999 )
999 )
1000 coreconfigitem('web', 'allowzip',
1000 coreconfigitem('web', 'allowzip',
1001 default=False,
1001 default=False,
1002 )
1002 )
1003 coreconfigitem('web', 'archivesubrepos',
1003 coreconfigitem('web', 'archivesubrepos',
1004 default=False,
1004 default=False,
1005 )
1005 )
1006 coreconfigitem('web', 'cache',
1006 coreconfigitem('web', 'cache',
1007 default=True,
1007 default=True,
1008 )
1008 )
1009 coreconfigitem('web', 'contact',
1009 coreconfigitem('web', 'contact',
1010 default=None,
1010 default=None,
1011 )
1011 )
1012 coreconfigitem('web', 'deny_push',
1012 coreconfigitem('web', 'deny_push',
1013 default=list,
1013 default=list,
1014 )
1014 )
1015 coreconfigitem('web', 'guessmime',
1015 coreconfigitem('web', 'guessmime',
1016 default=False,
1016 default=False,
1017 )
1017 )
1018 coreconfigitem('web', 'hidden',
1018 coreconfigitem('web', 'hidden',
1019 default=False,
1019 default=False,
1020 )
1020 )
1021 coreconfigitem('web', 'labels',
1021 coreconfigitem('web', 'labels',
1022 default=list,
1022 default=list,
1023 )
1023 )
1024 coreconfigitem('web', 'logoimg',
1024 coreconfigitem('web', 'logoimg',
1025 default='hglogo.png',
1025 default='hglogo.png',
1026 )
1026 )
1027 coreconfigitem('web', 'logourl',
1027 coreconfigitem('web', 'logourl',
1028 default='https://mercurial-scm.org/',
1028 default='https://mercurial-scm.org/',
1029 )
1029 )
1030 coreconfigitem('web', 'accesslog',
1030 coreconfigitem('web', 'accesslog',
1031 default='-',
1031 default='-',
1032 )
1032 )
1033 coreconfigitem('web', 'address',
1033 coreconfigitem('web', 'address',
1034 default='',
1034 default='',
1035 )
1035 )
1036 coreconfigitem('web', 'allow_archive',
1036 coreconfigitem('web', 'allow_archive',
1037 default=list,
1037 default=list,
1038 )
1038 )
1039 coreconfigitem('web', 'allow_read',
1039 coreconfigitem('web', 'allow_read',
1040 default=list,
1040 default=list,
1041 )
1041 )
1042 coreconfigitem('web', 'baseurl',
1042 coreconfigitem('web', 'baseurl',
1043 default=None,
1043 default=None,
1044 )
1044 )
1045 coreconfigitem('web', 'cacerts',
1045 coreconfigitem('web', 'cacerts',
1046 default=None,
1046 default=None,
1047 )
1047 )
1048 coreconfigitem('web', 'certificate',
1048 coreconfigitem('web', 'certificate',
1049 default=None,
1049 default=None,
1050 )
1050 )
1051 coreconfigitem('web', 'collapse',
1051 coreconfigitem('web', 'collapse',
1052 default=False,
1052 default=False,
1053 )
1053 )
1054 coreconfigitem('web', 'csp',
1054 coreconfigitem('web', 'csp',
1055 default=None,
1055 default=None,
1056 )
1056 )
1057 coreconfigitem('web', 'deny_read',
1057 coreconfigitem('web', 'deny_read',
1058 default=list,
1058 default=list,
1059 )
1059 )
1060 coreconfigitem('web', 'descend',
1060 coreconfigitem('web', 'descend',
1061 default=True,
1061 default=True,
1062 )
1062 )
1063 coreconfigitem('web', 'description',
1063 coreconfigitem('web', 'description',
1064 default="",
1064 default="",
1065 )
1065 )
1066 coreconfigitem('web', 'encoding',
1066 coreconfigitem('web', 'encoding',
1067 default=lambda: encoding.encoding,
1067 default=lambda: encoding.encoding,
1068 )
1068 )
1069 coreconfigitem('web', 'errorlog',
1069 coreconfigitem('web', 'errorlog',
1070 default='-',
1070 default='-',
1071 )
1071 )
1072 coreconfigitem('web', 'ipv6',
1072 coreconfigitem('web', 'ipv6',
1073 default=False,
1073 default=False,
1074 )
1074 )
1075 coreconfigitem('web', 'maxchanges',
1075 coreconfigitem('web', 'maxchanges',
1076 default=10,
1076 default=10,
1077 )
1077 )
1078 coreconfigitem('web', 'maxfiles',
1078 coreconfigitem('web', 'maxfiles',
1079 default=10,
1079 default=10,
1080 )
1080 )
1081 coreconfigitem('web', 'maxshortchanges',
1081 coreconfigitem('web', 'maxshortchanges',
1082 default=60,
1082 default=60,
1083 )
1083 )
1084 coreconfigitem('web', 'motd',
1084 coreconfigitem('web', 'motd',
1085 default='',
1085 default='',
1086 )
1086 )
1087 coreconfigitem('web', 'name',
1087 coreconfigitem('web', 'name',
1088 default=dynamicdefault,
1088 default=dynamicdefault,
1089 )
1089 )
1090 coreconfigitem('web', 'port',
1090 coreconfigitem('web', 'port',
1091 default=8000,
1091 default=8000,
1092 )
1092 )
1093 coreconfigitem('web', 'prefix',
1093 coreconfigitem('web', 'prefix',
1094 default='',
1094 default='',
1095 )
1095 )
1096 coreconfigitem('web', 'push_ssl',
1096 coreconfigitem('web', 'push_ssl',
1097 default=True,
1097 default=True,
1098 )
1098 )
1099 coreconfigitem('web', 'refreshinterval',
1099 coreconfigitem('web', 'refreshinterval',
1100 default=20,
1100 default=20,
1101 )
1101 )
1102 coreconfigitem('web', 'staticurl',
1102 coreconfigitem('web', 'staticurl',
1103 default=None,
1103 default=None,
1104 )
1104 )
1105 coreconfigitem('web', 'stripes',
1105 coreconfigitem('web', 'stripes',
1106 default=1,
1106 default=1,
1107 )
1107 )
1108 coreconfigitem('web', 'style',
1108 coreconfigitem('web', 'style',
1109 default='paper',
1109 default='paper',
1110 )
1110 )
1111 coreconfigitem('web', 'templates',
1111 coreconfigitem('web', 'templates',
1112 default=None,
1112 default=None,
1113 )
1113 )
1114 coreconfigitem('web', 'view',
1114 coreconfigitem('web', 'view',
1115 default='served',
1115 default='served',
1116 )
1116 )
1117 coreconfigitem('worker', 'backgroundclose',
1117 coreconfigitem('worker', 'backgroundclose',
1118 default=dynamicdefault,
1118 default=dynamicdefault,
1119 )
1119 )
1120 # Windows defaults to a limit of 512 open files. A buffer of 128
1120 # Windows defaults to a limit of 512 open files. A buffer of 128
1121 # should give us enough headway.
1121 # should give us enough headway.
1122 coreconfigitem('worker', 'backgroundclosemaxqueue',
1122 coreconfigitem('worker', 'backgroundclosemaxqueue',
1123 default=384,
1123 default=384,
1124 )
1124 )
1125 coreconfigitem('worker', 'backgroundcloseminfilecount',
1125 coreconfigitem('worker', 'backgroundcloseminfilecount',
1126 default=2048,
1126 default=2048,
1127 )
1127 )
1128 coreconfigitem('worker', 'backgroundclosethreadcount',
1128 coreconfigitem('worker', 'backgroundclosethreadcount',
1129 default=4,
1129 default=4,
1130 )
1130 )
1131 coreconfigitem('worker', 'numcpus',
1131 coreconfigitem('worker', 'numcpus',
1132 default=None,
1132 default=None,
1133 )
1133 )
1134
1134
1135 # Rebase related configuration moved to core because other extension are doing
1135 # Rebase related configuration moved to core because other extension are doing
1136 # strange things. For example, shelve import the extensions to reuse some bit
1136 # strange things. For example, shelve import the extensions to reuse some bit
1137 # without formally loading it.
1137 # without formally loading it.
1138 coreconfigitem('commands', 'rebase.requiredest',
1138 coreconfigitem('commands', 'rebase.requiredest',
1139 default=False,
1139 default=False,
1140 )
1140 )
1141 coreconfigitem('experimental', 'rebaseskipobsolete',
1141 coreconfigitem('experimental', 'rebaseskipobsolete',
1142 default=True,
1142 default=True,
1143 )
1143 )
1144 coreconfigitem('rebase', 'singletransaction',
1144 coreconfigitem('rebase', 'singletransaction',
1145 default=False,
1145 default=False,
1146 )
1146 )
@@ -1,248 +1,237 b''
1 $ hg init
1 $ hg init
2
2
3 audit of .hg
3 audit of .hg
4
4
5 $ hg add .hg/00changelog.i
5 $ hg add .hg/00changelog.i
6 abort: path contains illegal component: .hg/00changelog.i (glob)
6 abort: path contains illegal component: .hg/00changelog.i (glob)
7 [255]
7 [255]
8
8
9 #if symlink
9 #if symlink
10
10
11 Symlinks
11 Symlinks
12
12
13 $ mkdir a
13 $ mkdir a
14 $ echo a > a/a
14 $ echo a > a/a
15 $ hg ci -Ama
15 $ hg ci -Ama
16 adding a/a
16 adding a/a
17 $ ln -s a b
17 $ ln -s a b
18 $ echo b > a/b
18 $ echo b > a/b
19 $ hg add b/b
19 $ hg add b/b
20 abort: path 'b/b' traverses symbolic link 'b' (glob)
20 abort: path 'b/b' traverses symbolic link 'b' (glob)
21 [255]
21 [255]
22 $ hg add b
22 $ hg add b
23
23
24 should still fail - maybe
24 should still fail - maybe
25
25
26 $ hg add b/b
26 $ hg add b/b
27 abort: path 'b/b' traverses symbolic link 'b' (glob)
27 abort: path 'b/b' traverses symbolic link 'b' (glob)
28 [255]
28 [255]
29
29
30 $ hg commit -m 'add symlink b'
30 $ hg commit -m 'add symlink b'
31
31
32
32
33 Test symlink traversing when accessing history:
33 Test symlink traversing when accessing history:
34 -----------------------------------------------
34 -----------------------------------------------
35
35
36 (build a changeset where the path exists as a directory)
36 (build a changeset where the path exists as a directory)
37
37
38 $ hg up 0
38 $ hg up 0
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
40 $ mkdir b
40 $ mkdir b
41 $ echo c > b/a
41 $ echo c > b/a
42 $ hg add b/a
42 $ hg add b/a
43 $ hg ci -m 'add directory b'
43 $ hg ci -m 'add directory b'
44 created new head
44 created new head
45
45
46 Test that hg cat does not do anything wrong the working copy has 'b' as directory
46 Test that hg cat does not do anything wrong the working copy has 'b' as directory
47
47
48 $ hg cat b/a
48 $ hg cat b/a
49 c
49 c
50 $ hg cat -r "desc(directory)" b/a
50 $ hg cat -r "desc(directory)" b/a
51 c
51 c
52 $ hg cat -r "desc(symlink)" b/a
52 $ hg cat -r "desc(symlink)" b/a
53 b/a: no such file in rev bc151a1f53bd
53 b/a: no such file in rev bc151a1f53bd
54 [1]
54 [1]
55
55
56 Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749)
56 Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749)
57
57
58 $ hg up 'desc(symlink)'
58 $ hg up 'desc(symlink)'
59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
60 $ hg cat b/a
60 $ hg cat b/a
61 b/a: no such file in rev bc151a1f53bd
61 b/a: no such file in rev bc151a1f53bd
62 [1]
62 [1]
63 $ hg cat -r "desc(directory)" b/a
63 $ hg cat -r "desc(directory)" b/a
64 c
64 c
65 $ hg cat -r "desc(symlink)" b/a
65 $ hg cat -r "desc(symlink)" b/a
66 b/a: no such file in rev bc151a1f53bd
66 b/a: no such file in rev bc151a1f53bd
67 [1]
67 [1]
68
68
69 #endif
69 #endif
70
70
71
71
72 unbundle tampered bundle
72 unbundle tampered bundle
73
73
74 $ hg init target
74 $ hg init target
75 $ cd target
75 $ cd target
76 $ hg unbundle "$TESTDIR/bundles/tampered.hg"
76 $ hg unbundle "$TESTDIR/bundles/tampered.hg"
77 adding changesets
77 adding changesets
78 adding manifests
78 adding manifests
79 adding file changes
79 adding file changes
80 added 5 changesets with 6 changes to 6 files (+4 heads)
80 added 5 changesets with 6 changes to 6 files (+4 heads)
81 new changesets b7da9bf6b037:fc1393d727bc
81 new changesets b7da9bf6b037:fc1393d727bc
82 (run 'hg heads' to see heads, 'hg merge' to merge)
82 (run 'hg heads' to see heads, 'hg merge' to merge)
83
83
84 attack .hg/test
84 attack .hg/test
85
85
86 $ hg manifest -r0
86 $ hg manifest -r0
87 .hg/test
87 .hg/test
88 $ hg update -Cr0
88 $ hg update -Cr0
89 abort: path contains illegal component: .hg/test (glob)
89 abort: path contains illegal component: .hg/test (glob)
90 [255]
90 [255]
91
91
92 attack foo/.hg/test
92 attack foo/.hg/test
93
93
94 $ hg manifest -r1
94 $ hg manifest -r1
95 foo/.hg/test
95 foo/.hg/test
96 $ hg update -Cr1
96 $ hg update -Cr1
97 abort: path 'foo/.hg/test' is inside nested repo 'foo' (glob)
97 abort: path 'foo/.hg/test' is inside nested repo 'foo' (glob)
98 [255]
98 [255]
99
99
100 attack back/test where back symlinks to ..
100 attack back/test where back symlinks to ..
101
101
102 $ hg manifest -r2
102 $ hg manifest -r2
103 back
103 back
104 back/test
104 back/test
105 #if symlink
105 #if symlink
106 $ hg update -Cr2
106 $ hg update -Cr2
107 back: is both a file and a directory
107 abort: path 'back/test' traverses symbolic link 'back'
108 abort: destination manifest contains path conflicts
109 [255]
108 [255]
110 #else
109 #else
111 ('back' will be a file and cause some other system specific error)
110 ('back' will be a file and cause some other system specific error)
112 $ hg update -Cr2
111 $ hg update -Cr2
113 back: is both a file and a directory
112 back: is both a file and a directory
114 abort: * (glob)
113 abort: * (glob)
115 [255]
114 [255]
116 #endif
115 #endif
117
116
118 attack ../test
117 attack ../test
119
118
120 $ hg manifest -r3
119 $ hg manifest -r3
121 ../test
120 ../test
122 $ mkdir ../test
121 $ mkdir ../test
123 $ echo data > ../test/file
122 $ echo data > ../test/file
124 $ hg update -Cr3
123 $ hg update -Cr3
125 abort: path contains illegal component: ../test (glob)
124 abort: path contains illegal component: ../test (glob)
126 [255]
125 [255]
127 $ cat ../test/file
126 $ cat ../test/file
128 data
127 data
129
128
130 attack /tmp/test
129 attack /tmp/test
131
130
132 $ hg manifest -r4
131 $ hg manifest -r4
133 /tmp/test
132 /tmp/test
134 $ hg update -Cr4
133 $ hg update -Cr4
135 abort: path contains illegal component: /tmp/test (glob)
134 abort: path contains illegal component: /tmp/test (glob)
136 [255]
135 [255]
137
136
138 $ cd ..
137 $ cd ..
139
138
140 Test symlink traversal on merge:
139 Test symlink traversal on merge:
141 --------------------------------
140 --------------------------------
142
141
143 #if symlink
142 #if symlink
144
143
145 set up symlink hell
144 set up symlink hell
146
145
147 $ mkdir merge-symlink-out
146 $ mkdir merge-symlink-out
148 $ hg init merge-symlink
147 $ hg init merge-symlink
149 $ cd merge-symlink
148 $ cd merge-symlink
150 $ touch base
149 $ touch base
151 $ hg commit -qAm base
150 $ hg commit -qAm base
152 $ ln -s ../merge-symlink-out a
151 $ ln -s ../merge-symlink-out a
153 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
152 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
154 $ hg up -q 0
153 $ hg up -q 0
155 $ mkdir a
154 $ mkdir a
156 $ touch a/poisoned
155 $ touch a/poisoned
157 $ hg commit -qAm 'file a/poisoned'
156 $ hg commit -qAm 'file a/poisoned'
158 $ hg log -G -T '{rev}: {desc}\n'
157 $ hg log -G -T '{rev}: {desc}\n'
159 @ 2: file a/poisoned
158 @ 2: file a/poisoned
160 |
159 |
161 | o 1: symlink a -> ../merge-symlink-out
160 | o 1: symlink a -> ../merge-symlink-out
162 |/
161 |/
163 o 0: base
162 o 0: base
164
163
165
164
166 try trivial merge
165 try trivial merge
167
166
168 $ hg up -qC 1
167 $ hg up -qC 1
169 $ hg merge 2
168 $ hg merge 2
170 a: path conflict - a file or link has the same name as a directory
169 abort: path 'a/poisoned' traverses symbolic link 'a'
171 the local file has been renamed to a~aa04623eb0c3
170 [255]
172 resolve manually then use 'hg resolve --mark a'
173 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
174 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
175 [1]
176
171
177 try rebase onto other revision: cache of audited paths should be discarded,
172 try rebase onto other revision: cache of audited paths should be discarded,
178 and the rebase should fail (issue5628)
173 and the rebase should fail (issue5628)
179
174
180 $ hg up -qC 2
175 $ hg up -qC 2
181 $ hg rebase -s 2 -d 1 --config extensions.rebase=
176 $ hg rebase -s 2 -d 1 --config extensions.rebase=
182 rebasing 2:e73c21d6b244 "file a/poisoned" (tip)
177 rebasing 2:e73c21d6b244 "file a/poisoned" (tip)
183 a: path conflict - a file or link has the same name as a directory
178 abort: path 'a/poisoned' traverses symbolic link 'a'
184 the local file has been renamed to a~aa04623eb0c3
179 [255]
185 resolve manually then use 'hg resolve --mark a'
186 unresolved conflicts (see hg resolve, then hg rebase --continue)
187 [1]
188 $ ls ../merge-symlink-out
180 $ ls ../merge-symlink-out
189
181
190 $ cd ..
182 $ cd ..
191
183
192 Test symlink traversal on update:
184 Test symlink traversal on update:
193 ---------------------------------
185 ---------------------------------
194
186
195 $ mkdir update-symlink-out
187 $ mkdir update-symlink-out
196 $ hg init update-symlink
188 $ hg init update-symlink
197 $ cd update-symlink
189 $ cd update-symlink
198 $ ln -s ../update-symlink-out a
190 $ ln -s ../update-symlink-out a
199 $ hg commit -qAm 'symlink a -> ../update-symlink-out'
191 $ hg commit -qAm 'symlink a -> ../update-symlink-out'
200 $ hg rm a
192 $ hg rm a
201 $ mkdir a && touch a/b
193 $ mkdir a && touch a/b
202 $ hg ci -qAm 'file a/b' a/b
194 $ hg ci -qAm 'file a/b' a/b
203 $ hg up -qC 0
195 $ hg up -qC 0
204 $ hg rm a
196 $ hg rm a
205 $ mkdir a && touch a/c
197 $ mkdir a && touch a/c
206 $ hg ci -qAm 'rm a, file a/c'
198 $ hg ci -qAm 'rm a, file a/c'
207 $ hg log -G -T '{rev}: {desc}\n'
199 $ hg log -G -T '{rev}: {desc}\n'
208 @ 2: rm a, file a/c
200 @ 2: rm a, file a/c
209 |
201 |
210 | o 1: file a/b
202 | o 1: file a/b
211 |/
203 |/
212 o 0: symlink a -> ../update-symlink-out
204 o 0: symlink a -> ../update-symlink-out
213
205
214
206
215 try linear update where symlink already exists:
207 try linear update where symlink already exists:
216
208
217 $ hg up -qC 0
209 $ hg up -qC 0
218 $ hg up 1
210 $ hg up 1
219 a: is both a file and a directory
211 abort: path 'a/b' traverses symbolic link 'a'
220 abort: destination manifest contains path conflicts
221 [255]
212 [255]
222
213
223 try linear update including symlinked directory and its content: paths are
214 try linear update including symlinked directory and its content: paths are
224 audited first by calculateupdates(), where no symlink is created so both
215 audited first by calculateupdates(), where no symlink is created so both
225 'a' and 'a/b' are taken as good paths. still applyupdates() should fail.
216 'a' and 'a/b' are taken as good paths. still applyupdates() should fail.
226
217
227 $ hg up -qC null
218 $ hg up -qC null
228 $ hg up 1
219 $ hg up 1
229 a: is both a file and a directory
220 abort: path 'a/b' traverses symbolic link 'a'
230 abort: destination manifest contains path conflicts
231 [255]
221 [255]
232 $ ls ../update-symlink-out
222 $ ls ../update-symlink-out
233
223
234 try branch update replacing directory with symlink, and its content: the
224 try branch update replacing directory with symlink, and its content: the
235 path 'a' is audited as a directory first, which should be audited again as
225 path 'a' is audited as a directory first, which should be audited again as
236 a symlink.
226 a symlink.
237
227
238 $ rm -f a
228 $ rm -f a
239 $ hg up -qC 2
229 $ hg up -qC 2
240 $ hg up 1
230 $ hg up 1
241 a: is both a file and a directory
231 abort: path 'a/b' traverses symbolic link 'a'
242 abort: destination manifest contains path conflicts
243 [255]
232 [255]
244 $ ls ../update-symlink-out
233 $ ls ../update-symlink-out
245
234
246 $ cd ..
235 $ cd ..
247
236
248 #endif
237 #endif
@@ -1,1013 +1,1009 b''
1 #if windows
1 #if windows
2 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
2 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
3 #else
3 #else
4 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
4 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
5 #endif
5 #endif
6 $ export PYTHONPATH
6 $ export PYTHONPATH
7
7
8 typical client does not want echo-back messages, so test without it:
8 typical client does not want echo-back messages, so test without it:
9
9
10 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
10 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
11 $ mv $HGRCPATH.new $HGRCPATH
11 $ mv $HGRCPATH.new $HGRCPATH
12
12
13 $ hg init repo
13 $ hg init repo
14 $ cd repo
14 $ cd repo
15
15
16 >>> from __future__ import absolute_import, print_function
16 >>> from __future__ import absolute_import, print_function
17 >>> import os
17 >>> import os
18 >>> import sys
18 >>> import sys
19 >>> from hgclient import check, readchannel, runcommand
19 >>> from hgclient import check, readchannel, runcommand
20 >>> @check
20 >>> @check
21 ... def hellomessage(server):
21 ... def hellomessage(server):
22 ... ch, data = readchannel(server)
22 ... ch, data = readchannel(server)
23 ... print('%c, %r' % (ch, data))
23 ... print('%c, %r' % (ch, data))
24 ... # run an arbitrary command to make sure the next thing the server
24 ... # run an arbitrary command to make sure the next thing the server
25 ... # sends isn't part of the hello message
25 ... # sends isn't part of the hello message
26 ... runcommand(server, ['id'])
26 ... runcommand(server, ['id'])
27 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
27 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
28 *** runcommand id
28 *** runcommand id
29 000000000000 tip
29 000000000000 tip
30
30
31 >>> from hgclient import check
31 >>> from hgclient import check
32 >>> @check
32 >>> @check
33 ... def unknowncommand(server):
33 ... def unknowncommand(server):
34 ... server.stdin.write('unknowncommand\n')
34 ... server.stdin.write('unknowncommand\n')
35 abort: unknown command unknowncommand
35 abort: unknown command unknowncommand
36
36
37 >>> from hgclient import check, readchannel, runcommand
37 >>> from hgclient import check, readchannel, runcommand
38 >>> @check
38 >>> @check
39 ... def checkruncommand(server):
39 ... def checkruncommand(server):
40 ... # hello block
40 ... # hello block
41 ... readchannel(server)
41 ... readchannel(server)
42 ...
42 ...
43 ... # no args
43 ... # no args
44 ... runcommand(server, [])
44 ... runcommand(server, [])
45 ...
45 ...
46 ... # global options
46 ... # global options
47 ... runcommand(server, ['id', '--quiet'])
47 ... runcommand(server, ['id', '--quiet'])
48 ...
48 ...
49 ... # make sure global options don't stick through requests
49 ... # make sure global options don't stick through requests
50 ... runcommand(server, ['id'])
50 ... runcommand(server, ['id'])
51 ...
51 ...
52 ... # --config
52 ... # --config
53 ... runcommand(server, ['id', '--config', 'ui.quiet=True'])
53 ... runcommand(server, ['id', '--config', 'ui.quiet=True'])
54 ...
54 ...
55 ... # make sure --config doesn't stick
55 ... # make sure --config doesn't stick
56 ... runcommand(server, ['id'])
56 ... runcommand(server, ['id'])
57 ...
57 ...
58 ... # negative return code should be masked
58 ... # negative return code should be masked
59 ... runcommand(server, ['id', '-runknown'])
59 ... runcommand(server, ['id', '-runknown'])
60 *** runcommand
60 *** runcommand
61 Mercurial Distributed SCM
61 Mercurial Distributed SCM
62
62
63 basic commands:
63 basic commands:
64
64
65 add add the specified files on the next commit
65 add add the specified files on the next commit
66 annotate show changeset information by line for each file
66 annotate show changeset information by line for each file
67 clone make a copy of an existing repository
67 clone make a copy of an existing repository
68 commit commit the specified files or all outstanding changes
68 commit commit the specified files or all outstanding changes
69 diff diff repository (or selected files)
69 diff diff repository (or selected files)
70 export dump the header and diffs for one or more changesets
70 export dump the header and diffs for one or more changesets
71 forget forget the specified files on the next commit
71 forget forget the specified files on the next commit
72 init create a new repository in the given directory
72 init create a new repository in the given directory
73 log show revision history of entire repository or files
73 log show revision history of entire repository or files
74 merge merge another revision into working directory
74 merge merge another revision into working directory
75 pull pull changes from the specified source
75 pull pull changes from the specified source
76 push push changes to the specified destination
76 push push changes to the specified destination
77 remove remove the specified files on the next commit
77 remove remove the specified files on the next commit
78 serve start stand-alone webserver
78 serve start stand-alone webserver
79 status show changed files in the working directory
79 status show changed files in the working directory
80 summary summarize working directory state
80 summary summarize working directory state
81 update update working directory (or switch revisions)
81 update update working directory (or switch revisions)
82
82
83 (use 'hg help' for the full list of commands or 'hg -v' for details)
83 (use 'hg help' for the full list of commands or 'hg -v' for details)
84 *** runcommand id --quiet
84 *** runcommand id --quiet
85 000000000000
85 000000000000
86 *** runcommand id
86 *** runcommand id
87 000000000000 tip
87 000000000000 tip
88 *** runcommand id --config ui.quiet=True
88 *** runcommand id --config ui.quiet=True
89 000000000000
89 000000000000
90 *** runcommand id
90 *** runcommand id
91 000000000000 tip
91 000000000000 tip
92 *** runcommand id -runknown
92 *** runcommand id -runknown
93 abort: unknown revision 'unknown'!
93 abort: unknown revision 'unknown'!
94 [255]
94 [255]
95
95
96 >>> from hgclient import check, readchannel
96 >>> from hgclient import check, readchannel
97 >>> @check
97 >>> @check
98 ... def inputeof(server):
98 ... def inputeof(server):
99 ... readchannel(server)
99 ... readchannel(server)
100 ... server.stdin.write('runcommand\n')
100 ... server.stdin.write('runcommand\n')
101 ... # close stdin while server is waiting for input
101 ... # close stdin while server is waiting for input
102 ... server.stdin.close()
102 ... server.stdin.close()
103 ...
103 ...
104 ... # server exits with 1 if the pipe closed while reading the command
104 ... # server exits with 1 if the pipe closed while reading the command
105 ... print('server exit code =', server.wait())
105 ... print('server exit code =', server.wait())
106 server exit code = 1
106 server exit code = 1
107
107
108 >>> from hgclient import check, readchannel, runcommand, stringio
108 >>> from hgclient import check, readchannel, runcommand, stringio
109 >>> @check
109 >>> @check
110 ... def serverinput(server):
110 ... def serverinput(server):
111 ... readchannel(server)
111 ... readchannel(server)
112 ...
112 ...
113 ... patch = """
113 ... patch = """
114 ... # HG changeset patch
114 ... # HG changeset patch
115 ... # User test
115 ... # User test
116 ... # Date 0 0
116 ... # Date 0 0
117 ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
117 ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
118 ... # Parent 0000000000000000000000000000000000000000
118 ... # Parent 0000000000000000000000000000000000000000
119 ... 1
119 ... 1
120 ...
120 ...
121 ... diff -r 000000000000 -r c103a3dec114 a
121 ... diff -r 000000000000 -r c103a3dec114 a
122 ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000
122 ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000
123 ... +++ b/a Thu Jan 01 00:00:00 1970 +0000
123 ... +++ b/a Thu Jan 01 00:00:00 1970 +0000
124 ... @@ -0,0 +1,1 @@
124 ... @@ -0,0 +1,1 @@
125 ... +1
125 ... +1
126 ... """
126 ... """
127 ...
127 ...
128 ... runcommand(server, ['import', '-'], input=stringio(patch))
128 ... runcommand(server, ['import', '-'], input=stringio(patch))
129 ... runcommand(server, ['log'])
129 ... runcommand(server, ['log'])
130 *** runcommand import -
130 *** runcommand import -
131 applying patch from stdin
131 applying patch from stdin
132 *** runcommand log
132 *** runcommand log
133 changeset: 0:eff892de26ec
133 changeset: 0:eff892de26ec
134 tag: tip
134 tag: tip
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: 1
137 summary: 1
138
138
139
139
140 check that "histedit --commands=-" can read rules from the input channel:
140 check that "histedit --commands=-" can read rules from the input channel:
141
141
142 >>> import cStringIO
142 >>> import cStringIO
143 >>> from hgclient import check, readchannel, runcommand
143 >>> from hgclient import check, readchannel, runcommand
144 >>> @check
144 >>> @check
145 ... def serverinput(server):
145 ... def serverinput(server):
146 ... readchannel(server)
146 ... readchannel(server)
147 ... rules = 'pick eff892de26ec\n'
147 ... rules = 'pick eff892de26ec\n'
148 ... runcommand(server, ['histedit', '0', '--commands=-',
148 ... runcommand(server, ['histedit', '0', '--commands=-',
149 ... '--config', 'extensions.histedit='],
149 ... '--config', 'extensions.histedit='],
150 ... input=cStringIO.StringIO(rules))
150 ... input=cStringIO.StringIO(rules))
151 *** runcommand histedit 0 --commands=- --config extensions.histedit=
151 *** runcommand histedit 0 --commands=- --config extensions.histedit=
152
152
153 check that --cwd doesn't persist between requests:
153 check that --cwd doesn't persist between requests:
154
154
155 $ mkdir foo
155 $ mkdir foo
156 $ touch foo/bar
156 $ touch foo/bar
157 >>> from hgclient import check, readchannel, runcommand
157 >>> from hgclient import check, readchannel, runcommand
158 >>> @check
158 >>> @check
159 ... def cwd(server):
159 ... def cwd(server):
160 ... readchannel(server)
160 ... readchannel(server)
161 ... runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
161 ... runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
162 ... runcommand(server, ['st', 'foo/bar'])
162 ... runcommand(server, ['st', 'foo/bar'])
163 *** runcommand --cwd foo st bar
163 *** runcommand --cwd foo st bar
164 ? bar
164 ? bar
165 *** runcommand st foo/bar
165 *** runcommand st foo/bar
166 ? foo/bar
166 ? foo/bar
167
167
168 $ rm foo/bar
168 $ rm foo/bar
169
169
170
170
171 check that local configs for the cached repo aren't inherited when -R is used:
171 check that local configs for the cached repo aren't inherited when -R is used:
172
172
173 $ cat <<EOF >> .hg/hgrc
173 $ cat <<EOF >> .hg/hgrc
174 > [ui]
174 > [ui]
175 > foo = bar
175 > foo = bar
176 > EOF
176 > EOF
177
177
178 >>> from hgclient import check, readchannel, runcommand, sep
178 >>> from hgclient import check, readchannel, runcommand, sep
179 >>> @check
179 >>> @check
180 ... def localhgrc(server):
180 ... def localhgrc(server):
181 ... readchannel(server)
181 ... readchannel(server)
182 ...
182 ...
183 ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should
183 ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should
184 ... # show it
184 ... # show it
185 ... runcommand(server, ['showconfig'], outfilter=sep)
185 ... runcommand(server, ['showconfig'], outfilter=sep)
186 ...
186 ...
187 ... # but not for this repo
187 ... # but not for this repo
188 ... runcommand(server, ['init', 'foo'])
188 ... runcommand(server, ['init', 'foo'])
189 ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
189 ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
190 *** runcommand showconfig
190 *** runcommand showconfig
191 bundle.mainreporoot=$TESTTMP/repo
191 bundle.mainreporoot=$TESTTMP/repo
192 devel.all-warnings=true
192 devel.all-warnings=true
193 devel.default-date=0 0
193 devel.default-date=0 0
194 extensions.fsmonitor= (fsmonitor !)
194 extensions.fsmonitor= (fsmonitor !)
195 largefiles.usercache=$TESTTMP/.cache/largefiles
195 largefiles.usercache=$TESTTMP/.cache/largefiles
196 ui.slash=True
196 ui.slash=True
197 ui.interactive=False
197 ui.interactive=False
198 ui.mergemarkers=detailed
198 ui.mergemarkers=detailed
199 ui.usehttp2=true (?)
199 ui.usehttp2=true (?)
200 ui.foo=bar
200 ui.foo=bar
201 ui.nontty=true
201 ui.nontty=true
202 web.address=localhost
202 web.address=localhost
203 web\.ipv6=(?:True|False) (re)
203 web\.ipv6=(?:True|False) (re)
204 *** runcommand init foo
204 *** runcommand init foo
205 *** runcommand -R foo showconfig ui defaults
205 *** runcommand -R foo showconfig ui defaults
206 ui.slash=True
206 ui.slash=True
207 ui.interactive=False
207 ui.interactive=False
208 ui.mergemarkers=detailed
208 ui.mergemarkers=detailed
209 ui.usehttp2=true (?)
209 ui.usehttp2=true (?)
210 ui.nontty=true
210 ui.nontty=true
211
211
212 $ rm -R foo
212 $ rm -R foo
213
213
214 #if windows
214 #if windows
215 $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
215 $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
216 #else
216 #else
217 $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
217 $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
218 #endif
218 #endif
219
219
220 $ cat <<EOF > hook.py
220 $ cat <<EOF > hook.py
221 > from __future__ import print_function
221 > from __future__ import print_function
222 > import sys
222 > import sys
223 > def hook(**args):
223 > def hook(**args):
224 > print('hook talking')
224 > print('hook talking')
225 > print('now try to read something: %r' % sys.stdin.read())
225 > print('now try to read something: %r' % sys.stdin.read())
226 > EOF
226 > EOF
227
227
228 >>> from hgclient import check, readchannel, runcommand, stringio
228 >>> from hgclient import check, readchannel, runcommand, stringio
229 >>> @check
229 >>> @check
230 ... def hookoutput(server):
230 ... def hookoutput(server):
231 ... readchannel(server)
231 ... readchannel(server)
232 ... runcommand(server, ['--config',
232 ... runcommand(server, ['--config',
233 ... 'hooks.pre-identify=python:hook.hook',
233 ... 'hooks.pre-identify=python:hook.hook',
234 ... 'id'],
234 ... 'id'],
235 ... input=stringio('some input'))
235 ... input=stringio('some input'))
236 *** runcommand --config hooks.pre-identify=python:hook.hook id
236 *** runcommand --config hooks.pre-identify=python:hook.hook id
237 eff892de26ec tip
237 eff892de26ec tip
238
238
239 Clean hook cached version
239 Clean hook cached version
240 $ rm hook.py*
240 $ rm hook.py*
241 $ rm -Rf __pycache__
241 $ rm -Rf __pycache__
242
242
243 $ echo a >> a
243 $ echo a >> a
244 >>> import os
244 >>> import os
245 >>> from hgclient import check, readchannel, runcommand
245 >>> from hgclient import check, readchannel, runcommand
246 >>> @check
246 >>> @check
247 ... def outsidechanges(server):
247 ... def outsidechanges(server):
248 ... readchannel(server)
248 ... readchannel(server)
249 ... runcommand(server, ['status'])
249 ... runcommand(server, ['status'])
250 ... os.system('hg ci -Am2')
250 ... os.system('hg ci -Am2')
251 ... runcommand(server, ['tip'])
251 ... runcommand(server, ['tip'])
252 ... runcommand(server, ['status'])
252 ... runcommand(server, ['status'])
253 *** runcommand status
253 *** runcommand status
254 M a
254 M a
255 *** runcommand tip
255 *** runcommand tip
256 changeset: 1:d3a0a68be6de
256 changeset: 1:d3a0a68be6de
257 tag: tip
257 tag: tip
258 user: test
258 user: test
259 date: Thu Jan 01 00:00:00 1970 +0000
259 date: Thu Jan 01 00:00:00 1970 +0000
260 summary: 2
260 summary: 2
261
261
262 *** runcommand status
262 *** runcommand status
263
263
264 >>> import os
264 >>> import os
265 >>> from hgclient import check, readchannel, runcommand
265 >>> from hgclient import check, readchannel, runcommand
266 >>> @check
266 >>> @check
267 ... def bookmarks(server):
267 ... def bookmarks(server):
268 ... readchannel(server)
268 ... readchannel(server)
269 ... runcommand(server, ['bookmarks'])
269 ... runcommand(server, ['bookmarks'])
270 ...
270 ...
271 ... # changes .hg/bookmarks
271 ... # changes .hg/bookmarks
272 ... os.system('hg bookmark -i bm1')
272 ... os.system('hg bookmark -i bm1')
273 ... os.system('hg bookmark -i bm2')
273 ... os.system('hg bookmark -i bm2')
274 ... runcommand(server, ['bookmarks'])
274 ... runcommand(server, ['bookmarks'])
275 ...
275 ...
276 ... # changes .hg/bookmarks.current
276 ... # changes .hg/bookmarks.current
277 ... os.system('hg upd bm1 -q')
277 ... os.system('hg upd bm1 -q')
278 ... runcommand(server, ['bookmarks'])
278 ... runcommand(server, ['bookmarks'])
279 ...
279 ...
280 ... runcommand(server, ['bookmarks', 'bm3'])
280 ... runcommand(server, ['bookmarks', 'bm3'])
281 ... f = open('a', 'ab')
281 ... f = open('a', 'ab')
282 ... f.write('a\n')
282 ... f.write('a\n')
283 ... f.close()
283 ... f.close()
284 ... runcommand(server, ['commit', '-Amm'])
284 ... runcommand(server, ['commit', '-Amm'])
285 ... runcommand(server, ['bookmarks'])
285 ... runcommand(server, ['bookmarks'])
286 ... print('')
286 ... print('')
287 *** runcommand bookmarks
287 *** runcommand bookmarks
288 no bookmarks set
288 no bookmarks set
289 *** runcommand bookmarks
289 *** runcommand bookmarks
290 bm1 1:d3a0a68be6de
290 bm1 1:d3a0a68be6de
291 bm2 1:d3a0a68be6de
291 bm2 1:d3a0a68be6de
292 *** runcommand bookmarks
292 *** runcommand bookmarks
293 * bm1 1:d3a0a68be6de
293 * bm1 1:d3a0a68be6de
294 bm2 1:d3a0a68be6de
294 bm2 1:d3a0a68be6de
295 *** runcommand bookmarks bm3
295 *** runcommand bookmarks bm3
296 *** runcommand commit -Amm
296 *** runcommand commit -Amm
297 *** runcommand bookmarks
297 *** runcommand bookmarks
298 bm1 1:d3a0a68be6de
298 bm1 1:d3a0a68be6de
299 bm2 1:d3a0a68be6de
299 bm2 1:d3a0a68be6de
300 * bm3 2:aef17e88f5f0
300 * bm3 2:aef17e88f5f0
301
301
302
302
303 >>> import os
303 >>> import os
304 >>> from hgclient import check, readchannel, runcommand
304 >>> from hgclient import check, readchannel, runcommand
305 >>> @check
305 >>> @check
306 ... def tagscache(server):
306 ... def tagscache(server):
307 ... readchannel(server)
307 ... readchannel(server)
308 ... runcommand(server, ['id', '-t', '-r', '0'])
308 ... runcommand(server, ['id', '-t', '-r', '0'])
309 ... os.system('hg tag -r 0 foo')
309 ... os.system('hg tag -r 0 foo')
310 ... runcommand(server, ['id', '-t', '-r', '0'])
310 ... runcommand(server, ['id', '-t', '-r', '0'])
311 *** runcommand id -t -r 0
311 *** runcommand id -t -r 0
312
312
313 *** runcommand id -t -r 0
313 *** runcommand id -t -r 0
314 foo
314 foo
315
315
316 >>> import os
316 >>> import os
317 >>> from hgclient import check, readchannel, runcommand
317 >>> from hgclient import check, readchannel, runcommand
318 >>> @check
318 >>> @check
319 ... def setphase(server):
319 ... def setphase(server):
320 ... readchannel(server)
320 ... readchannel(server)
321 ... runcommand(server, ['phase', '-r', '.'])
321 ... runcommand(server, ['phase', '-r', '.'])
322 ... os.system('hg phase -r . -p')
322 ... os.system('hg phase -r . -p')
323 ... runcommand(server, ['phase', '-r', '.'])
323 ... runcommand(server, ['phase', '-r', '.'])
324 *** runcommand phase -r .
324 *** runcommand phase -r .
325 3: draft
325 3: draft
326 *** runcommand phase -r .
326 *** runcommand phase -r .
327 3: public
327 3: public
328
328
329 $ echo a >> a
329 $ echo a >> a
330 >>> from hgclient import check, readchannel, runcommand
330 >>> from hgclient import check, readchannel, runcommand
331 >>> @check
331 >>> @check
332 ... def rollback(server):
332 ... def rollback(server):
333 ... readchannel(server)
333 ... readchannel(server)
334 ... runcommand(server, ['phase', '-r', '.', '-p'])
334 ... runcommand(server, ['phase', '-r', '.', '-p'])
335 ... runcommand(server, ['commit', '-Am.'])
335 ... runcommand(server, ['commit', '-Am.'])
336 ... runcommand(server, ['rollback'])
336 ... runcommand(server, ['rollback'])
337 ... runcommand(server, ['phase', '-r', '.'])
337 ... runcommand(server, ['phase', '-r', '.'])
338 ... print('')
338 ... print('')
339 *** runcommand phase -r . -p
339 *** runcommand phase -r . -p
340 no phases changed
340 no phases changed
341 *** runcommand commit -Am.
341 *** runcommand commit -Am.
342 *** runcommand rollback
342 *** runcommand rollback
343 repository tip rolled back to revision 3 (undo commit)
343 repository tip rolled back to revision 3 (undo commit)
344 working directory now based on revision 3
344 working directory now based on revision 3
345 *** runcommand phase -r .
345 *** runcommand phase -r .
346 3: public
346 3: public
347
347
348
348
349 >>> import os
349 >>> import os
350 >>> from hgclient import check, readchannel, runcommand
350 >>> from hgclient import check, readchannel, runcommand
351 >>> @check
351 >>> @check
352 ... def branch(server):
352 ... def branch(server):
353 ... readchannel(server)
353 ... readchannel(server)
354 ... runcommand(server, ['branch'])
354 ... runcommand(server, ['branch'])
355 ... os.system('hg branch foo')
355 ... os.system('hg branch foo')
356 ... runcommand(server, ['branch'])
356 ... runcommand(server, ['branch'])
357 ... os.system('hg branch default')
357 ... os.system('hg branch default')
358 *** runcommand branch
358 *** runcommand branch
359 default
359 default
360 marked working directory as branch foo
360 marked working directory as branch foo
361 (branches are permanent and global, did you want a bookmark?)
361 (branches are permanent and global, did you want a bookmark?)
362 *** runcommand branch
362 *** runcommand branch
363 foo
363 foo
364 marked working directory as branch default
364 marked working directory as branch default
365 (branches are permanent and global, did you want a bookmark?)
365 (branches are permanent and global, did you want a bookmark?)
366
366
367 $ touch .hgignore
367 $ touch .hgignore
368 >>> import os
368 >>> import os
369 >>> from hgclient import check, readchannel, runcommand
369 >>> from hgclient import check, readchannel, runcommand
370 >>> @check
370 >>> @check
371 ... def hgignore(server):
371 ... def hgignore(server):
372 ... readchannel(server)
372 ... readchannel(server)
373 ... runcommand(server, ['commit', '-Am.'])
373 ... runcommand(server, ['commit', '-Am.'])
374 ... f = open('ignored-file', 'ab')
374 ... f = open('ignored-file', 'ab')
375 ... f.write('')
375 ... f.write('')
376 ... f.close()
376 ... f.close()
377 ... f = open('.hgignore', 'ab')
377 ... f = open('.hgignore', 'ab')
378 ... f.write('ignored-file')
378 ... f.write('ignored-file')
379 ... f.close()
379 ... f.close()
380 ... runcommand(server, ['status', '-i', '-u'])
380 ... runcommand(server, ['status', '-i', '-u'])
381 ... print('')
381 ... print('')
382 *** runcommand commit -Am.
382 *** runcommand commit -Am.
383 adding .hgignore
383 adding .hgignore
384 *** runcommand status -i -u
384 *** runcommand status -i -u
385 I ignored-file
385 I ignored-file
386
386
387
387
388 cache of non-public revisions should be invalidated on repository change
388 cache of non-public revisions should be invalidated on repository change
389 (issue4855):
389 (issue4855):
390
390
391 >>> import os
391 >>> import os
392 >>> from hgclient import check, readchannel, runcommand
392 >>> from hgclient import check, readchannel, runcommand
393 >>> @check
393 >>> @check
394 ... def phasesetscacheaftercommit(server):
394 ... def phasesetscacheaftercommit(server):
395 ... readchannel(server)
395 ... readchannel(server)
396 ... # load _phasecache._phaserevs and _phasesets
396 ... # load _phasecache._phaserevs and _phasesets
397 ... runcommand(server, ['log', '-qr', 'draft()'])
397 ... runcommand(server, ['log', '-qr', 'draft()'])
398 ... # create draft commits by another process
398 ... # create draft commits by another process
399 ... for i in xrange(5, 7):
399 ... for i in xrange(5, 7):
400 ... f = open('a', 'ab')
400 ... f = open('a', 'ab')
401 ... f.seek(0, os.SEEK_END)
401 ... f.seek(0, os.SEEK_END)
402 ... f.write('a\n')
402 ... f.write('a\n')
403 ... f.close()
403 ... f.close()
404 ... os.system('hg commit -Aqm%d' % i)
404 ... os.system('hg commit -Aqm%d' % i)
405 ... # new commits should be listed as draft revisions
405 ... # new commits should be listed as draft revisions
406 ... runcommand(server, ['log', '-qr', 'draft()'])
406 ... runcommand(server, ['log', '-qr', 'draft()'])
407 ... print('')
407 ... print('')
408 *** runcommand log -qr draft()
408 *** runcommand log -qr draft()
409 4:7966c8e3734d
409 4:7966c8e3734d
410 *** runcommand log -qr draft()
410 *** runcommand log -qr draft()
411 4:7966c8e3734d
411 4:7966c8e3734d
412 5:41f6602d1c4f
412 5:41f6602d1c4f
413 6:10501e202c35
413 6:10501e202c35
414
414
415
415
416 >>> import os
416 >>> import os
417 >>> from hgclient import check, readchannel, runcommand
417 >>> from hgclient import check, readchannel, runcommand
418 >>> @check
418 >>> @check
419 ... def phasesetscacheafterstrip(server):
419 ... def phasesetscacheafterstrip(server):
420 ... readchannel(server)
420 ... readchannel(server)
421 ... # load _phasecache._phaserevs and _phasesets
421 ... # load _phasecache._phaserevs and _phasesets
422 ... runcommand(server, ['log', '-qr', 'draft()'])
422 ... runcommand(server, ['log', '-qr', 'draft()'])
423 ... # strip cached revisions by another process
423 ... # strip cached revisions by another process
424 ... os.system('hg --config extensions.strip= strip -q 5')
424 ... os.system('hg --config extensions.strip= strip -q 5')
425 ... # shouldn't abort by "unknown revision '6'"
425 ... # shouldn't abort by "unknown revision '6'"
426 ... runcommand(server, ['log', '-qr', 'draft()'])
426 ... runcommand(server, ['log', '-qr', 'draft()'])
427 ... print('')
427 ... print('')
428 *** runcommand log -qr draft()
428 *** runcommand log -qr draft()
429 4:7966c8e3734d
429 4:7966c8e3734d
430 5:41f6602d1c4f
430 5:41f6602d1c4f
431 6:10501e202c35
431 6:10501e202c35
432 *** runcommand log -qr draft()
432 *** runcommand log -qr draft()
433 4:7966c8e3734d
433 4:7966c8e3734d
434
434
435
435
436 cache of phase roots should be invalidated on strip (issue3827):
436 cache of phase roots should be invalidated on strip (issue3827):
437
437
438 >>> import os
438 >>> import os
439 >>> from hgclient import check, readchannel, runcommand, sep
439 >>> from hgclient import check, readchannel, runcommand, sep
440 >>> @check
440 >>> @check
441 ... def phasecacheafterstrip(server):
441 ... def phasecacheafterstrip(server):
442 ... readchannel(server)
442 ... readchannel(server)
443 ...
443 ...
444 ... # create new head, 5:731265503d86
444 ... # create new head, 5:731265503d86
445 ... runcommand(server, ['update', '-C', '0'])
445 ... runcommand(server, ['update', '-C', '0'])
446 ... f = open('a', 'ab')
446 ... f = open('a', 'ab')
447 ... f.write('a\n')
447 ... f.write('a\n')
448 ... f.close()
448 ... f.close()
449 ... runcommand(server, ['commit', '-Am.', 'a'])
449 ... runcommand(server, ['commit', '-Am.', 'a'])
450 ... runcommand(server, ['log', '-Gq'])
450 ... runcommand(server, ['log', '-Gq'])
451 ...
451 ...
452 ... # make it public; draft marker moves to 4:7966c8e3734d
452 ... # make it public; draft marker moves to 4:7966c8e3734d
453 ... runcommand(server, ['phase', '-p', '.'])
453 ... runcommand(server, ['phase', '-p', '.'])
454 ... # load _phasecache.phaseroots
454 ... # load _phasecache.phaseroots
455 ... runcommand(server, ['phase', '.'], outfilter=sep)
455 ... runcommand(server, ['phase', '.'], outfilter=sep)
456 ...
456 ...
457 ... # strip 1::4 outside server
457 ... # strip 1::4 outside server
458 ... os.system('hg -q --config extensions.mq= strip 1')
458 ... os.system('hg -q --config extensions.mq= strip 1')
459 ...
459 ...
460 ... # shouldn't raise "7966c8e3734d: no node!"
460 ... # shouldn't raise "7966c8e3734d: no node!"
461 ... runcommand(server, ['branches'])
461 ... runcommand(server, ['branches'])
462 *** runcommand update -C 0
462 *** runcommand update -C 0
463 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
463 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
464 (leaving bookmark bm3)
464 (leaving bookmark bm3)
465 *** runcommand commit -Am. a
465 *** runcommand commit -Am. a
466 created new head
466 created new head
467 *** runcommand log -Gq
467 *** runcommand log -Gq
468 @ 5:731265503d86
468 @ 5:731265503d86
469 |
469 |
470 | o 4:7966c8e3734d
470 | o 4:7966c8e3734d
471 | |
471 | |
472 | o 3:b9b85890c400
472 | o 3:b9b85890c400
473 | |
473 | |
474 | o 2:aef17e88f5f0
474 | o 2:aef17e88f5f0
475 | |
475 | |
476 | o 1:d3a0a68be6de
476 | o 1:d3a0a68be6de
477 |/
477 |/
478 o 0:eff892de26ec
478 o 0:eff892de26ec
479
479
480 *** runcommand phase -p .
480 *** runcommand phase -p .
481 *** runcommand phase .
481 *** runcommand phase .
482 5: public
482 5: public
483 *** runcommand branches
483 *** runcommand branches
484 default 1:731265503d86
484 default 1:731265503d86
485
485
486 in-memory cache must be reloaded if transaction is aborted. otherwise
486 in-memory cache must be reloaded if transaction is aborted. otherwise
487 changelog and manifest would have invalid node:
487 changelog and manifest would have invalid node:
488
488
489 $ echo a >> a
489 $ echo a >> a
490 >>> from hgclient import check, readchannel, runcommand
490 >>> from hgclient import check, readchannel, runcommand
491 >>> @check
491 >>> @check
492 ... def txabort(server):
492 ... def txabort(server):
493 ... readchannel(server)
493 ... readchannel(server)
494 ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false',
494 ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false',
495 ... '-mfoo'])
495 ... '-mfoo'])
496 ... runcommand(server, ['verify'])
496 ... runcommand(server, ['verify'])
497 *** runcommand commit --config hooks.pretxncommit=false -mfoo
497 *** runcommand commit --config hooks.pretxncommit=false -mfoo
498 transaction abort!
498 transaction abort!
499 rollback completed
499 rollback completed
500 abort: pretxncommit hook exited with status 1
500 abort: pretxncommit hook exited with status 1
501 [255]
501 [255]
502 *** runcommand verify
502 *** runcommand verify
503 checking changesets
503 checking changesets
504 checking manifests
504 checking manifests
505 crosschecking files in changesets and manifests
505 crosschecking files in changesets and manifests
506 checking files
506 checking files
507 1 files, 2 changesets, 2 total revisions
507 1 files, 2 changesets, 2 total revisions
508 $ hg revert --no-backup -aq
508 $ hg revert --no-backup -aq
509
509
510 $ cat >> .hg/hgrc << EOF
510 $ cat >> .hg/hgrc << EOF
511 > [experimental]
511 > [experimental]
512 > evolution.createmarkers=True
512 > evolution.createmarkers=True
513 > EOF
513 > EOF
514
514
515 >>> import os
515 >>> import os
516 >>> from hgclient import check, readchannel, runcommand
516 >>> from hgclient import check, readchannel, runcommand
517 >>> @check
517 >>> @check
518 ... def obsolete(server):
518 ... def obsolete(server):
519 ... readchannel(server)
519 ... readchannel(server)
520 ...
520 ...
521 ... runcommand(server, ['up', 'null'])
521 ... runcommand(server, ['up', 'null'])
522 ... runcommand(server, ['phase', '-df', 'tip'])
522 ... runcommand(server, ['phase', '-df', 'tip'])
523 ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
523 ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
524 ... if os.name == 'nt':
524 ... if os.name == 'nt':
525 ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
525 ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
526 ... os.system(cmd)
526 ... os.system(cmd)
527 ... runcommand(server, ['log', '--hidden'])
527 ... runcommand(server, ['log', '--hidden'])
528 ... runcommand(server, ['log'])
528 ... runcommand(server, ['log'])
529 *** runcommand up null
529 *** runcommand up null
530 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
530 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
531 *** runcommand phase -df tip
531 *** runcommand phase -df tip
532 obsoleted 1 changesets
532 obsoleted 1 changesets
533 *** runcommand log --hidden
533 *** runcommand log --hidden
534 changeset: 1:731265503d86
534 changeset: 1:731265503d86
535 tag: tip
535 tag: tip
536 user: test
536 user: test
537 date: Thu Jan 01 00:00:00 1970 +0000
537 date: Thu Jan 01 00:00:00 1970 +0000
538 obsolete: pruned
538 obsolete: pruned
539 summary: .
539 summary: .
540
540
541 changeset: 0:eff892de26ec
541 changeset: 0:eff892de26ec
542 bookmark: bm1
542 bookmark: bm1
543 bookmark: bm2
543 bookmark: bm2
544 bookmark: bm3
544 bookmark: bm3
545 user: test
545 user: test
546 date: Thu Jan 01 00:00:00 1970 +0000
546 date: Thu Jan 01 00:00:00 1970 +0000
547 summary: 1
547 summary: 1
548
548
549 *** runcommand log
549 *** runcommand log
550 changeset: 0:eff892de26ec
550 changeset: 0:eff892de26ec
551 bookmark: bm1
551 bookmark: bm1
552 bookmark: bm2
552 bookmark: bm2
553 bookmark: bm3
553 bookmark: bm3
554 tag: tip
554 tag: tip
555 user: test
555 user: test
556 date: Thu Jan 01 00:00:00 1970 +0000
556 date: Thu Jan 01 00:00:00 1970 +0000
557 summary: 1
557 summary: 1
558
558
559
559
560 $ cat <<EOF >> .hg/hgrc
560 $ cat <<EOF >> .hg/hgrc
561 > [extensions]
561 > [extensions]
562 > mq =
562 > mq =
563 > EOF
563 > EOF
564
564
565 >>> import os
565 >>> import os
566 >>> from hgclient import check, readchannel, runcommand
566 >>> from hgclient import check, readchannel, runcommand
567 >>> @check
567 >>> @check
568 ... def mqoutsidechanges(server):
568 ... def mqoutsidechanges(server):
569 ... readchannel(server)
569 ... readchannel(server)
570 ...
570 ...
571 ... # load repo.mq
571 ... # load repo.mq
572 ... runcommand(server, ['qapplied'])
572 ... runcommand(server, ['qapplied'])
573 ... os.system('hg qnew 0.diff')
573 ... os.system('hg qnew 0.diff')
574 ... # repo.mq should be invalidated
574 ... # repo.mq should be invalidated
575 ... runcommand(server, ['qapplied'])
575 ... runcommand(server, ['qapplied'])
576 ...
576 ...
577 ... runcommand(server, ['qpop', '--all'])
577 ... runcommand(server, ['qpop', '--all'])
578 ... os.system('hg qqueue --create foo')
578 ... os.system('hg qqueue --create foo')
579 ... # repo.mq should be recreated to point to new queue
579 ... # repo.mq should be recreated to point to new queue
580 ... runcommand(server, ['qqueue', '--active'])
580 ... runcommand(server, ['qqueue', '--active'])
581 *** runcommand qapplied
581 *** runcommand qapplied
582 *** runcommand qapplied
582 *** runcommand qapplied
583 0.diff
583 0.diff
584 *** runcommand qpop --all
584 *** runcommand qpop --all
585 popping 0.diff
585 popping 0.diff
586 patch queue now empty
586 patch queue now empty
587 *** runcommand qqueue --active
587 *** runcommand qqueue --active
588 foo
588 foo
589
589
590 $ cat <<EOF > dbgui.py
590 $ cat <<EOF > dbgui.py
591 > import os
591 > import os
592 > import sys
592 > import sys
593 > from mercurial import commands, registrar
593 > from mercurial import commands, registrar
594 > cmdtable = {}
594 > cmdtable = {}
595 > command = registrar.command(cmdtable)
595 > command = registrar.command(cmdtable)
596 > @command(b"debuggetpass", norepo=True)
596 > @command(b"debuggetpass", norepo=True)
597 > def debuggetpass(ui):
597 > def debuggetpass(ui):
598 > ui.write("%s\\n" % ui.getpass())
598 > ui.write("%s\\n" % ui.getpass())
599 > @command(b"debugprompt", norepo=True)
599 > @command(b"debugprompt", norepo=True)
600 > def debugprompt(ui):
600 > def debugprompt(ui):
601 > ui.write("%s\\n" % ui.prompt("prompt:"))
601 > ui.write("%s\\n" % ui.prompt("prompt:"))
602 > @command(b"debugreadstdin", norepo=True)
602 > @command(b"debugreadstdin", norepo=True)
603 > def debugreadstdin(ui):
603 > def debugreadstdin(ui):
604 > ui.write("read: %r\n" % sys.stdin.read(1))
604 > ui.write("read: %r\n" % sys.stdin.read(1))
605 > @command(b"debugwritestdout", norepo=True)
605 > @command(b"debugwritestdout", norepo=True)
606 > def debugwritestdout(ui):
606 > def debugwritestdout(ui):
607 > os.write(1, "low-level stdout fd and\n")
607 > os.write(1, "low-level stdout fd and\n")
608 > sys.stdout.write("stdout should be redirected to /dev/null\n")
608 > sys.stdout.write("stdout should be redirected to /dev/null\n")
609 > sys.stdout.flush()
609 > sys.stdout.flush()
610 > EOF
610 > EOF
611 $ cat <<EOF >> .hg/hgrc
611 $ cat <<EOF >> .hg/hgrc
612 > [extensions]
612 > [extensions]
613 > dbgui = dbgui.py
613 > dbgui = dbgui.py
614 > EOF
614 > EOF
615
615
616 >>> from hgclient import check, readchannel, runcommand, stringio
616 >>> from hgclient import check, readchannel, runcommand, stringio
617 >>> @check
617 >>> @check
618 ... def getpass(server):
618 ... def getpass(server):
619 ... readchannel(server)
619 ... readchannel(server)
620 ... runcommand(server, ['debuggetpass', '--config',
620 ... runcommand(server, ['debuggetpass', '--config',
621 ... 'ui.interactive=True'],
621 ... 'ui.interactive=True'],
622 ... input=stringio('1234\n'))
622 ... input=stringio('1234\n'))
623 ... runcommand(server, ['debuggetpass', '--config',
623 ... runcommand(server, ['debuggetpass', '--config',
624 ... 'ui.interactive=True'],
624 ... 'ui.interactive=True'],
625 ... input=stringio('\n'))
625 ... input=stringio('\n'))
626 ... runcommand(server, ['debuggetpass', '--config',
626 ... runcommand(server, ['debuggetpass', '--config',
627 ... 'ui.interactive=True'],
627 ... 'ui.interactive=True'],
628 ... input=stringio(''))
628 ... input=stringio(''))
629 ... runcommand(server, ['debugprompt', '--config',
629 ... runcommand(server, ['debugprompt', '--config',
630 ... 'ui.interactive=True'],
630 ... 'ui.interactive=True'],
631 ... input=stringio('5678\n'))
631 ... input=stringio('5678\n'))
632 ... runcommand(server, ['debugreadstdin'])
632 ... runcommand(server, ['debugreadstdin'])
633 ... runcommand(server, ['debugwritestdout'])
633 ... runcommand(server, ['debugwritestdout'])
634 *** runcommand debuggetpass --config ui.interactive=True
634 *** runcommand debuggetpass --config ui.interactive=True
635 password: 1234
635 password: 1234
636 *** runcommand debuggetpass --config ui.interactive=True
636 *** runcommand debuggetpass --config ui.interactive=True
637 password:
637 password:
638 *** runcommand debuggetpass --config ui.interactive=True
638 *** runcommand debuggetpass --config ui.interactive=True
639 password: abort: response expected
639 password: abort: response expected
640 [255]
640 [255]
641 *** runcommand debugprompt --config ui.interactive=True
641 *** runcommand debugprompt --config ui.interactive=True
642 prompt: 5678
642 prompt: 5678
643 *** runcommand debugreadstdin
643 *** runcommand debugreadstdin
644 read: ''
644 read: ''
645 *** runcommand debugwritestdout
645 *** runcommand debugwritestdout
646
646
647
647
648 run commandserver in commandserver, which is silly but should work:
648 run commandserver in commandserver, which is silly but should work:
649
649
650 >>> from __future__ import print_function
650 >>> from __future__ import print_function
651 >>> from hgclient import check, readchannel, runcommand, stringio
651 >>> from hgclient import check, readchannel, runcommand, stringio
652 >>> @check
652 >>> @check
653 ... def nested(server):
653 ... def nested(server):
654 ... print('%c, %r' % readchannel(server))
654 ... print('%c, %r' % readchannel(server))
655 ... class nestedserver(object):
655 ... class nestedserver(object):
656 ... stdin = stringio('getencoding\n')
656 ... stdin = stringio('getencoding\n')
657 ... stdout = stringio()
657 ... stdout = stringio()
658 ... runcommand(server, ['serve', '--cmdserver', 'pipe'],
658 ... runcommand(server, ['serve', '--cmdserver', 'pipe'],
659 ... output=nestedserver.stdout, input=nestedserver.stdin)
659 ... output=nestedserver.stdout, input=nestedserver.stdin)
660 ... nestedserver.stdout.seek(0)
660 ... nestedserver.stdout.seek(0)
661 ... print('%c, %r' % readchannel(nestedserver)) # hello
661 ... print('%c, %r' % readchannel(nestedserver)) # hello
662 ... print('%c, %r' % readchannel(nestedserver)) # getencoding
662 ... print('%c, %r' % readchannel(nestedserver)) # getencoding
663 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
663 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
664 *** runcommand serve --cmdserver pipe
664 *** runcommand serve --cmdserver pipe
665 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
665 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
666 r, '*' (glob)
666 r, '*' (glob)
667
667
668
668
669 start without repository:
669 start without repository:
670
670
671 $ cd ..
671 $ cd ..
672
672
673 >>> from __future__ import print_function
673 >>> from __future__ import print_function
674 >>> from hgclient import check, readchannel, runcommand
674 >>> from hgclient import check, readchannel, runcommand
675 >>> @check
675 >>> @check
676 ... def hellomessage(server):
676 ... def hellomessage(server):
677 ... ch, data = readchannel(server)
677 ... ch, data = readchannel(server)
678 ... print('%c, %r' % (ch, data))
678 ... print('%c, %r' % (ch, data))
679 ... # run an arbitrary command to make sure the next thing the server
679 ... # run an arbitrary command to make sure the next thing the server
680 ... # sends isn't part of the hello message
680 ... # sends isn't part of the hello message
681 ... runcommand(server, ['id'])
681 ... runcommand(server, ['id'])
682 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
682 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
683 *** runcommand id
683 *** runcommand id
684 abort: there is no Mercurial repository here (.hg not found)
684 abort: there is no Mercurial repository here (.hg not found)
685 [255]
685 [255]
686
686
687 >>> from hgclient import check, readchannel, runcommand
687 >>> from hgclient import check, readchannel, runcommand
688 >>> @check
688 >>> @check
689 ... def startwithoutrepo(server):
689 ... def startwithoutrepo(server):
690 ... readchannel(server)
690 ... readchannel(server)
691 ... runcommand(server, ['init', 'repo2'])
691 ... runcommand(server, ['init', 'repo2'])
692 ... runcommand(server, ['id', '-R', 'repo2'])
692 ... runcommand(server, ['id', '-R', 'repo2'])
693 *** runcommand init repo2
693 *** runcommand init repo2
694 *** runcommand id -R repo2
694 *** runcommand id -R repo2
695 000000000000 tip
695 000000000000 tip
696
696
697
697
698 don't fall back to cwd if invalid -R path is specified (issue4805):
698 don't fall back to cwd if invalid -R path is specified (issue4805):
699
699
700 $ cd repo
700 $ cd repo
701 $ hg serve --cmdserver pipe -R ../nonexistent
701 $ hg serve --cmdserver pipe -R ../nonexistent
702 abort: repository ../nonexistent not found!
702 abort: repository ../nonexistent not found!
703 [255]
703 [255]
704 $ cd ..
704 $ cd ..
705
705
706
706
707 unix domain socket:
707 unix domain socket:
708
708
709 $ cd repo
709 $ cd repo
710 $ hg update -q
710 $ hg update -q
711
711
712 #if unix-socket unix-permissions
712 #if unix-socket unix-permissions
713
713
714 >>> from __future__ import print_function
714 >>> from __future__ import print_function
715 >>> from hgclient import check, readchannel, runcommand, stringio, unixserver
715 >>> from hgclient import check, readchannel, runcommand, stringio, unixserver
716 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
716 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
717 >>> def hellomessage(conn):
717 >>> def hellomessage(conn):
718 ... ch, data = readchannel(conn)
718 ... ch, data = readchannel(conn)
719 ... print('%c, %r' % (ch, data))
719 ... print('%c, %r' % (ch, data))
720 ... runcommand(conn, ['id'])
720 ... runcommand(conn, ['id'])
721 >>> check(hellomessage, server.connect)
721 >>> check(hellomessage, server.connect)
722 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
722 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
723 *** runcommand id
723 *** runcommand id
724 eff892de26ec tip bm1/bm2/bm3
724 eff892de26ec tip bm1/bm2/bm3
725 >>> def unknowncommand(conn):
725 >>> def unknowncommand(conn):
726 ... readchannel(conn)
726 ... readchannel(conn)
727 ... conn.stdin.write('unknowncommand\n')
727 ... conn.stdin.write('unknowncommand\n')
728 >>> check(unknowncommand, server.connect) # error sent to server.log
728 >>> check(unknowncommand, server.connect) # error sent to server.log
729 >>> def serverinput(conn):
729 >>> def serverinput(conn):
730 ... readchannel(conn)
730 ... readchannel(conn)
731 ... patch = """
731 ... patch = """
732 ... # HG changeset patch
732 ... # HG changeset patch
733 ... # User test
733 ... # User test
734 ... # Date 0 0
734 ... # Date 0 0
735 ... 2
735 ... 2
736 ...
736 ...
737 ... diff -r eff892de26ec -r 1ed24be7e7a0 a
737 ... diff -r eff892de26ec -r 1ed24be7e7a0 a
738 ... --- a/a
738 ... --- a/a
739 ... +++ b/a
739 ... +++ b/a
740 ... @@ -1,1 +1,2 @@
740 ... @@ -1,1 +1,2 @@
741 ... 1
741 ... 1
742 ... +2
742 ... +2
743 ... """
743 ... """
744 ... runcommand(conn, ['import', '-'], input=stringio(patch))
744 ... runcommand(conn, ['import', '-'], input=stringio(patch))
745 ... runcommand(conn, ['log', '-rtip', '-q'])
745 ... runcommand(conn, ['log', '-rtip', '-q'])
746 >>> check(serverinput, server.connect)
746 >>> check(serverinput, server.connect)
747 *** runcommand import -
747 *** runcommand import -
748 applying patch from stdin
748 applying patch from stdin
749 *** runcommand log -rtip -q
749 *** runcommand log -rtip -q
750 2:1ed24be7e7a0
750 2:1ed24be7e7a0
751 >>> server.shutdown()
751 >>> server.shutdown()
752
752
753 $ cat .hg/server.log
753 $ cat .hg/server.log
754 listening at .hg/server.sock
754 listening at .hg/server.sock
755 abort: unknown command unknowncommand
755 abort: unknown command unknowncommand
756 killed!
756 killed!
757 $ rm .hg/server.log
757 $ rm .hg/server.log
758
758
759 if server crashed before hello, traceback will be sent to 'e' channel as
759 if server crashed before hello, traceback will be sent to 'e' channel as
760 last ditch:
760 last ditch:
761
761
762 $ cat <<EOF >> .hg/hgrc
762 $ cat <<EOF >> .hg/hgrc
763 > [cmdserver]
763 > [cmdserver]
764 > log = inexistent/path.log
764 > log = inexistent/path.log
765 > EOF
765 > EOF
766 >>> from __future__ import print_function
766 >>> from __future__ import print_function
767 >>> from hgclient import check, readchannel, unixserver
767 >>> from hgclient import check, readchannel, unixserver
768 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
768 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
769 >>> def earlycrash(conn):
769 >>> def earlycrash(conn):
770 ... while True:
770 ... while True:
771 ... try:
771 ... try:
772 ... ch, data = readchannel(conn)
772 ... ch, data = readchannel(conn)
773 ... if not data.startswith(' '):
773 ... if not data.startswith(' '):
774 ... print('%c, %r' % (ch, data))
774 ... print('%c, %r' % (ch, data))
775 ... except EOFError:
775 ... except EOFError:
776 ... break
776 ... break
777 >>> check(earlycrash, server.connect)
777 >>> check(earlycrash, server.connect)
778 e, 'Traceback (most recent call last):\n'
778 e, 'Traceback (most recent call last):\n'
779 e, "IOError: *" (glob)
779 e, "IOError: *" (glob)
780 >>> server.shutdown()
780 >>> server.shutdown()
781
781
782 $ cat .hg/server.log | grep -v '^ '
782 $ cat .hg/server.log | grep -v '^ '
783 listening at .hg/server.sock
783 listening at .hg/server.sock
784 Traceback (most recent call last):
784 Traceback (most recent call last):
785 IOError: * (glob)
785 IOError: * (glob)
786 killed!
786 killed!
787 #endif
787 #endif
788 #if no-unix-socket
788 #if no-unix-socket
789
789
790 $ hg serve --cmdserver unix -a .hg/server.sock
790 $ hg serve --cmdserver unix -a .hg/server.sock
791 abort: unsupported platform
791 abort: unsupported platform
792 [255]
792 [255]
793
793
794 #endif
794 #endif
795
795
796 $ cd ..
796 $ cd ..
797
797
798 Test that accessing to invalid changelog cache is avoided at
798 Test that accessing to invalid changelog cache is avoided at
799 subsequent operations even if repo object is reused even after failure
799 subsequent operations even if repo object is reused even after failure
800 of transaction (see 0a7610758c42 also)
800 of transaction (see 0a7610758c42 also)
801
801
802 "hg log" after failure of transaction is needed to detect invalid
802 "hg log" after failure of transaction is needed to detect invalid
803 cache in repoview: this can't detect by "hg verify" only.
803 cache in repoview: this can't detect by "hg verify" only.
804
804
805 Combination of "finalization" and "empty-ness of changelog" (2 x 2 =
805 Combination of "finalization" and "empty-ness of changelog" (2 x 2 =
806 4) are tested, because '00changelog.i' are differently changed in each
806 4) are tested, because '00changelog.i' are differently changed in each
807 cases.
807 cases.
808
808
809 $ cat > $TESTTMP/failafterfinalize.py <<EOF
809 $ cat > $TESTTMP/failafterfinalize.py <<EOF
810 > # extension to abort transaction after finalization forcibly
810 > # extension to abort transaction after finalization forcibly
811 > from mercurial import commands, error, extensions, lock as lockmod
811 > from mercurial import commands, error, extensions, lock as lockmod
812 > from mercurial import registrar
812 > from mercurial import registrar
813 > cmdtable = {}
813 > cmdtable = {}
814 > command = registrar.command(cmdtable)
814 > command = registrar.command(cmdtable)
815 > configtable = {}
815 > configtable = {}
816 > configitem = registrar.configitem(configtable)
816 > configitem = registrar.configitem(configtable)
817 > configitem('failafterfinalize', 'fail',
817 > configitem('failafterfinalize', 'fail',
818 > default=None,
818 > default=None,
819 > )
819 > )
820 > def fail(tr):
820 > def fail(tr):
821 > raise error.Abort('fail after finalization')
821 > raise error.Abort('fail after finalization')
822 > def reposetup(ui, repo):
822 > def reposetup(ui, repo):
823 > class failrepo(repo.__class__):
823 > class failrepo(repo.__class__):
824 > def commitctx(self, ctx, error=False):
824 > def commitctx(self, ctx, error=False):
825 > if self.ui.configbool('failafterfinalize', 'fail'):
825 > if self.ui.configbool('failafterfinalize', 'fail'):
826 > # 'sorted()' by ASCII code on category names causes
826 > # 'sorted()' by ASCII code on category names causes
827 > # invoking 'fail' after finalization of changelog
827 > # invoking 'fail' after finalization of changelog
828 > # using "'cl-%i' % id(self)" as category name
828 > # using "'cl-%i' % id(self)" as category name
829 > self.currenttransaction().addfinalize('zzzzzzzz', fail)
829 > self.currenttransaction().addfinalize('zzzzzzzz', fail)
830 > return super(failrepo, self).commitctx(ctx, error)
830 > return super(failrepo, self).commitctx(ctx, error)
831 > repo.__class__ = failrepo
831 > repo.__class__ = failrepo
832 > EOF
832 > EOF
833
833
834 $ hg init repo3
834 $ hg init repo3
835 $ cd repo3
835 $ cd repo3
836
836
837 $ cat <<EOF >> $HGRCPATH
837 $ cat <<EOF >> $HGRCPATH
838 > [ui]
838 > [ui]
839 > logtemplate = {rev} {desc|firstline} ({files})\n
839 > logtemplate = {rev} {desc|firstline} ({files})\n
840 >
840 >
841 > [extensions]
841 > [extensions]
842 > failafterfinalize = $TESTTMP/failafterfinalize.py
842 > failafterfinalize = $TESTTMP/failafterfinalize.py
843 > EOF
843 > EOF
844
844
845 - test failure with "empty changelog"
845 - test failure with "empty changelog"
846
846
847 $ echo foo > foo
847 $ echo foo > foo
848 $ hg add foo
848 $ hg add foo
849
849
850 (failure before finalization)
850 (failure before finalization)
851
851
852 >>> from hgclient import check, readchannel, runcommand
852 >>> from hgclient import check, readchannel, runcommand
853 >>> @check
853 >>> @check
854 ... def abort(server):
854 ... def abort(server):
855 ... readchannel(server)
855 ... readchannel(server)
856 ... runcommand(server, ['commit',
856 ... runcommand(server, ['commit',
857 ... '--config', 'hooks.pretxncommit=false',
857 ... '--config', 'hooks.pretxncommit=false',
858 ... '-mfoo'])
858 ... '-mfoo'])
859 ... runcommand(server, ['log'])
859 ... runcommand(server, ['log'])
860 ... runcommand(server, ['verify', '-q'])
860 ... runcommand(server, ['verify', '-q'])
861 *** runcommand commit --config hooks.pretxncommit=false -mfoo
861 *** runcommand commit --config hooks.pretxncommit=false -mfoo
862 transaction abort!
862 transaction abort!
863 rollback completed
863 rollback completed
864 abort: pretxncommit hook exited with status 1
864 abort: pretxncommit hook exited with status 1
865 [255]
865 [255]
866 *** runcommand log
866 *** runcommand log
867 *** runcommand verify -q
867 *** runcommand verify -q
868
868
869 (failure after finalization)
869 (failure after finalization)
870
870
871 >>> from hgclient import check, readchannel, runcommand
871 >>> from hgclient import check, readchannel, runcommand
872 >>> @check
872 >>> @check
873 ... def abort(server):
873 ... def abort(server):
874 ... readchannel(server)
874 ... readchannel(server)
875 ... runcommand(server, ['commit',
875 ... runcommand(server, ['commit',
876 ... '--config', 'failafterfinalize.fail=true',
876 ... '--config', 'failafterfinalize.fail=true',
877 ... '-mfoo'])
877 ... '-mfoo'])
878 ... runcommand(server, ['log'])
878 ... runcommand(server, ['log'])
879 ... runcommand(server, ['verify', '-q'])
879 ... runcommand(server, ['verify', '-q'])
880 *** runcommand commit --config failafterfinalize.fail=true -mfoo
880 *** runcommand commit --config failafterfinalize.fail=true -mfoo
881 transaction abort!
881 transaction abort!
882 rollback completed
882 rollback completed
883 abort: fail after finalization
883 abort: fail after finalization
884 [255]
884 [255]
885 *** runcommand log
885 *** runcommand log
886 *** runcommand verify -q
886 *** runcommand verify -q
887
887
888 - test failure with "not-empty changelog"
888 - test failure with "not-empty changelog"
889
889
890 $ echo bar > bar
890 $ echo bar > bar
891 $ hg add bar
891 $ hg add bar
892 $ hg commit -mbar bar
892 $ hg commit -mbar bar
893
893
894 (failure before finalization)
894 (failure before finalization)
895
895
896 >>> from hgclient import check, readchannel, runcommand
896 >>> from hgclient import check, readchannel, runcommand
897 >>> @check
897 >>> @check
898 ... def abort(server):
898 ... def abort(server):
899 ... readchannel(server)
899 ... readchannel(server)
900 ... runcommand(server, ['commit',
900 ... runcommand(server, ['commit',
901 ... '--config', 'hooks.pretxncommit=false',
901 ... '--config', 'hooks.pretxncommit=false',
902 ... '-mfoo', 'foo'])
902 ... '-mfoo', 'foo'])
903 ... runcommand(server, ['log'])
903 ... runcommand(server, ['log'])
904 ... runcommand(server, ['verify', '-q'])
904 ... runcommand(server, ['verify', '-q'])
905 *** runcommand commit --config hooks.pretxncommit=false -mfoo foo
905 *** runcommand commit --config hooks.pretxncommit=false -mfoo foo
906 transaction abort!
906 transaction abort!
907 rollback completed
907 rollback completed
908 abort: pretxncommit hook exited with status 1
908 abort: pretxncommit hook exited with status 1
909 [255]
909 [255]
910 *** runcommand log
910 *** runcommand log
911 0 bar (bar)
911 0 bar (bar)
912 *** runcommand verify -q
912 *** runcommand verify -q
913
913
914 (failure after finalization)
914 (failure after finalization)
915
915
916 >>> from hgclient import check, readchannel, runcommand
916 >>> from hgclient import check, readchannel, runcommand
917 >>> @check
917 >>> @check
918 ... def abort(server):
918 ... def abort(server):
919 ... readchannel(server)
919 ... readchannel(server)
920 ... runcommand(server, ['commit',
920 ... runcommand(server, ['commit',
921 ... '--config', 'failafterfinalize.fail=true',
921 ... '--config', 'failafterfinalize.fail=true',
922 ... '-mfoo', 'foo'])
922 ... '-mfoo', 'foo'])
923 ... runcommand(server, ['log'])
923 ... runcommand(server, ['log'])
924 ... runcommand(server, ['verify', '-q'])
924 ... runcommand(server, ['verify', '-q'])
925 *** runcommand commit --config failafterfinalize.fail=true -mfoo foo
925 *** runcommand commit --config failafterfinalize.fail=true -mfoo foo
926 transaction abort!
926 transaction abort!
927 rollback completed
927 rollback completed
928 abort: fail after finalization
928 abort: fail after finalization
929 [255]
929 [255]
930 *** runcommand log
930 *** runcommand log
931 0 bar (bar)
931 0 bar (bar)
932 *** runcommand verify -q
932 *** runcommand verify -q
933
933
934 $ cd ..
934 $ cd ..
935
935
936 Test symlink traversal over cached audited paths:
936 Test symlink traversal over cached audited paths:
937 -------------------------------------------------
937 -------------------------------------------------
938
938
939 #if symlink
939 #if symlink
940
940
941 set up symlink hell
941 set up symlink hell
942
942
943 $ mkdir merge-symlink-out
943 $ mkdir merge-symlink-out
944 $ hg init merge-symlink
944 $ hg init merge-symlink
945 $ cd merge-symlink
945 $ cd merge-symlink
946 $ touch base
946 $ touch base
947 $ hg commit -qAm base
947 $ hg commit -qAm base
948 $ ln -s ../merge-symlink-out a
948 $ ln -s ../merge-symlink-out a
949 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
949 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
950 $ hg up -q 0
950 $ hg up -q 0
951 $ mkdir a
951 $ mkdir a
952 $ touch a/poisoned
952 $ touch a/poisoned
953 $ hg commit -qAm 'file a/poisoned'
953 $ hg commit -qAm 'file a/poisoned'
954 $ hg log -G -T '{rev}: {desc}\n'
954 $ hg log -G -T '{rev}: {desc}\n'
955 @ 2: file a/poisoned
955 @ 2: file a/poisoned
956 |
956 |
957 | o 1: symlink a -> ../merge-symlink-out
957 | o 1: symlink a -> ../merge-symlink-out
958 |/
958 |/
959 o 0: base
959 o 0: base
960
960
961
961
962 try trivial merge after update: cache of audited paths should be discarded,
962 try trivial merge after update: cache of audited paths should be discarded,
963 and the merge should fail (issue5628)
963 and the merge should fail (issue5628)
964
964
965 $ hg up -q null
965 $ hg up -q null
966 >>> from hgclient import check, readchannel, runcommand
966 >>> from hgclient import check, readchannel, runcommand
967 >>> @check
967 >>> @check
968 ... def merge(server):
968 ... def merge(server):
969 ... readchannel(server)
969 ... readchannel(server)
970 ... # audit a/poisoned as a good path
970 ... # audit a/poisoned as a good path
971 ... runcommand(server, ['up', '-qC', '2'])
971 ... runcommand(server, ['up', '-qC', '2'])
972 ... runcommand(server, ['up', '-qC', '1'])
972 ... runcommand(server, ['up', '-qC', '1'])
973 ... # here a is a symlink, so a/poisoned is bad
973 ... # here a is a symlink, so a/poisoned is bad
974 ... runcommand(server, ['merge', '2'])
974 ... runcommand(server, ['merge', '2'])
975 *** runcommand up -qC 2
975 *** runcommand up -qC 2
976 *** runcommand up -qC 1
976 *** runcommand up -qC 1
977 *** runcommand merge 2
977 *** runcommand merge 2
978 a: path conflict - a file or link has the same name as a directory
978 abort: path 'a/poisoned' traverses symbolic link 'a'
979 the local file has been renamed to a~aa04623eb0c3
979 [255]
980 resolve manually then use 'hg resolve --mark a'
981 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
982 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
983 [1]
984 $ ls ../merge-symlink-out
980 $ ls ../merge-symlink-out
985
981
986 cache of repo.auditor should be discarded, so matcher would never traverse
982 cache of repo.auditor should be discarded, so matcher would never traverse
987 symlinks:
983 symlinks:
988
984
989 $ hg up -qC 0
985 $ hg up -qC 0
990 $ touch ../merge-symlink-out/poisoned
986 $ touch ../merge-symlink-out/poisoned
991 >>> from hgclient import check, readchannel, runcommand
987 >>> from hgclient import check, readchannel, runcommand
992 >>> @check
988 >>> @check
993 ... def files(server):
989 ... def files(server):
994 ... readchannel(server)
990 ... readchannel(server)
995 ... runcommand(server, ['up', '-qC', '2'])
991 ... runcommand(server, ['up', '-qC', '2'])
996 ... # audit a/poisoned as a good path
992 ... # audit a/poisoned as a good path
997 ... runcommand(server, ['files', 'a/poisoned'])
993 ... runcommand(server, ['files', 'a/poisoned'])
998 ... runcommand(server, ['up', '-qC', '0'])
994 ... runcommand(server, ['up', '-qC', '0'])
999 ... runcommand(server, ['up', '-qC', '1'])
995 ... runcommand(server, ['up', '-qC', '1'])
1000 ... # here 'a' is a symlink, so a/poisoned should be warned
996 ... # here 'a' is a symlink, so a/poisoned should be warned
1001 ... runcommand(server, ['files', 'a/poisoned'])
997 ... runcommand(server, ['files', 'a/poisoned'])
1002 *** runcommand up -qC 2
998 *** runcommand up -qC 2
1003 *** runcommand files a/poisoned
999 *** runcommand files a/poisoned
1004 a/poisoned
1000 a/poisoned
1005 *** runcommand up -qC 0
1001 *** runcommand up -qC 0
1006 *** runcommand up -qC 1
1002 *** runcommand up -qC 1
1007 *** runcommand files a/poisoned
1003 *** runcommand files a/poisoned
1008 abort: path 'a/poisoned' traverses symbolic link 'a'
1004 abort: path 'a/poisoned' traverses symbolic link 'a'
1009 [255]
1005 [255]
1010
1006
1011 $ cd ..
1007 $ cd ..
1012
1008
1013 #endif
1009 #endif
@@ -1,429 +1,430 b''
1 $ cat <<EOF > merge
1 $ cat <<EOF > merge
2 > from __future__ import print_function
2 > from __future__ import print_function
3 > import sys, os
3 > import sys, os
4 >
4 >
5 > try:
5 > try:
6 > import msvcrt
6 > import msvcrt
7 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
7 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
8 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
8 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
9 > except ImportError:
9 > except ImportError:
10 > pass
10 > pass
11 >
11 >
12 > print("merging for", os.path.basename(sys.argv[1]))
12 > print("merging for", os.path.basename(sys.argv[1]))
13 > EOF
13 > EOF
14 $ HGMERGE="$PYTHON ../merge"; export HGMERGE
14 $ HGMERGE="$PYTHON ../merge"; export HGMERGE
15
15
16 $ hg init t
16 $ hg init t
17 $ cd t
17 $ cd t
18 $ echo This is file a1 > a
18 $ echo This is file a1 > a
19 $ hg add a
19 $ hg add a
20 $ hg commit -m "commit #0"
20 $ hg commit -m "commit #0"
21 $ echo This is file b1 > b
21 $ echo This is file b1 > b
22 $ hg add b
22 $ hg add b
23 $ hg commit -m "commit #1"
23 $ hg commit -m "commit #1"
24
24
25 $ hg update 0
25 $ hg update 0
26 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
27
27
28 Test interrupted updates by having a non-empty dir with the same name as one
28 Test interrupted updates by having a non-empty dir with the same name as one
29 of the files in a commit we're updating to
29 of the files in a commit we're updating to
30
30
31 $ mkdir b && touch b/nonempty
31 $ mkdir b && touch b/nonempty
32 $ hg up
32 $ hg up
33 b: untracked directory conflicts with file
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 abort: untracked files in working directory differ from files in requested revision
35 [255]
36 $ hg ci
34 $ hg ci
37 nothing changed
35 nothing changed
38 [1]
36 [1]
39 $ hg sum
37 $ hg sum
40 parent: 0:538afb845929
38 parent: 1:b8bb4a988f25 tip
41 commit #0
39 commit #1
42 branch: default
40 branch: default
43 commit: 1 unknown (clean)
41 commit: (clean)
44 update: 1 new changesets (update)
42 update: (current)
45 phases: 2 draft
43 phases: 2 draft
46 $ rm b/nonempty
44
45 The following line is commented out because the file doesn't exist at the moment, and some OSes error out even with `rm -f`.
46 $ rm b/nonempty
47
47 $ hg up
48 $ hg up
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 $ hg sum
50 $ hg sum
50 parent: 1:b8bb4a988f25 tip
51 parent: 1:b8bb4a988f25 tip
51 commit #1
52 commit #1
52 branch: default
53 branch: default
53 commit: (clean)
54 commit: (clean)
54 update: (current)
55 update: (current)
55 phases: 2 draft
56 phases: 2 draft
56
57
57 Prepare a basic merge
58 Prepare a basic merge
58
59
59 $ hg up 0
60 $ hg up 0
60 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
61 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
61 $ echo This is file c1 > c
62 $ echo This is file c1 > c
62 $ hg add c
63 $ hg add c
63 $ hg commit -m "commit #2"
64 $ hg commit -m "commit #2"
64 created new head
65 created new head
65 $ echo This is file b1 > b
66 $ echo This is file b1 > b
66 no merges expected
67 no merges expected
67 $ hg merge -P 1
68 $ hg merge -P 1
68 changeset: 1:b8bb4a988f25
69 changeset: 1:b8bb4a988f25
69 user: test
70 user: test
70 date: Thu Jan 01 00:00:00 1970 +0000
71 date: Thu Jan 01 00:00:00 1970 +0000
71 summary: commit #1
72 summary: commit #1
72
73
73 $ hg merge 1
74 $ hg merge 1
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 (branch merge, don't forget to commit)
76 (branch merge, don't forget to commit)
76 $ hg diff --nodates
77 $ hg diff --nodates
77 diff -r 49035e18a8e6 b
78 diff -r 49035e18a8e6 b
78 --- /dev/null
79 --- /dev/null
79 +++ b/b
80 +++ b/b
80 @@ -0,0 +1,1 @@
81 @@ -0,0 +1,1 @@
81 +This is file b1
82 +This is file b1
82 $ hg status
83 $ hg status
83 M b
84 M b
84 $ cd ..; rm -r t
85 $ cd ..; rm -r t
85
86
86 $ hg init t
87 $ hg init t
87 $ cd t
88 $ cd t
88 $ echo This is file a1 > a
89 $ echo This is file a1 > a
89 $ hg add a
90 $ hg add a
90 $ hg commit -m "commit #0"
91 $ hg commit -m "commit #0"
91 $ echo This is file b1 > b
92 $ echo This is file b1 > b
92 $ hg add b
93 $ hg add b
93 $ hg commit -m "commit #1"
94 $ hg commit -m "commit #1"
94
95
95 $ hg update 0
96 $ hg update 0
96 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
97 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
97 $ echo This is file c1 > c
98 $ echo This is file c1 > c
98 $ hg add c
99 $ hg add c
99 $ hg commit -m "commit #2"
100 $ hg commit -m "commit #2"
100 created new head
101 created new head
101 $ echo This is file b2 > b
102 $ echo This is file b2 > b
102 merge should fail
103 merge should fail
103 $ hg merge 1
104 $ hg merge 1
104 b: untracked file differs
105 b: untracked file differs
105 abort: untracked files in working directory differ from files in requested revision
106 abort: untracked files in working directory differ from files in requested revision
106 [255]
107 [255]
107
108
108 #if symlink
109 #if symlink
109 symlinks to directories should be treated as regular files (issue5027)
110 symlinks to directories should be treated as regular files (issue5027)
110 $ rm b
111 $ rm b
111 $ ln -s 'This is file b2' b
112 $ ln -s 'This is file b2' b
112 $ hg merge 1
113 $ hg merge 1
113 b: untracked file differs
114 b: untracked file differs
114 abort: untracked files in working directory differ from files in requested revision
115 abort: untracked files in working directory differ from files in requested revision
115 [255]
116 [255]
116 symlinks shouldn't be followed
117 symlinks shouldn't be followed
117 $ rm b
118 $ rm b
118 $ echo This is file b1 > .hg/b
119 $ echo This is file b1 > .hg/b
119 $ ln -s .hg/b b
120 $ ln -s .hg/b b
120 $ hg merge 1
121 $ hg merge 1
121 b: untracked file differs
122 b: untracked file differs
122 abort: untracked files in working directory differ from files in requested revision
123 abort: untracked files in working directory differ from files in requested revision
123 [255]
124 [255]
124
125
125 $ rm b
126 $ rm b
126 $ echo This is file b2 > b
127 $ echo This is file b2 > b
127 #endif
128 #endif
128
129
129 bad config
130 bad config
130 $ hg merge 1 --config merge.checkunknown=x
131 $ hg merge 1 --config merge.checkunknown=x
131 abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn')
132 abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn')
132 [255]
133 [255]
133 this merge should fail
134 this merge should fail
134 $ hg merge 1 --config merge.checkunknown=abort
135 $ hg merge 1 --config merge.checkunknown=abort
135 b: untracked file differs
136 b: untracked file differs
136 abort: untracked files in working directory differ from files in requested revision
137 abort: untracked files in working directory differ from files in requested revision
137 [255]
138 [255]
138
139
139 this merge should warn
140 this merge should warn
140 $ hg merge 1 --config merge.checkunknown=warn
141 $ hg merge 1 --config merge.checkunknown=warn
141 b: replacing untracked file
142 b: replacing untracked file
142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 (branch merge, don't forget to commit)
144 (branch merge, don't forget to commit)
144 $ cat b.orig
145 $ cat b.orig
145 This is file b2
146 This is file b2
146 $ hg up --clean 2
147 $ hg up --clean 2
147 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
148 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
148 $ mv b.orig b
149 $ mv b.orig b
149
150
150 this merge should silently ignore
151 this merge should silently ignore
151 $ cat b
152 $ cat b
152 This is file b2
153 This is file b2
153 $ hg merge 1 --config merge.checkunknown=ignore
154 $ hg merge 1 --config merge.checkunknown=ignore
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 (branch merge, don't forget to commit)
156 (branch merge, don't forget to commit)
156
157
157 merge.checkignored
158 merge.checkignored
158 $ hg up --clean 1
159 $ hg up --clean 1
159 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
160 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
160 $ cat >> .hgignore << EOF
161 $ cat >> .hgignore << EOF
161 > remoteignored
162 > remoteignored
162 > EOF
163 > EOF
163 $ echo This is file localignored3 > localignored
164 $ echo This is file localignored3 > localignored
164 $ echo This is file remoteignored3 > remoteignored
165 $ echo This is file remoteignored3 > remoteignored
165 $ hg add .hgignore localignored remoteignored
166 $ hg add .hgignore localignored remoteignored
166 $ hg commit -m "commit #3"
167 $ hg commit -m "commit #3"
167
168
168 $ hg up 2
169 $ hg up 2
169 1 files updated, 0 files merged, 4 files removed, 0 files unresolved
170 1 files updated, 0 files merged, 4 files removed, 0 files unresolved
170 $ cat >> .hgignore << EOF
171 $ cat >> .hgignore << EOF
171 > localignored
172 > localignored
172 > EOF
173 > EOF
173 $ hg add .hgignore
174 $ hg add .hgignore
174 $ hg commit -m "commit #4"
175 $ hg commit -m "commit #4"
175
176
176 remote .hgignore shouldn't be used for determining whether a file is ignored
177 remote .hgignore shouldn't be used for determining whether a file is ignored
177 $ echo This is file remoteignored4 > remoteignored
178 $ echo This is file remoteignored4 > remoteignored
178 $ hg merge 3 --config merge.checkignored=ignore --config merge.checkunknown=abort
179 $ hg merge 3 --config merge.checkignored=ignore --config merge.checkunknown=abort
179 remoteignored: untracked file differs
180 remoteignored: untracked file differs
180 abort: untracked files in working directory differ from files in requested revision
181 abort: untracked files in working directory differ from files in requested revision
181 [255]
182 [255]
182 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore
183 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore
183 merging .hgignore
184 merging .hgignore
184 merging for .hgignore
185 merging for .hgignore
185 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
186 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
186 (branch merge, don't forget to commit)
187 (branch merge, don't forget to commit)
187 $ cat remoteignored
188 $ cat remoteignored
188 This is file remoteignored3
189 This is file remoteignored3
189 $ cat remoteignored.orig
190 $ cat remoteignored.orig
190 This is file remoteignored4
191 This is file remoteignored4
191 $ rm remoteignored.orig
192 $ rm remoteignored.orig
192
193
193 local .hgignore should be used for that
194 local .hgignore should be used for that
194 $ hg up --clean 4
195 $ hg up --clean 4
195 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
196 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
196 $ echo This is file localignored4 > localignored
197 $ echo This is file localignored4 > localignored
197 also test other conflicting files to see we output the full set of warnings
198 also test other conflicting files to see we output the full set of warnings
198 $ echo This is file b2 > b
199 $ echo This is file b2 > b
199 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=abort
200 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=abort
200 b: untracked file differs
201 b: untracked file differs
201 localignored: untracked file differs
202 localignored: untracked file differs
202 abort: untracked files in working directory differ from files in requested revision
203 abort: untracked files in working directory differ from files in requested revision
203 [255]
204 [255]
204 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore
205 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore
205 localignored: untracked file differs
206 localignored: untracked file differs
206 abort: untracked files in working directory differ from files in requested revision
207 abort: untracked files in working directory differ from files in requested revision
207 [255]
208 [255]
208 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=abort
209 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=abort
209 b: untracked file differs
210 b: untracked file differs
210 abort: untracked files in working directory differ from files in requested revision
211 abort: untracked files in working directory differ from files in requested revision
211 [255]
212 [255]
212 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=warn
213 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=warn
213 b: replacing untracked file
214 b: replacing untracked file
214 localignored: replacing untracked file
215 localignored: replacing untracked file
215 merging .hgignore
216 merging .hgignore
216 merging for .hgignore
217 merging for .hgignore
217 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
218 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
218 (branch merge, don't forget to commit)
219 (branch merge, don't forget to commit)
219 $ cat localignored
220 $ cat localignored
220 This is file localignored3
221 This is file localignored3
221 $ cat localignored.orig
222 $ cat localignored.orig
222 This is file localignored4
223 This is file localignored4
223 $ rm localignored.orig
224 $ rm localignored.orig
224
225
225 $ cat b.orig
226 $ cat b.orig
226 This is file b2
227 This is file b2
227 $ hg up --clean 2
228 $ hg up --clean 2
228 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
229 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
229 $ mv b.orig b
230 $ mv b.orig b
230
231
231 this merge of b should work
232 this merge of b should work
232 $ cat b
233 $ cat b
233 This is file b2
234 This is file b2
234 $ hg merge -f 1
235 $ hg merge -f 1
235 merging b
236 merging b
236 merging for b
237 merging for b
237 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
238 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
238 (branch merge, don't forget to commit)
239 (branch merge, don't forget to commit)
239 $ hg diff --nodates
240 $ hg diff --nodates
240 diff -r 49035e18a8e6 b
241 diff -r 49035e18a8e6 b
241 --- /dev/null
242 --- /dev/null
242 +++ b/b
243 +++ b/b
243 @@ -0,0 +1,1 @@
244 @@ -0,0 +1,1 @@
244 +This is file b2
245 +This is file b2
245 $ hg status
246 $ hg status
246 M b
247 M b
247 $ cd ..; rm -r t
248 $ cd ..; rm -r t
248
249
249 $ hg init t
250 $ hg init t
250 $ cd t
251 $ cd t
251 $ echo This is file a1 > a
252 $ echo This is file a1 > a
252 $ hg add a
253 $ hg add a
253 $ hg commit -m "commit #0"
254 $ hg commit -m "commit #0"
254 $ echo This is file b1 > b
255 $ echo This is file b1 > b
255 $ hg add b
256 $ hg add b
256 $ hg commit -m "commit #1"
257 $ hg commit -m "commit #1"
257 $ echo This is file b22 > b
258 $ echo This is file b22 > b
258 $ hg commit -m "commit #2"
259 $ hg commit -m "commit #2"
259 $ hg update 1
260 $ hg update 1
260 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 $ echo This is file c1 > c
262 $ echo This is file c1 > c
262 $ hg add c
263 $ hg add c
263 $ hg commit -m "commit #3"
264 $ hg commit -m "commit #3"
264 created new head
265 created new head
265
266
266 Contents of b should be "this is file b1"
267 Contents of b should be "this is file b1"
267 $ cat b
268 $ cat b
268 This is file b1
269 This is file b1
269
270
270 $ echo This is file b22 > b
271 $ echo This is file b22 > b
271 merge fails
272 merge fails
272 $ hg merge 2
273 $ hg merge 2
273 abort: uncommitted changes
274 abort: uncommitted changes
274 (use 'hg status' to list changes)
275 (use 'hg status' to list changes)
275 [255]
276 [255]
276 merge expected!
277 merge expected!
277 $ hg merge -f 2
278 $ hg merge -f 2
278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 (branch merge, don't forget to commit)
280 (branch merge, don't forget to commit)
280 $ hg diff --nodates
281 $ hg diff --nodates
281 diff -r 85de557015a8 b
282 diff -r 85de557015a8 b
282 --- a/b
283 --- a/b
283 +++ b/b
284 +++ b/b
284 @@ -1,1 +1,1 @@
285 @@ -1,1 +1,1 @@
285 -This is file b1
286 -This is file b1
286 +This is file b22
287 +This is file b22
287 $ hg status
288 $ hg status
288 M b
289 M b
289 $ cd ..; rm -r t
290 $ cd ..; rm -r t
290
291
291 $ hg init t
292 $ hg init t
292 $ cd t
293 $ cd t
293 $ echo This is file a1 > a
294 $ echo This is file a1 > a
294 $ hg add a
295 $ hg add a
295 $ hg commit -m "commit #0"
296 $ hg commit -m "commit #0"
296 $ echo This is file b1 > b
297 $ echo This is file b1 > b
297 $ hg add b
298 $ hg add b
298 $ hg commit -m "commit #1"
299 $ hg commit -m "commit #1"
299 $ echo This is file b22 > b
300 $ echo This is file b22 > b
300 $ hg commit -m "commit #2"
301 $ hg commit -m "commit #2"
301 $ hg update 1
302 $ hg update 1
302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
303 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
303 $ echo This is file c1 > c
304 $ echo This is file c1 > c
304 $ hg add c
305 $ hg add c
305 $ hg commit -m "commit #3"
306 $ hg commit -m "commit #3"
306 created new head
307 created new head
307 $ echo This is file b33 > b
308 $ echo This is file b33 > b
308 merge of b should fail
309 merge of b should fail
309 $ hg merge 2
310 $ hg merge 2
310 abort: uncommitted changes
311 abort: uncommitted changes
311 (use 'hg status' to list changes)
312 (use 'hg status' to list changes)
312 [255]
313 [255]
313 merge of b expected
314 merge of b expected
314 $ hg merge -f 2
315 $ hg merge -f 2
315 merging b
316 merging b
316 merging for b
317 merging for b
317 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
318 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
318 (branch merge, don't forget to commit)
319 (branch merge, don't forget to commit)
319 $ hg diff --nodates
320 $ hg diff --nodates
320 diff -r 85de557015a8 b
321 diff -r 85de557015a8 b
321 --- a/b
322 --- a/b
322 +++ b/b
323 +++ b/b
323 @@ -1,1 +1,1 @@
324 @@ -1,1 +1,1 @@
324 -This is file b1
325 -This is file b1
325 +This is file b33
326 +This is file b33
326 $ hg status
327 $ hg status
327 M b
328 M b
328
329
329 Test for issue2364
330 Test for issue2364
330
331
331 $ hg up -qC .
332 $ hg up -qC .
332 $ hg rm b
333 $ hg rm b
333 $ hg ci -md
334 $ hg ci -md
334 $ hg revert -r -2 b
335 $ hg revert -r -2 b
335 $ hg up -q -- -2
336 $ hg up -q -- -2
336
337
337 Test that updated files are treated as "modified", when
338 Test that updated files are treated as "modified", when
338 'merge.update()' is aborted before 'merge.recordupdates()' (= parents
339 'merge.update()' is aborted before 'merge.recordupdates()' (= parents
339 aren't changed), even if none of mode, size and timestamp of them
340 aren't changed), even if none of mode, size and timestamp of them
340 isn't changed on the filesystem (see also issue4583).
341 isn't changed on the filesystem (see also issue4583).
341
342
342 $ cat > $TESTTMP/abort.py <<EOF
343 $ cat > $TESTTMP/abort.py <<EOF
343 > from __future__ import absolute_import
344 > from __future__ import absolute_import
344 > # emulate aborting before "recordupdates()". in this case, files
345 > # emulate aborting before "recordupdates()". in this case, files
345 > # are changed without updating dirstate
346 > # are changed without updating dirstate
346 > from mercurial import (
347 > from mercurial import (
347 > error,
348 > error,
348 > extensions,
349 > extensions,
349 > merge,
350 > merge,
350 > )
351 > )
351 > def applyupdates(orig, *args, **kwargs):
352 > def applyupdates(orig, *args, **kwargs):
352 > orig(*args, **kwargs)
353 > orig(*args, **kwargs)
353 > raise error.Abort('intentional aborting')
354 > raise error.Abort('intentional aborting')
354 > def extsetup(ui):
355 > def extsetup(ui):
355 > extensions.wrapfunction(merge, "applyupdates", applyupdates)
356 > extensions.wrapfunction(merge, "applyupdates", applyupdates)
356 > EOF
357 > EOF
357
358
358 $ cat >> .hg/hgrc <<EOF
359 $ cat >> .hg/hgrc <<EOF
359 > [fakedirstatewritetime]
360 > [fakedirstatewritetime]
360 > # emulate invoking dirstate.write() via repo.status()
361 > # emulate invoking dirstate.write() via repo.status()
361 > # at 2000-01-01 00:00
362 > # at 2000-01-01 00:00
362 > fakenow = 200001010000
363 > fakenow = 200001010000
363 > EOF
364 > EOF
364
365
365 (file gotten from other revision)
366 (file gotten from other revision)
366
367
367 $ hg update -q -C 2
368 $ hg update -q -C 2
368 $ echo 'THIS IS FILE B5' > b
369 $ echo 'THIS IS FILE B5' > b
369 $ hg commit -m 'commit #5'
370 $ hg commit -m 'commit #5'
370
371
371 $ hg update -q -C 3
372 $ hg update -q -C 3
372 $ cat b
373 $ cat b
373 This is file b1
374 This is file b1
374 $ touch -t 200001010000 b
375 $ touch -t 200001010000 b
375 $ hg debugrebuildstate
376 $ hg debugrebuildstate
376
377
377 $ cat >> .hg/hgrc <<EOF
378 $ cat >> .hg/hgrc <<EOF
378 > [extensions]
379 > [extensions]
379 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
380 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
380 > abort = $TESTTMP/abort.py
381 > abort = $TESTTMP/abort.py
381 > EOF
382 > EOF
382 $ hg merge 5
383 $ hg merge 5
383 abort: intentional aborting
384 abort: intentional aborting
384 [255]
385 [255]
385 $ cat >> .hg/hgrc <<EOF
386 $ cat >> .hg/hgrc <<EOF
386 > [extensions]
387 > [extensions]
387 > fakedirstatewritetime = !
388 > fakedirstatewritetime = !
388 > abort = !
389 > abort = !
389 > EOF
390 > EOF
390
391
391 $ cat b
392 $ cat b
392 THIS IS FILE B5
393 THIS IS FILE B5
393 $ touch -t 200001010000 b
394 $ touch -t 200001010000 b
394 $ hg status -A b
395 $ hg status -A b
395 M b
396 M b
396
397
397 (file merged from other revision)
398 (file merged from other revision)
398
399
399 $ hg update -q -C 3
400 $ hg update -q -C 3
400 $ echo 'this is file b6' > b
401 $ echo 'this is file b6' > b
401 $ hg commit -m 'commit #6'
402 $ hg commit -m 'commit #6'
402 created new head
403 created new head
403
404
404 $ cat b
405 $ cat b
405 this is file b6
406 this is file b6
406 $ touch -t 200001010000 b
407 $ touch -t 200001010000 b
407 $ hg debugrebuildstate
408 $ hg debugrebuildstate
408
409
409 $ cat >> .hg/hgrc <<EOF
410 $ cat >> .hg/hgrc <<EOF
410 > [extensions]
411 > [extensions]
411 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
412 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
412 > abort = $TESTTMP/abort.py
413 > abort = $TESTTMP/abort.py
413 > EOF
414 > EOF
414 $ hg merge --tool internal:other 5
415 $ hg merge --tool internal:other 5
415 abort: intentional aborting
416 abort: intentional aborting
416 [255]
417 [255]
417 $ cat >> .hg/hgrc <<EOF
418 $ cat >> .hg/hgrc <<EOF
418 > [extensions]
419 > [extensions]
419 > fakedirstatewritetime = !
420 > fakedirstatewritetime = !
420 > abort = !
421 > abort = !
421 > EOF
422 > EOF
422
423
423 $ cat b
424 $ cat b
424 THIS IS FILE B5
425 THIS IS FILE B5
425 $ touch -t 200001010000 b
426 $ touch -t 200001010000 b
426 $ hg status -A b
427 $ hg status -A b
427 M b
428 M b
428
429
429 $ cd ..
430 $ cd ..
@@ -1,99 +1,106 b''
1 Path conflict checking is currently disabled by default because of issue5716.
2 Turn it on for this test.
3
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > merge.checkpathconflicts=True
7 > EOF
8
1 $ hg init repo
9 $ hg init repo
2 $ cd repo
10 $ cd repo
3 $ echo base > base
11 $ echo base > base
4 $ hg add base
12 $ hg add base
5 $ hg commit -m "base"
13 $ hg commit -m "base"
6 $ hg bookmark -i base
14 $ hg bookmark -i base
7 $ echo 1 > a
15 $ echo 1 > a
8 $ hg add a
16 $ hg add a
9 $ hg commit -m "file"
17 $ hg commit -m "file"
10 $ hg bookmark -i file
18 $ hg bookmark -i file
11 $ echo 2 > a
19 $ echo 2 > a
12 $ hg commit -m "file2"
20 $ hg commit -m "file2"
13 $ hg bookmark -i file2
21 $ hg bookmark -i file2
14 $ hg up -q 0
22 $ hg up -q 0
15 $ mkdir a
23 $ mkdir a
16 $ echo 2 > a/b
24 $ echo 2 > a/b
17 $ hg add a/b
25 $ hg add a/b
18 $ hg commit -m "dir"
26 $ hg commit -m "dir"
19 created new head
27 created new head
20 $ hg bookmark -i dir
28 $ hg bookmark -i dir
21
29
22 Basic merge - local file conflicts with remote directory
30 Basic merge - local file conflicts with remote directory
23
31
24 $ hg up -q file
32 $ hg up -q file
25 $ hg bookmark -i
33 $ hg bookmark -i
26 $ hg merge --verbose dir
34 $ hg merge --verbose dir
27 resolving manifests
35 resolving manifests
28 a: path conflict - a file or link has the same name as a directory
36 a: path conflict - a file or link has the same name as a directory
29 the local file has been renamed to a~853701544ac3
37 the local file has been renamed to a~853701544ac3
30 resolve manually then use 'hg resolve --mark a'
38 resolve manually then use 'hg resolve --mark a'
31 moving a to a~853701544ac3
39 moving a to a~853701544ac3
32 getting a/b
40 getting a/b
33 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
41 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
34 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
42 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
35 [1]
43 [1]
36 $ hg update --clean .
44 $ hg update --clean .
37 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
45 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
38 $ rm a~853701544ac3
46 $ rm a~853701544ac3
39
47
40 Basic update - local directory conflicts with remote file
48 Basic update - local directory conflicts with remote file
41
49
42 $ hg up -q 0
50 $ hg up -q 0
43 $ mkdir a
51 $ mkdir a
44 $ echo 3 > a/b
52 $ echo 3 > a/b
45 $ hg up file
53 $ hg up file
46 a: untracked directory conflicts with file
54 a: untracked directory conflicts with file
47 abort: untracked files in working directory differ from files in requested revision
55 abort: untracked files in working directory differ from files in requested revision
48 [255]
56 [255]
49 $ hg up --clean file
57 $ hg up --clean file
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 (activating bookmark file)
59 (activating bookmark file)
52
60
53 Repo state is ok
61 Repo state is ok
54
62
55 $ hg sum
63 $ hg sum
56 parent: 1:853701544ac3
64 parent: 1:853701544ac3
57 file
65 file
58 branch: default
66 branch: default
59 bookmarks: *file
67 bookmarks: *file
60 commit: (clean)
68 commit: (clean)
61 update: 2 new changesets (update)
69 update: 2 new changesets (update)
62 phases: 4 draft
70 phases: 4 draft
63
71
64 Basic update - untracked file conflicts with remote directory
72 Basic update - untracked file conflicts with remote directory
65
73
66 $ hg up -q 0
74 $ hg up -q 0
67 $ echo untracked > a
75 $ echo untracked > a
68 $ hg up --config merge.checkunknown=warn dir
76 $ hg up --config merge.checkunknown=warn dir
69 a: replacing untracked file
77 a: replacing untracked file
70 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 (activating bookmark dir)
79 (activating bookmark dir)
72 $ cat a.orig
80 $ cat a.orig
73 untracked
81 untracked
74 $ rm -f a.orig
82 $ rm -f a.orig
75
83
76 Basic clean update - local directory conflicts with changed remote file
84 Basic clean update - local directory conflicts with changed remote file
77
85
78 $ hg up -q file
86 $ hg up -q file
79 $ rm a
87 $ rm a
80 $ mkdir a
88 $ mkdir a
81 $ echo 4 > a/b
89 $ echo 4 > a/b
82 $ hg up file2
90 $ hg up file2
83 abort: *: '$TESTTMP/repo/a' (glob)
91 abort: *: '$TESTTMP/repo/a' (glob)
84 [255]
92 [255]
85 $ hg up --clean file2
93 $ hg up --clean file2
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 (activating bookmark file2)
95 (activating bookmark file2)
88
96
89 Repo state is ok
97 Repo state is ok
90
98
91 $ hg sum
99 $ hg sum
92 parent: 2:f64e09fac717
100 parent: 2:f64e09fac717
93 file2
101 file2
94 branch: default
102 branch: default
95 bookmarks: *file2
103 bookmarks: *file2
96 commit: (clean)
104 commit: (clean)
97 update: 1 new changesets, 2 branch heads (merge)
105 update: 1 new changesets, 2 branch heads (merge)
98 phases: 4 draft
106 phases: 4 draft
99
@@ -1,128 +1,136 b''
1 Path conflict checking is currently disabled by default because of issue5716.
2 Turn it on for this test.
3
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > merge.checkpathconflicts=True
7 > EOF
8
1 $ hg init repo
9 $ hg init repo
2 $ cd repo
10 $ cd repo
3 $ echo base > base
11 $ echo base > base
4 $ hg add base
12 $ hg add base
5 $ hg commit -m "base"
13 $ hg commit -m "base"
6 $ hg bookmark -i base
14 $ hg bookmark -i base
7 $ mkdir a
15 $ mkdir a
8 $ echo 1 > a/b
16 $ echo 1 > a/b
9 $ hg add a/b
17 $ hg add a/b
10 $ hg commit -m "file"
18 $ hg commit -m "file"
11 $ hg bookmark -i file
19 $ hg bookmark -i file
12 $ echo 2 > a/b
20 $ echo 2 > a/b
13 $ hg commit -m "file2"
21 $ hg commit -m "file2"
14 $ hg bookmark -i file2
22 $ hg bookmark -i file2
15 $ hg up 0
23 $ hg up 0
16 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
17 $ mkdir a
25 $ mkdir a
18 $ ln -s c a/b
26 $ ln -s c a/b
19 $ hg add a/b
27 $ hg add a/b
20 $ hg commit -m "link"
28 $ hg commit -m "link"
21 created new head
29 created new head
22 $ hg bookmark -i link
30 $ hg bookmark -i link
23 $ hg up 0
31 $ hg up 0
24 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
32 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 $ mkdir -p a/b/c
33 $ mkdir -p a/b/c
26 $ echo 2 > a/b/c/d
34 $ echo 2 > a/b/c/d
27 $ hg add a/b/c/d
35 $ hg add a/b/c/d
28 $ hg commit -m "dir"
36 $ hg commit -m "dir"
29 created new head
37 created new head
30 $ hg bookmark -i dir
38 $ hg bookmark -i dir
31
39
32 Merge - local file conflicts with remote directory
40 Merge - local file conflicts with remote directory
33
41
34 $ hg up file
42 $ hg up file
35 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
43 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
36 (activating bookmark file)
44 (activating bookmark file)
37 $ hg bookmark -i
45 $ hg bookmark -i
38 $ hg merge --verbose dir
46 $ hg merge --verbose dir
39 resolving manifests
47 resolving manifests
40 a/b: path conflict - a file or link has the same name as a directory
48 a/b: path conflict - a file or link has the same name as a directory
41 the local file has been renamed to a/b~0ed027b96f31
49 the local file has been renamed to a/b~0ed027b96f31
42 resolve manually then use 'hg resolve --mark a/b'
50 resolve manually then use 'hg resolve --mark a/b'
43 moving a/b to a/b~0ed027b96f31 (glob)
51 moving a/b to a/b~0ed027b96f31 (glob)
44 getting a/b/c/d
52 getting a/b/c/d
45 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
53 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
46 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
54 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
47 [1]
55 [1]
48 $ hg status
56 $ hg status
49 M a/b/c/d
57 M a/b/c/d
50 A a/b~0ed027b96f31
58 A a/b~0ed027b96f31
51 R a/b
59 R a/b
52 $ hg resolve --all
60 $ hg resolve --all
53 a/b: path conflict must be resolved manually
61 a/b: path conflict must be resolved manually
54 $ hg forget a/b~0ed027b96f31 && rm a/b~0ed027b96f31
62 $ hg forget a/b~0ed027b96f31 && rm a/b~0ed027b96f31
55 $ hg resolve --mark a/b
63 $ hg resolve --mark a/b
56 (no more unresolved files)
64 (no more unresolved files)
57 $ hg commit -m "merge file and dir (deleted file)"
65 $ hg commit -m "merge file and dir (deleted file)"
58
66
59 Merge - local symlink conflicts with remote directory
67 Merge - local symlink conflicts with remote directory
60
68
61 $ hg up link
69 $ hg up link
62 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
70 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
63 (activating bookmark link)
71 (activating bookmark link)
64 $ hg bookmark -i
72 $ hg bookmark -i
65 $ hg merge dir
73 $ hg merge dir
66 a/b: path conflict - a file or link has the same name as a directory
74 a/b: path conflict - a file or link has the same name as a directory
67 the local file has been renamed to a/b~2ea68033e3be
75 the local file has been renamed to a/b~2ea68033e3be
68 resolve manually then use 'hg resolve --mark a/b'
76 resolve manually then use 'hg resolve --mark a/b'
69 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
77 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
70 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
78 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
71 [1]
79 [1]
72 $ hg status
80 $ hg status
73 M a/b/c/d
81 M a/b/c/d
74 A a/b~2ea68033e3be
82 A a/b~2ea68033e3be
75 R a/b
83 R a/b
76 $ hg resolve --list
84 $ hg resolve --list
77 P a/b
85 P a/b
78 $ hg resolve --all
86 $ hg resolve --all
79 a/b: path conflict must be resolved manually
87 a/b: path conflict must be resolved manually
80 $ hg mv a/b~2ea68033e3be a/b.old
88 $ hg mv a/b~2ea68033e3be a/b.old
81 $ hg resolve --mark a/b
89 $ hg resolve --mark a/b
82 (no more unresolved files)
90 (no more unresolved files)
83 $ hg resolve --list
91 $ hg resolve --list
84 R a/b
92 R a/b
85 $ hg commit -m "merge link and dir (renamed link)"
93 $ hg commit -m "merge link and dir (renamed link)"
86
94
87 Merge - local directory conflicts with remote file or link
95 Merge - local directory conflicts with remote file or link
88
96
89 $ hg up dir
97 $ hg up dir
90 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
98 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
91 (activating bookmark dir)
99 (activating bookmark dir)
92 $ hg bookmark -i
100 $ hg bookmark -i
93 $ hg merge file
101 $ hg merge file
94 a/b: path conflict - a file or link has the same name as a directory
102 a/b: path conflict - a file or link has the same name as a directory
95 the remote file has been renamed to a/b~0ed027b96f31
103 the remote file has been renamed to a/b~0ed027b96f31
96 resolve manually then use 'hg resolve --mark a/b'
104 resolve manually then use 'hg resolve --mark a/b'
97 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
105 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
98 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
106 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
99 [1]
107 [1]
100 $ hg status
108 $ hg status
101 A a/b~0ed027b96f31
109 A a/b~0ed027b96f31
102 $ hg resolve --all
110 $ hg resolve --all
103 a/b: path conflict must be resolved manually
111 a/b: path conflict must be resolved manually
104 $ hg mv a/b~0ed027b96f31 a/b/old-b
112 $ hg mv a/b~0ed027b96f31 a/b/old-b
105 $ hg resolve --mark a/b
113 $ hg resolve --mark a/b
106 (no more unresolved files)
114 (no more unresolved files)
107 $ hg commit -m "merge dir and file (move file into dir)"
115 $ hg commit -m "merge dir and file (move file into dir)"
108 created new head
116 created new head
109 $ hg merge file2
117 $ hg merge file2
110 merging a/b/old-b and a/b to a/b/old-b
118 merging a/b/old-b and a/b to a/b/old-b
111 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
119 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
112 (branch merge, don't forget to commit)
120 (branch merge, don't forget to commit)
113 $ cat a/b/old-b
121 $ cat a/b/old-b
114 2
122 2
115 $ hg commit -m "merge file2 (copytrace tracked rename)"
123 $ hg commit -m "merge file2 (copytrace tracked rename)"
116 $ hg merge link
124 $ hg merge link
117 a/b: path conflict - a file or link has the same name as a directory
125 a/b: path conflict - a file or link has the same name as a directory
118 the remote file has been renamed to a/b~2ea68033e3be
126 the remote file has been renamed to a/b~2ea68033e3be
119 resolve manually then use 'hg resolve --mark a/b'
127 resolve manually then use 'hg resolve --mark a/b'
120 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
128 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
121 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
129 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
122 [1]
130 [1]
123 $ hg mv a/b~2ea68033e3be a/b.old
131 $ hg mv a/b~2ea68033e3be a/b.old
124 $ readlink.py a/b.old
132 $ readlink.py a/b.old
125 a/b.old -> c
133 a/b.old -> c
126 $ hg resolve --mark a/b
134 $ hg resolve --mark a/b
127 (no more unresolved files)
135 (no more unresolved files)
128 $ hg commit -m "merge link (rename link)"
136 $ hg commit -m "merge link (rename link)"
@@ -1,153 +1,160 b''
1 Path conflict checking is currently disabled by default because of issue5716.
2 Turn it on for this test.
3
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > merge.checkpathconflicts=True
7 > EOF
8
1 $ hg init repo
9 $ hg init repo
2 $ cd repo
10 $ cd repo
3 $ echo base > base
11 $ echo base > base
4 $ hg add base
12 $ hg add base
5 $ hg commit -m "base"
13 $ hg commit -m "base"
6 $ hg bookmark -i base
14 $ hg bookmark -i base
7 $ mkdir a
15 $ mkdir a
8 $ echo 1 > a/b
16 $ echo 1 > a/b
9 $ hg add a/b
17 $ hg add a/b
10 $ hg commit -m "file"
18 $ hg commit -m "file"
11 $ hg bookmark -i file
19 $ hg bookmark -i file
12 $ echo 2 > a/b
20 $ echo 2 > a/b
13 $ hg commit -m "file2"
21 $ hg commit -m "file2"
14 $ hg bookmark -i file2
22 $ hg bookmark -i file2
15 $ hg up 0
23 $ hg up 0
16 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
17 $ mkdir a
25 $ mkdir a
18 #if symlink
26 #if symlink
19 $ ln -s c a/b
27 $ ln -s c a/b
20 #else
28 #else
21 $ touch a/b
29 $ touch a/b
22 #endif
30 #endif
23 $ hg add a/b
31 $ hg add a/b
24 $ hg commit -m "link"
32 $ hg commit -m "link"
25 created new head
33 created new head
26 $ hg bookmark -i link
34 $ hg bookmark -i link
27 $ hg up 0
35 $ hg up 0
28 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
36 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
29 $ mkdir -p a/b/c
37 $ mkdir -p a/b/c
30 $ echo 2 > a/b/c/d
38 $ echo 2 > a/b/c/d
31 $ hg add a/b/c/d
39 $ hg add a/b/c/d
32 $ hg commit -m "dir"
40 $ hg commit -m "dir"
33 created new head
41 created new head
34 $ hg bookmark -i dir
42 $ hg bookmark -i dir
35
43
36 Update - local file conflicts with remote directory:
44 Update - local file conflicts with remote directory:
37
45
38 $ hg up -q 0
46 $ hg up -q 0
39 $ mkdir a
47 $ mkdir a
40 $ echo 9 > a/b
48 $ echo 9 > a/b
41 $ hg up dir
49 $ hg up dir
42 a/b: untracked file conflicts with directory
50 a/b: untracked file conflicts with directory
43 abort: untracked files in working directory differ from files in requested revision
51 abort: untracked files in working directory differ from files in requested revision
44 [255]
52 [255]
45 $ hg up dir --config merge.checkunknown=warn
53 $ hg up dir --config merge.checkunknown=warn
46 a/b: replacing untracked file
54 a/b: replacing untracked file
47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 (activating bookmark dir)
56 (activating bookmark dir)
49 $ cat a/b.orig
57 $ cat a/b.orig
50 9
58 9
51 $ rm a/b.orig
59 $ rm a/b.orig
52
60
53 Update - local symlink conflicts with remote directory:
61 Update - local symlink conflicts with remote directory:
54
62
55 $ hg up -q 0
63 $ hg up -q 0
56 $ mkdir a
64 $ mkdir a
57 #if symlink
65 #if symlink
58 $ ln -s x a/b
66 $ ln -s x a/b
59 #else
67 #else
60 $ touch a/b
68 $ touch a/b
61 #endif
69 #endif
62 $ hg up dir
70 $ hg up dir
63 a/b: untracked file conflicts with directory
71 a/b: untracked file conflicts with directory
64 abort: untracked files in working directory differ from files in requested revision
72 abort: untracked files in working directory differ from files in requested revision
65 [255]
73 [255]
66 $ hg up dir --config merge.checkunknown=warn
74 $ hg up dir --config merge.checkunknown=warn
67 a/b: replacing untracked file
75 a/b: replacing untracked file
68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 (activating bookmark dir)
77 (activating bookmark dir)
70 #if symlink
78 #if symlink
71 $ readlink.py a/b.orig
79 $ readlink.py a/b.orig
72 a/b.orig -> x
80 a/b.orig -> x
73 #endif
81 #endif
74 $ rm a/b.orig
82 $ rm a/b.orig
75
83
76 Update - local directory conflicts with remote file
84 Update - local directory conflicts with remote file
77
85
78 $ hg up -q 0
86 $ hg up -q 0
79 $ mkdir -p a/b/c
87 $ mkdir -p a/b/c
80 $ echo 9 > a/b/c/d
88 $ echo 9 > a/b/c/d
81 $ hg up file
89 $ hg up file
82 a/b: untracked directory conflicts with file
90 a/b: untracked directory conflicts with file
83 abort: untracked files in working directory differ from files in requested revision
91 abort: untracked files in working directory differ from files in requested revision
84 [255]
92 [255]
85 $ hg up file --config merge.checkunknown=warn
93 $ hg up file --config merge.checkunknown=warn
86 a/b: replacing untracked files in directory
94 a/b: replacing untracked files in directory
87 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 (activating bookmark file)
96 (activating bookmark file)
89 $ cat a/b
97 $ cat a/b
90 1
98 1
91 $ test -d a/b.orig
99 $ test -d a/b.orig
92 $ rm -rf a/b.orig
100 $ rm -rf a/b.orig
93
101
94 Update - local directory conflicts with remote symlink
102 Update - local directory conflicts with remote symlink
95
103
96 $ hg up -q 0
104 $ hg up -q 0
97 $ mkdir -p a/b/c
105 $ mkdir -p a/b/c
98 $ echo 9 > a/b/c/d
106 $ echo 9 > a/b/c/d
99 $ hg up link
107 $ hg up link
100 a/b: untracked directory conflicts with file
108 a/b: untracked directory conflicts with file
101 abort: untracked files in working directory differ from files in requested revision
109 abort: untracked files in working directory differ from files in requested revision
102 [255]
110 [255]
103 $ hg up link --config merge.checkunknown=warn
111 $ hg up link --config merge.checkunknown=warn
104 a/b: replacing untracked files in directory
112 a/b: replacing untracked files in directory
105 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
113 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 (activating bookmark link)
114 (activating bookmark link)
107 #if symlink
115 #if symlink
108 $ readlink.py a/b
116 $ readlink.py a/b
109 a/b -> c
117 a/b -> c
110 #endif
118 #endif
111 $ test -d a/b.orig
119 $ test -d a/b.orig
112 $ rm -rf a/b.orig
120 $ rm -rf a/b.orig
113
121
114 Update - local renamed file conflicts with remote directory
122 Update - local renamed file conflicts with remote directory
115
123
116 $ hg up -q 0
124 $ hg up -q 0
117 $ hg mv base a
125 $ hg mv base a
118 $ hg status -C
126 $ hg status -C
119 A a
127 A a
120 base
128 base
121 R base
129 R base
122 $ hg up --check dir
130 $ hg up --check dir
123 abort: uncommitted changes
131 abort: uncommitted changes
124 [255]
132 [255]
125 $ hg up dir
133 $ hg up dir
126 a: path conflict - a file or link has the same name as a directory
134 a: path conflict - a file or link has the same name as a directory
127 the local file has been renamed to a~d20a80d4def3
135 the local file has been renamed to a~d20a80d4def3
128 resolve manually then use 'hg resolve --mark a'
136 resolve manually then use 'hg resolve --mark a'
129 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
137 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
130 use 'hg resolve' to retry unresolved file merges
138 use 'hg resolve' to retry unresolved file merges
131 (activating bookmark dir)
139 (activating bookmark dir)
132 [1]
140 [1]
133 $ hg status -C
141 $ hg status -C
134 A a~d20a80d4def3
142 A a~d20a80d4def3
135 base
143 base
136 R base
144 R base
137 $ hg resolve --list
145 $ hg resolve --list
138 P a
146 P a
139 $ hg up --clean -q 0
147 $ hg up --clean -q 0
140
148
141 Update clean - local directory conflicts with changed remote file
149 Update clean - local directory conflicts with changed remote file
142
150
143 $ hg up -q file
151 $ hg up -q file
144 $ rm a/b
152 $ rm a/b
145 $ mkdir a/b
153 $ mkdir a/b
146 $ echo 9 > a/b/c
154 $ echo 9 > a/b/c
147 $ hg up file2 --check --config merge.checkunknown=warn
155 $ hg up file2 --check --config merge.checkunknown=warn
148 abort: uncommitted changes
156 abort: uncommitted changes
149 [255]
157 [255]
150 $ hg up file2 --clean
158 $ hg up file2 --clean
151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 (activating bookmark file2)
160 (activating bookmark file2)
153
@@ -1,91 +1,89 b''
1 Test update logic when there are renames or weird same-name cases between dirs
1 Test update logic when there are renames or weird same-name cases between dirs
2 and files
2 and files
3
3
4 Update with local changes across a file rename
4 Update with local changes across a file rename
5
5
6 $ hg init r1 && cd r1
6 $ hg init r1 && cd r1
7
7
8 $ echo a > a
8 $ echo a > a
9 $ hg add a
9 $ hg add a
10 $ hg ci -m a
10 $ hg ci -m a
11
11
12 $ hg mv a b
12 $ hg mv a b
13 $ hg ci -m rename
13 $ hg ci -m rename
14
14
15 $ echo b > b
15 $ echo b > b
16 $ hg ci -m change
16 $ hg ci -m change
17
17
18 $ hg up -q 0
18 $ hg up -q 0
19
19
20 $ echo c > a
20 $ echo c > a
21
21
22 $ hg up
22 $ hg up
23 merging a and b to b
23 merging a and b to b
24 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
24 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
25 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
25 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
26 use 'hg resolve' to retry unresolved file merges
26 use 'hg resolve' to retry unresolved file merges
27 [1]
27 [1]
28
28
29 Test update when local untracked directory exists with the same name as a
29 Test update when local untracked directory exists with the same name as a
30 tracked file in a commit we are updating to
30 tracked file in a commit we are updating to
31 $ hg init r2 && cd r2
31 $ hg init r2 && cd r2
32 $ echo root > root && hg ci -Am root # rev 0
32 $ echo root > root && hg ci -Am root # rev 0
33 adding root
33 adding root
34 $ echo text > name && hg ci -Am "name is a file" # rev 1
34 $ echo text > name && hg ci -Am "name is a file" # rev 1
35 adding name
35 adding name
36 $ hg up 0
36 $ hg up 0
37 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
37 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
38 $ mkdir name
38 $ mkdir name
39 $ hg up 1
39 $ hg up 1
40 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41
41
42 Test update when local untracked directory exists with some files in it and has
42 Test update when local untracked directory exists with some files in it and has
43 the same name a tracked file in a commit we are updating to. In future this
43 the same name a tracked file in a commit we are updating to. In future this
44 should be updated to give an friendlier error message, but now we should just
44 should be updated to give an friendlier error message, but now we should just
45 make sure that this does not erase untracked data
45 make sure that this does not erase untracked data
46 $ hg up 0
46 $ hg up 0
47 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
47 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
48 $ mkdir name
48 $ mkdir name
49 $ echo text > name/file
49 $ echo text > name/file
50 $ hg st
50 $ hg st
51 ? name/file
51 ? name/file
52 $ hg up 1
52 $ hg up 1
53 name: untracked directory conflicts with file
53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 abort: untracked files in working directory differ from files in requested revision
55 [255]
56 $ cd ..
54 $ cd ..
57
55
58 #if symlink
56 #if symlink
59
57
60 Test update when two commits have symlinks that point to different folders
58 Test update when two commits have symlinks that point to different folders
61 $ hg init r3 && cd r3
59 $ hg init r3 && cd r3
62 $ echo root > root && hg ci -Am root
60 $ echo root > root && hg ci -Am root
63 adding root
61 adding root
64 $ mkdir folder1 && mkdir folder2
62 $ mkdir folder1 && mkdir folder2
65 $ ln -s folder1 folder
63 $ ln -s folder1 folder
66 $ hg ci -Am "symlink to folder1"
64 $ hg ci -Am "symlink to folder1"
67 adding folder
65 adding folder
68 $ rm folder
66 $ rm folder
69 $ ln -s folder2 folder
67 $ ln -s folder2 folder
70 $ hg ci -Am "symlink to folder2"
68 $ hg ci -Am "symlink to folder2"
71 $ hg up 1
69 $ hg up 1
72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 $ cd ..
71 $ cd ..
74
72
75 #endif
73 #endif
76
74
77 #if rmcwd
75 #if rmcwd
78
76
79 Test that warning is printed if cwd is deleted during update
77 Test that warning is printed if cwd is deleted during update
80 $ hg init r4 && cd r4
78 $ hg init r4 && cd r4
81 $ mkdir dir
79 $ mkdir dir
82 $ cd dir
80 $ cd dir
83 $ echo a > a
81 $ echo a > a
84 $ echo b > b
82 $ echo b > b
85 $ hg add a b
83 $ hg add a b
86 $ hg ci -m "file and dir"
84 $ hg ci -m "file and dir"
87 $ hg up -q null
85 $ hg up -q null
88 current directory was removed
86 current directory was removed
89 (consider changing to repo root: $TESTTMP/r1/r4)
87 (consider changing to repo root: $TESTTMP/r1/r4)
90
88
91 #endif
89 #endif
General Comments 0
You need to be logged in to leave comments. Login now