##// END OF EJS Templates
stable: merge with security patches
Augie Fackler -
r34991:cabc840f merge 4.4.1 stable
parent child Browse files
Show More
@@ -0,0 +1,132 b''
1 Test illegal name
2 -----------------
3
4 on commit:
5
6 $ hg init hgname
7 $ cd hgname
8 $ mkdir sub
9 $ hg init sub/.hg
10 $ echo 'sub/.hg = sub/.hg' >> .hgsub
11 $ hg ci -qAm 'add subrepo "sub/.hg"'
12 abort: path 'sub/.hg' is inside nested repo 'sub'
13 [255]
14
15 prepare tampered repo (including the commit above):
16
17 $ hg import --bypass -qm 'add subrepo "sub/.hg"' - <<'EOF'
18 > diff --git a/.hgsub b/.hgsub
19 > new file mode 100644
20 > --- /dev/null
21 > +++ b/.hgsub
22 > @@ -0,0 +1,1 @@
23 > +sub/.hg = sub/.hg
24 > diff --git a/.hgsubstate b/.hgsubstate
25 > new file mode 100644
26 > --- /dev/null
27 > +++ b/.hgsubstate
28 > @@ -0,0 +1,1 @@
29 > +0000000000000000000000000000000000000000 sub/.hg
30 > EOF
31 $ cd ..
32
33 on clone (and update):
34
35 $ hg clone -q hgname hgname2
36 abort: path 'sub/.hg' is inside nested repo 'sub'
37 [255]
38
39 Test direct symlink traversal
40 -----------------------------
41
42 #if symlink
43
44 on commit:
45
46 $ mkdir hgsymdir
47 $ hg init hgsymdir/root
48 $ cd hgsymdir/root
49 $ ln -s ../out
50 $ hg ci -qAm 'add symlink "out"'
51 $ hg init ../out
52 $ echo 'out = out' >> .hgsub
53 $ hg ci -qAm 'add subrepo "out"'
54 abort: subrepo 'out' traverses symbolic link
55 [255]
56
57 prepare tampered repo (including the commit above):
58
59 $ hg import --bypass -qm 'add subrepo "out"' - <<'EOF'
60 > diff --git a/.hgsub b/.hgsub
61 > new file mode 100644
62 > --- /dev/null
63 > +++ b/.hgsub
64 > @@ -0,0 +1,1 @@
65 > +out = out
66 > diff --git a/.hgsubstate b/.hgsubstate
67 > new file mode 100644
68 > --- /dev/null
69 > +++ b/.hgsubstate
70 > @@ -0,0 +1,1 @@
71 > +0000000000000000000000000000000000000000 out
72 > EOF
73 $ cd ../..
74
75 on clone (and update):
76
77 $ mkdir hgsymdir2
78 $ hg clone -q hgsymdir/root hgsymdir2/root
79 abort: subrepo 'out' traverses symbolic link
80 [255]
81 $ ls hgsymdir2
82 root
83
84 #endif
85
86 Test indirect symlink traversal
87 -------------------------------
88
89 #if symlink
90
91 on commit:
92
93 $ mkdir hgsymin
94 $ hg init hgsymin/root
95 $ cd hgsymin/root
96 $ ln -s ../out
97 $ hg ci -qAm 'add symlink "out"'
98 $ mkdir ../out
99 $ hg init ../out/sub
100 $ echo 'out/sub = out/sub' >> .hgsub
101 $ hg ci -qAm 'add subrepo "out/sub"'
102 abort: path 'out/sub' traverses symbolic link 'out'
103 [255]
104
105 prepare tampered repo (including the commit above):
106
107 $ hg import --bypass -qm 'add subrepo "out/sub"' - <<'EOF'
108 > diff --git a/.hgsub b/.hgsub
109 > new file mode 100644
110 > --- /dev/null
111 > +++ b/.hgsub
112 > @@ -0,0 +1,1 @@
113 > +out/sub = out/sub
114 > diff --git a/.hgsubstate b/.hgsubstate
115 > new file mode 100644
116 > --- /dev/null
117 > +++ b/.hgsubstate
118 > @@ -0,0 +1,1 @@
119 > +0000000000000000000000000000000000000000 out/sub
120 > EOF
121 $ cd ../..
122
123 on clone (and update):
124
125 $ mkdir hgsymin2
126 $ hg clone -q hgsymin/root hgsymin2/root
127 abort: path 'out/sub' traverses symbolic link 'out'
128 [255]
129 $ ls hgsymin2
130 root
131
132 #endif
@@ -1,1152 +1,1164 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=False,
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('share', 'pool',
793 coreconfigitem('share', 'pool',
794 default=None,
794 default=None,
795 )
795 )
796 coreconfigitem('share', 'poolnaming',
796 coreconfigitem('share', 'poolnaming',
797 default='identity',
797 default='identity',
798 )
798 )
799 coreconfigitem('smtp', 'host',
799 coreconfigitem('smtp', 'host',
800 default=None,
800 default=None,
801 )
801 )
802 coreconfigitem('smtp', 'local_hostname',
802 coreconfigitem('smtp', 'local_hostname',
803 default=None,
803 default=None,
804 )
804 )
805 coreconfigitem('smtp', 'password',
805 coreconfigitem('smtp', 'password',
806 default=None,
806 default=None,
807 )
807 )
808 coreconfigitem('smtp', 'port',
808 coreconfigitem('smtp', 'port',
809 default=dynamicdefault,
809 default=dynamicdefault,
810 )
810 )
811 coreconfigitem('smtp', 'tls',
811 coreconfigitem('smtp', 'tls',
812 default='none',
812 default='none',
813 )
813 )
814 coreconfigitem('smtp', 'username',
814 coreconfigitem('smtp', 'username',
815 default=None,
815 default=None,
816 )
816 )
817 coreconfigitem('sparse', 'missingwarning',
817 coreconfigitem('sparse', 'missingwarning',
818 default=True,
818 default=True,
819 )
819 )
820 coreconfigitem('subrepos', 'allowed',
821 default=dynamicdefault, # to make backporting simpler
822 )
823 coreconfigitem('subrepos', 'hg:allowed',
824 default=dynamicdefault,
825 )
826 coreconfigitem('subrepos', 'git:allowed',
827 default=dynamicdefault,
828 )
829 coreconfigitem('subrepos', 'svn:allowed',
830 default=dynamicdefault,
831 )
820 coreconfigitem('templates', '.*',
832 coreconfigitem('templates', '.*',
821 default=None,
833 default=None,
822 generic=True,
834 generic=True,
823 )
835 )
824 coreconfigitem('trusted', 'groups',
836 coreconfigitem('trusted', 'groups',
825 default=list,
837 default=list,
826 )
838 )
827 coreconfigitem('trusted', 'users',
839 coreconfigitem('trusted', 'users',
828 default=list,
840 default=list,
829 )
841 )
830 coreconfigitem('ui', '_usedassubrepo',
842 coreconfigitem('ui', '_usedassubrepo',
831 default=False,
843 default=False,
832 )
844 )
833 coreconfigitem('ui', 'allowemptycommit',
845 coreconfigitem('ui', 'allowemptycommit',
834 default=False,
846 default=False,
835 )
847 )
836 coreconfigitem('ui', 'archivemeta',
848 coreconfigitem('ui', 'archivemeta',
837 default=True,
849 default=True,
838 )
850 )
839 coreconfigitem('ui', 'askusername',
851 coreconfigitem('ui', 'askusername',
840 default=False,
852 default=False,
841 )
853 )
842 coreconfigitem('ui', 'clonebundlefallback',
854 coreconfigitem('ui', 'clonebundlefallback',
843 default=False,
855 default=False,
844 )
856 )
845 coreconfigitem('ui', 'clonebundleprefers',
857 coreconfigitem('ui', 'clonebundleprefers',
846 default=list,
858 default=list,
847 )
859 )
848 coreconfigitem('ui', 'clonebundles',
860 coreconfigitem('ui', 'clonebundles',
849 default=True,
861 default=True,
850 )
862 )
851 coreconfigitem('ui', 'color',
863 coreconfigitem('ui', 'color',
852 default='auto',
864 default='auto',
853 )
865 )
854 coreconfigitem('ui', 'commitsubrepos',
866 coreconfigitem('ui', 'commitsubrepos',
855 default=False,
867 default=False,
856 )
868 )
857 coreconfigitem('ui', 'debug',
869 coreconfigitem('ui', 'debug',
858 default=False,
870 default=False,
859 )
871 )
860 coreconfigitem('ui', 'debugger',
872 coreconfigitem('ui', 'debugger',
861 default=None,
873 default=None,
862 )
874 )
863 coreconfigitem('ui', 'editor',
875 coreconfigitem('ui', 'editor',
864 default=dynamicdefault,
876 default=dynamicdefault,
865 )
877 )
866 coreconfigitem('ui', 'fallbackencoding',
878 coreconfigitem('ui', 'fallbackencoding',
867 default=None,
879 default=None,
868 )
880 )
869 coreconfigitem('ui', 'forcecwd',
881 coreconfigitem('ui', 'forcecwd',
870 default=None,
882 default=None,
871 )
883 )
872 coreconfigitem('ui', 'forcemerge',
884 coreconfigitem('ui', 'forcemerge',
873 default=None,
885 default=None,
874 )
886 )
875 coreconfigitem('ui', 'formatdebug',
887 coreconfigitem('ui', 'formatdebug',
876 default=False,
888 default=False,
877 )
889 )
878 coreconfigitem('ui', 'formatjson',
890 coreconfigitem('ui', 'formatjson',
879 default=False,
891 default=False,
880 )
892 )
881 coreconfigitem('ui', 'formatted',
893 coreconfigitem('ui', 'formatted',
882 default=None,
894 default=None,
883 )
895 )
884 coreconfigitem('ui', 'graphnodetemplate',
896 coreconfigitem('ui', 'graphnodetemplate',
885 default=None,
897 default=None,
886 )
898 )
887 coreconfigitem('ui', 'http2debuglevel',
899 coreconfigitem('ui', 'http2debuglevel',
888 default=None,
900 default=None,
889 )
901 )
890 coreconfigitem('ui', 'interactive',
902 coreconfigitem('ui', 'interactive',
891 default=None,
903 default=None,
892 )
904 )
893 coreconfigitem('ui', 'interface',
905 coreconfigitem('ui', 'interface',
894 default=None,
906 default=None,
895 )
907 )
896 coreconfigitem('ui', 'interface.chunkselector',
908 coreconfigitem('ui', 'interface.chunkselector',
897 default=None,
909 default=None,
898 )
910 )
899 coreconfigitem('ui', 'logblockedtimes',
911 coreconfigitem('ui', 'logblockedtimes',
900 default=False,
912 default=False,
901 )
913 )
902 coreconfigitem('ui', 'logtemplate',
914 coreconfigitem('ui', 'logtemplate',
903 default=None,
915 default=None,
904 )
916 )
905 coreconfigitem('ui', 'merge',
917 coreconfigitem('ui', 'merge',
906 default=None,
918 default=None,
907 )
919 )
908 coreconfigitem('ui', 'mergemarkers',
920 coreconfigitem('ui', 'mergemarkers',
909 default='basic',
921 default='basic',
910 )
922 )
911 coreconfigitem('ui', 'mergemarkertemplate',
923 coreconfigitem('ui', 'mergemarkertemplate',
912 default=('{node|short} '
924 default=('{node|short} '
913 '{ifeq(tags, "tip", "", '
925 '{ifeq(tags, "tip", "", '
914 'ifeq(tags, "", "", "{tags} "))}'
926 'ifeq(tags, "", "", "{tags} "))}'
915 '{if(bookmarks, "{bookmarks} ")}'
927 '{if(bookmarks, "{bookmarks} ")}'
916 '{ifeq(branch, "default", "", "{branch} ")}'
928 '{ifeq(branch, "default", "", "{branch} ")}'
917 '- {author|user}: {desc|firstline}')
929 '- {author|user}: {desc|firstline}')
918 )
930 )
919 coreconfigitem('ui', 'nontty',
931 coreconfigitem('ui', 'nontty',
920 default=False,
932 default=False,
921 )
933 )
922 coreconfigitem('ui', 'origbackuppath',
934 coreconfigitem('ui', 'origbackuppath',
923 default=None,
935 default=None,
924 )
936 )
925 coreconfigitem('ui', 'paginate',
937 coreconfigitem('ui', 'paginate',
926 default=True,
938 default=True,
927 )
939 )
928 coreconfigitem('ui', 'patch',
940 coreconfigitem('ui', 'patch',
929 default=None,
941 default=None,
930 )
942 )
931 coreconfigitem('ui', 'portablefilenames',
943 coreconfigitem('ui', 'portablefilenames',
932 default='warn',
944 default='warn',
933 )
945 )
934 coreconfigitem('ui', 'promptecho',
946 coreconfigitem('ui', 'promptecho',
935 default=False,
947 default=False,
936 )
948 )
937 coreconfigitem('ui', 'quiet',
949 coreconfigitem('ui', 'quiet',
938 default=False,
950 default=False,
939 )
951 )
940 coreconfigitem('ui', 'quietbookmarkmove',
952 coreconfigitem('ui', 'quietbookmarkmove',
941 default=False,
953 default=False,
942 )
954 )
943 coreconfigitem('ui', 'remotecmd',
955 coreconfigitem('ui', 'remotecmd',
944 default='hg',
956 default='hg',
945 )
957 )
946 coreconfigitem('ui', 'report_untrusted',
958 coreconfigitem('ui', 'report_untrusted',
947 default=True,
959 default=True,
948 )
960 )
949 coreconfigitem('ui', 'rollback',
961 coreconfigitem('ui', 'rollback',
950 default=True,
962 default=True,
951 )
963 )
952 coreconfigitem('ui', 'slash',
964 coreconfigitem('ui', 'slash',
953 default=False,
965 default=False,
954 )
966 )
955 coreconfigitem('ui', 'ssh',
967 coreconfigitem('ui', 'ssh',
956 default='ssh',
968 default='ssh',
957 )
969 )
958 coreconfigitem('ui', 'statuscopies',
970 coreconfigitem('ui', 'statuscopies',
959 default=False,
971 default=False,
960 )
972 )
961 coreconfigitem('ui', 'strict',
973 coreconfigitem('ui', 'strict',
962 default=False,
974 default=False,
963 )
975 )
964 coreconfigitem('ui', 'style',
976 coreconfigitem('ui', 'style',
965 default='',
977 default='',
966 )
978 )
967 coreconfigitem('ui', 'supportcontact',
979 coreconfigitem('ui', 'supportcontact',
968 default=None,
980 default=None,
969 )
981 )
970 coreconfigitem('ui', 'textwidth',
982 coreconfigitem('ui', 'textwidth',
971 default=78,
983 default=78,
972 )
984 )
973 coreconfigitem('ui', 'timeout',
985 coreconfigitem('ui', 'timeout',
974 default='600',
986 default='600',
975 )
987 )
976 coreconfigitem('ui', 'traceback',
988 coreconfigitem('ui', 'traceback',
977 default=False,
989 default=False,
978 )
990 )
979 coreconfigitem('ui', 'tweakdefaults',
991 coreconfigitem('ui', 'tweakdefaults',
980 default=False,
992 default=False,
981 )
993 )
982 coreconfigitem('ui', 'usehttp2',
994 coreconfigitem('ui', 'usehttp2',
983 default=False,
995 default=False,
984 )
996 )
985 coreconfigitem('ui', 'username',
997 coreconfigitem('ui', 'username',
986 alias=[('ui', 'user')]
998 alias=[('ui', 'user')]
987 )
999 )
988 coreconfigitem('ui', 'verbose',
1000 coreconfigitem('ui', 'verbose',
989 default=False,
1001 default=False,
990 )
1002 )
991 coreconfigitem('verify', 'skipflags',
1003 coreconfigitem('verify', 'skipflags',
992 default=None,
1004 default=None,
993 )
1005 )
994 coreconfigitem('web', 'allowbz2',
1006 coreconfigitem('web', 'allowbz2',
995 default=False,
1007 default=False,
996 )
1008 )
997 coreconfigitem('web', 'allowgz',
1009 coreconfigitem('web', 'allowgz',
998 default=False,
1010 default=False,
999 )
1011 )
1000 coreconfigitem('web', 'allowpull',
1012 coreconfigitem('web', 'allowpull',
1001 default=True,
1013 default=True,
1002 )
1014 )
1003 coreconfigitem('web', 'allow_push',
1015 coreconfigitem('web', 'allow_push',
1004 default=list,
1016 default=list,
1005 )
1017 )
1006 coreconfigitem('web', 'allowzip',
1018 coreconfigitem('web', 'allowzip',
1007 default=False,
1019 default=False,
1008 )
1020 )
1009 coreconfigitem('web', 'archivesubrepos',
1021 coreconfigitem('web', 'archivesubrepos',
1010 default=False,
1022 default=False,
1011 )
1023 )
1012 coreconfigitem('web', 'cache',
1024 coreconfigitem('web', 'cache',
1013 default=True,
1025 default=True,
1014 )
1026 )
1015 coreconfigitem('web', 'contact',
1027 coreconfigitem('web', 'contact',
1016 default=None,
1028 default=None,
1017 )
1029 )
1018 coreconfigitem('web', 'deny_push',
1030 coreconfigitem('web', 'deny_push',
1019 default=list,
1031 default=list,
1020 )
1032 )
1021 coreconfigitem('web', 'guessmime',
1033 coreconfigitem('web', 'guessmime',
1022 default=False,
1034 default=False,
1023 )
1035 )
1024 coreconfigitem('web', 'hidden',
1036 coreconfigitem('web', 'hidden',
1025 default=False,
1037 default=False,
1026 )
1038 )
1027 coreconfigitem('web', 'labels',
1039 coreconfigitem('web', 'labels',
1028 default=list,
1040 default=list,
1029 )
1041 )
1030 coreconfigitem('web', 'logoimg',
1042 coreconfigitem('web', 'logoimg',
1031 default='hglogo.png',
1043 default='hglogo.png',
1032 )
1044 )
1033 coreconfigitem('web', 'logourl',
1045 coreconfigitem('web', 'logourl',
1034 default='https://mercurial-scm.org/',
1046 default='https://mercurial-scm.org/',
1035 )
1047 )
1036 coreconfigitem('web', 'accesslog',
1048 coreconfigitem('web', 'accesslog',
1037 default='-',
1049 default='-',
1038 )
1050 )
1039 coreconfigitem('web', 'address',
1051 coreconfigitem('web', 'address',
1040 default='',
1052 default='',
1041 )
1053 )
1042 coreconfigitem('web', 'allow_archive',
1054 coreconfigitem('web', 'allow_archive',
1043 default=list,
1055 default=list,
1044 )
1056 )
1045 coreconfigitem('web', 'allow_read',
1057 coreconfigitem('web', 'allow_read',
1046 default=list,
1058 default=list,
1047 )
1059 )
1048 coreconfigitem('web', 'baseurl',
1060 coreconfigitem('web', 'baseurl',
1049 default=None,
1061 default=None,
1050 )
1062 )
1051 coreconfigitem('web', 'cacerts',
1063 coreconfigitem('web', 'cacerts',
1052 default=None,
1064 default=None,
1053 )
1065 )
1054 coreconfigitem('web', 'certificate',
1066 coreconfigitem('web', 'certificate',
1055 default=None,
1067 default=None,
1056 )
1068 )
1057 coreconfigitem('web', 'collapse',
1069 coreconfigitem('web', 'collapse',
1058 default=False,
1070 default=False,
1059 )
1071 )
1060 coreconfigitem('web', 'csp',
1072 coreconfigitem('web', 'csp',
1061 default=None,
1073 default=None,
1062 )
1074 )
1063 coreconfigitem('web', 'deny_read',
1075 coreconfigitem('web', 'deny_read',
1064 default=list,
1076 default=list,
1065 )
1077 )
1066 coreconfigitem('web', 'descend',
1078 coreconfigitem('web', 'descend',
1067 default=True,
1079 default=True,
1068 )
1080 )
1069 coreconfigitem('web', 'description',
1081 coreconfigitem('web', 'description',
1070 default="",
1082 default="",
1071 )
1083 )
1072 coreconfigitem('web', 'encoding',
1084 coreconfigitem('web', 'encoding',
1073 default=lambda: encoding.encoding,
1085 default=lambda: encoding.encoding,
1074 )
1086 )
1075 coreconfigitem('web', 'errorlog',
1087 coreconfigitem('web', 'errorlog',
1076 default='-',
1088 default='-',
1077 )
1089 )
1078 coreconfigitem('web', 'ipv6',
1090 coreconfigitem('web', 'ipv6',
1079 default=False,
1091 default=False,
1080 )
1092 )
1081 coreconfigitem('web', 'maxchanges',
1093 coreconfigitem('web', 'maxchanges',
1082 default=10,
1094 default=10,
1083 )
1095 )
1084 coreconfigitem('web', 'maxfiles',
1096 coreconfigitem('web', 'maxfiles',
1085 default=10,
1097 default=10,
1086 )
1098 )
1087 coreconfigitem('web', 'maxshortchanges',
1099 coreconfigitem('web', 'maxshortchanges',
1088 default=60,
1100 default=60,
1089 )
1101 )
1090 coreconfigitem('web', 'motd',
1102 coreconfigitem('web', 'motd',
1091 default='',
1103 default='',
1092 )
1104 )
1093 coreconfigitem('web', 'name',
1105 coreconfigitem('web', 'name',
1094 default=dynamicdefault,
1106 default=dynamicdefault,
1095 )
1107 )
1096 coreconfigitem('web', 'port',
1108 coreconfigitem('web', 'port',
1097 default=8000,
1109 default=8000,
1098 )
1110 )
1099 coreconfigitem('web', 'prefix',
1111 coreconfigitem('web', 'prefix',
1100 default='',
1112 default='',
1101 )
1113 )
1102 coreconfigitem('web', 'push_ssl',
1114 coreconfigitem('web', 'push_ssl',
1103 default=True,
1115 default=True,
1104 )
1116 )
1105 coreconfigitem('web', 'refreshinterval',
1117 coreconfigitem('web', 'refreshinterval',
1106 default=20,
1118 default=20,
1107 )
1119 )
1108 coreconfigitem('web', 'staticurl',
1120 coreconfigitem('web', 'staticurl',
1109 default=None,
1121 default=None,
1110 )
1122 )
1111 coreconfigitem('web', 'stripes',
1123 coreconfigitem('web', 'stripes',
1112 default=1,
1124 default=1,
1113 )
1125 )
1114 coreconfigitem('web', 'style',
1126 coreconfigitem('web', 'style',
1115 default='paper',
1127 default='paper',
1116 )
1128 )
1117 coreconfigitem('web', 'templates',
1129 coreconfigitem('web', 'templates',
1118 default=None,
1130 default=None,
1119 )
1131 )
1120 coreconfigitem('web', 'view',
1132 coreconfigitem('web', 'view',
1121 default='served',
1133 default='served',
1122 )
1134 )
1123 coreconfigitem('worker', 'backgroundclose',
1135 coreconfigitem('worker', 'backgroundclose',
1124 default=dynamicdefault,
1136 default=dynamicdefault,
1125 )
1137 )
1126 # Windows defaults to a limit of 512 open files. A buffer of 128
1138 # Windows defaults to a limit of 512 open files. A buffer of 128
1127 # should give us enough headway.
1139 # should give us enough headway.
1128 coreconfigitem('worker', 'backgroundclosemaxqueue',
1140 coreconfigitem('worker', 'backgroundclosemaxqueue',
1129 default=384,
1141 default=384,
1130 )
1142 )
1131 coreconfigitem('worker', 'backgroundcloseminfilecount',
1143 coreconfigitem('worker', 'backgroundcloseminfilecount',
1132 default=2048,
1144 default=2048,
1133 )
1145 )
1134 coreconfigitem('worker', 'backgroundclosethreadcount',
1146 coreconfigitem('worker', 'backgroundclosethreadcount',
1135 default=4,
1147 default=4,
1136 )
1148 )
1137 coreconfigitem('worker', 'numcpus',
1149 coreconfigitem('worker', 'numcpus',
1138 default=None,
1150 default=None,
1139 )
1151 )
1140
1152
1141 # Rebase related configuration moved to core because other extension are doing
1153 # Rebase related configuration moved to core because other extension are doing
1142 # strange things. For example, shelve import the extensions to reuse some bit
1154 # strange things. For example, shelve import the extensions to reuse some bit
1143 # without formally loading it.
1155 # without formally loading it.
1144 coreconfigitem('commands', 'rebase.requiredest',
1156 coreconfigitem('commands', 'rebase.requiredest',
1145 default=False,
1157 default=False,
1146 )
1158 )
1147 coreconfigitem('experimental', 'rebaseskipobsolete',
1159 coreconfigitem('experimental', 'rebaseskipobsolete',
1148 default=True,
1160 default=True,
1149 )
1161 )
1150 coreconfigitem('rebase', 'singletransaction',
1162 coreconfigitem('rebase', 'singletransaction',
1151 default=False,
1163 default=False,
1152 )
1164 )
@@ -1,2536 +1,2577 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``<internal>/default.d/*.rc`` (defaults)
64 - ``<internal>/default.d/*.rc`` (defaults)
65
65
66 .. container:: verbose.windows
66 .. container:: verbose.windows
67
67
68 On Windows, the following files are consulted:
68 On Windows, the following files are consulted:
69
69
70 - ``<repo>/.hg/hgrc`` (per-repository)
70 - ``<repo>/.hg/hgrc`` (per-repository)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
78 - ``<internal>/default.d/*.rc`` (defaults)
78 - ``<internal>/default.d/*.rc`` (defaults)
79
79
80 .. note::
80 .. note::
81
81
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
83 is used when running 32-bit Python on 64-bit Windows.
83 is used when running 32-bit Python on 64-bit Windows.
84
84
85 .. container:: windows
85 .. container:: windows
86
86
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
88
88
89 .. container:: verbose.plan9
89 .. container:: verbose.plan9
90
90
91 On Plan9, the following files are consulted:
91 On Plan9, the following files are consulted:
92
92
93 - ``<repo>/.hg/hgrc`` (per-repository)
93 - ``<repo>/.hg/hgrc`` (per-repository)
94 - ``$home/lib/hgrc`` (per-user)
94 - ``$home/lib/hgrc`` (per-user)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
97 - ``/lib/mercurial/hgrc`` (per-system)
97 - ``/lib/mercurial/hgrc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
99 - ``<internal>/default.d/*.rc`` (defaults)
99 - ``<internal>/default.d/*.rc`` (defaults)
100
100
101 Per-repository configuration options only apply in a
101 Per-repository configuration options only apply in a
102 particular repository. This file is not version-controlled, and
102 particular repository. This file is not version-controlled, and
103 will not get transferred during a "clone" operation. Options in
103 will not get transferred during a "clone" operation. Options in
104 this file override options in all other configuration files.
104 this file override options in all other configuration files.
105
105
106 .. container:: unix.plan9
106 .. container:: unix.plan9
107
107
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
109 belong to a trusted user or to a trusted group. See
109 belong to a trusted user or to a trusted group. See
110 :hg:`help config.trusted` for more details.
110 :hg:`help config.trusted` for more details.
111
111
112 Per-user configuration file(s) are for the user running Mercurial. Options
112 Per-user configuration file(s) are for the user running Mercurial. Options
113 in these files apply to all Mercurial commands executed by this user in any
113 in these files apply to all Mercurial commands executed by this user in any
114 directory. Options in these files override per-system and per-installation
114 directory. Options in these files override per-system and per-installation
115 options.
115 options.
116
116
117 Per-installation configuration files are searched for in the
117 Per-installation configuration files are searched for in the
118 directory where Mercurial is installed. ``<install-root>`` is the
118 directory where Mercurial is installed. ``<install-root>`` is the
119 parent directory of the **hg** executable (or symlink) being run.
119 parent directory of the **hg** executable (or symlink) being run.
120
120
121 .. container:: unix.plan9
121 .. container:: unix.plan9
122
122
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
125 files apply to all Mercurial commands executed by any user in any
125 files apply to all Mercurial commands executed by any user in any
126 directory.
126 directory.
127
127
128 Per-installation configuration files are for the system on
128 Per-installation configuration files are for the system on
129 which Mercurial is running. Options in these files apply to all
129 which Mercurial is running. Options in these files apply to all
130 Mercurial commands executed by any user in any directory. Registry
130 Mercurial commands executed by any user in any directory. Registry
131 keys contain PATH-like strings, every part of which must reference
131 keys contain PATH-like strings, every part of which must reference
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
133 be read. Mercurial checks each of these locations in the specified
133 be read. Mercurial checks each of these locations in the specified
134 order until one or more configuration files are detected.
134 order until one or more configuration files are detected.
135
135
136 Per-system configuration files are for the system on which Mercurial
136 Per-system configuration files are for the system on which Mercurial
137 is running. Options in these files apply to all Mercurial commands
137 is running. Options in these files apply to all Mercurial commands
138 executed by any user in any directory. Options in these files
138 executed by any user in any directory. Options in these files
139 override per-installation options.
139 override per-installation options.
140
140
141 Mercurial comes with some default configuration. The default configuration
141 Mercurial comes with some default configuration. The default configuration
142 files are installed with Mercurial and will be overwritten on upgrades. Default
142 files are installed with Mercurial and will be overwritten on upgrades. Default
143 configuration files should never be edited by users or administrators but can
143 configuration files should never be edited by users or administrators but can
144 be overridden in other configuration files. So far the directory only contains
144 be overridden in other configuration files. So far the directory only contains
145 merge tool configuration but packagers can also put other default configuration
145 merge tool configuration but packagers can also put other default configuration
146 there.
146 there.
147
147
148 Syntax
148 Syntax
149 ======
149 ======
150
150
151 A configuration file consists of sections, led by a ``[section]`` header
151 A configuration file consists of sections, led by a ``[section]`` header
152 and followed by ``name = value`` entries (sometimes called
152 and followed by ``name = value`` entries (sometimes called
153 ``configuration keys``)::
153 ``configuration keys``)::
154
154
155 [spam]
155 [spam]
156 eggs=ham
156 eggs=ham
157 green=
157 green=
158 eggs
158 eggs
159
159
160 Each line contains one entry. If the lines that follow are indented,
160 Each line contains one entry. If the lines that follow are indented,
161 they are treated as continuations of that entry. Leading whitespace is
161 they are treated as continuations of that entry. Leading whitespace is
162 removed from values. Empty lines are skipped. Lines beginning with
162 removed from values. Empty lines are skipped. Lines beginning with
163 ``#`` or ``;`` are ignored and may be used to provide comments.
163 ``#`` or ``;`` are ignored and may be used to provide comments.
164
164
165 Configuration keys can be set multiple times, in which case Mercurial
165 Configuration keys can be set multiple times, in which case Mercurial
166 will use the value that was configured last. As an example::
166 will use the value that was configured last. As an example::
167
167
168 [spam]
168 [spam]
169 eggs=large
169 eggs=large
170 ham=serrano
170 ham=serrano
171 eggs=small
171 eggs=small
172
172
173 This would set the configuration key named ``eggs`` to ``small``.
173 This would set the configuration key named ``eggs`` to ``small``.
174
174
175 It is also possible to define a section multiple times. A section can
175 It is also possible to define a section multiple times. A section can
176 be redefined on the same and/or on different configuration files. For
176 be redefined on the same and/or on different configuration files. For
177 example::
177 example::
178
178
179 [foo]
179 [foo]
180 eggs=large
180 eggs=large
181 ham=serrano
181 ham=serrano
182 eggs=small
182 eggs=small
183
183
184 [bar]
184 [bar]
185 eggs=ham
185 eggs=ham
186 green=
186 green=
187 eggs
187 eggs
188
188
189 [foo]
189 [foo]
190 ham=prosciutto
190 ham=prosciutto
191 eggs=medium
191 eggs=medium
192 bread=toasted
192 bread=toasted
193
193
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
196 respectively. As you can see there only thing that matters is the last
196 respectively. As you can see there only thing that matters is the last
197 value that was set for each of the configuration keys.
197 value that was set for each of the configuration keys.
198
198
199 If a configuration key is set multiple times in different
199 If a configuration key is set multiple times in different
200 configuration files the final value will depend on the order in which
200 configuration files the final value will depend on the order in which
201 the different configuration files are read, with settings from earlier
201 the different configuration files are read, with settings from earlier
202 paths overriding later ones as described on the ``Files`` section
202 paths overriding later ones as described on the ``Files`` section
203 above.
203 above.
204
204
205 A line of the form ``%include file`` will include ``file`` into the
205 A line of the form ``%include file`` will include ``file`` into the
206 current configuration file. The inclusion is recursive, which means
206 current configuration file. The inclusion is recursive, which means
207 that included files can include other files. Filenames are relative to
207 that included files can include other files. Filenames are relative to
208 the configuration file in which the ``%include`` directive is found.
208 the configuration file in which the ``%include`` directive is found.
209 Environment variables and ``~user`` constructs are expanded in
209 Environment variables and ``~user`` constructs are expanded in
210 ``file``. This lets you do something like::
210 ``file``. This lets you do something like::
211
211
212 %include ~/.hgrc.d/$HOST.rc
212 %include ~/.hgrc.d/$HOST.rc
213
213
214 to include a different configuration file on each computer you use.
214 to include a different configuration file on each computer you use.
215
215
216 A line with ``%unset name`` will remove ``name`` from the current
216 A line with ``%unset name`` will remove ``name`` from the current
217 section, if it has been set previously.
217 section, if it has been set previously.
218
218
219 The values are either free-form text strings, lists of text strings,
219 The values are either free-form text strings, lists of text strings,
220 or Boolean values. Boolean values can be set to true using any of "1",
220 or Boolean values. Boolean values can be set to true using any of "1",
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
222 (all case insensitive).
222 (all case insensitive).
223
223
224 List values are separated by whitespace or comma, except when values are
224 List values are separated by whitespace or comma, except when values are
225 placed in double quotation marks::
225 placed in double quotation marks::
226
226
227 allow_read = "John Doe, PhD", brian, betty
227 allow_read = "John Doe, PhD", brian, betty
228
228
229 Quotation marks can be escaped by prefixing them with a backslash. Only
229 Quotation marks can be escaped by prefixing them with a backslash. Only
230 quotation marks at the beginning of a word is counted as a quotation
230 quotation marks at the beginning of a word is counted as a quotation
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
232
232
233 Sections
233 Sections
234 ========
234 ========
235
235
236 This section describes the different sections that may appear in a
236 This section describes the different sections that may appear in a
237 Mercurial configuration file, the purpose of each section, its possible
237 Mercurial configuration file, the purpose of each section, its possible
238 keys, and their possible values.
238 keys, and their possible values.
239
239
240 ``alias``
240 ``alias``
241 ---------
241 ---------
242
242
243 Defines command aliases.
243 Defines command aliases.
244
244
245 Aliases allow you to define your own commands in terms of other
245 Aliases allow you to define your own commands in terms of other
246 commands (or aliases), optionally including arguments. Positional
246 commands (or aliases), optionally including arguments. Positional
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
248 are expanded by Mercurial before execution. Positional arguments not
248 are expanded by Mercurial before execution. Positional arguments not
249 already used by ``$N`` in the definition are put at the end of the
249 already used by ``$N`` in the definition are put at the end of the
250 command to be executed.
250 command to be executed.
251
251
252 Alias definitions consist of lines of the form::
252 Alias definitions consist of lines of the form::
253
253
254 <alias> = <command> [<argument>]...
254 <alias> = <command> [<argument>]...
255
255
256 For example, this definition::
256 For example, this definition::
257
257
258 latest = log --limit 5
258 latest = log --limit 5
259
259
260 creates a new command ``latest`` that shows only the five most recent
260 creates a new command ``latest`` that shows only the five most recent
261 changesets. You can define subsequent aliases using earlier ones::
261 changesets. You can define subsequent aliases using earlier ones::
262
262
263 stable5 = latest -b stable
263 stable5 = latest -b stable
264
264
265 .. note::
265 .. note::
266
266
267 It is possible to create aliases with the same names as
267 It is possible to create aliases with the same names as
268 existing commands, which will then override the original
268 existing commands, which will then override the original
269 definitions. This is almost always a bad idea!
269 definitions. This is almost always a bad idea!
270
270
271 An alias can start with an exclamation point (``!``) to make it a
271 An alias can start with an exclamation point (``!``) to make it a
272 shell alias. A shell alias is executed with the shell and will let you
272 shell alias. A shell alias is executed with the shell and will let you
273 run arbitrary commands. As an example, ::
273 run arbitrary commands. As an example, ::
274
274
275 echo = !echo $@
275 echo = !echo $@
276
276
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
278 terminal. A better example might be::
278 terminal. A better example might be::
279
279
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
281
281
282 which will make ``hg purge`` delete all unknown files in the
282 which will make ``hg purge`` delete all unknown files in the
283 repository in the same manner as the purge extension.
283 repository in the same manner as the purge extension.
284
284
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
286 expand to the command arguments. Unmatched arguments are
286 expand to the command arguments. Unmatched arguments are
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
289 arguments quoted individually and separated by a space. These expansions
289 arguments quoted individually and separated by a space. These expansions
290 happen before the command is passed to the shell.
290 happen before the command is passed to the shell.
291
291
292 Shell aliases are executed in an environment where ``$HG`` expands to
292 Shell aliases are executed in an environment where ``$HG`` expands to
293 the path of the Mercurial that was used to execute the alias. This is
293 the path of the Mercurial that was used to execute the alias. This is
294 useful when you want to call further Mercurial commands in a shell
294 useful when you want to call further Mercurial commands in a shell
295 alias, as was done above for the purge alias. In addition,
295 alias, as was done above for the purge alias. In addition,
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
298
298
299 .. note::
299 .. note::
300
300
301 Some global configuration options such as ``-R`` are
301 Some global configuration options such as ``-R`` are
302 processed before shell aliases and will thus not be passed to
302 processed before shell aliases and will thus not be passed to
303 aliases.
303 aliases.
304
304
305
305
306 ``annotate``
306 ``annotate``
307 ------------
307 ------------
308
308
309 Settings used when displaying file annotations. All values are
309 Settings used when displaying file annotations. All values are
310 Booleans and default to False. See :hg:`help config.diff` for
310 Booleans and default to False. See :hg:`help config.diff` for
311 related options for the diff command.
311 related options for the diff command.
312
312
313 ``ignorews``
313 ``ignorews``
314 Ignore white space when comparing lines.
314 Ignore white space when comparing lines.
315
315
316 ``ignorewseol``
316 ``ignorewseol``
317 Ignore white space at the end of a line when comparing lines.
317 Ignore white space at the end of a line when comparing lines.
318
318
319 ``ignorewsamount``
319 ``ignorewsamount``
320 Ignore changes in the amount of white space.
320 Ignore changes in the amount of white space.
321
321
322 ``ignoreblanklines``
322 ``ignoreblanklines``
323 Ignore changes whose lines are all blank.
323 Ignore changes whose lines are all blank.
324
324
325
325
326 ``auth``
326 ``auth``
327 --------
327 --------
328
328
329 Authentication credentials and other authentication-like configuration
329 Authentication credentials and other authentication-like configuration
330 for HTTP connections. This section allows you to store usernames and
330 for HTTP connections. This section allows you to store usernames and
331 passwords for use when logging *into* HTTP servers. See
331 passwords for use when logging *into* HTTP servers. See
332 :hg:`help config.web` if you want to configure *who* can login to
332 :hg:`help config.web` if you want to configure *who* can login to
333 your HTTP server.
333 your HTTP server.
334
334
335 The following options apply to all hosts.
335 The following options apply to all hosts.
336
336
337 ``cookiefile``
337 ``cookiefile``
338 Path to a file containing HTTP cookie lines. Cookies matching a
338 Path to a file containing HTTP cookie lines. Cookies matching a
339 host will be sent automatically.
339 host will be sent automatically.
340
340
341 The file format uses the Mozilla cookies.txt format, which defines cookies
341 The file format uses the Mozilla cookies.txt format, which defines cookies
342 on their own lines. Each line contains 7 fields delimited by the tab
342 on their own lines. Each line contains 7 fields delimited by the tab
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
344 value). For more info, do an Internet search for "Netscape cookies.txt
344 value). For more info, do an Internet search for "Netscape cookies.txt
345 format."
345 format."
346
346
347 Note: the cookies parser does not handle port numbers on domains. You
347 Note: the cookies parser does not handle port numbers on domains. You
348 will need to remove ports from the domain for the cookie to be recognized.
348 will need to remove ports from the domain for the cookie to be recognized.
349 This could result in a cookie being disclosed to an unwanted server.
349 This could result in a cookie being disclosed to an unwanted server.
350
350
351 The cookies file is read-only.
351 The cookies file is read-only.
352
352
353 Other options in this section are grouped by name and have the following
353 Other options in this section are grouped by name and have the following
354 format::
354 format::
355
355
356 <name>.<argument> = <value>
356 <name>.<argument> = <value>
357
357
358 where ``<name>`` is used to group arguments into authentication
358 where ``<name>`` is used to group arguments into authentication
359 entries. Example::
359 entries. Example::
360
360
361 foo.prefix = hg.intevation.de/mercurial
361 foo.prefix = hg.intevation.de/mercurial
362 foo.username = foo
362 foo.username = foo
363 foo.password = bar
363 foo.password = bar
364 foo.schemes = http https
364 foo.schemes = http https
365
365
366 bar.prefix = secure.example.org
366 bar.prefix = secure.example.org
367 bar.key = path/to/file.key
367 bar.key = path/to/file.key
368 bar.cert = path/to/file.cert
368 bar.cert = path/to/file.cert
369 bar.schemes = https
369 bar.schemes = https
370
370
371 Supported arguments:
371 Supported arguments:
372
372
373 ``prefix``
373 ``prefix``
374 Either ``*`` or a URI prefix with or without the scheme part.
374 Either ``*`` or a URI prefix with or without the scheme part.
375 The authentication entry with the longest matching prefix is used
375 The authentication entry with the longest matching prefix is used
376 (where ``*`` matches everything and counts as a match of length
376 (where ``*`` matches everything and counts as a match of length
377 1). If the prefix doesn't include a scheme, the match is performed
377 1). If the prefix doesn't include a scheme, the match is performed
378 against the URI with its scheme stripped as well, and the schemes
378 against the URI with its scheme stripped as well, and the schemes
379 argument, q.v., is then subsequently consulted.
379 argument, q.v., is then subsequently consulted.
380
380
381 ``username``
381 ``username``
382 Optional. Username to authenticate with. If not given, and the
382 Optional. Username to authenticate with. If not given, and the
383 remote site requires basic or digest authentication, the user will
383 remote site requires basic or digest authentication, the user will
384 be prompted for it. Environment variables are expanded in the
384 be prompted for it. Environment variables are expanded in the
385 username letting you do ``foo.username = $USER``. If the URI
385 username letting you do ``foo.username = $USER``. If the URI
386 includes a username, only ``[auth]`` entries with a matching
386 includes a username, only ``[auth]`` entries with a matching
387 username or without a username will be considered.
387 username or without a username will be considered.
388
388
389 ``password``
389 ``password``
390 Optional. Password to authenticate with. If not given, and the
390 Optional. Password to authenticate with. If not given, and the
391 remote site requires basic or digest authentication, the user
391 remote site requires basic or digest authentication, the user
392 will be prompted for it.
392 will be prompted for it.
393
393
394 ``key``
394 ``key``
395 Optional. PEM encoded client certificate key file. Environment
395 Optional. PEM encoded client certificate key file. Environment
396 variables are expanded in the filename.
396 variables are expanded in the filename.
397
397
398 ``cert``
398 ``cert``
399 Optional. PEM encoded client certificate chain file. Environment
399 Optional. PEM encoded client certificate chain file. Environment
400 variables are expanded in the filename.
400 variables are expanded in the filename.
401
401
402 ``schemes``
402 ``schemes``
403 Optional. Space separated list of URI schemes to use this
403 Optional. Space separated list of URI schemes to use this
404 authentication entry with. Only used if the prefix doesn't include
404 authentication entry with. Only used if the prefix doesn't include
405 a scheme. Supported schemes are http and https. They will match
405 a scheme. Supported schemes are http and https. They will match
406 static-http and static-https respectively, as well.
406 static-http and static-https respectively, as well.
407 (default: https)
407 (default: https)
408
408
409 If no suitable authentication entry is found, the user is prompted
409 If no suitable authentication entry is found, the user is prompted
410 for credentials as usual if required by the remote.
410 for credentials as usual if required by the remote.
411
411
412 ``color``
412 ``color``
413 ---------
413 ---------
414
414
415 Configure the Mercurial color mode. For details about how to define your custom
415 Configure the Mercurial color mode. For details about how to define your custom
416 effect and style see :hg:`help color`.
416 effect and style see :hg:`help color`.
417
417
418 ``mode``
418 ``mode``
419 String: control the method used to output color. One of ``auto``, ``ansi``,
419 String: control the method used to output color. One of ``auto``, ``ansi``,
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
422 terminal. Any invalid value will disable color.
422 terminal. Any invalid value will disable color.
423
423
424 ``pagermode``
424 ``pagermode``
425 String: optional override of ``color.mode`` used with pager.
425 String: optional override of ``color.mode`` used with pager.
426
426
427 On some systems, terminfo mode may cause problems when using
427 On some systems, terminfo mode may cause problems when using
428 color with ``less -R`` as a pager program. less with the -R option
428 color with ``less -R`` as a pager program. less with the -R option
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
430 emit codes that less doesn't understand. You can work around this by
430 emit codes that less doesn't understand. You can work around this by
431 either using ansi mode (or auto mode), or by using less -r (which will
431 either using ansi mode (or auto mode), or by using less -r (which will
432 pass through all terminal control codes, not just color control
432 pass through all terminal control codes, not just color control
433 codes).
433 codes).
434
434
435 On some systems (such as MSYS in Windows), the terminal may support
435 On some systems (such as MSYS in Windows), the terminal may support
436 a different color mode than the pager program.
436 a different color mode than the pager program.
437
437
438 ``commands``
438 ``commands``
439 ------------
439 ------------
440
440
441 ``status.relative``
441 ``status.relative``
442 Make paths in :hg:`status` output relative to the current directory.
442 Make paths in :hg:`status` output relative to the current directory.
443 (default: False)
443 (default: False)
444
444
445 ``update.check``
445 ``update.check``
446 Determines what level of checking :hg:`update` will perform before moving
446 Determines what level of checking :hg:`update` will perform before moving
447 to a destination revision. Valid values are ``abort``, ``none``,
447 to a destination revision. Valid values are ``abort``, ``none``,
448 ``linear``, and ``noconflict``. ``abort`` always fails if the working
448 ``linear``, and ``noconflict``. ``abort`` always fails if the working
449 directory has uncommitted changes. ``none`` performs no checking, and may
449 directory has uncommitted changes. ``none`` performs no checking, and may
450 result in a merge with uncommitted changes. ``linear`` allows any update
450 result in a merge with uncommitted changes. ``linear`` allows any update
451 as long as it follows a straight line in the revision history, and may
451 as long as it follows a straight line in the revision history, and may
452 trigger a merge with uncommitted changes. ``noconflict`` will allow any
452 trigger a merge with uncommitted changes. ``noconflict`` will allow any
453 update which would not trigger a merge with uncommitted changes, if any
453 update which would not trigger a merge with uncommitted changes, if any
454 are present.
454 are present.
455 (default: ``linear``)
455 (default: ``linear``)
456
456
457 ``update.requiredest``
457 ``update.requiredest``
458 Require that the user pass a destination when running :hg:`update`.
458 Require that the user pass a destination when running :hg:`update`.
459 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
459 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
460 will be disallowed.
460 will be disallowed.
461 (default: False)
461 (default: False)
462
462
463 ``committemplate``
463 ``committemplate``
464 ------------------
464 ------------------
465
465
466 ``changeset``
466 ``changeset``
467 String: configuration in this section is used as the template to
467 String: configuration in this section is used as the template to
468 customize the text shown in the editor when committing.
468 customize the text shown in the editor when committing.
469
469
470 In addition to pre-defined template keywords, commit log specific one
470 In addition to pre-defined template keywords, commit log specific one
471 below can be used for customization:
471 below can be used for customization:
472
472
473 ``extramsg``
473 ``extramsg``
474 String: Extra message (typically 'Leave message empty to abort
474 String: Extra message (typically 'Leave message empty to abort
475 commit.'). This may be changed by some commands or extensions.
475 commit.'). This may be changed by some commands or extensions.
476
476
477 For example, the template configuration below shows as same text as
477 For example, the template configuration below shows as same text as
478 one shown by default::
478 one shown by default::
479
479
480 [committemplate]
480 [committemplate]
481 changeset = {desc}\n\n
481 changeset = {desc}\n\n
482 HG: Enter commit message. Lines beginning with 'HG:' are removed.
482 HG: Enter commit message. Lines beginning with 'HG:' are removed.
483 HG: {extramsg}
483 HG: {extramsg}
484 HG: --
484 HG: --
485 HG: user: {author}\n{ifeq(p2rev, "-1", "",
485 HG: user: {author}\n{ifeq(p2rev, "-1", "",
486 "HG: branch merge\n")
486 "HG: branch merge\n")
487 }HG: branch '{branch}'\n{if(activebookmark,
487 }HG: branch '{branch}'\n{if(activebookmark,
488 "HG: bookmark '{activebookmark}'\n") }{subrepos %
488 "HG: bookmark '{activebookmark}'\n") }{subrepos %
489 "HG: subrepo {subrepo}\n" }{file_adds %
489 "HG: subrepo {subrepo}\n" }{file_adds %
490 "HG: added {file}\n" }{file_mods %
490 "HG: added {file}\n" }{file_mods %
491 "HG: changed {file}\n" }{file_dels %
491 "HG: changed {file}\n" }{file_dels %
492 "HG: removed {file}\n" }{if(files, "",
492 "HG: removed {file}\n" }{if(files, "",
493 "HG: no files changed\n")}
493 "HG: no files changed\n")}
494
494
495 ``diff()``
495 ``diff()``
496 String: show the diff (see :hg:`help templates` for detail)
496 String: show the diff (see :hg:`help templates` for detail)
497
497
498 Sometimes it is helpful to show the diff of the changeset in the editor without
498 Sometimes it is helpful to show the diff of the changeset in the editor without
499 having to prefix 'HG: ' to each line so that highlighting works correctly. For
499 having to prefix 'HG: ' to each line so that highlighting works correctly. For
500 this, Mercurial provides a special string which will ignore everything below
500 this, Mercurial provides a special string which will ignore everything below
501 it::
501 it::
502
502
503 HG: ------------------------ >8 ------------------------
503 HG: ------------------------ >8 ------------------------
504
504
505 For example, the template configuration below will show the diff below the
505 For example, the template configuration below will show the diff below the
506 extra message::
506 extra message::
507
507
508 [committemplate]
508 [committemplate]
509 changeset = {desc}\n\n
509 changeset = {desc}\n\n
510 HG: Enter commit message. Lines beginning with 'HG:' are removed.
510 HG: Enter commit message. Lines beginning with 'HG:' are removed.
511 HG: {extramsg}
511 HG: {extramsg}
512 HG: ------------------------ >8 ------------------------
512 HG: ------------------------ >8 ------------------------
513 HG: Do not touch the line above.
513 HG: Do not touch the line above.
514 HG: Everything below will be removed.
514 HG: Everything below will be removed.
515 {diff()}
515 {diff()}
516
516
517 .. note::
517 .. note::
518
518
519 For some problematic encodings (see :hg:`help win32mbcs` for
519 For some problematic encodings (see :hg:`help win32mbcs` for
520 detail), this customization should be configured carefully, to
520 detail), this customization should be configured carefully, to
521 avoid showing broken characters.
521 avoid showing broken characters.
522
522
523 For example, if a multibyte character ending with backslash (0x5c) is
523 For example, if a multibyte character ending with backslash (0x5c) is
524 followed by the ASCII character 'n' in the customized template,
524 followed by the ASCII character 'n' in the customized template,
525 the sequence of backslash and 'n' is treated as line-feed unexpectedly
525 the sequence of backslash and 'n' is treated as line-feed unexpectedly
526 (and the multibyte character is broken, too).
526 (and the multibyte character is broken, too).
527
527
528 Customized template is used for commands below (``--edit`` may be
528 Customized template is used for commands below (``--edit`` may be
529 required):
529 required):
530
530
531 - :hg:`backout`
531 - :hg:`backout`
532 - :hg:`commit`
532 - :hg:`commit`
533 - :hg:`fetch` (for merge commit only)
533 - :hg:`fetch` (for merge commit only)
534 - :hg:`graft`
534 - :hg:`graft`
535 - :hg:`histedit`
535 - :hg:`histedit`
536 - :hg:`import`
536 - :hg:`import`
537 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
537 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
538 - :hg:`rebase`
538 - :hg:`rebase`
539 - :hg:`shelve`
539 - :hg:`shelve`
540 - :hg:`sign`
540 - :hg:`sign`
541 - :hg:`tag`
541 - :hg:`tag`
542 - :hg:`transplant`
542 - :hg:`transplant`
543
543
544 Configuring items below instead of ``changeset`` allows showing
544 Configuring items below instead of ``changeset`` allows showing
545 customized message only for specific actions, or showing different
545 customized message only for specific actions, or showing different
546 messages for each action.
546 messages for each action.
547
547
548 - ``changeset.backout`` for :hg:`backout`
548 - ``changeset.backout`` for :hg:`backout`
549 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
549 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
550 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
550 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
551 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
551 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
552 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
552 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
553 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
553 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
554 - ``changeset.gpg.sign`` for :hg:`sign`
554 - ``changeset.gpg.sign`` for :hg:`sign`
555 - ``changeset.graft`` for :hg:`graft`
555 - ``changeset.graft`` for :hg:`graft`
556 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
556 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
557 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
557 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
558 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
558 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
559 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
559 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
560 - ``changeset.import.bypass`` for :hg:`import --bypass`
560 - ``changeset.import.bypass`` for :hg:`import --bypass`
561 - ``changeset.import.normal.merge`` for :hg:`import` on merges
561 - ``changeset.import.normal.merge`` for :hg:`import` on merges
562 - ``changeset.import.normal.normal`` for :hg:`import` on other
562 - ``changeset.import.normal.normal`` for :hg:`import` on other
563 - ``changeset.mq.qnew`` for :hg:`qnew`
563 - ``changeset.mq.qnew`` for :hg:`qnew`
564 - ``changeset.mq.qfold`` for :hg:`qfold`
564 - ``changeset.mq.qfold`` for :hg:`qfold`
565 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
565 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
566 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
566 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
567 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
567 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
568 - ``changeset.rebase.normal`` for :hg:`rebase` on other
568 - ``changeset.rebase.normal`` for :hg:`rebase` on other
569 - ``changeset.shelve.shelve`` for :hg:`shelve`
569 - ``changeset.shelve.shelve`` for :hg:`shelve`
570 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
570 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
571 - ``changeset.tag.remove`` for :hg:`tag --remove`
571 - ``changeset.tag.remove`` for :hg:`tag --remove`
572 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
572 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
573 - ``changeset.transplant.normal`` for :hg:`transplant` on other
573 - ``changeset.transplant.normal`` for :hg:`transplant` on other
574
574
575 These dot-separated lists of names are treated as hierarchical ones.
575 These dot-separated lists of names are treated as hierarchical ones.
576 For example, ``changeset.tag.remove`` customizes the commit message
576 For example, ``changeset.tag.remove`` customizes the commit message
577 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
577 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
578 commit message for :hg:`tag` regardless of ``--remove`` option.
578 commit message for :hg:`tag` regardless of ``--remove`` option.
579
579
580 When the external editor is invoked for a commit, the corresponding
580 When the external editor is invoked for a commit, the corresponding
581 dot-separated list of names without the ``changeset.`` prefix
581 dot-separated list of names without the ``changeset.`` prefix
582 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
582 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
583 variable.
583 variable.
584
584
585 In this section, items other than ``changeset`` can be referred from
585 In this section, items other than ``changeset`` can be referred from
586 others. For example, the configuration to list committed files up
586 others. For example, the configuration to list committed files up
587 below can be referred as ``{listupfiles}``::
587 below can be referred as ``{listupfiles}``::
588
588
589 [committemplate]
589 [committemplate]
590 listupfiles = {file_adds %
590 listupfiles = {file_adds %
591 "HG: added {file}\n" }{file_mods %
591 "HG: added {file}\n" }{file_mods %
592 "HG: changed {file}\n" }{file_dels %
592 "HG: changed {file}\n" }{file_dels %
593 "HG: removed {file}\n" }{if(files, "",
593 "HG: removed {file}\n" }{if(files, "",
594 "HG: no files changed\n")}
594 "HG: no files changed\n")}
595
595
596 ``decode/encode``
596 ``decode/encode``
597 -----------------
597 -----------------
598
598
599 Filters for transforming files on checkout/checkin. This would
599 Filters for transforming files on checkout/checkin. This would
600 typically be used for newline processing or other
600 typically be used for newline processing or other
601 localization/canonicalization of files.
601 localization/canonicalization of files.
602
602
603 Filters consist of a filter pattern followed by a filter command.
603 Filters consist of a filter pattern followed by a filter command.
604 Filter patterns are globs by default, rooted at the repository root.
604 Filter patterns are globs by default, rooted at the repository root.
605 For example, to match any file ending in ``.txt`` in the root
605 For example, to match any file ending in ``.txt`` in the root
606 directory only, use the pattern ``*.txt``. To match any file ending
606 directory only, use the pattern ``*.txt``. To match any file ending
607 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
607 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
608 For each file only the first matching filter applies.
608 For each file only the first matching filter applies.
609
609
610 The filter command can start with a specifier, either ``pipe:`` or
610 The filter command can start with a specifier, either ``pipe:`` or
611 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
611 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
612
612
613 A ``pipe:`` command must accept data on stdin and return the transformed
613 A ``pipe:`` command must accept data on stdin and return the transformed
614 data on stdout.
614 data on stdout.
615
615
616 Pipe example::
616 Pipe example::
617
617
618 [encode]
618 [encode]
619 # uncompress gzip files on checkin to improve delta compression
619 # uncompress gzip files on checkin to improve delta compression
620 # note: not necessarily a good idea, just an example
620 # note: not necessarily a good idea, just an example
621 *.gz = pipe: gunzip
621 *.gz = pipe: gunzip
622
622
623 [decode]
623 [decode]
624 # recompress gzip files when writing them to the working dir (we
624 # recompress gzip files when writing them to the working dir (we
625 # can safely omit "pipe:", because it's the default)
625 # can safely omit "pipe:", because it's the default)
626 *.gz = gzip
626 *.gz = gzip
627
627
628 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
628 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
629 with the name of a temporary file that contains the data to be
629 with the name of a temporary file that contains the data to be
630 filtered by the command. The string ``OUTFILE`` is replaced with the name
630 filtered by the command. The string ``OUTFILE`` is replaced with the name
631 of an empty temporary file, where the filtered data must be written by
631 of an empty temporary file, where the filtered data must be written by
632 the command.
632 the command.
633
633
634 .. container:: windows
634 .. container:: windows
635
635
636 .. note::
636 .. note::
637
637
638 The tempfile mechanism is recommended for Windows systems,
638 The tempfile mechanism is recommended for Windows systems,
639 where the standard shell I/O redirection operators often have
639 where the standard shell I/O redirection operators often have
640 strange effects and may corrupt the contents of your files.
640 strange effects and may corrupt the contents of your files.
641
641
642 This filter mechanism is used internally by the ``eol`` extension to
642 This filter mechanism is used internally by the ``eol`` extension to
643 translate line ending characters between Windows (CRLF) and Unix (LF)
643 translate line ending characters between Windows (CRLF) and Unix (LF)
644 format. We suggest you use the ``eol`` extension for convenience.
644 format. We suggest you use the ``eol`` extension for convenience.
645
645
646
646
647 ``defaults``
647 ``defaults``
648 ------------
648 ------------
649
649
650 (defaults are deprecated. Don't use them. Use aliases instead.)
650 (defaults are deprecated. Don't use them. Use aliases instead.)
651
651
652 Use the ``[defaults]`` section to define command defaults, i.e. the
652 Use the ``[defaults]`` section to define command defaults, i.e. the
653 default options/arguments to pass to the specified commands.
653 default options/arguments to pass to the specified commands.
654
654
655 The following example makes :hg:`log` run in verbose mode, and
655 The following example makes :hg:`log` run in verbose mode, and
656 :hg:`status` show only the modified files, by default::
656 :hg:`status` show only the modified files, by default::
657
657
658 [defaults]
658 [defaults]
659 log = -v
659 log = -v
660 status = -m
660 status = -m
661
661
662 The actual commands, instead of their aliases, must be used when
662 The actual commands, instead of their aliases, must be used when
663 defining command defaults. The command defaults will also be applied
663 defining command defaults. The command defaults will also be applied
664 to the aliases of the commands defined.
664 to the aliases of the commands defined.
665
665
666
666
667 ``diff``
667 ``diff``
668 --------
668 --------
669
669
670 Settings used when displaying diffs. Everything except for ``unified``
670 Settings used when displaying diffs. Everything except for ``unified``
671 is a Boolean and defaults to False. See :hg:`help config.annotate`
671 is a Boolean and defaults to False. See :hg:`help config.annotate`
672 for related options for the annotate command.
672 for related options for the annotate command.
673
673
674 ``git``
674 ``git``
675 Use git extended diff format.
675 Use git extended diff format.
676
676
677 ``nobinary``
677 ``nobinary``
678 Omit git binary patches.
678 Omit git binary patches.
679
679
680 ``nodates``
680 ``nodates``
681 Don't include dates in diff headers.
681 Don't include dates in diff headers.
682
682
683 ``noprefix``
683 ``noprefix``
684 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
684 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
685
685
686 ``showfunc``
686 ``showfunc``
687 Show which function each change is in.
687 Show which function each change is in.
688
688
689 ``ignorews``
689 ``ignorews``
690 Ignore white space when comparing lines.
690 Ignore white space when comparing lines.
691
691
692 ``ignorewsamount``
692 ``ignorewsamount``
693 Ignore changes in the amount of white space.
693 Ignore changes in the amount of white space.
694
694
695 ``ignoreblanklines``
695 ``ignoreblanklines``
696 Ignore changes whose lines are all blank.
696 Ignore changes whose lines are all blank.
697
697
698 ``unified``
698 ``unified``
699 Number of lines of context to show.
699 Number of lines of context to show.
700
700
701 ``email``
701 ``email``
702 ---------
702 ---------
703
703
704 Settings for extensions that send email messages.
704 Settings for extensions that send email messages.
705
705
706 ``from``
706 ``from``
707 Optional. Email address to use in "From" header and SMTP envelope
707 Optional. Email address to use in "From" header and SMTP envelope
708 of outgoing messages.
708 of outgoing messages.
709
709
710 ``to``
710 ``to``
711 Optional. Comma-separated list of recipients' email addresses.
711 Optional. Comma-separated list of recipients' email addresses.
712
712
713 ``cc``
713 ``cc``
714 Optional. Comma-separated list of carbon copy recipients'
714 Optional. Comma-separated list of carbon copy recipients'
715 email addresses.
715 email addresses.
716
716
717 ``bcc``
717 ``bcc``
718 Optional. Comma-separated list of blind carbon copy recipients'
718 Optional. Comma-separated list of blind carbon copy recipients'
719 email addresses.
719 email addresses.
720
720
721 ``method``
721 ``method``
722 Optional. Method to use to send email messages. If value is ``smtp``
722 Optional. Method to use to send email messages. If value is ``smtp``
723 (default), use SMTP (see the ``[smtp]`` section for configuration).
723 (default), use SMTP (see the ``[smtp]`` section for configuration).
724 Otherwise, use as name of program to run that acts like sendmail
724 Otherwise, use as name of program to run that acts like sendmail
725 (takes ``-f`` option for sender, list of recipients on command line,
725 (takes ``-f`` option for sender, list of recipients on command line,
726 message on stdin). Normally, setting this to ``sendmail`` or
726 message on stdin). Normally, setting this to ``sendmail`` or
727 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
727 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
728
728
729 ``charsets``
729 ``charsets``
730 Optional. Comma-separated list of character sets considered
730 Optional. Comma-separated list of character sets considered
731 convenient for recipients. Addresses, headers, and parts not
731 convenient for recipients. Addresses, headers, and parts not
732 containing patches of outgoing messages will be encoded in the
732 containing patches of outgoing messages will be encoded in the
733 first character set to which conversion from local encoding
733 first character set to which conversion from local encoding
734 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
734 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
735 conversion fails, the text in question is sent as is.
735 conversion fails, the text in question is sent as is.
736 (default: '')
736 (default: '')
737
737
738 Order of outgoing email character sets:
738 Order of outgoing email character sets:
739
739
740 1. ``us-ascii``: always first, regardless of settings
740 1. ``us-ascii``: always first, regardless of settings
741 2. ``email.charsets``: in order given by user
741 2. ``email.charsets``: in order given by user
742 3. ``ui.fallbackencoding``: if not in email.charsets
742 3. ``ui.fallbackencoding``: if not in email.charsets
743 4. ``$HGENCODING``: if not in email.charsets
743 4. ``$HGENCODING``: if not in email.charsets
744 5. ``utf-8``: always last, regardless of settings
744 5. ``utf-8``: always last, regardless of settings
745
745
746 Email example::
746 Email example::
747
747
748 [email]
748 [email]
749 from = Joseph User <joe.user@example.com>
749 from = Joseph User <joe.user@example.com>
750 method = /usr/sbin/sendmail
750 method = /usr/sbin/sendmail
751 # charsets for western Europeans
751 # charsets for western Europeans
752 # us-ascii, utf-8 omitted, as they are tried first and last
752 # us-ascii, utf-8 omitted, as they are tried first and last
753 charsets = iso-8859-1, iso-8859-15, windows-1252
753 charsets = iso-8859-1, iso-8859-15, windows-1252
754
754
755
755
756 ``extensions``
756 ``extensions``
757 --------------
757 --------------
758
758
759 Mercurial has an extension mechanism for adding new features. To
759 Mercurial has an extension mechanism for adding new features. To
760 enable an extension, create an entry for it in this section.
760 enable an extension, create an entry for it in this section.
761
761
762 If you know that the extension is already in Python's search path,
762 If you know that the extension is already in Python's search path,
763 you can give the name of the module, followed by ``=``, with nothing
763 you can give the name of the module, followed by ``=``, with nothing
764 after the ``=``.
764 after the ``=``.
765
765
766 Otherwise, give a name that you choose, followed by ``=``, followed by
766 Otherwise, give a name that you choose, followed by ``=``, followed by
767 the path to the ``.py`` file (including the file name extension) that
767 the path to the ``.py`` file (including the file name extension) that
768 defines the extension.
768 defines the extension.
769
769
770 To explicitly disable an extension that is enabled in an hgrc of
770 To explicitly disable an extension that is enabled in an hgrc of
771 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
771 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
772 or ``foo = !`` when path is not supplied.
772 or ``foo = !`` when path is not supplied.
773
773
774 Example for ``~/.hgrc``::
774 Example for ``~/.hgrc``::
775
775
776 [extensions]
776 [extensions]
777 # (the churn extension will get loaded from Mercurial's path)
777 # (the churn extension will get loaded from Mercurial's path)
778 churn =
778 churn =
779 # (this extension will get loaded from the file specified)
779 # (this extension will get loaded from the file specified)
780 myfeature = ~/.hgext/myfeature.py
780 myfeature = ~/.hgext/myfeature.py
781
781
782
782
783 ``format``
783 ``format``
784 ----------
784 ----------
785
785
786 ``usegeneraldelta``
786 ``usegeneraldelta``
787 Enable or disable the "generaldelta" repository format which improves
787 Enable or disable the "generaldelta" repository format which improves
788 repository compression by allowing "revlog" to store delta against arbitrary
788 repository compression by allowing "revlog" to store delta against arbitrary
789 revision instead of the previous stored one. This provides significant
789 revision instead of the previous stored one. This provides significant
790 improvement for repositories with branches.
790 improvement for repositories with branches.
791
791
792 Repositories with this on-disk format require Mercurial version 1.9.
792 Repositories with this on-disk format require Mercurial version 1.9.
793
793
794 Enabled by default.
794 Enabled by default.
795
795
796 ``dotencode``
796 ``dotencode``
797 Enable or disable the "dotencode" repository format which enhances
797 Enable or disable the "dotencode" repository format which enhances
798 the "fncache" repository format (which has to be enabled to use
798 the "fncache" repository format (which has to be enabled to use
799 dotencode) to avoid issues with filenames starting with ._ on
799 dotencode) to avoid issues with filenames starting with ._ on
800 Mac OS X and spaces on Windows.
800 Mac OS X and spaces on Windows.
801
801
802 Repositories with this on-disk format require Mercurial version 1.7.
802 Repositories with this on-disk format require Mercurial version 1.7.
803
803
804 Enabled by default.
804 Enabled by default.
805
805
806 ``usefncache``
806 ``usefncache``
807 Enable or disable the "fncache" repository format which enhances
807 Enable or disable the "fncache" repository format which enhances
808 the "store" repository format (which has to be enabled to use
808 the "store" repository format (which has to be enabled to use
809 fncache) to allow longer filenames and avoids using Windows
809 fncache) to allow longer filenames and avoids using Windows
810 reserved names, e.g. "nul".
810 reserved names, e.g. "nul".
811
811
812 Repositories with this on-disk format require Mercurial version 1.1.
812 Repositories with this on-disk format require Mercurial version 1.1.
813
813
814 Enabled by default.
814 Enabled by default.
815
815
816 ``usestore``
816 ``usestore``
817 Enable or disable the "store" repository format which improves
817 Enable or disable the "store" repository format which improves
818 compatibility with systems that fold case or otherwise mangle
818 compatibility with systems that fold case or otherwise mangle
819 filenames. Disabling this option will allow you to store longer filenames
819 filenames. Disabling this option will allow you to store longer filenames
820 in some situations at the expense of compatibility.
820 in some situations at the expense of compatibility.
821
821
822 Repositories with this on-disk format require Mercurial version 0.9.4.
822 Repositories with this on-disk format require Mercurial version 0.9.4.
823
823
824 Enabled by default.
824 Enabled by default.
825
825
826 ``graph``
826 ``graph``
827 ---------
827 ---------
828
828
829 Web graph view configuration. This section let you change graph
829 Web graph view configuration. This section let you change graph
830 elements display properties by branches, for instance to make the
830 elements display properties by branches, for instance to make the
831 ``default`` branch stand out.
831 ``default`` branch stand out.
832
832
833 Each line has the following format::
833 Each line has the following format::
834
834
835 <branch>.<argument> = <value>
835 <branch>.<argument> = <value>
836
836
837 where ``<branch>`` is the name of the branch being
837 where ``<branch>`` is the name of the branch being
838 customized. Example::
838 customized. Example::
839
839
840 [graph]
840 [graph]
841 # 2px width
841 # 2px width
842 default.width = 2
842 default.width = 2
843 # red color
843 # red color
844 default.color = FF0000
844 default.color = FF0000
845
845
846 Supported arguments:
846 Supported arguments:
847
847
848 ``width``
848 ``width``
849 Set branch edges width in pixels.
849 Set branch edges width in pixels.
850
850
851 ``color``
851 ``color``
852 Set branch edges color in hexadecimal RGB notation.
852 Set branch edges color in hexadecimal RGB notation.
853
853
854 ``hooks``
854 ``hooks``
855 ---------
855 ---------
856
856
857 Commands or Python functions that get automatically executed by
857 Commands or Python functions that get automatically executed by
858 various actions such as starting or finishing a commit. Multiple
858 various actions such as starting or finishing a commit. Multiple
859 hooks can be run for the same action by appending a suffix to the
859 hooks can be run for the same action by appending a suffix to the
860 action. Overriding a site-wide hook can be done by changing its
860 action. Overriding a site-wide hook can be done by changing its
861 value or setting it to an empty string. Hooks can be prioritized
861 value or setting it to an empty string. Hooks can be prioritized
862 by adding a prefix of ``priority.`` to the hook name on a new line
862 by adding a prefix of ``priority.`` to the hook name on a new line
863 and setting the priority. The default priority is 0.
863 and setting the priority. The default priority is 0.
864
864
865 Example ``.hg/hgrc``::
865 Example ``.hg/hgrc``::
866
866
867 [hooks]
867 [hooks]
868 # update working directory after adding changesets
868 # update working directory after adding changesets
869 changegroup.update = hg update
869 changegroup.update = hg update
870 # do not use the site-wide hook
870 # do not use the site-wide hook
871 incoming =
871 incoming =
872 incoming.email = /my/email/hook
872 incoming.email = /my/email/hook
873 incoming.autobuild = /my/build/hook
873 incoming.autobuild = /my/build/hook
874 # force autobuild hook to run before other incoming hooks
874 # force autobuild hook to run before other incoming hooks
875 priority.incoming.autobuild = 1
875 priority.incoming.autobuild = 1
876
876
877 Most hooks are run with environment variables set that give useful
877 Most hooks are run with environment variables set that give useful
878 additional information. For each hook below, the environment variables
878 additional information. For each hook below, the environment variables
879 it is passed are listed with names in the form ``$HG_foo``. The
879 it is passed are listed with names in the form ``$HG_foo``. The
880 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
880 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
881 They contain the type of hook which triggered the run and the full name
881 They contain the type of hook which triggered the run and the full name
882 of the hook in the config, respectively. In the example above, this will
882 of the hook in the config, respectively. In the example above, this will
883 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
883 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
884
884
885 ``changegroup``
885 ``changegroup``
886 Run after a changegroup has been added via push, pull or unbundle. The ID of
886 Run after a changegroup has been added via push, pull or unbundle. The ID of
887 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
887 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
888 The URL from which changes came is in ``$HG_URL``.
888 The URL from which changes came is in ``$HG_URL``.
889
889
890 ``commit``
890 ``commit``
891 Run after a changeset has been created in the local repository. The ID
891 Run after a changeset has been created in the local repository. The ID
892 of the newly created changeset is in ``$HG_NODE``. Parent changeset
892 of the newly created changeset is in ``$HG_NODE``. Parent changeset
893 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
893 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
894
894
895 ``incoming``
895 ``incoming``
896 Run after a changeset has been pulled, pushed, or unbundled into
896 Run after a changeset has been pulled, pushed, or unbundled into
897 the local repository. The ID of the newly arrived changeset is in
897 the local repository. The ID of the newly arrived changeset is in
898 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
898 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
899
899
900 ``outgoing``
900 ``outgoing``
901 Run after sending changes from the local repository to another. The ID of
901 Run after sending changes from the local repository to another. The ID of
902 first changeset sent is in ``$HG_NODE``. The source of operation is in
902 first changeset sent is in ``$HG_NODE``. The source of operation is in
903 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
903 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
904
904
905 ``post-<command>``
905 ``post-<command>``
906 Run after successful invocations of the associated command. The
906 Run after successful invocations of the associated command. The
907 contents of the command line are passed as ``$HG_ARGS`` and the result
907 contents of the command line are passed as ``$HG_ARGS`` and the result
908 code in ``$HG_RESULT``. Parsed command line arguments are passed as
908 code in ``$HG_RESULT``. Parsed command line arguments are passed as
909 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
909 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
910 the python data internally passed to <command>. ``$HG_OPTS`` is a
910 the python data internally passed to <command>. ``$HG_OPTS`` is a
911 dictionary of options (with unspecified options set to their defaults).
911 dictionary of options (with unspecified options set to their defaults).
912 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
912 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
913
913
914 ``fail-<command>``
914 ``fail-<command>``
915 Run after a failed invocation of an associated command. The contents
915 Run after a failed invocation of an associated command. The contents
916 of the command line are passed as ``$HG_ARGS``. Parsed command line
916 of the command line are passed as ``$HG_ARGS``. Parsed command line
917 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
917 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
918 string representations of the python data internally passed to
918 string representations of the python data internally passed to
919 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
919 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
920 options set to their defaults). ``$HG_PATS`` is a list of arguments.
920 options set to their defaults). ``$HG_PATS`` is a list of arguments.
921 Hook failure is ignored.
921 Hook failure is ignored.
922
922
923 ``pre-<command>``
923 ``pre-<command>``
924 Run before executing the associated command. The contents of the
924 Run before executing the associated command. The contents of the
925 command line are passed as ``$HG_ARGS``. Parsed command line arguments
925 command line are passed as ``$HG_ARGS``. Parsed command line arguments
926 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
926 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
927 representations of the data internally passed to <command>. ``$HG_OPTS``
927 representations of the data internally passed to <command>. ``$HG_OPTS``
928 is a dictionary of options (with unspecified options set to their
928 is a dictionary of options (with unspecified options set to their
929 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
929 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
930 failure, the command doesn't execute and Mercurial returns the failure
930 failure, the command doesn't execute and Mercurial returns the failure
931 code.
931 code.
932
932
933 ``prechangegroup``
933 ``prechangegroup``
934 Run before a changegroup is added via push, pull or unbundle. Exit
934 Run before a changegroup is added via push, pull or unbundle. Exit
935 status 0 allows the changegroup to proceed. A non-zero status will
935 status 0 allows the changegroup to proceed. A non-zero status will
936 cause the push, pull or unbundle to fail. The URL from which changes
936 cause the push, pull or unbundle to fail. The URL from which changes
937 will come is in ``$HG_URL``.
937 will come is in ``$HG_URL``.
938
938
939 ``precommit``
939 ``precommit``
940 Run before starting a local commit. Exit status 0 allows the
940 Run before starting a local commit. Exit status 0 allows the
941 commit to proceed. A non-zero status will cause the commit to fail.
941 commit to proceed. A non-zero status will cause the commit to fail.
942 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
942 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
943
943
944 ``prelistkeys``
944 ``prelistkeys``
945 Run before listing pushkeys (like bookmarks) in the
945 Run before listing pushkeys (like bookmarks) in the
946 repository. A non-zero status will cause failure. The key namespace is
946 repository. A non-zero status will cause failure. The key namespace is
947 in ``$HG_NAMESPACE``.
947 in ``$HG_NAMESPACE``.
948
948
949 ``preoutgoing``
949 ``preoutgoing``
950 Run before collecting changes to send from the local repository to
950 Run before collecting changes to send from the local repository to
951 another. A non-zero status will cause failure. This lets you prevent
951 another. A non-zero status will cause failure. This lets you prevent
952 pull over HTTP or SSH. It can also prevent propagating commits (via
952 pull over HTTP or SSH. It can also prevent propagating commits (via
953 local pull, push (outbound) or bundle commands), but not completely,
953 local pull, push (outbound) or bundle commands), but not completely,
954 since you can just copy files instead. The source of operation is in
954 since you can just copy files instead. The source of operation is in
955 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
955 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
956 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
956 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
957 is happening on behalf of a repository on same system.
957 is happening on behalf of a repository on same system.
958
958
959 ``prepushkey``
959 ``prepushkey``
960 Run before a pushkey (like a bookmark) is added to the
960 Run before a pushkey (like a bookmark) is added to the
961 repository. A non-zero status will cause the key to be rejected. The
961 repository. A non-zero status will cause the key to be rejected. The
962 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
962 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
963 the old value (if any) is in ``$HG_OLD``, and the new value is in
963 the old value (if any) is in ``$HG_OLD``, and the new value is in
964 ``$HG_NEW``.
964 ``$HG_NEW``.
965
965
966 ``pretag``
966 ``pretag``
967 Run before creating a tag. Exit status 0 allows the tag to be
967 Run before creating a tag. Exit status 0 allows the tag to be
968 created. A non-zero status will cause the tag to fail. The ID of the
968 created. A non-zero status will cause the tag to fail. The ID of the
969 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
969 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
970 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
970 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
971
971
972 ``pretxnopen``
972 ``pretxnopen``
973 Run before any new repository transaction is open. The reason for the
973 Run before any new repository transaction is open. The reason for the
974 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
974 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
975 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
975 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
976 transaction from being opened.
976 transaction from being opened.
977
977
978 ``pretxnclose``
978 ``pretxnclose``
979 Run right before the transaction is actually finalized. Any repository change
979 Run right before the transaction is actually finalized. Any repository change
980 will be visible to the hook program. This lets you validate the transaction
980 will be visible to the hook program. This lets you validate the transaction
981 content or change it. Exit status 0 allows the commit to proceed. A non-zero
981 content or change it. Exit status 0 allows the commit to proceed. A non-zero
982 status will cause the transaction to be rolled back. The reason for the
982 status will cause the transaction to be rolled back. The reason for the
983 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
983 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
984 the transaction will be in ``HG_TXNID``. The rest of the available data will
984 the transaction will be in ``HG_TXNID``. The rest of the available data will
985 vary according the transaction type. New changesets will add ``$HG_NODE``
985 vary according the transaction type. New changesets will add ``$HG_NODE``
986 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
986 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
987 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
987 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
988 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
988 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
989 respectively, etc.
989 respectively, etc.
990
990
991 ``pretxnclose-bookmark``
991 ``pretxnclose-bookmark``
992 Run right before a bookmark change is actually finalized. Any repository
992 Run right before a bookmark change is actually finalized. Any repository
993 change will be visible to the hook program. This lets you validate the
993 change will be visible to the hook program. This lets you validate the
994 transaction content or change it. Exit status 0 allows the commit to
994 transaction content or change it. Exit status 0 allows the commit to
995 proceed. A non-zero status will cause the transaction to be rolled back.
995 proceed. A non-zero status will cause the transaction to be rolled back.
996 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
996 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
997 bookmark location will be available in ``$HG_NODE`` while the previous
997 bookmark location will be available in ``$HG_NODE`` while the previous
998 location will be available in ``$HG_OLDNODE``. In case of a bookmark
998 location will be available in ``$HG_OLDNODE``. In case of a bookmark
999 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
999 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1000 will be empty.
1000 will be empty.
1001 In addition, the reason for the transaction opening will be in
1001 In addition, the reason for the transaction opening will be in
1002 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1002 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1003 ``HG_TXNID``.
1003 ``HG_TXNID``.
1004
1004
1005 ``pretxnclose-phase``
1005 ``pretxnclose-phase``
1006 Run right before a phase change is actually finalized. Any repository change
1006 Run right before a phase change is actually finalized. Any repository change
1007 will be visible to the hook program. This lets you validate the transaction
1007 will be visible to the hook program. This lets you validate the transaction
1008 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1008 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1009 status will cause the transaction to be rolled back. The hook is called
1009 status will cause the transaction to be rolled back. The hook is called
1010 multiple times, once for each revision affected by a phase change.
1010 multiple times, once for each revision affected by a phase change.
1011 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1011 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1012 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1012 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1013 will be empty. In addition, the reason for the transaction opening will be in
1013 will be empty. In addition, the reason for the transaction opening will be in
1014 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1014 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1015 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1015 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1016 the ``$HG_OLDPHASE`` entry will be empty.
1016 the ``$HG_OLDPHASE`` entry will be empty.
1017
1017
1018 ``txnclose``
1018 ``txnclose``
1019 Run after any repository transaction has been committed. At this
1019 Run after any repository transaction has been committed. At this
1020 point, the transaction can no longer be rolled back. The hook will run
1020 point, the transaction can no longer be rolled back. The hook will run
1021 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1021 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1022 details about available variables.
1022 details about available variables.
1023
1023
1024 ``txnclose-bookmark``
1024 ``txnclose-bookmark``
1025 Run after any bookmark change has been committed. At this point, the
1025 Run after any bookmark change has been committed. At this point, the
1026 transaction can no longer be rolled back. The hook will run after the lock
1026 transaction can no longer be rolled back. The hook will run after the lock
1027 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1027 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1028 about available variables.
1028 about available variables.
1029
1029
1030 ``txnclose-phase``
1030 ``txnclose-phase``
1031 Run after any phase change has been committed. At this point, the
1031 Run after any phase change has been committed. At this point, the
1032 transaction can no longer be rolled back. The hook will run after the lock
1032 transaction can no longer be rolled back. The hook will run after the lock
1033 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1033 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1034 available variables.
1034 available variables.
1035
1035
1036 ``txnabort``
1036 ``txnabort``
1037 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1037 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1038 for details about available variables.
1038 for details about available variables.
1039
1039
1040 ``pretxnchangegroup``
1040 ``pretxnchangegroup``
1041 Run after a changegroup has been added via push, pull or unbundle, but before
1041 Run after a changegroup has been added via push, pull or unbundle, but before
1042 the transaction has been committed. The changegroup is visible to the hook
1042 the transaction has been committed. The changegroup is visible to the hook
1043 program. This allows validation of incoming changes before accepting them.
1043 program. This allows validation of incoming changes before accepting them.
1044 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1044 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1045 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1045 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1046 status will cause the transaction to be rolled back, and the push, pull or
1046 status will cause the transaction to be rolled back, and the push, pull or
1047 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1047 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1048
1048
1049 ``pretxncommit``
1049 ``pretxncommit``
1050 Run after a changeset has been created, but before the transaction is
1050 Run after a changeset has been created, but before the transaction is
1051 committed. The changeset is visible to the hook program. This allows
1051 committed. The changeset is visible to the hook program. This allows
1052 validation of the commit message and changes. Exit status 0 allows the
1052 validation of the commit message and changes. Exit status 0 allows the
1053 commit to proceed. A non-zero status will cause the transaction to
1053 commit to proceed. A non-zero status will cause the transaction to
1054 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1054 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1055 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1055 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1056
1056
1057 ``preupdate``
1057 ``preupdate``
1058 Run before updating the working directory. Exit status 0 allows
1058 Run before updating the working directory. Exit status 0 allows
1059 the update to proceed. A non-zero status will prevent the update.
1059 the update to proceed. A non-zero status will prevent the update.
1060 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1060 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1061 merge, the ID of second new parent is in ``$HG_PARENT2``.
1061 merge, the ID of second new parent is in ``$HG_PARENT2``.
1062
1062
1063 ``listkeys``
1063 ``listkeys``
1064 Run after listing pushkeys (like bookmarks) in the repository. The
1064 Run after listing pushkeys (like bookmarks) in the repository. The
1065 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1065 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1066 dictionary containing the keys and values.
1066 dictionary containing the keys and values.
1067
1067
1068 ``pushkey``
1068 ``pushkey``
1069 Run after a pushkey (like a bookmark) is added to the
1069 Run after a pushkey (like a bookmark) is added to the
1070 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1070 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1071 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1071 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1072 value is in ``$HG_NEW``.
1072 value is in ``$HG_NEW``.
1073
1073
1074 ``tag``
1074 ``tag``
1075 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1075 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1076 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1076 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1077 the repository if ``$HG_LOCAL=0``.
1077 the repository if ``$HG_LOCAL=0``.
1078
1078
1079 ``update``
1079 ``update``
1080 Run after updating the working directory. The changeset ID of first
1080 Run after updating the working directory. The changeset ID of first
1081 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1081 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1082 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1082 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1083 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1083 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1084
1084
1085 .. note::
1085 .. note::
1086
1086
1087 It is generally better to use standard hooks rather than the
1087 It is generally better to use standard hooks rather than the
1088 generic pre- and post- command hooks, as they are guaranteed to be
1088 generic pre- and post- command hooks, as they are guaranteed to be
1089 called in the appropriate contexts for influencing transactions.
1089 called in the appropriate contexts for influencing transactions.
1090 Also, hooks like "commit" will be called in all contexts that
1090 Also, hooks like "commit" will be called in all contexts that
1091 generate a commit (e.g. tag) and not just the commit command.
1091 generate a commit (e.g. tag) and not just the commit command.
1092
1092
1093 .. note::
1093 .. note::
1094
1094
1095 Environment variables with empty values may not be passed to
1095 Environment variables with empty values may not be passed to
1096 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1096 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1097 will have an empty value under Unix-like platforms for non-merge
1097 will have an empty value under Unix-like platforms for non-merge
1098 changesets, while it will not be available at all under Windows.
1098 changesets, while it will not be available at all under Windows.
1099
1099
1100 The syntax for Python hooks is as follows::
1100 The syntax for Python hooks is as follows::
1101
1101
1102 hookname = python:modulename.submodule.callable
1102 hookname = python:modulename.submodule.callable
1103 hookname = python:/path/to/python/module.py:callable
1103 hookname = python:/path/to/python/module.py:callable
1104
1104
1105 Python hooks are run within the Mercurial process. Each hook is
1105 Python hooks are run within the Mercurial process. Each hook is
1106 called with at least three keyword arguments: a ui object (keyword
1106 called with at least three keyword arguments: a ui object (keyword
1107 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1107 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1108 keyword that tells what kind of hook is used. Arguments listed as
1108 keyword that tells what kind of hook is used. Arguments listed as
1109 environment variables above are passed as keyword arguments, with no
1109 environment variables above are passed as keyword arguments, with no
1110 ``HG_`` prefix, and names in lower case.
1110 ``HG_`` prefix, and names in lower case.
1111
1111
1112 If a Python hook returns a "true" value or raises an exception, this
1112 If a Python hook returns a "true" value or raises an exception, this
1113 is treated as a failure.
1113 is treated as a failure.
1114
1114
1115
1115
1116 ``hostfingerprints``
1116 ``hostfingerprints``
1117 --------------------
1117 --------------------
1118
1118
1119 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1119 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1120
1120
1121 Fingerprints of the certificates of known HTTPS servers.
1121 Fingerprints of the certificates of known HTTPS servers.
1122
1122
1123 A HTTPS connection to a server with a fingerprint configured here will
1123 A HTTPS connection to a server with a fingerprint configured here will
1124 only succeed if the servers certificate matches the fingerprint.
1124 only succeed if the servers certificate matches the fingerprint.
1125 This is very similar to how ssh known hosts works.
1125 This is very similar to how ssh known hosts works.
1126
1126
1127 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1127 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1128 Multiple values can be specified (separated by spaces or commas). This can
1128 Multiple values can be specified (separated by spaces or commas). This can
1129 be used to define both old and new fingerprints while a host transitions
1129 be used to define both old and new fingerprints while a host transitions
1130 to a new certificate.
1130 to a new certificate.
1131
1131
1132 The CA chain and web.cacerts is not used for servers with a fingerprint.
1132 The CA chain and web.cacerts is not used for servers with a fingerprint.
1133
1133
1134 For example::
1134 For example::
1135
1135
1136 [hostfingerprints]
1136 [hostfingerprints]
1137 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1137 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1138 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1138 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1139
1139
1140 ``hostsecurity``
1140 ``hostsecurity``
1141 ----------------
1141 ----------------
1142
1142
1143 Used to specify global and per-host security settings for connecting to
1143 Used to specify global and per-host security settings for connecting to
1144 other machines.
1144 other machines.
1145
1145
1146 The following options control default behavior for all hosts.
1146 The following options control default behavior for all hosts.
1147
1147
1148 ``ciphers``
1148 ``ciphers``
1149 Defines the cryptographic ciphers to use for connections.
1149 Defines the cryptographic ciphers to use for connections.
1150
1150
1151 Value must be a valid OpenSSL Cipher List Format as documented at
1151 Value must be a valid OpenSSL Cipher List Format as documented at
1152 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1152 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1153
1153
1154 This setting is for advanced users only. Setting to incorrect values
1154 This setting is for advanced users only. Setting to incorrect values
1155 can significantly lower connection security or decrease performance.
1155 can significantly lower connection security or decrease performance.
1156 You have been warned.
1156 You have been warned.
1157
1157
1158 This option requires Python 2.7.
1158 This option requires Python 2.7.
1159
1159
1160 ``minimumprotocol``
1160 ``minimumprotocol``
1161 Defines the minimum channel encryption protocol to use.
1161 Defines the minimum channel encryption protocol to use.
1162
1162
1163 By default, the highest version of TLS supported by both client and server
1163 By default, the highest version of TLS supported by both client and server
1164 is used.
1164 is used.
1165
1165
1166 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1166 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1167
1167
1168 When running on an old Python version, only ``tls1.0`` is allowed since
1168 When running on an old Python version, only ``tls1.0`` is allowed since
1169 old versions of Python only support up to TLS 1.0.
1169 old versions of Python only support up to TLS 1.0.
1170
1170
1171 When running a Python that supports modern TLS versions, the default is
1171 When running a Python that supports modern TLS versions, the default is
1172 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1172 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1173 weakens security and should only be used as a feature of last resort if
1173 weakens security and should only be used as a feature of last resort if
1174 a server does not support TLS 1.1+.
1174 a server does not support TLS 1.1+.
1175
1175
1176 Options in the ``[hostsecurity]`` section can have the form
1176 Options in the ``[hostsecurity]`` section can have the form
1177 ``hostname``:``setting``. This allows multiple settings to be defined on a
1177 ``hostname``:``setting``. This allows multiple settings to be defined on a
1178 per-host basis.
1178 per-host basis.
1179
1179
1180 The following per-host settings can be defined.
1180 The following per-host settings can be defined.
1181
1181
1182 ``ciphers``
1182 ``ciphers``
1183 This behaves like ``ciphers`` as described above except it only applies
1183 This behaves like ``ciphers`` as described above except it only applies
1184 to the host on which it is defined.
1184 to the host on which it is defined.
1185
1185
1186 ``fingerprints``
1186 ``fingerprints``
1187 A list of hashes of the DER encoded peer/remote certificate. Values have
1187 A list of hashes of the DER encoded peer/remote certificate. Values have
1188 the form ``algorithm``:``fingerprint``. e.g.
1188 the form ``algorithm``:``fingerprint``. e.g.
1189 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1189 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1190 In addition, colons (``:``) can appear in the fingerprint part.
1190 In addition, colons (``:``) can appear in the fingerprint part.
1191
1191
1192 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1192 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1193 ``sha512``.
1193 ``sha512``.
1194
1194
1195 Use of ``sha256`` or ``sha512`` is preferred.
1195 Use of ``sha256`` or ``sha512`` is preferred.
1196
1196
1197 If a fingerprint is specified, the CA chain is not validated for this
1197 If a fingerprint is specified, the CA chain is not validated for this
1198 host and Mercurial will require the remote certificate to match one
1198 host and Mercurial will require the remote certificate to match one
1199 of the fingerprints specified. This means if the server updates its
1199 of the fingerprints specified. This means if the server updates its
1200 certificate, Mercurial will abort until a new fingerprint is defined.
1200 certificate, Mercurial will abort until a new fingerprint is defined.
1201 This can provide stronger security than traditional CA-based validation
1201 This can provide stronger security than traditional CA-based validation
1202 at the expense of convenience.
1202 at the expense of convenience.
1203
1203
1204 This option takes precedence over ``verifycertsfile``.
1204 This option takes precedence over ``verifycertsfile``.
1205
1205
1206 ``minimumprotocol``
1206 ``minimumprotocol``
1207 This behaves like ``minimumprotocol`` as described above except it
1207 This behaves like ``minimumprotocol`` as described above except it
1208 only applies to the host on which it is defined.
1208 only applies to the host on which it is defined.
1209
1209
1210 ``verifycertsfile``
1210 ``verifycertsfile``
1211 Path to file a containing a list of PEM encoded certificates used to
1211 Path to file a containing a list of PEM encoded certificates used to
1212 verify the server certificate. Environment variables and ``~user``
1212 verify the server certificate. Environment variables and ``~user``
1213 constructs are expanded in the filename.
1213 constructs are expanded in the filename.
1214
1214
1215 The server certificate or the certificate's certificate authority (CA)
1215 The server certificate or the certificate's certificate authority (CA)
1216 must match a certificate from this file or certificate verification
1216 must match a certificate from this file or certificate verification
1217 will fail and connections to the server will be refused.
1217 will fail and connections to the server will be refused.
1218
1218
1219 If defined, only certificates provided by this file will be used:
1219 If defined, only certificates provided by this file will be used:
1220 ``web.cacerts`` and any system/default certificates will not be
1220 ``web.cacerts`` and any system/default certificates will not be
1221 used.
1221 used.
1222
1222
1223 This option has no effect if the per-host ``fingerprints`` option
1223 This option has no effect if the per-host ``fingerprints`` option
1224 is set.
1224 is set.
1225
1225
1226 The format of the file is as follows::
1226 The format of the file is as follows::
1227
1227
1228 -----BEGIN CERTIFICATE-----
1228 -----BEGIN CERTIFICATE-----
1229 ... (certificate in base64 PEM encoding) ...
1229 ... (certificate in base64 PEM encoding) ...
1230 -----END CERTIFICATE-----
1230 -----END CERTIFICATE-----
1231 -----BEGIN CERTIFICATE-----
1231 -----BEGIN CERTIFICATE-----
1232 ... (certificate in base64 PEM encoding) ...
1232 ... (certificate in base64 PEM encoding) ...
1233 -----END CERTIFICATE-----
1233 -----END CERTIFICATE-----
1234
1234
1235 For example::
1235 For example::
1236
1236
1237 [hostsecurity]
1237 [hostsecurity]
1238 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1238 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1239 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1239 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1240 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1240 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1241 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1241 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1242
1242
1243 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1243 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1244 when connecting to ``hg.example.com``::
1244 when connecting to ``hg.example.com``::
1245
1245
1246 [hostsecurity]
1246 [hostsecurity]
1247 minimumprotocol = tls1.2
1247 minimumprotocol = tls1.2
1248 hg.example.com:minimumprotocol = tls1.1
1248 hg.example.com:minimumprotocol = tls1.1
1249
1249
1250 ``http_proxy``
1250 ``http_proxy``
1251 --------------
1251 --------------
1252
1252
1253 Used to access web-based Mercurial repositories through a HTTP
1253 Used to access web-based Mercurial repositories through a HTTP
1254 proxy.
1254 proxy.
1255
1255
1256 ``host``
1256 ``host``
1257 Host name and (optional) port of the proxy server, for example
1257 Host name and (optional) port of the proxy server, for example
1258 "myproxy:8000".
1258 "myproxy:8000".
1259
1259
1260 ``no``
1260 ``no``
1261 Optional. Comma-separated list of host names that should bypass
1261 Optional. Comma-separated list of host names that should bypass
1262 the proxy.
1262 the proxy.
1263
1263
1264 ``passwd``
1264 ``passwd``
1265 Optional. Password to authenticate with at the proxy server.
1265 Optional. Password to authenticate with at the proxy server.
1266
1266
1267 ``user``
1267 ``user``
1268 Optional. User name to authenticate with at the proxy server.
1268 Optional. User name to authenticate with at the proxy server.
1269
1269
1270 ``always``
1270 ``always``
1271 Optional. Always use the proxy, even for localhost and any entries
1271 Optional. Always use the proxy, even for localhost and any entries
1272 in ``http_proxy.no``. (default: False)
1272 in ``http_proxy.no``. (default: False)
1273
1273
1274 ``merge``
1274 ``merge``
1275 ---------
1275 ---------
1276
1276
1277 This section specifies behavior during merges and updates.
1277 This section specifies behavior during merges and updates.
1278
1278
1279 ``checkignored``
1279 ``checkignored``
1280 Controls behavior when an ignored file on disk has the same name as a tracked
1280 Controls behavior when an ignored file on disk has the same name as a tracked
1281 file in the changeset being merged or updated to, and has different
1281 file in the changeset being merged or updated to, and has different
1282 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1282 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1283 abort on such files. With ``warn``, warn on such files and back them up as
1283 abort on such files. With ``warn``, warn on such files and back them up as
1284 ``.orig``. With ``ignore``, don't print a warning and back them up as
1284 ``.orig``. With ``ignore``, don't print a warning and back them up as
1285 ``.orig``. (default: ``abort``)
1285 ``.orig``. (default: ``abort``)
1286
1286
1287 ``checkunknown``
1287 ``checkunknown``
1288 Controls behavior when an unknown file that isn't ignored has the same name
1288 Controls behavior when an unknown file that isn't ignored has the same name
1289 as a tracked file in the changeset being merged or updated to, and has
1289 as a tracked file in the changeset being merged or updated to, and has
1290 different contents. Similar to ``merge.checkignored``, except for files that
1290 different contents. Similar to ``merge.checkignored``, except for files that
1291 are not ignored. (default: ``abort``)
1291 are not ignored. (default: ``abort``)
1292
1292
1293 ``on-failure``
1293 ``on-failure``
1294 When set to ``continue`` (the default), the merge process attempts to
1294 When set to ``continue`` (the default), the merge process attempts to
1295 merge all unresolved files using the merge chosen tool, regardless of
1295 merge all unresolved files using the merge chosen tool, regardless of
1296 whether previous file merge attempts during the process succeeded or not.
1296 whether previous file merge attempts during the process succeeded or not.
1297 Setting this to ``prompt`` will prompt after any merge failure continue
1297 Setting this to ``prompt`` will prompt after any merge failure continue
1298 or halt the merge process. Setting this to ``halt`` will automatically
1298 or halt the merge process. Setting this to ``halt`` will automatically
1299 halt the merge process on any merge tool failure. The merge process
1299 halt the merge process on any merge tool failure. The merge process
1300 can be restarted by using the ``resolve`` command. When a merge is
1300 can be restarted by using the ``resolve`` command. When a merge is
1301 halted, the repository is left in a normal ``unresolved`` merge state.
1301 halted, the repository is left in a normal ``unresolved`` merge state.
1302 (default: ``continue``)
1302 (default: ``continue``)
1303
1303
1304 ``merge-patterns``
1304 ``merge-patterns``
1305 ------------------
1305 ------------------
1306
1306
1307 This section specifies merge tools to associate with particular file
1307 This section specifies merge tools to associate with particular file
1308 patterns. Tools matched here will take precedence over the default
1308 patterns. Tools matched here will take precedence over the default
1309 merge tool. Patterns are globs by default, rooted at the repository
1309 merge tool. Patterns are globs by default, rooted at the repository
1310 root.
1310 root.
1311
1311
1312 Example::
1312 Example::
1313
1313
1314 [merge-patterns]
1314 [merge-patterns]
1315 **.c = kdiff3
1315 **.c = kdiff3
1316 **.jpg = myimgmerge
1316 **.jpg = myimgmerge
1317
1317
1318 ``merge-tools``
1318 ``merge-tools``
1319 ---------------
1319 ---------------
1320
1320
1321 This section configures external merge tools to use for file-level
1321 This section configures external merge tools to use for file-level
1322 merges. This section has likely been preconfigured at install time.
1322 merges. This section has likely been preconfigured at install time.
1323 Use :hg:`config merge-tools` to check the existing configuration.
1323 Use :hg:`config merge-tools` to check the existing configuration.
1324 Also see :hg:`help merge-tools` for more details.
1324 Also see :hg:`help merge-tools` for more details.
1325
1325
1326 Example ``~/.hgrc``::
1326 Example ``~/.hgrc``::
1327
1327
1328 [merge-tools]
1328 [merge-tools]
1329 # Override stock tool location
1329 # Override stock tool location
1330 kdiff3.executable = ~/bin/kdiff3
1330 kdiff3.executable = ~/bin/kdiff3
1331 # Specify command line
1331 # Specify command line
1332 kdiff3.args = $base $local $other -o $output
1332 kdiff3.args = $base $local $other -o $output
1333 # Give higher priority
1333 # Give higher priority
1334 kdiff3.priority = 1
1334 kdiff3.priority = 1
1335
1335
1336 # Changing the priority of preconfigured tool
1336 # Changing the priority of preconfigured tool
1337 meld.priority = 0
1337 meld.priority = 0
1338
1338
1339 # Disable a preconfigured tool
1339 # Disable a preconfigured tool
1340 vimdiff.disabled = yes
1340 vimdiff.disabled = yes
1341
1341
1342 # Define new tool
1342 # Define new tool
1343 myHtmlTool.args = -m $local $other $base $output
1343 myHtmlTool.args = -m $local $other $base $output
1344 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1344 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1345 myHtmlTool.priority = 1
1345 myHtmlTool.priority = 1
1346
1346
1347 Supported arguments:
1347 Supported arguments:
1348
1348
1349 ``priority``
1349 ``priority``
1350 The priority in which to evaluate this tool.
1350 The priority in which to evaluate this tool.
1351 (default: 0)
1351 (default: 0)
1352
1352
1353 ``executable``
1353 ``executable``
1354 Either just the name of the executable or its pathname.
1354 Either just the name of the executable or its pathname.
1355
1355
1356 .. container:: windows
1356 .. container:: windows
1357
1357
1358 On Windows, the path can use environment variables with ${ProgramFiles}
1358 On Windows, the path can use environment variables with ${ProgramFiles}
1359 syntax.
1359 syntax.
1360
1360
1361 (default: the tool name)
1361 (default: the tool name)
1362
1362
1363 ``args``
1363 ``args``
1364 The arguments to pass to the tool executable. You can refer to the
1364 The arguments to pass to the tool executable. You can refer to the
1365 files being merged as well as the output file through these
1365 files being merged as well as the output file through these
1366 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1366 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1367 of ``$local`` and ``$other`` can vary depending on which action is being
1367 of ``$local`` and ``$other`` can vary depending on which action is being
1368 performed. During and update or merge, ``$local`` represents the original
1368 performed. During and update or merge, ``$local`` represents the original
1369 state of the file, while ``$other`` represents the commit you are updating
1369 state of the file, while ``$other`` represents the commit you are updating
1370 to or the commit you are merging with. During a rebase ``$local``
1370 to or the commit you are merging with. During a rebase ``$local``
1371 represents the destination of the rebase, and ``$other`` represents the
1371 represents the destination of the rebase, and ``$other`` represents the
1372 commit being rebased.
1372 commit being rebased.
1373 (default: ``$local $base $other``)
1373 (default: ``$local $base $other``)
1374
1374
1375 ``premerge``
1375 ``premerge``
1376 Attempt to run internal non-interactive 3-way merge tool before
1376 Attempt to run internal non-interactive 3-way merge tool before
1377 launching external tool. Options are ``true``, ``false``, ``keep`` or
1377 launching external tool. Options are ``true``, ``false``, ``keep`` or
1378 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1378 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1379 premerge fails. The ``keep-merge3`` will do the same but include information
1379 premerge fails. The ``keep-merge3`` will do the same but include information
1380 about the base of the merge in the marker (see internal :merge3 in
1380 about the base of the merge in the marker (see internal :merge3 in
1381 :hg:`help merge-tools`).
1381 :hg:`help merge-tools`).
1382 (default: True)
1382 (default: True)
1383
1383
1384 ``binary``
1384 ``binary``
1385 This tool can merge binary files. (default: False, unless tool
1385 This tool can merge binary files. (default: False, unless tool
1386 was selected by file pattern match)
1386 was selected by file pattern match)
1387
1387
1388 ``symlink``
1388 ``symlink``
1389 This tool can merge symlinks. (default: False)
1389 This tool can merge symlinks. (default: False)
1390
1390
1391 ``check``
1391 ``check``
1392 A list of merge success-checking options:
1392 A list of merge success-checking options:
1393
1393
1394 ``changed``
1394 ``changed``
1395 Ask whether merge was successful when the merged file shows no changes.
1395 Ask whether merge was successful when the merged file shows no changes.
1396 ``conflicts``
1396 ``conflicts``
1397 Check whether there are conflicts even though the tool reported success.
1397 Check whether there are conflicts even though the tool reported success.
1398 ``prompt``
1398 ``prompt``
1399 Always prompt for merge success, regardless of success reported by tool.
1399 Always prompt for merge success, regardless of success reported by tool.
1400
1400
1401 ``fixeol``
1401 ``fixeol``
1402 Attempt to fix up EOL changes caused by the merge tool.
1402 Attempt to fix up EOL changes caused by the merge tool.
1403 (default: False)
1403 (default: False)
1404
1404
1405 ``gui``
1405 ``gui``
1406 This tool requires a graphical interface to run. (default: False)
1406 This tool requires a graphical interface to run. (default: False)
1407
1407
1408 .. container:: windows
1408 .. container:: windows
1409
1409
1410 ``regkey``
1410 ``regkey``
1411 Windows registry key which describes install location of this
1411 Windows registry key which describes install location of this
1412 tool. Mercurial will search for this key first under
1412 tool. Mercurial will search for this key first under
1413 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1413 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1414 (default: None)
1414 (default: None)
1415
1415
1416 ``regkeyalt``
1416 ``regkeyalt``
1417 An alternate Windows registry key to try if the first key is not
1417 An alternate Windows registry key to try if the first key is not
1418 found. The alternate key uses the same ``regname`` and ``regappend``
1418 found. The alternate key uses the same ``regname`` and ``regappend``
1419 semantics of the primary key. The most common use for this key
1419 semantics of the primary key. The most common use for this key
1420 is to search for 32bit applications on 64bit operating systems.
1420 is to search for 32bit applications on 64bit operating systems.
1421 (default: None)
1421 (default: None)
1422
1422
1423 ``regname``
1423 ``regname``
1424 Name of value to read from specified registry key.
1424 Name of value to read from specified registry key.
1425 (default: the unnamed (default) value)
1425 (default: the unnamed (default) value)
1426
1426
1427 ``regappend``
1427 ``regappend``
1428 String to append to the value read from the registry, typically
1428 String to append to the value read from the registry, typically
1429 the executable name of the tool.
1429 the executable name of the tool.
1430 (default: None)
1430 (default: None)
1431
1431
1432 ``pager``
1432 ``pager``
1433 ---------
1433 ---------
1434
1434
1435 Setting used to control when to paginate and with what external tool. See
1435 Setting used to control when to paginate and with what external tool. See
1436 :hg:`help pager` for details.
1436 :hg:`help pager` for details.
1437
1437
1438 ``pager``
1438 ``pager``
1439 Define the external tool used as pager.
1439 Define the external tool used as pager.
1440
1440
1441 If no pager is set, Mercurial uses the environment variable $PAGER.
1441 If no pager is set, Mercurial uses the environment variable $PAGER.
1442 If neither pager.pager, nor $PAGER is set, a default pager will be
1442 If neither pager.pager, nor $PAGER is set, a default pager will be
1443 used, typically `less` on Unix and `more` on Windows. Example::
1443 used, typically `less` on Unix and `more` on Windows. Example::
1444
1444
1445 [pager]
1445 [pager]
1446 pager = less -FRX
1446 pager = less -FRX
1447
1447
1448 ``ignore``
1448 ``ignore``
1449 List of commands to disable the pager for. Example::
1449 List of commands to disable the pager for. Example::
1450
1450
1451 [pager]
1451 [pager]
1452 ignore = version, help, update
1452 ignore = version, help, update
1453
1453
1454 ``patch``
1454 ``patch``
1455 ---------
1455 ---------
1456
1456
1457 Settings used when applying patches, for instance through the 'import'
1457 Settings used when applying patches, for instance through the 'import'
1458 command or with Mercurial Queues extension.
1458 command or with Mercurial Queues extension.
1459
1459
1460 ``eol``
1460 ``eol``
1461 When set to 'strict' patch content and patched files end of lines
1461 When set to 'strict' patch content and patched files end of lines
1462 are preserved. When set to ``lf`` or ``crlf``, both files end of
1462 are preserved. When set to ``lf`` or ``crlf``, both files end of
1463 lines are ignored when patching and the result line endings are
1463 lines are ignored when patching and the result line endings are
1464 normalized to either LF (Unix) or CRLF (Windows). When set to
1464 normalized to either LF (Unix) or CRLF (Windows). When set to
1465 ``auto``, end of lines are again ignored while patching but line
1465 ``auto``, end of lines are again ignored while patching but line
1466 endings in patched files are normalized to their original setting
1466 endings in patched files are normalized to their original setting
1467 on a per-file basis. If target file does not exist or has no end
1467 on a per-file basis. If target file does not exist or has no end
1468 of line, patch line endings are preserved.
1468 of line, patch line endings are preserved.
1469 (default: strict)
1469 (default: strict)
1470
1470
1471 ``fuzz``
1471 ``fuzz``
1472 The number of lines of 'fuzz' to allow when applying patches. This
1472 The number of lines of 'fuzz' to allow when applying patches. This
1473 controls how much context the patcher is allowed to ignore when
1473 controls how much context the patcher is allowed to ignore when
1474 trying to apply a patch.
1474 trying to apply a patch.
1475 (default: 2)
1475 (default: 2)
1476
1476
1477 ``paths``
1477 ``paths``
1478 ---------
1478 ---------
1479
1479
1480 Assigns symbolic names and behavior to repositories.
1480 Assigns symbolic names and behavior to repositories.
1481
1481
1482 Options are symbolic names defining the URL or directory that is the
1482 Options are symbolic names defining the URL or directory that is the
1483 location of the repository. Example::
1483 location of the repository. Example::
1484
1484
1485 [paths]
1485 [paths]
1486 my_server = https://example.com/my_repo
1486 my_server = https://example.com/my_repo
1487 local_path = /home/me/repo
1487 local_path = /home/me/repo
1488
1488
1489 These symbolic names can be used from the command line. To pull
1489 These symbolic names can be used from the command line. To pull
1490 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1490 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1491 :hg:`push local_path`.
1491 :hg:`push local_path`.
1492
1492
1493 Options containing colons (``:``) denote sub-options that can influence
1493 Options containing colons (``:``) denote sub-options that can influence
1494 behavior for that specific path. Example::
1494 behavior for that specific path. Example::
1495
1495
1496 [paths]
1496 [paths]
1497 my_server = https://example.com/my_path
1497 my_server = https://example.com/my_path
1498 my_server:pushurl = ssh://example.com/my_path
1498 my_server:pushurl = ssh://example.com/my_path
1499
1499
1500 The following sub-options can be defined:
1500 The following sub-options can be defined:
1501
1501
1502 ``pushurl``
1502 ``pushurl``
1503 The URL to use for push operations. If not defined, the location
1503 The URL to use for push operations. If not defined, the location
1504 defined by the path's main entry is used.
1504 defined by the path's main entry is used.
1505
1505
1506 ``pushrev``
1506 ``pushrev``
1507 A revset defining which revisions to push by default.
1507 A revset defining which revisions to push by default.
1508
1508
1509 When :hg:`push` is executed without a ``-r`` argument, the revset
1509 When :hg:`push` is executed without a ``-r`` argument, the revset
1510 defined by this sub-option is evaluated to determine what to push.
1510 defined by this sub-option is evaluated to determine what to push.
1511
1511
1512 For example, a value of ``.`` will push the working directory's
1512 For example, a value of ``.`` will push the working directory's
1513 revision by default.
1513 revision by default.
1514
1514
1515 Revsets specifying bookmarks will not result in the bookmark being
1515 Revsets specifying bookmarks will not result in the bookmark being
1516 pushed.
1516 pushed.
1517
1517
1518 The following special named paths exist:
1518 The following special named paths exist:
1519
1519
1520 ``default``
1520 ``default``
1521 The URL or directory to use when no source or remote is specified.
1521 The URL or directory to use when no source or remote is specified.
1522
1522
1523 :hg:`clone` will automatically define this path to the location the
1523 :hg:`clone` will automatically define this path to the location the
1524 repository was cloned from.
1524 repository was cloned from.
1525
1525
1526 ``default-push``
1526 ``default-push``
1527 (deprecated) The URL or directory for the default :hg:`push` location.
1527 (deprecated) The URL or directory for the default :hg:`push` location.
1528 ``default:pushurl`` should be used instead.
1528 ``default:pushurl`` should be used instead.
1529
1529
1530 ``phases``
1530 ``phases``
1531 ----------
1531 ----------
1532
1532
1533 Specifies default handling of phases. See :hg:`help phases` for more
1533 Specifies default handling of phases. See :hg:`help phases` for more
1534 information about working with phases.
1534 information about working with phases.
1535
1535
1536 ``publish``
1536 ``publish``
1537 Controls draft phase behavior when working as a server. When true,
1537 Controls draft phase behavior when working as a server. When true,
1538 pushed changesets are set to public in both client and server and
1538 pushed changesets are set to public in both client and server and
1539 pulled or cloned changesets are set to public in the client.
1539 pulled or cloned changesets are set to public in the client.
1540 (default: True)
1540 (default: True)
1541
1541
1542 ``new-commit``
1542 ``new-commit``
1543 Phase of newly-created commits.
1543 Phase of newly-created commits.
1544 (default: draft)
1544 (default: draft)
1545
1545
1546 ``checksubrepos``
1546 ``checksubrepos``
1547 Check the phase of the current revision of each subrepository. Allowed
1547 Check the phase of the current revision of each subrepository. Allowed
1548 values are "ignore", "follow" and "abort". For settings other than
1548 values are "ignore", "follow" and "abort". For settings other than
1549 "ignore", the phase of the current revision of each subrepository is
1549 "ignore", the phase of the current revision of each subrepository is
1550 checked before committing the parent repository. If any of those phases is
1550 checked before committing the parent repository. If any of those phases is
1551 greater than the phase of the parent repository (e.g. if a subrepo is in a
1551 greater than the phase of the parent repository (e.g. if a subrepo is in a
1552 "secret" phase while the parent repo is in "draft" phase), the commit is
1552 "secret" phase while the parent repo is in "draft" phase), the commit is
1553 either aborted (if checksubrepos is set to "abort") or the higher phase is
1553 either aborted (if checksubrepos is set to "abort") or the higher phase is
1554 used for the parent repository commit (if set to "follow").
1554 used for the parent repository commit (if set to "follow").
1555 (default: follow)
1555 (default: follow)
1556
1556
1557
1557
1558 ``profiling``
1558 ``profiling``
1559 -------------
1559 -------------
1560
1560
1561 Specifies profiling type, format, and file output. Two profilers are
1561 Specifies profiling type, format, and file output. Two profilers are
1562 supported: an instrumenting profiler (named ``ls``), and a sampling
1562 supported: an instrumenting profiler (named ``ls``), and a sampling
1563 profiler (named ``stat``).
1563 profiler (named ``stat``).
1564
1564
1565 In this section description, 'profiling data' stands for the raw data
1565 In this section description, 'profiling data' stands for the raw data
1566 collected during profiling, while 'profiling report' stands for a
1566 collected during profiling, while 'profiling report' stands for a
1567 statistical text report generated from the profiling data. The
1567 statistical text report generated from the profiling data. The
1568 profiling is done using lsprof.
1568 profiling is done using lsprof.
1569
1569
1570 ``enabled``
1570 ``enabled``
1571 Enable the profiler.
1571 Enable the profiler.
1572 (default: false)
1572 (default: false)
1573
1573
1574 This is equivalent to passing ``--profile`` on the command line.
1574 This is equivalent to passing ``--profile`` on the command line.
1575
1575
1576 ``type``
1576 ``type``
1577 The type of profiler to use.
1577 The type of profiler to use.
1578 (default: stat)
1578 (default: stat)
1579
1579
1580 ``ls``
1580 ``ls``
1581 Use Python's built-in instrumenting profiler. This profiler
1581 Use Python's built-in instrumenting profiler. This profiler
1582 works on all platforms, but each line number it reports is the
1582 works on all platforms, but each line number it reports is the
1583 first line of a function. This restriction makes it difficult to
1583 first line of a function. This restriction makes it difficult to
1584 identify the expensive parts of a non-trivial function.
1584 identify the expensive parts of a non-trivial function.
1585 ``stat``
1585 ``stat``
1586 Use a statistical profiler, statprof. This profiler is most
1586 Use a statistical profiler, statprof. This profiler is most
1587 useful for profiling commands that run for longer than about 0.1
1587 useful for profiling commands that run for longer than about 0.1
1588 seconds.
1588 seconds.
1589
1589
1590 ``format``
1590 ``format``
1591 Profiling format. Specific to the ``ls`` instrumenting profiler.
1591 Profiling format. Specific to the ``ls`` instrumenting profiler.
1592 (default: text)
1592 (default: text)
1593
1593
1594 ``text``
1594 ``text``
1595 Generate a profiling report. When saving to a file, it should be
1595 Generate a profiling report. When saving to a file, it should be
1596 noted that only the report is saved, and the profiling data is
1596 noted that only the report is saved, and the profiling data is
1597 not kept.
1597 not kept.
1598 ``kcachegrind``
1598 ``kcachegrind``
1599 Format profiling data for kcachegrind use: when saving to a
1599 Format profiling data for kcachegrind use: when saving to a
1600 file, the generated file can directly be loaded into
1600 file, the generated file can directly be loaded into
1601 kcachegrind.
1601 kcachegrind.
1602
1602
1603 ``statformat``
1603 ``statformat``
1604 Profiling format for the ``stat`` profiler.
1604 Profiling format for the ``stat`` profiler.
1605 (default: hotpath)
1605 (default: hotpath)
1606
1606
1607 ``hotpath``
1607 ``hotpath``
1608 Show a tree-based display containing the hot path of execution (where
1608 Show a tree-based display containing the hot path of execution (where
1609 most time was spent).
1609 most time was spent).
1610 ``bymethod``
1610 ``bymethod``
1611 Show a table of methods ordered by how frequently they are active.
1611 Show a table of methods ordered by how frequently they are active.
1612 ``byline``
1612 ``byline``
1613 Show a table of lines in files ordered by how frequently they are active.
1613 Show a table of lines in files ordered by how frequently they are active.
1614 ``json``
1614 ``json``
1615 Render profiling data as JSON.
1615 Render profiling data as JSON.
1616
1616
1617 ``frequency``
1617 ``frequency``
1618 Sampling frequency. Specific to the ``stat`` sampling profiler.
1618 Sampling frequency. Specific to the ``stat`` sampling profiler.
1619 (default: 1000)
1619 (default: 1000)
1620
1620
1621 ``output``
1621 ``output``
1622 File path where profiling data or report should be saved. If the
1622 File path where profiling data or report should be saved. If the
1623 file exists, it is replaced. (default: None, data is printed on
1623 file exists, it is replaced. (default: None, data is printed on
1624 stderr)
1624 stderr)
1625
1625
1626 ``sort``
1626 ``sort``
1627 Sort field. Specific to the ``ls`` instrumenting profiler.
1627 Sort field. Specific to the ``ls`` instrumenting profiler.
1628 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1628 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1629 ``inlinetime``.
1629 ``inlinetime``.
1630 (default: inlinetime)
1630 (default: inlinetime)
1631
1631
1632 ``limit``
1632 ``limit``
1633 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1633 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1634 (default: 30)
1634 (default: 30)
1635
1635
1636 ``nested``
1636 ``nested``
1637 Show at most this number of lines of drill-down info after each main entry.
1637 Show at most this number of lines of drill-down info after each main entry.
1638 This can help explain the difference between Total and Inline.
1638 This can help explain the difference between Total and Inline.
1639 Specific to the ``ls`` instrumenting profiler.
1639 Specific to the ``ls`` instrumenting profiler.
1640 (default: 5)
1640 (default: 5)
1641
1641
1642 ``showmin``
1642 ``showmin``
1643 Minimum fraction of samples an entry must have for it to be displayed.
1643 Minimum fraction of samples an entry must have for it to be displayed.
1644 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1644 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1645 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1645 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1646
1646
1647 Only used by the ``stat`` profiler.
1647 Only used by the ``stat`` profiler.
1648
1648
1649 For the ``hotpath`` format, default is ``0.05``.
1649 For the ``hotpath`` format, default is ``0.05``.
1650 For the ``chrome`` format, default is ``0.005``.
1650 For the ``chrome`` format, default is ``0.005``.
1651
1651
1652 The option is unused on other formats.
1652 The option is unused on other formats.
1653
1653
1654 ``showmax``
1654 ``showmax``
1655 Maximum fraction of samples an entry can have before it is ignored in
1655 Maximum fraction of samples an entry can have before it is ignored in
1656 display. Values format is the same as ``showmin``.
1656 display. Values format is the same as ``showmin``.
1657
1657
1658 Only used by the ``stat`` profiler.
1658 Only used by the ``stat`` profiler.
1659
1659
1660 For the ``chrome`` format, default is ``0.999``.
1660 For the ``chrome`` format, default is ``0.999``.
1661
1661
1662 The option is unused on other formats.
1662 The option is unused on other formats.
1663
1663
1664 ``progress``
1664 ``progress``
1665 ------------
1665 ------------
1666
1666
1667 Mercurial commands can draw progress bars that are as informative as
1667 Mercurial commands can draw progress bars that are as informative as
1668 possible. Some progress bars only offer indeterminate information, while others
1668 possible. Some progress bars only offer indeterminate information, while others
1669 have a definite end point.
1669 have a definite end point.
1670
1670
1671 ``delay``
1671 ``delay``
1672 Number of seconds (float) before showing the progress bar. (default: 3)
1672 Number of seconds (float) before showing the progress bar. (default: 3)
1673
1673
1674 ``changedelay``
1674 ``changedelay``
1675 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1675 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1676 that value will be used instead. (default: 1)
1676 that value will be used instead. (default: 1)
1677
1677
1678 ``estimateinterval``
1678 ``estimateinterval``
1679 Maximum sampling interval in seconds for speed and estimated time
1679 Maximum sampling interval in seconds for speed and estimated time
1680 calculation. (default: 60)
1680 calculation. (default: 60)
1681
1681
1682 ``refresh``
1682 ``refresh``
1683 Time in seconds between refreshes of the progress bar. (default: 0.1)
1683 Time in seconds between refreshes of the progress bar. (default: 0.1)
1684
1684
1685 ``format``
1685 ``format``
1686 Format of the progress bar.
1686 Format of the progress bar.
1687
1687
1688 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1688 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1689 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1689 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1690 last 20 characters of the item, but this can be changed by adding either
1690 last 20 characters of the item, but this can be changed by adding either
1691 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1691 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1692 first num characters.
1692 first num characters.
1693
1693
1694 (default: topic bar number estimate)
1694 (default: topic bar number estimate)
1695
1695
1696 ``width``
1696 ``width``
1697 If set, the maximum width of the progress information (that is, min(width,
1697 If set, the maximum width of the progress information (that is, min(width,
1698 term width) will be used).
1698 term width) will be used).
1699
1699
1700 ``clear-complete``
1700 ``clear-complete``
1701 Clear the progress bar after it's done. (default: True)
1701 Clear the progress bar after it's done. (default: True)
1702
1702
1703 ``disable``
1703 ``disable``
1704 If true, don't show a progress bar.
1704 If true, don't show a progress bar.
1705
1705
1706 ``assume-tty``
1706 ``assume-tty``
1707 If true, ALWAYS show a progress bar, unless disable is given.
1707 If true, ALWAYS show a progress bar, unless disable is given.
1708
1708
1709 ``rebase``
1709 ``rebase``
1710 ----------
1710 ----------
1711
1711
1712 ``evolution.allowdivergence``
1712 ``evolution.allowdivergence``
1713 Default to False, when True allow creating divergence when performing
1713 Default to False, when True allow creating divergence when performing
1714 rebase of obsolete changesets.
1714 rebase of obsolete changesets.
1715
1715
1716 ``revsetalias``
1716 ``revsetalias``
1717 ---------------
1717 ---------------
1718
1718
1719 Alias definitions for revsets. See :hg:`help revsets` for details.
1719 Alias definitions for revsets. See :hg:`help revsets` for details.
1720
1720
1721 ``server``
1721 ``server``
1722 ----------
1722 ----------
1723
1723
1724 Controls generic server settings.
1724 Controls generic server settings.
1725
1725
1726 ``compressionengines``
1726 ``compressionengines``
1727 List of compression engines and their relative priority to advertise
1727 List of compression engines and their relative priority to advertise
1728 to clients.
1728 to clients.
1729
1729
1730 The order of compression engines determines their priority, the first
1730 The order of compression engines determines their priority, the first
1731 having the highest priority. If a compression engine is not listed
1731 having the highest priority. If a compression engine is not listed
1732 here, it won't be advertised to clients.
1732 here, it won't be advertised to clients.
1733
1733
1734 If not set (the default), built-in defaults are used. Run
1734 If not set (the default), built-in defaults are used. Run
1735 :hg:`debuginstall` to list available compression engines and their
1735 :hg:`debuginstall` to list available compression engines and their
1736 default wire protocol priority.
1736 default wire protocol priority.
1737
1737
1738 Older Mercurial clients only support zlib compression and this setting
1738 Older Mercurial clients only support zlib compression and this setting
1739 has no effect for legacy clients.
1739 has no effect for legacy clients.
1740
1740
1741 ``uncompressed``
1741 ``uncompressed``
1742 Whether to allow clients to clone a repository using the
1742 Whether to allow clients to clone a repository using the
1743 uncompressed streaming protocol. This transfers about 40% more
1743 uncompressed streaming protocol. This transfers about 40% more
1744 data than a regular clone, but uses less memory and CPU on both
1744 data than a regular clone, but uses less memory and CPU on both
1745 server and client. Over a LAN (100 Mbps or better) or a very fast
1745 server and client. Over a LAN (100 Mbps or better) or a very fast
1746 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1746 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1747 regular clone. Over most WAN connections (anything slower than
1747 regular clone. Over most WAN connections (anything slower than
1748 about 6 Mbps), uncompressed streaming is slower, because of the
1748 about 6 Mbps), uncompressed streaming is slower, because of the
1749 extra data transfer overhead. This mode will also temporarily hold
1749 extra data transfer overhead. This mode will also temporarily hold
1750 the write lock while determining what data to transfer.
1750 the write lock while determining what data to transfer.
1751 (default: True)
1751 (default: True)
1752
1752
1753 ``uncompressedallowsecret``
1753 ``uncompressedallowsecret``
1754 Whether to allow stream clones when the repository contains secret
1754 Whether to allow stream clones when the repository contains secret
1755 changesets. (default: False)
1755 changesets. (default: False)
1756
1756
1757 ``preferuncompressed``
1757 ``preferuncompressed``
1758 When set, clients will try to use the uncompressed streaming
1758 When set, clients will try to use the uncompressed streaming
1759 protocol. (default: False)
1759 protocol. (default: False)
1760
1760
1761 ``disablefullbundle``
1761 ``disablefullbundle``
1762 When set, servers will refuse attempts to do pull-based clones.
1762 When set, servers will refuse attempts to do pull-based clones.
1763 If this option is set, ``preferuncompressed`` and/or clone bundles
1763 If this option is set, ``preferuncompressed`` and/or clone bundles
1764 are highly recommended. Partial clones will still be allowed.
1764 are highly recommended. Partial clones will still be allowed.
1765 (default: False)
1765 (default: False)
1766
1766
1767 ``concurrent-push-mode``
1767 ``concurrent-push-mode``
1768 Level of allowed race condition between two pushing clients.
1768 Level of allowed race condition between two pushing clients.
1769
1769
1770 - 'strict': push is abort if another client touched the repository
1770 - 'strict': push is abort if another client touched the repository
1771 while the push was preparing. (default)
1771 while the push was preparing. (default)
1772 - 'check-related': push is only aborted if it affects head that got also
1772 - 'check-related': push is only aborted if it affects head that got also
1773 affected while the push was preparing.
1773 affected while the push was preparing.
1774
1774
1775 This requires compatible client (version 4.3 and later). Old client will
1775 This requires compatible client (version 4.3 and later). Old client will
1776 use 'strict'.
1776 use 'strict'.
1777
1777
1778 ``validate``
1778 ``validate``
1779 Whether to validate the completeness of pushed changesets by
1779 Whether to validate the completeness of pushed changesets by
1780 checking that all new file revisions specified in manifests are
1780 checking that all new file revisions specified in manifests are
1781 present. (default: False)
1781 present. (default: False)
1782
1782
1783 ``maxhttpheaderlen``
1783 ``maxhttpheaderlen``
1784 Instruct HTTP clients not to send request headers longer than this
1784 Instruct HTTP clients not to send request headers longer than this
1785 many bytes. (default: 1024)
1785 many bytes. (default: 1024)
1786
1786
1787 ``bundle1``
1787 ``bundle1``
1788 Whether to allow clients to push and pull using the legacy bundle1
1788 Whether to allow clients to push and pull using the legacy bundle1
1789 exchange format. (default: True)
1789 exchange format. (default: True)
1790
1790
1791 ``bundle1gd``
1791 ``bundle1gd``
1792 Like ``bundle1`` but only used if the repository is using the
1792 Like ``bundle1`` but only used if the repository is using the
1793 *generaldelta* storage format. (default: True)
1793 *generaldelta* storage format. (default: True)
1794
1794
1795 ``bundle1.push``
1795 ``bundle1.push``
1796 Whether to allow clients to push using the legacy bundle1 exchange
1796 Whether to allow clients to push using the legacy bundle1 exchange
1797 format. (default: True)
1797 format. (default: True)
1798
1798
1799 ``bundle1gd.push``
1799 ``bundle1gd.push``
1800 Like ``bundle1.push`` but only used if the repository is using the
1800 Like ``bundle1.push`` but only used if the repository is using the
1801 *generaldelta* storage format. (default: True)
1801 *generaldelta* storage format. (default: True)
1802
1802
1803 ``bundle1.pull``
1803 ``bundle1.pull``
1804 Whether to allow clients to pull using the legacy bundle1 exchange
1804 Whether to allow clients to pull using the legacy bundle1 exchange
1805 format. (default: True)
1805 format. (default: True)
1806
1806
1807 ``bundle1gd.pull``
1807 ``bundle1gd.pull``
1808 Like ``bundle1.pull`` but only used if the repository is using the
1808 Like ``bundle1.pull`` but only used if the repository is using the
1809 *generaldelta* storage format. (default: True)
1809 *generaldelta* storage format. (default: True)
1810
1810
1811 Large repositories using the *generaldelta* storage format should
1811 Large repositories using the *generaldelta* storage format should
1812 consider setting this option because converting *generaldelta*
1812 consider setting this option because converting *generaldelta*
1813 repositories to the exchange format required by the bundle1 data
1813 repositories to the exchange format required by the bundle1 data
1814 format can consume a lot of CPU.
1814 format can consume a lot of CPU.
1815
1815
1816 ``zliblevel``
1816 ``zliblevel``
1817 Integer between ``-1`` and ``9`` that controls the zlib compression level
1817 Integer between ``-1`` and ``9`` that controls the zlib compression level
1818 for wire protocol commands that send zlib compressed output (notably the
1818 for wire protocol commands that send zlib compressed output (notably the
1819 commands that send repository history data).
1819 commands that send repository history data).
1820
1820
1821 The default (``-1``) uses the default zlib compression level, which is
1821 The default (``-1``) uses the default zlib compression level, which is
1822 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1822 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1823 maximum compression.
1823 maximum compression.
1824
1824
1825 Setting this option allows server operators to make trade-offs between
1825 Setting this option allows server operators to make trade-offs between
1826 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1826 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1827 but sends more bytes to clients.
1827 but sends more bytes to clients.
1828
1828
1829 This option only impacts the HTTP server.
1829 This option only impacts the HTTP server.
1830
1830
1831 ``zstdlevel``
1831 ``zstdlevel``
1832 Integer between ``1`` and ``22`` that controls the zstd compression level
1832 Integer between ``1`` and ``22`` that controls the zstd compression level
1833 for wire protocol commands. ``1`` is the minimal amount of compression and
1833 for wire protocol commands. ``1`` is the minimal amount of compression and
1834 ``22`` is the highest amount of compression.
1834 ``22`` is the highest amount of compression.
1835
1835
1836 The default (``3``) should be significantly faster than zlib while likely
1836 The default (``3``) should be significantly faster than zlib while likely
1837 delivering better compression ratios.
1837 delivering better compression ratios.
1838
1838
1839 This option only impacts the HTTP server.
1839 This option only impacts the HTTP server.
1840
1840
1841 See also ``server.zliblevel``.
1841 See also ``server.zliblevel``.
1842
1842
1843 ``smtp``
1843 ``smtp``
1844 --------
1844 --------
1845
1845
1846 Configuration for extensions that need to send email messages.
1846 Configuration for extensions that need to send email messages.
1847
1847
1848 ``host``
1848 ``host``
1849 Host name of mail server, e.g. "mail.example.com".
1849 Host name of mail server, e.g. "mail.example.com".
1850
1850
1851 ``port``
1851 ``port``
1852 Optional. Port to connect to on mail server. (default: 465 if
1852 Optional. Port to connect to on mail server. (default: 465 if
1853 ``tls`` is smtps; 25 otherwise)
1853 ``tls`` is smtps; 25 otherwise)
1854
1854
1855 ``tls``
1855 ``tls``
1856 Optional. Method to enable TLS when connecting to mail server: starttls,
1856 Optional. Method to enable TLS when connecting to mail server: starttls,
1857 smtps or none. (default: none)
1857 smtps or none. (default: none)
1858
1858
1859 ``username``
1859 ``username``
1860 Optional. User name for authenticating with the SMTP server.
1860 Optional. User name for authenticating with the SMTP server.
1861 (default: None)
1861 (default: None)
1862
1862
1863 ``password``
1863 ``password``
1864 Optional. Password for authenticating with the SMTP server. If not
1864 Optional. Password for authenticating with the SMTP server. If not
1865 specified, interactive sessions will prompt the user for a
1865 specified, interactive sessions will prompt the user for a
1866 password; non-interactive sessions will fail. (default: None)
1866 password; non-interactive sessions will fail. (default: None)
1867
1867
1868 ``local_hostname``
1868 ``local_hostname``
1869 Optional. The hostname that the sender can use to identify
1869 Optional. The hostname that the sender can use to identify
1870 itself to the MTA.
1870 itself to the MTA.
1871
1871
1872
1872
1873 ``subpaths``
1873 ``subpaths``
1874 ------------
1874 ------------
1875
1875
1876 Subrepository source URLs can go stale if a remote server changes name
1876 Subrepository source URLs can go stale if a remote server changes name
1877 or becomes temporarily unavailable. This section lets you define
1877 or becomes temporarily unavailable. This section lets you define
1878 rewrite rules of the form::
1878 rewrite rules of the form::
1879
1879
1880 <pattern> = <replacement>
1880 <pattern> = <replacement>
1881
1881
1882 where ``pattern`` is a regular expression matching a subrepository
1882 where ``pattern`` is a regular expression matching a subrepository
1883 source URL and ``replacement`` is the replacement string used to
1883 source URL and ``replacement`` is the replacement string used to
1884 rewrite it. Groups can be matched in ``pattern`` and referenced in
1884 rewrite it. Groups can be matched in ``pattern`` and referenced in
1885 ``replacements``. For instance::
1885 ``replacements``. For instance::
1886
1886
1887 http://server/(.*)-hg/ = http://hg.server/\1/
1887 http://server/(.*)-hg/ = http://hg.server/\1/
1888
1888
1889 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1889 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1890
1890
1891 Relative subrepository paths are first made absolute, and the
1891 Relative subrepository paths are first made absolute, and the
1892 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1892 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1893 doesn't match the full path, an attempt is made to apply it on the
1893 doesn't match the full path, an attempt is made to apply it on the
1894 relative path alone. The rules are applied in definition order.
1894 relative path alone. The rules are applied in definition order.
1895
1895
1896 ``subrepos``
1897 ------------
1898
1899 This section contains options that control the behavior of the
1900 subrepositories feature. See also :hg:`help subrepos`.
1901
1902 Security note: auditing in Mercurial is known to be insufficient to
1903 prevent clone-time code execution with carefully constructed Git
1904 subrepos. It is unknown if a similar detect is present in Subversion
1905 subrepos. Both Git and Subversion subrepos are disabled by default
1906 out of security concerns. These subrepo types can be enabled using
1907 the respective options below.
1908
1909 ``allowed``
1910 Whether subrepositories are allowed in the working directory.
1911
1912 When false, commands involving subrepositories (like :hg:`update`)
1913 will fail for all subrepository types.
1914 (default: true)
1915
1916 ``hg:allowed``
1917 Whether Mercurial subrepositories are allowed in the working
1918 directory. This option only has an effect if ``subrepos.allowed``
1919 is true.
1920 (default: true)
1921
1922 ``git:allowed``
1923 Whether Git subrepositories are allowed in the working directory.
1924 This option only has an effect if ``subrepos.allowed`` is true.
1925
1926 See the security note above before enabling Git subrepos.
1927 (default: false)
1928
1929 ``svn:allowed``
1930 Whether Subversion subrepositories are allowed in the working
1931 directory. This option only has an effect if ``subrepos.allowed``
1932 is true.
1933
1934 See the security note above before enabling Subversion subrepos.
1935 (default: false)
1936
1896 ``templatealias``
1937 ``templatealias``
1897 -----------------
1938 -----------------
1898
1939
1899 Alias definitions for templates. See :hg:`help templates` for details.
1940 Alias definitions for templates. See :hg:`help templates` for details.
1900
1941
1901 ``templates``
1942 ``templates``
1902 -------------
1943 -------------
1903
1944
1904 Use the ``[templates]`` section to define template strings.
1945 Use the ``[templates]`` section to define template strings.
1905 See :hg:`help templates` for details.
1946 See :hg:`help templates` for details.
1906
1947
1907 ``trusted``
1948 ``trusted``
1908 -----------
1949 -----------
1909
1950
1910 Mercurial will not use the settings in the
1951 Mercurial will not use the settings in the
1911 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1952 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1912 user or to a trusted group, as various hgrc features allow arbitrary
1953 user or to a trusted group, as various hgrc features allow arbitrary
1913 commands to be run. This issue is often encountered when configuring
1954 commands to be run. This issue is often encountered when configuring
1914 hooks or extensions for shared repositories or servers. However,
1955 hooks or extensions for shared repositories or servers. However,
1915 the web interface will use some safe settings from the ``[web]``
1956 the web interface will use some safe settings from the ``[web]``
1916 section.
1957 section.
1917
1958
1918 This section specifies what users and groups are trusted. The
1959 This section specifies what users and groups are trusted. The
1919 current user is always trusted. To trust everybody, list a user or a
1960 current user is always trusted. To trust everybody, list a user or a
1920 group with name ``*``. These settings must be placed in an
1961 group with name ``*``. These settings must be placed in an
1921 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1962 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1922 user or service running Mercurial.
1963 user or service running Mercurial.
1923
1964
1924 ``users``
1965 ``users``
1925 Comma-separated list of trusted users.
1966 Comma-separated list of trusted users.
1926
1967
1927 ``groups``
1968 ``groups``
1928 Comma-separated list of trusted groups.
1969 Comma-separated list of trusted groups.
1929
1970
1930
1971
1931 ``ui``
1972 ``ui``
1932 ------
1973 ------
1933
1974
1934 User interface controls.
1975 User interface controls.
1935
1976
1936 ``archivemeta``
1977 ``archivemeta``
1937 Whether to include the .hg_archival.txt file containing meta data
1978 Whether to include the .hg_archival.txt file containing meta data
1938 (hashes for the repository base and for tip) in archives created
1979 (hashes for the repository base and for tip) in archives created
1939 by the :hg:`archive` command or downloaded via hgweb.
1980 by the :hg:`archive` command or downloaded via hgweb.
1940 (default: True)
1981 (default: True)
1941
1982
1942 ``askusername``
1983 ``askusername``
1943 Whether to prompt for a username when committing. If True, and
1984 Whether to prompt for a username when committing. If True, and
1944 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1985 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1945 be prompted to enter a username. If no username is entered, the
1986 be prompted to enter a username. If no username is entered, the
1946 default ``USER@HOST`` is used instead.
1987 default ``USER@HOST`` is used instead.
1947 (default: False)
1988 (default: False)
1948
1989
1949 ``clonebundles``
1990 ``clonebundles``
1950 Whether the "clone bundles" feature is enabled.
1991 Whether the "clone bundles" feature is enabled.
1951
1992
1952 When enabled, :hg:`clone` may download and apply a server-advertised
1993 When enabled, :hg:`clone` may download and apply a server-advertised
1953 bundle file from a URL instead of using the normal exchange mechanism.
1994 bundle file from a URL instead of using the normal exchange mechanism.
1954
1995
1955 This can likely result in faster and more reliable clones.
1996 This can likely result in faster and more reliable clones.
1956
1997
1957 (default: True)
1998 (default: True)
1958
1999
1959 ``clonebundlefallback``
2000 ``clonebundlefallback``
1960 Whether failure to apply an advertised "clone bundle" from a server
2001 Whether failure to apply an advertised "clone bundle" from a server
1961 should result in fallback to a regular clone.
2002 should result in fallback to a regular clone.
1962
2003
1963 This is disabled by default because servers advertising "clone
2004 This is disabled by default because servers advertising "clone
1964 bundles" often do so to reduce server load. If advertised bundles
2005 bundles" often do so to reduce server load. If advertised bundles
1965 start mass failing and clients automatically fall back to a regular
2006 start mass failing and clients automatically fall back to a regular
1966 clone, this would add significant and unexpected load to the server
2007 clone, this would add significant and unexpected load to the server
1967 since the server is expecting clone operations to be offloaded to
2008 since the server is expecting clone operations to be offloaded to
1968 pre-generated bundles. Failing fast (the default behavior) ensures
2009 pre-generated bundles. Failing fast (the default behavior) ensures
1969 clients don't overwhelm the server when "clone bundle" application
2010 clients don't overwhelm the server when "clone bundle" application
1970 fails.
2011 fails.
1971
2012
1972 (default: False)
2013 (default: False)
1973
2014
1974 ``clonebundleprefers``
2015 ``clonebundleprefers``
1975 Defines preferences for which "clone bundles" to use.
2016 Defines preferences for which "clone bundles" to use.
1976
2017
1977 Servers advertising "clone bundles" may advertise multiple available
2018 Servers advertising "clone bundles" may advertise multiple available
1978 bundles. Each bundle may have different attributes, such as the bundle
2019 bundles. Each bundle may have different attributes, such as the bundle
1979 type and compression format. This option is used to prefer a particular
2020 type and compression format. This option is used to prefer a particular
1980 bundle over another.
2021 bundle over another.
1981
2022
1982 The following keys are defined by Mercurial:
2023 The following keys are defined by Mercurial:
1983
2024
1984 BUNDLESPEC
2025 BUNDLESPEC
1985 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2026 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
1986 e.g. ``gzip-v2`` or ``bzip2-v1``.
2027 e.g. ``gzip-v2`` or ``bzip2-v1``.
1987
2028
1988 COMPRESSION
2029 COMPRESSION
1989 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2030 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
1990
2031
1991 Server operators may define custom keys.
2032 Server operators may define custom keys.
1992
2033
1993 Example values: ``COMPRESSION=bzip2``,
2034 Example values: ``COMPRESSION=bzip2``,
1994 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2035 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
1995
2036
1996 By default, the first bundle advertised by the server is used.
2037 By default, the first bundle advertised by the server is used.
1997
2038
1998 ``color``
2039 ``color``
1999 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2040 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2000 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2041 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2001 seems possible. See :hg:`help color` for details.
2042 seems possible. See :hg:`help color` for details.
2002
2043
2003 ``commitsubrepos``
2044 ``commitsubrepos``
2004 Whether to commit modified subrepositories when committing the
2045 Whether to commit modified subrepositories when committing the
2005 parent repository. If False and one subrepository has uncommitted
2046 parent repository. If False and one subrepository has uncommitted
2006 changes, abort the commit.
2047 changes, abort the commit.
2007 (default: False)
2048 (default: False)
2008
2049
2009 ``debug``
2050 ``debug``
2010 Print debugging information. (default: False)
2051 Print debugging information. (default: False)
2011
2052
2012 ``editor``
2053 ``editor``
2013 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2054 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2014
2055
2015 ``fallbackencoding``
2056 ``fallbackencoding``
2016 Encoding to try if it's not possible to decode the changelog using
2057 Encoding to try if it's not possible to decode the changelog using
2017 UTF-8. (default: ISO-8859-1)
2058 UTF-8. (default: ISO-8859-1)
2018
2059
2019 ``graphnodetemplate``
2060 ``graphnodetemplate``
2020 The template used to print changeset nodes in an ASCII revision graph.
2061 The template used to print changeset nodes in an ASCII revision graph.
2021 (default: ``{graphnode}``)
2062 (default: ``{graphnode}``)
2022
2063
2023 ``ignore``
2064 ``ignore``
2024 A file to read per-user ignore patterns from. This file should be
2065 A file to read per-user ignore patterns from. This file should be
2025 in the same format as a repository-wide .hgignore file. Filenames
2066 in the same format as a repository-wide .hgignore file. Filenames
2026 are relative to the repository root. This option supports hook syntax,
2067 are relative to the repository root. This option supports hook syntax,
2027 so if you want to specify multiple ignore files, you can do so by
2068 so if you want to specify multiple ignore files, you can do so by
2028 setting something like ``ignore.other = ~/.hgignore2``. For details
2069 setting something like ``ignore.other = ~/.hgignore2``. For details
2029 of the ignore file format, see the ``hgignore(5)`` man page.
2070 of the ignore file format, see the ``hgignore(5)`` man page.
2030
2071
2031 ``interactive``
2072 ``interactive``
2032 Allow to prompt the user. (default: True)
2073 Allow to prompt the user. (default: True)
2033
2074
2034 ``interface``
2075 ``interface``
2035 Select the default interface for interactive features (default: text).
2076 Select the default interface for interactive features (default: text).
2036 Possible values are 'text' and 'curses'.
2077 Possible values are 'text' and 'curses'.
2037
2078
2038 ``interface.chunkselector``
2079 ``interface.chunkselector``
2039 Select the interface for change recording (e.g. :hg:`commit -i`).
2080 Select the interface for change recording (e.g. :hg:`commit -i`).
2040 Possible values are 'text' and 'curses'.
2081 Possible values are 'text' and 'curses'.
2041 This config overrides the interface specified by ui.interface.
2082 This config overrides the interface specified by ui.interface.
2042
2083
2043 ``logtemplate``
2084 ``logtemplate``
2044 Template string for commands that print changesets.
2085 Template string for commands that print changesets.
2045
2086
2046 ``merge``
2087 ``merge``
2047 The conflict resolution program to use during a manual merge.
2088 The conflict resolution program to use during a manual merge.
2048 For more information on merge tools see :hg:`help merge-tools`.
2089 For more information on merge tools see :hg:`help merge-tools`.
2049 For configuring merge tools see the ``[merge-tools]`` section.
2090 For configuring merge tools see the ``[merge-tools]`` section.
2050
2091
2051 ``mergemarkers``
2092 ``mergemarkers``
2052 Sets the merge conflict marker label styling. The ``detailed``
2093 Sets the merge conflict marker label styling. The ``detailed``
2053 style uses the ``mergemarkertemplate`` setting to style the labels.
2094 style uses the ``mergemarkertemplate`` setting to style the labels.
2054 The ``basic`` style just uses 'local' and 'other' as the marker label.
2095 The ``basic`` style just uses 'local' and 'other' as the marker label.
2055 One of ``basic`` or ``detailed``.
2096 One of ``basic`` or ``detailed``.
2056 (default: ``basic``)
2097 (default: ``basic``)
2057
2098
2058 ``mergemarkertemplate``
2099 ``mergemarkertemplate``
2059 The template used to print the commit description next to each conflict
2100 The template used to print the commit description next to each conflict
2060 marker during merge conflicts. See :hg:`help templates` for the template
2101 marker during merge conflicts. See :hg:`help templates` for the template
2061 format.
2102 format.
2062
2103
2063 Defaults to showing the hash, tags, branches, bookmarks, author, and
2104 Defaults to showing the hash, tags, branches, bookmarks, author, and
2064 the first line of the commit description.
2105 the first line of the commit description.
2065
2106
2066 If you use non-ASCII characters in names for tags, branches, bookmarks,
2107 If you use non-ASCII characters in names for tags, branches, bookmarks,
2067 authors, and/or commit descriptions, you must pay attention to encodings of
2108 authors, and/or commit descriptions, you must pay attention to encodings of
2068 managed files. At template expansion, non-ASCII characters use the encoding
2109 managed files. At template expansion, non-ASCII characters use the encoding
2069 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2110 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2070 environment variables that govern your locale. If the encoding of the merge
2111 environment variables that govern your locale. If the encoding of the merge
2071 markers is different from the encoding of the merged files,
2112 markers is different from the encoding of the merged files,
2072 serious problems may occur.
2113 serious problems may occur.
2073
2114
2074 ``origbackuppath``
2115 ``origbackuppath``
2075 The path to a directory used to store generated .orig files. If the path is
2116 The path to a directory used to store generated .orig files. If the path is
2076 not a directory, one will be created. If set, files stored in this
2117 not a directory, one will be created. If set, files stored in this
2077 directory have the same name as the original file and do not have a .orig
2118 directory have the same name as the original file and do not have a .orig
2078 suffix.
2119 suffix.
2079
2120
2080 ``paginate``
2121 ``paginate``
2081 Control the pagination of command output (default: True). See :hg:`help pager`
2122 Control the pagination of command output (default: True). See :hg:`help pager`
2082 for details.
2123 for details.
2083
2124
2084 ``patch``
2125 ``patch``
2085 An optional external tool that ``hg import`` and some extensions
2126 An optional external tool that ``hg import`` and some extensions
2086 will use for applying patches. By default Mercurial uses an
2127 will use for applying patches. By default Mercurial uses an
2087 internal patch utility. The external tool must work as the common
2128 internal patch utility. The external tool must work as the common
2088 Unix ``patch`` program. In particular, it must accept a ``-p``
2129 Unix ``patch`` program. In particular, it must accept a ``-p``
2089 argument to strip patch headers, a ``-d`` argument to specify the
2130 argument to strip patch headers, a ``-d`` argument to specify the
2090 current directory, a file name to patch, and a patch file to take
2131 current directory, a file name to patch, and a patch file to take
2091 from stdin.
2132 from stdin.
2092
2133
2093 It is possible to specify a patch tool together with extra
2134 It is possible to specify a patch tool together with extra
2094 arguments. For example, setting this option to ``patch --merge``
2135 arguments. For example, setting this option to ``patch --merge``
2095 will use the ``patch`` program with its 2-way merge option.
2136 will use the ``patch`` program with its 2-way merge option.
2096
2137
2097 ``portablefilenames``
2138 ``portablefilenames``
2098 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2139 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2099 (default: ``warn``)
2140 (default: ``warn``)
2100
2141
2101 ``warn``
2142 ``warn``
2102 Print a warning message on POSIX platforms, if a file with a non-portable
2143 Print a warning message on POSIX platforms, if a file with a non-portable
2103 filename is added (e.g. a file with a name that can't be created on
2144 filename is added (e.g. a file with a name that can't be created on
2104 Windows because it contains reserved parts like ``AUX``, reserved
2145 Windows because it contains reserved parts like ``AUX``, reserved
2105 characters like ``:``, or would cause a case collision with an existing
2146 characters like ``:``, or would cause a case collision with an existing
2106 file).
2147 file).
2107
2148
2108 ``ignore``
2149 ``ignore``
2109 Don't print a warning.
2150 Don't print a warning.
2110
2151
2111 ``abort``
2152 ``abort``
2112 The command is aborted.
2153 The command is aborted.
2113
2154
2114 ``true``
2155 ``true``
2115 Alias for ``warn``.
2156 Alias for ``warn``.
2116
2157
2117 ``false``
2158 ``false``
2118 Alias for ``ignore``.
2159 Alias for ``ignore``.
2119
2160
2120 .. container:: windows
2161 .. container:: windows
2121
2162
2122 On Windows, this configuration option is ignored and the command aborted.
2163 On Windows, this configuration option is ignored and the command aborted.
2123
2164
2124 ``quiet``
2165 ``quiet``
2125 Reduce the amount of output printed.
2166 Reduce the amount of output printed.
2126 (default: False)
2167 (default: False)
2127
2168
2128 ``remotecmd``
2169 ``remotecmd``
2129 Remote command to use for clone/push/pull operations.
2170 Remote command to use for clone/push/pull operations.
2130 (default: ``hg``)
2171 (default: ``hg``)
2131
2172
2132 ``report_untrusted``
2173 ``report_untrusted``
2133 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2174 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2134 trusted user or group.
2175 trusted user or group.
2135 (default: True)
2176 (default: True)
2136
2177
2137 ``slash``
2178 ``slash``
2138 Display paths using a slash (``/``) as the path separator. This
2179 Display paths using a slash (``/``) as the path separator. This
2139 only makes a difference on systems where the default path
2180 only makes a difference on systems where the default path
2140 separator is not the slash character (e.g. Windows uses the
2181 separator is not the slash character (e.g. Windows uses the
2141 backslash character (``\``)).
2182 backslash character (``\``)).
2142 (default: False)
2183 (default: False)
2143
2184
2144 ``statuscopies``
2185 ``statuscopies``
2145 Display copies in the status command.
2186 Display copies in the status command.
2146
2187
2147 ``ssh``
2188 ``ssh``
2148 Command to use for SSH connections. (default: ``ssh``)
2189 Command to use for SSH connections. (default: ``ssh``)
2149
2190
2150 ``strict``
2191 ``strict``
2151 Require exact command names, instead of allowing unambiguous
2192 Require exact command names, instead of allowing unambiguous
2152 abbreviations. (default: False)
2193 abbreviations. (default: False)
2153
2194
2154 ``style``
2195 ``style``
2155 Name of style to use for command output.
2196 Name of style to use for command output.
2156
2197
2157 ``supportcontact``
2198 ``supportcontact``
2158 A URL where users should report a Mercurial traceback. Use this if you are a
2199 A URL where users should report a Mercurial traceback. Use this if you are a
2159 large organisation with its own Mercurial deployment process and crash
2200 large organisation with its own Mercurial deployment process and crash
2160 reports should be addressed to your internal support.
2201 reports should be addressed to your internal support.
2161
2202
2162 ``textwidth``
2203 ``textwidth``
2163 Maximum width of help text. A longer line generated by ``hg help`` or
2204 Maximum width of help text. A longer line generated by ``hg help`` or
2164 ``hg subcommand --help`` will be broken after white space to get this
2205 ``hg subcommand --help`` will be broken after white space to get this
2165 width or the terminal width, whichever comes first.
2206 width or the terminal width, whichever comes first.
2166 A non-positive value will disable this and the terminal width will be
2207 A non-positive value will disable this and the terminal width will be
2167 used. (default: 78)
2208 used. (default: 78)
2168
2209
2169 ``timeout``
2210 ``timeout``
2170 The timeout used when a lock is held (in seconds), a negative value
2211 The timeout used when a lock is held (in seconds), a negative value
2171 means no timeout. (default: 600)
2212 means no timeout. (default: 600)
2172
2213
2173 ``traceback``
2214 ``traceback``
2174 Mercurial always prints a traceback when an unknown exception
2215 Mercurial always prints a traceback when an unknown exception
2175 occurs. Setting this to True will make Mercurial print a traceback
2216 occurs. Setting this to True will make Mercurial print a traceback
2176 on all exceptions, even those recognized by Mercurial (such as
2217 on all exceptions, even those recognized by Mercurial (such as
2177 IOError or MemoryError). (default: False)
2218 IOError or MemoryError). (default: False)
2178
2219
2179 ``tweakdefaults``
2220 ``tweakdefaults``
2180
2221
2181 By default Mercurial's behavior changes very little from release
2222 By default Mercurial's behavior changes very little from release
2182 to release, but over time the recommended config settings
2223 to release, but over time the recommended config settings
2183 shift. Enable this config to opt in to get automatic tweaks to
2224 shift. Enable this config to opt in to get automatic tweaks to
2184 Mercurial's behavior over time. This config setting will have no
2225 Mercurial's behavior over time. This config setting will have no
2185 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2226 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2186 not include ``tweakdefaults``. (default: False)
2227 not include ``tweakdefaults``. (default: False)
2187
2228
2188 ``username``
2229 ``username``
2189 The committer of a changeset created when running "commit".
2230 The committer of a changeset created when running "commit".
2190 Typically a person's name and email address, e.g. ``Fred Widget
2231 Typically a person's name and email address, e.g. ``Fred Widget
2191 <fred@example.com>``. Environment variables in the
2232 <fred@example.com>``. Environment variables in the
2192 username are expanded.
2233 username are expanded.
2193
2234
2194 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2235 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2195 hgrc is empty, e.g. if the system admin set ``username =`` in the
2236 hgrc is empty, e.g. if the system admin set ``username =`` in the
2196 system hgrc, it has to be specified manually or in a different
2237 system hgrc, it has to be specified manually or in a different
2197 hgrc file)
2238 hgrc file)
2198
2239
2199 ``verbose``
2240 ``verbose``
2200 Increase the amount of output printed. (default: False)
2241 Increase the amount of output printed. (default: False)
2201
2242
2202
2243
2203 ``web``
2244 ``web``
2204 -------
2245 -------
2205
2246
2206 Web interface configuration. The settings in this section apply to
2247 Web interface configuration. The settings in this section apply to
2207 both the builtin webserver (started by :hg:`serve`) and the script you
2248 both the builtin webserver (started by :hg:`serve`) and the script you
2208 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2249 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2209 and WSGI).
2250 and WSGI).
2210
2251
2211 The Mercurial webserver does no authentication (it does not prompt for
2252 The Mercurial webserver does no authentication (it does not prompt for
2212 usernames and passwords to validate *who* users are), but it does do
2253 usernames and passwords to validate *who* users are), but it does do
2213 authorization (it grants or denies access for *authenticated users*
2254 authorization (it grants or denies access for *authenticated users*
2214 based on settings in this section). You must either configure your
2255 based on settings in this section). You must either configure your
2215 webserver to do authentication for you, or disable the authorization
2256 webserver to do authentication for you, or disable the authorization
2216 checks.
2257 checks.
2217
2258
2218 For a quick setup in a trusted environment, e.g., a private LAN, where
2259 For a quick setup in a trusted environment, e.g., a private LAN, where
2219 you want it to accept pushes from anybody, you can use the following
2260 you want it to accept pushes from anybody, you can use the following
2220 command line::
2261 command line::
2221
2262
2222 $ hg --config web.allow_push=* --config web.push_ssl=False serve
2263 $ hg --config web.allow_push=* --config web.push_ssl=False serve
2223
2264
2224 Note that this will allow anybody to push anything to the server and
2265 Note that this will allow anybody to push anything to the server and
2225 that this should not be used for public servers.
2266 that this should not be used for public servers.
2226
2267
2227 The full set of options is:
2268 The full set of options is:
2228
2269
2229 ``accesslog``
2270 ``accesslog``
2230 Where to output the access log. (default: stdout)
2271 Where to output the access log. (default: stdout)
2231
2272
2232 ``address``
2273 ``address``
2233 Interface address to bind to. (default: all)
2274 Interface address to bind to. (default: all)
2234
2275
2235 ``allow_archive``
2276 ``allow_archive``
2236 List of archive format (bz2, gz, zip) allowed for downloading.
2277 List of archive format (bz2, gz, zip) allowed for downloading.
2237 (default: empty)
2278 (default: empty)
2238
2279
2239 ``allowbz2``
2280 ``allowbz2``
2240 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2281 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2241 revisions.
2282 revisions.
2242 (default: False)
2283 (default: False)
2243
2284
2244 ``allowgz``
2285 ``allowgz``
2245 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2286 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2246 revisions.
2287 revisions.
2247 (default: False)
2288 (default: False)
2248
2289
2249 ``allowpull``
2290 ``allowpull``
2250 Whether to allow pulling from the repository. (default: True)
2291 Whether to allow pulling from the repository. (default: True)
2251
2292
2252 ``allow_push``
2293 ``allow_push``
2253 Whether to allow pushing to the repository. If empty or not set,
2294 Whether to allow pushing to the repository. If empty or not set,
2254 pushing is not allowed. If the special value ``*``, any remote
2295 pushing is not allowed. If the special value ``*``, any remote
2255 user can push, including unauthenticated users. Otherwise, the
2296 user can push, including unauthenticated users. Otherwise, the
2256 remote user must have been authenticated, and the authenticated
2297 remote user must have been authenticated, and the authenticated
2257 user name must be present in this list. The contents of the
2298 user name must be present in this list. The contents of the
2258 allow_push list are examined after the deny_push list.
2299 allow_push list are examined after the deny_push list.
2259
2300
2260 ``allow_read``
2301 ``allow_read``
2261 If the user has not already been denied repository access due to
2302 If the user has not already been denied repository access due to
2262 the contents of deny_read, this list determines whether to grant
2303 the contents of deny_read, this list determines whether to grant
2263 repository access to the user. If this list is not empty, and the
2304 repository access to the user. If this list is not empty, and the
2264 user is unauthenticated or not present in the list, then access is
2305 user is unauthenticated or not present in the list, then access is
2265 denied for the user. If the list is empty or not set, then access
2306 denied for the user. If the list is empty or not set, then access
2266 is permitted to all users by default. Setting allow_read to the
2307 is permitted to all users by default. Setting allow_read to the
2267 special value ``*`` is equivalent to it not being set (i.e. access
2308 special value ``*`` is equivalent to it not being set (i.e. access
2268 is permitted to all users). The contents of the allow_read list are
2309 is permitted to all users). The contents of the allow_read list are
2269 examined after the deny_read list.
2310 examined after the deny_read list.
2270
2311
2271 ``allowzip``
2312 ``allowzip``
2272 (DEPRECATED) Whether to allow .zip downloading of repository
2313 (DEPRECATED) Whether to allow .zip downloading of repository
2273 revisions. This feature creates temporary files.
2314 revisions. This feature creates temporary files.
2274 (default: False)
2315 (default: False)
2275
2316
2276 ``archivesubrepos``
2317 ``archivesubrepos``
2277 Whether to recurse into subrepositories when archiving.
2318 Whether to recurse into subrepositories when archiving.
2278 (default: False)
2319 (default: False)
2279
2320
2280 ``baseurl``
2321 ``baseurl``
2281 Base URL to use when publishing URLs in other locations, so
2322 Base URL to use when publishing URLs in other locations, so
2282 third-party tools like email notification hooks can construct
2323 third-party tools like email notification hooks can construct
2283 URLs. Example: ``http://hgserver/repos/``.
2324 URLs. Example: ``http://hgserver/repos/``.
2284
2325
2285 ``cacerts``
2326 ``cacerts``
2286 Path to file containing a list of PEM encoded certificate
2327 Path to file containing a list of PEM encoded certificate
2287 authority certificates. Environment variables and ``~user``
2328 authority certificates. Environment variables and ``~user``
2288 constructs are expanded in the filename. If specified on the
2329 constructs are expanded in the filename. If specified on the
2289 client, then it will verify the identity of remote HTTPS servers
2330 client, then it will verify the identity of remote HTTPS servers
2290 with these certificates.
2331 with these certificates.
2291
2332
2292 To disable SSL verification temporarily, specify ``--insecure`` from
2333 To disable SSL verification temporarily, specify ``--insecure`` from
2293 command line.
2334 command line.
2294
2335
2295 You can use OpenSSL's CA certificate file if your platform has
2336 You can use OpenSSL's CA certificate file if your platform has
2296 one. On most Linux systems this will be
2337 one. On most Linux systems this will be
2297 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2338 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2298 generate this file manually. The form must be as follows::
2339 generate this file manually. The form must be as follows::
2299
2340
2300 -----BEGIN CERTIFICATE-----
2341 -----BEGIN CERTIFICATE-----
2301 ... (certificate in base64 PEM encoding) ...
2342 ... (certificate in base64 PEM encoding) ...
2302 -----END CERTIFICATE-----
2343 -----END CERTIFICATE-----
2303 -----BEGIN CERTIFICATE-----
2344 -----BEGIN CERTIFICATE-----
2304 ... (certificate in base64 PEM encoding) ...
2345 ... (certificate in base64 PEM encoding) ...
2305 -----END CERTIFICATE-----
2346 -----END CERTIFICATE-----
2306
2347
2307 ``cache``
2348 ``cache``
2308 Whether to support caching in hgweb. (default: True)
2349 Whether to support caching in hgweb. (default: True)
2309
2350
2310 ``certificate``
2351 ``certificate``
2311 Certificate to use when running :hg:`serve`.
2352 Certificate to use when running :hg:`serve`.
2312
2353
2313 ``collapse``
2354 ``collapse``
2314 With ``descend`` enabled, repositories in subdirectories are shown at
2355 With ``descend`` enabled, repositories in subdirectories are shown at
2315 a single level alongside repositories in the current path. With
2356 a single level alongside repositories in the current path. With
2316 ``collapse`` also enabled, repositories residing at a deeper level than
2357 ``collapse`` also enabled, repositories residing at a deeper level than
2317 the current path are grouped behind navigable directory entries that
2358 the current path are grouped behind navigable directory entries that
2318 lead to the locations of these repositories. In effect, this setting
2359 lead to the locations of these repositories. In effect, this setting
2319 collapses each collection of repositories found within a subdirectory
2360 collapses each collection of repositories found within a subdirectory
2320 into a single entry for that subdirectory. (default: False)
2361 into a single entry for that subdirectory. (default: False)
2321
2362
2322 ``comparisoncontext``
2363 ``comparisoncontext``
2323 Number of lines of context to show in side-by-side file comparison. If
2364 Number of lines of context to show in side-by-side file comparison. If
2324 negative or the value ``full``, whole files are shown. (default: 5)
2365 negative or the value ``full``, whole files are shown. (default: 5)
2325
2366
2326 This setting can be overridden by a ``context`` request parameter to the
2367 This setting can be overridden by a ``context`` request parameter to the
2327 ``comparison`` command, taking the same values.
2368 ``comparison`` command, taking the same values.
2328
2369
2329 ``contact``
2370 ``contact``
2330 Name or email address of the person in charge of the repository.
2371 Name or email address of the person in charge of the repository.
2331 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2372 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2332
2373
2333 ``csp``
2374 ``csp``
2334 Send a ``Content-Security-Policy`` HTTP header with this value.
2375 Send a ``Content-Security-Policy`` HTTP header with this value.
2335
2376
2336 The value may contain a special string ``%nonce%``, which will be replaced
2377 The value may contain a special string ``%nonce%``, which will be replaced
2337 by a randomly-generated one-time use value. If the value contains
2378 by a randomly-generated one-time use value. If the value contains
2338 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2379 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2339 one-time property of the nonce. This nonce will also be inserted into
2380 one-time property of the nonce. This nonce will also be inserted into
2340 ``<script>`` elements containing inline JavaScript.
2381 ``<script>`` elements containing inline JavaScript.
2341
2382
2342 Note: lots of HTML content sent by the server is derived from repository
2383 Note: lots of HTML content sent by the server is derived from repository
2343 data. Please consider the potential for malicious repository data to
2384 data. Please consider the potential for malicious repository data to
2344 "inject" itself into generated HTML content as part of your security
2385 "inject" itself into generated HTML content as part of your security
2345 threat model.
2386 threat model.
2346
2387
2347 ``deny_push``
2388 ``deny_push``
2348 Whether to deny pushing to the repository. If empty or not set,
2389 Whether to deny pushing to the repository. If empty or not set,
2349 push is not denied. If the special value ``*``, all remote users are
2390 push is not denied. If the special value ``*``, all remote users are
2350 denied push. Otherwise, unauthenticated users are all denied, and
2391 denied push. Otherwise, unauthenticated users are all denied, and
2351 any authenticated user name present in this list is also denied. The
2392 any authenticated user name present in this list is also denied. The
2352 contents of the deny_push list are examined before the allow_push list.
2393 contents of the deny_push list are examined before the allow_push list.
2353
2394
2354 ``deny_read``
2395 ``deny_read``
2355 Whether to deny reading/viewing of the repository. If this list is
2396 Whether to deny reading/viewing of the repository. If this list is
2356 not empty, unauthenticated users are all denied, and any
2397 not empty, unauthenticated users are all denied, and any
2357 authenticated user name present in this list is also denied access to
2398 authenticated user name present in this list is also denied access to
2358 the repository. If set to the special value ``*``, all remote users
2399 the repository. If set to the special value ``*``, all remote users
2359 are denied access (rarely needed ;). If deny_read is empty or not set,
2400 are denied access (rarely needed ;). If deny_read is empty or not set,
2360 the determination of repository access depends on the presence and
2401 the determination of repository access depends on the presence and
2361 content of the allow_read list (see description). If both
2402 content of the allow_read list (see description). If both
2362 deny_read and allow_read are empty or not set, then access is
2403 deny_read and allow_read are empty or not set, then access is
2363 permitted to all users by default. If the repository is being
2404 permitted to all users by default. If the repository is being
2364 served via hgwebdir, denied users will not be able to see it in
2405 served via hgwebdir, denied users will not be able to see it in
2365 the list of repositories. The contents of the deny_read list have
2406 the list of repositories. The contents of the deny_read list have
2366 priority over (are examined before) the contents of the allow_read
2407 priority over (are examined before) the contents of the allow_read
2367 list.
2408 list.
2368
2409
2369 ``descend``
2410 ``descend``
2370 hgwebdir indexes will not descend into subdirectories. Only repositories
2411 hgwebdir indexes will not descend into subdirectories. Only repositories
2371 directly in the current path will be shown (other repositories are still
2412 directly in the current path will be shown (other repositories are still
2372 available from the index corresponding to their containing path).
2413 available from the index corresponding to their containing path).
2373
2414
2374 ``description``
2415 ``description``
2375 Textual description of the repository's purpose or contents.
2416 Textual description of the repository's purpose or contents.
2376 (default: "unknown")
2417 (default: "unknown")
2377
2418
2378 ``encoding``
2419 ``encoding``
2379 Character encoding name. (default: the current locale charset)
2420 Character encoding name. (default: the current locale charset)
2380 Example: "UTF-8".
2421 Example: "UTF-8".
2381
2422
2382 ``errorlog``
2423 ``errorlog``
2383 Where to output the error log. (default: stderr)
2424 Where to output the error log. (default: stderr)
2384
2425
2385 ``guessmime``
2426 ``guessmime``
2386 Control MIME types for raw download of file content.
2427 Control MIME types for raw download of file content.
2387 Set to True to let hgweb guess the content type from the file
2428 Set to True to let hgweb guess the content type from the file
2388 extension. This will serve HTML files as ``text/html`` and might
2429 extension. This will serve HTML files as ``text/html`` and might
2389 allow cross-site scripting attacks when serving untrusted
2430 allow cross-site scripting attacks when serving untrusted
2390 repositories. (default: False)
2431 repositories. (default: False)
2391
2432
2392 ``hidden``
2433 ``hidden``
2393 Whether to hide the repository in the hgwebdir index.
2434 Whether to hide the repository in the hgwebdir index.
2394 (default: False)
2435 (default: False)
2395
2436
2396 ``ipv6``
2437 ``ipv6``
2397 Whether to use IPv6. (default: False)
2438 Whether to use IPv6. (default: False)
2398
2439
2399 ``labels``
2440 ``labels``
2400 List of string *labels* associated with the repository.
2441 List of string *labels* associated with the repository.
2401
2442
2402 Labels are exposed as a template keyword and can be used to customize
2443 Labels are exposed as a template keyword and can be used to customize
2403 output. e.g. the ``index`` template can group or filter repositories
2444 output. e.g. the ``index`` template can group or filter repositories
2404 by labels and the ``summary`` template can display additional content
2445 by labels and the ``summary`` template can display additional content
2405 if a specific label is present.
2446 if a specific label is present.
2406
2447
2407 ``logoimg``
2448 ``logoimg``
2408 File name of the logo image that some templates display on each page.
2449 File name of the logo image that some templates display on each page.
2409 The file name is relative to ``staticurl``. That is, the full path to
2450 The file name is relative to ``staticurl``. That is, the full path to
2410 the logo image is "staticurl/logoimg".
2451 the logo image is "staticurl/logoimg".
2411 If unset, ``hglogo.png`` will be used.
2452 If unset, ``hglogo.png`` will be used.
2412
2453
2413 ``logourl``
2454 ``logourl``
2414 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2455 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2415 will be used.
2456 will be used.
2416
2457
2417 ``maxchanges``
2458 ``maxchanges``
2418 Maximum number of changes to list on the changelog. (default: 10)
2459 Maximum number of changes to list on the changelog. (default: 10)
2419
2460
2420 ``maxfiles``
2461 ``maxfiles``
2421 Maximum number of files to list per changeset. (default: 10)
2462 Maximum number of files to list per changeset. (default: 10)
2422
2463
2423 ``maxshortchanges``
2464 ``maxshortchanges``
2424 Maximum number of changes to list on the shortlog, graph or filelog
2465 Maximum number of changes to list on the shortlog, graph or filelog
2425 pages. (default: 60)
2466 pages. (default: 60)
2426
2467
2427 ``name``
2468 ``name``
2428 Repository name to use in the web interface.
2469 Repository name to use in the web interface.
2429 (default: current working directory)
2470 (default: current working directory)
2430
2471
2431 ``port``
2472 ``port``
2432 Port to listen on. (default: 8000)
2473 Port to listen on. (default: 8000)
2433
2474
2434 ``prefix``
2475 ``prefix``
2435 Prefix path to serve from. (default: '' (server root))
2476 Prefix path to serve from. (default: '' (server root))
2436
2477
2437 ``push_ssl``
2478 ``push_ssl``
2438 Whether to require that inbound pushes be transported over SSL to
2479 Whether to require that inbound pushes be transported over SSL to
2439 prevent password sniffing. (default: True)
2480 prevent password sniffing. (default: True)
2440
2481
2441 ``refreshinterval``
2482 ``refreshinterval``
2442 How frequently directory listings re-scan the filesystem for new
2483 How frequently directory listings re-scan the filesystem for new
2443 repositories, in seconds. This is relevant when wildcards are used
2484 repositories, in seconds. This is relevant when wildcards are used
2444 to define paths. Depending on how much filesystem traversal is
2485 to define paths. Depending on how much filesystem traversal is
2445 required, refreshing may negatively impact performance.
2486 required, refreshing may negatively impact performance.
2446
2487
2447 Values less than or equal to 0 always refresh.
2488 Values less than or equal to 0 always refresh.
2448 (default: 20)
2489 (default: 20)
2449
2490
2450 ``staticurl``
2491 ``staticurl``
2451 Base URL to use for static files. If unset, static files (e.g. the
2492 Base URL to use for static files. If unset, static files (e.g. the
2452 hgicon.png favicon) will be served by the CGI script itself. Use
2493 hgicon.png favicon) will be served by the CGI script itself. Use
2453 this setting to serve them directly with the HTTP server.
2494 this setting to serve them directly with the HTTP server.
2454 Example: ``http://hgserver/static/``.
2495 Example: ``http://hgserver/static/``.
2455
2496
2456 ``stripes``
2497 ``stripes``
2457 How many lines a "zebra stripe" should span in multi-line output.
2498 How many lines a "zebra stripe" should span in multi-line output.
2458 Set to 0 to disable. (default: 1)
2499 Set to 0 to disable. (default: 1)
2459
2500
2460 ``style``
2501 ``style``
2461 Which template map style to use. The available options are the names of
2502 Which template map style to use. The available options are the names of
2462 subdirectories in the HTML templates path. (default: ``paper``)
2503 subdirectories in the HTML templates path. (default: ``paper``)
2463 Example: ``monoblue``.
2504 Example: ``monoblue``.
2464
2505
2465 ``templates``
2506 ``templates``
2466 Where to find the HTML templates. The default path to the HTML templates
2507 Where to find the HTML templates. The default path to the HTML templates
2467 can be obtained from ``hg debuginstall``.
2508 can be obtained from ``hg debuginstall``.
2468
2509
2469 ``websub``
2510 ``websub``
2470 ----------
2511 ----------
2471
2512
2472 Web substitution filter definition. You can use this section to
2513 Web substitution filter definition. You can use this section to
2473 define a set of regular expression substitution patterns which
2514 define a set of regular expression substitution patterns which
2474 let you automatically modify the hgweb server output.
2515 let you automatically modify the hgweb server output.
2475
2516
2476 The default hgweb templates only apply these substitution patterns
2517 The default hgweb templates only apply these substitution patterns
2477 on the revision description fields. You can apply them anywhere
2518 on the revision description fields. You can apply them anywhere
2478 you want when you create your own templates by adding calls to the
2519 you want when you create your own templates by adding calls to the
2479 "websub" filter (usually after calling the "escape" filter).
2520 "websub" filter (usually after calling the "escape" filter).
2480
2521
2481 This can be used, for example, to convert issue references to links
2522 This can be used, for example, to convert issue references to links
2482 to your issue tracker, or to convert "markdown-like" syntax into
2523 to your issue tracker, or to convert "markdown-like" syntax into
2483 HTML (see the examples below).
2524 HTML (see the examples below).
2484
2525
2485 Each entry in this section names a substitution filter.
2526 Each entry in this section names a substitution filter.
2486 The value of each entry defines the substitution expression itself.
2527 The value of each entry defines the substitution expression itself.
2487 The websub expressions follow the old interhg extension syntax,
2528 The websub expressions follow the old interhg extension syntax,
2488 which in turn imitates the Unix sed replacement syntax::
2529 which in turn imitates the Unix sed replacement syntax::
2489
2530
2490 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2531 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2491
2532
2492 You can use any separator other than "/". The final "i" is optional
2533 You can use any separator other than "/". The final "i" is optional
2493 and indicates that the search must be case insensitive.
2534 and indicates that the search must be case insensitive.
2494
2535
2495 Examples::
2536 Examples::
2496
2537
2497 [websub]
2538 [websub]
2498 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2539 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2499 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2540 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2500 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2541 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2501
2542
2502 ``worker``
2543 ``worker``
2503 ----------
2544 ----------
2504
2545
2505 Parallel master/worker configuration. We currently perform working
2546 Parallel master/worker configuration. We currently perform working
2506 directory updates in parallel on Unix-like systems, which greatly
2547 directory updates in parallel on Unix-like systems, which greatly
2507 helps performance.
2548 helps performance.
2508
2549
2509 ``numcpus``
2550 ``numcpus``
2510 Number of CPUs to use for parallel operations. A zero or
2551 Number of CPUs to use for parallel operations. A zero or
2511 negative value is treated as ``use the default``.
2552 negative value is treated as ``use the default``.
2512 (default: 4 or the number of CPUs on the system, whichever is larger)
2553 (default: 4 or the number of CPUs on the system, whichever is larger)
2513
2554
2514 ``backgroundclose``
2555 ``backgroundclose``
2515 Whether to enable closing file handles on background threads during certain
2556 Whether to enable closing file handles on background threads during certain
2516 operations. Some platforms aren't very efficient at closing file
2557 operations. Some platforms aren't very efficient at closing file
2517 handles that have been written or appended to. By performing file closing
2558 handles that have been written or appended to. By performing file closing
2518 on background threads, file write rate can increase substantially.
2559 on background threads, file write rate can increase substantially.
2519 (default: true on Windows, false elsewhere)
2560 (default: true on Windows, false elsewhere)
2520
2561
2521 ``backgroundcloseminfilecount``
2562 ``backgroundcloseminfilecount``
2522 Minimum number of files required to trigger background file closing.
2563 Minimum number of files required to trigger background file closing.
2523 Operations not writing this many files won't start background close
2564 Operations not writing this many files won't start background close
2524 threads.
2565 threads.
2525 (default: 2048)
2566 (default: 2048)
2526
2567
2527 ``backgroundclosemaxqueue``
2568 ``backgroundclosemaxqueue``
2528 The maximum number of opened file handles waiting to be closed in the
2569 The maximum number of opened file handles waiting to be closed in the
2529 background. This option only has an effect if ``backgroundclose`` is
2570 background. This option only has an effect if ``backgroundclose`` is
2530 enabled.
2571 enabled.
2531 (default: 384)
2572 (default: 384)
2532
2573
2533 ``backgroundclosethreadcount``
2574 ``backgroundclosethreadcount``
2534 Number of threads to process background file closes. Only relevant if
2575 Number of threads to process background file closes. Only relevant if
2535 ``backgroundclose`` is enabled.
2576 ``backgroundclose`` is enabled.
2536 (default: 4)
2577 (default: 4)
@@ -1,2036 +1,2063 b''
1 # subrepo.py - sub-repository handling for Mercurial
1 # subrepo.py - sub-repository handling for Mercurial
2 #
2 #
3 # Copyright 2009-2010 Matt Mackall <mpm@selenic.com>
3 # Copyright 2009-2010 Matt Mackall <mpm@selenic.com>
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 copy
10 import copy
11 import errno
11 import errno
12 import hashlib
12 import hashlib
13 import os
13 import os
14 import posixpath
14 import posixpath
15 import re
15 import re
16 import stat
16 import stat
17 import subprocess
17 import subprocess
18 import sys
18 import sys
19 import tarfile
19 import tarfile
20 import xml.dom.minidom
20 import xml.dom.minidom
21
21
22
22
23 from .i18n import _
23 from .i18n import _
24 from . import (
24 from . import (
25 cmdutil,
25 cmdutil,
26 config,
26 config,
27 encoding,
27 encoding,
28 error,
28 error,
29 exchange,
29 exchange,
30 filemerge,
30 filemerge,
31 match as matchmod,
31 match as matchmod,
32 node,
32 node,
33 pathutil,
33 pathutil,
34 phases,
34 phases,
35 pycompat,
35 pycompat,
36 scmutil,
36 scmutil,
37 util,
37 util,
38 vfs as vfsmod,
38 vfs as vfsmod,
39 )
39 )
40
40
41 hg = None
41 hg = None
42 propertycache = util.propertycache
42 propertycache = util.propertycache
43
43
44 nullstate = ('', '', 'empty')
44 nullstate = ('', '', 'empty')
45
45
46 def _expandedabspath(path):
46 def _expandedabspath(path):
47 '''
47 '''
48 get a path or url and if it is a path expand it and return an absolute path
48 get a path or url and if it is a path expand it and return an absolute path
49 '''
49 '''
50 expandedpath = util.urllocalpath(util.expandpath(path))
50 expandedpath = util.urllocalpath(util.expandpath(path))
51 u = util.url(expandedpath)
51 u = util.url(expandedpath)
52 if not u.scheme:
52 if not u.scheme:
53 path = util.normpath(os.path.abspath(u.path))
53 path = util.normpath(os.path.abspath(u.path))
54 return path
54 return path
55
55
56 def _getstorehashcachename(remotepath):
56 def _getstorehashcachename(remotepath):
57 '''get a unique filename for the store hash cache of a remote repository'''
57 '''get a unique filename for the store hash cache of a remote repository'''
58 return hashlib.sha1(_expandedabspath(remotepath)).hexdigest()[0:12]
58 return hashlib.sha1(_expandedabspath(remotepath)).hexdigest()[0:12]
59
59
60 class SubrepoAbort(error.Abort):
60 class SubrepoAbort(error.Abort):
61 """Exception class used to avoid handling a subrepo error more than once"""
61 """Exception class used to avoid handling a subrepo error more than once"""
62 def __init__(self, *args, **kw):
62 def __init__(self, *args, **kw):
63 self.subrepo = kw.pop('subrepo', None)
63 self.subrepo = kw.pop('subrepo', None)
64 self.cause = kw.pop('cause', None)
64 self.cause = kw.pop('cause', None)
65 error.Abort.__init__(self, *args, **kw)
65 error.Abort.__init__(self, *args, **kw)
66
66
67 def annotatesubrepoerror(func):
67 def annotatesubrepoerror(func):
68 def decoratedmethod(self, *args, **kargs):
68 def decoratedmethod(self, *args, **kargs):
69 try:
69 try:
70 res = func(self, *args, **kargs)
70 res = func(self, *args, **kargs)
71 except SubrepoAbort as ex:
71 except SubrepoAbort as ex:
72 # This exception has already been handled
72 # This exception has already been handled
73 raise ex
73 raise ex
74 except error.Abort as ex:
74 except error.Abort as ex:
75 subrepo = subrelpath(self)
75 subrepo = subrelpath(self)
76 errormsg = str(ex) + ' ' + _('(in subrepository "%s")') % subrepo
76 errormsg = str(ex) + ' ' + _('(in subrepository "%s")') % subrepo
77 # avoid handling this exception by raising a SubrepoAbort exception
77 # avoid handling this exception by raising a SubrepoAbort exception
78 raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo,
78 raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo,
79 cause=sys.exc_info())
79 cause=sys.exc_info())
80 return res
80 return res
81 return decoratedmethod
81 return decoratedmethod
82
82
83 def state(ctx, ui):
83 def state(ctx, ui):
84 """return a state dict, mapping subrepo paths configured in .hgsub
84 """return a state dict, mapping subrepo paths configured in .hgsub
85 to tuple: (source from .hgsub, revision from .hgsubstate, kind
85 to tuple: (source from .hgsub, revision from .hgsubstate, kind
86 (key in types dict))
86 (key in types dict))
87 """
87 """
88 p = config.config()
88 p = config.config()
89 repo = ctx.repo()
89 repo = ctx.repo()
90 def read(f, sections=None, remap=None):
90 def read(f, sections=None, remap=None):
91 if f in ctx:
91 if f in ctx:
92 try:
92 try:
93 data = ctx[f].data()
93 data = ctx[f].data()
94 except IOError as err:
94 except IOError as err:
95 if err.errno != errno.ENOENT:
95 if err.errno != errno.ENOENT:
96 raise
96 raise
97 # handle missing subrepo spec files as removed
97 # handle missing subrepo spec files as removed
98 ui.warn(_("warning: subrepo spec file \'%s\' not found\n") %
98 ui.warn(_("warning: subrepo spec file \'%s\' not found\n") %
99 repo.pathto(f))
99 repo.pathto(f))
100 return
100 return
101 p.parse(f, data, sections, remap, read)
101 p.parse(f, data, sections, remap, read)
102 else:
102 else:
103 raise error.Abort(_("subrepo spec file \'%s\' not found") %
103 raise error.Abort(_("subrepo spec file \'%s\' not found") %
104 repo.pathto(f))
104 repo.pathto(f))
105 if '.hgsub' in ctx:
105 if '.hgsub' in ctx:
106 read('.hgsub')
106 read('.hgsub')
107
107
108 for path, src in ui.configitems('subpaths'):
108 for path, src in ui.configitems('subpaths'):
109 p.set('subpaths', path, src, ui.configsource('subpaths', path))
109 p.set('subpaths', path, src, ui.configsource('subpaths', path))
110
110
111 rev = {}
111 rev = {}
112 if '.hgsubstate' in ctx:
112 if '.hgsubstate' in ctx:
113 try:
113 try:
114 for i, l in enumerate(ctx['.hgsubstate'].data().splitlines()):
114 for i, l in enumerate(ctx['.hgsubstate'].data().splitlines()):
115 l = l.lstrip()
115 l = l.lstrip()
116 if not l:
116 if not l:
117 continue
117 continue
118 try:
118 try:
119 revision, path = l.split(" ", 1)
119 revision, path = l.split(" ", 1)
120 except ValueError:
120 except ValueError:
121 raise error.Abort(_("invalid subrepository revision "
121 raise error.Abort(_("invalid subrepository revision "
122 "specifier in \'%s\' line %d")
122 "specifier in \'%s\' line %d")
123 % (repo.pathto('.hgsubstate'), (i + 1)))
123 % (repo.pathto('.hgsubstate'), (i + 1)))
124 rev[path] = revision
124 rev[path] = revision
125 except IOError as err:
125 except IOError as err:
126 if err.errno != errno.ENOENT:
126 if err.errno != errno.ENOENT:
127 raise
127 raise
128
128
129 def remap(src):
129 def remap(src):
130 for pattern, repl in p.items('subpaths'):
130 for pattern, repl in p.items('subpaths'):
131 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub
131 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub
132 # does a string decode.
132 # does a string decode.
133 repl = util.escapestr(repl)
133 repl = util.escapestr(repl)
134 # However, we still want to allow back references to go
134 # However, we still want to allow back references to go
135 # through unharmed, so we turn r'\\1' into r'\1'. Again,
135 # through unharmed, so we turn r'\\1' into r'\1'. Again,
136 # extra escapes are needed because re.sub string decodes.
136 # extra escapes are needed because re.sub string decodes.
137 repl = re.sub(br'\\\\([0-9]+)', br'\\\1', repl)
137 repl = re.sub(br'\\\\([0-9]+)', br'\\\1', repl)
138 try:
138 try:
139 src = re.sub(pattern, repl, src, 1)
139 src = re.sub(pattern, repl, src, 1)
140 except re.error as e:
140 except re.error as e:
141 raise error.Abort(_("bad subrepository pattern in %s: %s")
141 raise error.Abort(_("bad subrepository pattern in %s: %s")
142 % (p.source('subpaths', pattern), e))
142 % (p.source('subpaths', pattern), e))
143 return src
143 return src
144
144
145 state = {}
145 state = {}
146 for path, src in p[''].items():
146 for path, src in p[''].items():
147 kind = 'hg'
147 kind = 'hg'
148 if src.startswith('['):
148 if src.startswith('['):
149 if ']' not in src:
149 if ']' not in src:
150 raise error.Abort(_('missing ] in subrepository source'))
150 raise error.Abort(_('missing ] in subrepository source'))
151 kind, src = src.split(']', 1)
151 kind, src = src.split(']', 1)
152 kind = kind[1:]
152 kind = kind[1:]
153 src = src.lstrip() # strip any extra whitespace after ']'
153 src = src.lstrip() # strip any extra whitespace after ']'
154
154
155 if not util.url(src).isabs():
155 if not util.url(src).isabs():
156 parent = _abssource(repo, abort=False)
156 parent = _abssource(repo, abort=False)
157 if parent:
157 if parent:
158 parent = util.url(parent)
158 parent = util.url(parent)
159 parent.path = posixpath.join(parent.path or '', src)
159 parent.path = posixpath.join(parent.path or '', src)
160 parent.path = posixpath.normpath(parent.path)
160 parent.path = posixpath.normpath(parent.path)
161 joined = str(parent)
161 joined = str(parent)
162 # Remap the full joined path and use it if it changes,
162 # Remap the full joined path and use it if it changes,
163 # else remap the original source.
163 # else remap the original source.
164 remapped = remap(joined)
164 remapped = remap(joined)
165 if remapped == joined:
165 if remapped == joined:
166 src = remap(src)
166 src = remap(src)
167 else:
167 else:
168 src = remapped
168 src = remapped
169
169
170 src = remap(src)
170 src = remap(src)
171 state[util.pconvert(path)] = (src.strip(), rev.get(path, ''), kind)
171 state[util.pconvert(path)] = (src.strip(), rev.get(path, ''), kind)
172
172
173 return state
173 return state
174
174
175 def writestate(repo, state):
175 def writestate(repo, state):
176 """rewrite .hgsubstate in (outer) repo with these subrepo states"""
176 """rewrite .hgsubstate in (outer) repo with these subrepo states"""
177 lines = ['%s %s\n' % (state[s][1], s) for s in sorted(state)
177 lines = ['%s %s\n' % (state[s][1], s) for s in sorted(state)
178 if state[s][1] != nullstate[1]]
178 if state[s][1] != nullstate[1]]
179 repo.wwrite('.hgsubstate', ''.join(lines), '')
179 repo.wwrite('.hgsubstate', ''.join(lines), '')
180
180
181 def submerge(repo, wctx, mctx, actx, overwrite, labels=None):
181 def submerge(repo, wctx, mctx, actx, overwrite, labels=None):
182 """delegated from merge.applyupdates: merging of .hgsubstate file
182 """delegated from merge.applyupdates: merging of .hgsubstate file
183 in working context, merging context and ancestor context"""
183 in working context, merging context and ancestor context"""
184 if mctx == actx: # backwards?
184 if mctx == actx: # backwards?
185 actx = wctx.p1()
185 actx = wctx.p1()
186 s1 = wctx.substate
186 s1 = wctx.substate
187 s2 = mctx.substate
187 s2 = mctx.substate
188 sa = actx.substate
188 sa = actx.substate
189 sm = {}
189 sm = {}
190
190
191 repo.ui.debug("subrepo merge %s %s %s\n" % (wctx, mctx, actx))
191 repo.ui.debug("subrepo merge %s %s %s\n" % (wctx, mctx, actx))
192
192
193 def debug(s, msg, r=""):
193 def debug(s, msg, r=""):
194 if r:
194 if r:
195 r = "%s:%s:%s" % r
195 r = "%s:%s:%s" % r
196 repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r))
196 repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r))
197
197
198 promptssrc = filemerge.partextras(labels)
198 promptssrc = filemerge.partextras(labels)
199 for s, l in sorted(s1.iteritems()):
199 for s, l in sorted(s1.iteritems()):
200 prompts = None
200 prompts = None
201 a = sa.get(s, nullstate)
201 a = sa.get(s, nullstate)
202 ld = l # local state with possible dirty flag for compares
202 ld = l # local state with possible dirty flag for compares
203 if wctx.sub(s).dirty():
203 if wctx.sub(s).dirty():
204 ld = (l[0], l[1] + "+")
204 ld = (l[0], l[1] + "+")
205 if wctx == actx: # overwrite
205 if wctx == actx: # overwrite
206 a = ld
206 a = ld
207
207
208 prompts = promptssrc.copy()
208 prompts = promptssrc.copy()
209 prompts['s'] = s
209 prompts['s'] = s
210 if s in s2:
210 if s in s2:
211 r = s2[s]
211 r = s2[s]
212 if ld == r or r == a: # no change or local is newer
212 if ld == r or r == a: # no change or local is newer
213 sm[s] = l
213 sm[s] = l
214 continue
214 continue
215 elif ld == a: # other side changed
215 elif ld == a: # other side changed
216 debug(s, "other changed, get", r)
216 debug(s, "other changed, get", r)
217 wctx.sub(s).get(r, overwrite)
217 wctx.sub(s).get(r, overwrite)
218 sm[s] = r
218 sm[s] = r
219 elif ld[0] != r[0]: # sources differ
219 elif ld[0] != r[0]: # sources differ
220 prompts['lo'] = l[0]
220 prompts['lo'] = l[0]
221 prompts['ro'] = r[0]
221 prompts['ro'] = r[0]
222 if repo.ui.promptchoice(
222 if repo.ui.promptchoice(
223 _(' subrepository sources for %(s)s differ\n'
223 _(' subrepository sources for %(s)s differ\n'
224 'use (l)ocal%(l)s source (%(lo)s)'
224 'use (l)ocal%(l)s source (%(lo)s)'
225 ' or (r)emote%(o)s source (%(ro)s)?'
225 ' or (r)emote%(o)s source (%(ro)s)?'
226 '$$ &Local $$ &Remote') % prompts, 0):
226 '$$ &Local $$ &Remote') % prompts, 0):
227 debug(s, "prompt changed, get", r)
227 debug(s, "prompt changed, get", r)
228 wctx.sub(s).get(r, overwrite)
228 wctx.sub(s).get(r, overwrite)
229 sm[s] = r
229 sm[s] = r
230 elif ld[1] == a[1]: # local side is unchanged
230 elif ld[1] == a[1]: # local side is unchanged
231 debug(s, "other side changed, get", r)
231 debug(s, "other side changed, get", r)
232 wctx.sub(s).get(r, overwrite)
232 wctx.sub(s).get(r, overwrite)
233 sm[s] = r
233 sm[s] = r
234 else:
234 else:
235 debug(s, "both sides changed")
235 debug(s, "both sides changed")
236 srepo = wctx.sub(s)
236 srepo = wctx.sub(s)
237 prompts['sl'] = srepo.shortid(l[1])
237 prompts['sl'] = srepo.shortid(l[1])
238 prompts['sr'] = srepo.shortid(r[1])
238 prompts['sr'] = srepo.shortid(r[1])
239 option = repo.ui.promptchoice(
239 option = repo.ui.promptchoice(
240 _(' subrepository %(s)s diverged (local revision: %(sl)s, '
240 _(' subrepository %(s)s diverged (local revision: %(sl)s, '
241 'remote revision: %(sr)s)\n'
241 'remote revision: %(sr)s)\n'
242 '(M)erge, keep (l)ocal%(l)s or keep (r)emote%(o)s?'
242 '(M)erge, keep (l)ocal%(l)s or keep (r)emote%(o)s?'
243 '$$ &Merge $$ &Local $$ &Remote')
243 '$$ &Merge $$ &Local $$ &Remote')
244 % prompts, 0)
244 % prompts, 0)
245 if option == 0:
245 if option == 0:
246 wctx.sub(s).merge(r)
246 wctx.sub(s).merge(r)
247 sm[s] = l
247 sm[s] = l
248 debug(s, "merge with", r)
248 debug(s, "merge with", r)
249 elif option == 1:
249 elif option == 1:
250 sm[s] = l
250 sm[s] = l
251 debug(s, "keep local subrepo revision", l)
251 debug(s, "keep local subrepo revision", l)
252 else:
252 else:
253 wctx.sub(s).get(r, overwrite)
253 wctx.sub(s).get(r, overwrite)
254 sm[s] = r
254 sm[s] = r
255 debug(s, "get remote subrepo revision", r)
255 debug(s, "get remote subrepo revision", r)
256 elif ld == a: # remote removed, local unchanged
256 elif ld == a: # remote removed, local unchanged
257 debug(s, "remote removed, remove")
257 debug(s, "remote removed, remove")
258 wctx.sub(s).remove()
258 wctx.sub(s).remove()
259 elif a == nullstate: # not present in remote or ancestor
259 elif a == nullstate: # not present in remote or ancestor
260 debug(s, "local added, keep")
260 debug(s, "local added, keep")
261 sm[s] = l
261 sm[s] = l
262 continue
262 continue
263 else:
263 else:
264 if repo.ui.promptchoice(
264 if repo.ui.promptchoice(
265 _(' local%(l)s changed subrepository %(s)s'
265 _(' local%(l)s changed subrepository %(s)s'
266 ' which remote%(o)s removed\n'
266 ' which remote%(o)s removed\n'
267 'use (c)hanged version or (d)elete?'
267 'use (c)hanged version or (d)elete?'
268 '$$ &Changed $$ &Delete') % prompts, 0):
268 '$$ &Changed $$ &Delete') % prompts, 0):
269 debug(s, "prompt remove")
269 debug(s, "prompt remove")
270 wctx.sub(s).remove()
270 wctx.sub(s).remove()
271
271
272 for s, r in sorted(s2.items()):
272 for s, r in sorted(s2.items()):
273 prompts = None
273 prompts = None
274 if s in s1:
274 if s in s1:
275 continue
275 continue
276 elif s not in sa:
276 elif s not in sa:
277 debug(s, "remote added, get", r)
277 debug(s, "remote added, get", r)
278 mctx.sub(s).get(r)
278 mctx.sub(s).get(r)
279 sm[s] = r
279 sm[s] = r
280 elif r != sa[s]:
280 elif r != sa[s]:
281 prompts = promptssrc.copy()
281 prompts = promptssrc.copy()
282 prompts['s'] = s
282 prompts['s'] = s
283 if repo.ui.promptchoice(
283 if repo.ui.promptchoice(
284 _(' remote%(o)s changed subrepository %(s)s'
284 _(' remote%(o)s changed subrepository %(s)s'
285 ' which local%(l)s removed\n'
285 ' which local%(l)s removed\n'
286 'use (c)hanged version or (d)elete?'
286 'use (c)hanged version or (d)elete?'
287 '$$ &Changed $$ &Delete') % prompts, 0) == 0:
287 '$$ &Changed $$ &Delete') % prompts, 0) == 0:
288 debug(s, "prompt recreate", r)
288 debug(s, "prompt recreate", r)
289 mctx.sub(s).get(r)
289 mctx.sub(s).get(r)
290 sm[s] = r
290 sm[s] = r
291
291
292 # record merged .hgsubstate
292 # record merged .hgsubstate
293 writestate(repo, sm)
293 writestate(repo, sm)
294 return sm
294 return sm
295
295
296 def _updateprompt(ui, sub, dirty, local, remote):
296 def _updateprompt(ui, sub, dirty, local, remote):
297 if dirty:
297 if dirty:
298 msg = (_(' subrepository sources for %s differ\n'
298 msg = (_(' subrepository sources for %s differ\n'
299 'use (l)ocal source (%s) or (r)emote source (%s)?'
299 'use (l)ocal source (%s) or (r)emote source (%s)?'
300 '$$ &Local $$ &Remote')
300 '$$ &Local $$ &Remote')
301 % (subrelpath(sub), local, remote))
301 % (subrelpath(sub), local, remote))
302 else:
302 else:
303 msg = (_(' subrepository sources for %s differ (in checked out '
303 msg = (_(' subrepository sources for %s differ (in checked out '
304 'version)\n'
304 'version)\n'
305 'use (l)ocal source (%s) or (r)emote source (%s)?'
305 'use (l)ocal source (%s) or (r)emote source (%s)?'
306 '$$ &Local $$ &Remote')
306 '$$ &Local $$ &Remote')
307 % (subrelpath(sub), local, remote))
307 % (subrelpath(sub), local, remote))
308 return ui.promptchoice(msg, 0)
308 return ui.promptchoice(msg, 0)
309
309
310 def reporelpath(repo):
310 def reporelpath(repo):
311 """return path to this (sub)repo as seen from outermost repo"""
311 """return path to this (sub)repo as seen from outermost repo"""
312 parent = repo
312 parent = repo
313 while util.safehasattr(parent, '_subparent'):
313 while util.safehasattr(parent, '_subparent'):
314 parent = parent._subparent
314 parent = parent._subparent
315 return repo.root[len(pathutil.normasprefix(parent.root)):]
315 return repo.root[len(pathutil.normasprefix(parent.root)):]
316
316
317 def subrelpath(sub):
317 def subrelpath(sub):
318 """return path to this subrepo as seen from outermost repo"""
318 """return path to this subrepo as seen from outermost repo"""
319 return sub._relpath
319 return sub._relpath
320
320
321 def _abssource(repo, push=False, abort=True):
321 def _abssource(repo, push=False, abort=True):
322 """return pull/push path of repo - either based on parent repo .hgsub info
322 """return pull/push path of repo - either based on parent repo .hgsub info
323 or on the top repo config. Abort or return None if no source found."""
323 or on the top repo config. Abort or return None if no source found."""
324 if util.safehasattr(repo, '_subparent'):
324 if util.safehasattr(repo, '_subparent'):
325 source = util.url(repo._subsource)
325 source = util.url(repo._subsource)
326 if source.isabs():
326 if source.isabs():
327 return str(source)
327 return str(source)
328 source.path = posixpath.normpath(source.path)
328 source.path = posixpath.normpath(source.path)
329 parent = _abssource(repo._subparent, push, abort=False)
329 parent = _abssource(repo._subparent, push, abort=False)
330 if parent:
330 if parent:
331 parent = util.url(util.pconvert(parent))
331 parent = util.url(util.pconvert(parent))
332 parent.path = posixpath.join(parent.path or '', source.path)
332 parent.path = posixpath.join(parent.path or '', source.path)
333 parent.path = posixpath.normpath(parent.path)
333 parent.path = posixpath.normpath(parent.path)
334 return str(parent)
334 return str(parent)
335 else: # recursion reached top repo
335 else: # recursion reached top repo
336 if util.safehasattr(repo, '_subtoppath'):
336 if util.safehasattr(repo, '_subtoppath'):
337 return repo._subtoppath
337 return repo._subtoppath
338 if push and repo.ui.config('paths', 'default-push'):
338 if push and repo.ui.config('paths', 'default-push'):
339 return repo.ui.config('paths', 'default-push')
339 return repo.ui.config('paths', 'default-push')
340 if repo.ui.config('paths', 'default'):
340 if repo.ui.config('paths', 'default'):
341 return repo.ui.config('paths', 'default')
341 return repo.ui.config('paths', 'default')
342 if repo.shared():
342 if repo.shared():
343 # chop off the .hg component to get the default path form
343 # chop off the .hg component to get the default path form
344 return os.path.dirname(repo.sharedpath)
344 return os.path.dirname(repo.sharedpath)
345 if abort:
345 if abort:
346 raise error.Abort(_("default path for subrepository not found"))
346 raise error.Abort(_("default path for subrepository not found"))
347
347
348 def _sanitize(ui, vfs, ignore):
348 def _sanitize(ui, vfs, ignore):
349 for dirname, dirs, names in vfs.walk():
349 for dirname, dirs, names in vfs.walk():
350 for i, d in enumerate(dirs):
350 for i, d in enumerate(dirs):
351 if d.lower() == ignore:
351 if d.lower() == ignore:
352 del dirs[i]
352 del dirs[i]
353 break
353 break
354 if vfs.basename(dirname).lower() != '.hg':
354 if vfs.basename(dirname).lower() != '.hg':
355 continue
355 continue
356 for f in names:
356 for f in names:
357 if f.lower() == 'hgrc':
357 if f.lower() == 'hgrc':
358 ui.warn(_("warning: removing potentially hostile 'hgrc' "
358 ui.warn(_("warning: removing potentially hostile 'hgrc' "
359 "in '%s'\n") % vfs.join(dirname))
359 "in '%s'\n") % vfs.join(dirname))
360 vfs.unlink(vfs.reljoin(dirname, f))
360 vfs.unlink(vfs.reljoin(dirname, f))
361
361
362 def _auditsubrepopath(repo, path):
363 # auditor doesn't check if the path itself is a symlink
364 pathutil.pathauditor(repo.root)(path)
365 if repo.wvfs.islink(path):
366 raise error.Abort(_("subrepo '%s' traverses symbolic link") % path)
367
368 SUBREPO_ALLOWED_DEFAULTS = {
369 'hg': True,
370 'git': False,
371 'svn': False,
372 }
373
374 def _checktype(ui, kind):
375 # subrepos.allowed is a master kill switch. If disabled, subrepos are
376 # disabled period.
377 if not ui.configbool('subrepos', 'allowed', True):
378 raise error.Abort(_('subrepos not enabled'),
379 hint=_("see 'hg help config.subrepos' for details"))
380
381 default = SUBREPO_ALLOWED_DEFAULTS.get(kind, False)
382 if not ui.configbool('subrepos', '%s:allowed' % kind, default):
383 raise error.Abort(_('%s subrepos not allowed') % kind,
384 hint=_("see 'hg help config.subrepos' for details"))
385
386 if kind not in types:
387 raise error.Abort(_('unknown subrepo type %s') % kind)
388
362 def subrepo(ctx, path, allowwdir=False, allowcreate=True):
389 def subrepo(ctx, path, allowwdir=False, allowcreate=True):
363 """return instance of the right subrepo class for subrepo in path"""
390 """return instance of the right subrepo class for subrepo in path"""
364 # subrepo inherently violates our import layering rules
391 # subrepo inherently violates our import layering rules
365 # because it wants to make repo objects from deep inside the stack
392 # because it wants to make repo objects from deep inside the stack
366 # so we manually delay the circular imports to not break
393 # so we manually delay the circular imports to not break
367 # scripts that don't use our demand-loading
394 # scripts that don't use our demand-loading
368 global hg
395 global hg
369 from . import hg as h
396 from . import hg as h
370 hg = h
397 hg = h
371
398
372 pathutil.pathauditor(ctx.repo().root)(path)
399 repo = ctx.repo()
400 _auditsubrepopath(repo, path)
373 state = ctx.substate[path]
401 state = ctx.substate[path]
374 if state[2] not in types:
402 _checktype(repo.ui, state[2])
375 raise error.Abort(_('unknown subrepo type %s') % state[2])
376 if allowwdir:
403 if allowwdir:
377 state = (state[0], ctx.subrev(path), state[2])
404 state = (state[0], ctx.subrev(path), state[2])
378 return types[state[2]](ctx, path, state[:2], allowcreate)
405 return types[state[2]](ctx, path, state[:2], allowcreate)
379
406
380 def nullsubrepo(ctx, path, pctx):
407 def nullsubrepo(ctx, path, pctx):
381 """return an empty subrepo in pctx for the extant subrepo in ctx"""
408 """return an empty subrepo in pctx for the extant subrepo in ctx"""
382 # subrepo inherently violates our import layering rules
409 # subrepo inherently violates our import layering rules
383 # because it wants to make repo objects from deep inside the stack
410 # because it wants to make repo objects from deep inside the stack
384 # so we manually delay the circular imports to not break
411 # so we manually delay the circular imports to not break
385 # scripts that don't use our demand-loading
412 # scripts that don't use our demand-loading
386 global hg
413 global hg
387 from . import hg as h
414 from . import hg as h
388 hg = h
415 hg = h
389
416
390 pathutil.pathauditor(ctx.repo().root)(path)
417 repo = ctx.repo()
418 _auditsubrepopath(repo, path)
391 state = ctx.substate[path]
419 state = ctx.substate[path]
392 if state[2] not in types:
420 _checktype(repo.ui, state[2])
393 raise error.Abort(_('unknown subrepo type %s') % state[2])
394 subrev = ''
421 subrev = ''
395 if state[2] == 'hg':
422 if state[2] == 'hg':
396 subrev = "0" * 40
423 subrev = "0" * 40
397 return types[state[2]](pctx, path, (state[0], subrev), True)
424 return types[state[2]](pctx, path, (state[0], subrev), True)
398
425
399 def newcommitphase(ui, ctx):
426 def newcommitphase(ui, ctx):
400 commitphase = phases.newcommitphase(ui)
427 commitphase = phases.newcommitphase(ui)
401 substate = getattr(ctx, "substate", None)
428 substate = getattr(ctx, "substate", None)
402 if not substate:
429 if not substate:
403 return commitphase
430 return commitphase
404 check = ui.config('phases', 'checksubrepos')
431 check = ui.config('phases', 'checksubrepos')
405 if check not in ('ignore', 'follow', 'abort'):
432 if check not in ('ignore', 'follow', 'abort'):
406 raise error.Abort(_('invalid phases.checksubrepos configuration: %s')
433 raise error.Abort(_('invalid phases.checksubrepos configuration: %s')
407 % (check))
434 % (check))
408 if check == 'ignore':
435 if check == 'ignore':
409 return commitphase
436 return commitphase
410 maxphase = phases.public
437 maxphase = phases.public
411 maxsub = None
438 maxsub = None
412 for s in sorted(substate):
439 for s in sorted(substate):
413 sub = ctx.sub(s)
440 sub = ctx.sub(s)
414 subphase = sub.phase(substate[s][1])
441 subphase = sub.phase(substate[s][1])
415 if maxphase < subphase:
442 if maxphase < subphase:
416 maxphase = subphase
443 maxphase = subphase
417 maxsub = s
444 maxsub = s
418 if commitphase < maxphase:
445 if commitphase < maxphase:
419 if check == 'abort':
446 if check == 'abort':
420 raise error.Abort(_("can't commit in %s phase"
447 raise error.Abort(_("can't commit in %s phase"
421 " conflicting %s from subrepository %s") %
448 " conflicting %s from subrepository %s") %
422 (phases.phasenames[commitphase],
449 (phases.phasenames[commitphase],
423 phases.phasenames[maxphase], maxsub))
450 phases.phasenames[maxphase], maxsub))
424 ui.warn(_("warning: changes are committed in"
451 ui.warn(_("warning: changes are committed in"
425 " %s phase from subrepository %s\n") %
452 " %s phase from subrepository %s\n") %
426 (phases.phasenames[maxphase], maxsub))
453 (phases.phasenames[maxphase], maxsub))
427 return maxphase
454 return maxphase
428 return commitphase
455 return commitphase
429
456
430 # subrepo classes need to implement the following abstract class:
457 # subrepo classes need to implement the following abstract class:
431
458
432 class abstractsubrepo(object):
459 class abstractsubrepo(object):
433
460
434 def __init__(self, ctx, path):
461 def __init__(self, ctx, path):
435 """Initialize abstractsubrepo part
462 """Initialize abstractsubrepo part
436
463
437 ``ctx`` is the context referring this subrepository in the
464 ``ctx`` is the context referring this subrepository in the
438 parent repository.
465 parent repository.
439
466
440 ``path`` is the path to this subrepository as seen from
467 ``path`` is the path to this subrepository as seen from
441 innermost repository.
468 innermost repository.
442 """
469 """
443 self.ui = ctx.repo().ui
470 self.ui = ctx.repo().ui
444 self._ctx = ctx
471 self._ctx = ctx
445 self._path = path
472 self._path = path
446
473
447 def addwebdirpath(self, serverpath, webconf):
474 def addwebdirpath(self, serverpath, webconf):
448 """Add the hgwebdir entries for this subrepo, and any of its subrepos.
475 """Add the hgwebdir entries for this subrepo, and any of its subrepos.
449
476
450 ``serverpath`` is the path component of the URL for this repo.
477 ``serverpath`` is the path component of the URL for this repo.
451
478
452 ``webconf`` is the dictionary of hgwebdir entries.
479 ``webconf`` is the dictionary of hgwebdir entries.
453 """
480 """
454 pass
481 pass
455
482
456 def storeclean(self, path):
483 def storeclean(self, path):
457 """
484 """
458 returns true if the repository has not changed since it was last
485 returns true if the repository has not changed since it was last
459 cloned from or pushed to a given repository.
486 cloned from or pushed to a given repository.
460 """
487 """
461 return False
488 return False
462
489
463 def dirty(self, ignoreupdate=False, missing=False):
490 def dirty(self, ignoreupdate=False, missing=False):
464 """returns true if the dirstate of the subrepo is dirty or does not
491 """returns true if the dirstate of the subrepo is dirty or does not
465 match current stored state. If ignoreupdate is true, only check
492 match current stored state. If ignoreupdate is true, only check
466 whether the subrepo has uncommitted changes in its dirstate. If missing
493 whether the subrepo has uncommitted changes in its dirstate. If missing
467 is true, check for deleted files.
494 is true, check for deleted files.
468 """
495 """
469 raise NotImplementedError
496 raise NotImplementedError
470
497
471 def dirtyreason(self, ignoreupdate=False, missing=False):
498 def dirtyreason(self, ignoreupdate=False, missing=False):
472 """return reason string if it is ``dirty()``
499 """return reason string if it is ``dirty()``
473
500
474 Returned string should have enough information for the message
501 Returned string should have enough information for the message
475 of exception.
502 of exception.
476
503
477 This returns None, otherwise.
504 This returns None, otherwise.
478 """
505 """
479 if self.dirty(ignoreupdate=ignoreupdate, missing=missing):
506 if self.dirty(ignoreupdate=ignoreupdate, missing=missing):
480 return _('uncommitted changes in subrepository "%s"'
507 return _('uncommitted changes in subrepository "%s"'
481 ) % subrelpath(self)
508 ) % subrelpath(self)
482
509
483 def bailifchanged(self, ignoreupdate=False, hint=None):
510 def bailifchanged(self, ignoreupdate=False, hint=None):
484 """raise Abort if subrepository is ``dirty()``
511 """raise Abort if subrepository is ``dirty()``
485 """
512 """
486 dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate,
513 dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate,
487 missing=True)
514 missing=True)
488 if dirtyreason:
515 if dirtyreason:
489 raise error.Abort(dirtyreason, hint=hint)
516 raise error.Abort(dirtyreason, hint=hint)
490
517
491 def basestate(self):
518 def basestate(self):
492 """current working directory base state, disregarding .hgsubstate
519 """current working directory base state, disregarding .hgsubstate
493 state and working directory modifications"""
520 state and working directory modifications"""
494 raise NotImplementedError
521 raise NotImplementedError
495
522
496 def checknested(self, path):
523 def checknested(self, path):
497 """check if path is a subrepository within this repository"""
524 """check if path is a subrepository within this repository"""
498 return False
525 return False
499
526
500 def commit(self, text, user, date):
527 def commit(self, text, user, date):
501 """commit the current changes to the subrepo with the given
528 """commit the current changes to the subrepo with the given
502 log message. Use given user and date if possible. Return the
529 log message. Use given user and date if possible. Return the
503 new state of the subrepo.
530 new state of the subrepo.
504 """
531 """
505 raise NotImplementedError
532 raise NotImplementedError
506
533
507 def phase(self, state):
534 def phase(self, state):
508 """returns phase of specified state in the subrepository.
535 """returns phase of specified state in the subrepository.
509 """
536 """
510 return phases.public
537 return phases.public
511
538
512 def remove(self):
539 def remove(self):
513 """remove the subrepo
540 """remove the subrepo
514
541
515 (should verify the dirstate is not dirty first)
542 (should verify the dirstate is not dirty first)
516 """
543 """
517 raise NotImplementedError
544 raise NotImplementedError
518
545
519 def get(self, state, overwrite=False):
546 def get(self, state, overwrite=False):
520 """run whatever commands are needed to put the subrepo into
547 """run whatever commands are needed to put the subrepo into
521 this state
548 this state
522 """
549 """
523 raise NotImplementedError
550 raise NotImplementedError
524
551
525 def merge(self, state):
552 def merge(self, state):
526 """merge currently-saved state with the new state."""
553 """merge currently-saved state with the new state."""
527 raise NotImplementedError
554 raise NotImplementedError
528
555
529 def push(self, opts):
556 def push(self, opts):
530 """perform whatever action is analogous to 'hg push'
557 """perform whatever action is analogous to 'hg push'
531
558
532 This may be a no-op on some systems.
559 This may be a no-op on some systems.
533 """
560 """
534 raise NotImplementedError
561 raise NotImplementedError
535
562
536 def add(self, ui, match, prefix, explicitonly, **opts):
563 def add(self, ui, match, prefix, explicitonly, **opts):
537 return []
564 return []
538
565
539 def addremove(self, matcher, prefix, opts, dry_run, similarity):
566 def addremove(self, matcher, prefix, opts, dry_run, similarity):
540 self.ui.warn("%s: %s" % (prefix, _("addremove is not supported")))
567 self.ui.warn("%s: %s" % (prefix, _("addremove is not supported")))
541 return 1
568 return 1
542
569
543 def cat(self, match, fm, fntemplate, prefix, **opts):
570 def cat(self, match, fm, fntemplate, prefix, **opts):
544 return 1
571 return 1
545
572
546 def status(self, rev2, **opts):
573 def status(self, rev2, **opts):
547 return scmutil.status([], [], [], [], [], [], [])
574 return scmutil.status([], [], [], [], [], [], [])
548
575
549 def diff(self, ui, diffopts, node2, match, prefix, **opts):
576 def diff(self, ui, diffopts, node2, match, prefix, **opts):
550 pass
577 pass
551
578
552 def outgoing(self, ui, dest, opts):
579 def outgoing(self, ui, dest, opts):
553 return 1
580 return 1
554
581
555 def incoming(self, ui, source, opts):
582 def incoming(self, ui, source, opts):
556 return 1
583 return 1
557
584
558 def files(self):
585 def files(self):
559 """return filename iterator"""
586 """return filename iterator"""
560 raise NotImplementedError
587 raise NotImplementedError
561
588
562 def filedata(self, name, decode):
589 def filedata(self, name, decode):
563 """return file data, optionally passed through repo decoders"""
590 """return file data, optionally passed through repo decoders"""
564 raise NotImplementedError
591 raise NotImplementedError
565
592
566 def fileflags(self, name):
593 def fileflags(self, name):
567 """return file flags"""
594 """return file flags"""
568 return ''
595 return ''
569
596
570 def getfileset(self, expr):
597 def getfileset(self, expr):
571 """Resolve the fileset expression for this repo"""
598 """Resolve the fileset expression for this repo"""
572 return set()
599 return set()
573
600
574 def printfiles(self, ui, m, fm, fmt, subrepos):
601 def printfiles(self, ui, m, fm, fmt, subrepos):
575 """handle the files command for this subrepo"""
602 """handle the files command for this subrepo"""
576 return 1
603 return 1
577
604
578 def archive(self, archiver, prefix, match=None, decode=True):
605 def archive(self, archiver, prefix, match=None, decode=True):
579 if match is not None:
606 if match is not None:
580 files = [f for f in self.files() if match(f)]
607 files = [f for f in self.files() if match(f)]
581 else:
608 else:
582 files = self.files()
609 files = self.files()
583 total = len(files)
610 total = len(files)
584 relpath = subrelpath(self)
611 relpath = subrelpath(self)
585 self.ui.progress(_('archiving (%s)') % relpath, 0,
612 self.ui.progress(_('archiving (%s)') % relpath, 0,
586 unit=_('files'), total=total)
613 unit=_('files'), total=total)
587 for i, name in enumerate(files):
614 for i, name in enumerate(files):
588 flags = self.fileflags(name)
615 flags = self.fileflags(name)
589 mode = 'x' in flags and 0o755 or 0o644
616 mode = 'x' in flags and 0o755 or 0o644
590 symlink = 'l' in flags
617 symlink = 'l' in flags
591 archiver.addfile(prefix + self._path + '/' + name,
618 archiver.addfile(prefix + self._path + '/' + name,
592 mode, symlink, self.filedata(name, decode))
619 mode, symlink, self.filedata(name, decode))
593 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
620 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
594 unit=_('files'), total=total)
621 unit=_('files'), total=total)
595 self.ui.progress(_('archiving (%s)') % relpath, None)
622 self.ui.progress(_('archiving (%s)') % relpath, None)
596 return total
623 return total
597
624
598 def walk(self, match):
625 def walk(self, match):
599 '''
626 '''
600 walk recursively through the directory tree, finding all files
627 walk recursively through the directory tree, finding all files
601 matched by the match function
628 matched by the match function
602 '''
629 '''
603
630
604 def forget(self, match, prefix):
631 def forget(self, match, prefix):
605 return ([], [])
632 return ([], [])
606
633
607 def removefiles(self, matcher, prefix, after, force, subrepos, warnings):
634 def removefiles(self, matcher, prefix, after, force, subrepos, warnings):
608 """remove the matched files from the subrepository and the filesystem,
635 """remove the matched files from the subrepository and the filesystem,
609 possibly by force and/or after the file has been removed from the
636 possibly by force and/or after the file has been removed from the
610 filesystem. Return 0 on success, 1 on any warning.
637 filesystem. Return 0 on success, 1 on any warning.
611 """
638 """
612 warnings.append(_("warning: removefiles not implemented (%s)")
639 warnings.append(_("warning: removefiles not implemented (%s)")
613 % self._path)
640 % self._path)
614 return 1
641 return 1
615
642
616 def revert(self, substate, *pats, **opts):
643 def revert(self, substate, *pats, **opts):
617 self.ui.warn(_('%s: reverting %s subrepos is unsupported\n') \
644 self.ui.warn(_('%s: reverting %s subrepos is unsupported\n') \
618 % (substate[0], substate[2]))
645 % (substate[0], substate[2]))
619 return []
646 return []
620
647
621 def shortid(self, revid):
648 def shortid(self, revid):
622 return revid
649 return revid
623
650
624 def unshare(self):
651 def unshare(self):
625 '''
652 '''
626 convert this repository from shared to normal storage.
653 convert this repository from shared to normal storage.
627 '''
654 '''
628
655
629 def verify(self):
656 def verify(self):
630 '''verify the integrity of the repository. Return 0 on success or
657 '''verify the integrity of the repository. Return 0 on success or
631 warning, 1 on any error.
658 warning, 1 on any error.
632 '''
659 '''
633 return 0
660 return 0
634
661
635 @propertycache
662 @propertycache
636 def wvfs(self):
663 def wvfs(self):
637 """return vfs to access the working directory of this subrepository
664 """return vfs to access the working directory of this subrepository
638 """
665 """
639 return vfsmod.vfs(self._ctx.repo().wvfs.join(self._path))
666 return vfsmod.vfs(self._ctx.repo().wvfs.join(self._path))
640
667
641 @propertycache
668 @propertycache
642 def _relpath(self):
669 def _relpath(self):
643 """return path to this subrepository as seen from outermost repository
670 """return path to this subrepository as seen from outermost repository
644 """
671 """
645 return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path)
672 return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path)
646
673
647 class hgsubrepo(abstractsubrepo):
674 class hgsubrepo(abstractsubrepo):
648 def __init__(self, ctx, path, state, allowcreate):
675 def __init__(self, ctx, path, state, allowcreate):
649 super(hgsubrepo, self).__init__(ctx, path)
676 super(hgsubrepo, self).__init__(ctx, path)
650 self._state = state
677 self._state = state
651 r = ctx.repo()
678 r = ctx.repo()
652 root = r.wjoin(path)
679 root = r.wjoin(path)
653 create = allowcreate and not r.wvfs.exists('%s/.hg' % path)
680 create = allowcreate and not r.wvfs.exists('%s/.hg' % path)
654 self._repo = hg.repository(r.baseui, root, create=create)
681 self._repo = hg.repository(r.baseui, root, create=create)
655
682
656 # Propagate the parent's --hidden option
683 # Propagate the parent's --hidden option
657 if r is r.unfiltered():
684 if r is r.unfiltered():
658 self._repo = self._repo.unfiltered()
685 self._repo = self._repo.unfiltered()
659
686
660 self.ui = self._repo.ui
687 self.ui = self._repo.ui
661 for s, k in [('ui', 'commitsubrepos')]:
688 for s, k in [('ui', 'commitsubrepos')]:
662 v = r.ui.config(s, k)
689 v = r.ui.config(s, k)
663 if v:
690 if v:
664 self.ui.setconfig(s, k, v, 'subrepo')
691 self.ui.setconfig(s, k, v, 'subrepo')
665 # internal config: ui._usedassubrepo
692 # internal config: ui._usedassubrepo
666 self.ui.setconfig('ui', '_usedassubrepo', 'True', 'subrepo')
693 self.ui.setconfig('ui', '_usedassubrepo', 'True', 'subrepo')
667 self._initrepo(r, state[0], create)
694 self._initrepo(r, state[0], create)
668
695
669 @annotatesubrepoerror
696 @annotatesubrepoerror
670 def addwebdirpath(self, serverpath, webconf):
697 def addwebdirpath(self, serverpath, webconf):
671 cmdutil.addwebdirpath(self._repo, subrelpath(self), webconf)
698 cmdutil.addwebdirpath(self._repo, subrelpath(self), webconf)
672
699
673 def storeclean(self, path):
700 def storeclean(self, path):
674 with self._repo.lock():
701 with self._repo.lock():
675 return self._storeclean(path)
702 return self._storeclean(path)
676
703
677 def _storeclean(self, path):
704 def _storeclean(self, path):
678 clean = True
705 clean = True
679 itercache = self._calcstorehash(path)
706 itercache = self._calcstorehash(path)
680 for filehash in self._readstorehashcache(path):
707 for filehash in self._readstorehashcache(path):
681 if filehash != next(itercache, None):
708 if filehash != next(itercache, None):
682 clean = False
709 clean = False
683 break
710 break
684 if clean:
711 if clean:
685 # if not empty:
712 # if not empty:
686 # the cached and current pull states have a different size
713 # the cached and current pull states have a different size
687 clean = next(itercache, None) is None
714 clean = next(itercache, None) is None
688 return clean
715 return clean
689
716
690 def _calcstorehash(self, remotepath):
717 def _calcstorehash(self, remotepath):
691 '''calculate a unique "store hash"
718 '''calculate a unique "store hash"
692
719
693 This method is used to to detect when there are changes that may
720 This method is used to to detect when there are changes that may
694 require a push to a given remote path.'''
721 require a push to a given remote path.'''
695 # sort the files that will be hashed in increasing (likely) file size
722 # sort the files that will be hashed in increasing (likely) file size
696 filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i')
723 filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i')
697 yield '# %s\n' % _expandedabspath(remotepath)
724 yield '# %s\n' % _expandedabspath(remotepath)
698 vfs = self._repo.vfs
725 vfs = self._repo.vfs
699 for relname in filelist:
726 for relname in filelist:
700 filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest()
727 filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest()
701 yield '%s = %s\n' % (relname, filehash)
728 yield '%s = %s\n' % (relname, filehash)
702
729
703 @propertycache
730 @propertycache
704 def _cachestorehashvfs(self):
731 def _cachestorehashvfs(self):
705 return vfsmod.vfs(self._repo.vfs.join('cache/storehash'))
732 return vfsmod.vfs(self._repo.vfs.join('cache/storehash'))
706
733
707 def _readstorehashcache(self, remotepath):
734 def _readstorehashcache(self, remotepath):
708 '''read the store hash cache for a given remote repository'''
735 '''read the store hash cache for a given remote repository'''
709 cachefile = _getstorehashcachename(remotepath)
736 cachefile = _getstorehashcachename(remotepath)
710 return self._cachestorehashvfs.tryreadlines(cachefile, 'r')
737 return self._cachestorehashvfs.tryreadlines(cachefile, 'r')
711
738
712 def _cachestorehash(self, remotepath):
739 def _cachestorehash(self, remotepath):
713 '''cache the current store hash
740 '''cache the current store hash
714
741
715 Each remote repo requires its own store hash cache, because a subrepo
742 Each remote repo requires its own store hash cache, because a subrepo
716 store may be "clean" versus a given remote repo, but not versus another
743 store may be "clean" versus a given remote repo, but not versus another
717 '''
744 '''
718 cachefile = _getstorehashcachename(remotepath)
745 cachefile = _getstorehashcachename(remotepath)
719 with self._repo.lock():
746 with self._repo.lock():
720 storehash = list(self._calcstorehash(remotepath))
747 storehash = list(self._calcstorehash(remotepath))
721 vfs = self._cachestorehashvfs
748 vfs = self._cachestorehashvfs
722 vfs.writelines(cachefile, storehash, mode='w', notindexed=True)
749 vfs.writelines(cachefile, storehash, mode='w', notindexed=True)
723
750
724 def _getctx(self):
751 def _getctx(self):
725 '''fetch the context for this subrepo revision, possibly a workingctx
752 '''fetch the context for this subrepo revision, possibly a workingctx
726 '''
753 '''
727 if self._ctx.rev() is None:
754 if self._ctx.rev() is None:
728 return self._repo[None] # workingctx if parent is workingctx
755 return self._repo[None] # workingctx if parent is workingctx
729 else:
756 else:
730 rev = self._state[1]
757 rev = self._state[1]
731 return self._repo[rev]
758 return self._repo[rev]
732
759
733 @annotatesubrepoerror
760 @annotatesubrepoerror
734 def _initrepo(self, parentrepo, source, create):
761 def _initrepo(self, parentrepo, source, create):
735 self._repo._subparent = parentrepo
762 self._repo._subparent = parentrepo
736 self._repo._subsource = source
763 self._repo._subsource = source
737
764
738 if create:
765 if create:
739 lines = ['[paths]\n']
766 lines = ['[paths]\n']
740
767
741 def addpathconfig(key, value):
768 def addpathconfig(key, value):
742 if value:
769 if value:
743 lines.append('%s = %s\n' % (key, value))
770 lines.append('%s = %s\n' % (key, value))
744 self.ui.setconfig('paths', key, value, 'subrepo')
771 self.ui.setconfig('paths', key, value, 'subrepo')
745
772
746 defpath = _abssource(self._repo, abort=False)
773 defpath = _abssource(self._repo, abort=False)
747 defpushpath = _abssource(self._repo, True, abort=False)
774 defpushpath = _abssource(self._repo, True, abort=False)
748 addpathconfig('default', defpath)
775 addpathconfig('default', defpath)
749 if defpath != defpushpath:
776 if defpath != defpushpath:
750 addpathconfig('default-push', defpushpath)
777 addpathconfig('default-push', defpushpath)
751
778
752 fp = self._repo.vfs("hgrc", "w", text=True)
779 fp = self._repo.vfs("hgrc", "w", text=True)
753 try:
780 try:
754 fp.write(''.join(lines))
781 fp.write(''.join(lines))
755 finally:
782 finally:
756 fp.close()
783 fp.close()
757
784
758 @annotatesubrepoerror
785 @annotatesubrepoerror
759 def add(self, ui, match, prefix, explicitonly, **opts):
786 def add(self, ui, match, prefix, explicitonly, **opts):
760 return cmdutil.add(ui, self._repo, match,
787 return cmdutil.add(ui, self._repo, match,
761 self.wvfs.reljoin(prefix, self._path),
788 self.wvfs.reljoin(prefix, self._path),
762 explicitonly, **opts)
789 explicitonly, **opts)
763
790
764 @annotatesubrepoerror
791 @annotatesubrepoerror
765 def addremove(self, m, prefix, opts, dry_run, similarity):
792 def addremove(self, m, prefix, opts, dry_run, similarity):
766 # In the same way as sub directories are processed, once in a subrepo,
793 # In the same way as sub directories are processed, once in a subrepo,
767 # always entry any of its subrepos. Don't corrupt the options that will
794 # always entry any of its subrepos. Don't corrupt the options that will
768 # be used to process sibling subrepos however.
795 # be used to process sibling subrepos however.
769 opts = copy.copy(opts)
796 opts = copy.copy(opts)
770 opts['subrepos'] = True
797 opts['subrepos'] = True
771 return scmutil.addremove(self._repo, m,
798 return scmutil.addremove(self._repo, m,
772 self.wvfs.reljoin(prefix, self._path), opts,
799 self.wvfs.reljoin(prefix, self._path), opts,
773 dry_run, similarity)
800 dry_run, similarity)
774
801
775 @annotatesubrepoerror
802 @annotatesubrepoerror
776 def cat(self, match, fm, fntemplate, prefix, **opts):
803 def cat(self, match, fm, fntemplate, prefix, **opts):
777 rev = self._state[1]
804 rev = self._state[1]
778 ctx = self._repo[rev]
805 ctx = self._repo[rev]
779 return cmdutil.cat(self.ui, self._repo, ctx, match, fm, fntemplate,
806 return cmdutil.cat(self.ui, self._repo, ctx, match, fm, fntemplate,
780 prefix, **opts)
807 prefix, **opts)
781
808
782 @annotatesubrepoerror
809 @annotatesubrepoerror
783 def status(self, rev2, **opts):
810 def status(self, rev2, **opts):
784 try:
811 try:
785 rev1 = self._state[1]
812 rev1 = self._state[1]
786 ctx1 = self._repo[rev1]
813 ctx1 = self._repo[rev1]
787 ctx2 = self._repo[rev2]
814 ctx2 = self._repo[rev2]
788 return self._repo.status(ctx1, ctx2, **opts)
815 return self._repo.status(ctx1, ctx2, **opts)
789 except error.RepoLookupError as inst:
816 except error.RepoLookupError as inst:
790 self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
817 self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
791 % (inst, subrelpath(self)))
818 % (inst, subrelpath(self)))
792 return scmutil.status([], [], [], [], [], [], [])
819 return scmutil.status([], [], [], [], [], [], [])
793
820
794 @annotatesubrepoerror
821 @annotatesubrepoerror
795 def diff(self, ui, diffopts, node2, match, prefix, **opts):
822 def diff(self, ui, diffopts, node2, match, prefix, **opts):
796 try:
823 try:
797 node1 = node.bin(self._state[1])
824 node1 = node.bin(self._state[1])
798 # We currently expect node2 to come from substate and be
825 # We currently expect node2 to come from substate and be
799 # in hex format
826 # in hex format
800 if node2 is not None:
827 if node2 is not None:
801 node2 = node.bin(node2)
828 node2 = node.bin(node2)
802 cmdutil.diffordiffstat(ui, self._repo, diffopts,
829 cmdutil.diffordiffstat(ui, self._repo, diffopts,
803 node1, node2, match,
830 node1, node2, match,
804 prefix=posixpath.join(prefix, self._path),
831 prefix=posixpath.join(prefix, self._path),
805 listsubrepos=True, **opts)
832 listsubrepos=True, **opts)
806 except error.RepoLookupError as inst:
833 except error.RepoLookupError as inst:
807 self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
834 self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
808 % (inst, subrelpath(self)))
835 % (inst, subrelpath(self)))
809
836
810 @annotatesubrepoerror
837 @annotatesubrepoerror
811 def archive(self, archiver, prefix, match=None, decode=True):
838 def archive(self, archiver, prefix, match=None, decode=True):
812 self._get(self._state + ('hg',))
839 self._get(self._state + ('hg',))
813 total = abstractsubrepo.archive(self, archiver, prefix, match)
840 total = abstractsubrepo.archive(self, archiver, prefix, match)
814 rev = self._state[1]
841 rev = self._state[1]
815 ctx = self._repo[rev]
842 ctx = self._repo[rev]
816 for subpath in ctx.substate:
843 for subpath in ctx.substate:
817 s = subrepo(ctx, subpath, True)
844 s = subrepo(ctx, subpath, True)
818 submatch = matchmod.subdirmatcher(subpath, match)
845 submatch = matchmod.subdirmatcher(subpath, match)
819 total += s.archive(archiver, prefix + self._path + '/', submatch,
846 total += s.archive(archiver, prefix + self._path + '/', submatch,
820 decode)
847 decode)
821 return total
848 return total
822
849
823 @annotatesubrepoerror
850 @annotatesubrepoerror
824 def dirty(self, ignoreupdate=False, missing=False):
851 def dirty(self, ignoreupdate=False, missing=False):
825 r = self._state[1]
852 r = self._state[1]
826 if r == '' and not ignoreupdate: # no state recorded
853 if r == '' and not ignoreupdate: # no state recorded
827 return True
854 return True
828 w = self._repo[None]
855 w = self._repo[None]
829 if r != w.p1().hex() and not ignoreupdate:
856 if r != w.p1().hex() and not ignoreupdate:
830 # different version checked out
857 # different version checked out
831 return True
858 return True
832 return w.dirty(missing=missing) # working directory changed
859 return w.dirty(missing=missing) # working directory changed
833
860
834 def basestate(self):
861 def basestate(self):
835 return self._repo['.'].hex()
862 return self._repo['.'].hex()
836
863
837 def checknested(self, path):
864 def checknested(self, path):
838 return self._repo._checknested(self._repo.wjoin(path))
865 return self._repo._checknested(self._repo.wjoin(path))
839
866
840 @annotatesubrepoerror
867 @annotatesubrepoerror
841 def commit(self, text, user, date):
868 def commit(self, text, user, date):
842 # don't bother committing in the subrepo if it's only been
869 # don't bother committing in the subrepo if it's only been
843 # updated
870 # updated
844 if not self.dirty(True):
871 if not self.dirty(True):
845 return self._repo['.'].hex()
872 return self._repo['.'].hex()
846 self.ui.debug("committing subrepo %s\n" % subrelpath(self))
873 self.ui.debug("committing subrepo %s\n" % subrelpath(self))
847 n = self._repo.commit(text, user, date)
874 n = self._repo.commit(text, user, date)
848 if not n:
875 if not n:
849 return self._repo['.'].hex() # different version checked out
876 return self._repo['.'].hex() # different version checked out
850 return node.hex(n)
877 return node.hex(n)
851
878
852 @annotatesubrepoerror
879 @annotatesubrepoerror
853 def phase(self, state):
880 def phase(self, state):
854 return self._repo[state].phase()
881 return self._repo[state].phase()
855
882
856 @annotatesubrepoerror
883 @annotatesubrepoerror
857 def remove(self):
884 def remove(self):
858 # we can't fully delete the repository as it may contain
885 # we can't fully delete the repository as it may contain
859 # local-only history
886 # local-only history
860 self.ui.note(_('removing subrepo %s\n') % subrelpath(self))
887 self.ui.note(_('removing subrepo %s\n') % subrelpath(self))
861 hg.clean(self._repo, node.nullid, False)
888 hg.clean(self._repo, node.nullid, False)
862
889
863 def _get(self, state):
890 def _get(self, state):
864 source, revision, kind = state
891 source, revision, kind = state
865 parentrepo = self._repo._subparent
892 parentrepo = self._repo._subparent
866
893
867 if revision in self._repo.unfiltered():
894 if revision in self._repo.unfiltered():
868 # Allow shared subrepos tracked at null to setup the sharedpath
895 # Allow shared subrepos tracked at null to setup the sharedpath
869 if len(self._repo) != 0 or not parentrepo.shared():
896 if len(self._repo) != 0 or not parentrepo.shared():
870 return True
897 return True
871 self._repo._subsource = source
898 self._repo._subsource = source
872 srcurl = _abssource(self._repo)
899 srcurl = _abssource(self._repo)
873 other = hg.peer(self._repo, {}, srcurl)
900 other = hg.peer(self._repo, {}, srcurl)
874 if len(self._repo) == 0:
901 if len(self._repo) == 0:
875 # use self._repo.vfs instead of self.wvfs to remove .hg only
902 # use self._repo.vfs instead of self.wvfs to remove .hg only
876 self._repo.vfs.rmtree()
903 self._repo.vfs.rmtree()
877 if parentrepo.shared():
904 if parentrepo.shared():
878 self.ui.status(_('sharing subrepo %s from %s\n')
905 self.ui.status(_('sharing subrepo %s from %s\n')
879 % (subrelpath(self), srcurl))
906 % (subrelpath(self), srcurl))
880 shared = hg.share(self._repo._subparent.baseui,
907 shared = hg.share(self._repo._subparent.baseui,
881 other, self._repo.root,
908 other, self._repo.root,
882 update=False, bookmarks=False)
909 update=False, bookmarks=False)
883 self._repo = shared.local()
910 self._repo = shared.local()
884 else:
911 else:
885 self.ui.status(_('cloning subrepo %s from %s\n')
912 self.ui.status(_('cloning subrepo %s from %s\n')
886 % (subrelpath(self), srcurl))
913 % (subrelpath(self), srcurl))
887 other, cloned = hg.clone(self._repo._subparent.baseui, {},
914 other, cloned = hg.clone(self._repo._subparent.baseui, {},
888 other, self._repo.root,
915 other, self._repo.root,
889 update=False)
916 update=False)
890 self._repo = cloned.local()
917 self._repo = cloned.local()
891 self._initrepo(parentrepo, source, create=True)
918 self._initrepo(parentrepo, source, create=True)
892 self._cachestorehash(srcurl)
919 self._cachestorehash(srcurl)
893 else:
920 else:
894 self.ui.status(_('pulling subrepo %s from %s\n')
921 self.ui.status(_('pulling subrepo %s from %s\n')
895 % (subrelpath(self), srcurl))
922 % (subrelpath(self), srcurl))
896 cleansub = self.storeclean(srcurl)
923 cleansub = self.storeclean(srcurl)
897 exchange.pull(self._repo, other)
924 exchange.pull(self._repo, other)
898 if cleansub:
925 if cleansub:
899 # keep the repo clean after pull
926 # keep the repo clean after pull
900 self._cachestorehash(srcurl)
927 self._cachestorehash(srcurl)
901 return False
928 return False
902
929
903 @annotatesubrepoerror
930 @annotatesubrepoerror
904 def get(self, state, overwrite=False):
931 def get(self, state, overwrite=False):
905 inrepo = self._get(state)
932 inrepo = self._get(state)
906 source, revision, kind = state
933 source, revision, kind = state
907 repo = self._repo
934 repo = self._repo
908 repo.ui.debug("getting subrepo %s\n" % self._path)
935 repo.ui.debug("getting subrepo %s\n" % self._path)
909 if inrepo:
936 if inrepo:
910 urepo = repo.unfiltered()
937 urepo = repo.unfiltered()
911 ctx = urepo[revision]
938 ctx = urepo[revision]
912 if ctx.hidden():
939 if ctx.hidden():
913 urepo.ui.warn(
940 urepo.ui.warn(
914 _('revision %s in subrepository "%s" is hidden\n') \
941 _('revision %s in subrepository "%s" is hidden\n') \
915 % (revision[0:12], self._path))
942 % (revision[0:12], self._path))
916 repo = urepo
943 repo = urepo
917 hg.updaterepo(repo, revision, overwrite)
944 hg.updaterepo(repo, revision, overwrite)
918
945
919 @annotatesubrepoerror
946 @annotatesubrepoerror
920 def merge(self, state):
947 def merge(self, state):
921 self._get(state)
948 self._get(state)
922 cur = self._repo['.']
949 cur = self._repo['.']
923 dst = self._repo[state[1]]
950 dst = self._repo[state[1]]
924 anc = dst.ancestor(cur)
951 anc = dst.ancestor(cur)
925
952
926 def mergefunc():
953 def mergefunc():
927 if anc == cur and dst.branch() == cur.branch():
954 if anc == cur and dst.branch() == cur.branch():
928 self.ui.debug('updating subrepository "%s"\n'
955 self.ui.debug('updating subrepository "%s"\n'
929 % subrelpath(self))
956 % subrelpath(self))
930 hg.update(self._repo, state[1])
957 hg.update(self._repo, state[1])
931 elif anc == dst:
958 elif anc == dst:
932 self.ui.debug('skipping subrepository "%s"\n'
959 self.ui.debug('skipping subrepository "%s"\n'
933 % subrelpath(self))
960 % subrelpath(self))
934 else:
961 else:
935 self.ui.debug('merging subrepository "%s"\n' % subrelpath(self))
962 self.ui.debug('merging subrepository "%s"\n' % subrelpath(self))
936 hg.merge(self._repo, state[1], remind=False)
963 hg.merge(self._repo, state[1], remind=False)
937
964
938 wctx = self._repo[None]
965 wctx = self._repo[None]
939 if self.dirty():
966 if self.dirty():
940 if anc != dst:
967 if anc != dst:
941 if _updateprompt(self.ui, self, wctx.dirty(), cur, dst):
968 if _updateprompt(self.ui, self, wctx.dirty(), cur, dst):
942 mergefunc()
969 mergefunc()
943 else:
970 else:
944 mergefunc()
971 mergefunc()
945 else:
972 else:
946 mergefunc()
973 mergefunc()
947
974
948 @annotatesubrepoerror
975 @annotatesubrepoerror
949 def push(self, opts):
976 def push(self, opts):
950 force = opts.get('force')
977 force = opts.get('force')
951 newbranch = opts.get('new_branch')
978 newbranch = opts.get('new_branch')
952 ssh = opts.get('ssh')
979 ssh = opts.get('ssh')
953
980
954 # push subrepos depth-first for coherent ordering
981 # push subrepos depth-first for coherent ordering
955 c = self._repo['']
982 c = self._repo['']
956 subs = c.substate # only repos that are committed
983 subs = c.substate # only repos that are committed
957 for s in sorted(subs):
984 for s in sorted(subs):
958 if c.sub(s).push(opts) == 0:
985 if c.sub(s).push(opts) == 0:
959 return False
986 return False
960
987
961 dsturl = _abssource(self._repo, True)
988 dsturl = _abssource(self._repo, True)
962 if not force:
989 if not force:
963 if self.storeclean(dsturl):
990 if self.storeclean(dsturl):
964 self.ui.status(
991 self.ui.status(
965 _('no changes made to subrepo %s since last push to %s\n')
992 _('no changes made to subrepo %s since last push to %s\n')
966 % (subrelpath(self), dsturl))
993 % (subrelpath(self), dsturl))
967 return None
994 return None
968 self.ui.status(_('pushing subrepo %s to %s\n') %
995 self.ui.status(_('pushing subrepo %s to %s\n') %
969 (subrelpath(self), dsturl))
996 (subrelpath(self), dsturl))
970 other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
997 other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
971 res = exchange.push(self._repo, other, force, newbranch=newbranch)
998 res = exchange.push(self._repo, other, force, newbranch=newbranch)
972
999
973 # the repo is now clean
1000 # the repo is now clean
974 self._cachestorehash(dsturl)
1001 self._cachestorehash(dsturl)
975 return res.cgresult
1002 return res.cgresult
976
1003
977 @annotatesubrepoerror
1004 @annotatesubrepoerror
978 def outgoing(self, ui, dest, opts):
1005 def outgoing(self, ui, dest, opts):
979 if 'rev' in opts or 'branch' in opts:
1006 if 'rev' in opts or 'branch' in opts:
980 opts = copy.copy(opts)
1007 opts = copy.copy(opts)
981 opts.pop('rev', None)
1008 opts.pop('rev', None)
982 opts.pop('branch', None)
1009 opts.pop('branch', None)
983 return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
1010 return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
984
1011
985 @annotatesubrepoerror
1012 @annotatesubrepoerror
986 def incoming(self, ui, source, opts):
1013 def incoming(self, ui, source, opts):
987 if 'rev' in opts or 'branch' in opts:
1014 if 'rev' in opts or 'branch' in opts:
988 opts = copy.copy(opts)
1015 opts = copy.copy(opts)
989 opts.pop('rev', None)
1016 opts.pop('rev', None)
990 opts.pop('branch', None)
1017 opts.pop('branch', None)
991 return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
1018 return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
992
1019
993 @annotatesubrepoerror
1020 @annotatesubrepoerror
994 def files(self):
1021 def files(self):
995 rev = self._state[1]
1022 rev = self._state[1]
996 ctx = self._repo[rev]
1023 ctx = self._repo[rev]
997 return ctx.manifest().keys()
1024 return ctx.manifest().keys()
998
1025
999 def filedata(self, name, decode):
1026 def filedata(self, name, decode):
1000 rev = self._state[1]
1027 rev = self._state[1]
1001 data = self._repo[rev][name].data()
1028 data = self._repo[rev][name].data()
1002 if decode:
1029 if decode:
1003 data = self._repo.wwritedata(name, data)
1030 data = self._repo.wwritedata(name, data)
1004 return data
1031 return data
1005
1032
1006 def fileflags(self, name):
1033 def fileflags(self, name):
1007 rev = self._state[1]
1034 rev = self._state[1]
1008 ctx = self._repo[rev]
1035 ctx = self._repo[rev]
1009 return ctx.flags(name)
1036 return ctx.flags(name)
1010
1037
1011 @annotatesubrepoerror
1038 @annotatesubrepoerror
1012 def printfiles(self, ui, m, fm, fmt, subrepos):
1039 def printfiles(self, ui, m, fm, fmt, subrepos):
1013 # If the parent context is a workingctx, use the workingctx here for
1040 # If the parent context is a workingctx, use the workingctx here for
1014 # consistency.
1041 # consistency.
1015 if self._ctx.rev() is None:
1042 if self._ctx.rev() is None:
1016 ctx = self._repo[None]
1043 ctx = self._repo[None]
1017 else:
1044 else:
1018 rev = self._state[1]
1045 rev = self._state[1]
1019 ctx = self._repo[rev]
1046 ctx = self._repo[rev]
1020 return cmdutil.files(ui, ctx, m, fm, fmt, subrepos)
1047 return cmdutil.files(ui, ctx, m, fm, fmt, subrepos)
1021
1048
1022 @annotatesubrepoerror
1049 @annotatesubrepoerror
1023 def getfileset(self, expr):
1050 def getfileset(self, expr):
1024 if self._ctx.rev() is None:
1051 if self._ctx.rev() is None:
1025 ctx = self._repo[None]
1052 ctx = self._repo[None]
1026 else:
1053 else:
1027 rev = self._state[1]
1054 rev = self._state[1]
1028 ctx = self._repo[rev]
1055 ctx = self._repo[rev]
1029
1056
1030 files = ctx.getfileset(expr)
1057 files = ctx.getfileset(expr)
1031
1058
1032 for subpath in ctx.substate:
1059 for subpath in ctx.substate:
1033 sub = ctx.sub(subpath)
1060 sub = ctx.sub(subpath)
1034
1061
1035 try:
1062 try:
1036 files.extend(subpath + '/' + f for f in sub.getfileset(expr))
1063 files.extend(subpath + '/' + f for f in sub.getfileset(expr))
1037 except error.LookupError:
1064 except error.LookupError:
1038 self.ui.status(_("skipping missing subrepository: %s\n")
1065 self.ui.status(_("skipping missing subrepository: %s\n")
1039 % self.wvfs.reljoin(reporelpath(self), subpath))
1066 % self.wvfs.reljoin(reporelpath(self), subpath))
1040 return files
1067 return files
1041
1068
1042 def walk(self, match):
1069 def walk(self, match):
1043 ctx = self._repo[None]
1070 ctx = self._repo[None]
1044 return ctx.walk(match)
1071 return ctx.walk(match)
1045
1072
1046 @annotatesubrepoerror
1073 @annotatesubrepoerror
1047 def forget(self, match, prefix):
1074 def forget(self, match, prefix):
1048 return cmdutil.forget(self.ui, self._repo, match,
1075 return cmdutil.forget(self.ui, self._repo, match,
1049 self.wvfs.reljoin(prefix, self._path), True)
1076 self.wvfs.reljoin(prefix, self._path), True)
1050
1077
1051 @annotatesubrepoerror
1078 @annotatesubrepoerror
1052 def removefiles(self, matcher, prefix, after, force, subrepos, warnings):
1079 def removefiles(self, matcher, prefix, after, force, subrepos, warnings):
1053 return cmdutil.remove(self.ui, self._repo, matcher,
1080 return cmdutil.remove(self.ui, self._repo, matcher,
1054 self.wvfs.reljoin(prefix, self._path),
1081 self.wvfs.reljoin(prefix, self._path),
1055 after, force, subrepos)
1082 after, force, subrepos)
1056
1083
1057 @annotatesubrepoerror
1084 @annotatesubrepoerror
1058 def revert(self, substate, *pats, **opts):
1085 def revert(self, substate, *pats, **opts):
1059 # reverting a subrepo is a 2 step process:
1086 # reverting a subrepo is a 2 step process:
1060 # 1. if the no_backup is not set, revert all modified
1087 # 1. if the no_backup is not set, revert all modified
1061 # files inside the subrepo
1088 # files inside the subrepo
1062 # 2. update the subrepo to the revision specified in
1089 # 2. update the subrepo to the revision specified in
1063 # the corresponding substate dictionary
1090 # the corresponding substate dictionary
1064 self.ui.status(_('reverting subrepo %s\n') % substate[0])
1091 self.ui.status(_('reverting subrepo %s\n') % substate[0])
1065 if not opts.get('no_backup'):
1092 if not opts.get('no_backup'):
1066 # Revert all files on the subrepo, creating backups
1093 # Revert all files on the subrepo, creating backups
1067 # Note that this will not recursively revert subrepos
1094 # Note that this will not recursively revert subrepos
1068 # We could do it if there was a set:subrepos() predicate
1095 # We could do it if there was a set:subrepos() predicate
1069 opts = opts.copy()
1096 opts = opts.copy()
1070 opts['date'] = None
1097 opts['date'] = None
1071 opts['rev'] = substate[1]
1098 opts['rev'] = substate[1]
1072
1099
1073 self.filerevert(*pats, **opts)
1100 self.filerevert(*pats, **opts)
1074
1101
1075 # Update the repo to the revision specified in the given substate
1102 # Update the repo to the revision specified in the given substate
1076 if not opts.get('dry_run'):
1103 if not opts.get('dry_run'):
1077 self.get(substate, overwrite=True)
1104 self.get(substate, overwrite=True)
1078
1105
1079 def filerevert(self, *pats, **opts):
1106 def filerevert(self, *pats, **opts):
1080 ctx = self._repo[opts['rev']]
1107 ctx = self._repo[opts['rev']]
1081 parents = self._repo.dirstate.parents()
1108 parents = self._repo.dirstate.parents()
1082 if opts.get('all'):
1109 if opts.get('all'):
1083 pats = ['set:modified()']
1110 pats = ['set:modified()']
1084 else:
1111 else:
1085 pats = []
1112 pats = []
1086 cmdutil.revert(self.ui, self._repo, ctx, parents, *pats, **opts)
1113 cmdutil.revert(self.ui, self._repo, ctx, parents, *pats, **opts)
1087
1114
1088 def shortid(self, revid):
1115 def shortid(self, revid):
1089 return revid[:12]
1116 return revid[:12]
1090
1117
1091 @annotatesubrepoerror
1118 @annotatesubrepoerror
1092 def unshare(self):
1119 def unshare(self):
1093 # subrepo inherently violates our import layering rules
1120 # subrepo inherently violates our import layering rules
1094 # because it wants to make repo objects from deep inside the stack
1121 # because it wants to make repo objects from deep inside the stack
1095 # so we manually delay the circular imports to not break
1122 # so we manually delay the circular imports to not break
1096 # scripts that don't use our demand-loading
1123 # scripts that don't use our demand-loading
1097 global hg
1124 global hg
1098 from . import hg as h
1125 from . import hg as h
1099 hg = h
1126 hg = h
1100
1127
1101 # Nothing prevents a user from sharing in a repo, and then making that a
1128 # Nothing prevents a user from sharing in a repo, and then making that a
1102 # subrepo. Alternately, the previous unshare attempt may have failed
1129 # subrepo. Alternately, the previous unshare attempt may have failed
1103 # part way through. So recurse whether or not this layer is shared.
1130 # part way through. So recurse whether or not this layer is shared.
1104 if self._repo.shared():
1131 if self._repo.shared():
1105 self.ui.status(_("unsharing subrepo '%s'\n") % self._relpath)
1132 self.ui.status(_("unsharing subrepo '%s'\n") % self._relpath)
1106
1133
1107 hg.unshare(self.ui, self._repo)
1134 hg.unshare(self.ui, self._repo)
1108
1135
1109 def verify(self):
1136 def verify(self):
1110 try:
1137 try:
1111 rev = self._state[1]
1138 rev = self._state[1]
1112 ctx = self._repo.unfiltered()[rev]
1139 ctx = self._repo.unfiltered()[rev]
1113 if ctx.hidden():
1140 if ctx.hidden():
1114 # Since hidden revisions aren't pushed/pulled, it seems worth an
1141 # Since hidden revisions aren't pushed/pulled, it seems worth an
1115 # explicit warning.
1142 # explicit warning.
1116 ui = self._repo.ui
1143 ui = self._repo.ui
1117 ui.warn(_("subrepo '%s' is hidden in revision %s\n") %
1144 ui.warn(_("subrepo '%s' is hidden in revision %s\n") %
1118 (self._relpath, node.short(self._ctx.node())))
1145 (self._relpath, node.short(self._ctx.node())))
1119 return 0
1146 return 0
1120 except error.RepoLookupError:
1147 except error.RepoLookupError:
1121 # A missing subrepo revision may be a case of needing to pull it, so
1148 # A missing subrepo revision may be a case of needing to pull it, so
1122 # don't treat this as an error.
1149 # don't treat this as an error.
1123 self._repo.ui.warn(_("subrepo '%s' not found in revision %s\n") %
1150 self._repo.ui.warn(_("subrepo '%s' not found in revision %s\n") %
1124 (self._relpath, node.short(self._ctx.node())))
1151 (self._relpath, node.short(self._ctx.node())))
1125 return 0
1152 return 0
1126
1153
1127 @propertycache
1154 @propertycache
1128 def wvfs(self):
1155 def wvfs(self):
1129 """return own wvfs for efficiency and consistency
1156 """return own wvfs for efficiency and consistency
1130 """
1157 """
1131 return self._repo.wvfs
1158 return self._repo.wvfs
1132
1159
1133 @propertycache
1160 @propertycache
1134 def _relpath(self):
1161 def _relpath(self):
1135 """return path to this subrepository as seen from outermost repository
1162 """return path to this subrepository as seen from outermost repository
1136 """
1163 """
1137 # Keep consistent dir separators by avoiding vfs.join(self._path)
1164 # Keep consistent dir separators by avoiding vfs.join(self._path)
1138 return reporelpath(self._repo)
1165 return reporelpath(self._repo)
1139
1166
1140 class svnsubrepo(abstractsubrepo):
1167 class svnsubrepo(abstractsubrepo):
1141 def __init__(self, ctx, path, state, allowcreate):
1168 def __init__(self, ctx, path, state, allowcreate):
1142 super(svnsubrepo, self).__init__(ctx, path)
1169 super(svnsubrepo, self).__init__(ctx, path)
1143 self._state = state
1170 self._state = state
1144 self._exe = util.findexe('svn')
1171 self._exe = util.findexe('svn')
1145 if not self._exe:
1172 if not self._exe:
1146 raise error.Abort(_("'svn' executable not found for subrepo '%s'")
1173 raise error.Abort(_("'svn' executable not found for subrepo '%s'")
1147 % self._path)
1174 % self._path)
1148
1175
1149 def _svncommand(self, commands, filename='', failok=False):
1176 def _svncommand(self, commands, filename='', failok=False):
1150 cmd = [self._exe]
1177 cmd = [self._exe]
1151 extrakw = {}
1178 extrakw = {}
1152 if not self.ui.interactive():
1179 if not self.ui.interactive():
1153 # Making stdin be a pipe should prevent svn from behaving
1180 # Making stdin be a pipe should prevent svn from behaving
1154 # interactively even if we can't pass --non-interactive.
1181 # interactively even if we can't pass --non-interactive.
1155 extrakw['stdin'] = subprocess.PIPE
1182 extrakw['stdin'] = subprocess.PIPE
1156 # Starting in svn 1.5 --non-interactive is a global flag
1183 # Starting in svn 1.5 --non-interactive is a global flag
1157 # instead of being per-command, but we need to support 1.4 so
1184 # instead of being per-command, but we need to support 1.4 so
1158 # we have to be intelligent about what commands take
1185 # we have to be intelligent about what commands take
1159 # --non-interactive.
1186 # --non-interactive.
1160 if commands[0] in ('update', 'checkout', 'commit'):
1187 if commands[0] in ('update', 'checkout', 'commit'):
1161 cmd.append('--non-interactive')
1188 cmd.append('--non-interactive')
1162 cmd.extend(commands)
1189 cmd.extend(commands)
1163 if filename is not None:
1190 if filename is not None:
1164 path = self.wvfs.reljoin(self._ctx.repo().origroot,
1191 path = self.wvfs.reljoin(self._ctx.repo().origroot,
1165 self._path, filename)
1192 self._path, filename)
1166 cmd.append(path)
1193 cmd.append(path)
1167 env = dict(encoding.environ)
1194 env = dict(encoding.environ)
1168 # Avoid localized output, preserve current locale for everything else.
1195 # Avoid localized output, preserve current locale for everything else.
1169 lc_all = env.get('LC_ALL')
1196 lc_all = env.get('LC_ALL')
1170 if lc_all:
1197 if lc_all:
1171 env['LANG'] = lc_all
1198 env['LANG'] = lc_all
1172 del env['LC_ALL']
1199 del env['LC_ALL']
1173 env['LC_MESSAGES'] = 'C'
1200 env['LC_MESSAGES'] = 'C'
1174 p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds,
1201 p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds,
1175 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
1202 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
1176 universal_newlines=True, env=env, **extrakw)
1203 universal_newlines=True, env=env, **extrakw)
1177 stdout, stderr = p.communicate()
1204 stdout, stderr = p.communicate()
1178 stderr = stderr.strip()
1205 stderr = stderr.strip()
1179 if not failok:
1206 if not failok:
1180 if p.returncode:
1207 if p.returncode:
1181 raise error.Abort(stderr or 'exited with code %d'
1208 raise error.Abort(stderr or 'exited with code %d'
1182 % p.returncode)
1209 % p.returncode)
1183 if stderr:
1210 if stderr:
1184 self.ui.warn(stderr + '\n')
1211 self.ui.warn(stderr + '\n')
1185 return stdout, stderr
1212 return stdout, stderr
1186
1213
1187 @propertycache
1214 @propertycache
1188 def _svnversion(self):
1215 def _svnversion(self):
1189 output, err = self._svncommand(['--version', '--quiet'], filename=None)
1216 output, err = self._svncommand(['--version', '--quiet'], filename=None)
1190 m = re.search(br'^(\d+)\.(\d+)', output)
1217 m = re.search(br'^(\d+)\.(\d+)', output)
1191 if not m:
1218 if not m:
1192 raise error.Abort(_('cannot retrieve svn tool version'))
1219 raise error.Abort(_('cannot retrieve svn tool version'))
1193 return (int(m.group(1)), int(m.group(2)))
1220 return (int(m.group(1)), int(m.group(2)))
1194
1221
1195 def _wcrevs(self):
1222 def _wcrevs(self):
1196 # Get the working directory revision as well as the last
1223 # Get the working directory revision as well as the last
1197 # commit revision so we can compare the subrepo state with
1224 # commit revision so we can compare the subrepo state with
1198 # both. We used to store the working directory one.
1225 # both. We used to store the working directory one.
1199 output, err = self._svncommand(['info', '--xml'])
1226 output, err = self._svncommand(['info', '--xml'])
1200 doc = xml.dom.minidom.parseString(output)
1227 doc = xml.dom.minidom.parseString(output)
1201 entries = doc.getElementsByTagName('entry')
1228 entries = doc.getElementsByTagName('entry')
1202 lastrev, rev = '0', '0'
1229 lastrev, rev = '0', '0'
1203 if entries:
1230 if entries:
1204 rev = str(entries[0].getAttribute('revision')) or '0'
1231 rev = str(entries[0].getAttribute('revision')) or '0'
1205 commits = entries[0].getElementsByTagName('commit')
1232 commits = entries[0].getElementsByTagName('commit')
1206 if commits:
1233 if commits:
1207 lastrev = str(commits[0].getAttribute('revision')) or '0'
1234 lastrev = str(commits[0].getAttribute('revision')) or '0'
1208 return (lastrev, rev)
1235 return (lastrev, rev)
1209
1236
1210 def _wcrev(self):
1237 def _wcrev(self):
1211 return self._wcrevs()[0]
1238 return self._wcrevs()[0]
1212
1239
1213 def _wcchanged(self):
1240 def _wcchanged(self):
1214 """Return (changes, extchanges, missing) where changes is True
1241 """Return (changes, extchanges, missing) where changes is True
1215 if the working directory was changed, extchanges is
1242 if the working directory was changed, extchanges is
1216 True if any of these changes concern an external entry and missing
1243 True if any of these changes concern an external entry and missing
1217 is True if any change is a missing entry.
1244 is True if any change is a missing entry.
1218 """
1245 """
1219 output, err = self._svncommand(['status', '--xml'])
1246 output, err = self._svncommand(['status', '--xml'])
1220 externals, changes, missing = [], [], []
1247 externals, changes, missing = [], [], []
1221 doc = xml.dom.minidom.parseString(output)
1248 doc = xml.dom.minidom.parseString(output)
1222 for e in doc.getElementsByTagName('entry'):
1249 for e in doc.getElementsByTagName('entry'):
1223 s = e.getElementsByTagName('wc-status')
1250 s = e.getElementsByTagName('wc-status')
1224 if not s:
1251 if not s:
1225 continue
1252 continue
1226 item = s[0].getAttribute('item')
1253 item = s[0].getAttribute('item')
1227 props = s[0].getAttribute('props')
1254 props = s[0].getAttribute('props')
1228 path = e.getAttribute('path')
1255 path = e.getAttribute('path')
1229 if item == 'external':
1256 if item == 'external':
1230 externals.append(path)
1257 externals.append(path)
1231 elif item == 'missing':
1258 elif item == 'missing':
1232 missing.append(path)
1259 missing.append(path)
1233 if (item not in ('', 'normal', 'unversioned', 'external')
1260 if (item not in ('', 'normal', 'unversioned', 'external')
1234 or props not in ('', 'none', 'normal')):
1261 or props not in ('', 'none', 'normal')):
1235 changes.append(path)
1262 changes.append(path)
1236 for path in changes:
1263 for path in changes:
1237 for ext in externals:
1264 for ext in externals:
1238 if path == ext or path.startswith(ext + pycompat.ossep):
1265 if path == ext or path.startswith(ext + pycompat.ossep):
1239 return True, True, bool(missing)
1266 return True, True, bool(missing)
1240 return bool(changes), False, bool(missing)
1267 return bool(changes), False, bool(missing)
1241
1268
1242 def dirty(self, ignoreupdate=False, missing=False):
1269 def dirty(self, ignoreupdate=False, missing=False):
1243 wcchanged = self._wcchanged()
1270 wcchanged = self._wcchanged()
1244 changed = wcchanged[0] or (missing and wcchanged[2])
1271 changed = wcchanged[0] or (missing and wcchanged[2])
1245 if not changed:
1272 if not changed:
1246 if self._state[1] in self._wcrevs() or ignoreupdate:
1273 if self._state[1] in self._wcrevs() or ignoreupdate:
1247 return False
1274 return False
1248 return True
1275 return True
1249
1276
1250 def basestate(self):
1277 def basestate(self):
1251 lastrev, rev = self._wcrevs()
1278 lastrev, rev = self._wcrevs()
1252 if lastrev != rev:
1279 if lastrev != rev:
1253 # Last committed rev is not the same than rev. We would
1280 # Last committed rev is not the same than rev. We would
1254 # like to take lastrev but we do not know if the subrepo
1281 # like to take lastrev but we do not know if the subrepo
1255 # URL exists at lastrev. Test it and fallback to rev it
1282 # URL exists at lastrev. Test it and fallback to rev it
1256 # is not there.
1283 # is not there.
1257 try:
1284 try:
1258 self._svncommand(['list', '%s@%s' % (self._state[0], lastrev)])
1285 self._svncommand(['list', '%s@%s' % (self._state[0], lastrev)])
1259 return lastrev
1286 return lastrev
1260 except error.Abort:
1287 except error.Abort:
1261 pass
1288 pass
1262 return rev
1289 return rev
1263
1290
1264 @annotatesubrepoerror
1291 @annotatesubrepoerror
1265 def commit(self, text, user, date):
1292 def commit(self, text, user, date):
1266 # user and date are out of our hands since svn is centralized
1293 # user and date are out of our hands since svn is centralized
1267 changed, extchanged, missing = self._wcchanged()
1294 changed, extchanged, missing = self._wcchanged()
1268 if not changed:
1295 if not changed:
1269 return self.basestate()
1296 return self.basestate()
1270 if extchanged:
1297 if extchanged:
1271 # Do not try to commit externals
1298 # Do not try to commit externals
1272 raise error.Abort(_('cannot commit svn externals'))
1299 raise error.Abort(_('cannot commit svn externals'))
1273 if missing:
1300 if missing:
1274 # svn can commit with missing entries but aborting like hg
1301 # svn can commit with missing entries but aborting like hg
1275 # seems a better approach.
1302 # seems a better approach.
1276 raise error.Abort(_('cannot commit missing svn entries'))
1303 raise error.Abort(_('cannot commit missing svn entries'))
1277 commitinfo, err = self._svncommand(['commit', '-m', text])
1304 commitinfo, err = self._svncommand(['commit', '-m', text])
1278 self.ui.status(commitinfo)
1305 self.ui.status(commitinfo)
1279 newrev = re.search('Committed revision ([0-9]+).', commitinfo)
1306 newrev = re.search('Committed revision ([0-9]+).', commitinfo)
1280 if not newrev:
1307 if not newrev:
1281 if not commitinfo.strip():
1308 if not commitinfo.strip():
1282 # Sometimes, our definition of "changed" differs from
1309 # Sometimes, our definition of "changed" differs from
1283 # svn one. For instance, svn ignores missing files
1310 # svn one. For instance, svn ignores missing files
1284 # when committing. If there are only missing files, no
1311 # when committing. If there are only missing files, no
1285 # commit is made, no output and no error code.
1312 # commit is made, no output and no error code.
1286 raise error.Abort(_('failed to commit svn changes'))
1313 raise error.Abort(_('failed to commit svn changes'))
1287 raise error.Abort(commitinfo.splitlines()[-1])
1314 raise error.Abort(commitinfo.splitlines()[-1])
1288 newrev = newrev.groups()[0]
1315 newrev = newrev.groups()[0]
1289 self.ui.status(self._svncommand(['update', '-r', newrev])[0])
1316 self.ui.status(self._svncommand(['update', '-r', newrev])[0])
1290 return newrev
1317 return newrev
1291
1318
1292 @annotatesubrepoerror
1319 @annotatesubrepoerror
1293 def remove(self):
1320 def remove(self):
1294 if self.dirty():
1321 if self.dirty():
1295 self.ui.warn(_('not removing repo %s because '
1322 self.ui.warn(_('not removing repo %s because '
1296 'it has changes.\n') % self._path)
1323 'it has changes.\n') % self._path)
1297 return
1324 return
1298 self.ui.note(_('removing subrepo %s\n') % self._path)
1325 self.ui.note(_('removing subrepo %s\n') % self._path)
1299
1326
1300 self.wvfs.rmtree(forcibly=True)
1327 self.wvfs.rmtree(forcibly=True)
1301 try:
1328 try:
1302 pwvfs = self._ctx.repo().wvfs
1329 pwvfs = self._ctx.repo().wvfs
1303 pwvfs.removedirs(pwvfs.dirname(self._path))
1330 pwvfs.removedirs(pwvfs.dirname(self._path))
1304 except OSError:
1331 except OSError:
1305 pass
1332 pass
1306
1333
1307 @annotatesubrepoerror
1334 @annotatesubrepoerror
1308 def get(self, state, overwrite=False):
1335 def get(self, state, overwrite=False):
1309 if overwrite:
1336 if overwrite:
1310 self._svncommand(['revert', '--recursive'])
1337 self._svncommand(['revert', '--recursive'])
1311 args = ['checkout']
1338 args = ['checkout']
1312 if self._svnversion >= (1, 5):
1339 if self._svnversion >= (1, 5):
1313 args.append('--force')
1340 args.append('--force')
1314 # The revision must be specified at the end of the URL to properly
1341 # The revision must be specified at the end of the URL to properly
1315 # update to a directory which has since been deleted and recreated.
1342 # update to a directory which has since been deleted and recreated.
1316 args.append('%s@%s' % (state[0], state[1]))
1343 args.append('%s@%s' % (state[0], state[1]))
1317
1344
1318 # SEC: check that the ssh url is safe
1345 # SEC: check that the ssh url is safe
1319 util.checksafessh(state[0])
1346 util.checksafessh(state[0])
1320
1347
1321 status, err = self._svncommand(args, failok=True)
1348 status, err = self._svncommand(args, failok=True)
1322 _sanitize(self.ui, self.wvfs, '.svn')
1349 _sanitize(self.ui, self.wvfs, '.svn')
1323 if not re.search('Checked out revision [0-9]+.', status):
1350 if not re.search('Checked out revision [0-9]+.', status):
1324 if ('is already a working copy for a different URL' in err
1351 if ('is already a working copy for a different URL' in err
1325 and (self._wcchanged()[:2] == (False, False))):
1352 and (self._wcchanged()[:2] == (False, False))):
1326 # obstructed but clean working copy, so just blow it away.
1353 # obstructed but clean working copy, so just blow it away.
1327 self.remove()
1354 self.remove()
1328 self.get(state, overwrite=False)
1355 self.get(state, overwrite=False)
1329 return
1356 return
1330 raise error.Abort((status or err).splitlines()[-1])
1357 raise error.Abort((status or err).splitlines()[-1])
1331 self.ui.status(status)
1358 self.ui.status(status)
1332
1359
1333 @annotatesubrepoerror
1360 @annotatesubrepoerror
1334 def merge(self, state):
1361 def merge(self, state):
1335 old = self._state[1]
1362 old = self._state[1]
1336 new = state[1]
1363 new = state[1]
1337 wcrev = self._wcrev()
1364 wcrev = self._wcrev()
1338 if new != wcrev:
1365 if new != wcrev:
1339 dirty = old == wcrev or self._wcchanged()[0]
1366 dirty = old == wcrev or self._wcchanged()[0]
1340 if _updateprompt(self.ui, self, dirty, wcrev, new):
1367 if _updateprompt(self.ui, self, dirty, wcrev, new):
1341 self.get(state, False)
1368 self.get(state, False)
1342
1369
1343 def push(self, opts):
1370 def push(self, opts):
1344 # push is a no-op for SVN
1371 # push is a no-op for SVN
1345 return True
1372 return True
1346
1373
1347 @annotatesubrepoerror
1374 @annotatesubrepoerror
1348 def files(self):
1375 def files(self):
1349 output = self._svncommand(['list', '--recursive', '--xml'])[0]
1376 output = self._svncommand(['list', '--recursive', '--xml'])[0]
1350 doc = xml.dom.minidom.parseString(output)
1377 doc = xml.dom.minidom.parseString(output)
1351 paths = []
1378 paths = []
1352 for e in doc.getElementsByTagName('entry'):
1379 for e in doc.getElementsByTagName('entry'):
1353 kind = str(e.getAttribute('kind'))
1380 kind = str(e.getAttribute('kind'))
1354 if kind != 'file':
1381 if kind != 'file':
1355 continue
1382 continue
1356 name = ''.join(c.data for c
1383 name = ''.join(c.data for c
1357 in e.getElementsByTagName('name')[0].childNodes
1384 in e.getElementsByTagName('name')[0].childNodes
1358 if c.nodeType == c.TEXT_NODE)
1385 if c.nodeType == c.TEXT_NODE)
1359 paths.append(name.encode('utf-8'))
1386 paths.append(name.encode('utf-8'))
1360 return paths
1387 return paths
1361
1388
1362 def filedata(self, name, decode):
1389 def filedata(self, name, decode):
1363 return self._svncommand(['cat'], name)[0]
1390 return self._svncommand(['cat'], name)[0]
1364
1391
1365
1392
1366 class gitsubrepo(abstractsubrepo):
1393 class gitsubrepo(abstractsubrepo):
1367 def __init__(self, ctx, path, state, allowcreate):
1394 def __init__(self, ctx, path, state, allowcreate):
1368 super(gitsubrepo, self).__init__(ctx, path)
1395 super(gitsubrepo, self).__init__(ctx, path)
1369 self._state = state
1396 self._state = state
1370 self._abspath = ctx.repo().wjoin(path)
1397 self._abspath = ctx.repo().wjoin(path)
1371 self._subparent = ctx.repo()
1398 self._subparent = ctx.repo()
1372 self._ensuregit()
1399 self._ensuregit()
1373
1400
1374 def _ensuregit(self):
1401 def _ensuregit(self):
1375 try:
1402 try:
1376 self._gitexecutable = 'git'
1403 self._gitexecutable = 'git'
1377 out, err = self._gitnodir(['--version'])
1404 out, err = self._gitnodir(['--version'])
1378 except OSError as e:
1405 except OSError as e:
1379 genericerror = _("error executing git for subrepo '%s': %s")
1406 genericerror = _("error executing git for subrepo '%s': %s")
1380 notfoundhint = _("check git is installed and in your PATH")
1407 notfoundhint = _("check git is installed and in your PATH")
1381 if e.errno != errno.ENOENT:
1408 if e.errno != errno.ENOENT:
1382 raise error.Abort(genericerror % (
1409 raise error.Abort(genericerror % (
1383 self._path, encoding.strtolocal(e.strerror)))
1410 self._path, encoding.strtolocal(e.strerror)))
1384 elif pycompat.iswindows:
1411 elif pycompat.iswindows:
1385 try:
1412 try:
1386 self._gitexecutable = 'git.cmd'
1413 self._gitexecutable = 'git.cmd'
1387 out, err = self._gitnodir(['--version'])
1414 out, err = self._gitnodir(['--version'])
1388 except OSError as e2:
1415 except OSError as e2:
1389 if e2.errno == errno.ENOENT:
1416 if e2.errno == errno.ENOENT:
1390 raise error.Abort(_("couldn't find 'git' or 'git.cmd'"
1417 raise error.Abort(_("couldn't find 'git' or 'git.cmd'"
1391 " for subrepo '%s'") % self._path,
1418 " for subrepo '%s'") % self._path,
1392 hint=notfoundhint)
1419 hint=notfoundhint)
1393 else:
1420 else:
1394 raise error.Abort(genericerror % (self._path,
1421 raise error.Abort(genericerror % (self._path,
1395 encoding.strtolocal(e2.strerror)))
1422 encoding.strtolocal(e2.strerror)))
1396 else:
1423 else:
1397 raise error.Abort(_("couldn't find git for subrepo '%s'")
1424 raise error.Abort(_("couldn't find git for subrepo '%s'")
1398 % self._path, hint=notfoundhint)
1425 % self._path, hint=notfoundhint)
1399 versionstatus = self._checkversion(out)
1426 versionstatus = self._checkversion(out)
1400 if versionstatus == 'unknown':
1427 if versionstatus == 'unknown':
1401 self.ui.warn(_('cannot retrieve git version\n'))
1428 self.ui.warn(_('cannot retrieve git version\n'))
1402 elif versionstatus == 'abort':
1429 elif versionstatus == 'abort':
1403 raise error.Abort(_('git subrepo requires at least 1.6.0 or later'))
1430 raise error.Abort(_('git subrepo requires at least 1.6.0 or later'))
1404 elif versionstatus == 'warning':
1431 elif versionstatus == 'warning':
1405 self.ui.warn(_('git subrepo requires at least 1.6.0 or later\n'))
1432 self.ui.warn(_('git subrepo requires at least 1.6.0 or later\n'))
1406
1433
1407 @staticmethod
1434 @staticmethod
1408 def _gitversion(out):
1435 def _gitversion(out):
1409 m = re.search(br'^git version (\d+)\.(\d+)\.(\d+)', out)
1436 m = re.search(br'^git version (\d+)\.(\d+)\.(\d+)', out)
1410 if m:
1437 if m:
1411 return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
1438 return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
1412
1439
1413 m = re.search(br'^git version (\d+)\.(\d+)', out)
1440 m = re.search(br'^git version (\d+)\.(\d+)', out)
1414 if m:
1441 if m:
1415 return (int(m.group(1)), int(m.group(2)), 0)
1442 return (int(m.group(1)), int(m.group(2)), 0)
1416
1443
1417 return -1
1444 return -1
1418
1445
1419 @staticmethod
1446 @staticmethod
1420 def _checkversion(out):
1447 def _checkversion(out):
1421 '''ensure git version is new enough
1448 '''ensure git version is new enough
1422
1449
1423 >>> _checkversion = gitsubrepo._checkversion
1450 >>> _checkversion = gitsubrepo._checkversion
1424 >>> _checkversion(b'git version 1.6.0')
1451 >>> _checkversion(b'git version 1.6.0')
1425 'ok'
1452 'ok'
1426 >>> _checkversion(b'git version 1.8.5')
1453 >>> _checkversion(b'git version 1.8.5')
1427 'ok'
1454 'ok'
1428 >>> _checkversion(b'git version 1.4.0')
1455 >>> _checkversion(b'git version 1.4.0')
1429 'abort'
1456 'abort'
1430 >>> _checkversion(b'git version 1.5.0')
1457 >>> _checkversion(b'git version 1.5.0')
1431 'warning'
1458 'warning'
1432 >>> _checkversion(b'git version 1.9-rc0')
1459 >>> _checkversion(b'git version 1.9-rc0')
1433 'ok'
1460 'ok'
1434 >>> _checkversion(b'git version 1.9.0.265.g81cdec2')
1461 >>> _checkversion(b'git version 1.9.0.265.g81cdec2')
1435 'ok'
1462 'ok'
1436 >>> _checkversion(b'git version 1.9.0.GIT')
1463 >>> _checkversion(b'git version 1.9.0.GIT')
1437 'ok'
1464 'ok'
1438 >>> _checkversion(b'git version 12345')
1465 >>> _checkversion(b'git version 12345')
1439 'unknown'
1466 'unknown'
1440 >>> _checkversion(b'no')
1467 >>> _checkversion(b'no')
1441 'unknown'
1468 'unknown'
1442 '''
1469 '''
1443 version = gitsubrepo._gitversion(out)
1470 version = gitsubrepo._gitversion(out)
1444 # git 1.4.0 can't work at all, but 1.5.X can in at least some cases,
1471 # git 1.4.0 can't work at all, but 1.5.X can in at least some cases,
1445 # despite the docstring comment. For now, error on 1.4.0, warn on
1472 # despite the docstring comment. For now, error on 1.4.0, warn on
1446 # 1.5.0 but attempt to continue.
1473 # 1.5.0 but attempt to continue.
1447 if version == -1:
1474 if version == -1:
1448 return 'unknown'
1475 return 'unknown'
1449 if version < (1, 5, 0):
1476 if version < (1, 5, 0):
1450 return 'abort'
1477 return 'abort'
1451 elif version < (1, 6, 0):
1478 elif version < (1, 6, 0):
1452 return 'warning'
1479 return 'warning'
1453 return 'ok'
1480 return 'ok'
1454
1481
1455 def _gitcommand(self, commands, env=None, stream=False):
1482 def _gitcommand(self, commands, env=None, stream=False):
1456 return self._gitdir(commands, env=env, stream=stream)[0]
1483 return self._gitdir(commands, env=env, stream=stream)[0]
1457
1484
1458 def _gitdir(self, commands, env=None, stream=False):
1485 def _gitdir(self, commands, env=None, stream=False):
1459 return self._gitnodir(commands, env=env, stream=stream,
1486 return self._gitnodir(commands, env=env, stream=stream,
1460 cwd=self._abspath)
1487 cwd=self._abspath)
1461
1488
1462 def _gitnodir(self, commands, env=None, stream=False, cwd=None):
1489 def _gitnodir(self, commands, env=None, stream=False, cwd=None):
1463 """Calls the git command
1490 """Calls the git command
1464
1491
1465 The methods tries to call the git command. versions prior to 1.6.0
1492 The methods tries to call the git command. versions prior to 1.6.0
1466 are not supported and very probably fail.
1493 are not supported and very probably fail.
1467 """
1494 """
1468 self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands)))
1495 self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands)))
1469 if env is None:
1496 if env is None:
1470 env = encoding.environ.copy()
1497 env = encoding.environ.copy()
1471 # disable localization for Git output (issue5176)
1498 # disable localization for Git output (issue5176)
1472 env['LC_ALL'] = 'C'
1499 env['LC_ALL'] = 'C'
1473 # fix for Git CVE-2015-7545
1500 # fix for Git CVE-2015-7545
1474 if 'GIT_ALLOW_PROTOCOL' not in env:
1501 if 'GIT_ALLOW_PROTOCOL' not in env:
1475 env['GIT_ALLOW_PROTOCOL'] = 'file:git:http:https:ssh'
1502 env['GIT_ALLOW_PROTOCOL'] = 'file:git:http:https:ssh'
1476 # unless ui.quiet is set, print git's stderr,
1503 # unless ui.quiet is set, print git's stderr,
1477 # which is mostly progress and useful info
1504 # which is mostly progress and useful info
1478 errpipe = None
1505 errpipe = None
1479 if self.ui.quiet:
1506 if self.ui.quiet:
1480 errpipe = open(os.devnull, 'w')
1507 errpipe = open(os.devnull, 'w')
1481 if self.ui._colormode and len(commands) and commands[0] == "diff":
1508 if self.ui._colormode and len(commands) and commands[0] == "diff":
1482 # insert the argument in the front,
1509 # insert the argument in the front,
1483 # the end of git diff arguments is used for paths
1510 # the end of git diff arguments is used for paths
1484 commands.insert(1, '--color')
1511 commands.insert(1, '--color')
1485 p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1,
1512 p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1,
1486 cwd=cwd, env=env, close_fds=util.closefds,
1513 cwd=cwd, env=env, close_fds=util.closefds,
1487 stdout=subprocess.PIPE, stderr=errpipe)
1514 stdout=subprocess.PIPE, stderr=errpipe)
1488 if stream:
1515 if stream:
1489 return p.stdout, None
1516 return p.stdout, None
1490
1517
1491 retdata = p.stdout.read().strip()
1518 retdata = p.stdout.read().strip()
1492 # wait for the child to exit to avoid race condition.
1519 # wait for the child to exit to avoid race condition.
1493 p.wait()
1520 p.wait()
1494
1521
1495 if p.returncode != 0 and p.returncode != 1:
1522 if p.returncode != 0 and p.returncode != 1:
1496 # there are certain error codes that are ok
1523 # there are certain error codes that are ok
1497 command = commands[0]
1524 command = commands[0]
1498 if command in ('cat-file', 'symbolic-ref'):
1525 if command in ('cat-file', 'symbolic-ref'):
1499 return retdata, p.returncode
1526 return retdata, p.returncode
1500 # for all others, abort
1527 # for all others, abort
1501 raise error.Abort(_('git %s error %d in %s') %
1528 raise error.Abort(_('git %s error %d in %s') %
1502 (command, p.returncode, self._relpath))
1529 (command, p.returncode, self._relpath))
1503
1530
1504 return retdata, p.returncode
1531 return retdata, p.returncode
1505
1532
1506 def _gitmissing(self):
1533 def _gitmissing(self):
1507 return not self.wvfs.exists('.git')
1534 return not self.wvfs.exists('.git')
1508
1535
1509 def _gitstate(self):
1536 def _gitstate(self):
1510 return self._gitcommand(['rev-parse', 'HEAD'])
1537 return self._gitcommand(['rev-parse', 'HEAD'])
1511
1538
1512 def _gitcurrentbranch(self):
1539 def _gitcurrentbranch(self):
1513 current, err = self._gitdir(['symbolic-ref', 'HEAD', '--quiet'])
1540 current, err = self._gitdir(['symbolic-ref', 'HEAD', '--quiet'])
1514 if err:
1541 if err:
1515 current = None
1542 current = None
1516 return current
1543 return current
1517
1544
1518 def _gitremote(self, remote):
1545 def _gitremote(self, remote):
1519 out = self._gitcommand(['remote', 'show', '-n', remote])
1546 out = self._gitcommand(['remote', 'show', '-n', remote])
1520 line = out.split('\n')[1]
1547 line = out.split('\n')[1]
1521 i = line.index('URL: ') + len('URL: ')
1548 i = line.index('URL: ') + len('URL: ')
1522 return line[i:]
1549 return line[i:]
1523
1550
1524 def _githavelocally(self, revision):
1551 def _githavelocally(self, revision):
1525 out, code = self._gitdir(['cat-file', '-e', revision])
1552 out, code = self._gitdir(['cat-file', '-e', revision])
1526 return code == 0
1553 return code == 0
1527
1554
1528 def _gitisancestor(self, r1, r2):
1555 def _gitisancestor(self, r1, r2):
1529 base = self._gitcommand(['merge-base', r1, r2])
1556 base = self._gitcommand(['merge-base', r1, r2])
1530 return base == r1
1557 return base == r1
1531
1558
1532 def _gitisbare(self):
1559 def _gitisbare(self):
1533 return self._gitcommand(['config', '--bool', 'core.bare']) == 'true'
1560 return self._gitcommand(['config', '--bool', 'core.bare']) == 'true'
1534
1561
1535 def _gitupdatestat(self):
1562 def _gitupdatestat(self):
1536 """This must be run before git diff-index.
1563 """This must be run before git diff-index.
1537 diff-index only looks at changes to file stat;
1564 diff-index only looks at changes to file stat;
1538 this command looks at file contents and updates the stat."""
1565 this command looks at file contents and updates the stat."""
1539 self._gitcommand(['update-index', '-q', '--refresh'])
1566 self._gitcommand(['update-index', '-q', '--refresh'])
1540
1567
1541 def _gitbranchmap(self):
1568 def _gitbranchmap(self):
1542 '''returns 2 things:
1569 '''returns 2 things:
1543 a map from git branch to revision
1570 a map from git branch to revision
1544 a map from revision to branches'''
1571 a map from revision to branches'''
1545 branch2rev = {}
1572 branch2rev = {}
1546 rev2branch = {}
1573 rev2branch = {}
1547
1574
1548 out = self._gitcommand(['for-each-ref', '--format',
1575 out = self._gitcommand(['for-each-ref', '--format',
1549 '%(objectname) %(refname)'])
1576 '%(objectname) %(refname)'])
1550 for line in out.split('\n'):
1577 for line in out.split('\n'):
1551 revision, ref = line.split(' ')
1578 revision, ref = line.split(' ')
1552 if (not ref.startswith('refs/heads/') and
1579 if (not ref.startswith('refs/heads/') and
1553 not ref.startswith('refs/remotes/')):
1580 not ref.startswith('refs/remotes/')):
1554 continue
1581 continue
1555 if ref.startswith('refs/remotes/') and ref.endswith('/HEAD'):
1582 if ref.startswith('refs/remotes/') and ref.endswith('/HEAD'):
1556 continue # ignore remote/HEAD redirects
1583 continue # ignore remote/HEAD redirects
1557 branch2rev[ref] = revision
1584 branch2rev[ref] = revision
1558 rev2branch.setdefault(revision, []).append(ref)
1585 rev2branch.setdefault(revision, []).append(ref)
1559 return branch2rev, rev2branch
1586 return branch2rev, rev2branch
1560
1587
1561 def _gittracking(self, branches):
1588 def _gittracking(self, branches):
1562 'return map of remote branch to local tracking branch'
1589 'return map of remote branch to local tracking branch'
1563 # assumes no more than one local tracking branch for each remote
1590 # assumes no more than one local tracking branch for each remote
1564 tracking = {}
1591 tracking = {}
1565 for b in branches:
1592 for b in branches:
1566 if b.startswith('refs/remotes/'):
1593 if b.startswith('refs/remotes/'):
1567 continue
1594 continue
1568 bname = b.split('/', 2)[2]
1595 bname = b.split('/', 2)[2]
1569 remote = self._gitcommand(['config', 'branch.%s.remote' % bname])
1596 remote = self._gitcommand(['config', 'branch.%s.remote' % bname])
1570 if remote:
1597 if remote:
1571 ref = self._gitcommand(['config', 'branch.%s.merge' % bname])
1598 ref = self._gitcommand(['config', 'branch.%s.merge' % bname])
1572 tracking['refs/remotes/%s/%s' %
1599 tracking['refs/remotes/%s/%s' %
1573 (remote, ref.split('/', 2)[2])] = b
1600 (remote, ref.split('/', 2)[2])] = b
1574 return tracking
1601 return tracking
1575
1602
1576 def _abssource(self, source):
1603 def _abssource(self, source):
1577 if '://' not in source:
1604 if '://' not in source:
1578 # recognize the scp syntax as an absolute source
1605 # recognize the scp syntax as an absolute source
1579 colon = source.find(':')
1606 colon = source.find(':')
1580 if colon != -1 and '/' not in source[:colon]:
1607 if colon != -1 and '/' not in source[:colon]:
1581 return source
1608 return source
1582 self._subsource = source
1609 self._subsource = source
1583 return _abssource(self)
1610 return _abssource(self)
1584
1611
1585 def _fetch(self, source, revision):
1612 def _fetch(self, source, revision):
1586 if self._gitmissing():
1613 if self._gitmissing():
1587 # SEC: check for safe ssh url
1614 # SEC: check for safe ssh url
1588 util.checksafessh(source)
1615 util.checksafessh(source)
1589
1616
1590 source = self._abssource(source)
1617 source = self._abssource(source)
1591 self.ui.status(_('cloning subrepo %s from %s\n') %
1618 self.ui.status(_('cloning subrepo %s from %s\n') %
1592 (self._relpath, source))
1619 (self._relpath, source))
1593 self._gitnodir(['clone', source, self._abspath])
1620 self._gitnodir(['clone', source, self._abspath])
1594 if self._githavelocally(revision):
1621 if self._githavelocally(revision):
1595 return
1622 return
1596 self.ui.status(_('pulling subrepo %s from %s\n') %
1623 self.ui.status(_('pulling subrepo %s from %s\n') %
1597 (self._relpath, self._gitremote('origin')))
1624 (self._relpath, self._gitremote('origin')))
1598 # try only origin: the originally cloned repo
1625 # try only origin: the originally cloned repo
1599 self._gitcommand(['fetch'])
1626 self._gitcommand(['fetch'])
1600 if not self._githavelocally(revision):
1627 if not self._githavelocally(revision):
1601 raise error.Abort(_('revision %s does not exist in subrepository '
1628 raise error.Abort(_('revision %s does not exist in subrepository '
1602 '"%s"\n') % (revision, self._relpath))
1629 '"%s"\n') % (revision, self._relpath))
1603
1630
1604 @annotatesubrepoerror
1631 @annotatesubrepoerror
1605 def dirty(self, ignoreupdate=False, missing=False):
1632 def dirty(self, ignoreupdate=False, missing=False):
1606 if self._gitmissing():
1633 if self._gitmissing():
1607 return self._state[1] != ''
1634 return self._state[1] != ''
1608 if self._gitisbare():
1635 if self._gitisbare():
1609 return True
1636 return True
1610 if not ignoreupdate and self._state[1] != self._gitstate():
1637 if not ignoreupdate and self._state[1] != self._gitstate():
1611 # different version checked out
1638 # different version checked out
1612 return True
1639 return True
1613 # check for staged changes or modified files; ignore untracked files
1640 # check for staged changes or modified files; ignore untracked files
1614 self._gitupdatestat()
1641 self._gitupdatestat()
1615 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
1642 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
1616 return code == 1
1643 return code == 1
1617
1644
1618 def basestate(self):
1645 def basestate(self):
1619 return self._gitstate()
1646 return self._gitstate()
1620
1647
1621 @annotatesubrepoerror
1648 @annotatesubrepoerror
1622 def get(self, state, overwrite=False):
1649 def get(self, state, overwrite=False):
1623 source, revision, kind = state
1650 source, revision, kind = state
1624 if not revision:
1651 if not revision:
1625 self.remove()
1652 self.remove()
1626 return
1653 return
1627 self._fetch(source, revision)
1654 self._fetch(source, revision)
1628 # if the repo was set to be bare, unbare it
1655 # if the repo was set to be bare, unbare it
1629 if self._gitisbare():
1656 if self._gitisbare():
1630 self._gitcommand(['config', 'core.bare', 'false'])
1657 self._gitcommand(['config', 'core.bare', 'false'])
1631 if self._gitstate() == revision:
1658 if self._gitstate() == revision:
1632 self._gitcommand(['reset', '--hard', 'HEAD'])
1659 self._gitcommand(['reset', '--hard', 'HEAD'])
1633 return
1660 return
1634 elif self._gitstate() == revision:
1661 elif self._gitstate() == revision:
1635 if overwrite:
1662 if overwrite:
1636 # first reset the index to unmark new files for commit, because
1663 # first reset the index to unmark new files for commit, because
1637 # reset --hard will otherwise throw away files added for commit,
1664 # reset --hard will otherwise throw away files added for commit,
1638 # not just unmark them.
1665 # not just unmark them.
1639 self._gitcommand(['reset', 'HEAD'])
1666 self._gitcommand(['reset', 'HEAD'])
1640 self._gitcommand(['reset', '--hard', 'HEAD'])
1667 self._gitcommand(['reset', '--hard', 'HEAD'])
1641 return
1668 return
1642 branch2rev, rev2branch = self._gitbranchmap()
1669 branch2rev, rev2branch = self._gitbranchmap()
1643
1670
1644 def checkout(args):
1671 def checkout(args):
1645 cmd = ['checkout']
1672 cmd = ['checkout']
1646 if overwrite:
1673 if overwrite:
1647 # first reset the index to unmark new files for commit, because
1674 # first reset the index to unmark new files for commit, because
1648 # the -f option will otherwise throw away files added for
1675 # the -f option will otherwise throw away files added for
1649 # commit, not just unmark them.
1676 # commit, not just unmark them.
1650 self._gitcommand(['reset', 'HEAD'])
1677 self._gitcommand(['reset', 'HEAD'])
1651 cmd.append('-f')
1678 cmd.append('-f')
1652 self._gitcommand(cmd + args)
1679 self._gitcommand(cmd + args)
1653 _sanitize(self.ui, self.wvfs, '.git')
1680 _sanitize(self.ui, self.wvfs, '.git')
1654
1681
1655 def rawcheckout():
1682 def rawcheckout():
1656 # no branch to checkout, check it out with no branch
1683 # no branch to checkout, check it out with no branch
1657 self.ui.warn(_('checking out detached HEAD in '
1684 self.ui.warn(_('checking out detached HEAD in '
1658 'subrepository "%s"\n') % self._relpath)
1685 'subrepository "%s"\n') % self._relpath)
1659 self.ui.warn(_('check out a git branch if you intend '
1686 self.ui.warn(_('check out a git branch if you intend '
1660 'to make changes\n'))
1687 'to make changes\n'))
1661 checkout(['-q', revision])
1688 checkout(['-q', revision])
1662
1689
1663 if revision not in rev2branch:
1690 if revision not in rev2branch:
1664 rawcheckout()
1691 rawcheckout()
1665 return
1692 return
1666 branches = rev2branch[revision]
1693 branches = rev2branch[revision]
1667 firstlocalbranch = None
1694 firstlocalbranch = None
1668 for b in branches:
1695 for b in branches:
1669 if b == 'refs/heads/master':
1696 if b == 'refs/heads/master':
1670 # master trumps all other branches
1697 # master trumps all other branches
1671 checkout(['refs/heads/master'])
1698 checkout(['refs/heads/master'])
1672 return
1699 return
1673 if not firstlocalbranch and not b.startswith('refs/remotes/'):
1700 if not firstlocalbranch and not b.startswith('refs/remotes/'):
1674 firstlocalbranch = b
1701 firstlocalbranch = b
1675 if firstlocalbranch:
1702 if firstlocalbranch:
1676 checkout([firstlocalbranch])
1703 checkout([firstlocalbranch])
1677 return
1704 return
1678
1705
1679 tracking = self._gittracking(branch2rev.keys())
1706 tracking = self._gittracking(branch2rev.keys())
1680 # choose a remote branch already tracked if possible
1707 # choose a remote branch already tracked if possible
1681 remote = branches[0]
1708 remote = branches[0]
1682 if remote not in tracking:
1709 if remote not in tracking:
1683 for b in branches:
1710 for b in branches:
1684 if b in tracking:
1711 if b in tracking:
1685 remote = b
1712 remote = b
1686 break
1713 break
1687
1714
1688 if remote not in tracking:
1715 if remote not in tracking:
1689 # create a new local tracking branch
1716 # create a new local tracking branch
1690 local = remote.split('/', 3)[3]
1717 local = remote.split('/', 3)[3]
1691 checkout(['-b', local, remote])
1718 checkout(['-b', local, remote])
1692 elif self._gitisancestor(branch2rev[tracking[remote]], remote):
1719 elif self._gitisancestor(branch2rev[tracking[remote]], remote):
1693 # When updating to a tracked remote branch,
1720 # When updating to a tracked remote branch,
1694 # if the local tracking branch is downstream of it,
1721 # if the local tracking branch is downstream of it,
1695 # a normal `git pull` would have performed a "fast-forward merge"
1722 # a normal `git pull` would have performed a "fast-forward merge"
1696 # which is equivalent to updating the local branch to the remote.
1723 # which is equivalent to updating the local branch to the remote.
1697 # Since we are only looking at branching at update, we need to
1724 # Since we are only looking at branching at update, we need to
1698 # detect this situation and perform this action lazily.
1725 # detect this situation and perform this action lazily.
1699 if tracking[remote] != self._gitcurrentbranch():
1726 if tracking[remote] != self._gitcurrentbranch():
1700 checkout([tracking[remote]])
1727 checkout([tracking[remote]])
1701 self._gitcommand(['merge', '--ff', remote])
1728 self._gitcommand(['merge', '--ff', remote])
1702 _sanitize(self.ui, self.wvfs, '.git')
1729 _sanitize(self.ui, self.wvfs, '.git')
1703 else:
1730 else:
1704 # a real merge would be required, just checkout the revision
1731 # a real merge would be required, just checkout the revision
1705 rawcheckout()
1732 rawcheckout()
1706
1733
1707 @annotatesubrepoerror
1734 @annotatesubrepoerror
1708 def commit(self, text, user, date):
1735 def commit(self, text, user, date):
1709 if self._gitmissing():
1736 if self._gitmissing():
1710 raise error.Abort(_("subrepo %s is missing") % self._relpath)
1737 raise error.Abort(_("subrepo %s is missing") % self._relpath)
1711 cmd = ['commit', '-a', '-m', text]
1738 cmd = ['commit', '-a', '-m', text]
1712 env = encoding.environ.copy()
1739 env = encoding.environ.copy()
1713 if user:
1740 if user:
1714 cmd += ['--author', user]
1741 cmd += ['--author', user]
1715 if date:
1742 if date:
1716 # git's date parser silently ignores when seconds < 1e9
1743 # git's date parser silently ignores when seconds < 1e9
1717 # convert to ISO8601
1744 # convert to ISO8601
1718 env['GIT_AUTHOR_DATE'] = util.datestr(date,
1745 env['GIT_AUTHOR_DATE'] = util.datestr(date,
1719 '%Y-%m-%dT%H:%M:%S %1%2')
1746 '%Y-%m-%dT%H:%M:%S %1%2')
1720 self._gitcommand(cmd, env=env)
1747 self._gitcommand(cmd, env=env)
1721 # make sure commit works otherwise HEAD might not exist under certain
1748 # make sure commit works otherwise HEAD might not exist under certain
1722 # circumstances
1749 # circumstances
1723 return self._gitstate()
1750 return self._gitstate()
1724
1751
1725 @annotatesubrepoerror
1752 @annotatesubrepoerror
1726 def merge(self, state):
1753 def merge(self, state):
1727 source, revision, kind = state
1754 source, revision, kind = state
1728 self._fetch(source, revision)
1755 self._fetch(source, revision)
1729 base = self._gitcommand(['merge-base', revision, self._state[1]])
1756 base = self._gitcommand(['merge-base', revision, self._state[1]])
1730 self._gitupdatestat()
1757 self._gitupdatestat()
1731 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
1758 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
1732
1759
1733 def mergefunc():
1760 def mergefunc():
1734 if base == revision:
1761 if base == revision:
1735 self.get(state) # fast forward merge
1762 self.get(state) # fast forward merge
1736 elif base != self._state[1]:
1763 elif base != self._state[1]:
1737 self._gitcommand(['merge', '--no-commit', revision])
1764 self._gitcommand(['merge', '--no-commit', revision])
1738 _sanitize(self.ui, self.wvfs, '.git')
1765 _sanitize(self.ui, self.wvfs, '.git')
1739
1766
1740 if self.dirty():
1767 if self.dirty():
1741 if self._gitstate() != revision:
1768 if self._gitstate() != revision:
1742 dirty = self._gitstate() == self._state[1] or code != 0
1769 dirty = self._gitstate() == self._state[1] or code != 0
1743 if _updateprompt(self.ui, self, dirty,
1770 if _updateprompt(self.ui, self, dirty,
1744 self._state[1][:7], revision[:7]):
1771 self._state[1][:7], revision[:7]):
1745 mergefunc()
1772 mergefunc()
1746 else:
1773 else:
1747 mergefunc()
1774 mergefunc()
1748
1775
1749 @annotatesubrepoerror
1776 @annotatesubrepoerror
1750 def push(self, opts):
1777 def push(self, opts):
1751 force = opts.get('force')
1778 force = opts.get('force')
1752
1779
1753 if not self._state[1]:
1780 if not self._state[1]:
1754 return True
1781 return True
1755 if self._gitmissing():
1782 if self._gitmissing():
1756 raise error.Abort(_("subrepo %s is missing") % self._relpath)
1783 raise error.Abort(_("subrepo %s is missing") % self._relpath)
1757 # if a branch in origin contains the revision, nothing to do
1784 # if a branch in origin contains the revision, nothing to do
1758 branch2rev, rev2branch = self._gitbranchmap()
1785 branch2rev, rev2branch = self._gitbranchmap()
1759 if self._state[1] in rev2branch:
1786 if self._state[1] in rev2branch:
1760 for b in rev2branch[self._state[1]]:
1787 for b in rev2branch[self._state[1]]:
1761 if b.startswith('refs/remotes/origin/'):
1788 if b.startswith('refs/remotes/origin/'):
1762 return True
1789 return True
1763 for b, revision in branch2rev.iteritems():
1790 for b, revision in branch2rev.iteritems():
1764 if b.startswith('refs/remotes/origin/'):
1791 if b.startswith('refs/remotes/origin/'):
1765 if self._gitisancestor(self._state[1], revision):
1792 if self._gitisancestor(self._state[1], revision):
1766 return True
1793 return True
1767 # otherwise, try to push the currently checked out branch
1794 # otherwise, try to push the currently checked out branch
1768 cmd = ['push']
1795 cmd = ['push']
1769 if force:
1796 if force:
1770 cmd.append('--force')
1797 cmd.append('--force')
1771
1798
1772 current = self._gitcurrentbranch()
1799 current = self._gitcurrentbranch()
1773 if current:
1800 if current:
1774 # determine if the current branch is even useful
1801 # determine if the current branch is even useful
1775 if not self._gitisancestor(self._state[1], current):
1802 if not self._gitisancestor(self._state[1], current):
1776 self.ui.warn(_('unrelated git branch checked out '
1803 self.ui.warn(_('unrelated git branch checked out '
1777 'in subrepository "%s"\n') % self._relpath)
1804 'in subrepository "%s"\n') % self._relpath)
1778 return False
1805 return False
1779 self.ui.status(_('pushing branch %s of subrepository "%s"\n') %
1806 self.ui.status(_('pushing branch %s of subrepository "%s"\n') %
1780 (current.split('/', 2)[2], self._relpath))
1807 (current.split('/', 2)[2], self._relpath))
1781 ret = self._gitdir(cmd + ['origin', current])
1808 ret = self._gitdir(cmd + ['origin', current])
1782 return ret[1] == 0
1809 return ret[1] == 0
1783 else:
1810 else:
1784 self.ui.warn(_('no branch checked out in subrepository "%s"\n'
1811 self.ui.warn(_('no branch checked out in subrepository "%s"\n'
1785 'cannot push revision %s\n') %
1812 'cannot push revision %s\n') %
1786 (self._relpath, self._state[1]))
1813 (self._relpath, self._state[1]))
1787 return False
1814 return False
1788
1815
1789 @annotatesubrepoerror
1816 @annotatesubrepoerror
1790 def add(self, ui, match, prefix, explicitonly, **opts):
1817 def add(self, ui, match, prefix, explicitonly, **opts):
1791 if self._gitmissing():
1818 if self._gitmissing():
1792 return []
1819 return []
1793
1820
1794 (modified, added, removed,
1821 (modified, added, removed,
1795 deleted, unknown, ignored, clean) = self.status(None, unknown=True,
1822 deleted, unknown, ignored, clean) = self.status(None, unknown=True,
1796 clean=True)
1823 clean=True)
1797
1824
1798 tracked = set()
1825 tracked = set()
1799 # dirstates 'amn' warn, 'r' is added again
1826 # dirstates 'amn' warn, 'r' is added again
1800 for l in (modified, added, deleted, clean):
1827 for l in (modified, added, deleted, clean):
1801 tracked.update(l)
1828 tracked.update(l)
1802
1829
1803 # Unknown files not of interest will be rejected by the matcher
1830 # Unknown files not of interest will be rejected by the matcher
1804 files = unknown
1831 files = unknown
1805 files.extend(match.files())
1832 files.extend(match.files())
1806
1833
1807 rejected = []
1834 rejected = []
1808
1835
1809 files = [f for f in sorted(set(files)) if match(f)]
1836 files = [f for f in sorted(set(files)) if match(f)]
1810 for f in files:
1837 for f in files:
1811 exact = match.exact(f)
1838 exact = match.exact(f)
1812 command = ["add"]
1839 command = ["add"]
1813 if exact:
1840 if exact:
1814 command.append("-f") #should be added, even if ignored
1841 command.append("-f") #should be added, even if ignored
1815 if ui.verbose or not exact:
1842 if ui.verbose or not exact:
1816 ui.status(_('adding %s\n') % match.rel(f))
1843 ui.status(_('adding %s\n') % match.rel(f))
1817
1844
1818 if f in tracked: # hg prints 'adding' even if already tracked
1845 if f in tracked: # hg prints 'adding' even if already tracked
1819 if exact:
1846 if exact:
1820 rejected.append(f)
1847 rejected.append(f)
1821 continue
1848 continue
1822 if not opts.get(r'dry_run'):
1849 if not opts.get(r'dry_run'):
1823 self._gitcommand(command + [f])
1850 self._gitcommand(command + [f])
1824
1851
1825 for f in rejected:
1852 for f in rejected:
1826 ui.warn(_("%s already tracked!\n") % match.abs(f))
1853 ui.warn(_("%s already tracked!\n") % match.abs(f))
1827
1854
1828 return rejected
1855 return rejected
1829
1856
1830 @annotatesubrepoerror
1857 @annotatesubrepoerror
1831 def remove(self):
1858 def remove(self):
1832 if self._gitmissing():
1859 if self._gitmissing():
1833 return
1860 return
1834 if self.dirty():
1861 if self.dirty():
1835 self.ui.warn(_('not removing repo %s because '
1862 self.ui.warn(_('not removing repo %s because '
1836 'it has changes.\n') % self._relpath)
1863 'it has changes.\n') % self._relpath)
1837 return
1864 return
1838 # we can't fully delete the repository as it may contain
1865 # we can't fully delete the repository as it may contain
1839 # local-only history
1866 # local-only history
1840 self.ui.note(_('removing subrepo %s\n') % self._relpath)
1867 self.ui.note(_('removing subrepo %s\n') % self._relpath)
1841 self._gitcommand(['config', 'core.bare', 'true'])
1868 self._gitcommand(['config', 'core.bare', 'true'])
1842 for f, kind in self.wvfs.readdir():
1869 for f, kind in self.wvfs.readdir():
1843 if f == '.git':
1870 if f == '.git':
1844 continue
1871 continue
1845 if kind == stat.S_IFDIR:
1872 if kind == stat.S_IFDIR:
1846 self.wvfs.rmtree(f)
1873 self.wvfs.rmtree(f)
1847 else:
1874 else:
1848 self.wvfs.unlink(f)
1875 self.wvfs.unlink(f)
1849
1876
1850 def archive(self, archiver, prefix, match=None, decode=True):
1877 def archive(self, archiver, prefix, match=None, decode=True):
1851 total = 0
1878 total = 0
1852 source, revision = self._state
1879 source, revision = self._state
1853 if not revision:
1880 if not revision:
1854 return total
1881 return total
1855 self._fetch(source, revision)
1882 self._fetch(source, revision)
1856
1883
1857 # Parse git's native archive command.
1884 # Parse git's native archive command.
1858 # This should be much faster than manually traversing the trees
1885 # This should be much faster than manually traversing the trees
1859 # and objects with many subprocess calls.
1886 # and objects with many subprocess calls.
1860 tarstream = self._gitcommand(['archive', revision], stream=True)
1887 tarstream = self._gitcommand(['archive', revision], stream=True)
1861 tar = tarfile.open(fileobj=tarstream, mode='r|')
1888 tar = tarfile.open(fileobj=tarstream, mode='r|')
1862 relpath = subrelpath(self)
1889 relpath = subrelpath(self)
1863 self.ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files'))
1890 self.ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files'))
1864 for i, info in enumerate(tar):
1891 for i, info in enumerate(tar):
1865 if info.isdir():
1892 if info.isdir():
1866 continue
1893 continue
1867 if match and not match(info.name):
1894 if match and not match(info.name):
1868 continue
1895 continue
1869 if info.issym():
1896 if info.issym():
1870 data = info.linkname
1897 data = info.linkname
1871 else:
1898 else:
1872 data = tar.extractfile(info).read()
1899 data = tar.extractfile(info).read()
1873 archiver.addfile(prefix + self._path + '/' + info.name,
1900 archiver.addfile(prefix + self._path + '/' + info.name,
1874 info.mode, info.issym(), data)
1901 info.mode, info.issym(), data)
1875 total += 1
1902 total += 1
1876 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
1903 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
1877 unit=_('files'))
1904 unit=_('files'))
1878 self.ui.progress(_('archiving (%s)') % relpath, None)
1905 self.ui.progress(_('archiving (%s)') % relpath, None)
1879 return total
1906 return total
1880
1907
1881
1908
1882 @annotatesubrepoerror
1909 @annotatesubrepoerror
1883 def cat(self, match, fm, fntemplate, prefix, **opts):
1910 def cat(self, match, fm, fntemplate, prefix, **opts):
1884 rev = self._state[1]
1911 rev = self._state[1]
1885 if match.anypats():
1912 if match.anypats():
1886 return 1 #No support for include/exclude yet
1913 return 1 #No support for include/exclude yet
1887
1914
1888 if not match.files():
1915 if not match.files():
1889 return 1
1916 return 1
1890
1917
1891 # TODO: add support for non-plain formatter (see cmdutil.cat())
1918 # TODO: add support for non-plain formatter (see cmdutil.cat())
1892 for f in match.files():
1919 for f in match.files():
1893 output = self._gitcommand(["show", "%s:%s" % (rev, f)])
1920 output = self._gitcommand(["show", "%s:%s" % (rev, f)])
1894 fp = cmdutil.makefileobj(self._subparent, fntemplate,
1921 fp = cmdutil.makefileobj(self._subparent, fntemplate,
1895 self._ctx.node(),
1922 self._ctx.node(),
1896 pathname=self.wvfs.reljoin(prefix, f))
1923 pathname=self.wvfs.reljoin(prefix, f))
1897 fp.write(output)
1924 fp.write(output)
1898 fp.close()
1925 fp.close()
1899 return 0
1926 return 0
1900
1927
1901
1928
1902 @annotatesubrepoerror
1929 @annotatesubrepoerror
1903 def status(self, rev2, **opts):
1930 def status(self, rev2, **opts):
1904 rev1 = self._state[1]
1931 rev1 = self._state[1]
1905 if self._gitmissing() or not rev1:
1932 if self._gitmissing() or not rev1:
1906 # if the repo is missing, return no results
1933 # if the repo is missing, return no results
1907 return scmutil.status([], [], [], [], [], [], [])
1934 return scmutil.status([], [], [], [], [], [], [])
1908 modified, added, removed = [], [], []
1935 modified, added, removed = [], [], []
1909 self._gitupdatestat()
1936 self._gitupdatestat()
1910 if rev2:
1937 if rev2:
1911 command = ['diff-tree', '--no-renames', '-r', rev1, rev2]
1938 command = ['diff-tree', '--no-renames', '-r', rev1, rev2]
1912 else:
1939 else:
1913 command = ['diff-index', '--no-renames', rev1]
1940 command = ['diff-index', '--no-renames', rev1]
1914 out = self._gitcommand(command)
1941 out = self._gitcommand(command)
1915 for line in out.split('\n'):
1942 for line in out.split('\n'):
1916 tab = line.find('\t')
1943 tab = line.find('\t')
1917 if tab == -1:
1944 if tab == -1:
1918 continue
1945 continue
1919 status, f = line[tab - 1], line[tab + 1:]
1946 status, f = line[tab - 1], line[tab + 1:]
1920 if status == 'M':
1947 if status == 'M':
1921 modified.append(f)
1948 modified.append(f)
1922 elif status == 'A':
1949 elif status == 'A':
1923 added.append(f)
1950 added.append(f)
1924 elif status == 'D':
1951 elif status == 'D':
1925 removed.append(f)
1952 removed.append(f)
1926
1953
1927 deleted, unknown, ignored, clean = [], [], [], []
1954 deleted, unknown, ignored, clean = [], [], [], []
1928
1955
1929 command = ['status', '--porcelain', '-z']
1956 command = ['status', '--porcelain', '-z']
1930 if opts.get(r'unknown'):
1957 if opts.get(r'unknown'):
1931 command += ['--untracked-files=all']
1958 command += ['--untracked-files=all']
1932 if opts.get(r'ignored'):
1959 if opts.get(r'ignored'):
1933 command += ['--ignored']
1960 command += ['--ignored']
1934 out = self._gitcommand(command)
1961 out = self._gitcommand(command)
1935
1962
1936 changedfiles = set()
1963 changedfiles = set()
1937 changedfiles.update(modified)
1964 changedfiles.update(modified)
1938 changedfiles.update(added)
1965 changedfiles.update(added)
1939 changedfiles.update(removed)
1966 changedfiles.update(removed)
1940 for line in out.split('\0'):
1967 for line in out.split('\0'):
1941 if not line:
1968 if not line:
1942 continue
1969 continue
1943 st = line[0:2]
1970 st = line[0:2]
1944 #moves and copies show 2 files on one line
1971 #moves and copies show 2 files on one line
1945 if line.find('\0') >= 0:
1972 if line.find('\0') >= 0:
1946 filename1, filename2 = line[3:].split('\0')
1973 filename1, filename2 = line[3:].split('\0')
1947 else:
1974 else:
1948 filename1 = line[3:]
1975 filename1 = line[3:]
1949 filename2 = None
1976 filename2 = None
1950
1977
1951 changedfiles.add(filename1)
1978 changedfiles.add(filename1)
1952 if filename2:
1979 if filename2:
1953 changedfiles.add(filename2)
1980 changedfiles.add(filename2)
1954
1981
1955 if st == '??':
1982 if st == '??':
1956 unknown.append(filename1)
1983 unknown.append(filename1)
1957 elif st == '!!':
1984 elif st == '!!':
1958 ignored.append(filename1)
1985 ignored.append(filename1)
1959
1986
1960 if opts.get(r'clean'):
1987 if opts.get(r'clean'):
1961 out = self._gitcommand(['ls-files'])
1988 out = self._gitcommand(['ls-files'])
1962 for f in out.split('\n'):
1989 for f in out.split('\n'):
1963 if not f in changedfiles:
1990 if not f in changedfiles:
1964 clean.append(f)
1991 clean.append(f)
1965
1992
1966 return scmutil.status(modified, added, removed, deleted,
1993 return scmutil.status(modified, added, removed, deleted,
1967 unknown, ignored, clean)
1994 unknown, ignored, clean)
1968
1995
1969 @annotatesubrepoerror
1996 @annotatesubrepoerror
1970 def diff(self, ui, diffopts, node2, match, prefix, **opts):
1997 def diff(self, ui, diffopts, node2, match, prefix, **opts):
1971 node1 = self._state[1]
1998 node1 = self._state[1]
1972 cmd = ['diff', '--no-renames']
1999 cmd = ['diff', '--no-renames']
1973 if opts[r'stat']:
2000 if opts[r'stat']:
1974 cmd.append('--stat')
2001 cmd.append('--stat')
1975 else:
2002 else:
1976 # for Git, this also implies '-p'
2003 # for Git, this also implies '-p'
1977 cmd.append('-U%d' % diffopts.context)
2004 cmd.append('-U%d' % diffopts.context)
1978
2005
1979 gitprefix = self.wvfs.reljoin(prefix, self._path)
2006 gitprefix = self.wvfs.reljoin(prefix, self._path)
1980
2007
1981 if diffopts.noprefix:
2008 if diffopts.noprefix:
1982 cmd.extend(['--src-prefix=%s/' % gitprefix,
2009 cmd.extend(['--src-prefix=%s/' % gitprefix,
1983 '--dst-prefix=%s/' % gitprefix])
2010 '--dst-prefix=%s/' % gitprefix])
1984 else:
2011 else:
1985 cmd.extend(['--src-prefix=a/%s/' % gitprefix,
2012 cmd.extend(['--src-prefix=a/%s/' % gitprefix,
1986 '--dst-prefix=b/%s/' % gitprefix])
2013 '--dst-prefix=b/%s/' % gitprefix])
1987
2014
1988 if diffopts.ignorews:
2015 if diffopts.ignorews:
1989 cmd.append('--ignore-all-space')
2016 cmd.append('--ignore-all-space')
1990 if diffopts.ignorewsamount:
2017 if diffopts.ignorewsamount:
1991 cmd.append('--ignore-space-change')
2018 cmd.append('--ignore-space-change')
1992 if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \
2019 if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \
1993 and diffopts.ignoreblanklines:
2020 and diffopts.ignoreblanklines:
1994 cmd.append('--ignore-blank-lines')
2021 cmd.append('--ignore-blank-lines')
1995
2022
1996 cmd.append(node1)
2023 cmd.append(node1)
1997 if node2:
2024 if node2:
1998 cmd.append(node2)
2025 cmd.append(node2)
1999
2026
2000 output = ""
2027 output = ""
2001 if match.always():
2028 if match.always():
2002 output += self._gitcommand(cmd) + '\n'
2029 output += self._gitcommand(cmd) + '\n'
2003 else:
2030 else:
2004 st = self.status(node2)[:3]
2031 st = self.status(node2)[:3]
2005 files = [f for sublist in st for f in sublist]
2032 files = [f for sublist in st for f in sublist]
2006 for f in files:
2033 for f in files:
2007 if match(f):
2034 if match(f):
2008 output += self._gitcommand(cmd + ['--', f]) + '\n'
2035 output += self._gitcommand(cmd + ['--', f]) + '\n'
2009
2036
2010 if output.strip():
2037 if output.strip():
2011 ui.write(output)
2038 ui.write(output)
2012
2039
2013 @annotatesubrepoerror
2040 @annotatesubrepoerror
2014 def revert(self, substate, *pats, **opts):
2041 def revert(self, substate, *pats, **opts):
2015 self.ui.status(_('reverting subrepo %s\n') % substate[0])
2042 self.ui.status(_('reverting subrepo %s\n') % substate[0])
2016 if not opts.get(r'no_backup'):
2043 if not opts.get(r'no_backup'):
2017 status = self.status(None)
2044 status = self.status(None)
2018 names = status.modified
2045 names = status.modified
2019 for name in names:
2046 for name in names:
2020 bakname = scmutil.origpath(self.ui, self._subparent, name)
2047 bakname = scmutil.origpath(self.ui, self._subparent, name)
2021 self.ui.note(_('saving current version of %s as %s\n') %
2048 self.ui.note(_('saving current version of %s as %s\n') %
2022 (name, bakname))
2049 (name, bakname))
2023 self.wvfs.rename(name, bakname)
2050 self.wvfs.rename(name, bakname)
2024
2051
2025 if not opts.get(r'dry_run'):
2052 if not opts.get(r'dry_run'):
2026 self.get(substate, overwrite=True)
2053 self.get(substate, overwrite=True)
2027 return []
2054 return []
2028
2055
2029 def shortid(self, revid):
2056 def shortid(self, revid):
2030 return revid[:7]
2057 return revid[:7]
2031
2058
2032 types = {
2059 types = {
2033 'hg': hgsubrepo,
2060 'hg': hgsubrepo,
2034 'svn': svnsubrepo,
2061 'svn': svnsubrepo,
2035 'git': gitsubrepo,
2062 'git': gitsubrepo,
2036 }
2063 }
@@ -1,1167 +1,1171 b''
1 #require git
1 #require git
2
2
3 $ echo "[core]" >> $HOME/.gitconfig
3 $ echo "[core]" >> $HOME/.gitconfig
4 $ echo "autocrlf = false" >> $HOME/.gitconfig
4 $ echo "autocrlf = false" >> $HOME/.gitconfig
5 $ echo "[core]" >> $HOME/.gitconfig
5 $ echo "[core]" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
6 $ echo "autocrlf = false" >> $HOME/.gitconfig
7 $ echo "[extensions]" >> $HGRCPATH
7 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "convert=" >> $HGRCPATH
8 $ echo "convert=" >> $HGRCPATH
9 $ cat >> $HGRCPATH <<EOF
10 > [subrepos]
11 > git:allowed = true
12 > EOF
9 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
13 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
10 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
14 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
11 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
15 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
12 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
16 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
13 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
17 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
14 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
18 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
15 $ INVALIDID1=afd12345af
19 $ INVALIDID1=afd12345af
16 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
20 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
17 $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357
21 $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357
18 $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da
22 $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da
19 $ count=10
23 $ count=10
20 $ commit()
24 $ commit()
21 > {
25 > {
22 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
26 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
23 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
27 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
24 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
28 > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
25 > count=`expr $count + 1`
29 > count=`expr $count + 1`
26 > }
30 > }
27 $ mkdir git-repo
31 $ mkdir git-repo
28 $ cd git-repo
32 $ cd git-repo
29 $ git init-db >/dev/null 2>/dev/null
33 $ git init-db >/dev/null 2>/dev/null
30 $ echo a > a
34 $ echo a > a
31 $ mkdir d
35 $ mkdir d
32 $ echo b > d/b
36 $ echo b > d/b
33 $ git add a d
37 $ git add a d
34 $ commit -a -m t1
38 $ commit -a -m t1
35
39
36 Remove the directory, then try to replace it with a file (issue754)
40 Remove the directory, then try to replace it with a file (issue754)
37
41
38 $ git rm -f d/b
42 $ git rm -f d/b
39 rm 'd/b'
43 rm 'd/b'
40 $ commit -m t2
44 $ commit -m t2
41 $ echo d > d
45 $ echo d > d
42 $ git add d
46 $ git add d
43 $ commit -m t3
47 $ commit -m t3
44 $ echo b >> a
48 $ echo b >> a
45 $ commit -a -m t4.1
49 $ commit -a -m t4.1
46 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
50 $ git checkout -b other HEAD~ >/dev/null 2>/dev/null
47 $ echo c > a
51 $ echo c > a
48 $ echo a >> a
52 $ echo a >> a
49 $ commit -a -m t4.2
53 $ commit -a -m t4.2
50 $ git checkout master >/dev/null 2>/dev/null
54 $ git checkout master >/dev/null 2>/dev/null
51 $ git pull --no-commit . other > /dev/null 2>/dev/null
55 $ git pull --no-commit . other > /dev/null 2>/dev/null
52 $ commit -m 'Merge branch other'
56 $ commit -m 'Merge branch other'
53 $ cd ..
57 $ cd ..
54 $ hg convert --config extensions.progress= --config progress.assume-tty=1 \
58 $ hg convert --config extensions.progress= --config progress.assume-tty=1 \
55 > --config progress.delay=0 --config progress.changedelay=0 \
59 > --config progress.delay=0 --config progress.changedelay=0 \
56 > --config progress.refresh=0 --config progress.width=60 \
60 > --config progress.refresh=0 --config progress.width=60 \
57 > --config progress.format='topic, bar, number' --datesort git-repo
61 > --config progress.format='topic, bar, number' --datesort git-repo
58 \r (no-eol) (esc)
62 \r (no-eol) (esc)
59 scanning [======> ] 1/6\r (no-eol) (esc)
63 scanning [======> ] 1/6\r (no-eol) (esc)
60 scanning [=============> ] 2/6\r (no-eol) (esc)
64 scanning [=============> ] 2/6\r (no-eol) (esc)
61 scanning [=====================> ] 3/6\r (no-eol) (esc)
65 scanning [=====================> ] 3/6\r (no-eol) (esc)
62 scanning [============================> ] 4/6\r (no-eol) (esc)
66 scanning [============================> ] 4/6\r (no-eol) (esc)
63 scanning [===================================> ] 5/6\r (no-eol) (esc)
67 scanning [===================================> ] 5/6\r (no-eol) (esc)
64 scanning [===========================================>] 6/6\r (no-eol) (esc)
68 scanning [===========================================>] 6/6\r (no-eol) (esc)
65 \r (no-eol) (esc)
69 \r (no-eol) (esc)
66 \r (no-eol) (esc)
70 \r (no-eol) (esc)
67 converting [ ] 0/6\r (no-eol) (esc)
71 converting [ ] 0/6\r (no-eol) (esc)
68 getting files [==================> ] 1/2\r (no-eol) (esc)
72 getting files [==================> ] 1/2\r (no-eol) (esc)
69 getting files [======================================>] 2/2\r (no-eol) (esc)
73 getting files [======================================>] 2/2\r (no-eol) (esc)
70 \r (no-eol) (esc)
74 \r (no-eol) (esc)
71 \r (no-eol) (esc)
75 \r (no-eol) (esc)
72 converting [======> ] 1/6\r (no-eol) (esc)
76 converting [======> ] 1/6\r (no-eol) (esc)
73 getting files [======================================>] 1/1\r (no-eol) (esc)
77 getting files [======================================>] 1/1\r (no-eol) (esc)
74 \r (no-eol) (esc)
78 \r (no-eol) (esc)
75 \r (no-eol) (esc)
79 \r (no-eol) (esc)
76 converting [=============> ] 2/6\r (no-eol) (esc)
80 converting [=============> ] 2/6\r (no-eol) (esc)
77 getting files [======================================>] 1/1\r (no-eol) (esc)
81 getting files [======================================>] 1/1\r (no-eol) (esc)
78 \r (no-eol) (esc)
82 \r (no-eol) (esc)
79 \r (no-eol) (esc)
83 \r (no-eol) (esc)
80 converting [====================> ] 3/6\r (no-eol) (esc)
84 converting [====================> ] 3/6\r (no-eol) (esc)
81 getting files [======================================>] 1/1\r (no-eol) (esc)
85 getting files [======================================>] 1/1\r (no-eol) (esc)
82 \r (no-eol) (esc)
86 \r (no-eol) (esc)
83 \r (no-eol) (esc)
87 \r (no-eol) (esc)
84 converting [===========================> ] 4/6\r (no-eol) (esc)
88 converting [===========================> ] 4/6\r (no-eol) (esc)
85 getting files [======================================>] 1/1\r (no-eol) (esc)
89 getting files [======================================>] 1/1\r (no-eol) (esc)
86 \r (no-eol) (esc)
90 \r (no-eol) (esc)
87 \r (no-eol) (esc)
91 \r (no-eol) (esc)
88 converting [==================================> ] 5/6\r (no-eol) (esc)
92 converting [==================================> ] 5/6\r (no-eol) (esc)
89 getting files [======================================>] 1/1\r (no-eol) (esc)
93 getting files [======================================>] 1/1\r (no-eol) (esc)
90 \r (no-eol) (esc)
94 \r (no-eol) (esc)
91 assuming destination git-repo-hg
95 assuming destination git-repo-hg
92 initializing destination git-repo-hg repository
96 initializing destination git-repo-hg repository
93 scanning source...
97 scanning source...
94 sorting...
98 sorting...
95 converting...
99 converting...
96 5 t1
100 5 t1
97 4 t2
101 4 t2
98 3 t3
102 3 t3
99 2 t4.1
103 2 t4.1
100 1 t4.2
104 1 t4.2
101 0 Merge branch other
105 0 Merge branch other
102 updating bookmarks
106 updating bookmarks
103 $ hg up -q -R git-repo-hg
107 $ hg up -q -R git-repo-hg
104 $ hg -R git-repo-hg tip -v
108 $ hg -R git-repo-hg tip -v
105 changeset: 5:c78094926be2
109 changeset: 5:c78094926be2
106 bookmark: master
110 bookmark: master
107 tag: tip
111 tag: tip
108 parent: 3:f5f5cb45432b
112 parent: 3:f5f5cb45432b
109 parent: 4:4e174f80c67c
113 parent: 4:4e174f80c67c
110 user: test <test@example.org>
114 user: test <test@example.org>
111 date: Mon Jan 01 00:00:15 2007 +0000
115 date: Mon Jan 01 00:00:15 2007 +0000
112 files: a
116 files: a
113 description:
117 description:
114 Merge branch other
118 Merge branch other
115
119
116
120
117 $ count=10
121 $ count=10
118 $ mkdir git-repo2
122 $ mkdir git-repo2
119 $ cd git-repo2
123 $ cd git-repo2
120 $ git init-db >/dev/null 2>/dev/null
124 $ git init-db >/dev/null 2>/dev/null
121 $ echo foo > foo
125 $ echo foo > foo
122 $ git add foo
126 $ git add foo
123 $ commit -a -m 'add foo'
127 $ commit -a -m 'add foo'
124 $ echo >> foo
128 $ echo >> foo
125 $ commit -a -m 'change foo'
129 $ commit -a -m 'change foo'
126 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
130 $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
127 $ echo quux >> quux
131 $ echo quux >> quux
128 $ git add quux
132 $ git add quux
129 $ commit -a -m 'add quux'
133 $ commit -a -m 'add quux'
130 $ echo bar > bar
134 $ echo bar > bar
131 $ git add bar
135 $ git add bar
132 $ commit -a -m 'add bar'
136 $ commit -a -m 'add bar'
133 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
137 $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
134 $ echo baz > baz
138 $ echo baz > baz
135 $ git add baz
139 $ git add baz
136 $ commit -a -m 'add baz'
140 $ commit -a -m 'add baz'
137 $ git checkout master >/dev/null 2>/dev/null
141 $ git checkout master >/dev/null 2>/dev/null
138 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
142 $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
139 $ commit -m 'Octopus merge'
143 $ commit -m 'Octopus merge'
140 $ echo bar >> bar
144 $ echo bar >> bar
141 $ commit -a -m 'change bar'
145 $ commit -a -m 'change bar'
142 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
146 $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
143 $ echo >> foo
147 $ echo >> foo
144 $ commit -a -m 'change foo'
148 $ commit -a -m 'change foo'
145 $ git checkout master >/dev/null 2>/dev/null
149 $ git checkout master >/dev/null 2>/dev/null
146 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
150 $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
147 $ commit -m 'Discard change to foo'
151 $ commit -m 'Discard change to foo'
148 $ cd ..
152 $ cd ..
149 $ glog()
153 $ glog()
150 > {
154 > {
151 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
155 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
152 > }
156 > }
153 $ splitrepo()
157 $ splitrepo()
154 > {
158 > {
155 > msg="$1"
159 > msg="$1"
156 > files="$2"
160 > files="$2"
157 > opts=$3
161 > opts=$3
158 > echo "% $files: $msg"
162 > echo "% $files: $msg"
159 > prefix=`echo "$files" | sed -e 's/ /-/g'`
163 > prefix=`echo "$files" | sed -e 's/ /-/g'`
160 > fmap="$prefix.fmap"
164 > fmap="$prefix.fmap"
161 > repo="$prefix.repo"
165 > repo="$prefix.repo"
162 > for i in $files; do
166 > for i in $files; do
163 > echo "include $i" >> "$fmap"
167 > echo "include $i" >> "$fmap"
164 > done
168 > done
165 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
169 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
166 > hg up -q -R "$repo"
170 > hg up -q -R "$repo"
167 > glog -R "$repo"
171 > glog -R "$repo"
168 > hg -R "$repo" manifest --debug
172 > hg -R "$repo" manifest --debug
169 > }
173 > }
170
174
171 full conversion
175 full conversion
172
176
173 $ hg convert --datesort git-repo2 fullrepo \
177 $ hg convert --datesort git-repo2 fullrepo \
174 > --config extensions.progress= --config progress.assume-tty=1 \
178 > --config extensions.progress= --config progress.assume-tty=1 \
175 > --config progress.delay=0 --config progress.changedelay=0 \
179 > --config progress.delay=0 --config progress.changedelay=0 \
176 > --config progress.refresh=0 --config progress.width=60 \
180 > --config progress.refresh=0 --config progress.width=60 \
177 > --config progress.format='topic, bar, number'
181 > --config progress.format='topic, bar, number'
178 \r (no-eol) (esc)
182 \r (no-eol) (esc)
179 scanning [===> ] 1/9\r (no-eol) (esc)
183 scanning [===> ] 1/9\r (no-eol) (esc)
180 scanning [========> ] 2/9\r (no-eol) (esc)
184 scanning [========> ] 2/9\r (no-eol) (esc)
181 scanning [=============> ] 3/9\r (no-eol) (esc)
185 scanning [=============> ] 3/9\r (no-eol) (esc)
182 scanning [==================> ] 4/9\r (no-eol) (esc)
186 scanning [==================> ] 4/9\r (no-eol) (esc)
183 scanning [=======================> ] 5/9\r (no-eol) (esc)
187 scanning [=======================> ] 5/9\r (no-eol) (esc)
184 scanning [============================> ] 6/9\r (no-eol) (esc)
188 scanning [============================> ] 6/9\r (no-eol) (esc)
185 scanning [=================================> ] 7/9\r (no-eol) (esc)
189 scanning [=================================> ] 7/9\r (no-eol) (esc)
186 scanning [======================================> ] 8/9\r (no-eol) (esc)
190 scanning [======================================> ] 8/9\r (no-eol) (esc)
187 scanning [===========================================>] 9/9\r (no-eol) (esc)
191 scanning [===========================================>] 9/9\r (no-eol) (esc)
188 \r (no-eol) (esc)
192 \r (no-eol) (esc)
189 \r (no-eol) (esc)
193 \r (no-eol) (esc)
190 converting [ ] 0/9\r (no-eol) (esc)
194 converting [ ] 0/9\r (no-eol) (esc)
191 getting files [======================================>] 1/1\r (no-eol) (esc)
195 getting files [======================================>] 1/1\r (no-eol) (esc)
192 \r (no-eol) (esc)
196 \r (no-eol) (esc)
193 \r (no-eol) (esc)
197 \r (no-eol) (esc)
194 converting [===> ] 1/9\r (no-eol) (esc)
198 converting [===> ] 1/9\r (no-eol) (esc)
195 getting files [======================================>] 1/1\r (no-eol) (esc)
199 getting files [======================================>] 1/1\r (no-eol) (esc)
196 \r (no-eol) (esc)
200 \r (no-eol) (esc)
197 \r (no-eol) (esc)
201 \r (no-eol) (esc)
198 converting [========> ] 2/9\r (no-eol) (esc)
202 converting [========> ] 2/9\r (no-eol) (esc)
199 getting files [======================================>] 1/1\r (no-eol) (esc)
203 getting files [======================================>] 1/1\r (no-eol) (esc)
200 \r (no-eol) (esc)
204 \r (no-eol) (esc)
201 \r (no-eol) (esc)
205 \r (no-eol) (esc)
202 converting [=============> ] 3/9\r (no-eol) (esc)
206 converting [=============> ] 3/9\r (no-eol) (esc)
203 getting files [======================================>] 1/1\r (no-eol) (esc)
207 getting files [======================================>] 1/1\r (no-eol) (esc)
204 \r (no-eol) (esc)
208 \r (no-eol) (esc)
205 \r (no-eol) (esc)
209 \r (no-eol) (esc)
206 converting [=================> ] 4/9\r (no-eol) (esc)
210 converting [=================> ] 4/9\r (no-eol) (esc)
207 getting files [======================================>] 1/1\r (no-eol) (esc)
211 getting files [======================================>] 1/1\r (no-eol) (esc)
208 \r (no-eol) (esc)
212 \r (no-eol) (esc)
209 \r (no-eol) (esc)
213 \r (no-eol) (esc)
210 converting [======================> ] 5/9\r (no-eol) (esc)
214 converting [======================> ] 5/9\r (no-eol) (esc)
211 getting files [===> ] 1/8\r (no-eol) (esc)
215 getting files [===> ] 1/8\r (no-eol) (esc)
212 getting files [========> ] 2/8\r (no-eol) (esc)
216 getting files [========> ] 2/8\r (no-eol) (esc)
213 getting files [=============> ] 3/8\r (no-eol) (esc)
217 getting files [=============> ] 3/8\r (no-eol) (esc)
214 getting files [==================> ] 4/8\r (no-eol) (esc)
218 getting files [==================> ] 4/8\r (no-eol) (esc)
215 getting files [=======================> ] 5/8\r (no-eol) (esc)
219 getting files [=======================> ] 5/8\r (no-eol) (esc)
216 getting files [============================> ] 6/8\r (no-eol) (esc)
220 getting files [============================> ] 6/8\r (no-eol) (esc)
217 getting files [=================================> ] 7/8\r (no-eol) (esc)
221 getting files [=================================> ] 7/8\r (no-eol) (esc)
218 getting files [======================================>] 8/8\r (no-eol) (esc)
222 getting files [======================================>] 8/8\r (no-eol) (esc)
219 \r (no-eol) (esc)
223 \r (no-eol) (esc)
220 \r (no-eol) (esc)
224 \r (no-eol) (esc)
221 converting [===========================> ] 6/9\r (no-eol) (esc)
225 converting [===========================> ] 6/9\r (no-eol) (esc)
222 getting files [======================================>] 1/1\r (no-eol) (esc)
226 getting files [======================================>] 1/1\r (no-eol) (esc)
223 \r (no-eol) (esc)
227 \r (no-eol) (esc)
224 \r (no-eol) (esc)
228 \r (no-eol) (esc)
225 converting [===============================> ] 7/9\r (no-eol) (esc)
229 converting [===============================> ] 7/9\r (no-eol) (esc)
226 getting files [======================================>] 1/1\r (no-eol) (esc)
230 getting files [======================================>] 1/1\r (no-eol) (esc)
227 \r (no-eol) (esc)
231 \r (no-eol) (esc)
228 \r (no-eol) (esc)
232 \r (no-eol) (esc)
229 converting [====================================> ] 8/9\r (no-eol) (esc)
233 converting [====================================> ] 8/9\r (no-eol) (esc)
230 getting files [==================> ] 1/2\r (no-eol) (esc)
234 getting files [==================> ] 1/2\r (no-eol) (esc)
231 getting files [======================================>] 2/2\r (no-eol) (esc)
235 getting files [======================================>] 2/2\r (no-eol) (esc)
232 \r (no-eol) (esc)
236 \r (no-eol) (esc)
233 initializing destination fullrepo repository
237 initializing destination fullrepo repository
234 scanning source...
238 scanning source...
235 sorting...
239 sorting...
236 converting...
240 converting...
237 8 add foo
241 8 add foo
238 7 change foo
242 7 change foo
239 6 add quux
243 6 add quux
240 5 add bar
244 5 add bar
241 4 add baz
245 4 add baz
242 3 Octopus merge
246 3 Octopus merge
243 2 change bar
247 2 change bar
244 1 change foo
248 1 change foo
245 0 Discard change to foo
249 0 Discard change to foo
246 updating bookmarks
250 updating bookmarks
247 $ hg up -q -R fullrepo
251 $ hg up -q -R fullrepo
248 $ glog -R fullrepo
252 $ glog -R fullrepo
249 @ 9 "Discard change to foo" files: foo
253 @ 9 "Discard change to foo" files: foo
250 |\
254 |\
251 | o 8 "change foo" files: foo
255 | o 8 "change foo" files: foo
252 | |
256 | |
253 o | 7 "change bar" files: bar
257 o | 7 "change bar" files: bar
254 |/
258 |/
255 o 6 "(octopus merge fixup)" files:
259 o 6 "(octopus merge fixup)" files:
256 |\
260 |\
257 | o 5 "Octopus merge" files: baz
261 | o 5 "Octopus merge" files: baz
258 | |\
262 | |\
259 o | | 4 "add baz" files: baz
263 o | | 4 "add baz" files: baz
260 | | |
264 | | |
261 +---o 3 "add bar" files: bar
265 +---o 3 "add bar" files: bar
262 | |
266 | |
263 o | 2 "add quux" files: quux
267 o | 2 "add quux" files: quux
264 | |
268 | |
265 | o 1 "change foo" files: foo
269 | o 1 "change foo" files: foo
266 |/
270 |/
267 o 0 "add foo" files: foo
271 o 0 "add foo" files: foo
268
272
269 $ hg -R fullrepo manifest --debug
273 $ hg -R fullrepo manifest --debug
270 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
274 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
271 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
275 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
272 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
276 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
273 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
277 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
274 $ splitrepo 'octopus merge' 'foo bar baz'
278 $ splitrepo 'octopus merge' 'foo bar baz'
275 % foo bar baz: octopus merge
279 % foo bar baz: octopus merge
276 @ 8 "Discard change to foo" files: foo
280 @ 8 "Discard change to foo" files: foo
277 |\
281 |\
278 | o 7 "change foo" files: foo
282 | o 7 "change foo" files: foo
279 | |
283 | |
280 o | 6 "change bar" files: bar
284 o | 6 "change bar" files: bar
281 |/
285 |/
282 o 5 "(octopus merge fixup)" files:
286 o 5 "(octopus merge fixup)" files:
283 |\
287 |\
284 | o 4 "Octopus merge" files: baz
288 | o 4 "Octopus merge" files: baz
285 | |\
289 | |\
286 o | | 3 "add baz" files: baz
290 o | | 3 "add baz" files: baz
287 | | |
291 | | |
288 +---o 2 "add bar" files: bar
292 +---o 2 "add bar" files: bar
289 | |
293 | |
290 | o 1 "change foo" files: foo
294 | o 1 "change foo" files: foo
291 |/
295 |/
292 o 0 "add foo" files: foo
296 o 0 "add foo" files: foo
293
297
294 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
298 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar
295 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
299 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
296 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
300 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
297 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
301 $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
298 % foo baz quux: only some parents of an octopus merge; "discard" a head
302 % foo baz quux: only some parents of an octopus merge; "discard" a head
299 @ 6 "Discard change to foo" files: foo
303 @ 6 "Discard change to foo" files: foo
300 |
304 |
301 o 5 "change foo" files: foo
305 o 5 "change foo" files: foo
302 |
306 |
303 o 4 "Octopus merge" files:
307 o 4 "Octopus merge" files:
304 |\
308 |\
305 | o 3 "add baz" files: baz
309 | o 3 "add baz" files: baz
306 | |
310 | |
307 | o 2 "add quux" files: quux
311 | o 2 "add quux" files: quux
308 | |
312 | |
309 o | 1 "change foo" files: foo
313 o | 1 "change foo" files: foo
310 |/
314 |/
311 o 0 "add foo" files: foo
315 o 0 "add foo" files: foo
312
316
313 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
317 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
314 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
318 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
315 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
319 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
316
320
317 test importing git renames and copies
321 test importing git renames and copies
318
322
319 $ cd git-repo2
323 $ cd git-repo2
320 $ git mv foo foo-renamed
324 $ git mv foo foo-renamed
321 since bar is not touched in this commit, this copy will not be detected
325 since bar is not touched in this commit, this copy will not be detected
322 $ cp bar bar-copied
326 $ cp bar bar-copied
323 $ cp baz baz-copied
327 $ cp baz baz-copied
324 $ cp baz baz-copied2
328 $ cp baz baz-copied2
325 $ cp baz ba-copy
329 $ cp baz ba-copy
326 $ echo baz2 >> baz
330 $ echo baz2 >> baz
327 $ git add bar-copied baz-copied baz-copied2 ba-copy
331 $ git add bar-copied baz-copied baz-copied2 ba-copy
328 $ commit -a -m 'rename and copy'
332 $ commit -a -m 'rename and copy'
329 $ cd ..
333 $ cd ..
330
334
331 input validation
335 input validation
332 $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
336 $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
333 abort: convert.git.similarity is not a valid integer ('foo')
337 abort: convert.git.similarity is not a valid integer ('foo')
334 [255]
338 [255]
335 $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
339 $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
336 abort: similarity must be between 0 and 100
340 abort: similarity must be between 0 and 100
337 [255]
341 [255]
338 $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
342 $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
339 abort: similarity must be between 0 and 100
343 abort: similarity must be between 0 and 100
340 [255]
344 [255]
341
345
342 $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
346 $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
343 $ hg -R fullrepo status -C --change master
347 $ hg -R fullrepo status -C --change master
344 M baz
348 M baz
345 A ba-copy
349 A ba-copy
346 baz
350 baz
347 A bar-copied
351 A bar-copied
348 A baz-copied
352 A baz-copied
349 baz
353 baz
350 A baz-copied2
354 A baz-copied2
351 baz
355 baz
352 A foo-renamed
356 A foo-renamed
353 foo
357 foo
354 R foo
358 R foo
355
359
356 Ensure that the modification to the copy source was preserved
360 Ensure that the modification to the copy source was preserved
357 (there was a bug where if the copy dest was alphabetically prior to the copy
361 (there was a bug where if the copy dest was alphabetically prior to the copy
358 source, the copy source took the contents of the copy dest)
362 source, the copy source took the contents of the copy dest)
359 $ hg cat -r tip fullrepo/baz
363 $ hg cat -r tip fullrepo/baz
360 baz
364 baz
361 baz2
365 baz2
362
366
363 $ cd git-repo2
367 $ cd git-repo2
364 $ echo bar2 >> bar
368 $ echo bar2 >> bar
365 $ commit -a -m 'change bar'
369 $ commit -a -m 'change bar'
366 $ cp bar bar-copied2
370 $ cp bar bar-copied2
367 $ git add bar-copied2
371 $ git add bar-copied2
368 $ commit -a -m 'copy with no changes'
372 $ commit -a -m 'copy with no changes'
369 $ cd ..
373 $ cd ..
370
374
371 $ hg -q convert --config convert.git.similarity=100 \
375 $ hg -q convert --config convert.git.similarity=100 \
372 > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
376 > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo
373 $ hg -R fullrepo status -C --change master
377 $ hg -R fullrepo status -C --change master
374 A bar-copied2
378 A bar-copied2
375 bar
379 bar
376
380
377 renamelimit config option works
381 renamelimit config option works
378
382
379 $ cd git-repo2
383 $ cd git-repo2
380 $ cat >> copy-source << EOF
384 $ cat >> copy-source << EOF
381 > sc0
385 > sc0
382 > sc1
386 > sc1
383 > sc2
387 > sc2
384 > sc3
388 > sc3
385 > sc4
389 > sc4
386 > sc5
390 > sc5
387 > sc6
391 > sc6
388 > EOF
392 > EOF
389 $ git add copy-source
393 $ git add copy-source
390 $ commit -m 'add copy-source'
394 $ commit -m 'add copy-source'
391 $ cp copy-source source-copy0
395 $ cp copy-source source-copy0
392 $ echo 0 >> source-copy0
396 $ echo 0 >> source-copy0
393 $ cp copy-source source-copy1
397 $ cp copy-source source-copy1
394 $ echo 1 >> source-copy1
398 $ echo 1 >> source-copy1
395 $ git add source-copy0 source-copy1
399 $ git add source-copy0 source-copy1
396 $ commit -a -m 'copy copy-source 2 times'
400 $ commit -a -m 'copy copy-source 2 times'
397 $ cd ..
401 $ cd ..
398
402
399 $ hg -q convert --config convert.git.renamelimit=1 \
403 $ hg -q convert --config convert.git.renamelimit=1 \
400 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2
404 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2
401 $ hg -R fullrepo2 status -C --change master
405 $ hg -R fullrepo2 status -C --change master
402 A source-copy0
406 A source-copy0
403 A source-copy1
407 A source-copy1
404
408
405 $ hg -q convert --config convert.git.renamelimit=100 \
409 $ hg -q convert --config convert.git.renamelimit=100 \
406 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3
410 > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3
407 $ hg -R fullrepo3 status -C --change master
411 $ hg -R fullrepo3 status -C --change master
408 A source-copy0
412 A source-copy0
409 copy-source
413 copy-source
410 A source-copy1
414 A source-copy1
411 copy-source
415 copy-source
412
416
413 test binary conversion (issue1359)
417 test binary conversion (issue1359)
414
418
415 $ count=19
419 $ count=19
416 $ mkdir git-repo3
420 $ mkdir git-repo3
417 $ cd git-repo3
421 $ cd git-repo3
418 $ git init-db >/dev/null 2>/dev/null
422 $ git init-db >/dev/null 2>/dev/null
419 $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
423 $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
420 $ git add b
424 $ git add b
421 $ commit -a -m addbinary
425 $ commit -a -m addbinary
422 $ cd ..
426 $ cd ..
423
427
424 convert binary file
428 convert binary file
425
429
426 $ hg convert git-repo3 git-repo3-hg
430 $ hg convert git-repo3 git-repo3-hg
427 initializing destination git-repo3-hg repository
431 initializing destination git-repo3-hg repository
428 scanning source...
432 scanning source...
429 sorting...
433 sorting...
430 converting...
434 converting...
431 0 addbinary
435 0 addbinary
432 updating bookmarks
436 updating bookmarks
433 $ cd git-repo3-hg
437 $ cd git-repo3-hg
434 $ hg up -C
438 $ hg up -C
435 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
439 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
436 $ $PYTHON -c 'print len(file("b", "rb").read())'
440 $ $PYTHON -c 'print len(file("b", "rb").read())'
437 4096
441 4096
438 $ cd ..
442 $ cd ..
439
443
440 test author vs committer
444 test author vs committer
441
445
442 $ mkdir git-repo4
446 $ mkdir git-repo4
443 $ cd git-repo4
447 $ cd git-repo4
444 $ git init-db >/dev/null 2>/dev/null
448 $ git init-db >/dev/null 2>/dev/null
445 $ echo >> foo
449 $ echo >> foo
446 $ git add foo
450 $ git add foo
447 $ commit -a -m addfoo
451 $ commit -a -m addfoo
448 $ echo >> foo
452 $ echo >> foo
449 $ GIT_AUTHOR_NAME="nottest"
453 $ GIT_AUTHOR_NAME="nottest"
450 $ commit -a -m addfoo2
454 $ commit -a -m addfoo2
451 $ cd ..
455 $ cd ..
452
456
453 convert author committer
457 convert author committer
454
458
455 $ hg convert git-repo4 git-repo4-hg
459 $ hg convert git-repo4 git-repo4-hg
456 initializing destination git-repo4-hg repository
460 initializing destination git-repo4-hg repository
457 scanning source...
461 scanning source...
458 sorting...
462 sorting...
459 converting...
463 converting...
460 1 addfoo
464 1 addfoo
461 0 addfoo2
465 0 addfoo2
462 updating bookmarks
466 updating bookmarks
463 $ hg -R git-repo4-hg log -v
467 $ hg -R git-repo4-hg log -v
464 changeset: 1:d63e967f93da
468 changeset: 1:d63e967f93da
465 bookmark: master
469 bookmark: master
466 tag: tip
470 tag: tip
467 user: nottest <test@example.org>
471 user: nottest <test@example.org>
468 date: Mon Jan 01 00:00:21 2007 +0000
472 date: Mon Jan 01 00:00:21 2007 +0000
469 files: foo
473 files: foo
470 description:
474 description:
471 addfoo2
475 addfoo2
472
476
473 committer: test <test@example.org>
477 committer: test <test@example.org>
474
478
475
479
476 changeset: 0:0735477b0224
480 changeset: 0:0735477b0224
477 user: test <test@example.org>
481 user: test <test@example.org>
478 date: Mon Jan 01 00:00:20 2007 +0000
482 date: Mon Jan 01 00:00:20 2007 +0000
479 files: foo
483 files: foo
480 description:
484 description:
481 addfoo
485 addfoo
482
486
483
487
484
488
485 Various combinations of committeractions fail
489 Various combinations of committeractions fail
486
490
487 $ hg --config convert.git.committeractions=messagedifferent,messagealways convert git-repo4 bad-committer
491 $ hg --config convert.git.committeractions=messagedifferent,messagealways convert git-repo4 bad-committer
488 initializing destination bad-committer repository
492 initializing destination bad-committer repository
489 abort: committeractions cannot define both messagedifferent and messagealways
493 abort: committeractions cannot define both messagedifferent and messagealways
490 [255]
494 [255]
491
495
492 $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer
496 $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer
493 initializing destination bad-committer repository
497 initializing destination bad-committer repository
494 abort: committeractions cannot define both dropcommitter and replaceauthor
498 abort: committeractions cannot define both dropcommitter and replaceauthor
495 [255]
499 [255]
496
500
497 $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer
501 $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer
498 initializing destination bad-committer repository
502 initializing destination bad-committer repository
499 abort: committeractions cannot define both dropcommitter and messagealways
503 abort: committeractions cannot define both dropcommitter and messagealways
500 [255]
504 [255]
501
505
502 custom prefix on messagedifferent works
506 custom prefix on messagedifferent works
503
507
504 $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix
508 $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix
505 initializing destination git-repo4-hg-messagedifferentprefix repository
509 initializing destination git-repo4-hg-messagedifferentprefix repository
506 scanning source...
510 scanning source...
507 sorting...
511 sorting...
508 converting...
512 converting...
509 1 addfoo
513 1 addfoo
510 0 addfoo2
514 0 addfoo2
511 updating bookmarks
515 updating bookmarks
512
516
513 $ hg -R git-repo4-hg-messagedifferentprefix log -v
517 $ hg -R git-repo4-hg-messagedifferentprefix log -v
514 changeset: 1:2fe0c98a109d
518 changeset: 1:2fe0c98a109d
515 bookmark: master
519 bookmark: master
516 tag: tip
520 tag: tip
517 user: nottest <test@example.org>
521 user: nottest <test@example.org>
518 date: Mon Jan 01 00:00:21 2007 +0000
522 date: Mon Jan 01 00:00:21 2007 +0000
519 files: foo
523 files: foo
520 description:
524 description:
521 addfoo2
525 addfoo2
522
526
523 different: test <test@example.org>
527 different: test <test@example.org>
524
528
525
529
526 changeset: 0:0735477b0224
530 changeset: 0:0735477b0224
527 user: test <test@example.org>
531 user: test <test@example.org>
528 date: Mon Jan 01 00:00:20 2007 +0000
532 date: Mon Jan 01 00:00:20 2007 +0000
529 files: foo
533 files: foo
530 description:
534 description:
531 addfoo
535 addfoo
532
536
533
537
534
538
535 messagealways will always add the "committer: " line even if committer identical
539 messagealways will always add the "committer: " line even if committer identical
536
540
537 $ hg --config convert.git.committeractions=messagealways convert git-repo4 git-repo4-hg-messagealways
541 $ hg --config convert.git.committeractions=messagealways convert git-repo4 git-repo4-hg-messagealways
538 initializing destination git-repo4-hg-messagealways repository
542 initializing destination git-repo4-hg-messagealways repository
539 scanning source...
543 scanning source...
540 sorting...
544 sorting...
541 converting...
545 converting...
542 1 addfoo
546 1 addfoo
543 0 addfoo2
547 0 addfoo2
544 updating bookmarks
548 updating bookmarks
545
549
546 $ hg -R git-repo4-hg-messagealways log -v
550 $ hg -R git-repo4-hg-messagealways log -v
547 changeset: 1:8db057d8cd37
551 changeset: 1:8db057d8cd37
548 bookmark: master
552 bookmark: master
549 tag: tip
553 tag: tip
550 user: nottest <test@example.org>
554 user: nottest <test@example.org>
551 date: Mon Jan 01 00:00:21 2007 +0000
555 date: Mon Jan 01 00:00:21 2007 +0000
552 files: foo
556 files: foo
553 description:
557 description:
554 addfoo2
558 addfoo2
555
559
556 committer: test <test@example.org>
560 committer: test <test@example.org>
557
561
558
562
559 changeset: 0:8f71fe9c98be
563 changeset: 0:8f71fe9c98be
560 user: test <test@example.org>
564 user: test <test@example.org>
561 date: Mon Jan 01 00:00:20 2007 +0000
565 date: Mon Jan 01 00:00:20 2007 +0000
562 files: foo
566 files: foo
563 description:
567 description:
564 addfoo
568 addfoo
565
569
566 committer: test <test@example.org>
570 committer: test <test@example.org>
567
571
568
572
569
573
570 custom prefix on messagealways works
574 custom prefix on messagealways works
571
575
572 $ hg --config convert.git.committeractions=messagealways=always: convert git-repo4 git-repo4-hg-messagealwaysprefix
576 $ hg --config convert.git.committeractions=messagealways=always: convert git-repo4 git-repo4-hg-messagealwaysprefix
573 initializing destination git-repo4-hg-messagealwaysprefix repository
577 initializing destination git-repo4-hg-messagealwaysprefix repository
574 scanning source...
578 scanning source...
575 sorting...
579 sorting...
576 converting...
580 converting...
577 1 addfoo
581 1 addfoo
578 0 addfoo2
582 0 addfoo2
579 updating bookmarks
583 updating bookmarks
580
584
581 $ hg -R git-repo4-hg-messagealwaysprefix log -v
585 $ hg -R git-repo4-hg-messagealwaysprefix log -v
582 changeset: 1:83c17174de79
586 changeset: 1:83c17174de79
583 bookmark: master
587 bookmark: master
584 tag: tip
588 tag: tip
585 user: nottest <test@example.org>
589 user: nottest <test@example.org>
586 date: Mon Jan 01 00:00:21 2007 +0000
590 date: Mon Jan 01 00:00:21 2007 +0000
587 files: foo
591 files: foo
588 description:
592 description:
589 addfoo2
593 addfoo2
590
594
591 always: test <test@example.org>
595 always: test <test@example.org>
592
596
593
597
594 changeset: 0:2ac9bcb3534a
598 changeset: 0:2ac9bcb3534a
595 user: test <test@example.org>
599 user: test <test@example.org>
596 date: Mon Jan 01 00:00:20 2007 +0000
600 date: Mon Jan 01 00:00:20 2007 +0000
597 files: foo
601 files: foo
598 description:
602 description:
599 addfoo
603 addfoo
600
604
601 always: test <test@example.org>
605 always: test <test@example.org>
602
606
603
607
604
608
605 replaceauthor replaces author with committer
609 replaceauthor replaces author with committer
606
610
607 $ hg --config convert.git.committeractions=replaceauthor convert git-repo4 git-repo4-hg-replaceauthor
611 $ hg --config convert.git.committeractions=replaceauthor convert git-repo4 git-repo4-hg-replaceauthor
608 initializing destination git-repo4-hg-replaceauthor repository
612 initializing destination git-repo4-hg-replaceauthor repository
609 scanning source...
613 scanning source...
610 sorting...
614 sorting...
611 converting...
615 converting...
612 1 addfoo
616 1 addfoo
613 0 addfoo2
617 0 addfoo2
614 updating bookmarks
618 updating bookmarks
615
619
616 $ hg -R git-repo4-hg-replaceauthor log -v
620 $ hg -R git-repo4-hg-replaceauthor log -v
617 changeset: 1:122c1d8999ea
621 changeset: 1:122c1d8999ea
618 bookmark: master
622 bookmark: master
619 tag: tip
623 tag: tip
620 user: test <test@example.org>
624 user: test <test@example.org>
621 date: Mon Jan 01 00:00:21 2007 +0000
625 date: Mon Jan 01 00:00:21 2007 +0000
622 files: foo
626 files: foo
623 description:
627 description:
624 addfoo2
628 addfoo2
625
629
626
630
627 changeset: 0:0735477b0224
631 changeset: 0:0735477b0224
628 user: test <test@example.org>
632 user: test <test@example.org>
629 date: Mon Jan 01 00:00:20 2007 +0000
633 date: Mon Jan 01 00:00:20 2007 +0000
630 files: foo
634 files: foo
631 description:
635 description:
632 addfoo
636 addfoo
633
637
634
638
635
639
636 dropcommitter removes the committer
640 dropcommitter removes the committer
637
641
638 $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter
642 $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter
639 initializing destination git-repo4-hg-dropcommitter repository
643 initializing destination git-repo4-hg-dropcommitter repository
640 scanning source...
644 scanning source...
641 sorting...
645 sorting...
642 converting...
646 converting...
643 1 addfoo
647 1 addfoo
644 0 addfoo2
648 0 addfoo2
645 updating bookmarks
649 updating bookmarks
646
650
647 $ hg -R git-repo4-hg-dropcommitter log -v
651 $ hg -R git-repo4-hg-dropcommitter log -v
648 changeset: 1:190b2da396cc
652 changeset: 1:190b2da396cc
649 bookmark: master
653 bookmark: master
650 tag: tip
654 tag: tip
651 user: nottest <test@example.org>
655 user: nottest <test@example.org>
652 date: Mon Jan 01 00:00:21 2007 +0000
656 date: Mon Jan 01 00:00:21 2007 +0000
653 files: foo
657 files: foo
654 description:
658 description:
655 addfoo2
659 addfoo2
656
660
657
661
658 changeset: 0:0735477b0224
662 changeset: 0:0735477b0224
659 user: test <test@example.org>
663 user: test <test@example.org>
660 date: Mon Jan 01 00:00:20 2007 +0000
664 date: Mon Jan 01 00:00:20 2007 +0000
661 files: foo
665 files: foo
662 description:
666 description:
663 addfoo
667 addfoo
664
668
665
669
666
670
667 --sourceorder should fail
671 --sourceorder should fail
668
672
669 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
673 $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg
670 initializing destination git-repo4-sourcesort-hg repository
674 initializing destination git-repo4-sourcesort-hg repository
671 abort: --sourcesort is not supported by this data source
675 abort: --sourcesort is not supported by this data source
672 [255]
676 [255]
673
677
674 test converting certain branches
678 test converting certain branches
675
679
676 $ mkdir git-testrevs
680 $ mkdir git-testrevs
677 $ cd git-testrevs
681 $ cd git-testrevs
678 $ git init
682 $ git init
679 Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
683 Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
680 $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
684 $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
681 $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
685 $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
682 $ git checkout -b goodbranch 'HEAD^'
686 $ git checkout -b goodbranch 'HEAD^'
683 Switched to a new branch 'goodbranch'
687 Switched to a new branch 'goodbranch'
684 $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
688 $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
685 $ git checkout -b badbranch 'HEAD^'
689 $ git checkout -b badbranch 'HEAD^'
686 Switched to a new branch 'badbranch'
690 Switched to a new branch 'badbranch'
687 $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
691 $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
688 $ cd ..
692 $ cd ..
689 $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
693 $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
690 initializing destination hg-testrevs repository
694 initializing destination hg-testrevs repository
691 scanning source...
695 scanning source...
692 sorting...
696 sorting...
693 converting...
697 converting...
694 2 first
698 2 first
695 1 good branch commit
699 1 good branch commit
696 0 master commit
700 0 master commit
697 updating bookmarks
701 updating bookmarks
698 $ cd hg-testrevs
702 $ cd hg-testrevs
699 $ hg log -G -T '{rev} {bookmarks}'
703 $ hg log -G -T '{rev} {bookmarks}'
700 o 2 master
704 o 2 master
701 |
705 |
702 | o 1 goodbranch
706 | o 1 goodbranch
703 |/
707 |/
704 o 0
708 o 0
705
709
706 $ cd ..
710 $ cd ..
707
711
708 test sub modules
712 test sub modules
709
713
710 $ mkdir git-repo5
714 $ mkdir git-repo5
711 $ cd git-repo5
715 $ cd git-repo5
712 $ git init-db >/dev/null 2>/dev/null
716 $ git init-db >/dev/null 2>/dev/null
713 $ echo 'sub' >> foo
717 $ echo 'sub' >> foo
714 $ git add foo
718 $ git add foo
715 $ commit -a -m 'addfoo'
719 $ commit -a -m 'addfoo'
716 $ BASE=`pwd`
720 $ BASE=`pwd`
717 $ cd ..
721 $ cd ..
718 $ mkdir git-repo6
722 $ mkdir git-repo6
719 $ cd git-repo6
723 $ cd git-repo6
720 $ git init-db >/dev/null 2>/dev/null
724 $ git init-db >/dev/null 2>/dev/null
721 $ git submodule add ${BASE} >/dev/null 2>/dev/null
725 $ git submodule add ${BASE} >/dev/null 2>/dev/null
722 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
726 $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null
723
727
724 test non-tab whitespace .gitmodules
728 test non-tab whitespace .gitmodules
725
729
726 $ cat >> .gitmodules <<EOF
730 $ cat >> .gitmodules <<EOF
727 > [submodule "git-repo5"]
731 > [submodule "git-repo5"]
728 > path = git-repo5
732 > path = git-repo5
729 > url = git-repo5
733 > url = git-repo5
730 > EOF
734 > EOF
731 $ git commit -q -a -m "weird white space submodule"
735 $ git commit -q -a -m "weird white space submodule"
732 $ cd ..
736 $ cd ..
733 $ hg convert git-repo6 hg-repo6
737 $ hg convert git-repo6 hg-repo6
734 initializing destination hg-repo6 repository
738 initializing destination hg-repo6 repository
735 scanning source...
739 scanning source...
736 sorting...
740 sorting...
737 converting...
741 converting...
738 1 addsubmodule
742 1 addsubmodule
739 0 weird white space submodule
743 0 weird white space submodule
740 updating bookmarks
744 updating bookmarks
741
745
742 $ rm -rf hg-repo6
746 $ rm -rf hg-repo6
743 $ cd git-repo6
747 $ cd git-repo6
744 $ git reset --hard 'HEAD^' > /dev/null
748 $ git reset --hard 'HEAD^' > /dev/null
745
749
746 test missing .gitmodules
750 test missing .gitmodules
747
751
748 $ git submodule add ../git-repo4 >/dev/null 2>/dev/null
752 $ git submodule add ../git-repo4 >/dev/null 2>/dev/null
749 $ git checkout HEAD .gitmodules
753 $ git checkout HEAD .gitmodules
750 $ git rm .gitmodules
754 $ git rm .gitmodules
751 rm '.gitmodules'
755 rm '.gitmodules'
752 $ git commit -q -m "remove .gitmodules" .gitmodules
756 $ git commit -q -m "remove .gitmodules" .gitmodules
753 $ git commit -q -m "missing .gitmodules"
757 $ git commit -q -m "missing .gitmodules"
754 $ cd ..
758 $ cd ..
755 $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist"
759 $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist"
756 initializing destination hg-repo6 repository
760 initializing destination hg-repo6 repository
757 scanning source...
761 scanning source...
758 sorting...
762 sorting...
759 converting...
763 converting...
760 2 addsubmodule
764 2 addsubmodule
761 1 remove .gitmodules
765 1 remove .gitmodules
762 0 missing .gitmodules
766 0 missing .gitmodules
763 warning: cannot read submodules config file in * (glob)
767 warning: cannot read submodules config file in * (glob)
764 updating bookmarks
768 updating bookmarks
765 $ rm -rf hg-repo6
769 $ rm -rf hg-repo6
766 $ cd git-repo6
770 $ cd git-repo6
767 $ rm -rf git-repo4
771 $ rm -rf git-repo4
768 $ git reset --hard 'HEAD^^' > /dev/null
772 $ git reset --hard 'HEAD^^' > /dev/null
769 $ cd ..
773 $ cd ..
770
774
771 test invalid splicemap1
775 test invalid splicemap1
772
776
773 $ cat > splicemap <<EOF
777 $ cat > splicemap <<EOF
774 > $VALIDID1
778 > $VALIDID1
775 > EOF
779 > EOF
776 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
780 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg
777 initializing destination git-repo2-splicemap1-hg repository
781 initializing destination git-repo2-splicemap1-hg repository
778 abort: syntax error in splicemap(1): child parent1[,parent2] expected
782 abort: syntax error in splicemap(1): child parent1[,parent2] expected
779 [255]
783 [255]
780
784
781 test invalid splicemap2
785 test invalid splicemap2
782
786
783 $ cat > splicemap <<EOF
787 $ cat > splicemap <<EOF
784 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
788 > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2
785 > EOF
789 > EOF
786 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
790 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg
787 initializing destination git-repo2-splicemap2-hg repository
791 initializing destination git-repo2-splicemap2-hg repository
788 abort: syntax error in splicemap(1): child parent1[,parent2] expected
792 abort: syntax error in splicemap(1): child parent1[,parent2] expected
789 [255]
793 [255]
790
794
791 test invalid splicemap3
795 test invalid splicemap3
792
796
793 $ cat > splicemap <<EOF
797 $ cat > splicemap <<EOF
794 > $INVALIDID1 $INVALIDID2
798 > $INVALIDID1 $INVALIDID2
795 > EOF
799 > EOF
796 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
800 $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg
797 initializing destination git-repo2-splicemap3-hg repository
801 initializing destination git-repo2-splicemap3-hg repository
798 abort: splicemap entry afd12345af is not a valid revision identifier
802 abort: splicemap entry afd12345af is not a valid revision identifier
799 [255]
803 [255]
800
804
801 convert sub modules
805 convert sub modules
802 $ hg convert git-repo6 git-repo6-hg
806 $ hg convert git-repo6 git-repo6-hg
803 initializing destination git-repo6-hg repository
807 initializing destination git-repo6-hg repository
804 scanning source...
808 scanning source...
805 sorting...
809 sorting...
806 converting...
810 converting...
807 0 addsubmodule
811 0 addsubmodule
808 updating bookmarks
812 updating bookmarks
809 $ hg -R git-repo6-hg log -v
813 $ hg -R git-repo6-hg log -v
810 changeset: 0:* (glob)
814 changeset: 0:* (glob)
811 bookmark: master
815 bookmark: master
812 tag: tip
816 tag: tip
813 user: nottest <test@example.org>
817 user: nottest <test@example.org>
814 date: Mon Jan 01 00:00:23 2007 +0000
818 date: Mon Jan 01 00:00:23 2007 +0000
815 files: .hgsub .hgsubstate
819 files: .hgsub .hgsubstate
816 description:
820 description:
817 addsubmodule
821 addsubmodule
818
822
819 committer: test <test@example.org>
823 committer: test <test@example.org>
820
824
821
825
822
826
823 $ cd git-repo6-hg
827 $ cd git-repo6-hg
824 $ hg up >/dev/null 2>/dev/null
828 $ hg up >/dev/null 2>/dev/null
825 $ cat .hgsubstate
829 $ cat .hgsubstate
826 * git-repo5 (glob)
830 * git-repo5 (glob)
827 $ cd git-repo5
831 $ cd git-repo5
828 $ cat foo
832 $ cat foo
829 sub
833 sub
830
834
831 $ cd ../..
835 $ cd ../..
832
836
833 make sure rename detection doesn't break removing and adding gitmodules
837 make sure rename detection doesn't break removing and adding gitmodules
834
838
835 $ cd git-repo6
839 $ cd git-repo6
836 $ git mv .gitmodules .gitmodules-renamed
840 $ git mv .gitmodules .gitmodules-renamed
837 $ commit -a -m 'rename .gitmodules'
841 $ commit -a -m 'rename .gitmodules'
838 $ git mv .gitmodules-renamed .gitmodules
842 $ git mv .gitmodules-renamed .gitmodules
839 $ commit -a -m 'rename .gitmodules back'
843 $ commit -a -m 'rename .gitmodules back'
840 $ cd ..
844 $ cd ..
841
845
842 $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
846 $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
843 $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
847 $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
844 rename .gitmodules
848 rename .gitmodules
845 $ hg -R git-repo6-hg status -C --change 'tip^'
849 $ hg -R git-repo6-hg status -C --change 'tip^'
846 A .gitmodules-renamed
850 A .gitmodules-renamed
847 R .hgsub
851 R .hgsub
848 R .hgsubstate
852 R .hgsubstate
849 $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
853 $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
850 rename .gitmodules back
854 rename .gitmodules back
851 $ hg -R git-repo6-hg status -C --change tip
855 $ hg -R git-repo6-hg status -C --change tip
852 A .hgsub
856 A .hgsub
853 A .hgsubstate
857 A .hgsubstate
854 R .gitmodules-renamed
858 R .gitmodules-renamed
855
859
856 convert the revision removing '.gitmodules' itself (and related
860 convert the revision removing '.gitmodules' itself (and related
857 submodules)
861 submodules)
858
862
859 $ cd git-repo6
863 $ cd git-repo6
860 $ git rm .gitmodules
864 $ git rm .gitmodules
861 rm '.gitmodules'
865 rm '.gitmodules'
862 $ git rm --cached git-repo5
866 $ git rm --cached git-repo5
863 rm 'git-repo5'
867 rm 'git-repo5'
864 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
868 $ commit -a -m 'remove .gitmodules and submodule git-repo5'
865 $ cd ..
869 $ cd ..
866
870
867 $ hg convert -q git-repo6 git-repo6-hg
871 $ hg convert -q git-repo6 git-repo6-hg
868 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
872 $ hg -R git-repo6-hg tip -T "{desc|firstline}\n"
869 remove .gitmodules and submodule git-repo5
873 remove .gitmodules and submodule git-repo5
870 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
874 $ hg -R git-repo6-hg tip -T "{file_dels}\n"
871 .hgsub .hgsubstate
875 .hgsub .hgsubstate
872
876
873 skip submodules in the conversion
877 skip submodules in the conversion
874
878
875 $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True
879 $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True
876 $ hg -R no-submodules manifest --all
880 $ hg -R no-submodules manifest --all
877 .gitmodules-renamed
881 .gitmodules-renamed
878
882
879 convert using a different remote prefix
883 convert using a different remote prefix
880 $ git init git-repo7
884 $ git init git-repo7
881 Initialized empty Git repository in $TESTTMP/git-repo7/.git/
885 Initialized empty Git repository in $TESTTMP/git-repo7/.git/
882 $ cd git-repo7
886 $ cd git-repo7
883 TODO: it'd be nice to use (?) lines instead of grep -v to handle the
887 TODO: it'd be nice to use (?) lines instead of grep -v to handle the
884 git output variance, but that doesn't currently work in the middle of
888 git output variance, but that doesn't currently work in the middle of
885 a block, so do this for now.
889 a block, so do this for now.
886 $ touch a && git add a && git commit -am "commit a" | grep -v changed
890 $ touch a && git add a && git commit -am "commit a" | grep -v changed
887 [master (root-commit) 8ae5f69] commit a
891 [master (root-commit) 8ae5f69] commit a
888 Author: nottest <test@example.org>
892 Author: nottest <test@example.org>
889 create mode 100644 a
893 create mode 100644 a
890 $ cd ..
894 $ cd ..
891 $ git clone git-repo7 git-repo7-client
895 $ git clone git-repo7 git-repo7-client
892 Cloning into 'git-repo7-client'...
896 Cloning into 'git-repo7-client'...
893 done.
897 done.
894 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
898 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
895 initializing destination hg-repo7 repository
899 initializing destination hg-repo7 repository
896 scanning source...
900 scanning source...
897 sorting...
901 sorting...
898 converting...
902 converting...
899 0 commit a
903 0 commit a
900 updating bookmarks
904 updating bookmarks
901 $ hg -R hg-repo7 bookmarks
905 $ hg -R hg-repo7 bookmarks
902 master 0:03bf38caa4c6
906 master 0:03bf38caa4c6
903 origin/master 0:03bf38caa4c6
907 origin/master 0:03bf38caa4c6
904
908
905 Run convert when the remote branches have changed
909 Run convert when the remote branches have changed
906 (there was an old bug where the local convert read branches from the server)
910 (there was an old bug where the local convert read branches from the server)
907
911
908 $ cd git-repo7
912 $ cd git-repo7
909 $ echo a >> a
913 $ echo a >> a
910 $ git commit -q -am "move master forward"
914 $ git commit -q -am "move master forward"
911 $ cd ..
915 $ cd ..
912 $ rm -rf hg-repo7
916 $ rm -rf hg-repo7
913 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
917 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7
914 initializing destination hg-repo7 repository
918 initializing destination hg-repo7 repository
915 scanning source...
919 scanning source...
916 sorting...
920 sorting...
917 converting...
921 converting...
918 0 commit a
922 0 commit a
919 updating bookmarks
923 updating bookmarks
920 $ hg -R hg-repo7 bookmarks
924 $ hg -R hg-repo7 bookmarks
921 master 0:03bf38caa4c6
925 master 0:03bf38caa4c6
922 origin/master 0:03bf38caa4c6
926 origin/master 0:03bf38caa4c6
923
927
924 damaged git repository tests:
928 damaged git repository tests:
925 In case the hard-coded hashes change, the following commands can be used to
929 In case the hard-coded hashes change, the following commands can be used to
926 list the hashes and their corresponding types in the repository:
930 list the hashes and their corresponding types in the repository:
927 cd git-repo4/.git/objects
931 cd git-repo4/.git/objects
928 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
932 find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t
929 cd ../../..
933 cd ../../..
930
934
931 damage git repository by renaming a commit object
935 damage git repository by renaming a commit object
932 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
936 $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
933 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
937 $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp
934 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
938 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
935 abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git (glob)
939 abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git (glob)
936 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
940 $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ
937 damage git repository by renaming a blob object
941 damage git repository by renaming a blob object
938
942
939 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
943 $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc
940 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
944 $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp
941 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
945 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
942 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
946 abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc
943 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
947 $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ
944 damage git repository by renaming a tree object
948 damage git repository by renaming a tree object
945
949
946 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
950 $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635
947 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
951 $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp
948 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
952 $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:'
949 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
953 abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd
950
954
951 #if no-windows git19
955 #if no-windows git19
952
956
953 test for escaping the repo name (CVE-2016-3069)
957 test for escaping the repo name (CVE-2016-3069)
954
958
955 $ git init '`echo pwned >COMMAND-INJECTION`'
959 $ git init '`echo pwned >COMMAND-INJECTION`'
956 Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/
960 Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/
957 $ cd '`echo pwned >COMMAND-INJECTION`'
961 $ cd '`echo pwned >COMMAND-INJECTION`'
958 $ git commit -q --allow-empty -m 'empty'
962 $ git commit -q --allow-empty -m 'empty'
959 $ cd ..
963 $ cd ..
960 $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted'
964 $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted'
961 initializing destination converted repository
965 initializing destination converted repository
962 scanning source...
966 scanning source...
963 sorting...
967 sorting...
964 converting...
968 converting...
965 0 empty
969 0 empty
966 updating bookmarks
970 updating bookmarks
967 $ test -f COMMAND-INJECTION
971 $ test -f COMMAND-INJECTION
968 [1]
972 [1]
969
973
970 test for safely passing paths to git (CVE-2016-3105)
974 test for safely passing paths to git (CVE-2016-3105)
971
975
972 $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
976 $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
973 Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/
977 Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/
974 $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
978 $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #'
975 $ git commit -q --allow-empty -m 'empty'
979 $ git commit -q --allow-empty -m 'empty'
976 $ cd ..
980 $ cd ..
977 $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext'
981 $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext'
978 initializing destination converted-git-ext repository
982 initializing destination converted-git-ext repository
979 scanning source...
983 scanning source...
980 sorting...
984 sorting...
981 converting...
985 converting...
982 0 empty
986 0 empty
983 updating bookmarks
987 updating bookmarks
984 $ test -f GIT-EXT-COMMAND-INJECTION
988 $ test -f GIT-EXT-COMMAND-INJECTION
985 [1]
989 [1]
986
990
987 #endif
991 #endif
988
992
989 Conversion of extra commit metadata to extras works
993 Conversion of extra commit metadata to extras works
990
994
991 $ git init gitextras >/dev/null 2>/dev/null
995 $ git init gitextras >/dev/null 2>/dev/null
992 $ cd gitextras
996 $ cd gitextras
993 $ touch foo
997 $ touch foo
994 $ git add foo
998 $ git add foo
995 $ commit -m initial
999 $ commit -m initial
996 $ echo 1 > foo
1000 $ echo 1 > foo
997 $ tree=`git write-tree`
1001 $ tree=`git write-tree`
998
1002
999 Git doesn't provider a user-facing API to write extra metadata into the
1003 Git doesn't provider a user-facing API to write extra metadata into the
1000 commit, so create the commit object by hand
1004 commit, so create the commit object by hand
1001
1005
1002 $ git hash-object -t commit -w --stdin << EOF
1006 $ git hash-object -t commit -w --stdin << EOF
1003 > tree ${tree}
1007 > tree ${tree}
1004 > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1
1008 > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1
1005 > author test <test@example.com> 1000000000 +0000
1009 > author test <test@example.com> 1000000000 +0000
1006 > committer test <test@example.com> 1000000000 +0000
1010 > committer test <test@example.com> 1000000000 +0000
1007 > extra-1 extra-1
1011 > extra-1 extra-1
1008 > extra-2 extra-2 with space
1012 > extra-2 extra-2 with space
1009 > convert_revision 0000aaaabbbbccccddddeeee
1013 > convert_revision 0000aaaabbbbccccddddeeee
1010 >
1014 >
1011 > message with extras
1015 > message with extras
1012 > EOF
1016 > EOF
1013 8123727c8361a4117d1a2d80e0c4e7d70c757f18
1017 8123727c8361a4117d1a2d80e0c4e7d70c757f18
1014
1018
1015 $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null
1019 $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null
1016
1020
1017 $ cd ..
1021 $ cd ..
1018
1022
1019 convert will not retain custom metadata keys by default
1023 convert will not retain custom metadata keys by default
1020
1024
1021 $ hg convert gitextras hgextras1
1025 $ hg convert gitextras hgextras1
1022 initializing destination hgextras1 repository
1026 initializing destination hgextras1 repository
1023 scanning source...
1027 scanning source...
1024 sorting...
1028 sorting...
1025 converting...
1029 converting...
1026 1 initial
1030 1 initial
1027 0 message with extras
1031 0 message with extras
1028 updating bookmarks
1032 updating bookmarks
1029
1033
1030 $ hg -R hgextras1 log --debug -r 1
1034 $ hg -R hgextras1 log --debug -r 1
1031 changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09
1035 changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09
1032 bookmark: master
1036 bookmark: master
1033 tag: tip
1037 tag: tip
1034 phase: draft
1038 phase: draft
1035 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1039 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1036 parent: -1:0000000000000000000000000000000000000000
1040 parent: -1:0000000000000000000000000000000000000000
1037 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1041 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1038 user: test <test@example.com>
1042 user: test <test@example.com>
1039 date: Sun Sep 09 01:46:40 2001 +0000
1043 date: Sun Sep 09 01:46:40 2001 +0000
1040 extra: branch=default
1044 extra: branch=default
1041 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1045 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1042 description:
1046 description:
1043 message with extras
1047 message with extras
1044
1048
1045
1049
1046
1050
1047 Attempting to convert a banned extra is disallowed
1051 Attempting to convert a banned extra is disallowed
1048
1052
1049 $ hg convert --config convert.git.extrakeys=tree,parent gitextras hgextras-banned
1053 $ hg convert --config convert.git.extrakeys=tree,parent gitextras hgextras-banned
1050 initializing destination hgextras-banned repository
1054 initializing destination hgextras-banned repository
1051 abort: copying of extra key is forbidden: parent, tree
1055 abort: copying of extra key is forbidden: parent, tree
1052 [255]
1056 [255]
1053
1057
1054 Converting a specific extra works
1058 Converting a specific extra works
1055
1059
1056 $ hg convert --config convert.git.extrakeys=extra-1 gitextras hgextras2
1060 $ hg convert --config convert.git.extrakeys=extra-1 gitextras hgextras2
1057 initializing destination hgextras2 repository
1061 initializing destination hgextras2 repository
1058 scanning source...
1062 scanning source...
1059 sorting...
1063 sorting...
1060 converting...
1064 converting...
1061 1 initial
1065 1 initial
1062 0 message with extras
1066 0 message with extras
1063 updating bookmarks
1067 updating bookmarks
1064
1068
1065 $ hg -R hgextras2 log --debug -r 1
1069 $ hg -R hgextras2 log --debug -r 1
1066 changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391
1070 changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391
1067 bookmark: master
1071 bookmark: master
1068 tag: tip
1072 tag: tip
1069 phase: draft
1073 phase: draft
1070 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1074 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1071 parent: -1:0000000000000000000000000000000000000000
1075 parent: -1:0000000000000000000000000000000000000000
1072 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1076 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1073 user: test <test@example.com>
1077 user: test <test@example.com>
1074 date: Sun Sep 09 01:46:40 2001 +0000
1078 date: Sun Sep 09 01:46:40 2001 +0000
1075 extra: branch=default
1079 extra: branch=default
1076 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1080 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1077 extra: extra-1=extra-1
1081 extra: extra-1=extra-1
1078 description:
1082 description:
1079 message with extras
1083 message with extras
1080
1084
1081
1085
1082
1086
1083 Converting multiple extras works
1087 Converting multiple extras works
1084
1088
1085 $ hg convert --config convert.git.extrakeys=extra-1,extra-2 gitextras hgextras3
1089 $ hg convert --config convert.git.extrakeys=extra-1,extra-2 gitextras hgextras3
1086 initializing destination hgextras3 repository
1090 initializing destination hgextras3 repository
1087 scanning source...
1091 scanning source...
1088 sorting...
1092 sorting...
1089 converting...
1093 converting...
1090 1 initial
1094 1 initial
1091 0 message with extras
1095 0 message with extras
1092 updating bookmarks
1096 updating bookmarks
1093
1097
1094 $ hg -R hgextras3 log --debug -r 1
1098 $ hg -R hgextras3 log --debug -r 1
1095 changeset: 1:0105af33379e7b6491501fd34141b7af700fe125
1099 changeset: 1:0105af33379e7b6491501fd34141b7af700fe125
1096 bookmark: master
1100 bookmark: master
1097 tag: tip
1101 tag: tip
1098 phase: draft
1102 phase: draft
1099 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1103 parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9
1100 parent: -1:0000000000000000000000000000000000000000
1104 parent: -1:0000000000000000000000000000000000000000
1101 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1105 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1102 user: test <test@example.com>
1106 user: test <test@example.com>
1103 date: Sun Sep 09 01:46:40 2001 +0000
1107 date: Sun Sep 09 01:46:40 2001 +0000
1104 extra: branch=default
1108 extra: branch=default
1105 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1109 extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18
1106 extra: extra-1=extra-1
1110 extra: extra-1=extra-1
1107 extra: extra-2=extra-2 with space
1111 extra: extra-2=extra-2 with space
1108 description:
1112 description:
1109 message with extras
1113 message with extras
1110
1114
1111
1115
1112
1116
1113 convert.git.saverev can be disabled to prevent convert_revision from being written
1117 convert.git.saverev can be disabled to prevent convert_revision from being written
1114
1118
1115 $ hg convert --config convert.git.saverev=false gitextras hgextras4
1119 $ hg convert --config convert.git.saverev=false gitextras hgextras4
1116 initializing destination hgextras4 repository
1120 initializing destination hgextras4 repository
1117 scanning source...
1121 scanning source...
1118 sorting...
1122 sorting...
1119 converting...
1123 converting...
1120 1 initial
1124 1 initial
1121 0 message with extras
1125 0 message with extras
1122 updating bookmarks
1126 updating bookmarks
1123
1127
1124 $ hg -R hgextras4 log --debug -r 1
1128 $ hg -R hgextras4 log --debug -r 1
1125 changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c
1129 changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c
1126 bookmark: master
1130 bookmark: master
1127 tag: tip
1131 tag: tip
1128 phase: draft
1132 phase: draft
1129 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1133 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1130 parent: -1:0000000000000000000000000000000000000000
1134 parent: -1:0000000000000000000000000000000000000000
1131 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1135 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1132 user: test <test@example.com>
1136 user: test <test@example.com>
1133 date: Sun Sep 09 01:46:40 2001 +0000
1137 date: Sun Sep 09 01:46:40 2001 +0000
1134 extra: branch=default
1138 extra: branch=default
1135 description:
1139 description:
1136 message with extras
1140 message with extras
1137
1141
1138
1142
1139
1143
1140 convert.git.saverev and convert.git.extrakeys can be combined to preserve
1144 convert.git.saverev and convert.git.extrakeys can be combined to preserve
1141 convert_revision from source
1145 convert_revision from source
1142
1146
1143 $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5
1147 $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5
1144 initializing destination hgextras5 repository
1148 initializing destination hgextras5 repository
1145 scanning source...
1149 scanning source...
1146 sorting...
1150 sorting...
1147 converting...
1151 converting...
1148 1 initial
1152 1 initial
1149 0 message with extras
1153 0 message with extras
1150 updating bookmarks
1154 updating bookmarks
1151
1155
1152 $ hg -R hgextras5 log --debug -r 1
1156 $ hg -R hgextras5 log --debug -r 1
1153 changeset: 1:574d85931544d4542007664fee3747360e85ee28
1157 changeset: 1:574d85931544d4542007664fee3747360e85ee28
1154 bookmark: master
1158 bookmark: master
1155 tag: tip
1159 tag: tip
1156 phase: draft
1160 phase: draft
1157 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1161 parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d
1158 parent: -1:0000000000000000000000000000000000000000
1162 parent: -1:0000000000000000000000000000000000000000
1159 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1163 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50
1160 user: test <test@example.com>
1164 user: test <test@example.com>
1161 date: Sun Sep 09 01:46:40 2001 +0000
1165 date: Sun Sep 09 01:46:40 2001 +0000
1162 extra: branch=default
1166 extra: branch=default
1163 extra: convert_revision=0000aaaabbbbccccddddeeee
1167 extra: convert_revision=0000aaaabbbbccccddddeeee
1164 description:
1168 description:
1165 message with extras
1169 message with extras
1166
1170
1167
1171
@@ -1,53 +1,56 b''
1 #require svn13
1 #require svn13
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > mq =
5 > mq =
6 > [diff]
6 > [diff]
7 > nodates = 1
7 > nodates = 1
8 > [subrepos]
9 > allowed = true
10 > svn:allowed = true
8 > EOF
11 > EOF
9
12
10 fn to create new repository, and cd into it
13 fn to create new repository, and cd into it
11 $ mkrepo() {
14 $ mkrepo() {
12 > hg init $1
15 > hg init $1
13 > cd $1
16 > cd $1
14 > hg qinit
17 > hg qinit
15 > }
18 > }
16
19
17
20
18 handle svn subrepos safely
21 handle svn subrepos safely
19
22
20 $ svnadmin create svn-repo-2499
23 $ svnadmin create svn-repo-2499
21
24
22 $ SVNREPOPATH=`pwd`/svn-repo-2499/project
25 $ SVNREPOPATH=`pwd`/svn-repo-2499/project
23 #if windows
26 #if windows
24 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
27 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
25 #else
28 #else
26 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
29 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
27 #endif
30 #endif
28
31
29 $ mkdir -p svn-project-2499/trunk
32 $ mkdir -p svn-project-2499/trunk
30 $ svn import -qm 'init project' svn-project-2499 "$SVNREPOURL"
33 $ svn import -qm 'init project' svn-project-2499 "$SVNREPOURL"
31
34
32 qnew on repo w/svn subrepo
35 qnew on repo w/svn subrepo
33 $ mkrepo repo-2499-svn-subrepo
36 $ mkrepo repo-2499-svn-subrepo
34 $ svn co "$SVNREPOURL"/trunk sub
37 $ svn co "$SVNREPOURL"/trunk sub
35 Checked out revision 1.
38 Checked out revision 1.
36 $ echo 'sub = [svn]sub' >> .hgsub
39 $ echo 'sub = [svn]sub' >> .hgsub
37 $ hg add .hgsub
40 $ hg add .hgsub
38 $ hg status -S -X '**/format'
41 $ hg status -S -X '**/format'
39 A .hgsub
42 A .hgsub
40 $ hg qnew -m0 0.diff
43 $ hg qnew -m0 0.diff
41 $ cd sub
44 $ cd sub
42 $ echo a > a
45 $ echo a > a
43 $ svn add a
46 $ svn add a
44 A a
47 A a
45 $ svn st
48 $ svn st
46 A* a (glob)
49 A* a (glob)
47 $ cd ..
50 $ cd ..
48 $ hg status -S # doesn't show status for svn subrepos (yet)
51 $ hg status -S # doesn't show status for svn subrepos (yet)
49 $ hg qnew -m1 1.diff
52 $ hg qnew -m1 1.diff
50 abort: uncommitted changes in subrepository "sub"
53 abort: uncommitted changes in subrepository "sub"
51 [255]
54 [255]
52
55
53 $ cd ..
56 $ cd ..
@@ -1,1216 +1,1254 b''
1 #require git
1 #require git
2
2
3 make git commits repeatable
3 make git commits repeatable
4
4
5 $ cat >> $HGRCPATH <<EOF
5 $ cat >> $HGRCPATH <<EOF
6 > [defaults]
6 > [defaults]
7 > commit = -d "0 0"
7 > commit = -d "0 0"
8 > EOF
8 > EOF
9
9
10 $ echo "[core]" >> $HOME/.gitconfig
10 $ echo "[core]" >> $HOME/.gitconfig
11 $ echo "autocrlf = false" >> $HOME/.gitconfig
11 $ echo "autocrlf = false" >> $HOME/.gitconfig
12 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
12 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
13 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
13 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
14 $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE
14 $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE
15 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
15 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
16 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
16 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
17 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
17 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
18 $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
18 $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
19
19
20 root hg repo
20 root hg repo
21
21
22 $ hg init t
22 $ hg init t
23 $ cd t
23 $ cd t
24 $ echo a > a
24 $ echo a > a
25 $ hg add a
25 $ hg add a
26 $ hg commit -m a
26 $ hg commit -m a
27 $ cd ..
27 $ cd ..
28
28
29 new external git repo
29 new external git repo
30
30
31 $ mkdir gitroot
31 $ mkdir gitroot
32 $ cd gitroot
32 $ cd gitroot
33 $ git init -q
33 $ git init -q
34 $ echo g > g
34 $ echo g > g
35 $ git add g
35 $ git add g
36 $ git commit -q -m g
36 $ git commit -q -m g
37
37
38 add subrepo clone
38 add subrepo clone
39
39
40 $ cd ../t
40 $ cd ../t
41 $ echo 's = [git]../gitroot' > .hgsub
41 $ echo 's = [git]../gitroot' > .hgsub
42 $ git clone -q ../gitroot s
42 $ git clone -q ../gitroot s
43 $ hg add .hgsub
43 $ hg add .hgsub
44
45 git subrepo is disabled by default
46
44 $ hg commit -m 'new git subrepo'
47 $ hg commit -m 'new git subrepo'
48 abort: git subrepos not allowed
49 (see 'hg help config.subrepos' for details)
50 [255]
51
52 so enable it
53
54 $ cat >> $HGRCPATH <<EOF
55 > [subrepos]
56 > git:allowed = true
57 > EOF
58
59 $ hg commit -m 'new git subrepo'
60
45 $ hg debugsub
61 $ hg debugsub
46 path s
62 path s
47 source ../gitroot
63 source ../gitroot
48 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
64 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
49
65
50 record a new commit from upstream from a different branch
66 record a new commit from upstream from a different branch
51
67
52 $ cd ../gitroot
68 $ cd ../gitroot
53 $ git checkout -q -b testing
69 $ git checkout -q -b testing
54 $ echo gg >> g
70 $ echo gg >> g
55 $ git commit -q -a -m gg
71 $ git commit -q -a -m gg
56
72
57 $ cd ../t/s
73 $ cd ../t/s
58 $ git pull -q >/dev/null 2>/dev/null
74 $ git pull -q >/dev/null 2>/dev/null
59 $ git checkout -q -b testing origin/testing >/dev/null
75 $ git checkout -q -b testing origin/testing >/dev/null
60
76
61 $ cd ..
77 $ cd ..
62 $ hg status --subrepos
78 $ hg status --subrepos
63 M s/g
79 M s/g
64 $ hg commit -m 'update git subrepo'
80 $ hg commit -m 'update git subrepo'
65 $ hg debugsub
81 $ hg debugsub
66 path s
82 path s
67 source ../gitroot
83 source ../gitroot
68 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
84 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
69
85
70 make $GITROOT pushable, by replacing it with a clone with nothing checked out
86 make $GITROOT pushable, by replacing it with a clone with nothing checked out
71
87
72 $ cd ..
88 $ cd ..
73 $ git clone gitroot gitrootbare --bare -q
89 $ git clone gitroot gitrootbare --bare -q
74 $ rm -rf gitroot
90 $ rm -rf gitroot
75 $ mv gitrootbare gitroot
91 $ mv gitrootbare gitroot
76
92
77 clone root
93 clone root
78
94
79 $ cd t
95 $ cd t
80 $ hg clone . ../tc 2> /dev/null
96 $ hg clone . ../tc 2> /dev/null
81 updating to branch default
97 updating to branch default
82 cloning subrepo s from $TESTTMP/gitroot
98 cloning subrepo s from $TESTTMP/gitroot
83 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 $ cd ../tc
100 $ cd ../tc
85 $ hg debugsub
101 $ hg debugsub
86 path s
102 path s
87 source ../gitroot
103 source ../gitroot
88 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
104 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
105 $ cd ..
106
107 clone with subrepo disabled (update should fail)
108
109 $ hg clone t -U tc2 --config subrepos.allowed=false
110 $ hg update -R tc2 --config subrepos.allowed=false
111 abort: subrepos not enabled
112 (see 'hg help config.subrepos' for details)
113 [255]
114 $ ls tc2
115 a
116
117 $ hg clone t tc3 --config subrepos.allowed=false
118 updating to branch default
119 abort: subrepos not enabled
120 (see 'hg help config.subrepos' for details)
121 [255]
122 $ ls tc3
123 a
89
124
90 update to previous substate
125 update to previous substate
91
126
127 $ cd tc
92 $ hg update 1 -q
128 $ hg update 1 -q
93 $ cat s/g
129 $ cat s/g
94 g
130 g
95 $ hg debugsub
131 $ hg debugsub
96 path s
132 path s
97 source ../gitroot
133 source ../gitroot
98 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
134 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
99
135
100 clone root, make local change
136 clone root, make local change
101
137
102 $ cd ../t
138 $ cd ../t
103 $ hg clone . ../ta 2> /dev/null
139 $ hg clone . ../ta 2> /dev/null
104 updating to branch default
140 updating to branch default
105 cloning subrepo s from $TESTTMP/gitroot
141 cloning subrepo s from $TESTTMP/gitroot
106 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
142 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
107
143
108 $ cd ../ta
144 $ cd ../ta
109 $ echo ggg >> s/g
145 $ echo ggg >> s/g
110 $ hg status --subrepos
146 $ hg status --subrepos
111 M s/g
147 M s/g
112 $ hg diff --subrepos
148 $ hg diff --subrepos
113 diff --git a/s/g b/s/g
149 diff --git a/s/g b/s/g
114 index 089258f..85341ee 100644
150 index 089258f..85341ee 100644
115 --- a/s/g
151 --- a/s/g
116 +++ b/s/g
152 +++ b/s/g
117 @@ -1,2 +1,3 @@
153 @@ -1,2 +1,3 @@
118 g
154 g
119 gg
155 gg
120 +ggg
156 +ggg
121 $ hg commit --subrepos -m ggg
157 $ hg commit --subrepos -m ggg
122 committing subrepository s
158 committing subrepository s
123 $ hg debugsub
159 $ hg debugsub
124 path s
160 path s
125 source ../gitroot
161 source ../gitroot
126 revision 79695940086840c99328513acbe35f90fcd55e57
162 revision 79695940086840c99328513acbe35f90fcd55e57
127
163
128 clone root separately, make different local change
164 clone root separately, make different local change
129
165
130 $ cd ../t
166 $ cd ../t
131 $ hg clone . ../tb 2> /dev/null
167 $ hg clone . ../tb 2> /dev/null
132 updating to branch default
168 updating to branch default
133 cloning subrepo s from $TESTTMP/gitroot
169 cloning subrepo s from $TESTTMP/gitroot
134 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
135
171
136 $ cd ../tb/s
172 $ cd ../tb/s
137 $ hg status --subrepos
173 $ hg status --subrepos
138 $ echo f > f
174 $ echo f > f
139 $ hg status --subrepos
175 $ hg status --subrepos
140 ? s/f
176 ? s/f
141 $ hg add .
177 $ hg add .
142 adding f
178 adding f
143 $ git add f
179 $ git add f
144 $ cd ..
180 $ cd ..
145
181
146 $ hg status --subrepos
182 $ hg status --subrepos
147 A s/f
183 A s/f
148 $ hg commit --subrepos -m f
184 $ hg commit --subrepos -m f
149 committing subrepository s
185 committing subrepository s
150 $ hg debugsub
186 $ hg debugsub
151 path s
187 path s
152 source ../gitroot
188 source ../gitroot
153 revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
189 revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
154
190
155 user b push changes
191 user b push changes
156
192
157 $ hg push 2>/dev/null
193 $ hg push 2>/dev/null
158 pushing to $TESTTMP/t (glob)
194 pushing to $TESTTMP/t (glob)
159 pushing branch testing of subrepository "s"
195 pushing branch testing of subrepository "s"
160 searching for changes
196 searching for changes
161 adding changesets
197 adding changesets
162 adding manifests
198 adding manifests
163 adding file changes
199 adding file changes
164 added 1 changesets with 1 changes to 1 files
200 added 1 changesets with 1 changes to 1 files
165
201
166 user a pulls, merges, commits
202 user a pulls, merges, commits
167
203
168 $ cd ../ta
204 $ cd ../ta
169 $ hg pull
205 $ hg pull
170 pulling from $TESTTMP/t (glob)
206 pulling from $TESTTMP/t (glob)
171 searching for changes
207 searching for changes
172 adding changesets
208 adding changesets
173 adding manifests
209 adding manifests
174 adding file changes
210 adding file changes
175 added 1 changesets with 1 changes to 1 files (+1 heads)
211 added 1 changesets with 1 changes to 1 files (+1 heads)
176 new changesets 089416c11d73
212 new changesets 089416c11d73
177 (run 'hg heads' to see heads, 'hg merge' to merge)
213 (run 'hg heads' to see heads, 'hg merge' to merge)
178 $ hg merge 2>/dev/null
214 $ hg merge 2>/dev/null
179 subrepository s diverged (local revision: 7969594, remote revision: aa84837)
215 subrepository s diverged (local revision: 7969594, remote revision: aa84837)
180 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
216 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
181 pulling subrepo s from $TESTTMP/gitroot
217 pulling subrepo s from $TESTTMP/gitroot
182 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
183 (branch merge, don't forget to commit)
219 (branch merge, don't forget to commit)
184 $ hg st --subrepos s
220 $ hg st --subrepos s
185 A s/f
221 A s/f
186 $ cat s/f
222 $ cat s/f
187 f
223 f
188 $ cat s/g
224 $ cat s/g
189 g
225 g
190 gg
226 gg
191 ggg
227 ggg
192 $ hg commit --subrepos -m 'merge'
228 $ hg commit --subrepos -m 'merge'
193 committing subrepository s
229 committing subrepository s
194 $ hg status --subrepos --rev 1:5
230 $ hg status --subrepos --rev 1:5
195 M .hgsubstate
231 M .hgsubstate
196 M s/g
232 M s/g
197 A s/f
233 A s/f
198 $ hg debugsub
234 $ hg debugsub
199 path s
235 path s
200 source ../gitroot
236 source ../gitroot
201 revision f47b465e1bce645dbf37232a00574aa1546ca8d3
237 revision f47b465e1bce645dbf37232a00574aa1546ca8d3
202 $ hg push 2>/dev/null
238 $ hg push 2>/dev/null
203 pushing to $TESTTMP/t (glob)
239 pushing to $TESTTMP/t (glob)
204 pushing branch testing of subrepository "s"
240 pushing branch testing of subrepository "s"
205 searching for changes
241 searching for changes
206 adding changesets
242 adding changesets
207 adding manifests
243 adding manifests
208 adding file changes
244 adding file changes
209 added 2 changesets with 2 changes to 1 files
245 added 2 changesets with 2 changes to 1 files
210
246
211 make upstream git changes
247 make upstream git changes
212
248
213 $ cd ..
249 $ cd ..
214 $ git clone -q gitroot gitclone
250 $ git clone -q gitroot gitclone
215 $ cd gitclone
251 $ cd gitclone
216 $ echo ff >> f
252 $ echo ff >> f
217 $ git commit -q -a -m ff
253 $ git commit -q -a -m ff
218 $ echo fff >> f
254 $ echo fff >> f
219 $ git commit -q -a -m fff
255 $ git commit -q -a -m fff
220 $ git push origin testing 2>/dev/null
256 $ git push origin testing 2>/dev/null
221
257
222 make and push changes to hg without updating the subrepo
258 make and push changes to hg without updating the subrepo
223
259
224 $ cd ../t
260 $ cd ../t
225 $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
261 $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
226 updating to branch default
262 updating to branch default
227 cloning subrepo s from $TESTTMP/gitroot
263 cloning subrepo s from $TESTTMP/gitroot
228 checking out detached HEAD in subrepository "s"
264 checking out detached HEAD in subrepository "s"
229 check out a git branch if you intend to make changes
265 check out a git branch if you intend to make changes
230 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 $ cd ../td
267 $ cd ../td
232 $ echo aa >> a
268 $ echo aa >> a
233 $ hg commit -m aa
269 $ hg commit -m aa
234 $ hg push
270 $ hg push
235 pushing to $TESTTMP/t (glob)
271 pushing to $TESTTMP/t (glob)
236 searching for changes
272 searching for changes
237 adding changesets
273 adding changesets
238 adding manifests
274 adding manifests
239 adding file changes
275 adding file changes
240 added 1 changesets with 1 changes to 1 files
276 added 1 changesets with 1 changes to 1 files
241
277
242 sync to upstream git, distribute changes
278 sync to upstream git, distribute changes
243
279
244 $ cd ../ta
280 $ cd ../ta
245 $ hg pull -u -q
281 $ hg pull -u -q
246 $ cd s
282 $ cd s
247 $ git pull -q >/dev/null 2>/dev/null
283 $ git pull -q >/dev/null 2>/dev/null
248 $ cd ..
284 $ cd ..
249 $ hg commit -m 'git upstream sync'
285 $ hg commit -m 'git upstream sync'
250 $ hg debugsub
286 $ hg debugsub
251 path s
287 path s
252 source ../gitroot
288 source ../gitroot
253 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
289 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
254 $ hg push -q
290 $ hg push -q
255
291
256 $ cd ../tb
292 $ cd ../tb
257 $ hg pull -q
293 $ hg pull -q
258 $ hg update 2>/dev/null
294 $ hg update 2>/dev/null
259 pulling subrepo s from $TESTTMP/gitroot
295 pulling subrepo s from $TESTTMP/gitroot
260 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 $ hg debugsub
297 $ hg debugsub
262 path s
298 path s
263 source ../gitroot
299 source ../gitroot
264 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
300 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
265
301
266 create a new git branch
302 create a new git branch
267
303
268 $ cd s
304 $ cd s
269 $ git checkout -b b2
305 $ git checkout -b b2
270 Switched to a new branch 'b2'
306 Switched to a new branch 'b2'
271 $ echo a>a
307 $ echo a>a
272 $ git add a
308 $ git add a
273 $ git commit -qm 'add a'
309 $ git commit -qm 'add a'
274 $ cd ..
310 $ cd ..
275 $ hg commit -m 'add branch in s'
311 $ hg commit -m 'add branch in s'
276
312
277 pulling new git branch should not create tracking branch named 'origin/b2'
313 pulling new git branch should not create tracking branch named 'origin/b2'
278 (issue3870)
314 (issue3870)
279 $ cd ../td/s
315 $ cd ../td/s
280 $ git remote set-url origin $TESTTMP/tb/s
316 $ git remote set-url origin $TESTTMP/tb/s
281 $ git branch --no-track oldtesting
317 $ git branch --no-track oldtesting
282 $ cd ..
318 $ cd ..
283 $ hg pull -q ../tb
319 $ hg pull -q ../tb
284 $ hg up
320 $ hg up
285 From $TESTTMP/tb/s
321 From $TESTTMP/tb/s
286 * [new branch] b2 -> origin/b2
322 * [new branch] b2 -> origin/b2
287 Previous HEAD position was f47b465... merge
323 Previous HEAD position was f47b465... merge
288 Switched to a new branch 'b2'
324 Switched to a new branch 'b2'
289 pulling subrepo s from $TESTTMP/tb/s
325 pulling subrepo s from $TESTTMP/tb/s
290 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
326 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
291
327
292 update to a revision without the subrepo, keeping the local git repository
328 update to a revision without the subrepo, keeping the local git repository
293
329
294 $ cd ../t
330 $ cd ../t
295 $ hg up 0
331 $ hg up 0
296 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
332 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
297 $ ls -a s
333 $ ls -a s
298 .
334 .
299 ..
335 ..
300 .git
336 .git
301
337
302 $ hg up 2
338 $ hg up 2
303 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
339 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
304 $ ls -a s
340 $ ls -a s
305 .
341 .
306 ..
342 ..
307 .git
343 .git
308 g
344 g
309
345
310 archive subrepos
346 archive subrepos
311
347
312 $ cd ../tc
348 $ cd ../tc
313 $ hg pull -q
349 $ hg pull -q
314 $ hg archive --subrepos -r 5 ../archive 2>/dev/null
350 $ hg archive --subrepos -r 5 ../archive 2>/dev/null
315 pulling subrepo s from $TESTTMP/gitroot
351 pulling subrepo s from $TESTTMP/gitroot
316 $ cd ../archive
352 $ cd ../archive
317 $ cat s/f
353 $ cat s/f
318 f
354 f
319 $ cat s/g
355 $ cat s/g
320 g
356 g
321 gg
357 gg
322 ggg
358 ggg
323
359
324 $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null
360 $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null
325 $ find ../archive_x | sort | grep -v pax_global_header
361 $ find ../archive_x | sort | grep -v pax_global_header
326 ../archive_x
362 ../archive_x
327 ../archive_x/.hg_archival.txt
363 ../archive_x/.hg_archival.txt
328 ../archive_x/.hgsub
364 ../archive_x/.hgsub
329 ../archive_x/.hgsubstate
365 ../archive_x/.hgsubstate
330 ../archive_x/a
366 ../archive_x/a
331 ../archive_x/s
367 ../archive_x/s
332 ../archive_x/s/g
368 ../archive_x/s/g
333
369
334 $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null
370 $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null
335 $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header
371 $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header
336 .hg_archival.txt
372 .hg_archival.txt
337 .hgsub
373 .hgsub
338 .hgsubstate
374 .hgsubstate
339 a
375 a
340 s/g
376 s/g
341
377
342 create nested repo
378 create nested repo
343
379
344 $ cd ..
380 $ cd ..
345 $ hg init outer
381 $ hg init outer
346 $ cd outer
382 $ cd outer
347 $ echo b>b
383 $ echo b>b
348 $ hg add b
384 $ hg add b
349 $ hg commit -m b
385 $ hg commit -m b
350
386
351 $ hg clone ../t inner 2> /dev/null
387 $ hg clone ../t inner 2> /dev/null
352 updating to branch default
388 updating to branch default
353 cloning subrepo s from $TESTTMP/gitroot
389 cloning subrepo s from $TESTTMP/gitroot
354 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
355 $ echo inner = inner > .hgsub
391 $ echo inner = inner > .hgsub
356 $ hg add .hgsub
392 $ hg add .hgsub
357 $ hg commit -m 'nested sub'
393 $ hg commit -m 'nested sub'
358
394
359 nested commit
395 nested commit
360
396
361 $ echo ffff >> inner/s/f
397 $ echo ffff >> inner/s/f
362 $ hg status --subrepos
398 $ hg status --subrepos
363 M inner/s/f
399 M inner/s/f
364 $ hg commit --subrepos -m nested
400 $ hg commit --subrepos -m nested
365 committing subrepository inner
401 committing subrepository inner
366 committing subrepository inner/s (glob)
402 committing subrepository inner/s (glob)
367
403
368 nested archive
404 nested archive
369
405
370 $ hg archive --subrepos ../narchive
406 $ hg archive --subrepos ../narchive
371 $ ls ../narchive/inner/s | grep -v pax_global_header
407 $ ls ../narchive/inner/s | grep -v pax_global_header
372 f
408 f
373 g
409 g
374
410
375 relative source expansion
411 relative source expansion
376
412
377 $ cd ..
413 $ cd ..
378 $ mkdir d
414 $ mkdir d
379 $ hg clone t d/t 2> /dev/null
415 $ hg clone t d/t 2> /dev/null
380 updating to branch default
416 updating to branch default
381 cloning subrepo s from $TESTTMP/gitroot
417 cloning subrepo s from $TESTTMP/gitroot
382 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
418 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
383
419
384 Don't crash if the subrepo is missing
420 Don't crash if the subrepo is missing
385
421
386 $ hg clone t missing -q
422 $ hg clone t missing -q
387 $ cd missing
423 $ cd missing
388 $ rm -rf s
424 $ rm -rf s
389 $ hg status -S
425 $ hg status -S
390 $ hg sum | grep commit
426 $ hg sum | grep commit
391 commit: 1 subrepos
427 commit: 1 subrepos
392 $ hg push -q
428 $ hg push -q
393 abort: subrepo s is missing (in subrepository "s")
429 abort: subrepo s is missing (in subrepository "s")
394 [255]
430 [255]
395 $ hg commit --subrepos -qm missing
431 $ hg commit --subrepos -qm missing
396 abort: subrepo s is missing (in subrepository "s")
432 abort: subrepo s is missing (in subrepository "s")
397 [255]
433 [255]
398
434
399 #if symlink
435 #if symlink
400 Don't crash if subrepo is a broken symlink
436 Don't crash if subrepo is a broken symlink
401 $ ln -s broken s
437 $ ln -s broken s
402 $ hg status -S
438 $ hg status -S
439 abort: subrepo 's' traverses symbolic link
440 [255]
403 $ hg push -q
441 $ hg push -q
404 abort: subrepo s is missing (in subrepository "s")
442 abort: subrepo 's' traverses symbolic link
405 [255]
443 [255]
406 $ hg commit --subrepos -qm missing
444 $ hg commit --subrepos -qm missing
407 abort: subrepo s is missing (in subrepository "s")
445 abort: subrepo 's' traverses symbolic link
408 [255]
446 [255]
409 $ rm s
447 $ rm s
410 #endif
448 #endif
411
449
412 $ hg update -C 2> /dev/null
450 $ hg update -C 2> /dev/null
413 cloning subrepo s from $TESTTMP/gitroot
451 cloning subrepo s from $TESTTMP/gitroot
414 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
452 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
415 $ hg sum | grep commit
453 $ hg sum | grep commit
416 commit: (clean)
454 commit: (clean)
417
455
418 Don't crash if the .hgsubstate entry is missing
456 Don't crash if the .hgsubstate entry is missing
419
457
420 $ hg update 1 -q
458 $ hg update 1 -q
421 $ hg rm .hgsubstate
459 $ hg rm .hgsubstate
422 $ hg commit .hgsubstate -m 'no substate'
460 $ hg commit .hgsubstate -m 'no substate'
423 nothing changed
461 nothing changed
424 [1]
462 [1]
425 $ hg tag -l nosubstate
463 $ hg tag -l nosubstate
426 $ hg manifest
464 $ hg manifest
427 .hgsub
465 .hgsub
428 .hgsubstate
466 .hgsubstate
429 a
467 a
430
468
431 $ hg status -S
469 $ hg status -S
432 R .hgsubstate
470 R .hgsubstate
433 $ hg sum | grep commit
471 $ hg sum | grep commit
434 commit: 1 removed, 1 subrepos (new branch head)
472 commit: 1 removed, 1 subrepos (new branch head)
435
473
436 $ hg commit -m 'restore substate'
474 $ hg commit -m 'restore substate'
437 nothing changed
475 nothing changed
438 [1]
476 [1]
439 $ hg manifest
477 $ hg manifest
440 .hgsub
478 .hgsub
441 .hgsubstate
479 .hgsubstate
442 a
480 a
443 $ hg sum | grep commit
481 $ hg sum | grep commit
444 commit: 1 removed, 1 subrepos (new branch head)
482 commit: 1 removed, 1 subrepos (new branch head)
445
483
446 $ hg update -qC nosubstate
484 $ hg update -qC nosubstate
447 $ ls s
485 $ ls s
448 g
486 g
449
487
450 issue3109: false positives in git diff-index
488 issue3109: false positives in git diff-index
451
489
452 $ hg update -q
490 $ hg update -q
453 $ touch -t 200001010000 s/g
491 $ touch -t 200001010000 s/g
454 $ hg status --subrepos
492 $ hg status --subrepos
455 $ touch -t 200001010000 s/g
493 $ touch -t 200001010000 s/g
456 $ hg sum | grep commit
494 $ hg sum | grep commit
457 commit: (clean)
495 commit: (clean)
458
496
459 Check hg update --clean
497 Check hg update --clean
460 $ cd $TESTTMP/ta
498 $ cd $TESTTMP/ta
461 $ echo > s/g
499 $ echo > s/g
462 $ cd s
500 $ cd s
463 $ echo c1 > f1
501 $ echo c1 > f1
464 $ echo c1 > f2
502 $ echo c1 > f2
465 $ git add f1
503 $ git add f1
466 $ cd ..
504 $ cd ..
467 $ hg status -S
505 $ hg status -S
468 M s/g
506 M s/g
469 A s/f1
507 A s/f1
470 ? s/f2
508 ? s/f2
471 $ ls s
509 $ ls s
472 f
510 f
473 f1
511 f1
474 f2
512 f2
475 g
513 g
476 $ hg update --clean
514 $ hg update --clean
477 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
515 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
478 $ hg status -S
516 $ hg status -S
479 ? s/f1
517 ? s/f1
480 ? s/f2
518 ? s/f2
481 $ ls s
519 $ ls s
482 f
520 f
483 f1
521 f1
484 f2
522 f2
485 g
523 g
486
524
487 Sticky subrepositories, no changes
525 Sticky subrepositories, no changes
488 $ cd $TESTTMP/ta
526 $ cd $TESTTMP/ta
489 $ hg id -n
527 $ hg id -n
490 7
528 7
491 $ cd s
529 $ cd s
492 $ git rev-parse HEAD
530 $ git rev-parse HEAD
493 32a343883b74769118bb1d3b4b1fbf9156f4dddc
531 32a343883b74769118bb1d3b4b1fbf9156f4dddc
494 $ cd ..
532 $ cd ..
495 $ hg update 1 > /dev/null 2>&1
533 $ hg update 1 > /dev/null 2>&1
496 $ hg id -n
534 $ hg id -n
497 1
535 1
498 $ cd s
536 $ cd s
499 $ git rev-parse HEAD
537 $ git rev-parse HEAD
500 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
538 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
501 $ cd ..
539 $ cd ..
502
540
503 Sticky subrepositories, file changes
541 Sticky subrepositories, file changes
504 $ touch s/f1
542 $ touch s/f1
505 $ cd s
543 $ cd s
506 $ git add f1
544 $ git add f1
507 $ cd ..
545 $ cd ..
508 $ hg id -n
546 $ hg id -n
509 1+
547 1+
510 $ cd s
548 $ cd s
511 $ git rev-parse HEAD
549 $ git rev-parse HEAD
512 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
550 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
513 $ cd ..
551 $ cd ..
514 $ hg update 4
552 $ hg update 4
515 subrepository s diverged (local revision: da5f5b1, remote revision: aa84837)
553 subrepository s diverged (local revision: da5f5b1, remote revision: aa84837)
516 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
554 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
517 subrepository sources for s differ
555 subrepository sources for s differ
518 use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l
556 use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l
519 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
557 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 $ hg id -n
558 $ hg id -n
521 4+
559 4+
522 $ cd s
560 $ cd s
523 $ git rev-parse HEAD
561 $ git rev-parse HEAD
524 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
562 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
525 $ cd ..
563 $ cd ..
526 $ hg update --clean tip > /dev/null 2>&1
564 $ hg update --clean tip > /dev/null 2>&1
527
565
528 Sticky subrepository, revision updates
566 Sticky subrepository, revision updates
529 $ hg id -n
567 $ hg id -n
530 7
568 7
531 $ cd s
569 $ cd s
532 $ git rev-parse HEAD
570 $ git rev-parse HEAD
533 32a343883b74769118bb1d3b4b1fbf9156f4dddc
571 32a343883b74769118bb1d3b4b1fbf9156f4dddc
534 $ cd ..
572 $ cd ..
535 $ cd s
573 $ cd s
536 $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
574 $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
537 Previous HEAD position was 32a3438... fff
575 Previous HEAD position was 32a3438... fff
538 HEAD is now at aa84837... f
576 HEAD is now at aa84837... f
539 $ cd ..
577 $ cd ..
540 $ hg update 1
578 $ hg update 1
541 subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1)
579 subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1)
542 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
580 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
543 subrepository sources for s differ (in checked out version)
581 subrepository sources for s differ (in checked out version)
544 use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l
582 use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l
545 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
546 $ hg id -n
584 $ hg id -n
547 1+
585 1+
548 $ cd s
586 $ cd s
549 $ git rev-parse HEAD
587 $ git rev-parse HEAD
550 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
588 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
551 $ cd ..
589 $ cd ..
552
590
553 Sticky subrepository, file changes and revision updates
591 Sticky subrepository, file changes and revision updates
554 $ touch s/f1
592 $ touch s/f1
555 $ cd s
593 $ cd s
556 $ git add f1
594 $ git add f1
557 $ git rev-parse HEAD
595 $ git rev-parse HEAD
558 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
596 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
559 $ cd ..
597 $ cd ..
560 $ hg id -n
598 $ hg id -n
561 1+
599 1+
562 $ hg update 7
600 $ hg update 7
563 subrepository s diverged (local revision: 32a3438, remote revision: 32a3438)
601 subrepository s diverged (local revision: 32a3438, remote revision: 32a3438)
564 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
602 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
565 subrepository sources for s differ
603 subrepository sources for s differ
566 use (l)ocal source (32a3438) or (r)emote source (32a3438)? l
604 use (l)ocal source (32a3438) or (r)emote source (32a3438)? l
567 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
605 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
568 $ hg id -n
606 $ hg id -n
569 7+
607 7+
570 $ cd s
608 $ cd s
571 $ git rev-parse HEAD
609 $ git rev-parse HEAD
572 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
610 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
573 $ cd ..
611 $ cd ..
574
612
575 Sticky repository, update --clean
613 Sticky repository, update --clean
576 $ hg update --clean tip 2>/dev/null
614 $ hg update --clean tip 2>/dev/null
577 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
615 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
578 $ hg id -n
616 $ hg id -n
579 7
617 7
580 $ cd s
618 $ cd s
581 $ git rev-parse HEAD
619 $ git rev-parse HEAD
582 32a343883b74769118bb1d3b4b1fbf9156f4dddc
620 32a343883b74769118bb1d3b4b1fbf9156f4dddc
583 $ cd ..
621 $ cd ..
584
622
585 Test subrepo already at intended revision:
623 Test subrepo already at intended revision:
586 $ cd s
624 $ cd s
587 $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc
625 $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc
588 HEAD is now at 32a3438... fff
626 HEAD is now at 32a3438... fff
589 $ cd ..
627 $ cd ..
590 $ hg update 1
628 $ hg update 1
591 Previous HEAD position was 32a3438... fff
629 Previous HEAD position was 32a3438... fff
592 HEAD is now at da5f5b1... g
630 HEAD is now at da5f5b1... g
593 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
631 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
594 $ hg id -n
632 $ hg id -n
595 1
633 1
596 $ cd s
634 $ cd s
597 $ git rev-parse HEAD
635 $ git rev-parse HEAD
598 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
636 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
599 $ cd ..
637 $ cd ..
600
638
601 Test forgetting files, not implemented in git subrepo, used to
639 Test forgetting files, not implemented in git subrepo, used to
602 traceback
640 traceback
603 #if no-windows
641 #if no-windows
604 $ hg forget 'notafile*'
642 $ hg forget 'notafile*'
605 notafile*: No such file or directory
643 notafile*: No such file or directory
606 [1]
644 [1]
607 #else
645 #else
608 $ hg forget 'notafile'
646 $ hg forget 'notafile'
609 notafile: * (glob)
647 notafile: * (glob)
610 [1]
648 [1]
611 #endif
649 #endif
612
650
613 $ cd ..
651 $ cd ..
614
652
615 Test sanitizing ".hg/hgrc" in subrepo
653 Test sanitizing ".hg/hgrc" in subrepo
616
654
617 $ cd t
655 $ cd t
618 $ hg tip -q
656 $ hg tip -q
619 7:af6d2edbb0d3
657 7:af6d2edbb0d3
620 $ hg update -q -C af6d2edbb0d3
658 $ hg update -q -C af6d2edbb0d3
621 $ cd s
659 $ cd s
622 $ git checkout -q -b sanitize-test
660 $ git checkout -q -b sanitize-test
623 $ mkdir .hg
661 $ mkdir .hg
624 $ echo '.hg/hgrc in git repo' > .hg/hgrc
662 $ echo '.hg/hgrc in git repo' > .hg/hgrc
625 $ mkdir -p sub/.hg
663 $ mkdir -p sub/.hg
626 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
664 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
627 $ git add .hg sub
665 $ git add .hg sub
628 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update'
666 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update'
629 $ git push -q origin sanitize-test
667 $ git push -q origin sanitize-test
630 $ cd ..
668 $ cd ..
631 $ grep ' s$' .hgsubstate
669 $ grep ' s$' .hgsubstate
632 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
670 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
633 $ hg commit -qm 'commit with git revision including .hg/hgrc'
671 $ hg commit -qm 'commit with git revision including .hg/hgrc'
634 $ hg parents -q
672 $ hg parents -q
635 8:3473d20bddcf
673 8:3473d20bddcf
636 $ grep ' s$' .hgsubstate
674 $ grep ' s$' .hgsubstate
637 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
675 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
638 $ cd ..
676 $ cd ..
639
677
640 $ hg -R tc pull -q
678 $ hg -R tc pull -q
641 $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
679 $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
642 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
680 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
643 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
681 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
644 $ cd tc
682 $ cd tc
645 $ hg parents -q
683 $ hg parents -q
646 8:3473d20bddcf
684 8:3473d20bddcf
647 $ grep ' s$' .hgsubstate
685 $ grep ' s$' .hgsubstate
648 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
686 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
649 $ test -f s/.hg/hgrc
687 $ test -f s/.hg/hgrc
650 [1]
688 [1]
651 $ test -f s/sub/.hg/hgrc
689 $ test -f s/sub/.hg/hgrc
652 [1]
690 [1]
653 $ cd ..
691 $ cd ..
654
692
655 additional test for "git merge --ff" route:
693 additional test for "git merge --ff" route:
656
694
657 $ cd t
695 $ cd t
658 $ hg tip -q
696 $ hg tip -q
659 8:3473d20bddcf
697 8:3473d20bddcf
660 $ hg update -q -C af6d2edbb0d3
698 $ hg update -q -C af6d2edbb0d3
661 $ cd s
699 $ cd s
662 $ git checkout -q testing
700 $ git checkout -q testing
663 $ mkdir .hg
701 $ mkdir .hg
664 $ echo '.hg/hgrc in git repo' > .hg/hgrc
702 $ echo '.hg/hgrc in git repo' > .hg/hgrc
665 $ mkdir -p sub/.hg
703 $ mkdir -p sub/.hg
666 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
704 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
667 $ git add .hg sub
705 $ git add .hg sub
668 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)'
706 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)'
669 $ git push -q origin testing
707 $ git push -q origin testing
670 $ cd ..
708 $ cd ..
671 $ grep ' s$' .hgsubstate
709 $ grep ' s$' .hgsubstate
672 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
710 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
673 $ hg commit -qm 'commit with git revision including .hg/hgrc'
711 $ hg commit -qm 'commit with git revision including .hg/hgrc'
674 $ hg parents -q
712 $ hg parents -q
675 9:ed23f7fe024e
713 9:ed23f7fe024e
676 $ grep ' s$' .hgsubstate
714 $ grep ' s$' .hgsubstate
677 f262643c1077219fbd3858d54e78ef050ef84fbf s
715 f262643c1077219fbd3858d54e78ef050ef84fbf s
678 $ cd ..
716 $ cd ..
679
717
680 $ cd tc
718 $ cd tc
681 $ hg update -q -C af6d2edbb0d3
719 $ hg update -q -C af6d2edbb0d3
682 $ test -f s/.hg/hgrc
720 $ test -f s/.hg/hgrc
683 [1]
721 [1]
684 $ test -f s/sub/.hg/hgrc
722 $ test -f s/sub/.hg/hgrc
685 [1]
723 [1]
686 $ cd ..
724 $ cd ..
687 $ hg -R tc pull -q
725 $ hg -R tc pull -q
688 $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
726 $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
689 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
727 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
690 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
728 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
691 $ cd tc
729 $ cd tc
692 $ hg parents -q
730 $ hg parents -q
693 9:ed23f7fe024e
731 9:ed23f7fe024e
694 $ grep ' s$' .hgsubstate
732 $ grep ' s$' .hgsubstate
695 f262643c1077219fbd3858d54e78ef050ef84fbf s
733 f262643c1077219fbd3858d54e78ef050ef84fbf s
696 $ test -f s/.hg/hgrc
734 $ test -f s/.hg/hgrc
697 [1]
735 [1]
698 $ test -f s/sub/.hg/hgrc
736 $ test -f s/sub/.hg/hgrc
699 [1]
737 [1]
700
738
701 Test that sanitizing is omitted in meta data area:
739 Test that sanitizing is omitted in meta data area:
702
740
703 $ mkdir s/.git/.hg
741 $ mkdir s/.git/.hg
704 $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
742 $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
705 $ hg update -q -C af6d2edbb0d3
743 $ hg update -q -C af6d2edbb0d3
706 checking out detached HEAD in subrepository "s"
744 checking out detached HEAD in subrepository "s"
707 check out a git branch if you intend to make changes
745 check out a git branch if you intend to make changes
708
746
709 check differences made by most recent change
747 check differences made by most recent change
710 $ cd s
748 $ cd s
711 $ cat > foobar << EOF
749 $ cat > foobar << EOF
712 > woopwoop
750 > woopwoop
713 >
751 >
714 > foo
752 > foo
715 > bar
753 > bar
716 > EOF
754 > EOF
717 $ git add foobar
755 $ git add foobar
718 $ cd ..
756 $ cd ..
719
757
720 $ hg diff --subrepos
758 $ hg diff --subrepos
721 diff --git a/s/foobar b/s/foobar
759 diff --git a/s/foobar b/s/foobar
722 new file mode 100644
760 new file mode 100644
723 index 0000000..8a5a5e2
761 index 0000000..8a5a5e2
724 --- /dev/null
762 --- /dev/null
725 +++ b/s/foobar
763 +++ b/s/foobar
726 @@ -0,0 +1,4 @@
764 @@ -0,0 +1,4 @@
727 +woopwoop
765 +woopwoop
728 +
766 +
729 +foo
767 +foo
730 +bar
768 +bar
731
769
732 $ hg commit --subrepos -m "Added foobar"
770 $ hg commit --subrepos -m "Added foobar"
733 committing subrepository s
771 committing subrepository s
734 created new head
772 created new head
735
773
736 $ hg diff -c . --subrepos --nodates
774 $ hg diff -c . --subrepos --nodates
737 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
775 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
738 --- a/.hgsubstate
776 --- a/.hgsubstate
739 +++ b/.hgsubstate
777 +++ b/.hgsubstate
740 @@ -1,1 +1,1 @@
778 @@ -1,1 +1,1 @@
741 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
779 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
742 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
780 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
743 diff --git a/s/foobar b/s/foobar
781 diff --git a/s/foobar b/s/foobar
744 new file mode 100644
782 new file mode 100644
745 index 0000000..8a5a5e2
783 index 0000000..8a5a5e2
746 --- /dev/null
784 --- /dev/null
747 +++ b/s/foobar
785 +++ b/s/foobar
748 @@ -0,0 +1,4 @@
786 @@ -0,0 +1,4 @@
749 +woopwoop
787 +woopwoop
750 +
788 +
751 +foo
789 +foo
752 +bar
790 +bar
753
791
754 check output when only diffing the subrepository
792 check output when only diffing the subrepository
755 $ hg diff -c . --subrepos s
793 $ hg diff -c . --subrepos s
756 diff --git a/s/foobar b/s/foobar
794 diff --git a/s/foobar b/s/foobar
757 new file mode 100644
795 new file mode 100644
758 index 0000000..8a5a5e2
796 index 0000000..8a5a5e2
759 --- /dev/null
797 --- /dev/null
760 +++ b/s/foobar
798 +++ b/s/foobar
761 @@ -0,0 +1,4 @@
799 @@ -0,0 +1,4 @@
762 +woopwoop
800 +woopwoop
763 +
801 +
764 +foo
802 +foo
765 +bar
803 +bar
766
804
767 check output when diffing something else
805 check output when diffing something else
768 $ hg diff -c . --subrepos .hgsubstate --nodates
806 $ hg diff -c . --subrepos .hgsubstate --nodates
769 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
807 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
770 --- a/.hgsubstate
808 --- a/.hgsubstate
771 +++ b/.hgsubstate
809 +++ b/.hgsubstate
772 @@ -1,1 +1,1 @@
810 @@ -1,1 +1,1 @@
773 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
811 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
774 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
812 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
775
813
776 add new changes, including whitespace
814 add new changes, including whitespace
777 $ cd s
815 $ cd s
778 $ cat > foobar << EOF
816 $ cat > foobar << EOF
779 > woop woop
817 > woop woop
780 >
818 >
781 > foo
819 > foo
782 > bar
820 > bar
783 > EOF
821 > EOF
784 $ echo foo > barfoo
822 $ echo foo > barfoo
785 $ git add barfoo
823 $ git add barfoo
786 $ cd ..
824 $ cd ..
787
825
788 $ hg diff --subrepos --ignore-all-space
826 $ hg diff --subrepos --ignore-all-space
789 diff --git a/s/barfoo b/s/barfoo
827 diff --git a/s/barfoo b/s/barfoo
790 new file mode 100644
828 new file mode 100644
791 index 0000000..257cc56
829 index 0000000..257cc56
792 --- /dev/null
830 --- /dev/null
793 +++ b/s/barfoo
831 +++ b/s/barfoo
794 @@ -0,0 +1* @@ (glob)
832 @@ -0,0 +1* @@ (glob)
795 +foo
833 +foo
796 $ hg diff --subrepos s/foobar
834 $ hg diff --subrepos s/foobar
797 diff --git a/s/foobar b/s/foobar
835 diff --git a/s/foobar b/s/foobar
798 index 8a5a5e2..bd5812a 100644
836 index 8a5a5e2..bd5812a 100644
799 --- a/s/foobar
837 --- a/s/foobar
800 +++ b/s/foobar
838 +++ b/s/foobar
801 @@ -1,4 +1,4 @@
839 @@ -1,4 +1,4 @@
802 -woopwoop
840 -woopwoop
803 +woop woop
841 +woop woop
804
842
805 foo
843 foo
806 bar
844 bar
807
845
808 execute a diffstat
846 execute a diffstat
809 the output contains a regex, because git 1.7.10 and 1.7.11
847 the output contains a regex, because git 1.7.10 and 1.7.11
810 change the amount of whitespace
848 change the amount of whitespace
811 $ hg diff --subrepos --stat
849 $ hg diff --subrepos --stat
812 \s*barfoo |\s*1 + (re)
850 \s*barfoo |\s*1 + (re)
813 \s*foobar |\s*2 +- (re)
851 \s*foobar |\s*2 +- (re)
814 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re)
852 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re)
815
853
816 adding an include should ignore the other elements
854 adding an include should ignore the other elements
817 $ hg diff --subrepos -I s/foobar
855 $ hg diff --subrepos -I s/foobar
818 diff --git a/s/foobar b/s/foobar
856 diff --git a/s/foobar b/s/foobar
819 index 8a5a5e2..bd5812a 100644
857 index 8a5a5e2..bd5812a 100644
820 --- a/s/foobar
858 --- a/s/foobar
821 +++ b/s/foobar
859 +++ b/s/foobar
822 @@ -1,4 +1,4 @@
860 @@ -1,4 +1,4 @@
823 -woopwoop
861 -woopwoop
824 +woop woop
862 +woop woop
825
863
826 foo
864 foo
827 bar
865 bar
828
866
829 adding an exclude should ignore this element
867 adding an exclude should ignore this element
830 $ hg diff --subrepos -X s/foobar
868 $ hg diff --subrepos -X s/foobar
831 diff --git a/s/barfoo b/s/barfoo
869 diff --git a/s/barfoo b/s/barfoo
832 new file mode 100644
870 new file mode 100644
833 index 0000000..257cc56
871 index 0000000..257cc56
834 --- /dev/null
872 --- /dev/null
835 +++ b/s/barfoo
873 +++ b/s/barfoo
836 @@ -0,0 +1* @@ (glob)
874 @@ -0,0 +1* @@ (glob)
837 +foo
875 +foo
838
876
839 moving a file should show a removal and an add
877 moving a file should show a removal and an add
840 $ hg revert --all
878 $ hg revert --all
841 reverting subrepo ../gitroot
879 reverting subrepo ../gitroot
842 $ cd s
880 $ cd s
843 $ git mv foobar woop
881 $ git mv foobar woop
844 $ cd ..
882 $ cd ..
845 $ hg diff --subrepos
883 $ hg diff --subrepos
846 diff --git a/s/foobar b/s/foobar
884 diff --git a/s/foobar b/s/foobar
847 deleted file mode 100644
885 deleted file mode 100644
848 index 8a5a5e2..0000000
886 index 8a5a5e2..0000000
849 --- a/s/foobar
887 --- a/s/foobar
850 +++ /dev/null
888 +++ /dev/null
851 @@ -1,4 +0,0 @@
889 @@ -1,4 +0,0 @@
852 -woopwoop
890 -woopwoop
853 -
891 -
854 -foo
892 -foo
855 -bar
893 -bar
856 diff --git a/s/woop b/s/woop
894 diff --git a/s/woop b/s/woop
857 new file mode 100644
895 new file mode 100644
858 index 0000000..8a5a5e2
896 index 0000000..8a5a5e2
859 --- /dev/null
897 --- /dev/null
860 +++ b/s/woop
898 +++ b/s/woop
861 @@ -0,0 +1,4 @@
899 @@ -0,0 +1,4 @@
862 +woopwoop
900 +woopwoop
863 +
901 +
864 +foo
902 +foo
865 +bar
903 +bar
866 $ rm s/woop
904 $ rm s/woop
867
905
868 revert the subrepository
906 revert the subrepository
869 $ hg revert --all
907 $ hg revert --all
870 reverting subrepo ../gitroot
908 reverting subrepo ../gitroot
871
909
872 $ hg status --subrepos
910 $ hg status --subrepos
873 ? s/barfoo
911 ? s/barfoo
874 ? s/foobar.orig
912 ? s/foobar.orig
875
913
876 $ mv s/foobar.orig s/foobar
914 $ mv s/foobar.orig s/foobar
877
915
878 $ hg revert --no-backup s
916 $ hg revert --no-backup s
879 reverting subrepo ../gitroot
917 reverting subrepo ../gitroot
880
918
881 $ hg status --subrepos
919 $ hg status --subrepos
882 ? s/barfoo
920 ? s/barfoo
883
921
884 revert moves orig files to the right place
922 revert moves orig files to the right place
885 $ echo 'bloop' > s/foobar
923 $ echo 'bloop' > s/foobar
886 $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
924 $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
887 reverting subrepo ../gitroot
925 reverting subrepo ../gitroot
888 creating directory: $TESTTMP/tc/.hg/origbackups (glob)
926 creating directory: $TESTTMP/tc/.hg/origbackups (glob)
889 saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar (glob)
927 saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar (glob)
890 $ ls .hg/origbackups
928 $ ls .hg/origbackups
891 foobar
929 foobar
892 $ rm -rf .hg/origbackups
930 $ rm -rf .hg/origbackups
893
931
894 show file at specific revision
932 show file at specific revision
895 $ cat > s/foobar << EOF
933 $ cat > s/foobar << EOF
896 > woop woop
934 > woop woop
897 > fooo bar
935 > fooo bar
898 > EOF
936 > EOF
899 $ hg commit --subrepos -m "updated foobar"
937 $ hg commit --subrepos -m "updated foobar"
900 committing subrepository s
938 committing subrepository s
901 $ cat > s/foobar << EOF
939 $ cat > s/foobar << EOF
902 > current foobar
940 > current foobar
903 > (should not be visible using hg cat)
941 > (should not be visible using hg cat)
904 > EOF
942 > EOF
905
943
906 $ hg cat -r . s/foobar
944 $ hg cat -r . s/foobar
907 woop woop
945 woop woop
908 fooo bar (no-eol)
946 fooo bar (no-eol)
909 $ hg cat -r "parents(.)" s/foobar > catparents
947 $ hg cat -r "parents(.)" s/foobar > catparents
910
948
911 $ mkdir -p tmp/s
949 $ mkdir -p tmp/s
912
950
913 $ hg cat -r "parents(.)" --output tmp/%% s/foobar
951 $ hg cat -r "parents(.)" --output tmp/%% s/foobar
914 $ diff tmp/% catparents
952 $ diff tmp/% catparents
915
953
916 $ hg cat -r "parents(.)" --output tmp/%s s/foobar
954 $ hg cat -r "parents(.)" --output tmp/%s s/foobar
917 $ diff tmp/foobar catparents
955 $ diff tmp/foobar catparents
918
956
919 $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar
957 $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar
920 $ diff tmp/s/otherfoobar catparents
958 $ diff tmp/s/otherfoobar catparents
921
959
922 $ hg cat -r "parents(.)" --output tmp/%p s/foobar
960 $ hg cat -r "parents(.)" --output tmp/%p s/foobar
923 $ diff tmp/s/foobar catparents
961 $ diff tmp/s/foobar catparents
924
962
925 $ hg cat -r "parents(.)" --output tmp/%H s/foobar
963 $ hg cat -r "parents(.)" --output tmp/%H s/foobar
926 $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents
964 $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents
927
965
928 $ hg cat -r "parents(.)" --output tmp/%R s/foobar
966 $ hg cat -r "parents(.)" --output tmp/%R s/foobar
929 $ diff tmp/10 catparents
967 $ diff tmp/10 catparents
930
968
931 $ hg cat -r "parents(.)" --output tmp/%h s/foobar
969 $ hg cat -r "parents(.)" --output tmp/%h s/foobar
932 $ diff tmp/255ee8cf690e catparents
970 $ diff tmp/255ee8cf690e catparents
933
971
934 $ rm tmp/10
972 $ rm tmp/10
935 $ hg cat -r "parents(.)" --output tmp/%r s/foobar
973 $ hg cat -r "parents(.)" --output tmp/%r s/foobar
936 $ diff tmp/10 catparents
974 $ diff tmp/10 catparents
937
975
938 $ mkdir tmp/tc
976 $ mkdir tmp/tc
939 $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar
977 $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar
940 $ diff tmp/tc/foobar catparents
978 $ diff tmp/tc/foobar catparents
941
979
942 cleanup
980 cleanup
943 $ rm -r tmp
981 $ rm -r tmp
944 $ rm catparents
982 $ rm catparents
945
983
946 add git files, using either files or patterns
984 add git files, using either files or patterns
947 $ echo "hsss! hsssssssh!" > s/snake.python
985 $ echo "hsss! hsssssssh!" > s/snake.python
948 $ echo "ccc" > s/c.c
986 $ echo "ccc" > s/c.c
949 $ echo "cpp" > s/cpp.cpp
987 $ echo "cpp" > s/cpp.cpp
950
988
951 $ hg add s/snake.python s/c.c s/cpp.cpp
989 $ hg add s/snake.python s/c.c s/cpp.cpp
952 $ hg st --subrepos s
990 $ hg st --subrepos s
953 M s/foobar
991 M s/foobar
954 A s/c.c
992 A s/c.c
955 A s/cpp.cpp
993 A s/cpp.cpp
956 A s/snake.python
994 A s/snake.python
957 ? s/barfoo
995 ? s/barfoo
958 $ hg revert s
996 $ hg revert s
959 reverting subrepo ../gitroot
997 reverting subrepo ../gitroot
960
998
961 $ hg add --subrepos "glob:**.python"
999 $ hg add --subrepos "glob:**.python"
962 adding s/snake.python (glob)
1000 adding s/snake.python (glob)
963 $ hg st --subrepos s
1001 $ hg st --subrepos s
964 A s/snake.python
1002 A s/snake.python
965 ? s/barfoo
1003 ? s/barfoo
966 ? s/c.c
1004 ? s/c.c
967 ? s/cpp.cpp
1005 ? s/cpp.cpp
968 ? s/foobar.orig
1006 ? s/foobar.orig
969 $ hg revert s
1007 $ hg revert s
970 reverting subrepo ../gitroot
1008 reverting subrepo ../gitroot
971
1009
972 $ hg add --subrepos s
1010 $ hg add --subrepos s
973 adding s/barfoo (glob)
1011 adding s/barfoo (glob)
974 adding s/c.c (glob)
1012 adding s/c.c (glob)
975 adding s/cpp.cpp (glob)
1013 adding s/cpp.cpp (glob)
976 adding s/foobar.orig (glob)
1014 adding s/foobar.orig (glob)
977 adding s/snake.python (glob)
1015 adding s/snake.python (glob)
978 $ hg st --subrepos s
1016 $ hg st --subrepos s
979 A s/barfoo
1017 A s/barfoo
980 A s/c.c
1018 A s/c.c
981 A s/cpp.cpp
1019 A s/cpp.cpp
982 A s/foobar.orig
1020 A s/foobar.orig
983 A s/snake.python
1021 A s/snake.python
984 $ hg revert s
1022 $ hg revert s
985 reverting subrepo ../gitroot
1023 reverting subrepo ../gitroot
986 make sure everything is reverted correctly
1024 make sure everything is reverted correctly
987 $ hg st --subrepos s
1025 $ hg st --subrepos s
988 ? s/barfoo
1026 ? s/barfoo
989 ? s/c.c
1027 ? s/c.c
990 ? s/cpp.cpp
1028 ? s/cpp.cpp
991 ? s/foobar.orig
1029 ? s/foobar.orig
992 ? s/snake.python
1030 ? s/snake.python
993
1031
994 $ hg add --subrepos --exclude "path:s/c.c"
1032 $ hg add --subrepos --exclude "path:s/c.c"
995 adding s/barfoo (glob)
1033 adding s/barfoo (glob)
996 adding s/cpp.cpp (glob)
1034 adding s/cpp.cpp (glob)
997 adding s/foobar.orig (glob)
1035 adding s/foobar.orig (glob)
998 adding s/snake.python (glob)
1036 adding s/snake.python (glob)
999 $ hg st --subrepos s
1037 $ hg st --subrepos s
1000 A s/barfoo
1038 A s/barfoo
1001 A s/cpp.cpp
1039 A s/cpp.cpp
1002 A s/foobar.orig
1040 A s/foobar.orig
1003 A s/snake.python
1041 A s/snake.python
1004 ? s/c.c
1042 ? s/c.c
1005 $ hg revert --all -q
1043 $ hg revert --all -q
1006
1044
1007 .hgignore should not have influence in subrepos
1045 .hgignore should not have influence in subrepos
1008 $ cat > .hgignore << EOF
1046 $ cat > .hgignore << EOF
1009 > syntax: glob
1047 > syntax: glob
1010 > *.python
1048 > *.python
1011 > EOF
1049 > EOF
1012 $ hg add .hgignore
1050 $ hg add .hgignore
1013 $ hg add --subrepos "glob:**.python" s/barfoo
1051 $ hg add --subrepos "glob:**.python" s/barfoo
1014 adding s/snake.python (glob)
1052 adding s/snake.python (glob)
1015 $ hg st --subrepos s
1053 $ hg st --subrepos s
1016 A s/barfoo
1054 A s/barfoo
1017 A s/snake.python
1055 A s/snake.python
1018 ? s/c.c
1056 ? s/c.c
1019 ? s/cpp.cpp
1057 ? s/cpp.cpp
1020 ? s/foobar.orig
1058 ? s/foobar.orig
1021 $ hg revert --all -q
1059 $ hg revert --all -q
1022
1060
1023 .gitignore should have influence,
1061 .gitignore should have influence,
1024 except for explicitly added files (no patterns)
1062 except for explicitly added files (no patterns)
1025 $ cat > s/.gitignore << EOF
1063 $ cat > s/.gitignore << EOF
1026 > *.python
1064 > *.python
1027 > EOF
1065 > EOF
1028 $ hg add s/.gitignore
1066 $ hg add s/.gitignore
1029 $ hg st --subrepos s
1067 $ hg st --subrepos s
1030 A s/.gitignore
1068 A s/.gitignore
1031 ? s/barfoo
1069 ? s/barfoo
1032 ? s/c.c
1070 ? s/c.c
1033 ? s/cpp.cpp
1071 ? s/cpp.cpp
1034 ? s/foobar.orig
1072 ? s/foobar.orig
1035 $ hg st --subrepos s --all
1073 $ hg st --subrepos s --all
1036 A s/.gitignore
1074 A s/.gitignore
1037 ? s/barfoo
1075 ? s/barfoo
1038 ? s/c.c
1076 ? s/c.c
1039 ? s/cpp.cpp
1077 ? s/cpp.cpp
1040 ? s/foobar.orig
1078 ? s/foobar.orig
1041 I s/snake.python
1079 I s/snake.python
1042 C s/f
1080 C s/f
1043 C s/foobar
1081 C s/foobar
1044 C s/g
1082 C s/g
1045 $ hg add --subrepos "glob:**.python"
1083 $ hg add --subrepos "glob:**.python"
1046 $ hg st --subrepos s
1084 $ hg st --subrepos s
1047 A s/.gitignore
1085 A s/.gitignore
1048 ? s/barfoo
1086 ? s/barfoo
1049 ? s/c.c
1087 ? s/c.c
1050 ? s/cpp.cpp
1088 ? s/cpp.cpp
1051 ? s/foobar.orig
1089 ? s/foobar.orig
1052 $ hg add --subrepos s/snake.python
1090 $ hg add --subrepos s/snake.python
1053 $ hg st --subrepos s
1091 $ hg st --subrepos s
1054 A s/.gitignore
1092 A s/.gitignore
1055 A s/snake.python
1093 A s/snake.python
1056 ? s/barfoo
1094 ? s/barfoo
1057 ? s/c.c
1095 ? s/c.c
1058 ? s/cpp.cpp
1096 ? s/cpp.cpp
1059 ? s/foobar.orig
1097 ? s/foobar.orig
1060
1098
1061 correctly do a dry run
1099 correctly do a dry run
1062 $ hg add --subrepos s --dry-run
1100 $ hg add --subrepos s --dry-run
1063 adding s/barfoo (glob)
1101 adding s/barfoo (glob)
1064 adding s/c.c (glob)
1102 adding s/c.c (glob)
1065 adding s/cpp.cpp (glob)
1103 adding s/cpp.cpp (glob)
1066 adding s/foobar.orig (glob)
1104 adding s/foobar.orig (glob)
1067 $ hg st --subrepos s
1105 $ hg st --subrepos s
1068 A s/.gitignore
1106 A s/.gitignore
1069 A s/snake.python
1107 A s/snake.python
1070 ? s/barfoo
1108 ? s/barfoo
1071 ? s/c.c
1109 ? s/c.c
1072 ? s/cpp.cpp
1110 ? s/cpp.cpp
1073 ? s/foobar.orig
1111 ? s/foobar.orig
1074
1112
1075 error given when adding an already tracked file
1113 error given when adding an already tracked file
1076 $ hg add s/.gitignore
1114 $ hg add s/.gitignore
1077 s/.gitignore already tracked!
1115 s/.gitignore already tracked!
1078 [1]
1116 [1]
1079 $ hg add s/g
1117 $ hg add s/g
1080 s/g already tracked!
1118 s/g already tracked!
1081 [1]
1119 [1]
1082
1120
1083 removed files can be re-added
1121 removed files can be re-added
1084 removing files using 'rm' or 'git rm' has the same effect,
1122 removing files using 'rm' or 'git rm' has the same effect,
1085 since we ignore the staging area
1123 since we ignore the staging area
1086 $ hg ci --subrepos -m 'snake'
1124 $ hg ci --subrepos -m 'snake'
1087 committing subrepository s
1125 committing subrepository s
1088 $ cd s
1126 $ cd s
1089 $ rm snake.python
1127 $ rm snake.python
1090 (remove leftover .hg so Mercurial doesn't look for a root here)
1128 (remove leftover .hg so Mercurial doesn't look for a root here)
1091 $ rm -rf .hg
1129 $ rm -rf .hg
1092 $ hg status --subrepos --all .
1130 $ hg status --subrepos --all .
1093 R snake.python
1131 R snake.python
1094 ? barfoo
1132 ? barfoo
1095 ? c.c
1133 ? c.c
1096 ? cpp.cpp
1134 ? cpp.cpp
1097 ? foobar.orig
1135 ? foobar.orig
1098 C .gitignore
1136 C .gitignore
1099 C f
1137 C f
1100 C foobar
1138 C foobar
1101 C g
1139 C g
1102 $ git rm snake.python
1140 $ git rm snake.python
1103 rm 'snake.python'
1141 rm 'snake.python'
1104 $ hg status --subrepos --all .
1142 $ hg status --subrepos --all .
1105 R snake.python
1143 R snake.python
1106 ? barfoo
1144 ? barfoo
1107 ? c.c
1145 ? c.c
1108 ? cpp.cpp
1146 ? cpp.cpp
1109 ? foobar.orig
1147 ? foobar.orig
1110 C .gitignore
1148 C .gitignore
1111 C f
1149 C f
1112 C foobar
1150 C foobar
1113 C g
1151 C g
1114 $ touch snake.python
1152 $ touch snake.python
1115 $ cd ..
1153 $ cd ..
1116 $ hg add s/snake.python
1154 $ hg add s/snake.python
1117 $ hg status -S
1155 $ hg status -S
1118 M s/snake.python
1156 M s/snake.python
1119 ? .hgignore
1157 ? .hgignore
1120 ? s/barfoo
1158 ? s/barfoo
1121 ? s/c.c
1159 ? s/c.c
1122 ? s/cpp.cpp
1160 ? s/cpp.cpp
1123 ? s/foobar.orig
1161 ? s/foobar.orig
1124 $ hg revert --all -q
1162 $ hg revert --all -q
1125
1163
1126 make sure we show changed files, rather than changed subtrees
1164 make sure we show changed files, rather than changed subtrees
1127 $ mkdir s/foo
1165 $ mkdir s/foo
1128 $ touch s/foo/bwuh
1166 $ touch s/foo/bwuh
1129 $ hg add s/foo/bwuh
1167 $ hg add s/foo/bwuh
1130 $ hg commit -S -m "add bwuh"
1168 $ hg commit -S -m "add bwuh"
1131 committing subrepository s
1169 committing subrepository s
1132 $ hg status -S --change .
1170 $ hg status -S --change .
1133 M .hgsubstate
1171 M .hgsubstate
1134 A s/foo/bwuh
1172 A s/foo/bwuh
1135 ? s/barfoo
1173 ? s/barfoo
1136 ? s/c.c
1174 ? s/c.c
1137 ? s/cpp.cpp
1175 ? s/cpp.cpp
1138 ? s/foobar.orig
1176 ? s/foobar.orig
1139 ? s/snake.python.orig
1177 ? s/snake.python.orig
1140
1178
1141 #if git19
1179 #if git19
1142
1180
1143 test for Git CVE-2016-3068
1181 test for Git CVE-2016-3068
1144 $ hg init malicious-subrepository
1182 $ hg init malicious-subrepository
1145 $ cd malicious-subrepository
1183 $ cd malicious-subrepository
1146 $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub
1184 $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub
1147 $ git init s
1185 $ git init s
1148 Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
1186 Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
1149 $ cd s
1187 $ cd s
1150 $ git commit --allow-empty -m 'empty'
1188 $ git commit --allow-empty -m 'empty'
1151 [master (root-commit) 153f934] empty
1189 [master (root-commit) 153f934] empty
1152 $ cd ..
1190 $ cd ..
1153 $ hg add .hgsub
1191 $ hg add .hgsub
1154 $ hg commit -m "add subrepo"
1192 $ hg commit -m "add subrepo"
1155 $ cd ..
1193 $ cd ..
1156 $ rm -f pwned.txt
1194 $ rm -f pwned.txt
1157 $ unset GIT_ALLOW_PROTOCOL
1195 $ unset GIT_ALLOW_PROTOCOL
1158 $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \
1196 $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \
1159 > malicious-subrepository malicious-subrepository-protected
1197 > malicious-subrepository malicious-subrepository-protected
1160 Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
1198 Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
1161 fatal: transport 'ext' not allowed
1199 fatal: transport 'ext' not allowed
1162 updating to branch default
1200 updating to branch default
1163 cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
1201 cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
1164 abort: git clone error 128 in s (in subrepository "s")
1202 abort: git clone error 128 in s (in subrepository "s")
1165 [255]
1203 [255]
1166 $ f -Dq pwned.txt
1204 $ f -Dq pwned.txt
1167 pwned.txt: file not found
1205 pwned.txt: file not found
1168
1206
1169 whitelisting of ext should be respected (that's the git submodule behaviour)
1207 whitelisting of ext should be respected (that's the git submodule behaviour)
1170 $ rm -f pwned.txt
1208 $ rm -f pwned.txt
1171 $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \
1209 $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \
1172 > malicious-subrepository malicious-subrepository-clone-allowed
1210 > malicious-subrepository malicious-subrepository-clone-allowed
1173 Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
1211 Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
1174 fatal: Could not read from remote repository.
1212 fatal: Could not read from remote repository.
1175
1213
1176 Please make sure you have the correct access rights
1214 Please make sure you have the correct access rights
1177 and the repository exists.
1215 and the repository exists.
1178 updating to branch default
1216 updating to branch default
1179 cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
1217 cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
1180 abort: git clone error 128 in s (in subrepository "s")
1218 abort: git clone error 128 in s (in subrepository "s")
1181 [255]
1219 [255]
1182 $ f -Dq pwned.txt
1220 $ f -Dq pwned.txt
1183 pwned: you asked for it
1221 pwned: you asked for it
1184
1222
1185 #endif
1223 #endif
1186
1224
1187 test for ssh exploit with git subrepos 2017-07-25
1225 test for ssh exploit with git subrepos 2017-07-25
1188
1226
1189 $ hg init malicious-proxycommand
1227 $ hg init malicious-proxycommand
1190 $ cd malicious-proxycommand
1228 $ cd malicious-proxycommand
1191 $ echo 's = [git]ssh://-oProxyCommand=rm${IFS}non-existent/path' > .hgsub
1229 $ echo 's = [git]ssh://-oProxyCommand=rm${IFS}non-existent/path' > .hgsub
1192 $ git init s
1230 $ git init s
1193 Initialized empty Git repository in $TESTTMP/tc/malicious-proxycommand/s/.git/
1231 Initialized empty Git repository in $TESTTMP/tc/malicious-proxycommand/s/.git/
1194 $ cd s
1232 $ cd s
1195 $ git commit --allow-empty -m 'empty'
1233 $ git commit --allow-empty -m 'empty'
1196 [master (root-commit) 153f934] empty
1234 [master (root-commit) 153f934] empty
1197 $ cd ..
1235 $ cd ..
1198 $ hg add .hgsub
1236 $ hg add .hgsub
1199 $ hg ci -m 'add subrepo'
1237 $ hg ci -m 'add subrepo'
1200 $ cd ..
1238 $ cd ..
1201 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1239 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1202 updating to branch default
1240 updating to branch default
1203 abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s")
1241 abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s")
1204 [255]
1242 [255]
1205
1243
1206 also check that a percent encoded '-' (%2D) doesn't work
1244 also check that a percent encoded '-' (%2D) doesn't work
1207
1245
1208 $ cd malicious-proxycommand
1246 $ cd malicious-proxycommand
1209 $ echo 's = [git]ssh://%2DoProxyCommand=rm${IFS}non-existent/path' > .hgsub
1247 $ echo 's = [git]ssh://%2DoProxyCommand=rm${IFS}non-existent/path' > .hgsub
1210 $ hg ci -m 'change url to percent encoded'
1248 $ hg ci -m 'change url to percent encoded'
1211 $ cd ..
1249 $ cd ..
1212 $ rm -r malicious-proxycommand-clone
1250 $ rm -r malicious-proxycommand-clone
1213 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1251 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1214 updating to branch default
1252 updating to branch default
1215 abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s")
1253 abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s")
1216 [255]
1254 [255]
@@ -1,681 +1,696 b''
1 #require svn15
1 #require svn15
2
2
3 $ SVNREPOPATH=`pwd`/svn-repo
3 $ SVNREPOPATH=`pwd`/svn-repo
4 #if windows
4 #if windows
5 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
5 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
6 #else
6 #else
7 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
7 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
8 #endif
8 #endif
9
9
10 $ filter_svn_output () {
10 $ filter_svn_output () {
11 > egrep -v 'Committing|Transmitting|Updating|(^$)' || true
11 > egrep -v 'Committing|Transmitting|Updating|(^$)' || true
12 > }
12 > }
13
13
14 create subversion repo
14 create subversion repo
15
15
16 $ WCROOT="`pwd`/svn-wc"
16 $ WCROOT="`pwd`/svn-wc"
17 $ svnadmin create svn-repo
17 $ svnadmin create svn-repo
18 $ svn co "$SVNREPOURL" svn-wc
18 $ svn co "$SVNREPOURL" svn-wc
19 Checked out revision 0.
19 Checked out revision 0.
20 $ cd svn-wc
20 $ cd svn-wc
21 $ mkdir src
21 $ mkdir src
22 $ echo alpha > src/alpha
22 $ echo alpha > src/alpha
23 $ svn add src
23 $ svn add src
24 A src
24 A src
25 A src/alpha (glob)
25 A src/alpha (glob)
26 $ mkdir externals
26 $ mkdir externals
27 $ echo other > externals/other
27 $ echo other > externals/other
28 $ svn add externals
28 $ svn add externals
29 A externals
29 A externals
30 A externals/other (glob)
30 A externals/other (glob)
31 $ svn ci -qm 'Add alpha'
31 $ svn ci -qm 'Add alpha'
32 $ svn up -q
32 $ svn up -q
33 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
33 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
34 $ svn propset -F extdef svn:externals src
34 $ svn propset -F extdef svn:externals src
35 property 'svn:externals' set on 'src'
35 property 'svn:externals' set on 'src'
36 $ svn ci -qm 'Setting externals'
36 $ svn ci -qm 'Setting externals'
37 $ cd ..
37 $ cd ..
38
38
39 create hg repo
39 create hg repo
40
40
41 $ mkdir sub
41 $ mkdir sub
42 $ cd sub
42 $ cd sub
43 $ hg init t
43 $ hg init t
44 $ cd t
44 $ cd t
45
45
46 first revision, no sub
46 first revision, no sub
47
47
48 $ echo a > a
48 $ echo a > a
49 $ hg ci -Am0
49 $ hg ci -Am0
50 adding a
50 adding a
51
51
52 add first svn sub with leading whitespaces
52 add first svn sub with leading whitespaces
53
53
54 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
54 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
55 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
55 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
56 $ svn co --quiet "$SVNREPOURL"/src s
56 $ svn co --quiet "$SVNREPOURL"/src s
57 $ mkdir subdir
57 $ mkdir subdir
58 $ svn co --quiet "$SVNREPOURL"/src subdir/s
58 $ svn co --quiet "$SVNREPOURL"/src subdir/s
59 $ hg add .hgsub
59 $ hg add .hgsub
60
61 svn subrepo is disabled by default
62
63 $ hg ci -m1
64 abort: svn subrepos not allowed
65 (see 'hg help config.subrepos' for details)
66 [255]
67
68 so enable it
69
70 $ cat >> $HGRCPATH <<EOF
71 > [subrepos]
72 > svn:allowed = true
73 > EOF
74
60 $ hg ci -m1
75 $ hg ci -m1
61
76
62 make sure we avoid empty commits (issue2445)
77 make sure we avoid empty commits (issue2445)
63
78
64 $ hg sum
79 $ hg sum
65 parent: 1:* tip (glob)
80 parent: 1:* tip (glob)
66 1
81 1
67 branch: default
82 branch: default
68 commit: (clean)
83 commit: (clean)
69 update: (current)
84 update: (current)
70 phases: 2 draft
85 phases: 2 draft
71 $ hg ci -moops
86 $ hg ci -moops
72 nothing changed
87 nothing changed
73 [1]
88 [1]
74
89
75 debugsub
90 debugsub
76
91
77 $ hg debugsub
92 $ hg debugsub
78 path s
93 path s
79 source file://*/svn-repo/src (glob)
94 source file://*/svn-repo/src (glob)
80 revision 2
95 revision 2
81 path subdir/s
96 path subdir/s
82 source file://*/svn-repo/src (glob)
97 source file://*/svn-repo/src (glob)
83 revision 2
98 revision 2
84
99
85 change file in svn and hg, commit
100 change file in svn and hg, commit
86
101
87 $ echo a >> a
102 $ echo a >> a
88 $ echo alpha >> s/alpha
103 $ echo alpha >> s/alpha
89 $ hg sum
104 $ hg sum
90 parent: 1:* tip (glob)
105 parent: 1:* tip (glob)
91 1
106 1
92 branch: default
107 branch: default
93 commit: 1 modified, 1 subrepos
108 commit: 1 modified, 1 subrepos
94 update: (current)
109 update: (current)
95 phases: 2 draft
110 phases: 2 draft
96 $ hg commit --subrepos -m 'Message!' | filter_svn_output
111 $ hg commit --subrepos -m 'Message!' | filter_svn_output
97 committing subrepository s
112 committing subrepository s
98 Sending*s/alpha (glob)
113 Sending*s/alpha (glob)
99 Committed revision 3.
114 Committed revision 3.
100 Fetching external item into '*s/externals'* (glob)
115 Fetching external item into '*s/externals'* (glob)
101 External at revision 1.
116 External at revision 1.
102 At revision 3.
117 At revision 3.
103 $ hg debugsub
118 $ hg debugsub
104 path s
119 path s
105 source file://*/svn-repo/src (glob)
120 source file://*/svn-repo/src (glob)
106 revision 3
121 revision 3
107 path subdir/s
122 path subdir/s
108 source file://*/svn-repo/src (glob)
123 source file://*/svn-repo/src (glob)
109 revision 2
124 revision 2
110
125
111 missing svn file, commit should fail
126 missing svn file, commit should fail
112
127
113 $ rm s/alpha
128 $ rm s/alpha
114 $ hg commit --subrepos -m 'abort on missing file'
129 $ hg commit --subrepos -m 'abort on missing file'
115 committing subrepository s
130 committing subrepository s
116 abort: cannot commit missing svn entries (in subrepository "s")
131 abort: cannot commit missing svn entries (in subrepository "s")
117 [255]
132 [255]
118 $ svn revert s/alpha > /dev/null
133 $ svn revert s/alpha > /dev/null
119
134
120 add an unrelated revision in svn and update the subrepo to without
135 add an unrelated revision in svn and update the subrepo to without
121 bringing any changes.
136 bringing any changes.
122
137
123 $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated'
138 $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated'
124 $ svn up -q s
139 $ svn up -q s
125 $ hg sum
140 $ hg sum
126 parent: 2:* tip (glob)
141 parent: 2:* tip (glob)
127 Message!
142 Message!
128 branch: default
143 branch: default
129 commit: (clean)
144 commit: (clean)
130 update: (current)
145 update: (current)
131 phases: 3 draft
146 phases: 3 draft
132
147
133 $ echo a > s/a
148 $ echo a > s/a
134
149
135 should be empty despite change to s/a
150 should be empty despite change to s/a
136
151
137 $ hg st
152 $ hg st
138
153
139 add a commit from svn
154 add a commit from svn
140
155
141 $ cd "$WCROOT/src"
156 $ cd "$WCROOT/src"
142 $ svn up -q
157 $ svn up -q
143 $ echo xyz >> alpha
158 $ echo xyz >> alpha
144 $ svn propset svn:mime-type 'text/xml' alpha
159 $ svn propset svn:mime-type 'text/xml' alpha
145 property 'svn:mime-type' set on 'alpha'
160 property 'svn:mime-type' set on 'alpha'
146 $ svn ci -qm 'amend a from svn'
161 $ svn ci -qm 'amend a from svn'
147 $ cd ../../sub/t
162 $ cd ../../sub/t
148
163
149 this commit from hg will fail
164 this commit from hg will fail
150
165
151 $ echo zzz >> s/alpha
166 $ echo zzz >> s/alpha
152 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
167 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
153 committing subrepository s
168 committing subrepository s
154 abort: svn:*Commit failed (details follow): (glob)
169 abort: svn:*Commit failed (details follow): (glob)
155 [255]
170 [255]
156 $ svn revert -q s/alpha
171 $ svn revert -q s/alpha
157
172
158 this commit fails because of meta changes
173 this commit fails because of meta changes
159
174
160 $ svn propset svn:mime-type 'text/html' s/alpha
175 $ svn propset svn:mime-type 'text/html' s/alpha
161 property 'svn:mime-type' set on 's/alpha' (glob)
176 property 'svn:mime-type' set on 's/alpha' (glob)
162 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
177 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
163 committing subrepository s
178 committing subrepository s
164 abort: svn:*Commit failed (details follow): (glob)
179 abort: svn:*Commit failed (details follow): (glob)
165 [255]
180 [255]
166 $ svn revert -q s/alpha
181 $ svn revert -q s/alpha
167
182
168 this commit fails because of externals changes
183 this commit fails because of externals changes
169
184
170 $ echo zzz > s/externals/other
185 $ echo zzz > s/externals/other
171 $ hg ci --subrepos -m 'amend externals from hg'
186 $ hg ci --subrepos -m 'amend externals from hg'
172 committing subrepository s
187 committing subrepository s
173 abort: cannot commit svn externals (in subrepository "s")
188 abort: cannot commit svn externals (in subrepository "s")
174 [255]
189 [255]
175 $ hg diff --subrepos -r 1:2 | grep -v diff
190 $ hg diff --subrepos -r 1:2 | grep -v diff
176 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
191 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
177 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
192 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
178 @@ -1,2 +1,2 @@
193 @@ -1,2 +1,2 @@
179 -2 s
194 -2 s
180 +3 s
195 +3 s
181 2 subdir/s
196 2 subdir/s
182 --- a/a Thu Jan 01 00:00:00 1970 +0000
197 --- a/a Thu Jan 01 00:00:00 1970 +0000
183 +++ b/a Thu Jan 01 00:00:00 1970 +0000
198 +++ b/a Thu Jan 01 00:00:00 1970 +0000
184 @@ -1,1 +1,2 @@
199 @@ -1,1 +1,2 @@
185 a
200 a
186 +a
201 +a
187 $ svn revert -q s/externals/other
202 $ svn revert -q s/externals/other
188
203
189 this commit fails because of externals meta changes
204 this commit fails because of externals meta changes
190
205
191 $ svn propset svn:mime-type 'text/html' s/externals/other
206 $ svn propset svn:mime-type 'text/html' s/externals/other
192 property 'svn:mime-type' set on 's/externals/other' (glob)
207 property 'svn:mime-type' set on 's/externals/other' (glob)
193 $ hg ci --subrepos -m 'amend externals from hg'
208 $ hg ci --subrepos -m 'amend externals from hg'
194 committing subrepository s
209 committing subrepository s
195 abort: cannot commit svn externals (in subrepository "s")
210 abort: cannot commit svn externals (in subrepository "s")
196 [255]
211 [255]
197 $ svn revert -q s/externals/other
212 $ svn revert -q s/externals/other
198
213
199 clone
214 clone
200
215
201 $ cd ..
216 $ cd ..
202 $ hg clone t tc
217 $ hg clone t tc
203 updating to branch default
218 updating to branch default
204 A tc/s/alpha (glob)
219 A tc/s/alpha (glob)
205 U tc/s (glob)
220 U tc/s (glob)
206
221
207 Fetching external item into 'tc/s/externals'* (glob)
222 Fetching external item into 'tc/s/externals'* (glob)
208 A tc/s/externals/other (glob)
223 A tc/s/externals/other (glob)
209 Checked out external at revision 1.
224 Checked out external at revision 1.
210
225
211 Checked out revision 3.
226 Checked out revision 3.
212 A tc/subdir/s/alpha (glob)
227 A tc/subdir/s/alpha (glob)
213 U tc/subdir/s (glob)
228 U tc/subdir/s (glob)
214
229
215 Fetching external item into 'tc/subdir/s/externals'* (glob)
230 Fetching external item into 'tc/subdir/s/externals'* (glob)
216 A tc/subdir/s/externals/other (glob)
231 A tc/subdir/s/externals/other (glob)
217 Checked out external at revision 1.
232 Checked out external at revision 1.
218
233
219 Checked out revision 2.
234 Checked out revision 2.
220 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 $ cd tc
236 $ cd tc
222
237
223 debugsub in clone
238 debugsub in clone
224
239
225 $ hg debugsub
240 $ hg debugsub
226 path s
241 path s
227 source file://*/svn-repo/src (glob)
242 source file://*/svn-repo/src (glob)
228 revision 3
243 revision 3
229 path subdir/s
244 path subdir/s
230 source file://*/svn-repo/src (glob)
245 source file://*/svn-repo/src (glob)
231 revision 2
246 revision 2
232
247
233 verify subrepo is contained within the repo directory
248 verify subrepo is contained within the repo directory
234
249
235 $ $PYTHON -c "import os.path; print os.path.exists('s')"
250 $ $PYTHON -c "import os.path; print os.path.exists('s')"
236 True
251 True
237
252
238 update to nullrev (must delete the subrepo)
253 update to nullrev (must delete the subrepo)
239
254
240 $ hg up null
255 $ hg up null
241 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
256 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
242 $ ls
257 $ ls
243
258
244 Check hg update --clean
259 Check hg update --clean
245 $ cd "$TESTTMP/sub/t"
260 $ cd "$TESTTMP/sub/t"
246 $ cd s
261 $ cd s
247 $ echo c0 > alpha
262 $ echo c0 > alpha
248 $ echo c1 > f1
263 $ echo c1 > f1
249 $ echo c1 > f2
264 $ echo c1 > f2
250 $ svn add f1 -q
265 $ svn add f1 -q
251 $ svn status | sort
266 $ svn status | sort
252
267
253 ? * a (glob)
268 ? * a (glob)
254 ? * f2 (glob)
269 ? * f2 (glob)
255 A * f1 (glob)
270 A * f1 (glob)
256 M * alpha (glob)
271 M * alpha (glob)
257 Performing status on external item at 'externals'* (glob)
272 Performing status on external item at 'externals'* (glob)
258 X * externals (glob)
273 X * externals (glob)
259 $ cd ../..
274 $ cd ../..
260 $ hg -R t update -C
275 $ hg -R t update -C
261
276
262 Fetching external item into 't/s/externals'* (glob)
277 Fetching external item into 't/s/externals'* (glob)
263 Checked out external at revision 1.
278 Checked out external at revision 1.
264
279
265 Checked out revision 3.
280 Checked out revision 3.
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 $ cd t/s
282 $ cd t/s
268 $ svn status | sort
283 $ svn status | sort
269
284
270 ? * a (glob)
285 ? * a (glob)
271 ? * f1 (glob)
286 ? * f1 (glob)
272 ? * f2 (glob)
287 ? * f2 (glob)
273 Performing status on external item at 'externals'* (glob)
288 Performing status on external item at 'externals'* (glob)
274 X * externals (glob)
289 X * externals (glob)
275
290
276 Sticky subrepositories, no changes
291 Sticky subrepositories, no changes
277 $ cd "$TESTTMP/sub/t"
292 $ cd "$TESTTMP/sub/t"
278 $ hg id -n
293 $ hg id -n
279 2
294 2
280 $ cd s
295 $ cd s
281 $ svnversion
296 $ svnversion
282 3
297 3
283 $ cd ..
298 $ cd ..
284 $ hg update 1
299 $ hg update 1
285 U *s/alpha (glob)
300 U *s/alpha (glob)
286
301
287 Fetching external item into '*s/externals'* (glob)
302 Fetching external item into '*s/externals'* (glob)
288 Checked out external at revision 1.
303 Checked out external at revision 1.
289
304
290 Checked out revision 2.
305 Checked out revision 2.
291 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
306 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 $ hg id -n
307 $ hg id -n
293 1
308 1
294 $ cd s
309 $ cd s
295 $ svnversion
310 $ svnversion
296 2
311 2
297 $ cd ..
312 $ cd ..
298
313
299 Sticky subrepositories, file changes
314 Sticky subrepositories, file changes
300 $ touch s/f1
315 $ touch s/f1
301 $ cd s
316 $ cd s
302 $ svn add f1
317 $ svn add f1
303 A f1
318 A f1
304 $ cd ..
319 $ cd ..
305 $ hg id -n
320 $ hg id -n
306 1+
321 1+
307 $ cd s
322 $ cd s
308 $ svnversion
323 $ svnversion
309 2M
324 2M
310 $ cd ..
325 $ cd ..
311 $ hg update tip
326 $ hg update tip
312 subrepository s diverged (local revision: 2, remote revision: 3)
327 subrepository s diverged (local revision: 2, remote revision: 3)
313 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
328 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
314 subrepository sources for s differ
329 subrepository sources for s differ
315 use (l)ocal source (2) or (r)emote source (3)? l
330 use (l)ocal source (2) or (r)emote source (3)? l
316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
317 $ hg id -n
332 $ hg id -n
318 2+
333 2+
319 $ cd s
334 $ cd s
320 $ svnversion
335 $ svnversion
321 2M
336 2M
322 $ cd ..
337 $ cd ..
323 $ hg update --clean tip
338 $ hg update --clean tip
324 U *s/alpha (glob)
339 U *s/alpha (glob)
325
340
326 Fetching external item into '*s/externals'* (glob)
341 Fetching external item into '*s/externals'* (glob)
327 Checked out external at revision 1.
342 Checked out external at revision 1.
328
343
329 Checked out revision 3.
344 Checked out revision 3.
330 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
331
346
332 Sticky subrepository, revision updates
347 Sticky subrepository, revision updates
333 $ hg id -n
348 $ hg id -n
334 2
349 2
335 $ cd s
350 $ cd s
336 $ svnversion
351 $ svnversion
337 3
352 3
338 $ cd ..
353 $ cd ..
339 $ cd s
354 $ cd s
340 $ svn update -qr 1
355 $ svn update -qr 1
341 $ cd ..
356 $ cd ..
342 $ hg update 1
357 $ hg update 1
343 subrepository s diverged (local revision: 3, remote revision: 2)
358 subrepository s diverged (local revision: 3, remote revision: 2)
344 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
359 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
345 subrepository sources for s differ (in checked out version)
360 subrepository sources for s differ (in checked out version)
346 use (l)ocal source (1) or (r)emote source (2)? l
361 use (l)ocal source (1) or (r)emote source (2)? l
347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 $ hg id -n
363 $ hg id -n
349 1+
364 1+
350 $ cd s
365 $ cd s
351 $ svnversion
366 $ svnversion
352 1
367 1
353 $ cd ..
368 $ cd ..
354
369
355 Sticky subrepository, file changes and revision updates
370 Sticky subrepository, file changes and revision updates
356 $ touch s/f1
371 $ touch s/f1
357 $ cd s
372 $ cd s
358 $ svn add f1
373 $ svn add f1
359 A f1
374 A f1
360 $ svnversion
375 $ svnversion
361 1M
376 1M
362 $ cd ..
377 $ cd ..
363 $ hg id -n
378 $ hg id -n
364 1+
379 1+
365 $ hg update tip
380 $ hg update tip
366 subrepository s diverged (local revision: 3, remote revision: 3)
381 subrepository s diverged (local revision: 3, remote revision: 3)
367 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
382 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
368 subrepository sources for s differ
383 subrepository sources for s differ
369 use (l)ocal source (1) or (r)emote source (3)? l
384 use (l)ocal source (1) or (r)emote source (3)? l
370 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
385 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
371 $ hg id -n
386 $ hg id -n
372 2+
387 2+
373 $ cd s
388 $ cd s
374 $ svnversion
389 $ svnversion
375 1M
390 1M
376 $ cd ..
391 $ cd ..
377
392
378 Sticky repository, update --clean
393 Sticky repository, update --clean
379 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
394 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
380 U *s/alpha (glob)
395 U *s/alpha (glob)
381 U *s (glob)
396 U *s (glob)
382
397
383 Fetching external item into '*s/externals'* (glob)
398 Fetching external item into '*s/externals'* (glob)
384 Checked out external at revision 1.
399 Checked out external at revision 1.
385
400
386 Checked out revision 3.
401 Checked out revision 3.
387 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
402 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
388 $ hg id -n
403 $ hg id -n
389 2
404 2
390 $ cd s
405 $ cd s
391 $ svnversion
406 $ svnversion
392 3
407 3
393 $ cd ..
408 $ cd ..
394
409
395 Test subrepo already at intended revision:
410 Test subrepo already at intended revision:
396 $ cd s
411 $ cd s
397 $ svn update -qr 2
412 $ svn update -qr 2
398 $ cd ..
413 $ cd ..
399 $ hg update 1
414 $ hg update 1
400 subrepository s diverged (local revision: 3, remote revision: 2)
415 subrepository s diverged (local revision: 3, remote revision: 2)
401 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
416 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
402 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
417 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 $ hg id -n
418 $ hg id -n
404 1+
419 1+
405 $ cd s
420 $ cd s
406 $ svnversion
421 $ svnversion
407 2
422 2
408 $ cd ..
423 $ cd ..
409
424
410 Test case where subversion would fail to update the subrepo because there
425 Test case where subversion would fail to update the subrepo because there
411 are unknown directories being replaced by tracked ones (happens with rebase).
426 are unknown directories being replaced by tracked ones (happens with rebase).
412
427
413 $ cd "$WCROOT/src"
428 $ cd "$WCROOT/src"
414 $ mkdir dir
429 $ mkdir dir
415 $ echo epsilon.py > dir/epsilon.py
430 $ echo epsilon.py > dir/epsilon.py
416 $ svn add dir
431 $ svn add dir
417 A dir
432 A dir
418 A dir/epsilon.py (glob)
433 A dir/epsilon.py (glob)
419 $ svn ci -qm 'Add dir/epsilon.py'
434 $ svn ci -qm 'Add dir/epsilon.py'
420 $ cd ../..
435 $ cd ../..
421 $ hg init rebaserepo
436 $ hg init rebaserepo
422 $ cd rebaserepo
437 $ cd rebaserepo
423 $ svn co -r5 --quiet "$SVNREPOURL"/src s
438 $ svn co -r5 --quiet "$SVNREPOURL"/src s
424 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
439 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
425 $ hg add .hgsub
440 $ hg add .hgsub
426 $ hg ci -m addsub
441 $ hg ci -m addsub
427 $ echo a > a
442 $ echo a > a
428 $ hg add .
443 $ hg add .
429 adding a
444 adding a
430 $ hg ci -m adda
445 $ hg ci -m adda
431 $ hg up 0
446 $ hg up 0
432 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
447 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
433 $ svn up -qr6 s
448 $ svn up -qr6 s
434 $ hg ci -m updatesub
449 $ hg ci -m updatesub
435 created new head
450 created new head
436 $ echo pyc > s/dir/epsilon.pyc
451 $ echo pyc > s/dir/epsilon.pyc
437 $ hg up 1
452 $ hg up 1
438 D *s/dir (glob)
453 D *s/dir (glob)
439
454
440 Fetching external item into '*s/externals'* (glob)
455 Fetching external item into '*s/externals'* (glob)
441 Checked out external at revision 1.
456 Checked out external at revision 1.
442
457
443 Checked out revision 5.
458 Checked out revision 5.
444 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 $ hg up -q 2
460 $ hg up -q 2
446
461
447 Modify one of the externals to point to a different path so we can
462 Modify one of the externals to point to a different path so we can
448 test having obstructions when switching branches on checkout:
463 test having obstructions when switching branches on checkout:
449 $ hg checkout tip
464 $ hg checkout tip
450 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
465 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
451 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
466 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
452 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
467 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
453 $ hg commit -m 'Start making obstructed working copy'
468 $ hg commit -m 'Start making obstructed working copy'
454 $ hg book other
469 $ hg book other
455 $ hg co -r 'p1(tip)'
470 $ hg co -r 'p1(tip)'
456 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 (leaving bookmark other)
472 (leaving bookmark other)
458 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
473 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
459 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
474 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
460 $ hg commit -m 'Other branch which will be obstructed'
475 $ hg commit -m 'Other branch which will be obstructed'
461 created new head
476 created new head
462
477
463 Switching back to the head where we have another path mapped to the
478 Switching back to the head where we have another path mapped to the
464 same subrepo should work if the subrepo is clean.
479 same subrepo should work if the subrepo is clean.
465 $ hg co other
480 $ hg co other
466 A *obstruct/other (glob)
481 A *obstruct/other (glob)
467 Checked out revision 1.
482 Checked out revision 1.
468 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
483 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
469 (activating bookmark other)
484 (activating bookmark other)
470
485
471 This is surprising, but is also correct based on the current code:
486 This is surprising, but is also correct based on the current code:
472 $ echo "updating should (maybe) fail" > obstruct/other
487 $ echo "updating should (maybe) fail" > obstruct/other
473 $ hg co tip
488 $ hg co tip
474 abort: uncommitted changes
489 abort: uncommitted changes
475 (commit or update --clean to discard changes)
490 (commit or update --clean to discard changes)
476 [255]
491 [255]
477
492
478 Point to a Subversion branch which has since been deleted and recreated
493 Point to a Subversion branch which has since been deleted and recreated
479 First, create that condition in the repository.
494 First, create that condition in the repository.
480
495
481 $ hg ci --subrepos -m cleanup | filter_svn_output
496 $ hg ci --subrepos -m cleanup | filter_svn_output
482 committing subrepository obstruct
497 committing subrepository obstruct
483 Sending obstruct/other (glob)
498 Sending obstruct/other (glob)
484 Committed revision 7.
499 Committed revision 7.
485 At revision 7.
500 At revision 7.
486 $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
501 $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
487 $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
502 $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
488 $ svn co --quiet "$SVNREPOURL"/branch tempwc
503 $ svn co --quiet "$SVNREPOURL"/branch tempwc
489 $ cd tempwc
504 $ cd tempwc
490 $ echo "something old" > somethingold
505 $ echo "something old" > somethingold
491 $ svn add somethingold
506 $ svn add somethingold
492 A somethingold
507 A somethingold
493 $ svn ci -qm 'Something old'
508 $ svn ci -qm 'Something old'
494 $ svn rm -qm "remove branch" $SVNREPOURL/branch
509 $ svn rm -qm "remove branch" $SVNREPOURL/branch
495 $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
510 $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
496 $ svn up -q
511 $ svn up -q
497 $ echo "something new" > somethingnew
512 $ echo "something new" > somethingnew
498 $ svn add somethingnew
513 $ svn add somethingnew
499 A somethingnew
514 A somethingnew
500 $ svn ci -qm 'Something new'
515 $ svn ci -qm 'Something new'
501 $ cd ..
516 $ cd ..
502 $ rm -rf tempwc
517 $ rm -rf tempwc
503 $ svn co "$SVNREPOURL/branch"@10 recreated
518 $ svn co "$SVNREPOURL/branch"@10 recreated
504 A recreated/somethingold (glob)
519 A recreated/somethingold (glob)
505 Checked out revision 10.
520 Checked out revision 10.
506 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
521 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
507 $ hg ci -m addsub
522 $ hg ci -m addsub
508 $ cd recreated
523 $ cd recreated
509 $ svn up -q
524 $ svn up -q
510 $ cd ..
525 $ cd ..
511 $ hg ci -m updatesub
526 $ hg ci -m updatesub
512 $ hg up -r-2
527 $ hg up -r-2
513 D *recreated/somethingnew (glob)
528 D *recreated/somethingnew (glob)
514 A *recreated/somethingold (glob)
529 A *recreated/somethingold (glob)
515 Checked out revision 10.
530 Checked out revision 10.
516 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
517 (leaving bookmark other)
532 (leaving bookmark other)
518 $ test -f recreated/somethingold
533 $ test -f recreated/somethingold
519
534
520 Test archive
535 Test archive
521
536
522 $ hg archive -S ../archive-all --debug --config progress.debug=true
537 $ hg archive -S ../archive-all --debug --config progress.debug=true
523 archiving: 0/2 files (0.00%)
538 archiving: 0/2 files (0.00%)
524 archiving: .hgsub 1/2 files (50.00%)
539 archiving: .hgsub 1/2 files (50.00%)
525 archiving: .hgsubstate 2/2 files (100.00%)
540 archiving: .hgsubstate 2/2 files (100.00%)
526 archiving (obstruct): 0/1 files (0.00%)
541 archiving (obstruct): 0/1 files (0.00%)
527 archiving (obstruct): 1/1 files (100.00%)
542 archiving (obstruct): 1/1 files (100.00%)
528 archiving (recreated): 0/1 files (0.00%)
543 archiving (recreated): 0/1 files (0.00%)
529 archiving (recreated): 1/1 files (100.00%)
544 archiving (recreated): 1/1 files (100.00%)
530 archiving (s): 0/2 files (0.00%)
545 archiving (s): 0/2 files (0.00%)
531 archiving (s): 1/2 files (50.00%)
546 archiving (s): 1/2 files (50.00%)
532 archiving (s): 2/2 files (100.00%)
547 archiving (s): 2/2 files (100.00%)
533
548
534 $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old
549 $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old
535 archiving: 0/2 files (0.00%)
550 archiving: 0/2 files (0.00%)
536 archiving: .hgsub 1/2 files (50.00%)
551 archiving: .hgsub 1/2 files (50.00%)
537 archiving: .hgsubstate 2/2 files (100.00%)
552 archiving: .hgsubstate 2/2 files (100.00%)
538 archiving (obstruct): 0/1 files (0.00%)
553 archiving (obstruct): 0/1 files (0.00%)
539 archiving (obstruct): 1/1 files (100.00%)
554 archiving (obstruct): 1/1 files (100.00%)
540 archiving (recreated): 0 files
555 archiving (recreated): 0 files
541 archiving (s): 0/2 files (0.00%)
556 archiving (s): 0/2 files (0.00%)
542 archiving (s): 1/2 files (50.00%)
557 archiving (s): 1/2 files (50.00%)
543 archiving (s): 2/2 files (100.00%)
558 archiving (s): 2/2 files (100.00%)
544 $ find ../archive-exclude | sort
559 $ find ../archive-exclude | sort
545 ../archive-exclude
560 ../archive-exclude
546 ../archive-exclude/.hg_archival.txt
561 ../archive-exclude/.hg_archival.txt
547 ../archive-exclude/.hgsub
562 ../archive-exclude/.hgsub
548 ../archive-exclude/.hgsubstate
563 ../archive-exclude/.hgsubstate
549 ../archive-exclude/obstruct
564 ../archive-exclude/obstruct
550 ../archive-exclude/obstruct/other
565 ../archive-exclude/obstruct/other
551 ../archive-exclude/s
566 ../archive-exclude/s
552 ../archive-exclude/s/alpha
567 ../archive-exclude/s/alpha
553 ../archive-exclude/s/dir
568 ../archive-exclude/s/dir
554 ../archive-exclude/s/dir/epsilon.py
569 ../archive-exclude/s/dir/epsilon.py
555
570
556 Test forgetting files, not implemented in svn subrepo, used to
571 Test forgetting files, not implemented in svn subrepo, used to
557 traceback
572 traceback
558
573
559 #if no-windows
574 #if no-windows
560 $ hg forget 'notafile*'
575 $ hg forget 'notafile*'
561 notafile*: No such file or directory
576 notafile*: No such file or directory
562 [1]
577 [1]
563 #else
578 #else
564 $ hg forget 'notafile'
579 $ hg forget 'notafile'
565 notafile: * (glob)
580 notafile: * (glob)
566 [1]
581 [1]
567 #endif
582 #endif
568
583
569 Test a subrepo referencing a just moved svn path. Last commit rev will
584 Test a subrepo referencing a just moved svn path. Last commit rev will
570 be different from the revision, and the path will be different as
585 be different from the revision, and the path will be different as
571 well.
586 well.
572
587
573 $ cd "$WCROOT"
588 $ cd "$WCROOT"
574 $ svn up > /dev/null
589 $ svn up > /dev/null
575 $ mkdir trunk/subdir branches
590 $ mkdir trunk/subdir branches
576 $ echo a > trunk/subdir/a
591 $ echo a > trunk/subdir/a
577 $ svn add trunk/subdir branches
592 $ svn add trunk/subdir branches
578 A trunk/subdir (glob)
593 A trunk/subdir (glob)
579 A trunk/subdir/a (glob)
594 A trunk/subdir/a (glob)
580 A branches
595 A branches
581 $ svn ci -qm addsubdir
596 $ svn ci -qm addsubdir
582 $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
597 $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
583 $ cd ..
598 $ cd ..
584
599
585 $ hg init repo2
600 $ hg init repo2
586 $ cd repo2
601 $ cd repo2
587 $ svn co $SVNREPOURL/branches/somebranch/subdir
602 $ svn co $SVNREPOURL/branches/somebranch/subdir
588 A subdir/a (glob)
603 A subdir/a (glob)
589 Checked out revision 15.
604 Checked out revision 15.
590 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
605 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
591 $ hg add .hgsub
606 $ hg add .hgsub
592 $ hg ci -m addsub
607 $ hg ci -m addsub
593 $ hg up null
608 $ hg up null
594 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
609 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
595 $ hg up
610 $ hg up
596 A *subdir/a (glob)
611 A *subdir/a (glob)
597 Checked out revision 15.
612 Checked out revision 15.
598 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
613 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
599 $ cd ..
614 $ cd ..
600
615
601 Test sanitizing ".hg/hgrc" in subrepo
616 Test sanitizing ".hg/hgrc" in subrepo
602
617
603 $ cd sub/t
618 $ cd sub/t
604 $ hg update -q -C tip
619 $ hg update -q -C tip
605 $ cd s
620 $ cd s
606 $ mkdir .hg
621 $ mkdir .hg
607 $ echo '.hg/hgrc in svn repo' > .hg/hgrc
622 $ echo '.hg/hgrc in svn repo' > .hg/hgrc
608 $ mkdir -p sub/.hg
623 $ mkdir -p sub/.hg
609 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
624 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
610 $ svn add .hg sub
625 $ svn add .hg sub
611 A .hg
626 A .hg
612 A .hg/hgrc (glob)
627 A .hg/hgrc (glob)
613 A sub
628 A sub
614 A sub/.hg (glob)
629 A sub/.hg (glob)
615 A sub/.hg/hgrc (glob)
630 A sub/.hg/hgrc (glob)
616 $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
631 $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
617 $ svn up -q
632 $ svn up -q
618 $ cd ..
633 $ cd ..
619 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
634 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
620 $ grep ' s$' .hgsubstate
635 $ grep ' s$' .hgsubstate
621 16 s
636 16 s
622 $ cd ..
637 $ cd ..
623
638
624 $ hg -R tc pull -u -q 2>&1 | sort
639 $ hg -R tc pull -u -q 2>&1 | sort
625 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob)
640 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob)
626 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob)
641 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob)
627 $ cd tc
642 $ cd tc
628 $ grep ' s$' .hgsubstate
643 $ grep ' s$' .hgsubstate
629 16 s
644 16 s
630 $ test -f s/.hg/hgrc
645 $ test -f s/.hg/hgrc
631 [1]
646 [1]
632 $ test -f s/sub/.hg/hgrc
647 $ test -f s/sub/.hg/hgrc
633 [1]
648 [1]
634
649
635 Test that sanitizing is omitted in meta data area:
650 Test that sanitizing is omitted in meta data area:
636
651
637 $ mkdir s/.svn/.hg
652 $ mkdir s/.svn/.hg
638 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
653 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
639 $ hg update -q -C '.^1'
654 $ hg update -q -C '.^1'
640
655
641 $ cd ../..
656 $ cd ../..
642
657
643 SEC: test for ssh exploit
658 SEC: test for ssh exploit
644
659
645 $ hg init ssh-vuln
660 $ hg init ssh-vuln
646 $ cd ssh-vuln
661 $ cd ssh-vuln
647 $ echo "s = [svn]$SVNREPOURL/src" >> .hgsub
662 $ echo "s = [svn]$SVNREPOURL/src" >> .hgsub
648 $ svn co --quiet "$SVNREPOURL"/src s
663 $ svn co --quiet "$SVNREPOURL"/src s
649 $ hg add .hgsub
664 $ hg add .hgsub
650 $ hg ci -m1
665 $ hg ci -m1
651 $ echo "s = [svn]svn+ssh://-oProxyCommand=touch%20owned%20nested" > .hgsub
666 $ echo "s = [svn]svn+ssh://-oProxyCommand=touch%20owned%20nested" > .hgsub
652 $ hg ci -m2
667 $ hg ci -m2
653 $ cd ..
668 $ cd ..
654 $ hg clone ssh-vuln ssh-vuln-clone
669 $ hg clone ssh-vuln ssh-vuln-clone
655 updating to branch default
670 updating to branch default
656 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
671 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
657 [255]
672 [255]
658
673
659 also check that a percent encoded '-' (%2D) doesn't work
674 also check that a percent encoded '-' (%2D) doesn't work
660
675
661 $ cd ssh-vuln
676 $ cd ssh-vuln
662 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20nested" > .hgsub
677 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20nested" > .hgsub
663 $ hg ci -m3
678 $ hg ci -m3
664 $ cd ..
679 $ cd ..
665 $ rm -r ssh-vuln-clone
680 $ rm -r ssh-vuln-clone
666 $ hg clone ssh-vuln ssh-vuln-clone
681 $ hg clone ssh-vuln ssh-vuln-clone
667 updating to branch default
682 updating to branch default
668 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
683 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s")
669 [255]
684 [255]
670
685
671 also check that hiding the attack in the username doesn't work:
686 also check that hiding the attack in the username doesn't work:
672
687
673 $ cd ssh-vuln
688 $ cd ssh-vuln
674 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20foo@example.com/nested" > .hgsub
689 $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20foo@example.com/nested" > .hgsub
675 $ hg ci -m3
690 $ hg ci -m3
676 $ cd ..
691 $ cd ..
677 $ rm -r ssh-vuln-clone
692 $ rm -r ssh-vuln-clone
678 $ hg clone ssh-vuln ssh-vuln-clone
693 $ hg clone ssh-vuln ssh-vuln-clone
679 updating to branch default
694 updating to branch default
680 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned foo@example.com/nested' (in subrepository "s")
695 abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned foo@example.com/nested' (in subrepository "s")
681 [255]
696 [255]
@@ -1,1893 +1,1931 b''
1 Let commit recurse into subrepos by default to match pre-2.0 behavior:
1 Let commit recurse into subrepos by default to match pre-2.0 behavior:
2
2
3 $ echo "[ui]" >> $HGRCPATH
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "commitsubrepos = Yes" >> $HGRCPATH
4 $ echo "commitsubrepos = Yes" >> $HGRCPATH
5
5
6 $ hg init t
6 $ hg init t
7 $ cd t
7 $ cd t
8
8
9 first revision, no sub
9 first revision, no sub
10
10
11 $ echo a > a
11 $ echo a > a
12 $ hg ci -Am0
12 $ hg ci -Am0
13 adding a
13 adding a
14
14
15 add first sub
15 add first sub
16
16
17 $ echo s = s > .hgsub
17 $ echo s = s > .hgsub
18 $ hg add .hgsub
18 $ hg add .hgsub
19 $ hg init s
19 $ hg init s
20 $ echo a > s/a
20 $ echo a > s/a
21
21
22 Issue2232: committing a subrepo without .hgsub
22 Issue2232: committing a subrepo without .hgsub
23
23
24 $ hg ci -mbad s
24 $ hg ci -mbad s
25 abort: can't commit subrepos without .hgsub
25 abort: can't commit subrepos without .hgsub
26 [255]
26 [255]
27
27
28 $ hg -R s add s/a
28 $ hg -R s add s/a
29 $ hg files -S
29 $ hg files -S
30 .hgsub
30 .hgsub
31 a
31 a
32 s/a (glob)
32 s/a (glob)
33
33
34 $ hg -R s ci -Ams0
34 $ hg -R s ci -Ams0
35 $ hg sum
35 $ hg sum
36 parent: 0:f7b1eb17ad24 tip
36 parent: 0:f7b1eb17ad24 tip
37 0
37 0
38 branch: default
38 branch: default
39 commit: 1 added, 1 subrepos
39 commit: 1 added, 1 subrepos
40 update: (current)
40 update: (current)
41 phases: 1 draft
41 phases: 1 draft
42 $ hg ci -m1
42 $ hg ci -m1
43
43
44 test handling .hgsubstate "added" explicitly.
44 test handling .hgsubstate "added" explicitly.
45
45
46 $ hg parents --template '{node}\n{files}\n'
46 $ hg parents --template '{node}\n{files}\n'
47 7cf8cfea66e410e8e3336508dfeec07b3192de51
47 7cf8cfea66e410e8e3336508dfeec07b3192de51
48 .hgsub .hgsubstate
48 .hgsub .hgsubstate
49 $ hg rollback -q
49 $ hg rollback -q
50 $ hg add .hgsubstate
50 $ hg add .hgsubstate
51 $ hg ci -m1
51 $ hg ci -m1
52 $ hg parents --template '{node}\n{files}\n'
52 $ hg parents --template '{node}\n{files}\n'
53 7cf8cfea66e410e8e3336508dfeec07b3192de51
53 7cf8cfea66e410e8e3336508dfeec07b3192de51
54 .hgsub .hgsubstate
54 .hgsub .hgsubstate
55
55
56 Subrepopath which overlaps with filepath, does not change warnings in remove()
56 Subrepopath which overlaps with filepath, does not change warnings in remove()
57
57
58 $ mkdir snot
58 $ mkdir snot
59 $ touch snot/file
59 $ touch snot/file
60 $ hg remove -S snot/file
60 $ hg remove -S snot/file
61 not removing snot/file: file is untracked (glob)
61 not removing snot/file: file is untracked (glob)
62 [1]
62 [1]
63 $ hg cat snot/filenot
63 $ hg cat snot/filenot
64 snot/filenot: no such file in rev 7cf8cfea66e4 (glob)
64 snot/filenot: no such file in rev 7cf8cfea66e4 (glob)
65 [1]
65 [1]
66 $ rm -r snot
66 $ rm -r snot
67
67
68 Revert subrepo and test subrepo fileset keyword:
68 Revert subrepo and test subrepo fileset keyword:
69
69
70 $ echo b > s/a
70 $ echo b > s/a
71 $ hg revert --dry-run "set:subrepo('glob:s*')"
71 $ hg revert --dry-run "set:subrepo('glob:s*')"
72 reverting subrepo s
72 reverting subrepo s
73 reverting s/a (glob)
73 reverting s/a (glob)
74 $ cat s/a
74 $ cat s/a
75 b
75 b
76 $ hg revert "set:subrepo('glob:s*')"
76 $ hg revert "set:subrepo('glob:s*')"
77 reverting subrepo s
77 reverting subrepo s
78 reverting s/a (glob)
78 reverting s/a (glob)
79 $ cat s/a
79 $ cat s/a
80 a
80 a
81 $ rm s/a.orig
81 $ rm s/a.orig
82
82
83 Revert subrepo with no backup. The "reverting s/a" line is gone since
83 Revert subrepo with no backup. The "reverting s/a" line is gone since
84 we're really running 'hg update' in the subrepo:
84 we're really running 'hg update' in the subrepo:
85
85
86 $ echo b > s/a
86 $ echo b > s/a
87 $ hg revert --no-backup s
87 $ hg revert --no-backup s
88 reverting subrepo s
88 reverting subrepo s
89
89
90 Issue2022: update -C
90 Issue2022: update -C
91
91
92 $ echo b > s/a
92 $ echo b > s/a
93 $ hg sum
93 $ hg sum
94 parent: 1:7cf8cfea66e4 tip
94 parent: 1:7cf8cfea66e4 tip
95 1
95 1
96 branch: default
96 branch: default
97 commit: 1 subrepos
97 commit: 1 subrepos
98 update: (current)
98 update: (current)
99 phases: 2 draft
99 phases: 2 draft
100 $ hg co -C 1
100 $ hg co -C 1
101 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 $ hg sum
102 $ hg sum
103 parent: 1:7cf8cfea66e4 tip
103 parent: 1:7cf8cfea66e4 tip
104 1
104 1
105 branch: default
105 branch: default
106 commit: (clean)
106 commit: (clean)
107 update: (current)
107 update: (current)
108 phases: 2 draft
108 phases: 2 draft
109
109
110 commands that require a clean repo should respect subrepos
110 commands that require a clean repo should respect subrepos
111
111
112 $ echo b >> s/a
112 $ echo b >> s/a
113 $ hg backout tip
113 $ hg backout tip
114 abort: uncommitted changes in subrepository "s"
114 abort: uncommitted changes in subrepository "s"
115 [255]
115 [255]
116 $ hg revert -C -R s s/a
116 $ hg revert -C -R s s/a
117
117
118 add sub sub
118 add sub sub
119
119
120 $ echo ss = ss > s/.hgsub
120 $ echo ss = ss > s/.hgsub
121 $ hg init s/ss
121 $ hg init s/ss
122 $ echo a > s/ss/a
122 $ echo a > s/ss/a
123 $ hg -R s add s/.hgsub
123 $ hg -R s add s/.hgsub
124 $ hg -R s/ss add s/ss/a
124 $ hg -R s/ss add s/ss/a
125 $ hg sum
125 $ hg sum
126 parent: 1:7cf8cfea66e4 tip
126 parent: 1:7cf8cfea66e4 tip
127 1
127 1
128 branch: default
128 branch: default
129 commit: 1 subrepos
129 commit: 1 subrepos
130 update: (current)
130 update: (current)
131 phases: 2 draft
131 phases: 2 draft
132 $ hg ci -m2
132 $ hg ci -m2
133 committing subrepository s
133 committing subrepository s
134 committing subrepository s/ss (glob)
134 committing subrepository s/ss (glob)
135 $ hg sum
135 $ hg sum
136 parent: 2:df30734270ae tip
136 parent: 2:df30734270ae tip
137 2
137 2
138 branch: default
138 branch: default
139 commit: (clean)
139 commit: (clean)
140 update: (current)
140 update: (current)
141 phases: 3 draft
141 phases: 3 draft
142
142
143 test handling .hgsubstate "modified" explicitly.
143 test handling .hgsubstate "modified" explicitly.
144
144
145 $ hg parents --template '{node}\n{files}\n'
145 $ hg parents --template '{node}\n{files}\n'
146 df30734270ae757feb35e643b7018e818e78a9aa
146 df30734270ae757feb35e643b7018e818e78a9aa
147 .hgsubstate
147 .hgsubstate
148 $ hg rollback -q
148 $ hg rollback -q
149 $ hg status -A .hgsubstate
149 $ hg status -A .hgsubstate
150 M .hgsubstate
150 M .hgsubstate
151 $ hg ci -m2
151 $ hg ci -m2
152 $ hg parents --template '{node}\n{files}\n'
152 $ hg parents --template '{node}\n{files}\n'
153 df30734270ae757feb35e643b7018e818e78a9aa
153 df30734270ae757feb35e643b7018e818e78a9aa
154 .hgsubstate
154 .hgsubstate
155
155
156 bump sub rev (and check it is ignored by ui.commitsubrepos)
156 bump sub rev (and check it is ignored by ui.commitsubrepos)
157
157
158 $ echo b > s/a
158 $ echo b > s/a
159 $ hg -R s ci -ms1
159 $ hg -R s ci -ms1
160 $ hg --config ui.commitsubrepos=no ci -m3
160 $ hg --config ui.commitsubrepos=no ci -m3
161
161
162 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
162 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
163
163
164 $ echo c > s/a
164 $ echo c > s/a
165 $ hg --config ui.commitsubrepos=no ci -m4
165 $ hg --config ui.commitsubrepos=no ci -m4
166 abort: uncommitted changes in subrepository "s"
166 abort: uncommitted changes in subrepository "s"
167 (use --subrepos for recursive commit)
167 (use --subrepos for recursive commit)
168 [255]
168 [255]
169 $ hg id
169 $ hg id
170 f6affe3fbfaa+ tip
170 f6affe3fbfaa+ tip
171 $ hg -R s ci -mc
171 $ hg -R s ci -mc
172 $ hg id
172 $ hg id
173 f6affe3fbfaa+ tip
173 f6affe3fbfaa+ tip
174 $ echo d > s/a
174 $ echo d > s/a
175 $ hg ci -m4
175 $ hg ci -m4
176 committing subrepository s
176 committing subrepository s
177 $ hg tip -R s
177 $ hg tip -R s
178 changeset: 4:02dcf1d70411
178 changeset: 4:02dcf1d70411
179 tag: tip
179 tag: tip
180 user: test
180 user: test
181 date: Thu Jan 01 00:00:00 1970 +0000
181 date: Thu Jan 01 00:00:00 1970 +0000
182 summary: 4
182 summary: 4
183
183
184
184
185 check caching
185 check caching
186
186
187 $ hg co 0
187 $ hg co 0
188 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
188 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
189 $ hg debugsub
189 $ hg debugsub
190
190
191 restore
191 restore
192
192
193 $ hg co
193 $ hg co
194 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
195 $ hg debugsub
195 $ hg debugsub
196 path s
196 path s
197 source s
197 source s
198 revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
198 revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
199
199
200 new branch for merge tests
200 new branch for merge tests
201
201
202 $ hg co 1
202 $ hg co 1
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 $ echo t = t >> .hgsub
204 $ echo t = t >> .hgsub
205 $ hg init t
205 $ hg init t
206 $ echo t > t/t
206 $ echo t > t/t
207 $ hg -R t add t
207 $ hg -R t add t
208 adding t/t (glob)
208 adding t/t (glob)
209
209
210 5
210 5
211
211
212 $ hg ci -m5 # add sub
212 $ hg ci -m5 # add sub
213 committing subrepository t
213 committing subrepository t
214 created new head
214 created new head
215 $ echo t2 > t/t
215 $ echo t2 > t/t
216
216
217 6
217 6
218
218
219 $ hg st -R s
219 $ hg st -R s
220 $ hg ci -m6 # change sub
220 $ hg ci -m6 # change sub
221 committing subrepository t
221 committing subrepository t
222 $ hg debugsub
222 $ hg debugsub
223 path s
223 path s
224 source s
224 source s
225 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
225 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
226 path t
226 path t
227 source t
227 source t
228 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
228 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
229 $ echo t3 > t/t
229 $ echo t3 > t/t
230
230
231 7
231 7
232
232
233 $ hg ci -m7 # change sub again for conflict test
233 $ hg ci -m7 # change sub again for conflict test
234 committing subrepository t
234 committing subrepository t
235 $ hg rm .hgsub
235 $ hg rm .hgsub
236
236
237 8
237 8
238
238
239 $ hg ci -m8 # remove sub
239 $ hg ci -m8 # remove sub
240
240
241 test handling .hgsubstate "removed" explicitly.
241 test handling .hgsubstate "removed" explicitly.
242
242
243 $ hg parents --template '{node}\n{files}\n'
243 $ hg parents --template '{node}\n{files}\n'
244 96615c1dad2dc8e3796d7332c77ce69156f7b78e
244 96615c1dad2dc8e3796d7332c77ce69156f7b78e
245 .hgsub .hgsubstate
245 .hgsub .hgsubstate
246 $ hg rollback -q
246 $ hg rollback -q
247 $ hg remove .hgsubstate
247 $ hg remove .hgsubstate
248 $ hg ci -m8
248 $ hg ci -m8
249 $ hg parents --template '{node}\n{files}\n'
249 $ hg parents --template '{node}\n{files}\n'
250 96615c1dad2dc8e3796d7332c77ce69156f7b78e
250 96615c1dad2dc8e3796d7332c77ce69156f7b78e
251 .hgsub .hgsubstate
251 .hgsub .hgsubstate
252
252
253 merge tests
253 merge tests
254
254
255 $ hg co -C 3
255 $ hg co -C 3
256 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 $ hg merge 5 # test adding
257 $ hg merge 5 # test adding
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 (branch merge, don't forget to commit)
259 (branch merge, don't forget to commit)
260 $ hg debugsub
260 $ hg debugsub
261 path s
261 path s
262 source s
262 source s
263 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
263 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
264 path t
264 path t
265 source t
265 source t
266 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
266 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
267 $ hg ci -m9
267 $ hg ci -m9
268 created new head
268 created new head
269 $ hg merge 6 --debug # test change
269 $ hg merge 6 --debug # test change
270 searching for copies back to rev 2
270 searching for copies back to rev 2
271 resolving manifests
271 resolving manifests
272 branchmerge: True, force: False, partial: False
272 branchmerge: True, force: False, partial: False
273 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
273 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
274 starting 4 threads for background file closing (?)
274 starting 4 threads for background file closing (?)
275 .hgsubstate: versions differ -> m (premerge)
275 .hgsubstate: versions differ -> m (premerge)
276 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
276 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
277 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
277 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
278 getting subrepo t
278 getting subrepo t
279 resolving manifests
279 resolving manifests
280 branchmerge: False, force: False, partial: False
280 branchmerge: False, force: False, partial: False
281 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
281 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
282 t: remote is newer -> g
282 t: remote is newer -> g
283 getting t
283 getting t
284 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
284 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
285 (branch merge, don't forget to commit)
285 (branch merge, don't forget to commit)
286 $ hg debugsub
286 $ hg debugsub
287 path s
287 path s
288 source s
288 source s
289 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
289 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
290 path t
290 path t
291 source t
291 source t
292 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
292 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
293 $ echo conflict > t/t
293 $ echo conflict > t/t
294 $ hg ci -m10
294 $ hg ci -m10
295 committing subrepository t
295 committing subrepository t
296 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
296 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
297 searching for copies back to rev 2
297 searching for copies back to rev 2
298 resolving manifests
298 resolving manifests
299 branchmerge: True, force: False, partial: False
299 branchmerge: True, force: False, partial: False
300 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
300 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
301 starting 4 threads for background file closing (?)
301 starting 4 threads for background file closing (?)
302 .hgsubstate: versions differ -> m (premerge)
302 .hgsubstate: versions differ -> m (premerge)
303 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
303 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
304 subrepo t: both sides changed
304 subrepo t: both sides changed
305 subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
305 subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
306 starting 4 threads for background file closing (?)
306 starting 4 threads for background file closing (?)
307 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
307 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
308 merging subrepository "t"
308 merging subrepository "t"
309 searching for copies back to rev 2
309 searching for copies back to rev 2
310 resolving manifests
310 resolving manifests
311 branchmerge: True, force: False, partial: False
311 branchmerge: True, force: False, partial: False
312 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
312 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
313 preserving t for resolve of t
313 preserving t for resolve of t
314 starting 4 threads for background file closing (?)
314 starting 4 threads for background file closing (?)
315 t: versions differ -> m (premerge)
315 t: versions differ -> m (premerge)
316 picked tool ':merge' for t (binary False symlink False changedelete False)
316 picked tool ':merge' for t (binary False symlink False changedelete False)
317 merging t
317 merging t
318 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
318 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
319 t: versions differ -> m (merge)
319 t: versions differ -> m (merge)
320 picked tool ':merge' for t (binary False symlink False changedelete False)
320 picked tool ':merge' for t (binary False symlink False changedelete False)
321 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
321 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
322 warning: conflicts while merging t! (edit, then use 'hg resolve --mark')
322 warning: conflicts while merging t! (edit, then use 'hg resolve --mark')
323 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
323 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
324 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
324 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
325 subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
325 subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
326 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
326 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
327 (branch merge, don't forget to commit)
327 (branch merge, don't forget to commit)
328
328
329 should conflict
329 should conflict
330
330
331 $ cat t/t
331 $ cat t/t
332 <<<<<<< local: 20a0db6fbf6c - test: 10
332 <<<<<<< local: 20a0db6fbf6c - test: 10
333 conflict
333 conflict
334 =======
334 =======
335 t3
335 t3
336 >>>>>>> other: 7af322bc1198 - test: 7
336 >>>>>>> other: 7af322bc1198 - test: 7
337
337
338 11: remove subrepo t
338 11: remove subrepo t
339
339
340 $ hg co -C 5
340 $ hg co -C 5
341 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
341 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 $ hg revert -r 4 .hgsub # remove t
342 $ hg revert -r 4 .hgsub # remove t
343 $ hg ci -m11
343 $ hg ci -m11
344 created new head
344 created new head
345 $ hg debugsub
345 $ hg debugsub
346 path s
346 path s
347 source s
347 source s
348 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
348 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
349
349
350 local removed, remote changed, keep changed
350 local removed, remote changed, keep changed
351
351
352 $ hg merge 6
352 $ hg merge 6
353 remote [merge rev] changed subrepository t which local [working copy] removed
353 remote [merge rev] changed subrepository t which local [working copy] removed
354 use (c)hanged version or (d)elete? c
354 use (c)hanged version or (d)elete? c
355 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
355 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
356 (branch merge, don't forget to commit)
356 (branch merge, don't forget to commit)
357 BROKEN: should include subrepo t
357 BROKEN: should include subrepo t
358 $ hg debugsub
358 $ hg debugsub
359 path s
359 path s
360 source s
360 source s
361 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
361 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
362 $ cat .hgsubstate
362 $ cat .hgsubstate
363 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
363 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
364 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
364 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
365 $ hg ci -m 'local removed, remote changed, keep changed'
365 $ hg ci -m 'local removed, remote changed, keep changed'
366 BROKEN: should include subrepo t
366 BROKEN: should include subrepo t
367 $ hg debugsub
367 $ hg debugsub
368 path s
368 path s
369 source s
369 source s
370 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
370 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
371 BROKEN: should include subrepo t
371 BROKEN: should include subrepo t
372 $ cat .hgsubstate
372 $ cat .hgsubstate
373 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
373 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
374 $ cat t/t
374 $ cat t/t
375 t2
375 t2
376
376
377 local removed, remote changed, keep removed
377 local removed, remote changed, keep removed
378
378
379 $ hg co -C 11
379 $ hg co -C 11
380 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
381 $ hg merge --config ui.interactive=true 6 <<EOF
381 $ hg merge --config ui.interactive=true 6 <<EOF
382 > d
382 > d
383 > EOF
383 > EOF
384 remote [merge rev] changed subrepository t which local [working copy] removed
384 remote [merge rev] changed subrepository t which local [working copy] removed
385 use (c)hanged version or (d)elete? d
385 use (c)hanged version or (d)elete? d
386 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
387 (branch merge, don't forget to commit)
387 (branch merge, don't forget to commit)
388 $ hg debugsub
388 $ hg debugsub
389 path s
389 path s
390 source s
390 source s
391 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
391 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
392 $ cat .hgsubstate
392 $ cat .hgsubstate
393 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
393 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
394 $ hg ci -m 'local removed, remote changed, keep removed'
394 $ hg ci -m 'local removed, remote changed, keep removed'
395 created new head
395 created new head
396 $ hg debugsub
396 $ hg debugsub
397 path s
397 path s
398 source s
398 source s
399 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
399 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
400 $ cat .hgsubstate
400 $ cat .hgsubstate
401 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
401 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
402
402
403 local changed, remote removed, keep changed
403 local changed, remote removed, keep changed
404
404
405 $ hg co -C 6
405 $ hg co -C 6
406 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
406 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 $ hg merge 11
407 $ hg merge 11
408 local [working copy] changed subrepository t which remote [merge rev] removed
408 local [working copy] changed subrepository t which remote [merge rev] removed
409 use (c)hanged version or (d)elete? c
409 use (c)hanged version or (d)elete? c
410 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
410 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
411 (branch merge, don't forget to commit)
411 (branch merge, don't forget to commit)
412 BROKEN: should include subrepo t
412 BROKEN: should include subrepo t
413 $ hg debugsub
413 $ hg debugsub
414 path s
414 path s
415 source s
415 source s
416 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
416 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
417 BROKEN: should include subrepo t
417 BROKEN: should include subrepo t
418 $ cat .hgsubstate
418 $ cat .hgsubstate
419 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
419 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
420 $ hg ci -m 'local changed, remote removed, keep changed'
420 $ hg ci -m 'local changed, remote removed, keep changed'
421 created new head
421 created new head
422 BROKEN: should include subrepo t
422 BROKEN: should include subrepo t
423 $ hg debugsub
423 $ hg debugsub
424 path s
424 path s
425 source s
425 source s
426 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
426 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
427 BROKEN: should include subrepo t
427 BROKEN: should include subrepo t
428 $ cat .hgsubstate
428 $ cat .hgsubstate
429 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
429 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
430 $ cat t/t
430 $ cat t/t
431 t2
431 t2
432
432
433 local changed, remote removed, keep removed
433 local changed, remote removed, keep removed
434
434
435 $ hg co -C 6
435 $ hg co -C 6
436 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
436 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
437 $ hg merge --config ui.interactive=true 11 <<EOF
437 $ hg merge --config ui.interactive=true 11 <<EOF
438 > d
438 > d
439 > EOF
439 > EOF
440 local [working copy] changed subrepository t which remote [merge rev] removed
440 local [working copy] changed subrepository t which remote [merge rev] removed
441 use (c)hanged version or (d)elete? d
441 use (c)hanged version or (d)elete? d
442 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
442 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
443 (branch merge, don't forget to commit)
443 (branch merge, don't forget to commit)
444 $ hg debugsub
444 $ hg debugsub
445 path s
445 path s
446 source s
446 source s
447 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
447 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
448 $ cat .hgsubstate
448 $ cat .hgsubstate
449 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
449 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
450 $ hg ci -m 'local changed, remote removed, keep removed'
450 $ hg ci -m 'local changed, remote removed, keep removed'
451 created new head
451 created new head
452 $ hg debugsub
452 $ hg debugsub
453 path s
453 path s
454 source s
454 source s
455 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
455 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
456 $ cat .hgsubstate
456 $ cat .hgsubstate
457 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
457 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
458
458
459 clean up to avoid having to fix up the tests below
459 clean up to avoid having to fix up the tests below
460
460
461 $ hg co -C 10
461 $ hg co -C 10
462 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
462 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
463 $ cat >> $HGRCPATH <<EOF
463 $ cat >> $HGRCPATH <<EOF
464 > [extensions]
464 > [extensions]
465 > strip=
465 > strip=
466 > EOF
466 > EOF
467 $ hg strip -r 11:15
467 $ hg strip -r 11:15
468 saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
468 saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
469
469
470 clone
470 clone
471
471
472 $ cd ..
472 $ cd ..
473 $ hg clone t tc
473 $ hg clone t tc
474 updating to branch default
474 updating to branch default
475 cloning subrepo s from $TESTTMP/t/s
475 cloning subrepo s from $TESTTMP/t/s
476 cloning subrepo s/ss from $TESTTMP/t/s/ss (glob)
476 cloning subrepo s/ss from $TESTTMP/t/s/ss (glob)
477 cloning subrepo t from $TESTTMP/t/t
477 cloning subrepo t from $TESTTMP/t/t
478 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
478 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
479 $ cd tc
479 $ cd tc
480 $ hg debugsub
480 $ hg debugsub
481 path s
481 path s
482 source s
482 source s
483 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
483 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
484 path t
484 path t
485 source t
485 source t
486 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
486 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
487 $ cd ..
488
489 clone with subrepo disabled (update should fail)
490
491 $ hg clone t -U tc2 --config subrepos.allowed=false
492 $ hg update -R tc2 --config subrepos.allowed=false
493 abort: subrepos not enabled
494 (see 'hg help config.subrepos' for details)
495 [255]
496 $ ls tc2
497 a
498
499 $ hg clone t tc3 --config subrepos.allowed=false
500 updating to branch default
501 abort: subrepos not enabled
502 (see 'hg help config.subrepos' for details)
503 [255]
504 $ ls tc3
505 a
506
507 And again with just the hg type disabled
508
509 $ hg clone t -U tc4 --config subrepos.hg:allowed=false
510 $ hg update -R tc4 --config subrepos.hg:allowed=false
511 abort: hg subrepos not allowed
512 (see 'hg help config.subrepos' for details)
513 [255]
514 $ ls tc4
515 a
516
517 $ hg clone t tc5 --config subrepos.hg:allowed=false
518 updating to branch default
519 abort: hg subrepos not allowed
520 (see 'hg help config.subrepos' for details)
521 [255]
522 $ ls tc5
523 a
487
524
488 push
525 push
489
526
527 $ cd tc
490 $ echo bah > t/t
528 $ echo bah > t/t
491 $ hg ci -m11
529 $ hg ci -m11
492 committing subrepository t
530 committing subrepository t
493 $ hg push
531 $ hg push
494 pushing to $TESTTMP/t (glob)
532 pushing to $TESTTMP/t (glob)
495 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
533 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
496 no changes made to subrepo s since last push to $TESTTMP/t/s
534 no changes made to subrepo s since last push to $TESTTMP/t/s
497 pushing subrepo t to $TESTTMP/t/t
535 pushing subrepo t to $TESTTMP/t/t
498 searching for changes
536 searching for changes
499 adding changesets
537 adding changesets
500 adding manifests
538 adding manifests
501 adding file changes
539 adding file changes
502 added 1 changesets with 1 changes to 1 files
540 added 1 changesets with 1 changes to 1 files
503 searching for changes
541 searching for changes
504 adding changesets
542 adding changesets
505 adding manifests
543 adding manifests
506 adding file changes
544 adding file changes
507 added 1 changesets with 1 changes to 1 files
545 added 1 changesets with 1 changes to 1 files
508
546
509 push -f
547 push -f
510
548
511 $ echo bah > s/a
549 $ echo bah > s/a
512 $ hg ci -m12
550 $ hg ci -m12
513 committing subrepository s
551 committing subrepository s
514 $ hg push
552 $ hg push
515 pushing to $TESTTMP/t (glob)
553 pushing to $TESTTMP/t (glob)
516 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
554 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
517 pushing subrepo s to $TESTTMP/t/s
555 pushing subrepo s to $TESTTMP/t/s
518 searching for changes
556 searching for changes
519 abort: push creates new remote head 12a213df6fa9! (in subrepository "s")
557 abort: push creates new remote head 12a213df6fa9! (in subrepository "s")
520 (merge or see 'hg help push' for details about pushing new heads)
558 (merge or see 'hg help push' for details about pushing new heads)
521 [255]
559 [255]
522 $ hg push -f
560 $ hg push -f
523 pushing to $TESTTMP/t (glob)
561 pushing to $TESTTMP/t (glob)
524 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
562 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
525 searching for changes
563 searching for changes
526 no changes found
564 no changes found
527 pushing subrepo s to $TESTTMP/t/s
565 pushing subrepo s to $TESTTMP/t/s
528 searching for changes
566 searching for changes
529 adding changesets
567 adding changesets
530 adding manifests
568 adding manifests
531 adding file changes
569 adding file changes
532 added 1 changesets with 1 changes to 1 files (+1 heads)
570 added 1 changesets with 1 changes to 1 files (+1 heads)
533 pushing subrepo t to $TESTTMP/t/t
571 pushing subrepo t to $TESTTMP/t/t
534 searching for changes
572 searching for changes
535 no changes found
573 no changes found
536 searching for changes
574 searching for changes
537 adding changesets
575 adding changesets
538 adding manifests
576 adding manifests
539 adding file changes
577 adding file changes
540 added 1 changesets with 1 changes to 1 files
578 added 1 changesets with 1 changes to 1 files
541
579
542 check that unmodified subrepos are not pushed
580 check that unmodified subrepos are not pushed
543
581
544 $ hg clone . ../tcc
582 $ hg clone . ../tcc
545 updating to branch default
583 updating to branch default
546 cloning subrepo s from $TESTTMP/tc/s
584 cloning subrepo s from $TESTTMP/tc/s
547 cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob)
585 cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob)
548 cloning subrepo t from $TESTTMP/tc/t
586 cloning subrepo t from $TESTTMP/tc/t
549 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
587 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
550
588
551 the subrepos on the new clone have nothing to push to its source
589 the subrepos on the new clone have nothing to push to its source
552
590
553 $ hg push -R ../tcc .
591 $ hg push -R ../tcc .
554 pushing to .
592 pushing to .
555 no changes made to subrepo s/ss since last push to s/ss (glob)
593 no changes made to subrepo s/ss since last push to s/ss (glob)
556 no changes made to subrepo s since last push to s
594 no changes made to subrepo s since last push to s
557 no changes made to subrepo t since last push to t
595 no changes made to subrepo t since last push to t
558 searching for changes
596 searching for changes
559 no changes found
597 no changes found
560 [1]
598 [1]
561
599
562 the subrepos on the source do not have a clean store versus the clone target
600 the subrepos on the source do not have a clean store versus the clone target
563 because they were never explicitly pushed to the source
601 because they were never explicitly pushed to the source
564
602
565 $ hg push ../tcc
603 $ hg push ../tcc
566 pushing to ../tcc
604 pushing to ../tcc
567 pushing subrepo s/ss to ../tcc/s/ss (glob)
605 pushing subrepo s/ss to ../tcc/s/ss (glob)
568 searching for changes
606 searching for changes
569 no changes found
607 no changes found
570 pushing subrepo s to ../tcc/s
608 pushing subrepo s to ../tcc/s
571 searching for changes
609 searching for changes
572 no changes found
610 no changes found
573 pushing subrepo t to ../tcc/t
611 pushing subrepo t to ../tcc/t
574 searching for changes
612 searching for changes
575 no changes found
613 no changes found
576 searching for changes
614 searching for changes
577 no changes found
615 no changes found
578 [1]
616 [1]
579
617
580 after push their stores become clean
618 after push their stores become clean
581
619
582 $ hg push ../tcc
620 $ hg push ../tcc
583 pushing to ../tcc
621 pushing to ../tcc
584 no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob)
622 no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob)
585 no changes made to subrepo s since last push to ../tcc/s
623 no changes made to subrepo s since last push to ../tcc/s
586 no changes made to subrepo t since last push to ../tcc/t
624 no changes made to subrepo t since last push to ../tcc/t
587 searching for changes
625 searching for changes
588 no changes found
626 no changes found
589 [1]
627 [1]
590
628
591 updating a subrepo to a different revision or changing
629 updating a subrepo to a different revision or changing
592 its working directory does not make its store dirty
630 its working directory does not make its store dirty
593
631
594 $ hg -R s update '.^'
632 $ hg -R s update '.^'
595 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
633 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
596 $ hg push
634 $ hg push
597 pushing to $TESTTMP/t (glob)
635 pushing to $TESTTMP/t (glob)
598 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
636 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
599 no changes made to subrepo s since last push to $TESTTMP/t/s
637 no changes made to subrepo s since last push to $TESTTMP/t/s
600 no changes made to subrepo t since last push to $TESTTMP/t/t
638 no changes made to subrepo t since last push to $TESTTMP/t/t
601 searching for changes
639 searching for changes
602 no changes found
640 no changes found
603 [1]
641 [1]
604 $ echo foo >> s/a
642 $ echo foo >> s/a
605 $ hg push
643 $ hg push
606 pushing to $TESTTMP/t (glob)
644 pushing to $TESTTMP/t (glob)
607 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
645 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
608 no changes made to subrepo s since last push to $TESTTMP/t/s
646 no changes made to subrepo s since last push to $TESTTMP/t/s
609 no changes made to subrepo t since last push to $TESTTMP/t/t
647 no changes made to subrepo t since last push to $TESTTMP/t/t
610 searching for changes
648 searching for changes
611 no changes found
649 no changes found
612 [1]
650 [1]
613 $ hg -R s update -C tip
651 $ hg -R s update -C tip
614 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
652 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
615
653
616 committing into a subrepo makes its store (but not its parent's store) dirty
654 committing into a subrepo makes its store (but not its parent's store) dirty
617
655
618 $ echo foo >> s/ss/a
656 $ echo foo >> s/ss/a
619 $ hg -R s/ss commit -m 'test dirty store detection'
657 $ hg -R s/ss commit -m 'test dirty store detection'
620
658
621 $ hg out -S -r `hg log -r tip -T "{node|short}"`
659 $ hg out -S -r `hg log -r tip -T "{node|short}"`
622 comparing with $TESTTMP/t (glob)
660 comparing with $TESTTMP/t (glob)
623 searching for changes
661 searching for changes
624 no changes found
662 no changes found
625 comparing with $TESTTMP/t/s
663 comparing with $TESTTMP/t/s
626 searching for changes
664 searching for changes
627 no changes found
665 no changes found
628 comparing with $TESTTMP/t/s/ss
666 comparing with $TESTTMP/t/s/ss
629 searching for changes
667 searching for changes
630 changeset: 1:79ea5566a333
668 changeset: 1:79ea5566a333
631 tag: tip
669 tag: tip
632 user: test
670 user: test
633 date: Thu Jan 01 00:00:00 1970 +0000
671 date: Thu Jan 01 00:00:00 1970 +0000
634 summary: test dirty store detection
672 summary: test dirty store detection
635
673
636 comparing with $TESTTMP/t/t
674 comparing with $TESTTMP/t/t
637 searching for changes
675 searching for changes
638 no changes found
676 no changes found
639
677
640 $ hg push
678 $ hg push
641 pushing to $TESTTMP/t (glob)
679 pushing to $TESTTMP/t (glob)
642 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
680 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
643 searching for changes
681 searching for changes
644 adding changesets
682 adding changesets
645 adding manifests
683 adding manifests
646 adding file changes
684 adding file changes
647 added 1 changesets with 1 changes to 1 files
685 added 1 changesets with 1 changes to 1 files
648 no changes made to subrepo s since last push to $TESTTMP/t/s
686 no changes made to subrepo s since last push to $TESTTMP/t/s
649 no changes made to subrepo t since last push to $TESTTMP/t/t
687 no changes made to subrepo t since last push to $TESTTMP/t/t
650 searching for changes
688 searching for changes
651 no changes found
689 no changes found
652 [1]
690 [1]
653
691
654 a subrepo store may be clean versus one repo but not versus another
692 a subrepo store may be clean versus one repo but not versus another
655
693
656 $ hg push
694 $ hg push
657 pushing to $TESTTMP/t (glob)
695 pushing to $TESTTMP/t (glob)
658 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
696 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
659 no changes made to subrepo s since last push to $TESTTMP/t/s
697 no changes made to subrepo s since last push to $TESTTMP/t/s
660 no changes made to subrepo t since last push to $TESTTMP/t/t
698 no changes made to subrepo t since last push to $TESTTMP/t/t
661 searching for changes
699 searching for changes
662 no changes found
700 no changes found
663 [1]
701 [1]
664 $ hg push ../tcc
702 $ hg push ../tcc
665 pushing to ../tcc
703 pushing to ../tcc
666 pushing subrepo s/ss to ../tcc/s/ss (glob)
704 pushing subrepo s/ss to ../tcc/s/ss (glob)
667 searching for changes
705 searching for changes
668 adding changesets
706 adding changesets
669 adding manifests
707 adding manifests
670 adding file changes
708 adding file changes
671 added 1 changesets with 1 changes to 1 files
709 added 1 changesets with 1 changes to 1 files
672 no changes made to subrepo s since last push to ../tcc/s
710 no changes made to subrepo s since last push to ../tcc/s
673 no changes made to subrepo t since last push to ../tcc/t
711 no changes made to subrepo t since last push to ../tcc/t
674 searching for changes
712 searching for changes
675 no changes found
713 no changes found
676 [1]
714 [1]
677
715
678 update
716 update
679
717
680 $ cd ../t
718 $ cd ../t
681 $ hg up -C # discard our earlier merge
719 $ hg up -C # discard our earlier merge
682 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
720 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
683 updated to "c373c8102e68: 12"
721 updated to "c373c8102e68: 12"
684 2 other heads for branch "default"
722 2 other heads for branch "default"
685 $ echo blah > t/t
723 $ echo blah > t/t
686 $ hg ci -m13
724 $ hg ci -m13
687 committing subrepository t
725 committing subrepository t
688
726
689 backout calls revert internally with minimal opts, which should not raise
727 backout calls revert internally with minimal opts, which should not raise
690 KeyError
728 KeyError
691
729
692 $ hg backout ".^" --no-commit
730 $ hg backout ".^" --no-commit
693 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
731 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
694 changeset c373c8102e68 backed out, don't forget to commit.
732 changeset c373c8102e68 backed out, don't forget to commit.
695
733
696 $ hg up -C # discard changes
734 $ hg up -C # discard changes
697 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
735 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
698 updated to "925c17564ef8: 13"
736 updated to "925c17564ef8: 13"
699 2 other heads for branch "default"
737 2 other heads for branch "default"
700
738
701 pull
739 pull
702
740
703 $ cd ../tc
741 $ cd ../tc
704 $ hg pull
742 $ hg pull
705 pulling from $TESTTMP/t (glob)
743 pulling from $TESTTMP/t (glob)
706 searching for changes
744 searching for changes
707 adding changesets
745 adding changesets
708 adding manifests
746 adding manifests
709 adding file changes
747 adding file changes
710 added 1 changesets with 1 changes to 1 files
748 added 1 changesets with 1 changes to 1 files
711 new changesets 925c17564ef8
749 new changesets 925c17564ef8
712 (run 'hg update' to get a working copy)
750 (run 'hg update' to get a working copy)
713
751
714 should pull t
752 should pull t
715
753
716 $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
754 $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
717 comparing with $TESTTMP/t (glob)
755 comparing with $TESTTMP/t (glob)
718 no changes found
756 no changes found
719 comparing with $TESTTMP/t/s
757 comparing with $TESTTMP/t/s
720 searching for changes
758 searching for changes
721 no changes found
759 no changes found
722 comparing with $TESTTMP/t/s/ss
760 comparing with $TESTTMP/t/s/ss
723 searching for changes
761 searching for changes
724 no changes found
762 no changes found
725 comparing with $TESTTMP/t/t
763 comparing with $TESTTMP/t/t
726 searching for changes
764 searching for changes
727 changeset: 5:52c0adc0515a
765 changeset: 5:52c0adc0515a
728 tag: tip
766 tag: tip
729 user: test
767 user: test
730 date: Thu Jan 01 00:00:00 1970 +0000
768 date: Thu Jan 01 00:00:00 1970 +0000
731 summary: 13
769 summary: 13
732
770
733
771
734 $ hg up
772 $ hg up
735 pulling subrepo t from $TESTTMP/t/t
773 pulling subrepo t from $TESTTMP/t/t
736 searching for changes
774 searching for changes
737 adding changesets
775 adding changesets
738 adding manifests
776 adding manifests
739 adding file changes
777 adding file changes
740 added 1 changesets with 1 changes to 1 files
778 added 1 changesets with 1 changes to 1 files
741 new changesets 52c0adc0515a
779 new changesets 52c0adc0515a
742 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
780 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
743 updated to "925c17564ef8: 13"
781 updated to "925c17564ef8: 13"
744 2 other heads for branch "default"
782 2 other heads for branch "default"
745 $ cat t/t
783 $ cat t/t
746 blah
784 blah
747
785
748 bogus subrepo path aborts
786 bogus subrepo path aborts
749
787
750 $ echo 'bogus=[boguspath' >> .hgsub
788 $ echo 'bogus=[boguspath' >> .hgsub
751 $ hg ci -m 'bogus subrepo path'
789 $ hg ci -m 'bogus subrepo path'
752 abort: missing ] in subrepository source
790 abort: missing ] in subrepository source
753 [255]
791 [255]
754
792
755 Issue1986: merge aborts when trying to merge a subrepo that
793 Issue1986: merge aborts when trying to merge a subrepo that
756 shouldn't need merging
794 shouldn't need merging
757
795
758 # subrepo layout
796 # subrepo layout
759 #
797 #
760 # o 5 br
798 # o 5 br
761 # /|
799 # /|
762 # o | 4 default
800 # o | 4 default
763 # | |
801 # | |
764 # | o 3 br
802 # | o 3 br
765 # |/|
803 # |/|
766 # o | 2 default
804 # o | 2 default
767 # | |
805 # | |
768 # | o 1 br
806 # | o 1 br
769 # |/
807 # |/
770 # o 0 default
808 # o 0 default
771
809
772 $ cd ..
810 $ cd ..
773 $ rm -rf sub
811 $ rm -rf sub
774 $ hg init main
812 $ hg init main
775 $ cd main
813 $ cd main
776 $ hg init s
814 $ hg init s
777 $ cd s
815 $ cd s
778 $ echo a > a
816 $ echo a > a
779 $ hg ci -Am1
817 $ hg ci -Am1
780 adding a
818 adding a
781 $ hg branch br
819 $ hg branch br
782 marked working directory as branch br
820 marked working directory as branch br
783 (branches are permanent and global, did you want a bookmark?)
821 (branches are permanent and global, did you want a bookmark?)
784 $ echo a >> a
822 $ echo a >> a
785 $ hg ci -m1
823 $ hg ci -m1
786 $ hg up default
824 $ hg up default
787 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
825 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
788 $ echo b > b
826 $ echo b > b
789 $ hg ci -Am1
827 $ hg ci -Am1
790 adding b
828 adding b
791 $ hg up br
829 $ hg up br
792 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
830 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
793 $ hg merge tip
831 $ hg merge tip
794 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
832 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
795 (branch merge, don't forget to commit)
833 (branch merge, don't forget to commit)
796 $ hg ci -m1
834 $ hg ci -m1
797 $ hg up 2
835 $ hg up 2
798 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
836 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
799 $ echo c > c
837 $ echo c > c
800 $ hg ci -Am1
838 $ hg ci -Am1
801 adding c
839 adding c
802 $ hg up 3
840 $ hg up 3
803 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
841 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
804 $ hg merge 4
842 $ hg merge 4
805 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
843 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
806 (branch merge, don't forget to commit)
844 (branch merge, don't forget to commit)
807 $ hg ci -m1
845 $ hg ci -m1
808
846
809 # main repo layout:
847 # main repo layout:
810 #
848 #
811 # * <-- try to merge default into br again
849 # * <-- try to merge default into br again
812 # .`|
850 # .`|
813 # . o 5 br --> substate = 5
851 # . o 5 br --> substate = 5
814 # . |
852 # . |
815 # o | 4 default --> substate = 4
853 # o | 4 default --> substate = 4
816 # | |
854 # | |
817 # | o 3 br --> substate = 2
855 # | o 3 br --> substate = 2
818 # |/|
856 # |/|
819 # o | 2 default --> substate = 2
857 # o | 2 default --> substate = 2
820 # | |
858 # | |
821 # | o 1 br --> substate = 3
859 # | o 1 br --> substate = 3
822 # |/
860 # |/
823 # o 0 default --> substate = 2
861 # o 0 default --> substate = 2
824
862
825 $ cd ..
863 $ cd ..
826 $ echo 's = s' > .hgsub
864 $ echo 's = s' > .hgsub
827 $ hg -R s up 2
865 $ hg -R s up 2
828 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
866 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
829 $ hg ci -Am1
867 $ hg ci -Am1
830 adding .hgsub
868 adding .hgsub
831 $ hg branch br
869 $ hg branch br
832 marked working directory as branch br
870 marked working directory as branch br
833 (branches are permanent and global, did you want a bookmark?)
871 (branches are permanent and global, did you want a bookmark?)
834 $ echo b > b
872 $ echo b > b
835 $ hg -R s up 3
873 $ hg -R s up 3
836 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
874 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 $ hg ci -Am1
875 $ hg ci -Am1
838 adding b
876 adding b
839 $ hg up default
877 $ hg up default
840 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
878 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
841 $ echo c > c
879 $ echo c > c
842 $ hg ci -Am1
880 $ hg ci -Am1
843 adding c
881 adding c
844 $ hg up 1
882 $ hg up 1
845 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
883 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
846 $ hg merge 2
884 $ hg merge 2
847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
885 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 (branch merge, don't forget to commit)
886 (branch merge, don't forget to commit)
849 $ hg ci -m1
887 $ hg ci -m1
850 $ hg up 2
888 $ hg up 2
851 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
889 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
852 $ hg -R s up 4
890 $ hg -R s up 4
853 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
891 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
854 $ echo d > d
892 $ echo d > d
855 $ hg ci -Am1
893 $ hg ci -Am1
856 adding d
894 adding d
857 $ hg up 3
895 $ hg up 3
858 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
896 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
859 $ hg -R s up 5
897 $ hg -R s up 5
860 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
898 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
861 $ echo e > e
899 $ echo e > e
862 $ hg ci -Am1
900 $ hg ci -Am1
863 adding e
901 adding e
864
902
865 $ hg up 5
903 $ hg up 5
866 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
904 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
867 $ hg merge 4 # try to merge default into br again
905 $ hg merge 4 # try to merge default into br again
868 subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
906 subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
869 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
907 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
870 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
908 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
871 (branch merge, don't forget to commit)
909 (branch merge, don't forget to commit)
872 $ cd ..
910 $ cd ..
873
911
874 test subrepo delete from .hgsubstate
912 test subrepo delete from .hgsubstate
875
913
876 $ hg init testdelete
914 $ hg init testdelete
877 $ mkdir testdelete/nested testdelete/nested2
915 $ mkdir testdelete/nested testdelete/nested2
878 $ hg init testdelete/nested
916 $ hg init testdelete/nested
879 $ hg init testdelete/nested2
917 $ hg init testdelete/nested2
880 $ echo test > testdelete/nested/foo
918 $ echo test > testdelete/nested/foo
881 $ echo test > testdelete/nested2/foo
919 $ echo test > testdelete/nested2/foo
882 $ hg -R testdelete/nested add
920 $ hg -R testdelete/nested add
883 adding testdelete/nested/foo (glob)
921 adding testdelete/nested/foo (glob)
884 $ hg -R testdelete/nested2 add
922 $ hg -R testdelete/nested2 add
885 adding testdelete/nested2/foo (glob)
923 adding testdelete/nested2/foo (glob)
886 $ hg -R testdelete/nested ci -m test
924 $ hg -R testdelete/nested ci -m test
887 $ hg -R testdelete/nested2 ci -m test
925 $ hg -R testdelete/nested2 ci -m test
888 $ echo nested = nested > testdelete/.hgsub
926 $ echo nested = nested > testdelete/.hgsub
889 $ echo nested2 = nested2 >> testdelete/.hgsub
927 $ echo nested2 = nested2 >> testdelete/.hgsub
890 $ hg -R testdelete add
928 $ hg -R testdelete add
891 adding testdelete/.hgsub (glob)
929 adding testdelete/.hgsub (glob)
892 $ hg -R testdelete ci -m "nested 1 & 2 added"
930 $ hg -R testdelete ci -m "nested 1 & 2 added"
893 $ echo nested = nested > testdelete/.hgsub
931 $ echo nested = nested > testdelete/.hgsub
894 $ hg -R testdelete ci -m "nested 2 deleted"
932 $ hg -R testdelete ci -m "nested 2 deleted"
895 $ cat testdelete/.hgsubstate
933 $ cat testdelete/.hgsubstate
896 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
934 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
897 $ hg -R testdelete remove testdelete/.hgsub
935 $ hg -R testdelete remove testdelete/.hgsub
898 $ hg -R testdelete ci -m ".hgsub deleted"
936 $ hg -R testdelete ci -m ".hgsub deleted"
899 $ cat testdelete/.hgsubstate
937 $ cat testdelete/.hgsubstate
900 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
938 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
901
939
902 test repository cloning
940 test repository cloning
903
941
904 $ mkdir mercurial mercurial2
942 $ mkdir mercurial mercurial2
905 $ hg init nested_absolute
943 $ hg init nested_absolute
906 $ echo test > nested_absolute/foo
944 $ echo test > nested_absolute/foo
907 $ hg -R nested_absolute add
945 $ hg -R nested_absolute add
908 adding nested_absolute/foo (glob)
946 adding nested_absolute/foo (glob)
909 $ hg -R nested_absolute ci -mtest
947 $ hg -R nested_absolute ci -mtest
910 $ cd mercurial
948 $ cd mercurial
911 $ hg init nested_relative
949 $ hg init nested_relative
912 $ echo test2 > nested_relative/foo2
950 $ echo test2 > nested_relative/foo2
913 $ hg -R nested_relative add
951 $ hg -R nested_relative add
914 adding nested_relative/foo2 (glob)
952 adding nested_relative/foo2 (glob)
915 $ hg -R nested_relative ci -mtest2
953 $ hg -R nested_relative ci -mtest2
916 $ hg init main
954 $ hg init main
917 $ echo "nested_relative = ../nested_relative" > main/.hgsub
955 $ echo "nested_relative = ../nested_relative" > main/.hgsub
918 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
956 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
919 $ hg -R main add
957 $ hg -R main add
920 adding main/.hgsub (glob)
958 adding main/.hgsub (glob)
921 $ hg -R main ci -m "add subrepos"
959 $ hg -R main ci -m "add subrepos"
922 $ cd ..
960 $ cd ..
923 $ hg clone mercurial/main mercurial2/main
961 $ hg clone mercurial/main mercurial2/main
924 updating to branch default
962 updating to branch default
925 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
963 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
926 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
964 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
927 > mercurial2/main/nested_relative/.hg/hgrc
965 > mercurial2/main/nested_relative/.hg/hgrc
928 [paths]
966 [paths]
929 default = $TESTTMP/mercurial/nested_absolute
967 default = $TESTTMP/mercurial/nested_absolute
930 [paths]
968 [paths]
931 default = $TESTTMP/mercurial/nested_relative
969 default = $TESTTMP/mercurial/nested_relative
932 $ rm -rf mercurial mercurial2
970 $ rm -rf mercurial mercurial2
933
971
934 Issue1977: multirepo push should fail if subrepo push fails
972 Issue1977: multirepo push should fail if subrepo push fails
935
973
936 $ hg init repo
974 $ hg init repo
937 $ hg init repo/s
975 $ hg init repo/s
938 $ echo a > repo/s/a
976 $ echo a > repo/s/a
939 $ hg -R repo/s ci -Am0
977 $ hg -R repo/s ci -Am0
940 adding a
978 adding a
941 $ echo s = s > repo/.hgsub
979 $ echo s = s > repo/.hgsub
942 $ hg -R repo ci -Am1
980 $ hg -R repo ci -Am1
943 adding .hgsub
981 adding .hgsub
944 $ hg clone repo repo2
982 $ hg clone repo repo2
945 updating to branch default
983 updating to branch default
946 cloning subrepo s from $TESTTMP/repo/s
984 cloning subrepo s from $TESTTMP/repo/s
947 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
985 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
948 $ hg -q -R repo2 pull -u
986 $ hg -q -R repo2 pull -u
949 $ echo 1 > repo2/s/a
987 $ echo 1 > repo2/s/a
950 $ hg -R repo2/s ci -m2
988 $ hg -R repo2/s ci -m2
951 $ hg -q -R repo2/s push
989 $ hg -q -R repo2/s push
952 $ hg -R repo2/s up -C 0
990 $ hg -R repo2/s up -C 0
953 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
991 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
954 $ echo 2 > repo2/s/b
992 $ echo 2 > repo2/s/b
955 $ hg -R repo2/s ci -m3 -A
993 $ hg -R repo2/s ci -m3 -A
956 adding b
994 adding b
957 created new head
995 created new head
958 $ hg -R repo2 ci -m3
996 $ hg -R repo2 ci -m3
959 $ hg -q -R repo2 push
997 $ hg -q -R repo2 push
960 abort: push creates new remote head cc505f09a8b2! (in subrepository "s")
998 abort: push creates new remote head cc505f09a8b2! (in subrepository "s")
961 (merge or see 'hg help push' for details about pushing new heads)
999 (merge or see 'hg help push' for details about pushing new heads)
962 [255]
1000 [255]
963 $ hg -R repo update
1001 $ hg -R repo update
964 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1002 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
965
1003
966 test if untracked file is not overwritten
1004 test if untracked file is not overwritten
967
1005
968 (this also tests that updated .hgsubstate is treated as "modified",
1006 (this also tests that updated .hgsubstate is treated as "modified",
969 when 'merge.update()' is aborted before 'merge.recordupdates()', even
1007 when 'merge.update()' is aborted before 'merge.recordupdates()', even
970 if none of mode, size and timestamp of it isn't changed on the
1008 if none of mode, size and timestamp of it isn't changed on the
971 filesystem (see also issue4583))
1009 filesystem (see also issue4583))
972
1010
973 $ echo issue3276_ok > repo/s/b
1011 $ echo issue3276_ok > repo/s/b
974 $ hg -R repo2 push -f -q
1012 $ hg -R repo2 push -f -q
975 $ touch -t 200001010000 repo/.hgsubstate
1013 $ touch -t 200001010000 repo/.hgsubstate
976
1014
977 $ cat >> repo/.hg/hgrc <<EOF
1015 $ cat >> repo/.hg/hgrc <<EOF
978 > [fakedirstatewritetime]
1016 > [fakedirstatewritetime]
979 > # emulate invoking dirstate.write() via repo.status()
1017 > # emulate invoking dirstate.write() via repo.status()
980 > # at 2000-01-01 00:00
1018 > # at 2000-01-01 00:00
981 > fakenow = 200001010000
1019 > fakenow = 200001010000
982 >
1020 >
983 > [extensions]
1021 > [extensions]
984 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
1022 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
985 > EOF
1023 > EOF
986 $ hg -R repo update
1024 $ hg -R repo update
987 b: untracked file differs
1025 b: untracked file differs
988 abort: untracked files in working directory differ from files in requested revision (in subrepository "s")
1026 abort: untracked files in working directory differ from files in requested revision (in subrepository "s")
989 [255]
1027 [255]
990 $ cat >> repo/.hg/hgrc <<EOF
1028 $ cat >> repo/.hg/hgrc <<EOF
991 > [extensions]
1029 > [extensions]
992 > fakedirstatewritetime = !
1030 > fakedirstatewritetime = !
993 > EOF
1031 > EOF
994
1032
995 $ cat repo/s/b
1033 $ cat repo/s/b
996 issue3276_ok
1034 issue3276_ok
997 $ rm repo/s/b
1035 $ rm repo/s/b
998 $ touch -t 200001010000 repo/.hgsubstate
1036 $ touch -t 200001010000 repo/.hgsubstate
999 $ hg -R repo revert --all
1037 $ hg -R repo revert --all
1000 reverting repo/.hgsubstate (glob)
1038 reverting repo/.hgsubstate (glob)
1001 reverting subrepo s
1039 reverting subrepo s
1002 $ hg -R repo update
1040 $ hg -R repo update
1003 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1041 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1004 $ cat repo/s/b
1042 $ cat repo/s/b
1005 2
1043 2
1006 $ rm -rf repo2 repo
1044 $ rm -rf repo2 repo
1007
1045
1008
1046
1009 Issue1852 subrepos with relative paths always push/pull relative to default
1047 Issue1852 subrepos with relative paths always push/pull relative to default
1010
1048
1011 Prepare a repo with subrepo
1049 Prepare a repo with subrepo
1012
1050
1013 $ hg init issue1852a
1051 $ hg init issue1852a
1014 $ cd issue1852a
1052 $ cd issue1852a
1015 $ hg init sub/repo
1053 $ hg init sub/repo
1016 $ echo test > sub/repo/foo
1054 $ echo test > sub/repo/foo
1017 $ hg -R sub/repo add sub/repo/foo
1055 $ hg -R sub/repo add sub/repo/foo
1018 $ echo sub/repo = sub/repo > .hgsub
1056 $ echo sub/repo = sub/repo > .hgsub
1019 $ hg add .hgsub
1057 $ hg add .hgsub
1020 $ hg ci -mtest
1058 $ hg ci -mtest
1021 committing subrepository sub/repo (glob)
1059 committing subrepository sub/repo (glob)
1022 $ echo test >> sub/repo/foo
1060 $ echo test >> sub/repo/foo
1023 $ hg ci -mtest
1061 $ hg ci -mtest
1024 committing subrepository sub/repo (glob)
1062 committing subrepository sub/repo (glob)
1025 $ hg cat sub/repo/foo
1063 $ hg cat sub/repo/foo
1026 test
1064 test
1027 test
1065 test
1028 $ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g'
1066 $ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g'
1029 [
1067 [
1030 {
1068 {
1031 "abspath": "foo",
1069 "abspath": "foo",
1032 "data": "test\ntest\n",
1070 "data": "test\ntest\n",
1033 "path": "sub/repo/foo"
1071 "path": "sub/repo/foo"
1034 }
1072 }
1035 ]
1073 ]
1036 $ mkdir -p tmp/sub/repo
1074 $ mkdir -p tmp/sub/repo
1037 $ hg cat -r 0 --output tmp/%p_p sub/repo/foo
1075 $ hg cat -r 0 --output tmp/%p_p sub/repo/foo
1038 $ cat tmp/sub/repo/foo_p
1076 $ cat tmp/sub/repo/foo_p
1039 test
1077 test
1040 $ mv sub/repo sub_
1078 $ mv sub/repo sub_
1041 $ hg cat sub/repo/baz
1079 $ hg cat sub/repo/baz
1042 skipping missing subrepository: sub/repo
1080 skipping missing subrepository: sub/repo
1043 [1]
1081 [1]
1044 $ rm -rf sub/repo
1082 $ rm -rf sub/repo
1045 $ mv sub_ sub/repo
1083 $ mv sub_ sub/repo
1046 $ cd ..
1084 $ cd ..
1047
1085
1048 Create repo without default path, pull top repo, and see what happens on update
1086 Create repo without default path, pull top repo, and see what happens on update
1049
1087
1050 $ hg init issue1852b
1088 $ hg init issue1852b
1051 $ hg -R issue1852b pull issue1852a
1089 $ hg -R issue1852b pull issue1852a
1052 pulling from issue1852a
1090 pulling from issue1852a
1053 requesting all changes
1091 requesting all changes
1054 adding changesets
1092 adding changesets
1055 adding manifests
1093 adding manifests
1056 adding file changes
1094 adding file changes
1057 added 2 changesets with 3 changes to 2 files
1095 added 2 changesets with 3 changes to 2 files
1058 new changesets 19487b456929:be5eb94e7215
1096 new changesets 19487b456929:be5eb94e7215
1059 (run 'hg update' to get a working copy)
1097 (run 'hg update' to get a working copy)
1060 $ hg -R issue1852b update
1098 $ hg -R issue1852b update
1061 abort: default path for subrepository not found (in subrepository "sub/repo") (glob)
1099 abort: default path for subrepository not found (in subrepository "sub/repo") (glob)
1062 [255]
1100 [255]
1063
1101
1064 Ensure a full traceback, not just the SubrepoAbort part
1102 Ensure a full traceback, not just the SubrepoAbort part
1065
1103
1066 $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort'
1104 $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort'
1067 raise error.Abort(_("default path for subrepository not found"))
1105 raise error.Abort(_("default path for subrepository not found"))
1068
1106
1069 Pull -u now doesn't help
1107 Pull -u now doesn't help
1070
1108
1071 $ hg -R issue1852b pull -u issue1852a
1109 $ hg -R issue1852b pull -u issue1852a
1072 pulling from issue1852a
1110 pulling from issue1852a
1073 searching for changes
1111 searching for changes
1074 no changes found
1112 no changes found
1075
1113
1076 Try the same, but with pull -u
1114 Try the same, but with pull -u
1077
1115
1078 $ hg init issue1852c
1116 $ hg init issue1852c
1079 $ hg -R issue1852c pull -r0 -u issue1852a
1117 $ hg -R issue1852c pull -r0 -u issue1852a
1080 pulling from issue1852a
1118 pulling from issue1852a
1081 adding changesets
1119 adding changesets
1082 adding manifests
1120 adding manifests
1083 adding file changes
1121 adding file changes
1084 added 1 changesets with 2 changes to 2 files
1122 added 1 changesets with 2 changes to 2 files
1085 new changesets 19487b456929
1123 new changesets 19487b456929
1086 cloning subrepo sub/repo from issue1852a/sub/repo (glob)
1124 cloning subrepo sub/repo from issue1852a/sub/repo (glob)
1087 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1125 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1088
1126
1089 Try to push from the other side
1127 Try to push from the other side
1090
1128
1091 $ hg -R issue1852a push `pwd`/issue1852c
1129 $ hg -R issue1852a push `pwd`/issue1852c
1092 pushing to $TESTTMP/issue1852c (glob)
1130 pushing to $TESTTMP/issue1852c (glob)
1093 pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob)
1131 pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob)
1094 searching for changes
1132 searching for changes
1095 no changes found
1133 no changes found
1096 searching for changes
1134 searching for changes
1097 adding changesets
1135 adding changesets
1098 adding manifests
1136 adding manifests
1099 adding file changes
1137 adding file changes
1100 added 1 changesets with 1 changes to 1 files
1138 added 1 changesets with 1 changes to 1 files
1101
1139
1102 Incoming and outgoing should not use the default path:
1140 Incoming and outgoing should not use the default path:
1103
1141
1104 $ hg clone -q issue1852a issue1852d
1142 $ hg clone -q issue1852a issue1852d
1105 $ hg -R issue1852d outgoing --subrepos issue1852c
1143 $ hg -R issue1852d outgoing --subrepos issue1852c
1106 comparing with issue1852c
1144 comparing with issue1852c
1107 searching for changes
1145 searching for changes
1108 no changes found
1146 no changes found
1109 comparing with issue1852c/sub/repo
1147 comparing with issue1852c/sub/repo
1110 searching for changes
1148 searching for changes
1111 no changes found
1149 no changes found
1112 [1]
1150 [1]
1113 $ hg -R issue1852d incoming --subrepos issue1852c
1151 $ hg -R issue1852d incoming --subrepos issue1852c
1114 comparing with issue1852c
1152 comparing with issue1852c
1115 searching for changes
1153 searching for changes
1116 no changes found
1154 no changes found
1117 comparing with issue1852c/sub/repo
1155 comparing with issue1852c/sub/repo
1118 searching for changes
1156 searching for changes
1119 no changes found
1157 no changes found
1120 [1]
1158 [1]
1121
1159
1122 Check that merge of a new subrepo doesn't write the uncommitted state to
1160 Check that merge of a new subrepo doesn't write the uncommitted state to
1123 .hgsubstate (issue4622)
1161 .hgsubstate (issue4622)
1124
1162
1125 $ hg init issue1852a/addedsub
1163 $ hg init issue1852a/addedsub
1126 $ echo zzz > issue1852a/addedsub/zz.txt
1164 $ echo zzz > issue1852a/addedsub/zz.txt
1127 $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
1165 $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
1128
1166
1129 $ hg clone issue1852a/addedsub issue1852d/addedsub
1167 $ hg clone issue1852a/addedsub issue1852d/addedsub
1130 updating to branch default
1168 updating to branch default
1131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1132
1170
1133 $ echo def > issue1852a/sub/repo/foo
1171 $ echo def > issue1852a/sub/repo/foo
1134 $ hg -R issue1852a ci -SAm 'tweaked subrepo'
1172 $ hg -R issue1852a ci -SAm 'tweaked subrepo'
1135 adding tmp/sub/repo/foo_p
1173 adding tmp/sub/repo/foo_p
1136 committing subrepository sub/repo (glob)
1174 committing subrepository sub/repo (glob)
1137
1175
1138 $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
1176 $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
1139 $ echo xyz > issue1852d/sub/repo/foo
1177 $ echo xyz > issue1852d/sub/repo/foo
1140 $ hg -R issue1852d pull -u
1178 $ hg -R issue1852d pull -u
1141 pulling from $TESTTMP/issue1852a (glob)
1179 pulling from $TESTTMP/issue1852a (glob)
1142 searching for changes
1180 searching for changes
1143 adding changesets
1181 adding changesets
1144 adding manifests
1182 adding manifests
1145 adding file changes
1183 adding file changes
1146 added 1 changesets with 2 changes to 2 files
1184 added 1 changesets with 2 changes to 2 files
1147 new changesets c82b79fdcc5b
1185 new changesets c82b79fdcc5b
1148 subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
1186 subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
1149 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1187 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1150 pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob)
1188 pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob)
1151 searching for changes
1189 searching for changes
1152 adding changesets
1190 adding changesets
1153 adding manifests
1191 adding manifests
1154 adding file changes
1192 adding file changes
1155 added 1 changesets with 1 changes to 1 files
1193 added 1 changesets with 1 changes to 1 files
1156 new changesets 46cd4aac504c
1194 new changesets 46cd4aac504c
1157 subrepository sources for sub/repo differ (glob)
1195 subrepository sources for sub/repo differ (glob)
1158 use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
1196 use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
1159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1197 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1160 $ cat issue1852d/.hgsubstate
1198 $ cat issue1852d/.hgsubstate
1161 f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
1199 f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
1162
1200
1163 Check status of files when none of them belong to the first
1201 Check status of files when none of them belong to the first
1164 subrepository:
1202 subrepository:
1165
1203
1166 $ hg init subrepo-status
1204 $ hg init subrepo-status
1167 $ cd subrepo-status
1205 $ cd subrepo-status
1168 $ hg init subrepo-1
1206 $ hg init subrepo-1
1169 $ hg init subrepo-2
1207 $ hg init subrepo-2
1170 $ cd subrepo-2
1208 $ cd subrepo-2
1171 $ touch file
1209 $ touch file
1172 $ hg add file
1210 $ hg add file
1173 $ cd ..
1211 $ cd ..
1174 $ echo subrepo-1 = subrepo-1 > .hgsub
1212 $ echo subrepo-1 = subrepo-1 > .hgsub
1175 $ echo subrepo-2 = subrepo-2 >> .hgsub
1213 $ echo subrepo-2 = subrepo-2 >> .hgsub
1176 $ hg add .hgsub
1214 $ hg add .hgsub
1177 $ hg ci -m 'Added subrepos'
1215 $ hg ci -m 'Added subrepos'
1178 committing subrepository subrepo-2
1216 committing subrepository subrepo-2
1179 $ hg st subrepo-2/file
1217 $ hg st subrepo-2/file
1180
1218
1181 Check that share works with subrepo
1219 Check that share works with subrepo
1182 $ hg --config extensions.share= share . ../shared
1220 $ hg --config extensions.share= share . ../shared
1183 updating working directory
1221 updating working directory
1184 sharing subrepo subrepo-1 from $TESTTMP/subrepo-status/subrepo-1
1222 sharing subrepo subrepo-1 from $TESTTMP/subrepo-status/subrepo-1
1185 sharing subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
1223 sharing subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
1186 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1224 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1187 $ find ../shared/* | sort
1225 $ find ../shared/* | sort
1188 ../shared/subrepo-1
1226 ../shared/subrepo-1
1189 ../shared/subrepo-1/.hg
1227 ../shared/subrepo-1/.hg
1190 ../shared/subrepo-1/.hg/cache
1228 ../shared/subrepo-1/.hg/cache
1191 ../shared/subrepo-1/.hg/cache/storehash
1229 ../shared/subrepo-1/.hg/cache/storehash
1192 ../shared/subrepo-1/.hg/cache/storehash/* (glob)
1230 ../shared/subrepo-1/.hg/cache/storehash/* (glob)
1193 ../shared/subrepo-1/.hg/hgrc
1231 ../shared/subrepo-1/.hg/hgrc
1194 ../shared/subrepo-1/.hg/requires
1232 ../shared/subrepo-1/.hg/requires
1195 ../shared/subrepo-1/.hg/sharedpath
1233 ../shared/subrepo-1/.hg/sharedpath
1196 ../shared/subrepo-2
1234 ../shared/subrepo-2
1197 ../shared/subrepo-2/.hg
1235 ../shared/subrepo-2/.hg
1198 ../shared/subrepo-2/.hg/branch
1236 ../shared/subrepo-2/.hg/branch
1199 ../shared/subrepo-2/.hg/cache
1237 ../shared/subrepo-2/.hg/cache
1200 ../shared/subrepo-2/.hg/cache/checkisexec (execbit !)
1238 ../shared/subrepo-2/.hg/cache/checkisexec (execbit !)
1201 ../shared/subrepo-2/.hg/cache/checklink (symlink !)
1239 ../shared/subrepo-2/.hg/cache/checklink (symlink !)
1202 ../shared/subrepo-2/.hg/cache/checklink-target (symlink !)
1240 ../shared/subrepo-2/.hg/cache/checklink-target (symlink !)
1203 ../shared/subrepo-2/.hg/cache/storehash
1241 ../shared/subrepo-2/.hg/cache/storehash
1204 ../shared/subrepo-2/.hg/cache/storehash/* (glob)
1242 ../shared/subrepo-2/.hg/cache/storehash/* (glob)
1205 ../shared/subrepo-2/.hg/dirstate
1243 ../shared/subrepo-2/.hg/dirstate
1206 ../shared/subrepo-2/.hg/hgrc
1244 ../shared/subrepo-2/.hg/hgrc
1207 ../shared/subrepo-2/.hg/requires
1245 ../shared/subrepo-2/.hg/requires
1208 ../shared/subrepo-2/.hg/sharedpath
1246 ../shared/subrepo-2/.hg/sharedpath
1209 ../shared/subrepo-2/file
1247 ../shared/subrepo-2/file
1210 $ hg -R ../shared in
1248 $ hg -R ../shared in
1211 abort: repository default not found!
1249 abort: repository default not found!
1212 [255]
1250 [255]
1213 $ hg -R ../shared/subrepo-2 showconfig paths
1251 $ hg -R ../shared/subrepo-2 showconfig paths
1214 paths.default=$TESTTMP/subrepo-status/subrepo-2
1252 paths.default=$TESTTMP/subrepo-status/subrepo-2
1215 $ hg -R ../shared/subrepo-1 sum --remote
1253 $ hg -R ../shared/subrepo-1 sum --remote
1216 parent: -1:000000000000 tip (empty repository)
1254 parent: -1:000000000000 tip (empty repository)
1217 branch: default
1255 branch: default
1218 commit: (clean)
1256 commit: (clean)
1219 update: (current)
1257 update: (current)
1220 remote: (synced)
1258 remote: (synced)
1221
1259
1222 Check hg update --clean
1260 Check hg update --clean
1223 $ cd $TESTTMP/t
1261 $ cd $TESTTMP/t
1224 $ rm -r t/t.orig
1262 $ rm -r t/t.orig
1225 $ hg status -S --all
1263 $ hg status -S --all
1226 C .hgsub
1264 C .hgsub
1227 C .hgsubstate
1265 C .hgsubstate
1228 C a
1266 C a
1229 C s/.hgsub
1267 C s/.hgsub
1230 C s/.hgsubstate
1268 C s/.hgsubstate
1231 C s/a
1269 C s/a
1232 C s/ss/a
1270 C s/ss/a
1233 C t/t
1271 C t/t
1234 $ echo c1 > s/a
1272 $ echo c1 > s/a
1235 $ cd s
1273 $ cd s
1236 $ echo c1 > b
1274 $ echo c1 > b
1237 $ echo c1 > c
1275 $ echo c1 > c
1238 $ hg add b
1276 $ hg add b
1239 $ cd ..
1277 $ cd ..
1240 $ hg status -S
1278 $ hg status -S
1241 M s/a
1279 M s/a
1242 A s/b
1280 A s/b
1243 ? s/c
1281 ? s/c
1244 $ hg update -C
1282 $ hg update -C
1245 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1283 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1246 updated to "925c17564ef8: 13"
1284 updated to "925c17564ef8: 13"
1247 2 other heads for branch "default"
1285 2 other heads for branch "default"
1248 $ hg status -S
1286 $ hg status -S
1249 ? s/b
1287 ? s/b
1250 ? s/c
1288 ? s/c
1251
1289
1252 Sticky subrepositories, no changes
1290 Sticky subrepositories, no changes
1253 $ cd $TESTTMP/t
1291 $ cd $TESTTMP/t
1254 $ hg id
1292 $ hg id
1255 925c17564ef8 tip
1293 925c17564ef8 tip
1256 $ hg -R s id
1294 $ hg -R s id
1257 12a213df6fa9 tip
1295 12a213df6fa9 tip
1258 $ hg -R t id
1296 $ hg -R t id
1259 52c0adc0515a tip
1297 52c0adc0515a tip
1260 $ hg update 11
1298 $ hg update 11
1261 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1262 $ hg id
1300 $ hg id
1263 365661e5936a
1301 365661e5936a
1264 $ hg -R s id
1302 $ hg -R s id
1265 fc627a69481f
1303 fc627a69481f
1266 $ hg -R t id
1304 $ hg -R t id
1267 e95bcfa18a35
1305 e95bcfa18a35
1268
1306
1269 Sticky subrepositories, file changes
1307 Sticky subrepositories, file changes
1270 $ touch s/f1
1308 $ touch s/f1
1271 $ touch t/f1
1309 $ touch t/f1
1272 $ hg add -S s/f1
1310 $ hg add -S s/f1
1273 $ hg add -S t/f1
1311 $ hg add -S t/f1
1274 $ hg id
1312 $ hg id
1275 365661e5936a+
1313 365661e5936a+
1276 $ hg -R s id
1314 $ hg -R s id
1277 fc627a69481f+
1315 fc627a69481f+
1278 $ hg -R t id
1316 $ hg -R t id
1279 e95bcfa18a35+
1317 e95bcfa18a35+
1280 $ hg update tip
1318 $ hg update tip
1281 subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
1319 subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
1282 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1320 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1283 subrepository sources for s differ
1321 subrepository sources for s differ
1284 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
1322 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
1285 subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
1323 subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
1286 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1324 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1287 subrepository sources for t differ
1325 subrepository sources for t differ
1288 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
1326 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
1289 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1327 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1290 $ hg id
1328 $ hg id
1291 925c17564ef8+ tip
1329 925c17564ef8+ tip
1292 $ hg -R s id
1330 $ hg -R s id
1293 fc627a69481f+
1331 fc627a69481f+
1294 $ hg -R t id
1332 $ hg -R t id
1295 e95bcfa18a35+
1333 e95bcfa18a35+
1296 $ hg update --clean tip
1334 $ hg update --clean tip
1297 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1335 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1298
1336
1299 Sticky subrepository, revision updates
1337 Sticky subrepository, revision updates
1300 $ hg id
1338 $ hg id
1301 925c17564ef8 tip
1339 925c17564ef8 tip
1302 $ hg -R s id
1340 $ hg -R s id
1303 12a213df6fa9 tip
1341 12a213df6fa9 tip
1304 $ hg -R t id
1342 $ hg -R t id
1305 52c0adc0515a tip
1343 52c0adc0515a tip
1306 $ cd s
1344 $ cd s
1307 $ hg update -r -2
1345 $ hg update -r -2
1308 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1346 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1309 $ cd ../t
1347 $ cd ../t
1310 $ hg update -r 2
1348 $ hg update -r 2
1311 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1349 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1312 $ cd ..
1350 $ cd ..
1313 $ hg update 10
1351 $ hg update 10
1314 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1352 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1315 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1353 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1316 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
1354 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
1317 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1355 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1318 subrepository sources for t differ (in checked out version)
1356 subrepository sources for t differ (in checked out version)
1319 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
1357 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
1320 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1358 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1321 $ hg id
1359 $ hg id
1322 e45c8b14af55+
1360 e45c8b14af55+
1323 $ hg -R s id
1361 $ hg -R s id
1324 02dcf1d70411
1362 02dcf1d70411
1325 $ hg -R t id
1363 $ hg -R t id
1326 7af322bc1198
1364 7af322bc1198
1327
1365
1328 Sticky subrepository, file changes and revision updates
1366 Sticky subrepository, file changes and revision updates
1329 $ touch s/f1
1367 $ touch s/f1
1330 $ touch t/f1
1368 $ touch t/f1
1331 $ hg add -S s/f1
1369 $ hg add -S s/f1
1332 $ hg add -S t/f1
1370 $ hg add -S t/f1
1333 $ hg id
1371 $ hg id
1334 e45c8b14af55+
1372 e45c8b14af55+
1335 $ hg -R s id
1373 $ hg -R s id
1336 02dcf1d70411+
1374 02dcf1d70411+
1337 $ hg -R t id
1375 $ hg -R t id
1338 7af322bc1198+
1376 7af322bc1198+
1339 $ hg update tip
1377 $ hg update tip
1340 subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
1378 subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
1341 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1379 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1342 subrepository sources for s differ
1380 subrepository sources for s differ
1343 use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
1381 use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
1344 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
1382 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
1345 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1383 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1346 subrepository sources for t differ
1384 subrepository sources for t differ
1347 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
1385 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
1348 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1386 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1349 $ hg id
1387 $ hg id
1350 925c17564ef8+ tip
1388 925c17564ef8+ tip
1351 $ hg -R s id
1389 $ hg -R s id
1352 02dcf1d70411+
1390 02dcf1d70411+
1353 $ hg -R t id
1391 $ hg -R t id
1354 7af322bc1198+
1392 7af322bc1198+
1355
1393
1356 Sticky repository, update --clean
1394 Sticky repository, update --clean
1357 $ hg update --clean tip
1395 $ hg update --clean tip
1358 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1396 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1359 $ hg id
1397 $ hg id
1360 925c17564ef8 tip
1398 925c17564ef8 tip
1361 $ hg -R s id
1399 $ hg -R s id
1362 12a213df6fa9 tip
1400 12a213df6fa9 tip
1363 $ hg -R t id
1401 $ hg -R t id
1364 52c0adc0515a tip
1402 52c0adc0515a tip
1365
1403
1366 Test subrepo already at intended revision:
1404 Test subrepo already at intended revision:
1367 $ cd s
1405 $ cd s
1368 $ hg update fc627a69481f
1406 $ hg update fc627a69481f
1369 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1407 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1370 $ cd ..
1408 $ cd ..
1371 $ hg update 11
1409 $ hg update 11
1372 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1410 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1373 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1411 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1374 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1412 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1375 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1413 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1376 $ hg id -n
1414 $ hg id -n
1377 11+
1415 11+
1378 $ hg -R s id
1416 $ hg -R s id
1379 fc627a69481f
1417 fc627a69481f
1380 $ hg -R t id
1418 $ hg -R t id
1381 e95bcfa18a35
1419 e95bcfa18a35
1382
1420
1383 Test that removing .hgsubstate doesn't break anything:
1421 Test that removing .hgsubstate doesn't break anything:
1384
1422
1385 $ hg rm -f .hgsubstate
1423 $ hg rm -f .hgsubstate
1386 $ hg ci -mrm
1424 $ hg ci -mrm
1387 nothing changed
1425 nothing changed
1388 [1]
1426 [1]
1389 $ hg log -vr tip
1427 $ hg log -vr tip
1390 changeset: 13:925c17564ef8
1428 changeset: 13:925c17564ef8
1391 tag: tip
1429 tag: tip
1392 user: test
1430 user: test
1393 date: Thu Jan 01 00:00:00 1970 +0000
1431 date: Thu Jan 01 00:00:00 1970 +0000
1394 files: .hgsubstate
1432 files: .hgsubstate
1395 description:
1433 description:
1396 13
1434 13
1397
1435
1398
1436
1399
1437
1400 Test that removing .hgsub removes .hgsubstate:
1438 Test that removing .hgsub removes .hgsubstate:
1401
1439
1402 $ hg rm .hgsub
1440 $ hg rm .hgsub
1403 $ hg ci -mrm2
1441 $ hg ci -mrm2
1404 created new head
1442 created new head
1405 $ hg log -vr tip
1443 $ hg log -vr tip
1406 changeset: 14:2400bccd50af
1444 changeset: 14:2400bccd50af
1407 tag: tip
1445 tag: tip
1408 parent: 11:365661e5936a
1446 parent: 11:365661e5936a
1409 user: test
1447 user: test
1410 date: Thu Jan 01 00:00:00 1970 +0000
1448 date: Thu Jan 01 00:00:00 1970 +0000
1411 files: .hgsub .hgsubstate
1449 files: .hgsub .hgsubstate
1412 description:
1450 description:
1413 rm2
1451 rm2
1414
1452
1415
1453
1416 Test issue3153: diff -S with deleted subrepos
1454 Test issue3153: diff -S with deleted subrepos
1417
1455
1418 $ hg diff --nodates -S -c .
1456 $ hg diff --nodates -S -c .
1419 diff -r 365661e5936a -r 2400bccd50af .hgsub
1457 diff -r 365661e5936a -r 2400bccd50af .hgsub
1420 --- a/.hgsub
1458 --- a/.hgsub
1421 +++ /dev/null
1459 +++ /dev/null
1422 @@ -1,2 +0,0 @@
1460 @@ -1,2 +0,0 @@
1423 -s = s
1461 -s = s
1424 -t = t
1462 -t = t
1425 diff -r 365661e5936a -r 2400bccd50af .hgsubstate
1463 diff -r 365661e5936a -r 2400bccd50af .hgsubstate
1426 --- a/.hgsubstate
1464 --- a/.hgsubstate
1427 +++ /dev/null
1465 +++ /dev/null
1428 @@ -1,2 +0,0 @@
1466 @@ -1,2 +0,0 @@
1429 -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1467 -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1430 -e95bcfa18a358dc4936da981ebf4147b4cad1362 t
1468 -e95bcfa18a358dc4936da981ebf4147b4cad1362 t
1431
1469
1432 Test behavior of add for explicit path in subrepo:
1470 Test behavior of add for explicit path in subrepo:
1433 $ cd ..
1471 $ cd ..
1434 $ hg init explicit
1472 $ hg init explicit
1435 $ cd explicit
1473 $ cd explicit
1436 $ echo s = s > .hgsub
1474 $ echo s = s > .hgsub
1437 $ hg add .hgsub
1475 $ hg add .hgsub
1438 $ hg init s
1476 $ hg init s
1439 $ hg ci -m0
1477 $ hg ci -m0
1440 Adding with an explicit path in a subrepo adds the file
1478 Adding with an explicit path in a subrepo adds the file
1441 $ echo c1 > f1
1479 $ echo c1 > f1
1442 $ echo c2 > s/f2
1480 $ echo c2 > s/f2
1443 $ hg st -S
1481 $ hg st -S
1444 ? f1
1482 ? f1
1445 ? s/f2
1483 ? s/f2
1446 $ hg add s/f2
1484 $ hg add s/f2
1447 $ hg st -S
1485 $ hg st -S
1448 A s/f2
1486 A s/f2
1449 ? f1
1487 ? f1
1450 $ hg ci -R s -m0
1488 $ hg ci -R s -m0
1451 $ hg ci -Am1
1489 $ hg ci -Am1
1452 adding f1
1490 adding f1
1453 Adding with an explicit path in a subrepo with -S has the same behavior
1491 Adding with an explicit path in a subrepo with -S has the same behavior
1454 $ echo c3 > f3
1492 $ echo c3 > f3
1455 $ echo c4 > s/f4
1493 $ echo c4 > s/f4
1456 $ hg st -S
1494 $ hg st -S
1457 ? f3
1495 ? f3
1458 ? s/f4
1496 ? s/f4
1459 $ hg add -S s/f4
1497 $ hg add -S s/f4
1460 $ hg st -S
1498 $ hg st -S
1461 A s/f4
1499 A s/f4
1462 ? f3
1500 ? f3
1463 $ hg ci -R s -m1
1501 $ hg ci -R s -m1
1464 $ hg ci -Ama2
1502 $ hg ci -Ama2
1465 adding f3
1503 adding f3
1466 Adding without a path or pattern silently ignores subrepos
1504 Adding without a path or pattern silently ignores subrepos
1467 $ echo c5 > f5
1505 $ echo c5 > f5
1468 $ echo c6 > s/f6
1506 $ echo c6 > s/f6
1469 $ echo c7 > s/f7
1507 $ echo c7 > s/f7
1470 $ hg st -S
1508 $ hg st -S
1471 ? f5
1509 ? f5
1472 ? s/f6
1510 ? s/f6
1473 ? s/f7
1511 ? s/f7
1474 $ hg add
1512 $ hg add
1475 adding f5
1513 adding f5
1476 $ hg st -S
1514 $ hg st -S
1477 A f5
1515 A f5
1478 ? s/f6
1516 ? s/f6
1479 ? s/f7
1517 ? s/f7
1480 $ hg ci -R s -Am2
1518 $ hg ci -R s -Am2
1481 adding f6
1519 adding f6
1482 adding f7
1520 adding f7
1483 $ hg ci -m3
1521 $ hg ci -m3
1484 Adding without a path or pattern with -S also adds files in subrepos
1522 Adding without a path or pattern with -S also adds files in subrepos
1485 $ echo c8 > f8
1523 $ echo c8 > f8
1486 $ echo c9 > s/f9
1524 $ echo c9 > s/f9
1487 $ echo c10 > s/f10
1525 $ echo c10 > s/f10
1488 $ hg st -S
1526 $ hg st -S
1489 ? f8
1527 ? f8
1490 ? s/f10
1528 ? s/f10
1491 ? s/f9
1529 ? s/f9
1492 $ hg add -S
1530 $ hg add -S
1493 adding f8
1531 adding f8
1494 adding s/f10 (glob)
1532 adding s/f10 (glob)
1495 adding s/f9 (glob)
1533 adding s/f9 (glob)
1496 $ hg st -S
1534 $ hg st -S
1497 A f8
1535 A f8
1498 A s/f10
1536 A s/f10
1499 A s/f9
1537 A s/f9
1500 $ hg ci -R s -m3
1538 $ hg ci -R s -m3
1501 $ hg ci -m4
1539 $ hg ci -m4
1502 Adding with a pattern silently ignores subrepos
1540 Adding with a pattern silently ignores subrepos
1503 $ echo c11 > fm11
1541 $ echo c11 > fm11
1504 $ echo c12 > fn12
1542 $ echo c12 > fn12
1505 $ echo c13 > s/fm13
1543 $ echo c13 > s/fm13
1506 $ echo c14 > s/fn14
1544 $ echo c14 > s/fn14
1507 $ hg st -S
1545 $ hg st -S
1508 ? fm11
1546 ? fm11
1509 ? fn12
1547 ? fn12
1510 ? s/fm13
1548 ? s/fm13
1511 ? s/fn14
1549 ? s/fn14
1512 $ hg add 'glob:**fm*'
1550 $ hg add 'glob:**fm*'
1513 adding fm11
1551 adding fm11
1514 $ hg st -S
1552 $ hg st -S
1515 A fm11
1553 A fm11
1516 ? fn12
1554 ? fn12
1517 ? s/fm13
1555 ? s/fm13
1518 ? s/fn14
1556 ? s/fn14
1519 $ hg ci -R s -Am4
1557 $ hg ci -R s -Am4
1520 adding fm13
1558 adding fm13
1521 adding fn14
1559 adding fn14
1522 $ hg ci -Am5
1560 $ hg ci -Am5
1523 adding fn12
1561 adding fn12
1524 Adding with a pattern with -S also adds matches in subrepos
1562 Adding with a pattern with -S also adds matches in subrepos
1525 $ echo c15 > fm15
1563 $ echo c15 > fm15
1526 $ echo c16 > fn16
1564 $ echo c16 > fn16
1527 $ echo c17 > s/fm17
1565 $ echo c17 > s/fm17
1528 $ echo c18 > s/fn18
1566 $ echo c18 > s/fn18
1529 $ hg st -S
1567 $ hg st -S
1530 ? fm15
1568 ? fm15
1531 ? fn16
1569 ? fn16
1532 ? s/fm17
1570 ? s/fm17
1533 ? s/fn18
1571 ? s/fn18
1534 $ hg add -S 'glob:**fm*'
1572 $ hg add -S 'glob:**fm*'
1535 adding fm15
1573 adding fm15
1536 adding s/fm17 (glob)
1574 adding s/fm17 (glob)
1537 $ hg st -S
1575 $ hg st -S
1538 A fm15
1576 A fm15
1539 A s/fm17
1577 A s/fm17
1540 ? fn16
1578 ? fn16
1541 ? s/fn18
1579 ? s/fn18
1542 $ hg ci -R s -Am5
1580 $ hg ci -R s -Am5
1543 adding fn18
1581 adding fn18
1544 $ hg ci -Am6
1582 $ hg ci -Am6
1545 adding fn16
1583 adding fn16
1546
1584
1547 Test behavior of forget for explicit path in subrepo:
1585 Test behavior of forget for explicit path in subrepo:
1548 Forgetting an explicit path in a subrepo untracks the file
1586 Forgetting an explicit path in a subrepo untracks the file
1549 $ echo c19 > s/f19
1587 $ echo c19 > s/f19
1550 $ hg add s/f19
1588 $ hg add s/f19
1551 $ hg st -S
1589 $ hg st -S
1552 A s/f19
1590 A s/f19
1553 $ hg forget s/f19
1591 $ hg forget s/f19
1554 $ hg st -S
1592 $ hg st -S
1555 ? s/f19
1593 ? s/f19
1556 $ rm s/f19
1594 $ rm s/f19
1557 $ cd ..
1595 $ cd ..
1558
1596
1559 Courtesy phases synchronisation to publishing server does not block the push
1597 Courtesy phases synchronisation to publishing server does not block the push
1560 (issue3781)
1598 (issue3781)
1561
1599
1562 $ cp -R main issue3781
1600 $ cp -R main issue3781
1563 $ cp -R main issue3781-dest
1601 $ cp -R main issue3781-dest
1564 $ cd issue3781-dest/s
1602 $ cd issue3781-dest/s
1565 $ hg phase tip # show we have draft changeset
1603 $ hg phase tip # show we have draft changeset
1566 5: draft
1604 5: draft
1567 $ chmod a-w .hg/store/phaseroots # prevent phase push
1605 $ chmod a-w .hg/store/phaseroots # prevent phase push
1568 $ cd ../../issue3781
1606 $ cd ../../issue3781
1569 $ cat >> .hg/hgrc << EOF
1607 $ cat >> .hg/hgrc << EOF
1570 > [paths]
1608 > [paths]
1571 > default=../issue3781-dest/
1609 > default=../issue3781-dest/
1572 > EOF
1610 > EOF
1573 $ hg push --config devel.legacy.exchange=bundle1
1611 $ hg push --config devel.legacy.exchange=bundle1
1574 pushing to $TESTTMP/issue3781-dest (glob)
1612 pushing to $TESTTMP/issue3781-dest (glob)
1575 pushing subrepo s to $TESTTMP/issue3781-dest/s
1613 pushing subrepo s to $TESTTMP/issue3781-dest/s
1576 searching for changes
1614 searching for changes
1577 no changes found
1615 no changes found
1578 searching for changes
1616 searching for changes
1579 no changes found
1617 no changes found
1580 [1]
1618 [1]
1581 # clean the push cache
1619 # clean the push cache
1582 $ rm s/.hg/cache/storehash/*
1620 $ rm s/.hg/cache/storehash/*
1583 $ hg push # bundle2+
1621 $ hg push # bundle2+
1584 pushing to $TESTTMP/issue3781-dest (glob)
1622 pushing to $TESTTMP/issue3781-dest (glob)
1585 pushing subrepo s to $TESTTMP/issue3781-dest/s
1623 pushing subrepo s to $TESTTMP/issue3781-dest/s
1586 searching for changes
1624 searching for changes
1587 no changes found
1625 no changes found
1588 searching for changes
1626 searching for changes
1589 no changes found
1627 no changes found
1590 [1]
1628 [1]
1591 $ cd ..
1629 $ cd ..
1592
1630
1593 Test phase choice for newly created commit with "phases.subrepochecks"
1631 Test phase choice for newly created commit with "phases.subrepochecks"
1594 configuration
1632 configuration
1595
1633
1596 $ cd t
1634 $ cd t
1597 $ hg update -q -r 12
1635 $ hg update -q -r 12
1598
1636
1599 $ cat >> s/ss/.hg/hgrc <<EOF
1637 $ cat >> s/ss/.hg/hgrc <<EOF
1600 > [phases]
1638 > [phases]
1601 > new-commit = secret
1639 > new-commit = secret
1602 > EOF
1640 > EOF
1603 $ cat >> s/.hg/hgrc <<EOF
1641 $ cat >> s/.hg/hgrc <<EOF
1604 > [phases]
1642 > [phases]
1605 > new-commit = draft
1643 > new-commit = draft
1606 > EOF
1644 > EOF
1607 $ echo phasecheck1 >> s/ss/a
1645 $ echo phasecheck1 >> s/ss/a
1608 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1646 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1609 committing subrepository ss
1647 committing subrepository ss
1610 transaction abort!
1648 transaction abort!
1611 rollback completed
1649 rollback completed
1612 abort: can't commit in draft phase conflicting secret from subrepository ss
1650 abort: can't commit in draft phase conflicting secret from subrepository ss
1613 [255]
1651 [255]
1614 $ echo phasecheck2 >> s/ss/a
1652 $ echo phasecheck2 >> s/ss/a
1615 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1653 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1616 committing subrepository ss
1654 committing subrepository ss
1617 $ hg -R s/ss phase tip
1655 $ hg -R s/ss phase tip
1618 3: secret
1656 3: secret
1619 $ hg -R s phase tip
1657 $ hg -R s phase tip
1620 6: draft
1658 6: draft
1621 $ echo phasecheck3 >> s/ss/a
1659 $ echo phasecheck3 >> s/ss/a
1622 $ hg -R s commit -S -m phasecheck3
1660 $ hg -R s commit -S -m phasecheck3
1623 committing subrepository ss
1661 committing subrepository ss
1624 warning: changes are committed in secret phase from subrepository ss
1662 warning: changes are committed in secret phase from subrepository ss
1625 $ hg -R s/ss phase tip
1663 $ hg -R s/ss phase tip
1626 4: secret
1664 4: secret
1627 $ hg -R s phase tip
1665 $ hg -R s phase tip
1628 7: secret
1666 7: secret
1629
1667
1630 $ cat >> t/.hg/hgrc <<EOF
1668 $ cat >> t/.hg/hgrc <<EOF
1631 > [phases]
1669 > [phases]
1632 > new-commit = draft
1670 > new-commit = draft
1633 > EOF
1671 > EOF
1634 $ cat >> .hg/hgrc <<EOF
1672 $ cat >> .hg/hgrc <<EOF
1635 > [phases]
1673 > [phases]
1636 > new-commit = public
1674 > new-commit = public
1637 > EOF
1675 > EOF
1638 $ echo phasecheck4 >> s/ss/a
1676 $ echo phasecheck4 >> s/ss/a
1639 $ echo phasecheck4 >> t/t
1677 $ echo phasecheck4 >> t/t
1640 $ hg commit -S -m phasecheck4
1678 $ hg commit -S -m phasecheck4
1641 committing subrepository s
1679 committing subrepository s
1642 committing subrepository s/ss (glob)
1680 committing subrepository s/ss (glob)
1643 warning: changes are committed in secret phase from subrepository ss
1681 warning: changes are committed in secret phase from subrepository ss
1644 committing subrepository t
1682 committing subrepository t
1645 warning: changes are committed in secret phase from subrepository s
1683 warning: changes are committed in secret phase from subrepository s
1646 created new head
1684 created new head
1647 $ hg -R s/ss phase tip
1685 $ hg -R s/ss phase tip
1648 5: secret
1686 5: secret
1649 $ hg -R s phase tip
1687 $ hg -R s phase tip
1650 8: secret
1688 8: secret
1651 $ hg -R t phase tip
1689 $ hg -R t phase tip
1652 6: draft
1690 6: draft
1653 $ hg phase tip
1691 $ hg phase tip
1654 15: secret
1692 15: secret
1655
1693
1656 $ cd ..
1694 $ cd ..
1657
1695
1658
1696
1659 Test that commit --secret works on both repo and subrepo (issue4182)
1697 Test that commit --secret works on both repo and subrepo (issue4182)
1660
1698
1661 $ cd main
1699 $ cd main
1662 $ echo secret >> b
1700 $ echo secret >> b
1663 $ echo secret >> s/b
1701 $ echo secret >> s/b
1664 $ hg commit --secret --subrepo -m "secret"
1702 $ hg commit --secret --subrepo -m "secret"
1665 committing subrepository s
1703 committing subrepository s
1666 $ hg phase -r .
1704 $ hg phase -r .
1667 6: secret
1705 6: secret
1668 $ cd s
1706 $ cd s
1669 $ hg phase -r .
1707 $ hg phase -r .
1670 6: secret
1708 6: secret
1671 $ cd ../../
1709 $ cd ../../
1672
1710
1673 Test "subrepos" template keyword
1711 Test "subrepos" template keyword
1674
1712
1675 $ cd t
1713 $ cd t
1676 $ hg update -q 15
1714 $ hg update -q 15
1677 $ cat > .hgsub <<EOF
1715 $ cat > .hgsub <<EOF
1678 > s = s
1716 > s = s
1679 > EOF
1717 > EOF
1680 $ hg commit -m "16"
1718 $ hg commit -m "16"
1681 warning: changes are committed in secret phase from subrepository s
1719 warning: changes are committed in secret phase from subrepository s
1682
1720
1683 (addition of ".hgsub" itself)
1721 (addition of ".hgsub" itself)
1684
1722
1685 $ hg diff --nodates -c 1 .hgsubstate
1723 $ hg diff --nodates -c 1 .hgsubstate
1686 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1724 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1687 --- /dev/null
1725 --- /dev/null
1688 +++ b/.hgsubstate
1726 +++ b/.hgsubstate
1689 @@ -0,0 +1,1 @@
1727 @@ -0,0 +1,1 @@
1690 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1728 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1691 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1729 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1692 f7b1eb17ad24 000000000000
1730 f7b1eb17ad24 000000000000
1693 s
1731 s
1694
1732
1695 (modification of existing entry)
1733 (modification of existing entry)
1696
1734
1697 $ hg diff --nodates -c 2 .hgsubstate
1735 $ hg diff --nodates -c 2 .hgsubstate
1698 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1736 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1699 --- a/.hgsubstate
1737 --- a/.hgsubstate
1700 +++ b/.hgsubstate
1738 +++ b/.hgsubstate
1701 @@ -1,1 +1,1 @@
1739 @@ -1,1 +1,1 @@
1702 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1740 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1703 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1741 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1704 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1742 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1705 7cf8cfea66e4 000000000000
1743 7cf8cfea66e4 000000000000
1706 s
1744 s
1707
1745
1708 (addition of entry)
1746 (addition of entry)
1709
1747
1710 $ hg diff --nodates -c 5 .hgsubstate
1748 $ hg diff --nodates -c 5 .hgsubstate
1711 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1749 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1712 --- a/.hgsubstate
1750 --- a/.hgsubstate
1713 +++ b/.hgsubstate
1751 +++ b/.hgsubstate
1714 @@ -1,1 +1,2 @@
1752 @@ -1,1 +1,2 @@
1715 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1753 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1716 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1754 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1717 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1755 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1718 7cf8cfea66e4 000000000000
1756 7cf8cfea66e4 000000000000
1719 t
1757 t
1720
1758
1721 (removal of existing entry)
1759 (removal of existing entry)
1722
1760
1723 $ hg diff --nodates -c 16 .hgsubstate
1761 $ hg diff --nodates -c 16 .hgsubstate
1724 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1762 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1725 --- a/.hgsubstate
1763 --- a/.hgsubstate
1726 +++ b/.hgsubstate
1764 +++ b/.hgsubstate
1727 @@ -1,2 +1,1 @@
1765 @@ -1,2 +1,1 @@
1728 0731af8ca9423976d3743119d0865097c07bdc1b s
1766 0731af8ca9423976d3743119d0865097c07bdc1b s
1729 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1767 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1730 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1768 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1731 8bec38d2bd0b 000000000000
1769 8bec38d2bd0b 000000000000
1732 t
1770 t
1733
1771
1734 (merging)
1772 (merging)
1735
1773
1736 $ hg diff --nodates -c 9 .hgsubstate
1774 $ hg diff --nodates -c 9 .hgsubstate
1737 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1775 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1738 --- a/.hgsubstate
1776 --- a/.hgsubstate
1739 +++ b/.hgsubstate
1777 +++ b/.hgsubstate
1740 @@ -1,1 +1,2 @@
1778 @@ -1,1 +1,2 @@
1741 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1779 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1742 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1780 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1743 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1781 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1744 f6affe3fbfaa 1f14a2e2d3ec
1782 f6affe3fbfaa 1f14a2e2d3ec
1745 t
1783 t
1746
1784
1747 (removal of ".hgsub" itself)
1785 (removal of ".hgsub" itself)
1748
1786
1749 $ hg diff --nodates -c 8 .hgsubstate
1787 $ hg diff --nodates -c 8 .hgsubstate
1750 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1788 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1751 --- a/.hgsubstate
1789 --- a/.hgsubstate
1752 +++ /dev/null
1790 +++ /dev/null
1753 @@ -1,2 +0,0 @@
1791 @@ -1,2 +0,0 @@
1754 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1792 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1755 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1793 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1756 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1794 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1757 f94576341bcf 000000000000
1795 f94576341bcf 000000000000
1758
1796
1759 Test that '[paths]' is configured correctly at subrepo creation
1797 Test that '[paths]' is configured correctly at subrepo creation
1760
1798
1761 $ cd $TESTTMP/tc
1799 $ cd $TESTTMP/tc
1762 $ cat > .hgsub <<EOF
1800 $ cat > .hgsub <<EOF
1763 > # to clear bogus subrepo path 'bogus=[boguspath'
1801 > # to clear bogus subrepo path 'bogus=[boguspath'
1764 > s = s
1802 > s = s
1765 > t = t
1803 > t = t
1766 > EOF
1804 > EOF
1767 $ hg update -q --clean null
1805 $ hg update -q --clean null
1768 $ rm -rf s t
1806 $ rm -rf s t
1769 $ cat >> .hg/hgrc <<EOF
1807 $ cat >> .hg/hgrc <<EOF
1770 > [paths]
1808 > [paths]
1771 > default-push = /foo/bar
1809 > default-push = /foo/bar
1772 > EOF
1810 > EOF
1773 $ hg update -q
1811 $ hg update -q
1774 $ cat s/.hg/hgrc
1812 $ cat s/.hg/hgrc
1775 [paths]
1813 [paths]
1776 default = $TESTTMP/t/s
1814 default = $TESTTMP/t/s
1777 default-push = /foo/bar/s
1815 default-push = /foo/bar/s
1778 $ cat s/ss/.hg/hgrc
1816 $ cat s/ss/.hg/hgrc
1779 [paths]
1817 [paths]
1780 default = $TESTTMP/t/s/ss
1818 default = $TESTTMP/t/s/ss
1781 default-push = /foo/bar/s/ss
1819 default-push = /foo/bar/s/ss
1782 $ cat t/.hg/hgrc
1820 $ cat t/.hg/hgrc
1783 [paths]
1821 [paths]
1784 default = $TESTTMP/t/t
1822 default = $TESTTMP/t/t
1785 default-push = /foo/bar/t
1823 default-push = /foo/bar/t
1786
1824
1787 $ cd $TESTTMP/t
1825 $ cd $TESTTMP/t
1788 $ hg up -qC 0
1826 $ hg up -qC 0
1789 $ echo 'bar' > bar.txt
1827 $ echo 'bar' > bar.txt
1790 $ hg ci -Am 'branch before subrepo add'
1828 $ hg ci -Am 'branch before subrepo add'
1791 adding bar.txt
1829 adding bar.txt
1792 created new head
1830 created new head
1793 $ hg merge -r "first(subrepo('s'))"
1831 $ hg merge -r "first(subrepo('s'))"
1794 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1832 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1795 (branch merge, don't forget to commit)
1833 (branch merge, don't forget to commit)
1796 $ hg status -S -X '.hgsub*'
1834 $ hg status -S -X '.hgsub*'
1797 A s/a
1835 A s/a
1798 ? s/b
1836 ? s/b
1799 ? s/c
1837 ? s/c
1800 ? s/f1
1838 ? s/f1
1801 $ hg status -S --rev 'p2()'
1839 $ hg status -S --rev 'p2()'
1802 A bar.txt
1840 A bar.txt
1803 ? s/b
1841 ? s/b
1804 ? s/c
1842 ? s/c
1805 ? s/f1
1843 ? s/f1
1806 $ hg diff -S -X '.hgsub*' --nodates
1844 $ hg diff -S -X '.hgsub*' --nodates
1807 diff -r 000000000000 s/a
1845 diff -r 000000000000 s/a
1808 --- /dev/null
1846 --- /dev/null
1809 +++ b/s/a
1847 +++ b/s/a
1810 @@ -0,0 +1,1 @@
1848 @@ -0,0 +1,1 @@
1811 +a
1849 +a
1812 $ hg diff -S --rev 'p2()' --nodates
1850 $ hg diff -S --rev 'p2()' --nodates
1813 diff -r 7cf8cfea66e4 bar.txt
1851 diff -r 7cf8cfea66e4 bar.txt
1814 --- /dev/null
1852 --- /dev/null
1815 +++ b/bar.txt
1853 +++ b/bar.txt
1816 @@ -0,0 +1,1 @@
1854 @@ -0,0 +1,1 @@
1817 +bar
1855 +bar
1818
1856
1819 $ cd ..
1857 $ cd ..
1820
1858
1821 test for ssh exploit 2017-07-25
1859 test for ssh exploit 2017-07-25
1822
1860
1823 $ cat >> $HGRCPATH << EOF
1861 $ cat >> $HGRCPATH << EOF
1824 > [ui]
1862 > [ui]
1825 > ssh = sh -c "read l; read l; read l"
1863 > ssh = sh -c "read l; read l; read l"
1826 > EOF
1864 > EOF
1827
1865
1828 $ hg init malicious-proxycommand
1866 $ hg init malicious-proxycommand
1829 $ cd malicious-proxycommand
1867 $ cd malicious-proxycommand
1830 $ echo 's = [hg]ssh://-oProxyCommand=touch${IFS}owned/path' > .hgsub
1868 $ echo 's = [hg]ssh://-oProxyCommand=touch${IFS}owned/path' > .hgsub
1831 $ hg init s
1869 $ hg init s
1832 $ cd s
1870 $ cd s
1833 $ echo init > init
1871 $ echo init > init
1834 $ hg add
1872 $ hg add
1835 adding init
1873 adding init
1836 $ hg commit -m init
1874 $ hg commit -m init
1837 $ cd ..
1875 $ cd ..
1838 $ hg add .hgsub
1876 $ hg add .hgsub
1839 $ hg ci -m 'add subrepo'
1877 $ hg ci -m 'add subrepo'
1840 $ cd ..
1878 $ cd ..
1841 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1879 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1842 updating to branch default
1880 updating to branch default
1843 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1881 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1844 [255]
1882 [255]
1845
1883
1846 also check that a percent encoded '-' (%2D) doesn't work
1884 also check that a percent encoded '-' (%2D) doesn't work
1847
1885
1848 $ cd malicious-proxycommand
1886 $ cd malicious-proxycommand
1849 $ echo 's = [hg]ssh://%2DoProxyCommand=touch${IFS}owned/path' > .hgsub
1887 $ echo 's = [hg]ssh://%2DoProxyCommand=touch${IFS}owned/path' > .hgsub
1850 $ hg ci -m 'change url to percent encoded'
1888 $ hg ci -m 'change url to percent encoded'
1851 $ cd ..
1889 $ cd ..
1852 $ rm -r malicious-proxycommand-clone
1890 $ rm -r malicious-proxycommand-clone
1853 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1891 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1854 updating to branch default
1892 updating to branch default
1855 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1893 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1856 [255]
1894 [255]
1857
1895
1858 also check for a pipe
1896 also check for a pipe
1859
1897
1860 $ cd malicious-proxycommand
1898 $ cd malicious-proxycommand
1861 $ echo 's = [hg]ssh://fakehost|touch${IFS}owned/path' > .hgsub
1899 $ echo 's = [hg]ssh://fakehost|touch${IFS}owned/path' > .hgsub
1862 $ hg ci -m 'change url to pipe'
1900 $ hg ci -m 'change url to pipe'
1863 $ cd ..
1901 $ cd ..
1864 $ rm -r malicious-proxycommand-clone
1902 $ rm -r malicious-proxycommand-clone
1865 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1903 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1866 updating to branch default
1904 updating to branch default
1867 abort: no suitable response from remote hg!
1905 abort: no suitable response from remote hg!
1868 [255]
1906 [255]
1869 $ [ ! -f owned ] || echo 'you got owned'
1907 $ [ ! -f owned ] || echo 'you got owned'
1870
1908
1871 also check that a percent encoded '|' (%7C) doesn't work
1909 also check that a percent encoded '|' (%7C) doesn't work
1872
1910
1873 $ cd malicious-proxycommand
1911 $ cd malicious-proxycommand
1874 $ echo 's = [hg]ssh://fakehost%7Ctouch%20owned/path' > .hgsub
1912 $ echo 's = [hg]ssh://fakehost%7Ctouch%20owned/path' > .hgsub
1875 $ hg ci -m 'change url to percent encoded pipe'
1913 $ hg ci -m 'change url to percent encoded pipe'
1876 $ cd ..
1914 $ cd ..
1877 $ rm -r malicious-proxycommand-clone
1915 $ rm -r malicious-proxycommand-clone
1878 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1916 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1879 updating to branch default
1917 updating to branch default
1880 abort: no suitable response from remote hg!
1918 abort: no suitable response from remote hg!
1881 [255]
1919 [255]
1882 $ [ ! -f owned ] || echo 'you got owned'
1920 $ [ ! -f owned ] || echo 'you got owned'
1883
1921
1884 and bad usernames:
1922 and bad usernames:
1885 $ cd malicious-proxycommand
1923 $ cd malicious-proxycommand
1886 $ echo 's = [hg]ssh://-oProxyCommand=touch owned@example.com/path' > .hgsub
1924 $ echo 's = [hg]ssh://-oProxyCommand=touch owned@example.com/path' > .hgsub
1887 $ hg ci -m 'owned username'
1925 $ hg ci -m 'owned username'
1888 $ cd ..
1926 $ cd ..
1889 $ rm -r malicious-proxycommand-clone
1927 $ rm -r malicious-proxycommand-clone
1890 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1928 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1891 updating to branch default
1929 updating to branch default
1892 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s")
1930 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s")
1893 [255]
1931 [255]
General Comments 0
You need to be logged in to leave comments. Login now