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 | 1 | # configitems.py - centralized declaration of configuration option |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import functools |
|
11 | 11 | import re |
|
12 | 12 | |
|
13 | 13 | from . import ( |
|
14 | 14 | encoding, |
|
15 | 15 | error, |
|
16 | 16 | ) |
|
17 | 17 | |
|
18 | 18 | def loadconfigtable(ui, extname, configtable): |
|
19 | 19 | """update config item known to the ui with the extension ones""" |
|
20 | 20 | for section, items in configtable.items(): |
|
21 | 21 | knownitems = ui._knownconfig.setdefault(section, itemregister()) |
|
22 | 22 | knownkeys = set(knownitems) |
|
23 | 23 | newkeys = set(items) |
|
24 | 24 | for key in sorted(knownkeys & newkeys): |
|
25 | 25 | msg = "extension '%s' overwrite config item '%s.%s'" |
|
26 | 26 | msg %= (extname, section, key) |
|
27 | 27 | ui.develwarn(msg, config='warn-config') |
|
28 | 28 | |
|
29 | 29 | knownitems.update(items) |
|
30 | 30 | |
|
31 | 31 | class configitem(object): |
|
32 | 32 | """represent a known config item |
|
33 | 33 | |
|
34 | 34 | :section: the official config section where to find this item, |
|
35 | 35 | :name: the official name within the section, |
|
36 | 36 | :default: default value for this item, |
|
37 | 37 | :alias: optional list of tuples as alternatives, |
|
38 | 38 | :generic: this is a generic definition, match name using regular expression. |
|
39 | 39 | """ |
|
40 | 40 | |
|
41 | 41 | def __init__(self, section, name, default=None, alias=(), |
|
42 | 42 | generic=False, priority=0): |
|
43 | 43 | self.section = section |
|
44 | 44 | self.name = name |
|
45 | 45 | self.default = default |
|
46 | 46 | self.alias = list(alias) |
|
47 | 47 | self.generic = generic |
|
48 | 48 | self.priority = priority |
|
49 | 49 | self._re = None |
|
50 | 50 | if generic: |
|
51 | 51 | self._re = re.compile(self.name) |
|
52 | 52 | |
|
53 | 53 | class itemregister(dict): |
|
54 | 54 | """A specialized dictionary that can handle wild-card selection""" |
|
55 | 55 | |
|
56 | 56 | def __init__(self): |
|
57 | 57 | super(itemregister, self).__init__() |
|
58 | 58 | self._generics = set() |
|
59 | 59 | |
|
60 | 60 | def update(self, other): |
|
61 | 61 | super(itemregister, self).update(other) |
|
62 | 62 | self._generics.update(other._generics) |
|
63 | 63 | |
|
64 | 64 | def __setitem__(self, key, item): |
|
65 | 65 | super(itemregister, self).__setitem__(key, item) |
|
66 | 66 | if item.generic: |
|
67 | 67 | self._generics.add(item) |
|
68 | 68 | |
|
69 | 69 | def get(self, key): |
|
70 | 70 | baseitem = super(itemregister, self).get(key) |
|
71 | 71 | if baseitem is not None and not baseitem.generic: |
|
72 | 72 | return baseitem |
|
73 | 73 | |
|
74 | 74 | # search for a matching generic item |
|
75 | 75 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) |
|
76 | 76 | for item in generics: |
|
77 | 77 | # we use 'match' instead of 'search' to make the matching simpler |
|
78 | 78 | # for people unfamiliar with regular expression. Having the match |
|
79 | 79 | # rooted to the start of the string will produce less surprising |
|
80 | 80 | # result for user writing simple regex for sub-attribute. |
|
81 | 81 | # |
|
82 | 82 | # For example using "color\..*" match produces an unsurprising |
|
83 | 83 | # result, while using search could suddenly match apparently |
|
84 | 84 | # unrelated configuration that happens to contains "color." |
|
85 | 85 | # anywhere. This is a tradeoff where we favor requiring ".*" on |
|
86 | 86 | # some match to avoid the need to prefix most pattern with "^". |
|
87 | 87 | # The "^" seems more error prone. |
|
88 | 88 | if item._re.match(key): |
|
89 | 89 | return item |
|
90 | 90 | |
|
91 | 91 | return None |
|
92 | 92 | |
|
93 | 93 | coreitems = {} |
|
94 | 94 | |
|
95 | 95 | def _register(configtable, *args, **kwargs): |
|
96 | 96 | item = configitem(*args, **kwargs) |
|
97 | 97 | section = configtable.setdefault(item.section, itemregister()) |
|
98 | 98 | if item.name in section: |
|
99 | 99 | msg = "duplicated config item registration for '%s.%s'" |
|
100 | 100 | raise error.ProgrammingError(msg % (item.section, item.name)) |
|
101 | 101 | section[item.name] = item |
|
102 | 102 | |
|
103 | 103 | # special value for case where the default is derived from other values |
|
104 | 104 | dynamicdefault = object() |
|
105 | 105 | |
|
106 | 106 | # Registering actual config items |
|
107 | 107 | |
|
108 | 108 | def getitemregister(configtable): |
|
109 | 109 | f = functools.partial(_register, configtable) |
|
110 | 110 | # export pseudo enum as configitem.* |
|
111 | 111 | f.dynamicdefault = dynamicdefault |
|
112 | 112 | return f |
|
113 | 113 | |
|
114 | 114 | coreconfigitem = getitemregister(coreitems) |
|
115 | 115 | |
|
116 | 116 | coreconfigitem('alias', '.*', |
|
117 | 117 | default=None, |
|
118 | 118 | generic=True, |
|
119 | 119 | ) |
|
120 | 120 | coreconfigitem('annotate', 'nodates', |
|
121 | 121 | default=False, |
|
122 | 122 | ) |
|
123 | 123 | coreconfigitem('annotate', 'showfunc', |
|
124 | 124 | default=False, |
|
125 | 125 | ) |
|
126 | 126 | coreconfigitem('annotate', 'unified', |
|
127 | 127 | default=None, |
|
128 | 128 | ) |
|
129 | 129 | coreconfigitem('annotate', 'git', |
|
130 | 130 | default=False, |
|
131 | 131 | ) |
|
132 | 132 | coreconfigitem('annotate', 'ignorews', |
|
133 | 133 | default=False, |
|
134 | 134 | ) |
|
135 | 135 | coreconfigitem('annotate', 'ignorewsamount', |
|
136 | 136 | default=False, |
|
137 | 137 | ) |
|
138 | 138 | coreconfigitem('annotate', 'ignoreblanklines', |
|
139 | 139 | default=False, |
|
140 | 140 | ) |
|
141 | 141 | coreconfigitem('annotate', 'ignorewseol', |
|
142 | 142 | default=False, |
|
143 | 143 | ) |
|
144 | 144 | coreconfigitem('annotate', 'nobinary', |
|
145 | 145 | default=False, |
|
146 | 146 | ) |
|
147 | 147 | coreconfigitem('annotate', 'noprefix', |
|
148 | 148 | default=False, |
|
149 | 149 | ) |
|
150 | 150 | coreconfigitem('auth', 'cookiefile', |
|
151 | 151 | default=None, |
|
152 | 152 | ) |
|
153 | 153 | # bookmarks.pushing: internal hack for discovery |
|
154 | 154 | coreconfigitem('bookmarks', 'pushing', |
|
155 | 155 | default=list, |
|
156 | 156 | ) |
|
157 | 157 | # bundle.mainreporoot: internal hack for bundlerepo |
|
158 | 158 | coreconfigitem('bundle', 'mainreporoot', |
|
159 | 159 | default='', |
|
160 | 160 | ) |
|
161 | 161 | # bundle.reorder: experimental config |
|
162 | 162 | coreconfigitem('bundle', 'reorder', |
|
163 | 163 | default='auto', |
|
164 | 164 | ) |
|
165 | 165 | coreconfigitem('censor', 'policy', |
|
166 | 166 | default='abort', |
|
167 | 167 | ) |
|
168 | 168 | coreconfigitem('chgserver', 'idletimeout', |
|
169 | 169 | default=3600, |
|
170 | 170 | ) |
|
171 | 171 | coreconfigitem('chgserver', 'skiphash', |
|
172 | 172 | default=False, |
|
173 | 173 | ) |
|
174 | 174 | coreconfigitem('cmdserver', 'log', |
|
175 | 175 | default=None, |
|
176 | 176 | ) |
|
177 | 177 | coreconfigitem('color', '.*', |
|
178 | 178 | default=None, |
|
179 | 179 | generic=True, |
|
180 | 180 | ) |
|
181 | 181 | coreconfigitem('color', 'mode', |
|
182 | 182 | default='auto', |
|
183 | 183 | ) |
|
184 | 184 | coreconfigitem('color', 'pagermode', |
|
185 | 185 | default=dynamicdefault, |
|
186 | 186 | ) |
|
187 | 187 | coreconfigitem('commands', 'show.aliasprefix', |
|
188 | 188 | default=list, |
|
189 | 189 | ) |
|
190 | 190 | coreconfigitem('commands', 'status.relative', |
|
191 | 191 | default=False, |
|
192 | 192 | ) |
|
193 | 193 | coreconfigitem('commands', 'status.skipstates', |
|
194 | 194 | default=[], |
|
195 | 195 | ) |
|
196 | 196 | coreconfigitem('commands', 'status.verbose', |
|
197 | 197 | default=False, |
|
198 | 198 | ) |
|
199 | 199 | coreconfigitem('commands', 'update.check', |
|
200 | 200 | default=None, |
|
201 | 201 | # Deprecated, remove after 4.4 release |
|
202 | 202 | alias=[('experimental', 'updatecheck')] |
|
203 | 203 | ) |
|
204 | 204 | coreconfigitem('commands', 'update.requiredest', |
|
205 | 205 | default=False, |
|
206 | 206 | ) |
|
207 | 207 | coreconfigitem('committemplate', '.*', |
|
208 | 208 | default=None, |
|
209 | 209 | generic=True, |
|
210 | 210 | ) |
|
211 | 211 | coreconfigitem('debug', 'dirstate.delaywrite', |
|
212 | 212 | default=0, |
|
213 | 213 | ) |
|
214 | 214 | coreconfigitem('defaults', '.*', |
|
215 | 215 | default=None, |
|
216 | 216 | generic=True, |
|
217 | 217 | ) |
|
218 | 218 | coreconfigitem('devel', 'all-warnings', |
|
219 | 219 | default=False, |
|
220 | 220 | ) |
|
221 | 221 | coreconfigitem('devel', 'bundle2.debug', |
|
222 | 222 | default=False, |
|
223 | 223 | ) |
|
224 | 224 | coreconfigitem('devel', 'cache-vfs', |
|
225 | 225 | default=None, |
|
226 | 226 | ) |
|
227 | 227 | coreconfigitem('devel', 'check-locks', |
|
228 | 228 | default=False, |
|
229 | 229 | ) |
|
230 | 230 | coreconfigitem('devel', 'check-relroot', |
|
231 | 231 | default=False, |
|
232 | 232 | ) |
|
233 | 233 | coreconfigitem('devel', 'default-date', |
|
234 | 234 | default=None, |
|
235 | 235 | ) |
|
236 | 236 | coreconfigitem('devel', 'deprec-warn', |
|
237 | 237 | default=False, |
|
238 | 238 | ) |
|
239 | 239 | coreconfigitem('devel', 'disableloaddefaultcerts', |
|
240 | 240 | default=False, |
|
241 | 241 | ) |
|
242 | 242 | coreconfigitem('devel', 'warn-empty-changegroup', |
|
243 | 243 | default=False, |
|
244 | 244 | ) |
|
245 | 245 | coreconfigitem('devel', 'legacy.exchange', |
|
246 | 246 | default=list, |
|
247 | 247 | ) |
|
248 | 248 | coreconfigitem('devel', 'servercafile', |
|
249 | 249 | default='', |
|
250 | 250 | ) |
|
251 | 251 | coreconfigitem('devel', 'serverexactprotocol', |
|
252 | 252 | default='', |
|
253 | 253 | ) |
|
254 | 254 | coreconfigitem('devel', 'serverrequirecert', |
|
255 | 255 | default=False, |
|
256 | 256 | ) |
|
257 | 257 | coreconfigitem('devel', 'strip-obsmarkers', |
|
258 | 258 | default=True, |
|
259 | 259 | ) |
|
260 | 260 | coreconfigitem('devel', 'warn-config', |
|
261 | 261 | default=None, |
|
262 | 262 | ) |
|
263 | 263 | coreconfigitem('devel', 'warn-config-default', |
|
264 | 264 | default=None, |
|
265 | 265 | ) |
|
266 | 266 | coreconfigitem('devel', 'user.obsmarker', |
|
267 | 267 | default=None, |
|
268 | 268 | ) |
|
269 | 269 | coreconfigitem('devel', 'warn-config-unknown', |
|
270 | 270 | default=None, |
|
271 | 271 | ) |
|
272 | 272 | coreconfigitem('diff', 'nodates', |
|
273 | 273 | default=False, |
|
274 | 274 | ) |
|
275 | 275 | coreconfigitem('diff', 'showfunc', |
|
276 | 276 | default=False, |
|
277 | 277 | ) |
|
278 | 278 | coreconfigitem('diff', 'unified', |
|
279 | 279 | default=None, |
|
280 | 280 | ) |
|
281 | 281 | coreconfigitem('diff', 'git', |
|
282 | 282 | default=False, |
|
283 | 283 | ) |
|
284 | 284 | coreconfigitem('diff', 'ignorews', |
|
285 | 285 | default=False, |
|
286 | 286 | ) |
|
287 | 287 | coreconfigitem('diff', 'ignorewsamount', |
|
288 | 288 | default=False, |
|
289 | 289 | ) |
|
290 | 290 | coreconfigitem('diff', 'ignoreblanklines', |
|
291 | 291 | default=False, |
|
292 | 292 | ) |
|
293 | 293 | coreconfigitem('diff', 'ignorewseol', |
|
294 | 294 | default=False, |
|
295 | 295 | ) |
|
296 | 296 | coreconfigitem('diff', 'nobinary', |
|
297 | 297 | default=False, |
|
298 | 298 | ) |
|
299 | 299 | coreconfigitem('diff', 'noprefix', |
|
300 | 300 | default=False, |
|
301 | 301 | ) |
|
302 | 302 | coreconfigitem('email', 'bcc', |
|
303 | 303 | default=None, |
|
304 | 304 | ) |
|
305 | 305 | coreconfigitem('email', 'cc', |
|
306 | 306 | default=None, |
|
307 | 307 | ) |
|
308 | 308 | coreconfigitem('email', 'charsets', |
|
309 | 309 | default=list, |
|
310 | 310 | ) |
|
311 | 311 | coreconfigitem('email', 'from', |
|
312 | 312 | default=None, |
|
313 | 313 | ) |
|
314 | 314 | coreconfigitem('email', 'method', |
|
315 | 315 | default='smtp', |
|
316 | 316 | ) |
|
317 | 317 | coreconfigitem('email', 'reply-to', |
|
318 | 318 | default=None, |
|
319 | 319 | ) |
|
320 | 320 | coreconfigitem('email', 'to', |
|
321 | 321 | default=None, |
|
322 | 322 | ) |
|
323 | 323 | coreconfigitem('experimental', 'archivemetatemplate', |
|
324 | 324 | default=dynamicdefault, |
|
325 | 325 | ) |
|
326 | 326 | coreconfigitem('experimental', 'bundle-phases', |
|
327 | 327 | default=False, |
|
328 | 328 | ) |
|
329 | 329 | coreconfigitem('experimental', 'bundle2-advertise', |
|
330 | 330 | default=True, |
|
331 | 331 | ) |
|
332 | 332 | coreconfigitem('experimental', 'bundle2-output-capture', |
|
333 | 333 | default=False, |
|
334 | 334 | ) |
|
335 | 335 | coreconfigitem('experimental', 'bundle2.pushback', |
|
336 | 336 | default=False, |
|
337 | 337 | ) |
|
338 | 338 | coreconfigitem('experimental', 'bundle2lazylocking', |
|
339 | 339 | default=False, |
|
340 | 340 | ) |
|
341 | 341 | coreconfigitem('experimental', 'bundlecomplevel', |
|
342 | 342 | default=None, |
|
343 | 343 | ) |
|
344 | 344 | coreconfigitem('experimental', 'changegroup3', |
|
345 | 345 | default=False, |
|
346 | 346 | ) |
|
347 | 347 | coreconfigitem('experimental', 'clientcompressionengines', |
|
348 | 348 | default=list, |
|
349 | 349 | ) |
|
350 | 350 | coreconfigitem('experimental', 'copytrace', |
|
351 | 351 | default='on', |
|
352 | 352 | ) |
|
353 | 353 | coreconfigitem('experimental', 'copytrace.movecandidateslimit', |
|
354 | 354 | default=100, |
|
355 | 355 | ) |
|
356 | 356 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', |
|
357 | 357 | default=100, |
|
358 | 358 | ) |
|
359 | 359 | coreconfigitem('experimental', 'crecordtest', |
|
360 | 360 | default=None, |
|
361 | 361 | ) |
|
362 | 362 | coreconfigitem('experimental', 'editortmpinhg', |
|
363 | 363 | default=False, |
|
364 | 364 | ) |
|
365 | 365 | coreconfigitem('experimental', 'evolution', |
|
366 | 366 | default=list, |
|
367 | 367 | ) |
|
368 | 368 | coreconfigitem('experimental', 'evolution.allowdivergence', |
|
369 | 369 | default=False, |
|
370 | 370 | alias=[('experimental', 'allowdivergence')] |
|
371 | 371 | ) |
|
372 | 372 | coreconfigitem('experimental', 'evolution.allowunstable', |
|
373 | 373 | default=None, |
|
374 | 374 | ) |
|
375 | 375 | coreconfigitem('experimental', 'evolution.createmarkers', |
|
376 | 376 | default=None, |
|
377 | 377 | ) |
|
378 | 378 | coreconfigitem('experimental', 'evolution.effect-flags', |
|
379 | 379 | default=False, |
|
380 | 380 | alias=[('experimental', 'effect-flags')] |
|
381 | 381 | ) |
|
382 | 382 | coreconfigitem('experimental', 'evolution.exchange', |
|
383 | 383 | default=None, |
|
384 | 384 | ) |
|
385 | 385 | coreconfigitem('experimental', 'evolution.bundle-obsmarker', |
|
386 | 386 | default=False, |
|
387 | 387 | ) |
|
388 | 388 | coreconfigitem('experimental', 'evolution.track-operation', |
|
389 | 389 | default=True, |
|
390 | 390 | ) |
|
391 | 391 | coreconfigitem('experimental', 'maxdeltachainspan', |
|
392 | 392 | default=-1, |
|
393 | 393 | ) |
|
394 | 394 | coreconfigitem('experimental', 'mmapindexthreshold', |
|
395 | 395 | default=None, |
|
396 | 396 | ) |
|
397 | 397 | coreconfigitem('experimental', 'nonnormalparanoidcheck', |
|
398 | 398 | default=False, |
|
399 | 399 | ) |
|
400 | 400 | coreconfigitem('experimental', 'exportableenviron', |
|
401 | 401 | default=list, |
|
402 | 402 | ) |
|
403 | 403 | coreconfigitem('experimental', 'extendedheader.index', |
|
404 | 404 | default=None, |
|
405 | 405 | ) |
|
406 | 406 | coreconfigitem('experimental', 'extendedheader.similarity', |
|
407 | 407 | default=False, |
|
408 | 408 | ) |
|
409 | 409 | coreconfigitem('experimental', 'format.compression', |
|
410 | 410 | default='zlib', |
|
411 | 411 | ) |
|
412 | 412 | coreconfigitem('experimental', 'graphshorten', |
|
413 | 413 | default=False, |
|
414 | 414 | ) |
|
415 | 415 | coreconfigitem('experimental', 'graphstyle.parent', |
|
416 | 416 | default=dynamicdefault, |
|
417 | 417 | ) |
|
418 | 418 | coreconfigitem('experimental', 'graphstyle.missing', |
|
419 | 419 | default=dynamicdefault, |
|
420 | 420 | ) |
|
421 | 421 | coreconfigitem('experimental', 'graphstyle.grandparent', |
|
422 | 422 | default=dynamicdefault, |
|
423 | 423 | ) |
|
424 | 424 | coreconfigitem('experimental', 'hook-track-tags', |
|
425 | 425 | default=False, |
|
426 | 426 | ) |
|
427 | 427 | coreconfigitem('experimental', 'httppostargs', |
|
428 | 428 | default=False, |
|
429 | 429 | ) |
|
430 | 430 | coreconfigitem('experimental', 'manifestv2', |
|
431 | 431 | default=False, |
|
432 | 432 | ) |
|
433 | 433 | coreconfigitem('experimental', 'mergedriver', |
|
434 | 434 | default=None, |
|
435 | 435 | ) |
|
436 | 436 | coreconfigitem('experimental', 'obsmarkers-exchange-debug', |
|
437 | 437 | default=False, |
|
438 | 438 | ) |
|
439 | 439 | coreconfigitem('experimental', 'rebase.multidest', |
|
440 | 440 | default=False, |
|
441 | 441 | ) |
|
442 | 442 | coreconfigitem('experimental', 'revertalternateinteractivemode', |
|
443 | 443 | default=True, |
|
444 | 444 | ) |
|
445 | 445 | coreconfigitem('experimental', 'revlogv2', |
|
446 | 446 | default=None, |
|
447 | 447 | ) |
|
448 | 448 | coreconfigitem('experimental', 'spacemovesdown', |
|
449 | 449 | default=False, |
|
450 | 450 | ) |
|
451 | 451 | coreconfigitem('experimental', 'sparse-read', |
|
452 | 452 | default=False, |
|
453 | 453 | ) |
|
454 | 454 | coreconfigitem('experimental', 'sparse-read.density-threshold', |
|
455 | 455 | default=0.25, |
|
456 | 456 | ) |
|
457 | 457 | coreconfigitem('experimental', 'sparse-read.min-gap-size', |
|
458 | 458 | default='256K', |
|
459 | 459 | ) |
|
460 | 460 | coreconfigitem('experimental', 'treemanifest', |
|
461 | 461 | default=False, |
|
462 | 462 | ) |
|
463 | 463 | coreconfigitem('extensions', '.*', |
|
464 | 464 | default=None, |
|
465 | 465 | generic=True, |
|
466 | 466 | ) |
|
467 | 467 | coreconfigitem('extdata', '.*', |
|
468 | 468 | default=None, |
|
469 | 469 | generic=True, |
|
470 | 470 | ) |
|
471 | 471 | coreconfigitem('format', 'aggressivemergedeltas', |
|
472 | 472 | default=False, |
|
473 | 473 | ) |
|
474 | 474 | coreconfigitem('format', 'chunkcachesize', |
|
475 | 475 | default=None, |
|
476 | 476 | ) |
|
477 | 477 | coreconfigitem('format', 'dotencode', |
|
478 | 478 | default=True, |
|
479 | 479 | ) |
|
480 | 480 | coreconfigitem('format', 'generaldelta', |
|
481 | 481 | default=False, |
|
482 | 482 | ) |
|
483 | 483 | coreconfigitem('format', 'manifestcachesize', |
|
484 | 484 | default=None, |
|
485 | 485 | ) |
|
486 | 486 | coreconfigitem('format', 'maxchainlen', |
|
487 | 487 | default=None, |
|
488 | 488 | ) |
|
489 | 489 | coreconfigitem('format', 'obsstore-version', |
|
490 | 490 | default=None, |
|
491 | 491 | ) |
|
492 | 492 | coreconfigitem('format', 'usefncache', |
|
493 | 493 | default=True, |
|
494 | 494 | ) |
|
495 | 495 | coreconfigitem('format', 'usegeneraldelta', |
|
496 | 496 | default=True, |
|
497 | 497 | ) |
|
498 | 498 | coreconfigitem('format', 'usestore', |
|
499 | 499 | default=True, |
|
500 | 500 | ) |
|
501 | 501 | coreconfigitem('fsmonitor', 'warn_when_unused', |
|
502 | 502 | default=True, |
|
503 | 503 | ) |
|
504 | 504 | coreconfigitem('fsmonitor', 'warn_update_file_count', |
|
505 | 505 | default=50000, |
|
506 | 506 | ) |
|
507 | 507 | coreconfigitem('hooks', '.*', |
|
508 | 508 | default=dynamicdefault, |
|
509 | 509 | generic=True, |
|
510 | 510 | ) |
|
511 | 511 | coreconfigitem('hgweb-paths', '.*', |
|
512 | 512 | default=list, |
|
513 | 513 | generic=True, |
|
514 | 514 | ) |
|
515 | 515 | coreconfigitem('hostfingerprints', '.*', |
|
516 | 516 | default=list, |
|
517 | 517 | generic=True, |
|
518 | 518 | ) |
|
519 | 519 | coreconfigitem('hostsecurity', 'ciphers', |
|
520 | 520 | default=None, |
|
521 | 521 | ) |
|
522 | 522 | coreconfigitem('hostsecurity', 'disabletls10warning', |
|
523 | 523 | default=False, |
|
524 | 524 | ) |
|
525 | 525 | coreconfigitem('hostsecurity', 'minimumprotocol', |
|
526 | 526 | default=dynamicdefault, |
|
527 | 527 | ) |
|
528 | 528 | coreconfigitem('hostsecurity', '.*:minimumprotocol$', |
|
529 | 529 | default=dynamicdefault, |
|
530 | 530 | generic=True, |
|
531 | 531 | ) |
|
532 | 532 | coreconfigitem('hostsecurity', '.*:ciphers$', |
|
533 | 533 | default=dynamicdefault, |
|
534 | 534 | generic=True, |
|
535 | 535 | ) |
|
536 | 536 | coreconfigitem('hostsecurity', '.*:fingerprints$', |
|
537 | 537 | default=list, |
|
538 | 538 | generic=True, |
|
539 | 539 | ) |
|
540 | 540 | coreconfigitem('hostsecurity', '.*:verifycertsfile$', |
|
541 | 541 | default=None, |
|
542 | 542 | generic=True, |
|
543 | 543 | ) |
|
544 | 544 | |
|
545 | 545 | coreconfigitem('http_proxy', 'always', |
|
546 | 546 | default=False, |
|
547 | 547 | ) |
|
548 | 548 | coreconfigitem('http_proxy', 'host', |
|
549 | 549 | default=None, |
|
550 | 550 | ) |
|
551 | 551 | coreconfigitem('http_proxy', 'no', |
|
552 | 552 | default=list, |
|
553 | 553 | ) |
|
554 | 554 | coreconfigitem('http_proxy', 'passwd', |
|
555 | 555 | default=None, |
|
556 | 556 | ) |
|
557 | 557 | coreconfigitem('http_proxy', 'user', |
|
558 | 558 | default=None, |
|
559 | 559 | ) |
|
560 | 560 | coreconfigitem('logtoprocess', 'commandexception', |
|
561 | 561 | default=None, |
|
562 | 562 | ) |
|
563 | 563 | coreconfigitem('logtoprocess', 'commandfinish', |
|
564 | 564 | default=None, |
|
565 | 565 | ) |
|
566 | 566 | coreconfigitem('logtoprocess', 'command', |
|
567 | 567 | default=None, |
|
568 | 568 | ) |
|
569 | 569 | coreconfigitem('logtoprocess', 'develwarn', |
|
570 | 570 | default=None, |
|
571 | 571 | ) |
|
572 | 572 | coreconfigitem('logtoprocess', 'uiblocked', |
|
573 | 573 | default=None, |
|
574 | 574 | ) |
|
575 | 575 | coreconfigitem('merge', 'checkunknown', |
|
576 | 576 | default='abort', |
|
577 | 577 | ) |
|
578 | 578 | coreconfigitem('merge', 'checkignored', |
|
579 | 579 | default='abort', |
|
580 | 580 | ) |
|
581 | 581 | coreconfigitem('experimental', 'merge.checkpathconflicts', |
|
582 | 582 | default=False, |
|
583 | 583 | ) |
|
584 | 584 | coreconfigitem('merge', 'followcopies', |
|
585 | 585 | default=True, |
|
586 | 586 | ) |
|
587 | 587 | coreconfigitem('merge', 'on-failure', |
|
588 | 588 | default='continue', |
|
589 | 589 | ) |
|
590 | 590 | coreconfigitem('merge', 'preferancestor', |
|
591 | 591 | default=lambda: ['*'], |
|
592 | 592 | ) |
|
593 | 593 | coreconfigitem('merge-tools', '.*', |
|
594 | 594 | default=None, |
|
595 | 595 | generic=True, |
|
596 | 596 | ) |
|
597 | 597 | coreconfigitem('merge-tools', br'.*\.args$', |
|
598 | 598 | default="$local $base $other", |
|
599 | 599 | generic=True, |
|
600 | 600 | priority=-1, |
|
601 | 601 | ) |
|
602 | 602 | coreconfigitem('merge-tools', br'.*\.binary$', |
|
603 | 603 | default=False, |
|
604 | 604 | generic=True, |
|
605 | 605 | priority=-1, |
|
606 | 606 | ) |
|
607 | 607 | coreconfigitem('merge-tools', br'.*\.check$', |
|
608 | 608 | default=list, |
|
609 | 609 | generic=True, |
|
610 | 610 | priority=-1, |
|
611 | 611 | ) |
|
612 | 612 | coreconfigitem('merge-tools', br'.*\.checkchanged$', |
|
613 | 613 | default=False, |
|
614 | 614 | generic=True, |
|
615 | 615 | priority=-1, |
|
616 | 616 | ) |
|
617 | 617 | coreconfigitem('merge-tools', br'.*\.executable$', |
|
618 | 618 | default=dynamicdefault, |
|
619 | 619 | generic=True, |
|
620 | 620 | priority=-1, |
|
621 | 621 | ) |
|
622 | 622 | coreconfigitem('merge-tools', br'.*\.fixeol$', |
|
623 | 623 | default=False, |
|
624 | 624 | generic=True, |
|
625 | 625 | priority=-1, |
|
626 | 626 | ) |
|
627 | 627 | coreconfigitem('merge-tools', br'.*\.gui$', |
|
628 | 628 | default=False, |
|
629 | 629 | generic=True, |
|
630 | 630 | priority=-1, |
|
631 | 631 | ) |
|
632 | 632 | coreconfigitem('merge-tools', br'.*\.priority$', |
|
633 | 633 | default=0, |
|
634 | 634 | generic=True, |
|
635 | 635 | priority=-1, |
|
636 | 636 | ) |
|
637 | 637 | coreconfigitem('merge-tools', br'.*\.premerge$', |
|
638 | 638 | default=dynamicdefault, |
|
639 | 639 | generic=True, |
|
640 | 640 | priority=-1, |
|
641 | 641 | ) |
|
642 | 642 | coreconfigitem('merge-tools', br'.*\.symlink$', |
|
643 | 643 | default=False, |
|
644 | 644 | generic=True, |
|
645 | 645 | priority=-1, |
|
646 | 646 | ) |
|
647 | 647 | coreconfigitem('pager', 'attend-.*', |
|
648 | 648 | default=dynamicdefault, |
|
649 | 649 | generic=True, |
|
650 | 650 | ) |
|
651 | 651 | coreconfigitem('pager', 'ignore', |
|
652 | 652 | default=list, |
|
653 | 653 | ) |
|
654 | 654 | coreconfigitem('pager', 'pager', |
|
655 | 655 | default=dynamicdefault, |
|
656 | 656 | ) |
|
657 | 657 | coreconfigitem('patch', 'eol', |
|
658 | 658 | default='strict', |
|
659 | 659 | ) |
|
660 | 660 | coreconfigitem('patch', 'fuzz', |
|
661 | 661 | default=2, |
|
662 | 662 | ) |
|
663 | 663 | coreconfigitem('paths', 'default', |
|
664 | 664 | default=None, |
|
665 | 665 | ) |
|
666 | 666 | coreconfigitem('paths', 'default-push', |
|
667 | 667 | default=None, |
|
668 | 668 | ) |
|
669 | 669 | coreconfigitem('paths', '.*', |
|
670 | 670 | default=None, |
|
671 | 671 | generic=True, |
|
672 | 672 | ) |
|
673 | 673 | coreconfigitem('phases', 'checksubrepos', |
|
674 | 674 | default='follow', |
|
675 | 675 | ) |
|
676 | 676 | coreconfigitem('phases', 'new-commit', |
|
677 | 677 | default='draft', |
|
678 | 678 | ) |
|
679 | 679 | coreconfigitem('phases', 'publish', |
|
680 | 680 | default=True, |
|
681 | 681 | ) |
|
682 | 682 | coreconfigitem('profiling', 'enabled', |
|
683 | 683 | default=False, |
|
684 | 684 | ) |
|
685 | 685 | coreconfigitem('profiling', 'format', |
|
686 | 686 | default='text', |
|
687 | 687 | ) |
|
688 | 688 | coreconfigitem('profiling', 'freq', |
|
689 | 689 | default=1000, |
|
690 | 690 | ) |
|
691 | 691 | coreconfigitem('profiling', 'limit', |
|
692 | 692 | default=30, |
|
693 | 693 | ) |
|
694 | 694 | coreconfigitem('profiling', 'nested', |
|
695 | 695 | default=0, |
|
696 | 696 | ) |
|
697 | 697 | coreconfigitem('profiling', 'output', |
|
698 | 698 | default=None, |
|
699 | 699 | ) |
|
700 | 700 | coreconfigitem('profiling', 'showmax', |
|
701 | 701 | default=0.999, |
|
702 | 702 | ) |
|
703 | 703 | coreconfigitem('profiling', 'showmin', |
|
704 | 704 | default=dynamicdefault, |
|
705 | 705 | ) |
|
706 | 706 | coreconfigitem('profiling', 'sort', |
|
707 | 707 | default='inlinetime', |
|
708 | 708 | ) |
|
709 | 709 | coreconfigitem('profiling', 'statformat', |
|
710 | 710 | default='hotpath', |
|
711 | 711 | ) |
|
712 | 712 | coreconfigitem('profiling', 'type', |
|
713 | 713 | default='stat', |
|
714 | 714 | ) |
|
715 | 715 | coreconfigitem('progress', 'assume-tty', |
|
716 | 716 | default=False, |
|
717 | 717 | ) |
|
718 | 718 | coreconfigitem('progress', 'changedelay', |
|
719 | 719 | default=1, |
|
720 | 720 | ) |
|
721 | 721 | coreconfigitem('progress', 'clear-complete', |
|
722 | 722 | default=True, |
|
723 | 723 | ) |
|
724 | 724 | coreconfigitem('progress', 'debug', |
|
725 | 725 | default=False, |
|
726 | 726 | ) |
|
727 | 727 | coreconfigitem('progress', 'delay', |
|
728 | 728 | default=3, |
|
729 | 729 | ) |
|
730 | 730 | coreconfigitem('progress', 'disable', |
|
731 | 731 | default=False, |
|
732 | 732 | ) |
|
733 | 733 | coreconfigitem('progress', 'estimateinterval', |
|
734 | 734 | default=60.0, |
|
735 | 735 | ) |
|
736 | 736 | coreconfigitem('progress', 'format', |
|
737 | 737 | default=lambda: ['topic', 'bar', 'number', 'estimate'], |
|
738 | 738 | ) |
|
739 | 739 | coreconfigitem('progress', 'refresh', |
|
740 | 740 | default=0.1, |
|
741 | 741 | ) |
|
742 | 742 | coreconfigitem('progress', 'width', |
|
743 | 743 | default=dynamicdefault, |
|
744 | 744 | ) |
|
745 | 745 | coreconfigitem('push', 'pushvars.server', |
|
746 | 746 | default=False, |
|
747 | 747 | ) |
|
748 | 748 | coreconfigitem('server', 'bundle1', |
|
749 | 749 | default=True, |
|
750 | 750 | ) |
|
751 | 751 | coreconfigitem('server', 'bundle1gd', |
|
752 | 752 | default=None, |
|
753 | 753 | ) |
|
754 | 754 | coreconfigitem('server', 'bundle1.pull', |
|
755 | 755 | default=None, |
|
756 | 756 | ) |
|
757 | 757 | coreconfigitem('server', 'bundle1gd.pull', |
|
758 | 758 | default=None, |
|
759 | 759 | ) |
|
760 | 760 | coreconfigitem('server', 'bundle1.push', |
|
761 | 761 | default=None, |
|
762 | 762 | ) |
|
763 | 763 | coreconfigitem('server', 'bundle1gd.push', |
|
764 | 764 | default=None, |
|
765 | 765 | ) |
|
766 | 766 | coreconfigitem('server', 'compressionengines', |
|
767 | 767 | default=list, |
|
768 | 768 | ) |
|
769 | 769 | coreconfigitem('server', 'concurrent-push-mode', |
|
770 | 770 | default='strict', |
|
771 | 771 | ) |
|
772 | 772 | coreconfigitem('server', 'disablefullbundle', |
|
773 | 773 | default=False, |
|
774 | 774 | ) |
|
775 | 775 | coreconfigitem('server', 'maxhttpheaderlen', |
|
776 | 776 | default=1024, |
|
777 | 777 | ) |
|
778 | 778 | coreconfigitem('server', 'preferuncompressed', |
|
779 | 779 | default=False, |
|
780 | 780 | ) |
|
781 | 781 | coreconfigitem('server', 'uncompressed', |
|
782 | 782 | default=True, |
|
783 | 783 | ) |
|
784 | 784 | coreconfigitem('server', 'uncompressedallowsecret', |
|
785 | 785 | default=False, |
|
786 | 786 | ) |
|
787 | 787 | coreconfigitem('server', 'validate', |
|
788 | 788 | default=False, |
|
789 | 789 | ) |
|
790 | 790 | coreconfigitem('server', 'zliblevel', |
|
791 | 791 | default=-1, |
|
792 | 792 | ) |
|
793 | 793 | coreconfigitem('share', 'pool', |
|
794 | 794 | default=None, |
|
795 | 795 | ) |
|
796 | 796 | coreconfigitem('share', 'poolnaming', |
|
797 | 797 | default='identity', |
|
798 | 798 | ) |
|
799 | 799 | coreconfigitem('smtp', 'host', |
|
800 | 800 | default=None, |
|
801 | 801 | ) |
|
802 | 802 | coreconfigitem('smtp', 'local_hostname', |
|
803 | 803 | default=None, |
|
804 | 804 | ) |
|
805 | 805 | coreconfigitem('smtp', 'password', |
|
806 | 806 | default=None, |
|
807 | 807 | ) |
|
808 | 808 | coreconfigitem('smtp', 'port', |
|
809 | 809 | default=dynamicdefault, |
|
810 | 810 | ) |
|
811 | 811 | coreconfigitem('smtp', 'tls', |
|
812 | 812 | default='none', |
|
813 | 813 | ) |
|
814 | 814 | coreconfigitem('smtp', 'username', |
|
815 | 815 | default=None, |
|
816 | 816 | ) |
|
817 | 817 | coreconfigitem('sparse', 'missingwarning', |
|
818 | 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 | 832 | coreconfigitem('templates', '.*', |
|
821 | 833 | default=None, |
|
822 | 834 | generic=True, |
|
823 | 835 | ) |
|
824 | 836 | coreconfigitem('trusted', 'groups', |
|
825 | 837 | default=list, |
|
826 | 838 | ) |
|
827 | 839 | coreconfigitem('trusted', 'users', |
|
828 | 840 | default=list, |
|
829 | 841 | ) |
|
830 | 842 | coreconfigitem('ui', '_usedassubrepo', |
|
831 | 843 | default=False, |
|
832 | 844 | ) |
|
833 | 845 | coreconfigitem('ui', 'allowemptycommit', |
|
834 | 846 | default=False, |
|
835 | 847 | ) |
|
836 | 848 | coreconfigitem('ui', 'archivemeta', |
|
837 | 849 | default=True, |
|
838 | 850 | ) |
|
839 | 851 | coreconfigitem('ui', 'askusername', |
|
840 | 852 | default=False, |
|
841 | 853 | ) |
|
842 | 854 | coreconfigitem('ui', 'clonebundlefallback', |
|
843 | 855 | default=False, |
|
844 | 856 | ) |
|
845 | 857 | coreconfigitem('ui', 'clonebundleprefers', |
|
846 | 858 | default=list, |
|
847 | 859 | ) |
|
848 | 860 | coreconfigitem('ui', 'clonebundles', |
|
849 | 861 | default=True, |
|
850 | 862 | ) |
|
851 | 863 | coreconfigitem('ui', 'color', |
|
852 | 864 | default='auto', |
|
853 | 865 | ) |
|
854 | 866 | coreconfigitem('ui', 'commitsubrepos', |
|
855 | 867 | default=False, |
|
856 | 868 | ) |
|
857 | 869 | coreconfigitem('ui', 'debug', |
|
858 | 870 | default=False, |
|
859 | 871 | ) |
|
860 | 872 | coreconfigitem('ui', 'debugger', |
|
861 | 873 | default=None, |
|
862 | 874 | ) |
|
863 | 875 | coreconfigitem('ui', 'editor', |
|
864 | 876 | default=dynamicdefault, |
|
865 | 877 | ) |
|
866 | 878 | coreconfigitem('ui', 'fallbackencoding', |
|
867 | 879 | default=None, |
|
868 | 880 | ) |
|
869 | 881 | coreconfigitem('ui', 'forcecwd', |
|
870 | 882 | default=None, |
|
871 | 883 | ) |
|
872 | 884 | coreconfigitem('ui', 'forcemerge', |
|
873 | 885 | default=None, |
|
874 | 886 | ) |
|
875 | 887 | coreconfigitem('ui', 'formatdebug', |
|
876 | 888 | default=False, |
|
877 | 889 | ) |
|
878 | 890 | coreconfigitem('ui', 'formatjson', |
|
879 | 891 | default=False, |
|
880 | 892 | ) |
|
881 | 893 | coreconfigitem('ui', 'formatted', |
|
882 | 894 | default=None, |
|
883 | 895 | ) |
|
884 | 896 | coreconfigitem('ui', 'graphnodetemplate', |
|
885 | 897 | default=None, |
|
886 | 898 | ) |
|
887 | 899 | coreconfigitem('ui', 'http2debuglevel', |
|
888 | 900 | default=None, |
|
889 | 901 | ) |
|
890 | 902 | coreconfigitem('ui', 'interactive', |
|
891 | 903 | default=None, |
|
892 | 904 | ) |
|
893 | 905 | coreconfigitem('ui', 'interface', |
|
894 | 906 | default=None, |
|
895 | 907 | ) |
|
896 | 908 | coreconfigitem('ui', 'interface.chunkselector', |
|
897 | 909 | default=None, |
|
898 | 910 | ) |
|
899 | 911 | coreconfigitem('ui', 'logblockedtimes', |
|
900 | 912 | default=False, |
|
901 | 913 | ) |
|
902 | 914 | coreconfigitem('ui', 'logtemplate', |
|
903 | 915 | default=None, |
|
904 | 916 | ) |
|
905 | 917 | coreconfigitem('ui', 'merge', |
|
906 | 918 | default=None, |
|
907 | 919 | ) |
|
908 | 920 | coreconfigitem('ui', 'mergemarkers', |
|
909 | 921 | default='basic', |
|
910 | 922 | ) |
|
911 | 923 | coreconfigitem('ui', 'mergemarkertemplate', |
|
912 | 924 | default=('{node|short} ' |
|
913 | 925 | '{ifeq(tags, "tip", "", ' |
|
914 | 926 | 'ifeq(tags, "", "", "{tags} "))}' |
|
915 | 927 | '{if(bookmarks, "{bookmarks} ")}' |
|
916 | 928 | '{ifeq(branch, "default", "", "{branch} ")}' |
|
917 | 929 | '- {author|user}: {desc|firstline}') |
|
918 | 930 | ) |
|
919 | 931 | coreconfigitem('ui', 'nontty', |
|
920 | 932 | default=False, |
|
921 | 933 | ) |
|
922 | 934 | coreconfigitem('ui', 'origbackuppath', |
|
923 | 935 | default=None, |
|
924 | 936 | ) |
|
925 | 937 | coreconfigitem('ui', 'paginate', |
|
926 | 938 | default=True, |
|
927 | 939 | ) |
|
928 | 940 | coreconfigitem('ui', 'patch', |
|
929 | 941 | default=None, |
|
930 | 942 | ) |
|
931 | 943 | coreconfigitem('ui', 'portablefilenames', |
|
932 | 944 | default='warn', |
|
933 | 945 | ) |
|
934 | 946 | coreconfigitem('ui', 'promptecho', |
|
935 | 947 | default=False, |
|
936 | 948 | ) |
|
937 | 949 | coreconfigitem('ui', 'quiet', |
|
938 | 950 | default=False, |
|
939 | 951 | ) |
|
940 | 952 | coreconfigitem('ui', 'quietbookmarkmove', |
|
941 | 953 | default=False, |
|
942 | 954 | ) |
|
943 | 955 | coreconfigitem('ui', 'remotecmd', |
|
944 | 956 | default='hg', |
|
945 | 957 | ) |
|
946 | 958 | coreconfigitem('ui', 'report_untrusted', |
|
947 | 959 | default=True, |
|
948 | 960 | ) |
|
949 | 961 | coreconfigitem('ui', 'rollback', |
|
950 | 962 | default=True, |
|
951 | 963 | ) |
|
952 | 964 | coreconfigitem('ui', 'slash', |
|
953 | 965 | default=False, |
|
954 | 966 | ) |
|
955 | 967 | coreconfigitem('ui', 'ssh', |
|
956 | 968 | default='ssh', |
|
957 | 969 | ) |
|
958 | 970 | coreconfigitem('ui', 'statuscopies', |
|
959 | 971 | default=False, |
|
960 | 972 | ) |
|
961 | 973 | coreconfigitem('ui', 'strict', |
|
962 | 974 | default=False, |
|
963 | 975 | ) |
|
964 | 976 | coreconfigitem('ui', 'style', |
|
965 | 977 | default='', |
|
966 | 978 | ) |
|
967 | 979 | coreconfigitem('ui', 'supportcontact', |
|
968 | 980 | default=None, |
|
969 | 981 | ) |
|
970 | 982 | coreconfigitem('ui', 'textwidth', |
|
971 | 983 | default=78, |
|
972 | 984 | ) |
|
973 | 985 | coreconfigitem('ui', 'timeout', |
|
974 | 986 | default='600', |
|
975 | 987 | ) |
|
976 | 988 | coreconfigitem('ui', 'traceback', |
|
977 | 989 | default=False, |
|
978 | 990 | ) |
|
979 | 991 | coreconfigitem('ui', 'tweakdefaults', |
|
980 | 992 | default=False, |
|
981 | 993 | ) |
|
982 | 994 | coreconfigitem('ui', 'usehttp2', |
|
983 | 995 | default=False, |
|
984 | 996 | ) |
|
985 | 997 | coreconfigitem('ui', 'username', |
|
986 | 998 | alias=[('ui', 'user')] |
|
987 | 999 | ) |
|
988 | 1000 | coreconfigitem('ui', 'verbose', |
|
989 | 1001 | default=False, |
|
990 | 1002 | ) |
|
991 | 1003 | coreconfigitem('verify', 'skipflags', |
|
992 | 1004 | default=None, |
|
993 | 1005 | ) |
|
994 | 1006 | coreconfigitem('web', 'allowbz2', |
|
995 | 1007 | default=False, |
|
996 | 1008 | ) |
|
997 | 1009 | coreconfigitem('web', 'allowgz', |
|
998 | 1010 | default=False, |
|
999 | 1011 | ) |
|
1000 | 1012 | coreconfigitem('web', 'allowpull', |
|
1001 | 1013 | default=True, |
|
1002 | 1014 | ) |
|
1003 | 1015 | coreconfigitem('web', 'allow_push', |
|
1004 | 1016 | default=list, |
|
1005 | 1017 | ) |
|
1006 | 1018 | coreconfigitem('web', 'allowzip', |
|
1007 | 1019 | default=False, |
|
1008 | 1020 | ) |
|
1009 | 1021 | coreconfigitem('web', 'archivesubrepos', |
|
1010 | 1022 | default=False, |
|
1011 | 1023 | ) |
|
1012 | 1024 | coreconfigitem('web', 'cache', |
|
1013 | 1025 | default=True, |
|
1014 | 1026 | ) |
|
1015 | 1027 | coreconfigitem('web', 'contact', |
|
1016 | 1028 | default=None, |
|
1017 | 1029 | ) |
|
1018 | 1030 | coreconfigitem('web', 'deny_push', |
|
1019 | 1031 | default=list, |
|
1020 | 1032 | ) |
|
1021 | 1033 | coreconfigitem('web', 'guessmime', |
|
1022 | 1034 | default=False, |
|
1023 | 1035 | ) |
|
1024 | 1036 | coreconfigitem('web', 'hidden', |
|
1025 | 1037 | default=False, |
|
1026 | 1038 | ) |
|
1027 | 1039 | coreconfigitem('web', 'labels', |
|
1028 | 1040 | default=list, |
|
1029 | 1041 | ) |
|
1030 | 1042 | coreconfigitem('web', 'logoimg', |
|
1031 | 1043 | default='hglogo.png', |
|
1032 | 1044 | ) |
|
1033 | 1045 | coreconfigitem('web', 'logourl', |
|
1034 | 1046 | default='https://mercurial-scm.org/', |
|
1035 | 1047 | ) |
|
1036 | 1048 | coreconfigitem('web', 'accesslog', |
|
1037 | 1049 | default='-', |
|
1038 | 1050 | ) |
|
1039 | 1051 | coreconfigitem('web', 'address', |
|
1040 | 1052 | default='', |
|
1041 | 1053 | ) |
|
1042 | 1054 | coreconfigitem('web', 'allow_archive', |
|
1043 | 1055 | default=list, |
|
1044 | 1056 | ) |
|
1045 | 1057 | coreconfigitem('web', 'allow_read', |
|
1046 | 1058 | default=list, |
|
1047 | 1059 | ) |
|
1048 | 1060 | coreconfigitem('web', 'baseurl', |
|
1049 | 1061 | default=None, |
|
1050 | 1062 | ) |
|
1051 | 1063 | coreconfigitem('web', 'cacerts', |
|
1052 | 1064 | default=None, |
|
1053 | 1065 | ) |
|
1054 | 1066 | coreconfigitem('web', 'certificate', |
|
1055 | 1067 | default=None, |
|
1056 | 1068 | ) |
|
1057 | 1069 | coreconfigitem('web', 'collapse', |
|
1058 | 1070 | default=False, |
|
1059 | 1071 | ) |
|
1060 | 1072 | coreconfigitem('web', 'csp', |
|
1061 | 1073 | default=None, |
|
1062 | 1074 | ) |
|
1063 | 1075 | coreconfigitem('web', 'deny_read', |
|
1064 | 1076 | default=list, |
|
1065 | 1077 | ) |
|
1066 | 1078 | coreconfigitem('web', 'descend', |
|
1067 | 1079 | default=True, |
|
1068 | 1080 | ) |
|
1069 | 1081 | coreconfigitem('web', 'description', |
|
1070 | 1082 | default="", |
|
1071 | 1083 | ) |
|
1072 | 1084 | coreconfigitem('web', 'encoding', |
|
1073 | 1085 | default=lambda: encoding.encoding, |
|
1074 | 1086 | ) |
|
1075 | 1087 | coreconfigitem('web', 'errorlog', |
|
1076 | 1088 | default='-', |
|
1077 | 1089 | ) |
|
1078 | 1090 | coreconfigitem('web', 'ipv6', |
|
1079 | 1091 | default=False, |
|
1080 | 1092 | ) |
|
1081 | 1093 | coreconfigitem('web', 'maxchanges', |
|
1082 | 1094 | default=10, |
|
1083 | 1095 | ) |
|
1084 | 1096 | coreconfigitem('web', 'maxfiles', |
|
1085 | 1097 | default=10, |
|
1086 | 1098 | ) |
|
1087 | 1099 | coreconfigitem('web', 'maxshortchanges', |
|
1088 | 1100 | default=60, |
|
1089 | 1101 | ) |
|
1090 | 1102 | coreconfigitem('web', 'motd', |
|
1091 | 1103 | default='', |
|
1092 | 1104 | ) |
|
1093 | 1105 | coreconfigitem('web', 'name', |
|
1094 | 1106 | default=dynamicdefault, |
|
1095 | 1107 | ) |
|
1096 | 1108 | coreconfigitem('web', 'port', |
|
1097 | 1109 | default=8000, |
|
1098 | 1110 | ) |
|
1099 | 1111 | coreconfigitem('web', 'prefix', |
|
1100 | 1112 | default='', |
|
1101 | 1113 | ) |
|
1102 | 1114 | coreconfigitem('web', 'push_ssl', |
|
1103 | 1115 | default=True, |
|
1104 | 1116 | ) |
|
1105 | 1117 | coreconfigitem('web', 'refreshinterval', |
|
1106 | 1118 | default=20, |
|
1107 | 1119 | ) |
|
1108 | 1120 | coreconfigitem('web', 'staticurl', |
|
1109 | 1121 | default=None, |
|
1110 | 1122 | ) |
|
1111 | 1123 | coreconfigitem('web', 'stripes', |
|
1112 | 1124 | default=1, |
|
1113 | 1125 | ) |
|
1114 | 1126 | coreconfigitem('web', 'style', |
|
1115 | 1127 | default='paper', |
|
1116 | 1128 | ) |
|
1117 | 1129 | coreconfigitem('web', 'templates', |
|
1118 | 1130 | default=None, |
|
1119 | 1131 | ) |
|
1120 | 1132 | coreconfigitem('web', 'view', |
|
1121 | 1133 | default='served', |
|
1122 | 1134 | ) |
|
1123 | 1135 | coreconfigitem('worker', 'backgroundclose', |
|
1124 | 1136 | default=dynamicdefault, |
|
1125 | 1137 | ) |
|
1126 | 1138 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
1127 | 1139 | # should give us enough headway. |
|
1128 | 1140 | coreconfigitem('worker', 'backgroundclosemaxqueue', |
|
1129 | 1141 | default=384, |
|
1130 | 1142 | ) |
|
1131 | 1143 | coreconfigitem('worker', 'backgroundcloseminfilecount', |
|
1132 | 1144 | default=2048, |
|
1133 | 1145 | ) |
|
1134 | 1146 | coreconfigitem('worker', 'backgroundclosethreadcount', |
|
1135 | 1147 | default=4, |
|
1136 | 1148 | ) |
|
1137 | 1149 | coreconfigitem('worker', 'numcpus', |
|
1138 | 1150 | default=None, |
|
1139 | 1151 | ) |
|
1140 | 1152 | |
|
1141 | 1153 | # Rebase related configuration moved to core because other extension are doing |
|
1142 | 1154 | # strange things. For example, shelve import the extensions to reuse some bit |
|
1143 | 1155 | # without formally loading it. |
|
1144 | 1156 | coreconfigitem('commands', 'rebase.requiredest', |
|
1145 | 1157 | default=False, |
|
1146 | 1158 | ) |
|
1147 | 1159 | coreconfigitem('experimental', 'rebaseskipobsolete', |
|
1148 | 1160 | default=True, |
|
1149 | 1161 | ) |
|
1150 | 1162 | coreconfigitem('rebase', 'singletransaction', |
|
1151 | 1163 | default=False, |
|
1152 | 1164 | ) |
@@ -1,2536 +1,2577 b'' | |||
|
1 | 1 | The Mercurial system uses a set of configuration files to control |
|
2 | 2 | aspects of its behavior. |
|
3 | 3 | |
|
4 | 4 | Troubleshooting |
|
5 | 5 | =============== |
|
6 | 6 | |
|
7 | 7 | If you're having problems with your configuration, |
|
8 | 8 | :hg:`config --debug` can help you understand what is introducing |
|
9 | 9 | a setting into your environment. |
|
10 | 10 | |
|
11 | 11 | See :hg:`help config.syntax` and :hg:`help config.files` |
|
12 | 12 | for information about how and where to override things. |
|
13 | 13 | |
|
14 | 14 | Structure |
|
15 | 15 | ========= |
|
16 | 16 | |
|
17 | 17 | The configuration files use a simple ini-file format. A configuration |
|
18 | 18 | file consists of sections, led by a ``[section]`` header and followed |
|
19 | 19 | by ``name = value`` entries:: |
|
20 | 20 | |
|
21 | 21 | [ui] |
|
22 | 22 | username = Firstname Lastname <firstname.lastname@example.net> |
|
23 | 23 | verbose = True |
|
24 | 24 | |
|
25 | 25 | The above entries will be referred to as ``ui.username`` and |
|
26 | 26 | ``ui.verbose``, respectively. See :hg:`help config.syntax`. |
|
27 | 27 | |
|
28 | 28 | Files |
|
29 | 29 | ===== |
|
30 | 30 | |
|
31 | 31 | Mercurial reads configuration data from several files, if they exist. |
|
32 | 32 | These files do not exist by default and you will have to create the |
|
33 | 33 | appropriate configuration files yourself: |
|
34 | 34 | |
|
35 | 35 | Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
36 | 36 | |
|
37 | 37 | Global configuration like the username setting is typically put into: |
|
38 | 38 | |
|
39 | 39 | .. container:: windows |
|
40 | 40 | |
|
41 | 41 | - ``%USERPROFILE%\mercurial.ini`` (on Windows) |
|
42 | 42 | |
|
43 | 43 | .. container:: unix.plan9 |
|
44 | 44 | |
|
45 | 45 | - ``$HOME/.hgrc`` (on Unix, Plan9) |
|
46 | 46 | |
|
47 | 47 | The names of these files depend on the system on which Mercurial is |
|
48 | 48 | installed. ``*.rc`` files from a single directory are read in |
|
49 | 49 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
50 | 50 | paths are given below, settings from earlier paths override later |
|
51 | 51 | ones. |
|
52 | 52 | |
|
53 | 53 | .. container:: verbose.unix |
|
54 | 54 | |
|
55 | 55 | On Unix, the following files are consulted: |
|
56 | 56 | |
|
57 | 57 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
58 | 58 | - ``$HOME/.hgrc`` (per-user) |
|
59 | 59 | - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user) |
|
60 | 60 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
61 | 61 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
62 | 62 | - ``/etc/mercurial/hgrc`` (per-system) |
|
63 | 63 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
64 | 64 | - ``<internal>/default.d/*.rc`` (defaults) |
|
65 | 65 | |
|
66 | 66 | .. container:: verbose.windows |
|
67 | 67 | |
|
68 | 68 | On Windows, the following files are consulted: |
|
69 | 69 | |
|
70 | 70 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
71 | 71 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
72 | 72 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
73 | 73 | - ``%HOME%\.hgrc`` (per-user) |
|
74 | 74 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
75 | 75 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) |
|
76 | 76 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
77 | 77 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
78 | 78 | - ``<internal>/default.d/*.rc`` (defaults) |
|
79 | 79 | |
|
80 | 80 | .. note:: |
|
81 | 81 | |
|
82 | 82 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
83 | 83 | is used when running 32-bit Python on 64-bit Windows. |
|
84 | 84 | |
|
85 | 85 | .. container:: windows |
|
86 | 86 | |
|
87 | 87 | On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. |
|
88 | 88 | |
|
89 | 89 | .. container:: verbose.plan9 |
|
90 | 90 | |
|
91 | 91 | On Plan9, the following files are consulted: |
|
92 | 92 | |
|
93 | 93 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
94 | 94 | - ``$home/lib/hgrc`` (per-user) |
|
95 | 95 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
96 | 96 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
97 | 97 | - ``/lib/mercurial/hgrc`` (per-system) |
|
98 | 98 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
99 | 99 | - ``<internal>/default.d/*.rc`` (defaults) |
|
100 | 100 | |
|
101 | 101 | Per-repository configuration options only apply in a |
|
102 | 102 | particular repository. This file is not version-controlled, and |
|
103 | 103 | will not get transferred during a "clone" operation. Options in |
|
104 | 104 | this file override options in all other configuration files. |
|
105 | 105 | |
|
106 | 106 | .. container:: unix.plan9 |
|
107 | 107 | |
|
108 | 108 | On Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
109 | 109 | belong to a trusted user or to a trusted group. See |
|
110 | 110 | :hg:`help config.trusted` for more details. |
|
111 | 111 | |
|
112 | 112 | Per-user configuration file(s) are for the user running Mercurial. Options |
|
113 | 113 | in these files apply to all Mercurial commands executed by this user in any |
|
114 | 114 | directory. Options in these files override per-system and per-installation |
|
115 | 115 | options. |
|
116 | 116 | |
|
117 | 117 | Per-installation configuration files are searched for in the |
|
118 | 118 | directory where Mercurial is installed. ``<install-root>`` is the |
|
119 | 119 | parent directory of the **hg** executable (or symlink) being run. |
|
120 | 120 | |
|
121 | 121 | .. container:: unix.plan9 |
|
122 | 122 | |
|
123 | 123 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial |
|
124 | 124 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these |
|
125 | 125 | files apply to all Mercurial commands executed by any user in any |
|
126 | 126 | directory. |
|
127 | 127 | |
|
128 | 128 | Per-installation configuration files are for the system on |
|
129 | 129 | which Mercurial is running. Options in these files apply to all |
|
130 | 130 | Mercurial commands executed by any user in any directory. Registry |
|
131 | 131 | keys contain PATH-like strings, every part of which must reference |
|
132 | 132 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
133 | 133 | be read. Mercurial checks each of these locations in the specified |
|
134 | 134 | order until one or more configuration files are detected. |
|
135 | 135 | |
|
136 | 136 | Per-system configuration files are for the system on which Mercurial |
|
137 | 137 | is running. Options in these files apply to all Mercurial commands |
|
138 | 138 | executed by any user in any directory. Options in these files |
|
139 | 139 | override per-installation options. |
|
140 | 140 | |
|
141 | 141 | Mercurial comes with some default configuration. The default configuration |
|
142 | 142 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
143 | 143 | configuration files should never be edited by users or administrators but can |
|
144 | 144 | be overridden in other configuration files. So far the directory only contains |
|
145 | 145 | merge tool configuration but packagers can also put other default configuration |
|
146 | 146 | there. |
|
147 | 147 | |
|
148 | 148 | Syntax |
|
149 | 149 | ====== |
|
150 | 150 | |
|
151 | 151 | A configuration file consists of sections, led by a ``[section]`` header |
|
152 | 152 | and followed by ``name = value`` entries (sometimes called |
|
153 | 153 | ``configuration keys``):: |
|
154 | 154 | |
|
155 | 155 | [spam] |
|
156 | 156 | eggs=ham |
|
157 | 157 | green= |
|
158 | 158 | eggs |
|
159 | 159 | |
|
160 | 160 | Each line contains one entry. If the lines that follow are indented, |
|
161 | 161 | they are treated as continuations of that entry. Leading whitespace is |
|
162 | 162 | removed from values. Empty lines are skipped. Lines beginning with |
|
163 | 163 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
164 | 164 | |
|
165 | 165 | Configuration keys can be set multiple times, in which case Mercurial |
|
166 | 166 | will use the value that was configured last. As an example:: |
|
167 | 167 | |
|
168 | 168 | [spam] |
|
169 | 169 | eggs=large |
|
170 | 170 | ham=serrano |
|
171 | 171 | eggs=small |
|
172 | 172 | |
|
173 | 173 | This would set the configuration key named ``eggs`` to ``small``. |
|
174 | 174 | |
|
175 | 175 | It is also possible to define a section multiple times. A section can |
|
176 | 176 | be redefined on the same and/or on different configuration files. For |
|
177 | 177 | example:: |
|
178 | 178 | |
|
179 | 179 | [foo] |
|
180 | 180 | eggs=large |
|
181 | 181 | ham=serrano |
|
182 | 182 | eggs=small |
|
183 | 183 | |
|
184 | 184 | [bar] |
|
185 | 185 | eggs=ham |
|
186 | 186 | green= |
|
187 | 187 | eggs |
|
188 | 188 | |
|
189 | 189 | [foo] |
|
190 | 190 | ham=prosciutto |
|
191 | 191 | eggs=medium |
|
192 | 192 | bread=toasted |
|
193 | 193 | |
|
194 | 194 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
195 | 195 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
196 | 196 | respectively. As you can see there only thing that matters is the last |
|
197 | 197 | value that was set for each of the configuration keys. |
|
198 | 198 | |
|
199 | 199 | If a configuration key is set multiple times in different |
|
200 | 200 | configuration files the final value will depend on the order in which |
|
201 | 201 | the different configuration files are read, with settings from earlier |
|
202 | 202 | paths overriding later ones as described on the ``Files`` section |
|
203 | 203 | above. |
|
204 | 204 | |
|
205 | 205 | A line of the form ``%include file`` will include ``file`` into the |
|
206 | 206 | current configuration file. The inclusion is recursive, which means |
|
207 | 207 | that included files can include other files. Filenames are relative to |
|
208 | 208 | the configuration file in which the ``%include`` directive is found. |
|
209 | 209 | Environment variables and ``~user`` constructs are expanded in |
|
210 | 210 | ``file``. This lets you do something like:: |
|
211 | 211 | |
|
212 | 212 | %include ~/.hgrc.d/$HOST.rc |
|
213 | 213 | |
|
214 | 214 | to include a different configuration file on each computer you use. |
|
215 | 215 | |
|
216 | 216 | A line with ``%unset name`` will remove ``name`` from the current |
|
217 | 217 | section, if it has been set previously. |
|
218 | 218 | |
|
219 | 219 | The values are either free-form text strings, lists of text strings, |
|
220 | 220 | or Boolean values. Boolean values can be set to true using any of "1", |
|
221 | 221 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
222 | 222 | (all case insensitive). |
|
223 | 223 | |
|
224 | 224 | List values are separated by whitespace or comma, except when values are |
|
225 | 225 | placed in double quotation marks:: |
|
226 | 226 | |
|
227 | 227 | allow_read = "John Doe, PhD", brian, betty |
|
228 | 228 | |
|
229 | 229 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
230 | 230 | quotation marks at the beginning of a word is counted as a quotation |
|
231 | 231 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
232 | 232 | |
|
233 | 233 | Sections |
|
234 | 234 | ======== |
|
235 | 235 | |
|
236 | 236 | This section describes the different sections that may appear in a |
|
237 | 237 | Mercurial configuration file, the purpose of each section, its possible |
|
238 | 238 | keys, and their possible values. |
|
239 | 239 | |
|
240 | 240 | ``alias`` |
|
241 | 241 | --------- |
|
242 | 242 | |
|
243 | 243 | Defines command aliases. |
|
244 | 244 | |
|
245 | 245 | Aliases allow you to define your own commands in terms of other |
|
246 | 246 | commands (or aliases), optionally including arguments. Positional |
|
247 | 247 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
248 | 248 | are expanded by Mercurial before execution. Positional arguments not |
|
249 | 249 | already used by ``$N`` in the definition are put at the end of the |
|
250 | 250 | command to be executed. |
|
251 | 251 | |
|
252 | 252 | Alias definitions consist of lines of the form:: |
|
253 | 253 | |
|
254 | 254 | <alias> = <command> [<argument>]... |
|
255 | 255 | |
|
256 | 256 | For example, this definition:: |
|
257 | 257 | |
|
258 | 258 | latest = log --limit 5 |
|
259 | 259 | |
|
260 | 260 | creates a new command ``latest`` that shows only the five most recent |
|
261 | 261 | changesets. You can define subsequent aliases using earlier ones:: |
|
262 | 262 | |
|
263 | 263 | stable5 = latest -b stable |
|
264 | 264 | |
|
265 | 265 | .. note:: |
|
266 | 266 | |
|
267 | 267 | It is possible to create aliases with the same names as |
|
268 | 268 | existing commands, which will then override the original |
|
269 | 269 | definitions. This is almost always a bad idea! |
|
270 | 270 | |
|
271 | 271 | An alias can start with an exclamation point (``!``) to make it a |
|
272 | 272 | shell alias. A shell alias is executed with the shell and will let you |
|
273 | 273 | run arbitrary commands. As an example, :: |
|
274 | 274 | |
|
275 | 275 | echo = !echo $@ |
|
276 | 276 | |
|
277 | 277 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
278 | 278 | terminal. A better example might be:: |
|
279 | 279 | |
|
280 | 280 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f |
|
281 | 281 | |
|
282 | 282 | which will make ``hg purge`` delete all unknown files in the |
|
283 | 283 | repository in the same manner as the purge extension. |
|
284 | 284 | |
|
285 | 285 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
286 | 286 | expand to the command arguments. Unmatched arguments are |
|
287 | 287 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
288 | 288 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
289 | 289 | arguments quoted individually and separated by a space. These expansions |
|
290 | 290 | happen before the command is passed to the shell. |
|
291 | 291 | |
|
292 | 292 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
293 | 293 | the path of the Mercurial that was used to execute the alias. This is |
|
294 | 294 | useful when you want to call further Mercurial commands in a shell |
|
295 | 295 | alias, as was done above for the purge alias. In addition, |
|
296 | 296 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
297 | 297 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
298 | 298 | |
|
299 | 299 | .. note:: |
|
300 | 300 | |
|
301 | 301 | Some global configuration options such as ``-R`` are |
|
302 | 302 | processed before shell aliases and will thus not be passed to |
|
303 | 303 | aliases. |
|
304 | 304 | |
|
305 | 305 | |
|
306 | 306 | ``annotate`` |
|
307 | 307 | ------------ |
|
308 | 308 | |
|
309 | 309 | Settings used when displaying file annotations. All values are |
|
310 | 310 | Booleans and default to False. See :hg:`help config.diff` for |
|
311 | 311 | related options for the diff command. |
|
312 | 312 | |
|
313 | 313 | ``ignorews`` |
|
314 | 314 | Ignore white space when comparing lines. |
|
315 | 315 | |
|
316 | 316 | ``ignorewseol`` |
|
317 | 317 | Ignore white space at the end of a line when comparing lines. |
|
318 | 318 | |
|
319 | 319 | ``ignorewsamount`` |
|
320 | 320 | Ignore changes in the amount of white space. |
|
321 | 321 | |
|
322 | 322 | ``ignoreblanklines`` |
|
323 | 323 | Ignore changes whose lines are all blank. |
|
324 | 324 | |
|
325 | 325 | |
|
326 | 326 | ``auth`` |
|
327 | 327 | -------- |
|
328 | 328 | |
|
329 | 329 | Authentication credentials and other authentication-like configuration |
|
330 | 330 | for HTTP connections. This section allows you to store usernames and |
|
331 | 331 | passwords for use when logging *into* HTTP servers. See |
|
332 | 332 | :hg:`help config.web` if you want to configure *who* can login to |
|
333 | 333 | your HTTP server. |
|
334 | 334 | |
|
335 | 335 | The following options apply to all hosts. |
|
336 | 336 | |
|
337 | 337 | ``cookiefile`` |
|
338 | 338 | Path to a file containing HTTP cookie lines. Cookies matching a |
|
339 | 339 | host will be sent automatically. |
|
340 | 340 | |
|
341 | 341 | The file format uses the Mozilla cookies.txt format, which defines cookies |
|
342 | 342 | on their own lines. Each line contains 7 fields delimited by the tab |
|
343 | 343 | character (domain, is_domain_cookie, path, is_secure, expires, name, |
|
344 | 344 | value). For more info, do an Internet search for "Netscape cookies.txt |
|
345 | 345 | format." |
|
346 | 346 | |
|
347 | 347 | Note: the cookies parser does not handle port numbers on domains. You |
|
348 | 348 | will need to remove ports from the domain for the cookie to be recognized. |
|
349 | 349 | This could result in a cookie being disclosed to an unwanted server. |
|
350 | 350 | |
|
351 | 351 | The cookies file is read-only. |
|
352 | 352 | |
|
353 | 353 | Other options in this section are grouped by name and have the following |
|
354 | 354 | format:: |
|
355 | 355 | |
|
356 | 356 | <name>.<argument> = <value> |
|
357 | 357 | |
|
358 | 358 | where ``<name>`` is used to group arguments into authentication |
|
359 | 359 | entries. Example:: |
|
360 | 360 | |
|
361 | 361 | foo.prefix = hg.intevation.de/mercurial |
|
362 | 362 | foo.username = foo |
|
363 | 363 | foo.password = bar |
|
364 | 364 | foo.schemes = http https |
|
365 | 365 | |
|
366 | 366 | bar.prefix = secure.example.org |
|
367 | 367 | bar.key = path/to/file.key |
|
368 | 368 | bar.cert = path/to/file.cert |
|
369 | 369 | bar.schemes = https |
|
370 | 370 | |
|
371 | 371 | Supported arguments: |
|
372 | 372 | |
|
373 | 373 | ``prefix`` |
|
374 | 374 | Either ``*`` or a URI prefix with or without the scheme part. |
|
375 | 375 | The authentication entry with the longest matching prefix is used |
|
376 | 376 | (where ``*`` matches everything and counts as a match of length |
|
377 | 377 | 1). If the prefix doesn't include a scheme, the match is performed |
|
378 | 378 | against the URI with its scheme stripped as well, and the schemes |
|
379 | 379 | argument, q.v., is then subsequently consulted. |
|
380 | 380 | |
|
381 | 381 | ``username`` |
|
382 | 382 | Optional. Username to authenticate with. If not given, and the |
|
383 | 383 | remote site requires basic or digest authentication, the user will |
|
384 | 384 | be prompted for it. Environment variables are expanded in the |
|
385 | 385 | username letting you do ``foo.username = $USER``. If the URI |
|
386 | 386 | includes a username, only ``[auth]`` entries with a matching |
|
387 | 387 | username or without a username will be considered. |
|
388 | 388 | |
|
389 | 389 | ``password`` |
|
390 | 390 | Optional. Password to authenticate with. If not given, and the |
|
391 | 391 | remote site requires basic or digest authentication, the user |
|
392 | 392 | will be prompted for it. |
|
393 | 393 | |
|
394 | 394 | ``key`` |
|
395 | 395 | Optional. PEM encoded client certificate key file. Environment |
|
396 | 396 | variables are expanded in the filename. |
|
397 | 397 | |
|
398 | 398 | ``cert`` |
|
399 | 399 | Optional. PEM encoded client certificate chain file. Environment |
|
400 | 400 | variables are expanded in the filename. |
|
401 | 401 | |
|
402 | 402 | ``schemes`` |
|
403 | 403 | Optional. Space separated list of URI schemes to use this |
|
404 | 404 | authentication entry with. Only used if the prefix doesn't include |
|
405 | 405 | a scheme. Supported schemes are http and https. They will match |
|
406 | 406 | static-http and static-https respectively, as well. |
|
407 | 407 | (default: https) |
|
408 | 408 | |
|
409 | 409 | If no suitable authentication entry is found, the user is prompted |
|
410 | 410 | for credentials as usual if required by the remote. |
|
411 | 411 | |
|
412 | 412 | ``color`` |
|
413 | 413 | --------- |
|
414 | 414 | |
|
415 | 415 | Configure the Mercurial color mode. For details about how to define your custom |
|
416 | 416 | effect and style see :hg:`help color`. |
|
417 | 417 | |
|
418 | 418 | ``mode`` |
|
419 | 419 | String: control the method used to output color. One of ``auto``, ``ansi``, |
|
420 | 420 | ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will |
|
421 | 421 | use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a |
|
422 | 422 | terminal. Any invalid value will disable color. |
|
423 | 423 | |
|
424 | 424 | ``pagermode`` |
|
425 | 425 | String: optional override of ``color.mode`` used with pager. |
|
426 | 426 | |
|
427 | 427 | On some systems, terminfo mode may cause problems when using |
|
428 | 428 | color with ``less -R`` as a pager program. less with the -R option |
|
429 | 429 | will only display ECMA-48 color codes, and terminfo mode may sometimes |
|
430 | 430 | emit codes that less doesn't understand. You can work around this by |
|
431 | 431 | either using ansi mode (or auto mode), or by using less -r (which will |
|
432 | 432 | pass through all terminal control codes, not just color control |
|
433 | 433 | codes). |
|
434 | 434 | |
|
435 | 435 | On some systems (such as MSYS in Windows), the terminal may support |
|
436 | 436 | a different color mode than the pager program. |
|
437 | 437 | |
|
438 | 438 | ``commands`` |
|
439 | 439 | ------------ |
|
440 | 440 | |
|
441 | 441 | ``status.relative`` |
|
442 | 442 | Make paths in :hg:`status` output relative to the current directory. |
|
443 | 443 | (default: False) |
|
444 | 444 | |
|
445 | 445 | ``update.check`` |
|
446 | 446 | Determines what level of checking :hg:`update` will perform before moving |
|
447 | 447 | to a destination revision. Valid values are ``abort``, ``none``, |
|
448 | 448 | ``linear``, and ``noconflict``. ``abort`` always fails if the working |
|
449 | 449 | directory has uncommitted changes. ``none`` performs no checking, and may |
|
450 | 450 | result in a merge with uncommitted changes. ``linear`` allows any update |
|
451 | 451 | as long as it follows a straight line in the revision history, and may |
|
452 | 452 | trigger a merge with uncommitted changes. ``noconflict`` will allow any |
|
453 | 453 | update which would not trigger a merge with uncommitted changes, if any |
|
454 | 454 | are present. |
|
455 | 455 | (default: ``linear``) |
|
456 | 456 | |
|
457 | 457 | ``update.requiredest`` |
|
458 | 458 | Require that the user pass a destination when running :hg:`update`. |
|
459 | 459 | For example, :hg:`update .::` will be allowed, but a plain :hg:`update` |
|
460 | 460 | will be disallowed. |
|
461 | 461 | (default: False) |
|
462 | 462 | |
|
463 | 463 | ``committemplate`` |
|
464 | 464 | ------------------ |
|
465 | 465 | |
|
466 | 466 | ``changeset`` |
|
467 | 467 | String: configuration in this section is used as the template to |
|
468 | 468 | customize the text shown in the editor when committing. |
|
469 | 469 | |
|
470 | 470 | In addition to pre-defined template keywords, commit log specific one |
|
471 | 471 | below can be used for customization: |
|
472 | 472 | |
|
473 | 473 | ``extramsg`` |
|
474 | 474 | String: Extra message (typically 'Leave message empty to abort |
|
475 | 475 | commit.'). This may be changed by some commands or extensions. |
|
476 | 476 | |
|
477 | 477 | For example, the template configuration below shows as same text as |
|
478 | 478 | one shown by default:: |
|
479 | 479 | |
|
480 | 480 | [committemplate] |
|
481 | 481 | changeset = {desc}\n\n |
|
482 | 482 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
483 | 483 | HG: {extramsg} |
|
484 | 484 | HG: -- |
|
485 | 485 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
486 | 486 | "HG: branch merge\n") |
|
487 | 487 | }HG: branch '{branch}'\n{if(activebookmark, |
|
488 | 488 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
489 | 489 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
490 | 490 | "HG: added {file}\n" }{file_mods % |
|
491 | 491 | "HG: changed {file}\n" }{file_dels % |
|
492 | 492 | "HG: removed {file}\n" }{if(files, "", |
|
493 | 493 | "HG: no files changed\n")} |
|
494 | 494 | |
|
495 | 495 | ``diff()`` |
|
496 | 496 | String: show the diff (see :hg:`help templates` for detail) |
|
497 | 497 | |
|
498 | 498 | Sometimes it is helpful to show the diff of the changeset in the editor without |
|
499 | 499 | having to prefix 'HG: ' to each line so that highlighting works correctly. For |
|
500 | 500 | this, Mercurial provides a special string which will ignore everything below |
|
501 | 501 | it:: |
|
502 | 502 | |
|
503 | 503 | HG: ------------------------ >8 ------------------------ |
|
504 | 504 | |
|
505 | 505 | For example, the template configuration below will show the diff below the |
|
506 | 506 | extra message:: |
|
507 | 507 | |
|
508 | 508 | [committemplate] |
|
509 | 509 | changeset = {desc}\n\n |
|
510 | 510 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
511 | 511 | HG: {extramsg} |
|
512 | 512 | HG: ------------------------ >8 ------------------------ |
|
513 | 513 | HG: Do not touch the line above. |
|
514 | 514 | HG: Everything below will be removed. |
|
515 | 515 | {diff()} |
|
516 | 516 | |
|
517 | 517 | .. note:: |
|
518 | 518 | |
|
519 | 519 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
520 | 520 | detail), this customization should be configured carefully, to |
|
521 | 521 | avoid showing broken characters. |
|
522 | 522 | |
|
523 | 523 | For example, if a multibyte character ending with backslash (0x5c) is |
|
524 | 524 | followed by the ASCII character 'n' in the customized template, |
|
525 | 525 | the sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
526 | 526 | (and the multibyte character is broken, too). |
|
527 | 527 | |
|
528 | 528 | Customized template is used for commands below (``--edit`` may be |
|
529 | 529 | required): |
|
530 | 530 | |
|
531 | 531 | - :hg:`backout` |
|
532 | 532 | - :hg:`commit` |
|
533 | 533 | - :hg:`fetch` (for merge commit only) |
|
534 | 534 | - :hg:`graft` |
|
535 | 535 | - :hg:`histedit` |
|
536 | 536 | - :hg:`import` |
|
537 | 537 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
538 | 538 | - :hg:`rebase` |
|
539 | 539 | - :hg:`shelve` |
|
540 | 540 | - :hg:`sign` |
|
541 | 541 | - :hg:`tag` |
|
542 | 542 | - :hg:`transplant` |
|
543 | 543 | |
|
544 | 544 | Configuring items below instead of ``changeset`` allows showing |
|
545 | 545 | customized message only for specific actions, or showing different |
|
546 | 546 | messages for each action. |
|
547 | 547 | |
|
548 | 548 | - ``changeset.backout`` for :hg:`backout` |
|
549 | 549 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
550 | 550 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
551 | 551 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
552 | 552 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
553 | 553 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
554 | 554 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
555 | 555 | - ``changeset.graft`` for :hg:`graft` |
|
556 | 556 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
557 | 557 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
558 | 558 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
559 | 559 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
560 | 560 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
561 | 561 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
562 | 562 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
563 | 563 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
564 | 564 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
565 | 565 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
566 | 566 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
567 | 567 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
568 | 568 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
569 | 569 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
570 | 570 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
571 | 571 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
572 | 572 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
573 | 573 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
574 | 574 | |
|
575 | 575 | These dot-separated lists of names are treated as hierarchical ones. |
|
576 | 576 | For example, ``changeset.tag.remove`` customizes the commit message |
|
577 | 577 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
578 | 578 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
579 | 579 | |
|
580 | 580 | When the external editor is invoked for a commit, the corresponding |
|
581 | 581 | dot-separated list of names without the ``changeset.`` prefix |
|
582 | 582 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment |
|
583 | 583 | variable. |
|
584 | 584 | |
|
585 | 585 | In this section, items other than ``changeset`` can be referred from |
|
586 | 586 | others. For example, the configuration to list committed files up |
|
587 | 587 | below can be referred as ``{listupfiles}``:: |
|
588 | 588 | |
|
589 | 589 | [committemplate] |
|
590 | 590 | listupfiles = {file_adds % |
|
591 | 591 | "HG: added {file}\n" }{file_mods % |
|
592 | 592 | "HG: changed {file}\n" }{file_dels % |
|
593 | 593 | "HG: removed {file}\n" }{if(files, "", |
|
594 | 594 | "HG: no files changed\n")} |
|
595 | 595 | |
|
596 | 596 | ``decode/encode`` |
|
597 | 597 | ----------------- |
|
598 | 598 | |
|
599 | 599 | Filters for transforming files on checkout/checkin. This would |
|
600 | 600 | typically be used for newline processing or other |
|
601 | 601 | localization/canonicalization of files. |
|
602 | 602 | |
|
603 | 603 | Filters consist of a filter pattern followed by a filter command. |
|
604 | 604 | Filter patterns are globs by default, rooted at the repository root. |
|
605 | 605 | For example, to match any file ending in ``.txt`` in the root |
|
606 | 606 | directory only, use the pattern ``*.txt``. To match any file ending |
|
607 | 607 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
608 | 608 | For each file only the first matching filter applies. |
|
609 | 609 | |
|
610 | 610 | The filter command can start with a specifier, either ``pipe:`` or |
|
611 | 611 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
612 | 612 | |
|
613 | 613 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
614 | 614 | data on stdout. |
|
615 | 615 | |
|
616 | 616 | Pipe example:: |
|
617 | 617 | |
|
618 | 618 | [encode] |
|
619 | 619 | # uncompress gzip files on checkin to improve delta compression |
|
620 | 620 | # note: not necessarily a good idea, just an example |
|
621 | 621 | *.gz = pipe: gunzip |
|
622 | 622 | |
|
623 | 623 | [decode] |
|
624 | 624 | # recompress gzip files when writing them to the working dir (we |
|
625 | 625 | # can safely omit "pipe:", because it's the default) |
|
626 | 626 | *.gz = gzip |
|
627 | 627 | |
|
628 | 628 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
629 | 629 | with the name of a temporary file that contains the data to be |
|
630 | 630 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
631 | 631 | of an empty temporary file, where the filtered data must be written by |
|
632 | 632 | the command. |
|
633 | 633 | |
|
634 | 634 | .. container:: windows |
|
635 | 635 | |
|
636 | 636 | .. note:: |
|
637 | 637 | |
|
638 | 638 | The tempfile mechanism is recommended for Windows systems, |
|
639 | 639 | where the standard shell I/O redirection operators often have |
|
640 | 640 | strange effects and may corrupt the contents of your files. |
|
641 | 641 | |
|
642 | 642 | This filter mechanism is used internally by the ``eol`` extension to |
|
643 | 643 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
644 | 644 | format. We suggest you use the ``eol`` extension for convenience. |
|
645 | 645 | |
|
646 | 646 | |
|
647 | 647 | ``defaults`` |
|
648 | 648 | ------------ |
|
649 | 649 | |
|
650 | 650 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
651 | 651 | |
|
652 | 652 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
653 | 653 | default options/arguments to pass to the specified commands. |
|
654 | 654 | |
|
655 | 655 | The following example makes :hg:`log` run in verbose mode, and |
|
656 | 656 | :hg:`status` show only the modified files, by default:: |
|
657 | 657 | |
|
658 | 658 | [defaults] |
|
659 | 659 | log = -v |
|
660 | 660 | status = -m |
|
661 | 661 | |
|
662 | 662 | The actual commands, instead of their aliases, must be used when |
|
663 | 663 | defining command defaults. The command defaults will also be applied |
|
664 | 664 | to the aliases of the commands defined. |
|
665 | 665 | |
|
666 | 666 | |
|
667 | 667 | ``diff`` |
|
668 | 668 | -------- |
|
669 | 669 | |
|
670 | 670 | Settings used when displaying diffs. Everything except for ``unified`` |
|
671 | 671 | is a Boolean and defaults to False. See :hg:`help config.annotate` |
|
672 | 672 | for related options for the annotate command. |
|
673 | 673 | |
|
674 | 674 | ``git`` |
|
675 | 675 | Use git extended diff format. |
|
676 | 676 | |
|
677 | 677 | ``nobinary`` |
|
678 | 678 | Omit git binary patches. |
|
679 | 679 | |
|
680 | 680 | ``nodates`` |
|
681 | 681 | Don't include dates in diff headers. |
|
682 | 682 | |
|
683 | 683 | ``noprefix`` |
|
684 | 684 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
685 | 685 | |
|
686 | 686 | ``showfunc`` |
|
687 | 687 | Show which function each change is in. |
|
688 | 688 | |
|
689 | 689 | ``ignorews`` |
|
690 | 690 | Ignore white space when comparing lines. |
|
691 | 691 | |
|
692 | 692 | ``ignorewsamount`` |
|
693 | 693 | Ignore changes in the amount of white space. |
|
694 | 694 | |
|
695 | 695 | ``ignoreblanklines`` |
|
696 | 696 | Ignore changes whose lines are all blank. |
|
697 | 697 | |
|
698 | 698 | ``unified`` |
|
699 | 699 | Number of lines of context to show. |
|
700 | 700 | |
|
701 | 701 | ``email`` |
|
702 | 702 | --------- |
|
703 | 703 | |
|
704 | 704 | Settings for extensions that send email messages. |
|
705 | 705 | |
|
706 | 706 | ``from`` |
|
707 | 707 | Optional. Email address to use in "From" header and SMTP envelope |
|
708 | 708 | of outgoing messages. |
|
709 | 709 | |
|
710 | 710 | ``to`` |
|
711 | 711 | Optional. Comma-separated list of recipients' email addresses. |
|
712 | 712 | |
|
713 | 713 | ``cc`` |
|
714 | 714 | Optional. Comma-separated list of carbon copy recipients' |
|
715 | 715 | email addresses. |
|
716 | 716 | |
|
717 | 717 | ``bcc`` |
|
718 | 718 | Optional. Comma-separated list of blind carbon copy recipients' |
|
719 | 719 | email addresses. |
|
720 | 720 | |
|
721 | 721 | ``method`` |
|
722 | 722 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
723 | 723 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
724 | 724 | Otherwise, use as name of program to run that acts like sendmail |
|
725 | 725 | (takes ``-f`` option for sender, list of recipients on command line, |
|
726 | 726 | message on stdin). Normally, setting this to ``sendmail`` or |
|
727 | 727 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
728 | 728 | |
|
729 | 729 | ``charsets`` |
|
730 | 730 | Optional. Comma-separated list of character sets considered |
|
731 | 731 | convenient for recipients. Addresses, headers, and parts not |
|
732 | 732 | containing patches of outgoing messages will be encoded in the |
|
733 | 733 | first character set to which conversion from local encoding |
|
734 | 734 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
735 | 735 | conversion fails, the text in question is sent as is. |
|
736 | 736 | (default: '') |
|
737 | 737 | |
|
738 | 738 | Order of outgoing email character sets: |
|
739 | 739 | |
|
740 | 740 | 1. ``us-ascii``: always first, regardless of settings |
|
741 | 741 | 2. ``email.charsets``: in order given by user |
|
742 | 742 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
743 | 743 | 4. ``$HGENCODING``: if not in email.charsets |
|
744 | 744 | 5. ``utf-8``: always last, regardless of settings |
|
745 | 745 | |
|
746 | 746 | Email example:: |
|
747 | 747 | |
|
748 | 748 | [email] |
|
749 | 749 | from = Joseph User <joe.user@example.com> |
|
750 | 750 | method = /usr/sbin/sendmail |
|
751 | 751 | # charsets for western Europeans |
|
752 | 752 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
753 | 753 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
754 | 754 | |
|
755 | 755 | |
|
756 | 756 | ``extensions`` |
|
757 | 757 | -------------- |
|
758 | 758 | |
|
759 | 759 | Mercurial has an extension mechanism for adding new features. To |
|
760 | 760 | enable an extension, create an entry for it in this section. |
|
761 | 761 | |
|
762 | 762 | If you know that the extension is already in Python's search path, |
|
763 | 763 | you can give the name of the module, followed by ``=``, with nothing |
|
764 | 764 | after the ``=``. |
|
765 | 765 | |
|
766 | 766 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
767 | 767 | the path to the ``.py`` file (including the file name extension) that |
|
768 | 768 | defines the extension. |
|
769 | 769 | |
|
770 | 770 | To explicitly disable an extension that is enabled in an hgrc of |
|
771 | 771 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
772 | 772 | or ``foo = !`` when path is not supplied. |
|
773 | 773 | |
|
774 | 774 | Example for ``~/.hgrc``:: |
|
775 | 775 | |
|
776 | 776 | [extensions] |
|
777 | 777 | # (the churn extension will get loaded from Mercurial's path) |
|
778 | 778 | churn = |
|
779 | 779 | # (this extension will get loaded from the file specified) |
|
780 | 780 | myfeature = ~/.hgext/myfeature.py |
|
781 | 781 | |
|
782 | 782 | |
|
783 | 783 | ``format`` |
|
784 | 784 | ---------- |
|
785 | 785 | |
|
786 | 786 | ``usegeneraldelta`` |
|
787 | 787 | Enable or disable the "generaldelta" repository format which improves |
|
788 | 788 | repository compression by allowing "revlog" to store delta against arbitrary |
|
789 | 789 | revision instead of the previous stored one. This provides significant |
|
790 | 790 | improvement for repositories with branches. |
|
791 | 791 | |
|
792 | 792 | Repositories with this on-disk format require Mercurial version 1.9. |
|
793 | 793 | |
|
794 | 794 | Enabled by default. |
|
795 | 795 | |
|
796 | 796 | ``dotencode`` |
|
797 | 797 | Enable or disable the "dotencode" repository format which enhances |
|
798 | 798 | the "fncache" repository format (which has to be enabled to use |
|
799 | 799 | dotencode) to avoid issues with filenames starting with ._ on |
|
800 | 800 | Mac OS X and spaces on Windows. |
|
801 | 801 | |
|
802 | 802 | Repositories with this on-disk format require Mercurial version 1.7. |
|
803 | 803 | |
|
804 | 804 | Enabled by default. |
|
805 | 805 | |
|
806 | 806 | ``usefncache`` |
|
807 | 807 | Enable or disable the "fncache" repository format which enhances |
|
808 | 808 | the "store" repository format (which has to be enabled to use |
|
809 | 809 | fncache) to allow longer filenames and avoids using Windows |
|
810 | 810 | reserved names, e.g. "nul". |
|
811 | 811 | |
|
812 | 812 | Repositories with this on-disk format require Mercurial version 1.1. |
|
813 | 813 | |
|
814 | 814 | Enabled by default. |
|
815 | 815 | |
|
816 | 816 | ``usestore`` |
|
817 | 817 | Enable or disable the "store" repository format which improves |
|
818 | 818 | compatibility with systems that fold case or otherwise mangle |
|
819 | 819 | filenames. Disabling this option will allow you to store longer filenames |
|
820 | 820 | in some situations at the expense of compatibility. |
|
821 | 821 | |
|
822 | 822 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
823 | 823 | |
|
824 | 824 | Enabled by default. |
|
825 | 825 | |
|
826 | 826 | ``graph`` |
|
827 | 827 | --------- |
|
828 | 828 | |
|
829 | 829 | Web graph view configuration. This section let you change graph |
|
830 | 830 | elements display properties by branches, for instance to make the |
|
831 | 831 | ``default`` branch stand out. |
|
832 | 832 | |
|
833 | 833 | Each line has the following format:: |
|
834 | 834 | |
|
835 | 835 | <branch>.<argument> = <value> |
|
836 | 836 | |
|
837 | 837 | where ``<branch>`` is the name of the branch being |
|
838 | 838 | customized. Example:: |
|
839 | 839 | |
|
840 | 840 | [graph] |
|
841 | 841 | # 2px width |
|
842 | 842 | default.width = 2 |
|
843 | 843 | # red color |
|
844 | 844 | default.color = FF0000 |
|
845 | 845 | |
|
846 | 846 | Supported arguments: |
|
847 | 847 | |
|
848 | 848 | ``width`` |
|
849 | 849 | Set branch edges width in pixels. |
|
850 | 850 | |
|
851 | 851 | ``color`` |
|
852 | 852 | Set branch edges color in hexadecimal RGB notation. |
|
853 | 853 | |
|
854 | 854 | ``hooks`` |
|
855 | 855 | --------- |
|
856 | 856 | |
|
857 | 857 | Commands or Python functions that get automatically executed by |
|
858 | 858 | various actions such as starting or finishing a commit. Multiple |
|
859 | 859 | hooks can be run for the same action by appending a suffix to the |
|
860 | 860 | action. Overriding a site-wide hook can be done by changing its |
|
861 | 861 | value or setting it to an empty string. Hooks can be prioritized |
|
862 | 862 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
863 | 863 | and setting the priority. The default priority is 0. |
|
864 | 864 | |
|
865 | 865 | Example ``.hg/hgrc``:: |
|
866 | 866 | |
|
867 | 867 | [hooks] |
|
868 | 868 | # update working directory after adding changesets |
|
869 | 869 | changegroup.update = hg update |
|
870 | 870 | # do not use the site-wide hook |
|
871 | 871 | incoming = |
|
872 | 872 | incoming.email = /my/email/hook |
|
873 | 873 | incoming.autobuild = /my/build/hook |
|
874 | 874 | # force autobuild hook to run before other incoming hooks |
|
875 | 875 | priority.incoming.autobuild = 1 |
|
876 | 876 | |
|
877 | 877 | Most hooks are run with environment variables set that give useful |
|
878 | 878 | additional information. For each hook below, the environment variables |
|
879 | 879 | it is passed are listed with names in the form ``$HG_foo``. The |
|
880 | 880 | ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks. |
|
881 | 881 | They contain the type of hook which triggered the run and the full name |
|
882 | 882 | of the hook in the config, respectively. In the example above, this will |
|
883 | 883 | be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``. |
|
884 | 884 | |
|
885 | 885 | ``changegroup`` |
|
886 | 886 | Run after a changegroup has been added via push, pull or unbundle. The ID of |
|
887 | 887 | the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``. |
|
888 | 888 | The URL from which changes came is in ``$HG_URL``. |
|
889 | 889 | |
|
890 | 890 | ``commit`` |
|
891 | 891 | Run after a changeset has been created in the local repository. The ID |
|
892 | 892 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
893 | 893 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
894 | 894 | |
|
895 | 895 | ``incoming`` |
|
896 | 896 | Run after a changeset has been pulled, pushed, or unbundled into |
|
897 | 897 | the local repository. The ID of the newly arrived changeset is in |
|
898 | 898 | ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``. |
|
899 | 899 | |
|
900 | 900 | ``outgoing`` |
|
901 | 901 | Run after sending changes from the local repository to another. The ID of |
|
902 | 902 | first changeset sent is in ``$HG_NODE``. The source of operation is in |
|
903 | 903 | ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`. |
|
904 | 904 | |
|
905 | 905 | ``post-<command>`` |
|
906 | 906 | Run after successful invocations of the associated command. The |
|
907 | 907 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
908 | 908 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
909 | 909 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
910 | 910 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
911 | 911 | dictionary of options (with unspecified options set to their defaults). |
|
912 | 912 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
913 | 913 | |
|
914 | 914 | ``fail-<command>`` |
|
915 | 915 | Run after a failed invocation of an associated command. The contents |
|
916 | 916 | of the command line are passed as ``$HG_ARGS``. Parsed command line |
|
917 | 917 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain |
|
918 | 918 | string representations of the python data internally passed to |
|
919 | 919 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified |
|
920 | 920 | options set to their defaults). ``$HG_PATS`` is a list of arguments. |
|
921 | 921 | Hook failure is ignored. |
|
922 | 922 | |
|
923 | 923 | ``pre-<command>`` |
|
924 | 924 | Run before executing the associated command. The contents of the |
|
925 | 925 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
926 | 926 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
927 | 927 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
928 | 928 | is a dictionary of options (with unspecified options set to their |
|
929 | 929 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
930 | 930 | failure, the command doesn't execute and Mercurial returns the failure |
|
931 | 931 | code. |
|
932 | 932 | |
|
933 | 933 | ``prechangegroup`` |
|
934 | 934 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
935 | 935 | status 0 allows the changegroup to proceed. A non-zero status will |
|
936 | 936 | cause the push, pull or unbundle to fail. The URL from which changes |
|
937 | 937 | will come is in ``$HG_URL``. |
|
938 | 938 | |
|
939 | 939 | ``precommit`` |
|
940 | 940 | Run before starting a local commit. Exit status 0 allows the |
|
941 | 941 | commit to proceed. A non-zero status will cause the commit to fail. |
|
942 | 942 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
943 | 943 | |
|
944 | 944 | ``prelistkeys`` |
|
945 | 945 | Run before listing pushkeys (like bookmarks) in the |
|
946 | 946 | repository. A non-zero status will cause failure. The key namespace is |
|
947 | 947 | in ``$HG_NAMESPACE``. |
|
948 | 948 | |
|
949 | 949 | ``preoutgoing`` |
|
950 | 950 | Run before collecting changes to send from the local repository to |
|
951 | 951 | another. A non-zero status will cause failure. This lets you prevent |
|
952 | 952 | pull over HTTP or SSH. It can also prevent propagating commits (via |
|
953 | 953 | local pull, push (outbound) or bundle commands), but not completely, |
|
954 | 954 | since you can just copy files instead. The source of operation is in |
|
955 | 955 | ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote |
|
956 | 956 | SSH or HTTP repository. If "push", "pull" or "bundle", the operation |
|
957 | 957 | is happening on behalf of a repository on same system. |
|
958 | 958 | |
|
959 | 959 | ``prepushkey`` |
|
960 | 960 | Run before a pushkey (like a bookmark) is added to the |
|
961 | 961 | repository. A non-zero status will cause the key to be rejected. The |
|
962 | 962 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
963 | 963 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
964 | 964 | ``$HG_NEW``. |
|
965 | 965 | |
|
966 | 966 | ``pretag`` |
|
967 | 967 | Run before creating a tag. Exit status 0 allows the tag to be |
|
968 | 968 | created. A non-zero status will cause the tag to fail. The ID of the |
|
969 | 969 | changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The |
|
970 | 970 | tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``. |
|
971 | 971 | |
|
972 | 972 | ``pretxnopen`` |
|
973 | 973 | Run before any new repository transaction is open. The reason for the |
|
974 | 974 | transaction will be in ``$HG_TXNNAME``, and a unique identifier for the |
|
975 | 975 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the |
|
976 | 976 | transaction from being opened. |
|
977 | 977 | |
|
978 | 978 | ``pretxnclose`` |
|
979 | 979 | Run right before the transaction is actually finalized. Any repository change |
|
980 | 980 | will be visible to the hook program. This lets you validate the transaction |
|
981 | 981 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
982 | 982 | status will cause the transaction to be rolled back. The reason for the |
|
983 | 983 | transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for |
|
984 | 984 | the transaction will be in ``HG_TXNID``. The rest of the available data will |
|
985 | 985 | vary according the transaction type. New changesets will add ``$HG_NODE`` |
|
986 | 986 | (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last |
|
987 | 987 | added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and |
|
988 | 988 | phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1`` |
|
989 | 989 | respectively, etc. |
|
990 | 990 | |
|
991 | 991 | ``pretxnclose-bookmark`` |
|
992 | 992 | Run right before a bookmark change is actually finalized. Any repository |
|
993 | 993 | change will be visible to the hook program. This lets you validate the |
|
994 | 994 | transaction content or change it. Exit status 0 allows the commit to |
|
995 | 995 | proceed. A non-zero status will cause the transaction to be rolled back. |
|
996 | 996 | The name of the bookmark will be available in ``$HG_BOOKMARK``, the new |
|
997 | 997 | bookmark location will be available in ``$HG_NODE`` while the previous |
|
998 | 998 | location will be available in ``$HG_OLDNODE``. In case of a bookmark |
|
999 | 999 | creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE`` |
|
1000 | 1000 | will be empty. |
|
1001 | 1001 | In addition, the reason for the transaction opening will be in |
|
1002 | 1002 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1003 | 1003 | ``HG_TXNID``. |
|
1004 | 1004 | |
|
1005 | 1005 | ``pretxnclose-phase`` |
|
1006 | 1006 | Run right before a phase change is actually finalized. Any repository change |
|
1007 | 1007 | will be visible to the hook program. This lets you validate the transaction |
|
1008 | 1008 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1009 | 1009 | status will cause the transaction to be rolled back. The hook is called |
|
1010 | 1010 | multiple times, once for each revision affected by a phase change. |
|
1011 | 1011 | The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE`` |
|
1012 | 1012 | while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE`` |
|
1013 | 1013 | will be empty. In addition, the reason for the transaction opening will be in |
|
1014 | 1014 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1015 | 1015 | ``HG_TXNID``. The hook is also run for newly added revisions. In this case |
|
1016 | 1016 | the ``$HG_OLDPHASE`` entry will be empty. |
|
1017 | 1017 | |
|
1018 | 1018 | ``txnclose`` |
|
1019 | 1019 | Run after any repository transaction has been committed. At this |
|
1020 | 1020 | point, the transaction can no longer be rolled back. The hook will run |
|
1021 | 1021 | after the lock is released. See :hg:`help config.hooks.pretxnclose` for |
|
1022 | 1022 | details about available variables. |
|
1023 | 1023 | |
|
1024 | 1024 | ``txnclose-bookmark`` |
|
1025 | 1025 | Run after any bookmark change has been committed. At this point, the |
|
1026 | 1026 | transaction can no longer be rolled back. The hook will run after the lock |
|
1027 | 1027 | is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details |
|
1028 | 1028 | about available variables. |
|
1029 | 1029 | |
|
1030 | 1030 | ``txnclose-phase`` |
|
1031 | 1031 | Run after any phase change has been committed. At this point, the |
|
1032 | 1032 | transaction can no longer be rolled back. The hook will run after the lock |
|
1033 | 1033 | is released. See :hg:`help config.hooks.pretxnclose-phase` for details about |
|
1034 | 1034 | available variables. |
|
1035 | 1035 | |
|
1036 | 1036 | ``txnabort`` |
|
1037 | 1037 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` |
|
1038 | 1038 | for details about available variables. |
|
1039 | 1039 | |
|
1040 | 1040 | ``pretxnchangegroup`` |
|
1041 | 1041 | Run after a changegroup has been added via push, pull or unbundle, but before |
|
1042 | 1042 | the transaction has been committed. The changegroup is visible to the hook |
|
1043 | 1043 | program. This allows validation of incoming changes before accepting them. |
|
1044 | 1044 | The ID of the first new changeset is in ``$HG_NODE`` and last is in |
|
1045 | 1045 | ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero |
|
1046 | 1046 | status will cause the transaction to be rolled back, and the push, pull or |
|
1047 | 1047 | unbundle will fail. The URL that was the source of changes is in ``$HG_URL``. |
|
1048 | 1048 | |
|
1049 | 1049 | ``pretxncommit`` |
|
1050 | 1050 | Run after a changeset has been created, but before the transaction is |
|
1051 | 1051 | committed. The changeset is visible to the hook program. This allows |
|
1052 | 1052 | validation of the commit message and changes. Exit status 0 allows the |
|
1053 | 1053 | commit to proceed. A non-zero status will cause the transaction to |
|
1054 | 1054 | be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent |
|
1055 | 1055 | changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1056 | 1056 | |
|
1057 | 1057 | ``preupdate`` |
|
1058 | 1058 | Run before updating the working directory. Exit status 0 allows |
|
1059 | 1059 | the update to proceed. A non-zero status will prevent the update. |
|
1060 | 1060 | The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a |
|
1061 | 1061 | merge, the ID of second new parent is in ``$HG_PARENT2``. |
|
1062 | 1062 | |
|
1063 | 1063 | ``listkeys`` |
|
1064 | 1064 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
1065 | 1065 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
1066 | 1066 | dictionary containing the keys and values. |
|
1067 | 1067 | |
|
1068 | 1068 | ``pushkey`` |
|
1069 | 1069 | Run after a pushkey (like a bookmark) is added to the |
|
1070 | 1070 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
1071 | 1071 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
1072 | 1072 | value is in ``$HG_NEW``. |
|
1073 | 1073 | |
|
1074 | 1074 | ``tag`` |
|
1075 | 1075 | Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``. |
|
1076 | 1076 | The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in |
|
1077 | 1077 | the repository if ``$HG_LOCAL=0``. |
|
1078 | 1078 | |
|
1079 | 1079 | ``update`` |
|
1080 | 1080 | Run after updating the working directory. The changeset ID of first |
|
1081 | 1081 | new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new |
|
1082 | 1082 | parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
1083 | 1083 | update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``. |
|
1084 | 1084 | |
|
1085 | 1085 | .. note:: |
|
1086 | 1086 | |
|
1087 | 1087 | It is generally better to use standard hooks rather than the |
|
1088 | 1088 | generic pre- and post- command hooks, as they are guaranteed to be |
|
1089 | 1089 | called in the appropriate contexts for influencing transactions. |
|
1090 | 1090 | Also, hooks like "commit" will be called in all contexts that |
|
1091 | 1091 | generate a commit (e.g. tag) and not just the commit command. |
|
1092 | 1092 | |
|
1093 | 1093 | .. note:: |
|
1094 | 1094 | |
|
1095 | 1095 | Environment variables with empty values may not be passed to |
|
1096 | 1096 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
1097 | 1097 | will have an empty value under Unix-like platforms for non-merge |
|
1098 | 1098 | changesets, while it will not be available at all under Windows. |
|
1099 | 1099 | |
|
1100 | 1100 | The syntax for Python hooks is as follows:: |
|
1101 | 1101 | |
|
1102 | 1102 | hookname = python:modulename.submodule.callable |
|
1103 | 1103 | hookname = python:/path/to/python/module.py:callable |
|
1104 | 1104 | |
|
1105 | 1105 | Python hooks are run within the Mercurial process. Each hook is |
|
1106 | 1106 | called with at least three keyword arguments: a ui object (keyword |
|
1107 | 1107 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
1108 | 1108 | keyword that tells what kind of hook is used. Arguments listed as |
|
1109 | 1109 | environment variables above are passed as keyword arguments, with no |
|
1110 | 1110 | ``HG_`` prefix, and names in lower case. |
|
1111 | 1111 | |
|
1112 | 1112 | If a Python hook returns a "true" value or raises an exception, this |
|
1113 | 1113 | is treated as a failure. |
|
1114 | 1114 | |
|
1115 | 1115 | |
|
1116 | 1116 | ``hostfingerprints`` |
|
1117 | 1117 | -------------------- |
|
1118 | 1118 | |
|
1119 | 1119 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) |
|
1120 | 1120 | |
|
1121 | 1121 | Fingerprints of the certificates of known HTTPS servers. |
|
1122 | 1122 | |
|
1123 | 1123 | A HTTPS connection to a server with a fingerprint configured here will |
|
1124 | 1124 | only succeed if the servers certificate matches the fingerprint. |
|
1125 | 1125 | This is very similar to how ssh known hosts works. |
|
1126 | 1126 | |
|
1127 | 1127 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
1128 | 1128 | Multiple values can be specified (separated by spaces or commas). This can |
|
1129 | 1129 | be used to define both old and new fingerprints while a host transitions |
|
1130 | 1130 | to a new certificate. |
|
1131 | 1131 | |
|
1132 | 1132 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
1133 | 1133 | |
|
1134 | 1134 | For example:: |
|
1135 | 1135 | |
|
1136 | 1136 | [hostfingerprints] |
|
1137 | 1137 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1138 | 1138 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1139 | 1139 | |
|
1140 | 1140 | ``hostsecurity`` |
|
1141 | 1141 | ---------------- |
|
1142 | 1142 | |
|
1143 | 1143 | Used to specify global and per-host security settings for connecting to |
|
1144 | 1144 | other machines. |
|
1145 | 1145 | |
|
1146 | 1146 | The following options control default behavior for all hosts. |
|
1147 | 1147 | |
|
1148 | 1148 | ``ciphers`` |
|
1149 | 1149 | Defines the cryptographic ciphers to use for connections. |
|
1150 | 1150 | |
|
1151 | 1151 | Value must be a valid OpenSSL Cipher List Format as documented at |
|
1152 | 1152 | https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT. |
|
1153 | 1153 | |
|
1154 | 1154 | This setting is for advanced users only. Setting to incorrect values |
|
1155 | 1155 | can significantly lower connection security or decrease performance. |
|
1156 | 1156 | You have been warned. |
|
1157 | 1157 | |
|
1158 | 1158 | This option requires Python 2.7. |
|
1159 | 1159 | |
|
1160 | 1160 | ``minimumprotocol`` |
|
1161 | 1161 | Defines the minimum channel encryption protocol to use. |
|
1162 | 1162 | |
|
1163 | 1163 | By default, the highest version of TLS supported by both client and server |
|
1164 | 1164 | is used. |
|
1165 | 1165 | |
|
1166 | 1166 | Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``. |
|
1167 | 1167 | |
|
1168 | 1168 | When running on an old Python version, only ``tls1.0`` is allowed since |
|
1169 | 1169 | old versions of Python only support up to TLS 1.0. |
|
1170 | 1170 | |
|
1171 | 1171 | When running a Python that supports modern TLS versions, the default is |
|
1172 | 1172 | ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this |
|
1173 | 1173 | weakens security and should only be used as a feature of last resort if |
|
1174 | 1174 | a server does not support TLS 1.1+. |
|
1175 | 1175 | |
|
1176 | 1176 | Options in the ``[hostsecurity]`` section can have the form |
|
1177 | 1177 | ``hostname``:``setting``. This allows multiple settings to be defined on a |
|
1178 | 1178 | per-host basis. |
|
1179 | 1179 | |
|
1180 | 1180 | The following per-host settings can be defined. |
|
1181 | 1181 | |
|
1182 | 1182 | ``ciphers`` |
|
1183 | 1183 | This behaves like ``ciphers`` as described above except it only applies |
|
1184 | 1184 | to the host on which it is defined. |
|
1185 | 1185 | |
|
1186 | 1186 | ``fingerprints`` |
|
1187 | 1187 | A list of hashes of the DER encoded peer/remote certificate. Values have |
|
1188 | 1188 | the form ``algorithm``:``fingerprint``. e.g. |
|
1189 | 1189 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. |
|
1190 | 1190 | In addition, colons (``:``) can appear in the fingerprint part. |
|
1191 | 1191 | |
|
1192 | 1192 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, |
|
1193 | 1193 | ``sha512``. |
|
1194 | 1194 | |
|
1195 | 1195 | Use of ``sha256`` or ``sha512`` is preferred. |
|
1196 | 1196 | |
|
1197 | 1197 | If a fingerprint is specified, the CA chain is not validated for this |
|
1198 | 1198 | host and Mercurial will require the remote certificate to match one |
|
1199 | 1199 | of the fingerprints specified. This means if the server updates its |
|
1200 | 1200 | certificate, Mercurial will abort until a new fingerprint is defined. |
|
1201 | 1201 | This can provide stronger security than traditional CA-based validation |
|
1202 | 1202 | at the expense of convenience. |
|
1203 | 1203 | |
|
1204 | 1204 | This option takes precedence over ``verifycertsfile``. |
|
1205 | 1205 | |
|
1206 | 1206 | ``minimumprotocol`` |
|
1207 | 1207 | This behaves like ``minimumprotocol`` as described above except it |
|
1208 | 1208 | only applies to the host on which it is defined. |
|
1209 | 1209 | |
|
1210 | 1210 | ``verifycertsfile`` |
|
1211 | 1211 | Path to file a containing a list of PEM encoded certificates used to |
|
1212 | 1212 | verify the server certificate. Environment variables and ``~user`` |
|
1213 | 1213 | constructs are expanded in the filename. |
|
1214 | 1214 | |
|
1215 | 1215 | The server certificate or the certificate's certificate authority (CA) |
|
1216 | 1216 | must match a certificate from this file or certificate verification |
|
1217 | 1217 | will fail and connections to the server will be refused. |
|
1218 | 1218 | |
|
1219 | 1219 | If defined, only certificates provided by this file will be used: |
|
1220 | 1220 | ``web.cacerts`` and any system/default certificates will not be |
|
1221 | 1221 | used. |
|
1222 | 1222 | |
|
1223 | 1223 | This option has no effect if the per-host ``fingerprints`` option |
|
1224 | 1224 | is set. |
|
1225 | 1225 | |
|
1226 | 1226 | The format of the file is as follows:: |
|
1227 | 1227 | |
|
1228 | 1228 | -----BEGIN CERTIFICATE----- |
|
1229 | 1229 | ... (certificate in base64 PEM encoding) ... |
|
1230 | 1230 | -----END CERTIFICATE----- |
|
1231 | 1231 | -----BEGIN CERTIFICATE----- |
|
1232 | 1232 | ... (certificate in base64 PEM encoding) ... |
|
1233 | 1233 | -----END CERTIFICATE----- |
|
1234 | 1234 | |
|
1235 | 1235 | For example:: |
|
1236 | 1236 | |
|
1237 | 1237 | [hostsecurity] |
|
1238 | 1238 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 |
|
1239 | 1239 | hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1240 | 1240 | hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2 |
|
1241 | 1241 | foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem |
|
1242 | 1242 | |
|
1243 | 1243 | To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1 |
|
1244 | 1244 | when connecting to ``hg.example.com``:: |
|
1245 | 1245 | |
|
1246 | 1246 | [hostsecurity] |
|
1247 | 1247 | minimumprotocol = tls1.2 |
|
1248 | 1248 | hg.example.com:minimumprotocol = tls1.1 |
|
1249 | 1249 | |
|
1250 | 1250 | ``http_proxy`` |
|
1251 | 1251 | -------------- |
|
1252 | 1252 | |
|
1253 | 1253 | Used to access web-based Mercurial repositories through a HTTP |
|
1254 | 1254 | proxy. |
|
1255 | 1255 | |
|
1256 | 1256 | ``host`` |
|
1257 | 1257 | Host name and (optional) port of the proxy server, for example |
|
1258 | 1258 | "myproxy:8000". |
|
1259 | 1259 | |
|
1260 | 1260 | ``no`` |
|
1261 | 1261 | Optional. Comma-separated list of host names that should bypass |
|
1262 | 1262 | the proxy. |
|
1263 | 1263 | |
|
1264 | 1264 | ``passwd`` |
|
1265 | 1265 | Optional. Password to authenticate with at the proxy server. |
|
1266 | 1266 | |
|
1267 | 1267 | ``user`` |
|
1268 | 1268 | Optional. User name to authenticate with at the proxy server. |
|
1269 | 1269 | |
|
1270 | 1270 | ``always`` |
|
1271 | 1271 | Optional. Always use the proxy, even for localhost and any entries |
|
1272 | 1272 | in ``http_proxy.no``. (default: False) |
|
1273 | 1273 | |
|
1274 | 1274 | ``merge`` |
|
1275 | 1275 | --------- |
|
1276 | 1276 | |
|
1277 | 1277 | This section specifies behavior during merges and updates. |
|
1278 | 1278 | |
|
1279 | 1279 | ``checkignored`` |
|
1280 | 1280 | Controls behavior when an ignored file on disk has the same name as a tracked |
|
1281 | 1281 | file in the changeset being merged or updated to, and has different |
|
1282 | 1282 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, |
|
1283 | 1283 | abort on such files. With ``warn``, warn on such files and back them up as |
|
1284 | 1284 | ``.orig``. With ``ignore``, don't print a warning and back them up as |
|
1285 | 1285 | ``.orig``. (default: ``abort``) |
|
1286 | 1286 | |
|
1287 | 1287 | ``checkunknown`` |
|
1288 | 1288 | Controls behavior when an unknown file that isn't ignored has the same name |
|
1289 | 1289 | as a tracked file in the changeset being merged or updated to, and has |
|
1290 | 1290 | different contents. Similar to ``merge.checkignored``, except for files that |
|
1291 | 1291 | are not ignored. (default: ``abort``) |
|
1292 | 1292 | |
|
1293 | 1293 | ``on-failure`` |
|
1294 | 1294 | When set to ``continue`` (the default), the merge process attempts to |
|
1295 | 1295 | merge all unresolved files using the merge chosen tool, regardless of |
|
1296 | 1296 | whether previous file merge attempts during the process succeeded or not. |
|
1297 | 1297 | Setting this to ``prompt`` will prompt after any merge failure continue |
|
1298 | 1298 | or halt the merge process. Setting this to ``halt`` will automatically |
|
1299 | 1299 | halt the merge process on any merge tool failure. The merge process |
|
1300 | 1300 | can be restarted by using the ``resolve`` command. When a merge is |
|
1301 | 1301 | halted, the repository is left in a normal ``unresolved`` merge state. |
|
1302 | 1302 | (default: ``continue``) |
|
1303 | 1303 | |
|
1304 | 1304 | ``merge-patterns`` |
|
1305 | 1305 | ------------------ |
|
1306 | 1306 | |
|
1307 | 1307 | This section specifies merge tools to associate with particular file |
|
1308 | 1308 | patterns. Tools matched here will take precedence over the default |
|
1309 | 1309 | merge tool. Patterns are globs by default, rooted at the repository |
|
1310 | 1310 | root. |
|
1311 | 1311 | |
|
1312 | 1312 | Example:: |
|
1313 | 1313 | |
|
1314 | 1314 | [merge-patterns] |
|
1315 | 1315 | **.c = kdiff3 |
|
1316 | 1316 | **.jpg = myimgmerge |
|
1317 | 1317 | |
|
1318 | 1318 | ``merge-tools`` |
|
1319 | 1319 | --------------- |
|
1320 | 1320 | |
|
1321 | 1321 | This section configures external merge tools to use for file-level |
|
1322 | 1322 | merges. This section has likely been preconfigured at install time. |
|
1323 | 1323 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1324 | 1324 | Also see :hg:`help merge-tools` for more details. |
|
1325 | 1325 | |
|
1326 | 1326 | Example ``~/.hgrc``:: |
|
1327 | 1327 | |
|
1328 | 1328 | [merge-tools] |
|
1329 | 1329 | # Override stock tool location |
|
1330 | 1330 | kdiff3.executable = ~/bin/kdiff3 |
|
1331 | 1331 | # Specify command line |
|
1332 | 1332 | kdiff3.args = $base $local $other -o $output |
|
1333 | 1333 | # Give higher priority |
|
1334 | 1334 | kdiff3.priority = 1 |
|
1335 | 1335 | |
|
1336 | 1336 | # Changing the priority of preconfigured tool |
|
1337 | 1337 | meld.priority = 0 |
|
1338 | 1338 | |
|
1339 | 1339 | # Disable a preconfigured tool |
|
1340 | 1340 | vimdiff.disabled = yes |
|
1341 | 1341 | |
|
1342 | 1342 | # Define new tool |
|
1343 | 1343 | myHtmlTool.args = -m $local $other $base $output |
|
1344 | 1344 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1345 | 1345 | myHtmlTool.priority = 1 |
|
1346 | 1346 | |
|
1347 | 1347 | Supported arguments: |
|
1348 | 1348 | |
|
1349 | 1349 | ``priority`` |
|
1350 | 1350 | The priority in which to evaluate this tool. |
|
1351 | 1351 | (default: 0) |
|
1352 | 1352 | |
|
1353 | 1353 | ``executable`` |
|
1354 | 1354 | Either just the name of the executable or its pathname. |
|
1355 | 1355 | |
|
1356 | 1356 | .. container:: windows |
|
1357 | 1357 | |
|
1358 | 1358 | On Windows, the path can use environment variables with ${ProgramFiles} |
|
1359 | 1359 | syntax. |
|
1360 | 1360 | |
|
1361 | 1361 | (default: the tool name) |
|
1362 | 1362 | |
|
1363 | 1363 | ``args`` |
|
1364 | 1364 | The arguments to pass to the tool executable. You can refer to the |
|
1365 | 1365 | files being merged as well as the output file through these |
|
1366 | 1366 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning |
|
1367 | 1367 | of ``$local`` and ``$other`` can vary depending on which action is being |
|
1368 | 1368 | performed. During and update or merge, ``$local`` represents the original |
|
1369 | 1369 | state of the file, while ``$other`` represents the commit you are updating |
|
1370 | 1370 | to or the commit you are merging with. During a rebase ``$local`` |
|
1371 | 1371 | represents the destination of the rebase, and ``$other`` represents the |
|
1372 | 1372 | commit being rebased. |
|
1373 | 1373 | (default: ``$local $base $other``) |
|
1374 | 1374 | |
|
1375 | 1375 | ``premerge`` |
|
1376 | 1376 | Attempt to run internal non-interactive 3-way merge tool before |
|
1377 | 1377 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
1378 | 1378 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1379 | 1379 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1380 | 1380 | about the base of the merge in the marker (see internal :merge3 in |
|
1381 | 1381 | :hg:`help merge-tools`). |
|
1382 | 1382 | (default: True) |
|
1383 | 1383 | |
|
1384 | 1384 | ``binary`` |
|
1385 | 1385 | This tool can merge binary files. (default: False, unless tool |
|
1386 | 1386 | was selected by file pattern match) |
|
1387 | 1387 | |
|
1388 | 1388 | ``symlink`` |
|
1389 | 1389 | This tool can merge symlinks. (default: False) |
|
1390 | 1390 | |
|
1391 | 1391 | ``check`` |
|
1392 | 1392 | A list of merge success-checking options: |
|
1393 | 1393 | |
|
1394 | 1394 | ``changed`` |
|
1395 | 1395 | Ask whether merge was successful when the merged file shows no changes. |
|
1396 | 1396 | ``conflicts`` |
|
1397 | 1397 | Check whether there are conflicts even though the tool reported success. |
|
1398 | 1398 | ``prompt`` |
|
1399 | 1399 | Always prompt for merge success, regardless of success reported by tool. |
|
1400 | 1400 | |
|
1401 | 1401 | ``fixeol`` |
|
1402 | 1402 | Attempt to fix up EOL changes caused by the merge tool. |
|
1403 | 1403 | (default: False) |
|
1404 | 1404 | |
|
1405 | 1405 | ``gui`` |
|
1406 | 1406 | This tool requires a graphical interface to run. (default: False) |
|
1407 | 1407 | |
|
1408 | 1408 | .. container:: windows |
|
1409 | 1409 | |
|
1410 | 1410 | ``regkey`` |
|
1411 | 1411 | Windows registry key which describes install location of this |
|
1412 | 1412 | tool. Mercurial will search for this key first under |
|
1413 | 1413 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1414 | 1414 | (default: None) |
|
1415 | 1415 | |
|
1416 | 1416 | ``regkeyalt`` |
|
1417 | 1417 | An alternate Windows registry key to try if the first key is not |
|
1418 | 1418 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1419 | 1419 | semantics of the primary key. The most common use for this key |
|
1420 | 1420 | is to search for 32bit applications on 64bit operating systems. |
|
1421 | 1421 | (default: None) |
|
1422 | 1422 | |
|
1423 | 1423 | ``regname`` |
|
1424 | 1424 | Name of value to read from specified registry key. |
|
1425 | 1425 | (default: the unnamed (default) value) |
|
1426 | 1426 | |
|
1427 | 1427 | ``regappend`` |
|
1428 | 1428 | String to append to the value read from the registry, typically |
|
1429 | 1429 | the executable name of the tool. |
|
1430 | 1430 | (default: None) |
|
1431 | 1431 | |
|
1432 | 1432 | ``pager`` |
|
1433 | 1433 | --------- |
|
1434 | 1434 | |
|
1435 | 1435 | Setting used to control when to paginate and with what external tool. See |
|
1436 | 1436 | :hg:`help pager` for details. |
|
1437 | 1437 | |
|
1438 | 1438 | ``pager`` |
|
1439 | 1439 | Define the external tool used as pager. |
|
1440 | 1440 | |
|
1441 | 1441 | If no pager is set, Mercurial uses the environment variable $PAGER. |
|
1442 | 1442 | If neither pager.pager, nor $PAGER is set, a default pager will be |
|
1443 | 1443 | used, typically `less` on Unix and `more` on Windows. Example:: |
|
1444 | 1444 | |
|
1445 | 1445 | [pager] |
|
1446 | 1446 | pager = less -FRX |
|
1447 | 1447 | |
|
1448 | 1448 | ``ignore`` |
|
1449 | 1449 | List of commands to disable the pager for. Example:: |
|
1450 | 1450 | |
|
1451 | 1451 | [pager] |
|
1452 | 1452 | ignore = version, help, update |
|
1453 | 1453 | |
|
1454 | 1454 | ``patch`` |
|
1455 | 1455 | --------- |
|
1456 | 1456 | |
|
1457 | 1457 | Settings used when applying patches, for instance through the 'import' |
|
1458 | 1458 | command or with Mercurial Queues extension. |
|
1459 | 1459 | |
|
1460 | 1460 | ``eol`` |
|
1461 | 1461 | When set to 'strict' patch content and patched files end of lines |
|
1462 | 1462 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1463 | 1463 | lines are ignored when patching and the result line endings are |
|
1464 | 1464 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1465 | 1465 | ``auto``, end of lines are again ignored while patching but line |
|
1466 | 1466 | endings in patched files are normalized to their original setting |
|
1467 | 1467 | on a per-file basis. If target file does not exist or has no end |
|
1468 | 1468 | of line, patch line endings are preserved. |
|
1469 | 1469 | (default: strict) |
|
1470 | 1470 | |
|
1471 | 1471 | ``fuzz`` |
|
1472 | 1472 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1473 | 1473 | controls how much context the patcher is allowed to ignore when |
|
1474 | 1474 | trying to apply a patch. |
|
1475 | 1475 | (default: 2) |
|
1476 | 1476 | |
|
1477 | 1477 | ``paths`` |
|
1478 | 1478 | --------- |
|
1479 | 1479 | |
|
1480 | 1480 | Assigns symbolic names and behavior to repositories. |
|
1481 | 1481 | |
|
1482 | 1482 | Options are symbolic names defining the URL or directory that is the |
|
1483 | 1483 | location of the repository. Example:: |
|
1484 | 1484 | |
|
1485 | 1485 | [paths] |
|
1486 | 1486 | my_server = https://example.com/my_repo |
|
1487 | 1487 | local_path = /home/me/repo |
|
1488 | 1488 | |
|
1489 | 1489 | These symbolic names can be used from the command line. To pull |
|
1490 | 1490 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1491 | 1491 | :hg:`push local_path`. |
|
1492 | 1492 | |
|
1493 | 1493 | Options containing colons (``:``) denote sub-options that can influence |
|
1494 | 1494 | behavior for that specific path. Example:: |
|
1495 | 1495 | |
|
1496 | 1496 | [paths] |
|
1497 | 1497 | my_server = https://example.com/my_path |
|
1498 | 1498 | my_server:pushurl = ssh://example.com/my_path |
|
1499 | 1499 | |
|
1500 | 1500 | The following sub-options can be defined: |
|
1501 | 1501 | |
|
1502 | 1502 | ``pushurl`` |
|
1503 | 1503 | The URL to use for push operations. If not defined, the location |
|
1504 | 1504 | defined by the path's main entry is used. |
|
1505 | 1505 | |
|
1506 | 1506 | ``pushrev`` |
|
1507 | 1507 | A revset defining which revisions to push by default. |
|
1508 | 1508 | |
|
1509 | 1509 | When :hg:`push` is executed without a ``-r`` argument, the revset |
|
1510 | 1510 | defined by this sub-option is evaluated to determine what to push. |
|
1511 | 1511 | |
|
1512 | 1512 | For example, a value of ``.`` will push the working directory's |
|
1513 | 1513 | revision by default. |
|
1514 | 1514 | |
|
1515 | 1515 | Revsets specifying bookmarks will not result in the bookmark being |
|
1516 | 1516 | pushed. |
|
1517 | 1517 | |
|
1518 | 1518 | The following special named paths exist: |
|
1519 | 1519 | |
|
1520 | 1520 | ``default`` |
|
1521 | 1521 | The URL or directory to use when no source or remote is specified. |
|
1522 | 1522 | |
|
1523 | 1523 | :hg:`clone` will automatically define this path to the location the |
|
1524 | 1524 | repository was cloned from. |
|
1525 | 1525 | |
|
1526 | 1526 | ``default-push`` |
|
1527 | 1527 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1528 | 1528 | ``default:pushurl`` should be used instead. |
|
1529 | 1529 | |
|
1530 | 1530 | ``phases`` |
|
1531 | 1531 | ---------- |
|
1532 | 1532 | |
|
1533 | 1533 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1534 | 1534 | information about working with phases. |
|
1535 | 1535 | |
|
1536 | 1536 | ``publish`` |
|
1537 | 1537 | Controls draft phase behavior when working as a server. When true, |
|
1538 | 1538 | pushed changesets are set to public in both client and server and |
|
1539 | 1539 | pulled or cloned changesets are set to public in the client. |
|
1540 | 1540 | (default: True) |
|
1541 | 1541 | |
|
1542 | 1542 | ``new-commit`` |
|
1543 | 1543 | Phase of newly-created commits. |
|
1544 | 1544 | (default: draft) |
|
1545 | 1545 | |
|
1546 | 1546 | ``checksubrepos`` |
|
1547 | 1547 | Check the phase of the current revision of each subrepository. Allowed |
|
1548 | 1548 | values are "ignore", "follow" and "abort". For settings other than |
|
1549 | 1549 | "ignore", the phase of the current revision of each subrepository is |
|
1550 | 1550 | checked before committing the parent repository. If any of those phases is |
|
1551 | 1551 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1552 | 1552 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1553 | 1553 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1554 | 1554 | used for the parent repository commit (if set to "follow"). |
|
1555 | 1555 | (default: follow) |
|
1556 | 1556 | |
|
1557 | 1557 | |
|
1558 | 1558 | ``profiling`` |
|
1559 | 1559 | ------------- |
|
1560 | 1560 | |
|
1561 | 1561 | Specifies profiling type, format, and file output. Two profilers are |
|
1562 | 1562 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1563 | 1563 | profiler (named ``stat``). |
|
1564 | 1564 | |
|
1565 | 1565 | In this section description, 'profiling data' stands for the raw data |
|
1566 | 1566 | collected during profiling, while 'profiling report' stands for a |
|
1567 | 1567 | statistical text report generated from the profiling data. The |
|
1568 | 1568 | profiling is done using lsprof. |
|
1569 | 1569 | |
|
1570 | 1570 | ``enabled`` |
|
1571 | 1571 | Enable the profiler. |
|
1572 | 1572 | (default: false) |
|
1573 | 1573 | |
|
1574 | 1574 | This is equivalent to passing ``--profile`` on the command line. |
|
1575 | 1575 | |
|
1576 | 1576 | ``type`` |
|
1577 | 1577 | The type of profiler to use. |
|
1578 | 1578 | (default: stat) |
|
1579 | 1579 | |
|
1580 | 1580 | ``ls`` |
|
1581 | 1581 | Use Python's built-in instrumenting profiler. This profiler |
|
1582 | 1582 | works on all platforms, but each line number it reports is the |
|
1583 | 1583 | first line of a function. This restriction makes it difficult to |
|
1584 | 1584 | identify the expensive parts of a non-trivial function. |
|
1585 | 1585 | ``stat`` |
|
1586 | 1586 | Use a statistical profiler, statprof. This profiler is most |
|
1587 | 1587 | useful for profiling commands that run for longer than about 0.1 |
|
1588 | 1588 | seconds. |
|
1589 | 1589 | |
|
1590 | 1590 | ``format`` |
|
1591 | 1591 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1592 | 1592 | (default: text) |
|
1593 | 1593 | |
|
1594 | 1594 | ``text`` |
|
1595 | 1595 | Generate a profiling report. When saving to a file, it should be |
|
1596 | 1596 | noted that only the report is saved, and the profiling data is |
|
1597 | 1597 | not kept. |
|
1598 | 1598 | ``kcachegrind`` |
|
1599 | 1599 | Format profiling data for kcachegrind use: when saving to a |
|
1600 | 1600 | file, the generated file can directly be loaded into |
|
1601 | 1601 | kcachegrind. |
|
1602 | 1602 | |
|
1603 | 1603 | ``statformat`` |
|
1604 | 1604 | Profiling format for the ``stat`` profiler. |
|
1605 | 1605 | (default: hotpath) |
|
1606 | 1606 | |
|
1607 | 1607 | ``hotpath`` |
|
1608 | 1608 | Show a tree-based display containing the hot path of execution (where |
|
1609 | 1609 | most time was spent). |
|
1610 | 1610 | ``bymethod`` |
|
1611 | 1611 | Show a table of methods ordered by how frequently they are active. |
|
1612 | 1612 | ``byline`` |
|
1613 | 1613 | Show a table of lines in files ordered by how frequently they are active. |
|
1614 | 1614 | ``json`` |
|
1615 | 1615 | Render profiling data as JSON. |
|
1616 | 1616 | |
|
1617 | 1617 | ``frequency`` |
|
1618 | 1618 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1619 | 1619 | (default: 1000) |
|
1620 | 1620 | |
|
1621 | 1621 | ``output`` |
|
1622 | 1622 | File path where profiling data or report should be saved. If the |
|
1623 | 1623 | file exists, it is replaced. (default: None, data is printed on |
|
1624 | 1624 | stderr) |
|
1625 | 1625 | |
|
1626 | 1626 | ``sort`` |
|
1627 | 1627 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1628 | 1628 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1629 | 1629 | ``inlinetime``. |
|
1630 | 1630 | (default: inlinetime) |
|
1631 | 1631 | |
|
1632 | 1632 | ``limit`` |
|
1633 | 1633 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1634 | 1634 | (default: 30) |
|
1635 | 1635 | |
|
1636 | 1636 | ``nested`` |
|
1637 | 1637 | Show at most this number of lines of drill-down info after each main entry. |
|
1638 | 1638 | This can help explain the difference between Total and Inline. |
|
1639 | 1639 | Specific to the ``ls`` instrumenting profiler. |
|
1640 | 1640 | (default: 5) |
|
1641 | 1641 | |
|
1642 | 1642 | ``showmin`` |
|
1643 | 1643 | Minimum fraction of samples an entry must have for it to be displayed. |
|
1644 | 1644 | Can be specified as a float between ``0.0`` and ``1.0`` or can have a |
|
1645 | 1645 | ``%`` afterwards to allow values up to ``100``. e.g. ``5%``. |
|
1646 | 1646 | |
|
1647 | 1647 | Only used by the ``stat`` profiler. |
|
1648 | 1648 | |
|
1649 | 1649 | For the ``hotpath`` format, default is ``0.05``. |
|
1650 | 1650 | For the ``chrome`` format, default is ``0.005``. |
|
1651 | 1651 | |
|
1652 | 1652 | The option is unused on other formats. |
|
1653 | 1653 | |
|
1654 | 1654 | ``showmax`` |
|
1655 | 1655 | Maximum fraction of samples an entry can have before it is ignored in |
|
1656 | 1656 | display. Values format is the same as ``showmin``. |
|
1657 | 1657 | |
|
1658 | 1658 | Only used by the ``stat`` profiler. |
|
1659 | 1659 | |
|
1660 | 1660 | For the ``chrome`` format, default is ``0.999``. |
|
1661 | 1661 | |
|
1662 | 1662 | The option is unused on other formats. |
|
1663 | 1663 | |
|
1664 | 1664 | ``progress`` |
|
1665 | 1665 | ------------ |
|
1666 | 1666 | |
|
1667 | 1667 | Mercurial commands can draw progress bars that are as informative as |
|
1668 | 1668 | possible. Some progress bars only offer indeterminate information, while others |
|
1669 | 1669 | have a definite end point. |
|
1670 | 1670 | |
|
1671 | 1671 | ``delay`` |
|
1672 | 1672 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1673 | 1673 | |
|
1674 | 1674 | ``changedelay`` |
|
1675 | 1675 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1676 | 1676 | that value will be used instead. (default: 1) |
|
1677 | 1677 | |
|
1678 | 1678 | ``estimateinterval`` |
|
1679 | 1679 | Maximum sampling interval in seconds for speed and estimated time |
|
1680 | 1680 | calculation. (default: 60) |
|
1681 | 1681 | |
|
1682 | 1682 | ``refresh`` |
|
1683 | 1683 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1684 | 1684 | |
|
1685 | 1685 | ``format`` |
|
1686 | 1686 | Format of the progress bar. |
|
1687 | 1687 | |
|
1688 | 1688 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1689 | 1689 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the |
|
1690 | 1690 | last 20 characters of the item, but this can be changed by adding either |
|
1691 | 1691 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the |
|
1692 | 1692 | first num characters. |
|
1693 | 1693 | |
|
1694 | 1694 | (default: topic bar number estimate) |
|
1695 | 1695 | |
|
1696 | 1696 | ``width`` |
|
1697 | 1697 | If set, the maximum width of the progress information (that is, min(width, |
|
1698 | 1698 | term width) will be used). |
|
1699 | 1699 | |
|
1700 | 1700 | ``clear-complete`` |
|
1701 | 1701 | Clear the progress bar after it's done. (default: True) |
|
1702 | 1702 | |
|
1703 | 1703 | ``disable`` |
|
1704 | 1704 | If true, don't show a progress bar. |
|
1705 | 1705 | |
|
1706 | 1706 | ``assume-tty`` |
|
1707 | 1707 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1708 | 1708 | |
|
1709 | 1709 | ``rebase`` |
|
1710 | 1710 | ---------- |
|
1711 | 1711 | |
|
1712 | 1712 | ``evolution.allowdivergence`` |
|
1713 | 1713 | Default to False, when True allow creating divergence when performing |
|
1714 | 1714 | rebase of obsolete changesets. |
|
1715 | 1715 | |
|
1716 | 1716 | ``revsetalias`` |
|
1717 | 1717 | --------------- |
|
1718 | 1718 | |
|
1719 | 1719 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1720 | 1720 | |
|
1721 | 1721 | ``server`` |
|
1722 | 1722 | ---------- |
|
1723 | 1723 | |
|
1724 | 1724 | Controls generic server settings. |
|
1725 | 1725 | |
|
1726 | 1726 | ``compressionengines`` |
|
1727 | 1727 | List of compression engines and their relative priority to advertise |
|
1728 | 1728 | to clients. |
|
1729 | 1729 | |
|
1730 | 1730 | The order of compression engines determines their priority, the first |
|
1731 | 1731 | having the highest priority. If a compression engine is not listed |
|
1732 | 1732 | here, it won't be advertised to clients. |
|
1733 | 1733 | |
|
1734 | 1734 | If not set (the default), built-in defaults are used. Run |
|
1735 | 1735 | :hg:`debuginstall` to list available compression engines and their |
|
1736 | 1736 | default wire protocol priority. |
|
1737 | 1737 | |
|
1738 | 1738 | Older Mercurial clients only support zlib compression and this setting |
|
1739 | 1739 | has no effect for legacy clients. |
|
1740 | 1740 | |
|
1741 | 1741 | ``uncompressed`` |
|
1742 | 1742 | Whether to allow clients to clone a repository using the |
|
1743 | 1743 | uncompressed streaming protocol. This transfers about 40% more |
|
1744 | 1744 | data than a regular clone, but uses less memory and CPU on both |
|
1745 | 1745 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1746 | 1746 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1747 | 1747 | regular clone. Over most WAN connections (anything slower than |
|
1748 | 1748 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1749 | 1749 | extra data transfer overhead. This mode will also temporarily hold |
|
1750 | 1750 | the write lock while determining what data to transfer. |
|
1751 | 1751 | (default: True) |
|
1752 | 1752 | |
|
1753 | 1753 | ``uncompressedallowsecret`` |
|
1754 | 1754 | Whether to allow stream clones when the repository contains secret |
|
1755 | 1755 | changesets. (default: False) |
|
1756 | 1756 | |
|
1757 | 1757 | ``preferuncompressed`` |
|
1758 | 1758 | When set, clients will try to use the uncompressed streaming |
|
1759 | 1759 | protocol. (default: False) |
|
1760 | 1760 | |
|
1761 | 1761 | ``disablefullbundle`` |
|
1762 | 1762 | When set, servers will refuse attempts to do pull-based clones. |
|
1763 | 1763 | If this option is set, ``preferuncompressed`` and/or clone bundles |
|
1764 | 1764 | are highly recommended. Partial clones will still be allowed. |
|
1765 | 1765 | (default: False) |
|
1766 | 1766 | |
|
1767 | 1767 | ``concurrent-push-mode`` |
|
1768 | 1768 | Level of allowed race condition between two pushing clients. |
|
1769 | 1769 | |
|
1770 | 1770 | - 'strict': push is abort if another client touched the repository |
|
1771 | 1771 | while the push was preparing. (default) |
|
1772 | 1772 | - 'check-related': push is only aborted if it affects head that got also |
|
1773 | 1773 | affected while the push was preparing. |
|
1774 | 1774 | |
|
1775 | 1775 | This requires compatible client (version 4.3 and later). Old client will |
|
1776 | 1776 | use 'strict'. |
|
1777 | 1777 | |
|
1778 | 1778 | ``validate`` |
|
1779 | 1779 | Whether to validate the completeness of pushed changesets by |
|
1780 | 1780 | checking that all new file revisions specified in manifests are |
|
1781 | 1781 | present. (default: False) |
|
1782 | 1782 | |
|
1783 | 1783 | ``maxhttpheaderlen`` |
|
1784 | 1784 | Instruct HTTP clients not to send request headers longer than this |
|
1785 | 1785 | many bytes. (default: 1024) |
|
1786 | 1786 | |
|
1787 | 1787 | ``bundle1`` |
|
1788 | 1788 | Whether to allow clients to push and pull using the legacy bundle1 |
|
1789 | 1789 | exchange format. (default: True) |
|
1790 | 1790 | |
|
1791 | 1791 | ``bundle1gd`` |
|
1792 | 1792 | Like ``bundle1`` but only used if the repository is using the |
|
1793 | 1793 | *generaldelta* storage format. (default: True) |
|
1794 | 1794 | |
|
1795 | 1795 | ``bundle1.push`` |
|
1796 | 1796 | Whether to allow clients to push using the legacy bundle1 exchange |
|
1797 | 1797 | format. (default: True) |
|
1798 | 1798 | |
|
1799 | 1799 | ``bundle1gd.push`` |
|
1800 | 1800 | Like ``bundle1.push`` but only used if the repository is using the |
|
1801 | 1801 | *generaldelta* storage format. (default: True) |
|
1802 | 1802 | |
|
1803 | 1803 | ``bundle1.pull`` |
|
1804 | 1804 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
1805 | 1805 | format. (default: True) |
|
1806 | 1806 | |
|
1807 | 1807 | ``bundle1gd.pull`` |
|
1808 | 1808 | Like ``bundle1.pull`` but only used if the repository is using the |
|
1809 | 1809 | *generaldelta* storage format. (default: True) |
|
1810 | 1810 | |
|
1811 | 1811 | Large repositories using the *generaldelta* storage format should |
|
1812 | 1812 | consider setting this option because converting *generaldelta* |
|
1813 | 1813 | repositories to the exchange format required by the bundle1 data |
|
1814 | 1814 | format can consume a lot of CPU. |
|
1815 | 1815 | |
|
1816 | 1816 | ``zliblevel`` |
|
1817 | 1817 | Integer between ``-1`` and ``9`` that controls the zlib compression level |
|
1818 | 1818 | for wire protocol commands that send zlib compressed output (notably the |
|
1819 | 1819 | commands that send repository history data). |
|
1820 | 1820 | |
|
1821 | 1821 | The default (``-1``) uses the default zlib compression level, which is |
|
1822 | 1822 | likely equivalent to ``6``. ``0`` means no compression. ``9`` means |
|
1823 | 1823 | maximum compression. |
|
1824 | 1824 | |
|
1825 | 1825 | Setting this option allows server operators to make trade-offs between |
|
1826 | 1826 | bandwidth and CPU used. Lowering the compression lowers CPU utilization |
|
1827 | 1827 | but sends more bytes to clients. |
|
1828 | 1828 | |
|
1829 | 1829 | This option only impacts the HTTP server. |
|
1830 | 1830 | |
|
1831 | 1831 | ``zstdlevel`` |
|
1832 | 1832 | Integer between ``1`` and ``22`` that controls the zstd compression level |
|
1833 | 1833 | for wire protocol commands. ``1`` is the minimal amount of compression and |
|
1834 | 1834 | ``22`` is the highest amount of compression. |
|
1835 | 1835 | |
|
1836 | 1836 | The default (``3``) should be significantly faster than zlib while likely |
|
1837 | 1837 | delivering better compression ratios. |
|
1838 | 1838 | |
|
1839 | 1839 | This option only impacts the HTTP server. |
|
1840 | 1840 | |
|
1841 | 1841 | See also ``server.zliblevel``. |
|
1842 | 1842 | |
|
1843 | 1843 | ``smtp`` |
|
1844 | 1844 | -------- |
|
1845 | 1845 | |
|
1846 | 1846 | Configuration for extensions that need to send email messages. |
|
1847 | 1847 | |
|
1848 | 1848 | ``host`` |
|
1849 | 1849 | Host name of mail server, e.g. "mail.example.com". |
|
1850 | 1850 | |
|
1851 | 1851 | ``port`` |
|
1852 | 1852 | Optional. Port to connect to on mail server. (default: 465 if |
|
1853 | 1853 | ``tls`` is smtps; 25 otherwise) |
|
1854 | 1854 | |
|
1855 | 1855 | ``tls`` |
|
1856 | 1856 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1857 | 1857 | smtps or none. (default: none) |
|
1858 | 1858 | |
|
1859 | 1859 | ``username`` |
|
1860 | 1860 | Optional. User name for authenticating with the SMTP server. |
|
1861 | 1861 | (default: None) |
|
1862 | 1862 | |
|
1863 | 1863 | ``password`` |
|
1864 | 1864 | Optional. Password for authenticating with the SMTP server. If not |
|
1865 | 1865 | specified, interactive sessions will prompt the user for a |
|
1866 | 1866 | password; non-interactive sessions will fail. (default: None) |
|
1867 | 1867 | |
|
1868 | 1868 | ``local_hostname`` |
|
1869 | 1869 | Optional. The hostname that the sender can use to identify |
|
1870 | 1870 | itself to the MTA. |
|
1871 | 1871 | |
|
1872 | 1872 | |
|
1873 | 1873 | ``subpaths`` |
|
1874 | 1874 | ------------ |
|
1875 | 1875 | |
|
1876 | 1876 | Subrepository source URLs can go stale if a remote server changes name |
|
1877 | 1877 | or becomes temporarily unavailable. This section lets you define |
|
1878 | 1878 | rewrite rules of the form:: |
|
1879 | 1879 | |
|
1880 | 1880 | <pattern> = <replacement> |
|
1881 | 1881 | |
|
1882 | 1882 | where ``pattern`` is a regular expression matching a subrepository |
|
1883 | 1883 | source URL and ``replacement`` is the replacement string used to |
|
1884 | 1884 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1885 | 1885 | ``replacements``. For instance:: |
|
1886 | 1886 | |
|
1887 | 1887 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1888 | 1888 | |
|
1889 | 1889 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1890 | 1890 | |
|
1891 | 1891 | Relative subrepository paths are first made absolute, and the |
|
1892 | 1892 | rewrite rules are then applied on the full (absolute) path. If ``pattern`` |
|
1893 | 1893 | doesn't match the full path, an attempt is made to apply it on the |
|
1894 | 1894 | relative path alone. The rules are applied in definition order. |
|
1895 | 1895 | |
|
1896 | ``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 | 1937 | ``templatealias`` |
|
1897 | 1938 | ----------------- |
|
1898 | 1939 | |
|
1899 | 1940 | Alias definitions for templates. See :hg:`help templates` for details. |
|
1900 | 1941 | |
|
1901 | 1942 | ``templates`` |
|
1902 | 1943 | ------------- |
|
1903 | 1944 | |
|
1904 | 1945 | Use the ``[templates]`` section to define template strings. |
|
1905 | 1946 | See :hg:`help templates` for details. |
|
1906 | 1947 | |
|
1907 | 1948 | ``trusted`` |
|
1908 | 1949 | ----------- |
|
1909 | 1950 | |
|
1910 | 1951 | Mercurial will not use the settings in the |
|
1911 | 1952 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1912 | 1953 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1913 | 1954 | commands to be run. This issue is often encountered when configuring |
|
1914 | 1955 | hooks or extensions for shared repositories or servers. However, |
|
1915 | 1956 | the web interface will use some safe settings from the ``[web]`` |
|
1916 | 1957 | section. |
|
1917 | 1958 | |
|
1918 | 1959 | This section specifies what users and groups are trusted. The |
|
1919 | 1960 | current user is always trusted. To trust everybody, list a user or a |
|
1920 | 1961 | group with name ``*``. These settings must be placed in an |
|
1921 | 1962 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1922 | 1963 | user or service running Mercurial. |
|
1923 | 1964 | |
|
1924 | 1965 | ``users`` |
|
1925 | 1966 | Comma-separated list of trusted users. |
|
1926 | 1967 | |
|
1927 | 1968 | ``groups`` |
|
1928 | 1969 | Comma-separated list of trusted groups. |
|
1929 | 1970 | |
|
1930 | 1971 | |
|
1931 | 1972 | ``ui`` |
|
1932 | 1973 | ------ |
|
1933 | 1974 | |
|
1934 | 1975 | User interface controls. |
|
1935 | 1976 | |
|
1936 | 1977 | ``archivemeta`` |
|
1937 | 1978 | Whether to include the .hg_archival.txt file containing meta data |
|
1938 | 1979 | (hashes for the repository base and for tip) in archives created |
|
1939 | 1980 | by the :hg:`archive` command or downloaded via hgweb. |
|
1940 | 1981 | (default: True) |
|
1941 | 1982 | |
|
1942 | 1983 | ``askusername`` |
|
1943 | 1984 | Whether to prompt for a username when committing. If True, and |
|
1944 | 1985 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1945 | 1986 | be prompted to enter a username. If no username is entered, the |
|
1946 | 1987 | default ``USER@HOST`` is used instead. |
|
1947 | 1988 | (default: False) |
|
1948 | 1989 | |
|
1949 | 1990 | ``clonebundles`` |
|
1950 | 1991 | Whether the "clone bundles" feature is enabled. |
|
1951 | 1992 | |
|
1952 | 1993 | When enabled, :hg:`clone` may download and apply a server-advertised |
|
1953 | 1994 | bundle file from a URL instead of using the normal exchange mechanism. |
|
1954 | 1995 | |
|
1955 | 1996 | This can likely result in faster and more reliable clones. |
|
1956 | 1997 | |
|
1957 | 1998 | (default: True) |
|
1958 | 1999 | |
|
1959 | 2000 | ``clonebundlefallback`` |
|
1960 | 2001 | Whether failure to apply an advertised "clone bundle" from a server |
|
1961 | 2002 | should result in fallback to a regular clone. |
|
1962 | 2003 | |
|
1963 | 2004 | This is disabled by default because servers advertising "clone |
|
1964 | 2005 | bundles" often do so to reduce server load. If advertised bundles |
|
1965 | 2006 | start mass failing and clients automatically fall back to a regular |
|
1966 | 2007 | clone, this would add significant and unexpected load to the server |
|
1967 | 2008 | since the server is expecting clone operations to be offloaded to |
|
1968 | 2009 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
1969 | 2010 | clients don't overwhelm the server when "clone bundle" application |
|
1970 | 2011 | fails. |
|
1971 | 2012 | |
|
1972 | 2013 | (default: False) |
|
1973 | 2014 | |
|
1974 | 2015 | ``clonebundleprefers`` |
|
1975 | 2016 | Defines preferences for which "clone bundles" to use. |
|
1976 | 2017 | |
|
1977 | 2018 | Servers advertising "clone bundles" may advertise multiple available |
|
1978 | 2019 | bundles. Each bundle may have different attributes, such as the bundle |
|
1979 | 2020 | type and compression format. This option is used to prefer a particular |
|
1980 | 2021 | bundle over another. |
|
1981 | 2022 | |
|
1982 | 2023 | The following keys are defined by Mercurial: |
|
1983 | 2024 | |
|
1984 | 2025 | BUNDLESPEC |
|
1985 | 2026 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. |
|
1986 | 2027 | e.g. ``gzip-v2`` or ``bzip2-v1``. |
|
1987 | 2028 | |
|
1988 | 2029 | COMPRESSION |
|
1989 | 2030 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. |
|
1990 | 2031 | |
|
1991 | 2032 | Server operators may define custom keys. |
|
1992 | 2033 | |
|
1993 | 2034 | Example values: ``COMPRESSION=bzip2``, |
|
1994 | 2035 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. |
|
1995 | 2036 | |
|
1996 | 2037 | By default, the first bundle advertised by the server is used. |
|
1997 | 2038 | |
|
1998 | 2039 | ``color`` |
|
1999 | 2040 | When to colorize output. Possible value are Boolean ("yes" or "no"), or |
|
2000 | 2041 | "debug", or "always". (default: "yes"). "yes" will use color whenever it |
|
2001 | 2042 | seems possible. See :hg:`help color` for details. |
|
2002 | 2043 | |
|
2003 | 2044 | ``commitsubrepos`` |
|
2004 | 2045 | Whether to commit modified subrepositories when committing the |
|
2005 | 2046 | parent repository. If False and one subrepository has uncommitted |
|
2006 | 2047 | changes, abort the commit. |
|
2007 | 2048 | (default: False) |
|
2008 | 2049 | |
|
2009 | 2050 | ``debug`` |
|
2010 | 2051 | Print debugging information. (default: False) |
|
2011 | 2052 | |
|
2012 | 2053 | ``editor`` |
|
2013 | 2054 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
2014 | 2055 | |
|
2015 | 2056 | ``fallbackencoding`` |
|
2016 | 2057 | Encoding to try if it's not possible to decode the changelog using |
|
2017 | 2058 | UTF-8. (default: ISO-8859-1) |
|
2018 | 2059 | |
|
2019 | 2060 | ``graphnodetemplate`` |
|
2020 | 2061 | The template used to print changeset nodes in an ASCII revision graph. |
|
2021 | 2062 | (default: ``{graphnode}``) |
|
2022 | 2063 | |
|
2023 | 2064 | ``ignore`` |
|
2024 | 2065 | A file to read per-user ignore patterns from. This file should be |
|
2025 | 2066 | in the same format as a repository-wide .hgignore file. Filenames |
|
2026 | 2067 | are relative to the repository root. This option supports hook syntax, |
|
2027 | 2068 | so if you want to specify multiple ignore files, you can do so by |
|
2028 | 2069 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
2029 | 2070 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
2030 | 2071 | |
|
2031 | 2072 | ``interactive`` |
|
2032 | 2073 | Allow to prompt the user. (default: True) |
|
2033 | 2074 | |
|
2034 | 2075 | ``interface`` |
|
2035 | 2076 | Select the default interface for interactive features (default: text). |
|
2036 | 2077 | Possible values are 'text' and 'curses'. |
|
2037 | 2078 | |
|
2038 | 2079 | ``interface.chunkselector`` |
|
2039 | 2080 | Select the interface for change recording (e.g. :hg:`commit -i`). |
|
2040 | 2081 | Possible values are 'text' and 'curses'. |
|
2041 | 2082 | This config overrides the interface specified by ui.interface. |
|
2042 | 2083 | |
|
2043 | 2084 | ``logtemplate`` |
|
2044 | 2085 | Template string for commands that print changesets. |
|
2045 | 2086 | |
|
2046 | 2087 | ``merge`` |
|
2047 | 2088 | The conflict resolution program to use during a manual merge. |
|
2048 | 2089 | For more information on merge tools see :hg:`help merge-tools`. |
|
2049 | 2090 | For configuring merge tools see the ``[merge-tools]`` section. |
|
2050 | 2091 | |
|
2051 | 2092 | ``mergemarkers`` |
|
2052 | 2093 | Sets the merge conflict marker label styling. The ``detailed`` |
|
2053 | 2094 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
2054 | 2095 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
2055 | 2096 | One of ``basic`` or ``detailed``. |
|
2056 | 2097 | (default: ``basic``) |
|
2057 | 2098 | |
|
2058 | 2099 | ``mergemarkertemplate`` |
|
2059 | 2100 | The template used to print the commit description next to each conflict |
|
2060 | 2101 | marker during merge conflicts. See :hg:`help templates` for the template |
|
2061 | 2102 | format. |
|
2062 | 2103 | |
|
2063 | 2104 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
2064 | 2105 | the first line of the commit description. |
|
2065 | 2106 | |
|
2066 | 2107 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
2067 | 2108 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
2068 | 2109 | managed files. At template expansion, non-ASCII characters use the encoding |
|
2069 | 2110 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
2070 | 2111 | environment variables that govern your locale. If the encoding of the merge |
|
2071 | 2112 | markers is different from the encoding of the merged files, |
|
2072 | 2113 | serious problems may occur. |
|
2073 | 2114 | |
|
2074 | 2115 | ``origbackuppath`` |
|
2075 | 2116 | The path to a directory used to store generated .orig files. If the path is |
|
2076 | 2117 | not a directory, one will be created. If set, files stored in this |
|
2077 | 2118 | directory have the same name as the original file and do not have a .orig |
|
2078 | 2119 | suffix. |
|
2079 | 2120 | |
|
2080 | 2121 | ``paginate`` |
|
2081 | 2122 | Control the pagination of command output (default: True). See :hg:`help pager` |
|
2082 | 2123 | for details. |
|
2083 | 2124 | |
|
2084 | 2125 | ``patch`` |
|
2085 | 2126 | An optional external tool that ``hg import`` and some extensions |
|
2086 | 2127 | will use for applying patches. By default Mercurial uses an |
|
2087 | 2128 | internal patch utility. The external tool must work as the common |
|
2088 | 2129 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
2089 | 2130 | argument to strip patch headers, a ``-d`` argument to specify the |
|
2090 | 2131 | current directory, a file name to patch, and a patch file to take |
|
2091 | 2132 | from stdin. |
|
2092 | 2133 | |
|
2093 | 2134 | It is possible to specify a patch tool together with extra |
|
2094 | 2135 | arguments. For example, setting this option to ``patch --merge`` |
|
2095 | 2136 | will use the ``patch`` program with its 2-way merge option. |
|
2096 | 2137 | |
|
2097 | 2138 | ``portablefilenames`` |
|
2098 | 2139 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
2099 | 2140 | (default: ``warn``) |
|
2100 | 2141 | |
|
2101 | 2142 | ``warn`` |
|
2102 | 2143 | Print a warning message on POSIX platforms, if a file with a non-portable |
|
2103 | 2144 | filename is added (e.g. a file with a name that can't be created on |
|
2104 | 2145 | Windows because it contains reserved parts like ``AUX``, reserved |
|
2105 | 2146 | characters like ``:``, or would cause a case collision with an existing |
|
2106 | 2147 | file). |
|
2107 | 2148 | |
|
2108 | 2149 | ``ignore`` |
|
2109 | 2150 | Don't print a warning. |
|
2110 | 2151 | |
|
2111 | 2152 | ``abort`` |
|
2112 | 2153 | The command is aborted. |
|
2113 | 2154 | |
|
2114 | 2155 | ``true`` |
|
2115 | 2156 | Alias for ``warn``. |
|
2116 | 2157 | |
|
2117 | 2158 | ``false`` |
|
2118 | 2159 | Alias for ``ignore``. |
|
2119 | 2160 | |
|
2120 | 2161 | .. container:: windows |
|
2121 | 2162 | |
|
2122 | 2163 | On Windows, this configuration option is ignored and the command aborted. |
|
2123 | 2164 | |
|
2124 | 2165 | ``quiet`` |
|
2125 | 2166 | Reduce the amount of output printed. |
|
2126 | 2167 | (default: False) |
|
2127 | 2168 | |
|
2128 | 2169 | ``remotecmd`` |
|
2129 | 2170 | Remote command to use for clone/push/pull operations. |
|
2130 | 2171 | (default: ``hg``) |
|
2131 | 2172 | |
|
2132 | 2173 | ``report_untrusted`` |
|
2133 | 2174 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
2134 | 2175 | trusted user or group. |
|
2135 | 2176 | (default: True) |
|
2136 | 2177 | |
|
2137 | 2178 | ``slash`` |
|
2138 | 2179 | Display paths using a slash (``/``) as the path separator. This |
|
2139 | 2180 | only makes a difference on systems where the default path |
|
2140 | 2181 | separator is not the slash character (e.g. Windows uses the |
|
2141 | 2182 | backslash character (``\``)). |
|
2142 | 2183 | (default: False) |
|
2143 | 2184 | |
|
2144 | 2185 | ``statuscopies`` |
|
2145 | 2186 | Display copies in the status command. |
|
2146 | 2187 | |
|
2147 | 2188 | ``ssh`` |
|
2148 | 2189 | Command to use for SSH connections. (default: ``ssh``) |
|
2149 | 2190 | |
|
2150 | 2191 | ``strict`` |
|
2151 | 2192 | Require exact command names, instead of allowing unambiguous |
|
2152 | 2193 | abbreviations. (default: False) |
|
2153 | 2194 | |
|
2154 | 2195 | ``style`` |
|
2155 | 2196 | Name of style to use for command output. |
|
2156 | 2197 | |
|
2157 | 2198 | ``supportcontact`` |
|
2158 | 2199 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
2159 | 2200 | large organisation with its own Mercurial deployment process and crash |
|
2160 | 2201 | reports should be addressed to your internal support. |
|
2161 | 2202 | |
|
2162 | 2203 | ``textwidth`` |
|
2163 | 2204 | Maximum width of help text. A longer line generated by ``hg help`` or |
|
2164 | 2205 | ``hg subcommand --help`` will be broken after white space to get this |
|
2165 | 2206 | width or the terminal width, whichever comes first. |
|
2166 | 2207 | A non-positive value will disable this and the terminal width will be |
|
2167 | 2208 | used. (default: 78) |
|
2168 | 2209 | |
|
2169 | 2210 | ``timeout`` |
|
2170 | 2211 | The timeout used when a lock is held (in seconds), a negative value |
|
2171 | 2212 | means no timeout. (default: 600) |
|
2172 | 2213 | |
|
2173 | 2214 | ``traceback`` |
|
2174 | 2215 | Mercurial always prints a traceback when an unknown exception |
|
2175 | 2216 | occurs. Setting this to True will make Mercurial print a traceback |
|
2176 | 2217 | on all exceptions, even those recognized by Mercurial (such as |
|
2177 | 2218 | IOError or MemoryError). (default: False) |
|
2178 | 2219 | |
|
2179 | 2220 | ``tweakdefaults`` |
|
2180 | 2221 | |
|
2181 | 2222 | By default Mercurial's behavior changes very little from release |
|
2182 | 2223 | to release, but over time the recommended config settings |
|
2183 | 2224 | shift. Enable this config to opt in to get automatic tweaks to |
|
2184 | 2225 | Mercurial's behavior over time. This config setting will have no |
|
2185 | 2226 | effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does |
|
2186 | 2227 | not include ``tweakdefaults``. (default: False) |
|
2187 | 2228 | |
|
2188 | 2229 | ``username`` |
|
2189 | 2230 | The committer of a changeset created when running "commit". |
|
2190 | 2231 | Typically a person's name and email address, e.g. ``Fred Widget |
|
2191 | 2232 | <fred@example.com>``. Environment variables in the |
|
2192 | 2233 | username are expanded. |
|
2193 | 2234 | |
|
2194 | 2235 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
2195 | 2236 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
2196 | 2237 | system hgrc, it has to be specified manually or in a different |
|
2197 | 2238 | hgrc file) |
|
2198 | 2239 | |
|
2199 | 2240 | ``verbose`` |
|
2200 | 2241 | Increase the amount of output printed. (default: False) |
|
2201 | 2242 | |
|
2202 | 2243 | |
|
2203 | 2244 | ``web`` |
|
2204 | 2245 | ------- |
|
2205 | 2246 | |
|
2206 | 2247 | Web interface configuration. The settings in this section apply to |
|
2207 | 2248 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
2208 | 2249 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
2209 | 2250 | and WSGI). |
|
2210 | 2251 | |
|
2211 | 2252 | The Mercurial webserver does no authentication (it does not prompt for |
|
2212 | 2253 | usernames and passwords to validate *who* users are), but it does do |
|
2213 | 2254 | authorization (it grants or denies access for *authenticated users* |
|
2214 | 2255 | based on settings in this section). You must either configure your |
|
2215 | 2256 | webserver to do authentication for you, or disable the authorization |
|
2216 | 2257 | checks. |
|
2217 | 2258 | |
|
2218 | 2259 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
2219 | 2260 | you want it to accept pushes from anybody, you can use the following |
|
2220 | 2261 | command line:: |
|
2221 | 2262 | |
|
2222 | 2263 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
2223 | 2264 | |
|
2224 | 2265 | Note that this will allow anybody to push anything to the server and |
|
2225 | 2266 | that this should not be used for public servers. |
|
2226 | 2267 | |
|
2227 | 2268 | The full set of options is: |
|
2228 | 2269 | |
|
2229 | 2270 | ``accesslog`` |
|
2230 | 2271 | Where to output the access log. (default: stdout) |
|
2231 | 2272 | |
|
2232 | 2273 | ``address`` |
|
2233 | 2274 | Interface address to bind to. (default: all) |
|
2234 | 2275 | |
|
2235 | 2276 | ``allow_archive`` |
|
2236 | 2277 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
2237 | 2278 | (default: empty) |
|
2238 | 2279 | |
|
2239 | 2280 | ``allowbz2`` |
|
2240 | 2281 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
2241 | 2282 | revisions. |
|
2242 | 2283 | (default: False) |
|
2243 | 2284 | |
|
2244 | 2285 | ``allowgz`` |
|
2245 | 2286 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
2246 | 2287 | revisions. |
|
2247 | 2288 | (default: False) |
|
2248 | 2289 | |
|
2249 | 2290 | ``allowpull`` |
|
2250 | 2291 | Whether to allow pulling from the repository. (default: True) |
|
2251 | 2292 | |
|
2252 | 2293 | ``allow_push`` |
|
2253 | 2294 | Whether to allow pushing to the repository. If empty or not set, |
|
2254 | 2295 | pushing is not allowed. If the special value ``*``, any remote |
|
2255 | 2296 | user can push, including unauthenticated users. Otherwise, the |
|
2256 | 2297 | remote user must have been authenticated, and the authenticated |
|
2257 | 2298 | user name must be present in this list. The contents of the |
|
2258 | 2299 | allow_push list are examined after the deny_push list. |
|
2259 | 2300 | |
|
2260 | 2301 | ``allow_read`` |
|
2261 | 2302 | If the user has not already been denied repository access due to |
|
2262 | 2303 | the contents of deny_read, this list determines whether to grant |
|
2263 | 2304 | repository access to the user. If this list is not empty, and the |
|
2264 | 2305 | user is unauthenticated or not present in the list, then access is |
|
2265 | 2306 | denied for the user. If the list is empty or not set, then access |
|
2266 | 2307 | is permitted to all users by default. Setting allow_read to the |
|
2267 | 2308 | special value ``*`` is equivalent to it not being set (i.e. access |
|
2268 | 2309 | is permitted to all users). The contents of the allow_read list are |
|
2269 | 2310 | examined after the deny_read list. |
|
2270 | 2311 | |
|
2271 | 2312 | ``allowzip`` |
|
2272 | 2313 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
2273 | 2314 | revisions. This feature creates temporary files. |
|
2274 | 2315 | (default: False) |
|
2275 | 2316 | |
|
2276 | 2317 | ``archivesubrepos`` |
|
2277 | 2318 | Whether to recurse into subrepositories when archiving. |
|
2278 | 2319 | (default: False) |
|
2279 | 2320 | |
|
2280 | 2321 | ``baseurl`` |
|
2281 | 2322 | Base URL to use when publishing URLs in other locations, so |
|
2282 | 2323 | third-party tools like email notification hooks can construct |
|
2283 | 2324 | URLs. Example: ``http://hgserver/repos/``. |
|
2284 | 2325 | |
|
2285 | 2326 | ``cacerts`` |
|
2286 | 2327 | Path to file containing a list of PEM encoded certificate |
|
2287 | 2328 | authority certificates. Environment variables and ``~user`` |
|
2288 | 2329 | constructs are expanded in the filename. If specified on the |
|
2289 | 2330 | client, then it will verify the identity of remote HTTPS servers |
|
2290 | 2331 | with these certificates. |
|
2291 | 2332 | |
|
2292 | 2333 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
2293 | 2334 | command line. |
|
2294 | 2335 | |
|
2295 | 2336 | You can use OpenSSL's CA certificate file if your platform has |
|
2296 | 2337 | one. On most Linux systems this will be |
|
2297 | 2338 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
2298 | 2339 | generate this file manually. The form must be as follows:: |
|
2299 | 2340 | |
|
2300 | 2341 | -----BEGIN CERTIFICATE----- |
|
2301 | 2342 | ... (certificate in base64 PEM encoding) ... |
|
2302 | 2343 | -----END CERTIFICATE----- |
|
2303 | 2344 | -----BEGIN CERTIFICATE----- |
|
2304 | 2345 | ... (certificate in base64 PEM encoding) ... |
|
2305 | 2346 | -----END CERTIFICATE----- |
|
2306 | 2347 | |
|
2307 | 2348 | ``cache`` |
|
2308 | 2349 | Whether to support caching in hgweb. (default: True) |
|
2309 | 2350 | |
|
2310 | 2351 | ``certificate`` |
|
2311 | 2352 | Certificate to use when running :hg:`serve`. |
|
2312 | 2353 | |
|
2313 | 2354 | ``collapse`` |
|
2314 | 2355 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
2315 | 2356 | a single level alongside repositories in the current path. With |
|
2316 | 2357 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
2317 | 2358 | the current path are grouped behind navigable directory entries that |
|
2318 | 2359 | lead to the locations of these repositories. In effect, this setting |
|
2319 | 2360 | collapses each collection of repositories found within a subdirectory |
|
2320 | 2361 | into a single entry for that subdirectory. (default: False) |
|
2321 | 2362 | |
|
2322 | 2363 | ``comparisoncontext`` |
|
2323 | 2364 | Number of lines of context to show in side-by-side file comparison. If |
|
2324 | 2365 | negative or the value ``full``, whole files are shown. (default: 5) |
|
2325 | 2366 | |
|
2326 | 2367 | This setting can be overridden by a ``context`` request parameter to the |
|
2327 | 2368 | ``comparison`` command, taking the same values. |
|
2328 | 2369 | |
|
2329 | 2370 | ``contact`` |
|
2330 | 2371 | Name or email address of the person in charge of the repository. |
|
2331 | 2372 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
2332 | 2373 | |
|
2333 | 2374 | ``csp`` |
|
2334 | 2375 | Send a ``Content-Security-Policy`` HTTP header with this value. |
|
2335 | 2376 | |
|
2336 | 2377 | The value may contain a special string ``%nonce%``, which will be replaced |
|
2337 | 2378 | by a randomly-generated one-time use value. If the value contains |
|
2338 | 2379 | ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the |
|
2339 | 2380 | one-time property of the nonce. This nonce will also be inserted into |
|
2340 | 2381 | ``<script>`` elements containing inline JavaScript. |
|
2341 | 2382 | |
|
2342 | 2383 | Note: lots of HTML content sent by the server is derived from repository |
|
2343 | 2384 | data. Please consider the potential for malicious repository data to |
|
2344 | 2385 | "inject" itself into generated HTML content as part of your security |
|
2345 | 2386 | threat model. |
|
2346 | 2387 | |
|
2347 | 2388 | ``deny_push`` |
|
2348 | 2389 | Whether to deny pushing to the repository. If empty or not set, |
|
2349 | 2390 | push is not denied. If the special value ``*``, all remote users are |
|
2350 | 2391 | denied push. Otherwise, unauthenticated users are all denied, and |
|
2351 | 2392 | any authenticated user name present in this list is also denied. The |
|
2352 | 2393 | contents of the deny_push list are examined before the allow_push list. |
|
2353 | 2394 | |
|
2354 | 2395 | ``deny_read`` |
|
2355 | 2396 | Whether to deny reading/viewing of the repository. If this list is |
|
2356 | 2397 | not empty, unauthenticated users are all denied, and any |
|
2357 | 2398 | authenticated user name present in this list is also denied access to |
|
2358 | 2399 | the repository. If set to the special value ``*``, all remote users |
|
2359 | 2400 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
2360 | 2401 | the determination of repository access depends on the presence and |
|
2361 | 2402 | content of the allow_read list (see description). If both |
|
2362 | 2403 | deny_read and allow_read are empty or not set, then access is |
|
2363 | 2404 | permitted to all users by default. If the repository is being |
|
2364 | 2405 | served via hgwebdir, denied users will not be able to see it in |
|
2365 | 2406 | the list of repositories. The contents of the deny_read list have |
|
2366 | 2407 | priority over (are examined before) the contents of the allow_read |
|
2367 | 2408 | list. |
|
2368 | 2409 | |
|
2369 | 2410 | ``descend`` |
|
2370 | 2411 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
2371 | 2412 | directly in the current path will be shown (other repositories are still |
|
2372 | 2413 | available from the index corresponding to their containing path). |
|
2373 | 2414 | |
|
2374 | 2415 | ``description`` |
|
2375 | 2416 | Textual description of the repository's purpose or contents. |
|
2376 | 2417 | (default: "unknown") |
|
2377 | 2418 | |
|
2378 | 2419 | ``encoding`` |
|
2379 | 2420 | Character encoding name. (default: the current locale charset) |
|
2380 | 2421 | Example: "UTF-8". |
|
2381 | 2422 | |
|
2382 | 2423 | ``errorlog`` |
|
2383 | 2424 | Where to output the error log. (default: stderr) |
|
2384 | 2425 | |
|
2385 | 2426 | ``guessmime`` |
|
2386 | 2427 | Control MIME types for raw download of file content. |
|
2387 | 2428 | Set to True to let hgweb guess the content type from the file |
|
2388 | 2429 | extension. This will serve HTML files as ``text/html`` and might |
|
2389 | 2430 | allow cross-site scripting attacks when serving untrusted |
|
2390 | 2431 | repositories. (default: False) |
|
2391 | 2432 | |
|
2392 | 2433 | ``hidden`` |
|
2393 | 2434 | Whether to hide the repository in the hgwebdir index. |
|
2394 | 2435 | (default: False) |
|
2395 | 2436 | |
|
2396 | 2437 | ``ipv6`` |
|
2397 | 2438 | Whether to use IPv6. (default: False) |
|
2398 | 2439 | |
|
2399 | 2440 | ``labels`` |
|
2400 | 2441 | List of string *labels* associated with the repository. |
|
2401 | 2442 | |
|
2402 | 2443 | Labels are exposed as a template keyword and can be used to customize |
|
2403 | 2444 | output. e.g. the ``index`` template can group or filter repositories |
|
2404 | 2445 | by labels and the ``summary`` template can display additional content |
|
2405 | 2446 | if a specific label is present. |
|
2406 | 2447 | |
|
2407 | 2448 | ``logoimg`` |
|
2408 | 2449 | File name of the logo image that some templates display on each page. |
|
2409 | 2450 | The file name is relative to ``staticurl``. That is, the full path to |
|
2410 | 2451 | the logo image is "staticurl/logoimg". |
|
2411 | 2452 | If unset, ``hglogo.png`` will be used. |
|
2412 | 2453 | |
|
2413 | 2454 | ``logourl`` |
|
2414 | 2455 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
2415 | 2456 | will be used. |
|
2416 | 2457 | |
|
2417 | 2458 | ``maxchanges`` |
|
2418 | 2459 | Maximum number of changes to list on the changelog. (default: 10) |
|
2419 | 2460 | |
|
2420 | 2461 | ``maxfiles`` |
|
2421 | 2462 | Maximum number of files to list per changeset. (default: 10) |
|
2422 | 2463 | |
|
2423 | 2464 | ``maxshortchanges`` |
|
2424 | 2465 | Maximum number of changes to list on the shortlog, graph or filelog |
|
2425 | 2466 | pages. (default: 60) |
|
2426 | 2467 | |
|
2427 | 2468 | ``name`` |
|
2428 | 2469 | Repository name to use in the web interface. |
|
2429 | 2470 | (default: current working directory) |
|
2430 | 2471 | |
|
2431 | 2472 | ``port`` |
|
2432 | 2473 | Port to listen on. (default: 8000) |
|
2433 | 2474 | |
|
2434 | 2475 | ``prefix`` |
|
2435 | 2476 | Prefix path to serve from. (default: '' (server root)) |
|
2436 | 2477 | |
|
2437 | 2478 | ``push_ssl`` |
|
2438 | 2479 | Whether to require that inbound pushes be transported over SSL to |
|
2439 | 2480 | prevent password sniffing. (default: True) |
|
2440 | 2481 | |
|
2441 | 2482 | ``refreshinterval`` |
|
2442 | 2483 | How frequently directory listings re-scan the filesystem for new |
|
2443 | 2484 | repositories, in seconds. This is relevant when wildcards are used |
|
2444 | 2485 | to define paths. Depending on how much filesystem traversal is |
|
2445 | 2486 | required, refreshing may negatively impact performance. |
|
2446 | 2487 | |
|
2447 | 2488 | Values less than or equal to 0 always refresh. |
|
2448 | 2489 | (default: 20) |
|
2449 | 2490 | |
|
2450 | 2491 | ``staticurl`` |
|
2451 | 2492 | Base URL to use for static files. If unset, static files (e.g. the |
|
2452 | 2493 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
2453 | 2494 | this setting to serve them directly with the HTTP server. |
|
2454 | 2495 | Example: ``http://hgserver/static/``. |
|
2455 | 2496 | |
|
2456 | 2497 | ``stripes`` |
|
2457 | 2498 | How many lines a "zebra stripe" should span in multi-line output. |
|
2458 | 2499 | Set to 0 to disable. (default: 1) |
|
2459 | 2500 | |
|
2460 | 2501 | ``style`` |
|
2461 | 2502 | Which template map style to use. The available options are the names of |
|
2462 | 2503 | subdirectories in the HTML templates path. (default: ``paper``) |
|
2463 | 2504 | Example: ``monoblue``. |
|
2464 | 2505 | |
|
2465 | 2506 | ``templates`` |
|
2466 | 2507 | Where to find the HTML templates. The default path to the HTML templates |
|
2467 | 2508 | can be obtained from ``hg debuginstall``. |
|
2468 | 2509 | |
|
2469 | 2510 | ``websub`` |
|
2470 | 2511 | ---------- |
|
2471 | 2512 | |
|
2472 | 2513 | Web substitution filter definition. You can use this section to |
|
2473 | 2514 | define a set of regular expression substitution patterns which |
|
2474 | 2515 | let you automatically modify the hgweb server output. |
|
2475 | 2516 | |
|
2476 | 2517 | The default hgweb templates only apply these substitution patterns |
|
2477 | 2518 | on the revision description fields. You can apply them anywhere |
|
2478 | 2519 | you want when you create your own templates by adding calls to the |
|
2479 | 2520 | "websub" filter (usually after calling the "escape" filter). |
|
2480 | 2521 | |
|
2481 | 2522 | This can be used, for example, to convert issue references to links |
|
2482 | 2523 | to your issue tracker, or to convert "markdown-like" syntax into |
|
2483 | 2524 | HTML (see the examples below). |
|
2484 | 2525 | |
|
2485 | 2526 | Each entry in this section names a substitution filter. |
|
2486 | 2527 | The value of each entry defines the substitution expression itself. |
|
2487 | 2528 | The websub expressions follow the old interhg extension syntax, |
|
2488 | 2529 | which in turn imitates the Unix sed replacement syntax:: |
|
2489 | 2530 | |
|
2490 | 2531 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
2491 | 2532 | |
|
2492 | 2533 | You can use any separator other than "/". The final "i" is optional |
|
2493 | 2534 | and indicates that the search must be case insensitive. |
|
2494 | 2535 | |
|
2495 | 2536 | Examples:: |
|
2496 | 2537 | |
|
2497 | 2538 | [websub] |
|
2498 | 2539 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
2499 | 2540 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
2500 | 2541 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
2501 | 2542 | |
|
2502 | 2543 | ``worker`` |
|
2503 | 2544 | ---------- |
|
2504 | 2545 | |
|
2505 | 2546 | Parallel master/worker configuration. We currently perform working |
|
2506 | 2547 | directory updates in parallel on Unix-like systems, which greatly |
|
2507 | 2548 | helps performance. |
|
2508 | 2549 | |
|
2509 | 2550 | ``numcpus`` |
|
2510 | 2551 | Number of CPUs to use for parallel operations. A zero or |
|
2511 | 2552 | negative value is treated as ``use the default``. |
|
2512 | 2553 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
2513 | 2554 | |
|
2514 | 2555 | ``backgroundclose`` |
|
2515 | 2556 | Whether to enable closing file handles on background threads during certain |
|
2516 | 2557 | operations. Some platforms aren't very efficient at closing file |
|
2517 | 2558 | handles that have been written or appended to. By performing file closing |
|
2518 | 2559 | on background threads, file write rate can increase substantially. |
|
2519 | 2560 | (default: true on Windows, false elsewhere) |
|
2520 | 2561 | |
|
2521 | 2562 | ``backgroundcloseminfilecount`` |
|
2522 | 2563 | Minimum number of files required to trigger background file closing. |
|
2523 | 2564 | Operations not writing this many files won't start background close |
|
2524 | 2565 | threads. |
|
2525 | 2566 | (default: 2048) |
|
2526 | 2567 | |
|
2527 | 2568 | ``backgroundclosemaxqueue`` |
|
2528 | 2569 | The maximum number of opened file handles waiting to be closed in the |
|
2529 | 2570 | background. This option only has an effect if ``backgroundclose`` is |
|
2530 | 2571 | enabled. |
|
2531 | 2572 | (default: 384) |
|
2532 | 2573 | |
|
2533 | 2574 | ``backgroundclosethreadcount`` |
|
2534 | 2575 | Number of threads to process background file closes. Only relevant if |
|
2535 | 2576 | ``backgroundclose`` is enabled. |
|
2536 | 2577 | (default: 4) |
@@ -1,2036 +1,2063 b'' | |||
|
1 | 1 | # subrepo.py - sub-repository handling for Mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2009-2010 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import copy |
|
11 | 11 | import errno |
|
12 | 12 | import hashlib |
|
13 | 13 | import os |
|
14 | 14 | import posixpath |
|
15 | 15 | import re |
|
16 | 16 | import stat |
|
17 | 17 | import subprocess |
|
18 | 18 | import sys |
|
19 | 19 | import tarfile |
|
20 | 20 | import xml.dom.minidom |
|
21 | 21 | |
|
22 | 22 | |
|
23 | 23 | from .i18n import _ |
|
24 | 24 | from . import ( |
|
25 | 25 | cmdutil, |
|
26 | 26 | config, |
|
27 | 27 | encoding, |
|
28 | 28 | error, |
|
29 | 29 | exchange, |
|
30 | 30 | filemerge, |
|
31 | 31 | match as matchmod, |
|
32 | 32 | node, |
|
33 | 33 | pathutil, |
|
34 | 34 | phases, |
|
35 | 35 | pycompat, |
|
36 | 36 | scmutil, |
|
37 | 37 | util, |
|
38 | 38 | vfs as vfsmod, |
|
39 | 39 | ) |
|
40 | 40 | |
|
41 | 41 | hg = None |
|
42 | 42 | propertycache = util.propertycache |
|
43 | 43 | |
|
44 | 44 | nullstate = ('', '', 'empty') |
|
45 | 45 | |
|
46 | 46 | def _expandedabspath(path): |
|
47 | 47 | ''' |
|
48 | 48 | get a path or url and if it is a path expand it and return an absolute path |
|
49 | 49 | ''' |
|
50 | 50 | expandedpath = util.urllocalpath(util.expandpath(path)) |
|
51 | 51 | u = util.url(expandedpath) |
|
52 | 52 | if not u.scheme: |
|
53 | 53 | path = util.normpath(os.path.abspath(u.path)) |
|
54 | 54 | return path |
|
55 | 55 | |
|
56 | 56 | def _getstorehashcachename(remotepath): |
|
57 | 57 | '''get a unique filename for the store hash cache of a remote repository''' |
|
58 | 58 | return hashlib.sha1(_expandedabspath(remotepath)).hexdigest()[0:12] |
|
59 | 59 | |
|
60 | 60 | class SubrepoAbort(error.Abort): |
|
61 | 61 | """Exception class used to avoid handling a subrepo error more than once""" |
|
62 | 62 | def __init__(self, *args, **kw): |
|
63 | 63 | self.subrepo = kw.pop('subrepo', None) |
|
64 | 64 | self.cause = kw.pop('cause', None) |
|
65 | 65 | error.Abort.__init__(self, *args, **kw) |
|
66 | 66 | |
|
67 | 67 | def annotatesubrepoerror(func): |
|
68 | 68 | def decoratedmethod(self, *args, **kargs): |
|
69 | 69 | try: |
|
70 | 70 | res = func(self, *args, **kargs) |
|
71 | 71 | except SubrepoAbort as ex: |
|
72 | 72 | # This exception has already been handled |
|
73 | 73 | raise ex |
|
74 | 74 | except error.Abort as ex: |
|
75 | 75 | subrepo = subrelpath(self) |
|
76 | 76 | errormsg = str(ex) + ' ' + _('(in subrepository "%s")') % subrepo |
|
77 | 77 | # avoid handling this exception by raising a SubrepoAbort exception |
|
78 | 78 | raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo, |
|
79 | 79 | cause=sys.exc_info()) |
|
80 | 80 | return res |
|
81 | 81 | return decoratedmethod |
|
82 | 82 | |
|
83 | 83 | def state(ctx, ui): |
|
84 | 84 | """return a state dict, mapping subrepo paths configured in .hgsub |
|
85 | 85 | to tuple: (source from .hgsub, revision from .hgsubstate, kind |
|
86 | 86 | (key in types dict)) |
|
87 | 87 | """ |
|
88 | 88 | p = config.config() |
|
89 | 89 | repo = ctx.repo() |
|
90 | 90 | def read(f, sections=None, remap=None): |
|
91 | 91 | if f in ctx: |
|
92 | 92 | try: |
|
93 | 93 | data = ctx[f].data() |
|
94 | 94 | except IOError as err: |
|
95 | 95 | if err.errno != errno.ENOENT: |
|
96 | 96 | raise |
|
97 | 97 | # handle missing subrepo spec files as removed |
|
98 | 98 | ui.warn(_("warning: subrepo spec file \'%s\' not found\n") % |
|
99 | 99 | repo.pathto(f)) |
|
100 | 100 | return |
|
101 | 101 | p.parse(f, data, sections, remap, read) |
|
102 | 102 | else: |
|
103 | 103 | raise error.Abort(_("subrepo spec file \'%s\' not found") % |
|
104 | 104 | repo.pathto(f)) |
|
105 | 105 | if '.hgsub' in ctx: |
|
106 | 106 | read('.hgsub') |
|
107 | 107 | |
|
108 | 108 | for path, src in ui.configitems('subpaths'): |
|
109 | 109 | p.set('subpaths', path, src, ui.configsource('subpaths', path)) |
|
110 | 110 | |
|
111 | 111 | rev = {} |
|
112 | 112 | if '.hgsubstate' in ctx: |
|
113 | 113 | try: |
|
114 | 114 | for i, l in enumerate(ctx['.hgsubstate'].data().splitlines()): |
|
115 | 115 | l = l.lstrip() |
|
116 | 116 | if not l: |
|
117 | 117 | continue |
|
118 | 118 | try: |
|
119 | 119 | revision, path = l.split(" ", 1) |
|
120 | 120 | except ValueError: |
|
121 | 121 | raise error.Abort(_("invalid subrepository revision " |
|
122 | 122 | "specifier in \'%s\' line %d") |
|
123 | 123 | % (repo.pathto('.hgsubstate'), (i + 1))) |
|
124 | 124 | rev[path] = revision |
|
125 | 125 | except IOError as err: |
|
126 | 126 | if err.errno != errno.ENOENT: |
|
127 | 127 | raise |
|
128 | 128 | |
|
129 | 129 | def remap(src): |
|
130 | 130 | for pattern, repl in p.items('subpaths'): |
|
131 | 131 | # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub |
|
132 | 132 | # does a string decode. |
|
133 | 133 | repl = util.escapestr(repl) |
|
134 | 134 | # However, we still want to allow back references to go |
|
135 | 135 | # through unharmed, so we turn r'\\1' into r'\1'. Again, |
|
136 | 136 | # extra escapes are needed because re.sub string decodes. |
|
137 | 137 | repl = re.sub(br'\\\\([0-9]+)', br'\\\1', repl) |
|
138 | 138 | try: |
|
139 | 139 | src = re.sub(pattern, repl, src, 1) |
|
140 | 140 | except re.error as e: |
|
141 | 141 | raise error.Abort(_("bad subrepository pattern in %s: %s") |
|
142 | 142 | % (p.source('subpaths', pattern), e)) |
|
143 | 143 | return src |
|
144 | 144 | |
|
145 | 145 | state = {} |
|
146 | 146 | for path, src in p[''].items(): |
|
147 | 147 | kind = 'hg' |
|
148 | 148 | if src.startswith('['): |
|
149 | 149 | if ']' not in src: |
|
150 | 150 | raise error.Abort(_('missing ] in subrepository source')) |
|
151 | 151 | kind, src = src.split(']', 1) |
|
152 | 152 | kind = kind[1:] |
|
153 | 153 | src = src.lstrip() # strip any extra whitespace after ']' |
|
154 | 154 | |
|
155 | 155 | if not util.url(src).isabs(): |
|
156 | 156 | parent = _abssource(repo, abort=False) |
|
157 | 157 | if parent: |
|
158 | 158 | parent = util.url(parent) |
|
159 | 159 | parent.path = posixpath.join(parent.path or '', src) |
|
160 | 160 | parent.path = posixpath.normpath(parent.path) |
|
161 | 161 | joined = str(parent) |
|
162 | 162 | # Remap the full joined path and use it if it changes, |
|
163 | 163 | # else remap the original source. |
|
164 | 164 | remapped = remap(joined) |
|
165 | 165 | if remapped == joined: |
|
166 | 166 | src = remap(src) |
|
167 | 167 | else: |
|
168 | 168 | src = remapped |
|
169 | 169 | |
|
170 | 170 | src = remap(src) |
|
171 | 171 | state[util.pconvert(path)] = (src.strip(), rev.get(path, ''), kind) |
|
172 | 172 | |
|
173 | 173 | return state |
|
174 | 174 | |
|
175 | 175 | def writestate(repo, state): |
|
176 | 176 | """rewrite .hgsubstate in (outer) repo with these subrepo states""" |
|
177 | 177 | lines = ['%s %s\n' % (state[s][1], s) for s in sorted(state) |
|
178 | 178 | if state[s][1] != nullstate[1]] |
|
179 | 179 | repo.wwrite('.hgsubstate', ''.join(lines), '') |
|
180 | 180 | |
|
181 | 181 | def submerge(repo, wctx, mctx, actx, overwrite, labels=None): |
|
182 | 182 | """delegated from merge.applyupdates: merging of .hgsubstate file |
|
183 | 183 | in working context, merging context and ancestor context""" |
|
184 | 184 | if mctx == actx: # backwards? |
|
185 | 185 | actx = wctx.p1() |
|
186 | 186 | s1 = wctx.substate |
|
187 | 187 | s2 = mctx.substate |
|
188 | 188 | sa = actx.substate |
|
189 | 189 | sm = {} |
|
190 | 190 | |
|
191 | 191 | repo.ui.debug("subrepo merge %s %s %s\n" % (wctx, mctx, actx)) |
|
192 | 192 | |
|
193 | 193 | def debug(s, msg, r=""): |
|
194 | 194 | if r: |
|
195 | 195 | r = "%s:%s:%s" % r |
|
196 | 196 | repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
|
197 | 197 | |
|
198 | 198 | promptssrc = filemerge.partextras(labels) |
|
199 | 199 | for s, l in sorted(s1.iteritems()): |
|
200 | 200 | prompts = None |
|
201 | 201 | a = sa.get(s, nullstate) |
|
202 | 202 | ld = l # local state with possible dirty flag for compares |
|
203 | 203 | if wctx.sub(s).dirty(): |
|
204 | 204 | ld = (l[0], l[1] + "+") |
|
205 | 205 | if wctx == actx: # overwrite |
|
206 | 206 | a = ld |
|
207 | 207 | |
|
208 | 208 | prompts = promptssrc.copy() |
|
209 | 209 | prompts['s'] = s |
|
210 | 210 | if s in s2: |
|
211 | 211 | r = s2[s] |
|
212 | 212 | if ld == r or r == a: # no change or local is newer |
|
213 | 213 | sm[s] = l |
|
214 | 214 | continue |
|
215 | 215 | elif ld == a: # other side changed |
|
216 | 216 | debug(s, "other changed, get", r) |
|
217 | 217 | wctx.sub(s).get(r, overwrite) |
|
218 | 218 | sm[s] = r |
|
219 | 219 | elif ld[0] != r[0]: # sources differ |
|
220 | 220 | prompts['lo'] = l[0] |
|
221 | 221 | prompts['ro'] = r[0] |
|
222 | 222 | if repo.ui.promptchoice( |
|
223 | 223 | _(' subrepository sources for %(s)s differ\n' |
|
224 | 224 | 'use (l)ocal%(l)s source (%(lo)s)' |
|
225 | 225 | ' or (r)emote%(o)s source (%(ro)s)?' |
|
226 | 226 | '$$ &Local $$ &Remote') % prompts, 0): |
|
227 | 227 | debug(s, "prompt changed, get", r) |
|
228 | 228 | wctx.sub(s).get(r, overwrite) |
|
229 | 229 | sm[s] = r |
|
230 | 230 | elif ld[1] == a[1]: # local side is unchanged |
|
231 | 231 | debug(s, "other side changed, get", r) |
|
232 | 232 | wctx.sub(s).get(r, overwrite) |
|
233 | 233 | sm[s] = r |
|
234 | 234 | else: |
|
235 | 235 | debug(s, "both sides changed") |
|
236 | 236 | srepo = wctx.sub(s) |
|
237 | 237 | prompts['sl'] = srepo.shortid(l[1]) |
|
238 | 238 | prompts['sr'] = srepo.shortid(r[1]) |
|
239 | 239 | option = repo.ui.promptchoice( |
|
240 | 240 | _(' subrepository %(s)s diverged (local revision: %(sl)s, ' |
|
241 | 241 | 'remote revision: %(sr)s)\n' |
|
242 | 242 | '(M)erge, keep (l)ocal%(l)s or keep (r)emote%(o)s?' |
|
243 | 243 | '$$ &Merge $$ &Local $$ &Remote') |
|
244 | 244 | % prompts, 0) |
|
245 | 245 | if option == 0: |
|
246 | 246 | wctx.sub(s).merge(r) |
|
247 | 247 | sm[s] = l |
|
248 | 248 | debug(s, "merge with", r) |
|
249 | 249 | elif option == 1: |
|
250 | 250 | sm[s] = l |
|
251 | 251 | debug(s, "keep local subrepo revision", l) |
|
252 | 252 | else: |
|
253 | 253 | wctx.sub(s).get(r, overwrite) |
|
254 | 254 | sm[s] = r |
|
255 | 255 | debug(s, "get remote subrepo revision", r) |
|
256 | 256 | elif ld == a: # remote removed, local unchanged |
|
257 | 257 | debug(s, "remote removed, remove") |
|
258 | 258 | wctx.sub(s).remove() |
|
259 | 259 | elif a == nullstate: # not present in remote or ancestor |
|
260 | 260 | debug(s, "local added, keep") |
|
261 | 261 | sm[s] = l |
|
262 | 262 | continue |
|
263 | 263 | else: |
|
264 | 264 | if repo.ui.promptchoice( |
|
265 | 265 | _(' local%(l)s changed subrepository %(s)s' |
|
266 | 266 | ' which remote%(o)s removed\n' |
|
267 | 267 | 'use (c)hanged version or (d)elete?' |
|
268 | 268 | '$$ &Changed $$ &Delete') % prompts, 0): |
|
269 | 269 | debug(s, "prompt remove") |
|
270 | 270 | wctx.sub(s).remove() |
|
271 | 271 | |
|
272 | 272 | for s, r in sorted(s2.items()): |
|
273 | 273 | prompts = None |
|
274 | 274 | if s in s1: |
|
275 | 275 | continue |
|
276 | 276 | elif s not in sa: |
|
277 | 277 | debug(s, "remote added, get", r) |
|
278 | 278 | mctx.sub(s).get(r) |
|
279 | 279 | sm[s] = r |
|
280 | 280 | elif r != sa[s]: |
|
281 | 281 | prompts = promptssrc.copy() |
|
282 | 282 | prompts['s'] = s |
|
283 | 283 | if repo.ui.promptchoice( |
|
284 | 284 | _(' remote%(o)s changed subrepository %(s)s' |
|
285 | 285 | ' which local%(l)s removed\n' |
|
286 | 286 | 'use (c)hanged version or (d)elete?' |
|
287 | 287 | '$$ &Changed $$ &Delete') % prompts, 0) == 0: |
|
288 | 288 | debug(s, "prompt recreate", r) |
|
289 | 289 | mctx.sub(s).get(r) |
|
290 | 290 | sm[s] = r |
|
291 | 291 | |
|
292 | 292 | # record merged .hgsubstate |
|
293 | 293 | writestate(repo, sm) |
|
294 | 294 | return sm |
|
295 | 295 | |
|
296 | 296 | def _updateprompt(ui, sub, dirty, local, remote): |
|
297 | 297 | if dirty: |
|
298 | 298 | msg = (_(' subrepository sources for %s differ\n' |
|
299 | 299 | 'use (l)ocal source (%s) or (r)emote source (%s)?' |
|
300 | 300 | '$$ &Local $$ &Remote') |
|
301 | 301 | % (subrelpath(sub), local, remote)) |
|
302 | 302 | else: |
|
303 | 303 | msg = (_(' subrepository sources for %s differ (in checked out ' |
|
304 | 304 | 'version)\n' |
|
305 | 305 | 'use (l)ocal source (%s) or (r)emote source (%s)?' |
|
306 | 306 | '$$ &Local $$ &Remote') |
|
307 | 307 | % (subrelpath(sub), local, remote)) |
|
308 | 308 | return ui.promptchoice(msg, 0) |
|
309 | 309 | |
|
310 | 310 | def reporelpath(repo): |
|
311 | 311 | """return path to this (sub)repo as seen from outermost repo""" |
|
312 | 312 | parent = repo |
|
313 | 313 | while util.safehasattr(parent, '_subparent'): |
|
314 | 314 | parent = parent._subparent |
|
315 | 315 | return repo.root[len(pathutil.normasprefix(parent.root)):] |
|
316 | 316 | |
|
317 | 317 | def subrelpath(sub): |
|
318 | 318 | """return path to this subrepo as seen from outermost repo""" |
|
319 | 319 | return sub._relpath |
|
320 | 320 | |
|
321 | 321 | def _abssource(repo, push=False, abort=True): |
|
322 | 322 | """return pull/push path of repo - either based on parent repo .hgsub info |
|
323 | 323 | or on the top repo config. Abort or return None if no source found.""" |
|
324 | 324 | if util.safehasattr(repo, '_subparent'): |
|
325 | 325 | source = util.url(repo._subsource) |
|
326 | 326 | if source.isabs(): |
|
327 | 327 | return str(source) |
|
328 | 328 | source.path = posixpath.normpath(source.path) |
|
329 | 329 | parent = _abssource(repo._subparent, push, abort=False) |
|
330 | 330 | if parent: |
|
331 | 331 | parent = util.url(util.pconvert(parent)) |
|
332 | 332 | parent.path = posixpath.join(parent.path or '', source.path) |
|
333 | 333 | parent.path = posixpath.normpath(parent.path) |
|
334 | 334 | return str(parent) |
|
335 | 335 | else: # recursion reached top repo |
|
336 | 336 | if util.safehasattr(repo, '_subtoppath'): |
|
337 | 337 | return repo._subtoppath |
|
338 | 338 | if push and repo.ui.config('paths', 'default-push'): |
|
339 | 339 | return repo.ui.config('paths', 'default-push') |
|
340 | 340 | if repo.ui.config('paths', 'default'): |
|
341 | 341 | return repo.ui.config('paths', 'default') |
|
342 | 342 | if repo.shared(): |
|
343 | 343 | # chop off the .hg component to get the default path form |
|
344 | 344 | return os.path.dirname(repo.sharedpath) |
|
345 | 345 | if abort: |
|
346 | 346 | raise error.Abort(_("default path for subrepository not found")) |
|
347 | 347 | |
|
348 | 348 | def _sanitize(ui, vfs, ignore): |
|
349 | 349 | for dirname, dirs, names in vfs.walk(): |
|
350 | 350 | for i, d in enumerate(dirs): |
|
351 | 351 | if d.lower() == ignore: |
|
352 | 352 | del dirs[i] |
|
353 | 353 | break |
|
354 | 354 | if vfs.basename(dirname).lower() != '.hg': |
|
355 | 355 | continue |
|
356 | 356 | for f in names: |
|
357 | 357 | if f.lower() == 'hgrc': |
|
358 | 358 | ui.warn(_("warning: removing potentially hostile 'hgrc' " |
|
359 | 359 | "in '%s'\n") % vfs.join(dirname)) |
|
360 | 360 | vfs.unlink(vfs.reljoin(dirname, f)) |
|
361 | 361 | |
|
362 | 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 | 389 | def subrepo(ctx, path, allowwdir=False, allowcreate=True): |
|
363 | 390 | """return instance of the right subrepo class for subrepo in path""" |
|
364 | 391 | # subrepo inherently violates our import layering rules |
|
365 | 392 | # because it wants to make repo objects from deep inside the stack |
|
366 | 393 | # so we manually delay the circular imports to not break |
|
367 | 394 | # scripts that don't use our demand-loading |
|
368 | 395 | global hg |
|
369 | 396 | from . import hg as h |
|
370 | 397 | hg = h |
|
371 | 398 | |
|
372 | pathutil.pathauditor(ctx.repo().root)(path) | |
|
399 | repo = ctx.repo() | |
|
400 | _auditsubrepopath(repo, path) | |
|
373 | 401 | state = ctx.substate[path] |
|
374 | if state[2] not in types: | |
|
375 | raise error.Abort(_('unknown subrepo type %s') % state[2]) | |
|
402 | _checktype(repo.ui, state[2]) | |
|
376 | 403 | if allowwdir: |
|
377 | 404 | state = (state[0], ctx.subrev(path), state[2]) |
|
378 | 405 | return types[state[2]](ctx, path, state[:2], allowcreate) |
|
379 | 406 | |
|
380 | 407 | def nullsubrepo(ctx, path, pctx): |
|
381 | 408 | """return an empty subrepo in pctx for the extant subrepo in ctx""" |
|
382 | 409 | # subrepo inherently violates our import layering rules |
|
383 | 410 | # because it wants to make repo objects from deep inside the stack |
|
384 | 411 | # so we manually delay the circular imports to not break |
|
385 | 412 | # scripts that don't use our demand-loading |
|
386 | 413 | global hg |
|
387 | 414 | from . import hg as h |
|
388 | 415 | hg = h |
|
389 | 416 | |
|
390 | pathutil.pathauditor(ctx.repo().root)(path) | |
|
417 | repo = ctx.repo() | |
|
418 | _auditsubrepopath(repo, path) | |
|
391 | 419 | state = ctx.substate[path] |
|
392 | if state[2] not in types: | |
|
393 | raise error.Abort(_('unknown subrepo type %s') % state[2]) | |
|
420 | _checktype(repo.ui, state[2]) | |
|
394 | 421 | subrev = '' |
|
395 | 422 | if state[2] == 'hg': |
|
396 | 423 | subrev = "0" * 40 |
|
397 | 424 | return types[state[2]](pctx, path, (state[0], subrev), True) |
|
398 | 425 | |
|
399 | 426 | def newcommitphase(ui, ctx): |
|
400 | 427 | commitphase = phases.newcommitphase(ui) |
|
401 | 428 | substate = getattr(ctx, "substate", None) |
|
402 | 429 | if not substate: |
|
403 | 430 | return commitphase |
|
404 | 431 | check = ui.config('phases', 'checksubrepos') |
|
405 | 432 | if check not in ('ignore', 'follow', 'abort'): |
|
406 | 433 | raise error.Abort(_('invalid phases.checksubrepos configuration: %s') |
|
407 | 434 | % (check)) |
|
408 | 435 | if check == 'ignore': |
|
409 | 436 | return commitphase |
|
410 | 437 | maxphase = phases.public |
|
411 | 438 | maxsub = None |
|
412 | 439 | for s in sorted(substate): |
|
413 | 440 | sub = ctx.sub(s) |
|
414 | 441 | subphase = sub.phase(substate[s][1]) |
|
415 | 442 | if maxphase < subphase: |
|
416 | 443 | maxphase = subphase |
|
417 | 444 | maxsub = s |
|
418 | 445 | if commitphase < maxphase: |
|
419 | 446 | if check == 'abort': |
|
420 | 447 | raise error.Abort(_("can't commit in %s phase" |
|
421 | 448 | " conflicting %s from subrepository %s") % |
|
422 | 449 | (phases.phasenames[commitphase], |
|
423 | 450 | phases.phasenames[maxphase], maxsub)) |
|
424 | 451 | ui.warn(_("warning: changes are committed in" |
|
425 | 452 | " %s phase from subrepository %s\n") % |
|
426 | 453 | (phases.phasenames[maxphase], maxsub)) |
|
427 | 454 | return maxphase |
|
428 | 455 | return commitphase |
|
429 | 456 | |
|
430 | 457 | # subrepo classes need to implement the following abstract class: |
|
431 | 458 | |
|
432 | 459 | class abstractsubrepo(object): |
|
433 | 460 | |
|
434 | 461 | def __init__(self, ctx, path): |
|
435 | 462 | """Initialize abstractsubrepo part |
|
436 | 463 | |
|
437 | 464 | ``ctx`` is the context referring this subrepository in the |
|
438 | 465 | parent repository. |
|
439 | 466 | |
|
440 | 467 | ``path`` is the path to this subrepository as seen from |
|
441 | 468 | innermost repository. |
|
442 | 469 | """ |
|
443 | 470 | self.ui = ctx.repo().ui |
|
444 | 471 | self._ctx = ctx |
|
445 | 472 | self._path = path |
|
446 | 473 | |
|
447 | 474 | def addwebdirpath(self, serverpath, webconf): |
|
448 | 475 | """Add the hgwebdir entries for this subrepo, and any of its subrepos. |
|
449 | 476 | |
|
450 | 477 | ``serverpath`` is the path component of the URL for this repo. |
|
451 | 478 | |
|
452 | 479 | ``webconf`` is the dictionary of hgwebdir entries. |
|
453 | 480 | """ |
|
454 | 481 | pass |
|
455 | 482 | |
|
456 | 483 | def storeclean(self, path): |
|
457 | 484 | """ |
|
458 | 485 | returns true if the repository has not changed since it was last |
|
459 | 486 | cloned from or pushed to a given repository. |
|
460 | 487 | """ |
|
461 | 488 | return False |
|
462 | 489 | |
|
463 | 490 | def dirty(self, ignoreupdate=False, missing=False): |
|
464 | 491 | """returns true if the dirstate of the subrepo is dirty or does not |
|
465 | 492 | match current stored state. If ignoreupdate is true, only check |
|
466 | 493 | whether the subrepo has uncommitted changes in its dirstate. If missing |
|
467 | 494 | is true, check for deleted files. |
|
468 | 495 | """ |
|
469 | 496 | raise NotImplementedError |
|
470 | 497 | |
|
471 | 498 | def dirtyreason(self, ignoreupdate=False, missing=False): |
|
472 | 499 | """return reason string if it is ``dirty()`` |
|
473 | 500 | |
|
474 | 501 | Returned string should have enough information for the message |
|
475 | 502 | of exception. |
|
476 | 503 | |
|
477 | 504 | This returns None, otherwise. |
|
478 | 505 | """ |
|
479 | 506 | if self.dirty(ignoreupdate=ignoreupdate, missing=missing): |
|
480 | 507 | return _('uncommitted changes in subrepository "%s"' |
|
481 | 508 | ) % subrelpath(self) |
|
482 | 509 | |
|
483 | 510 | def bailifchanged(self, ignoreupdate=False, hint=None): |
|
484 | 511 | """raise Abort if subrepository is ``dirty()`` |
|
485 | 512 | """ |
|
486 | 513 | dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate, |
|
487 | 514 | missing=True) |
|
488 | 515 | if dirtyreason: |
|
489 | 516 | raise error.Abort(dirtyreason, hint=hint) |
|
490 | 517 | |
|
491 | 518 | def basestate(self): |
|
492 | 519 | """current working directory base state, disregarding .hgsubstate |
|
493 | 520 | state and working directory modifications""" |
|
494 | 521 | raise NotImplementedError |
|
495 | 522 | |
|
496 | 523 | def checknested(self, path): |
|
497 | 524 | """check if path is a subrepository within this repository""" |
|
498 | 525 | return False |
|
499 | 526 | |
|
500 | 527 | def commit(self, text, user, date): |
|
501 | 528 | """commit the current changes to the subrepo with the given |
|
502 | 529 | log message. Use given user and date if possible. Return the |
|
503 | 530 | new state of the subrepo. |
|
504 | 531 | """ |
|
505 | 532 | raise NotImplementedError |
|
506 | 533 | |
|
507 | 534 | def phase(self, state): |
|
508 | 535 | """returns phase of specified state in the subrepository. |
|
509 | 536 | """ |
|
510 | 537 | return phases.public |
|
511 | 538 | |
|
512 | 539 | def remove(self): |
|
513 | 540 | """remove the subrepo |
|
514 | 541 | |
|
515 | 542 | (should verify the dirstate is not dirty first) |
|
516 | 543 | """ |
|
517 | 544 | raise NotImplementedError |
|
518 | 545 | |
|
519 | 546 | def get(self, state, overwrite=False): |
|
520 | 547 | """run whatever commands are needed to put the subrepo into |
|
521 | 548 | this state |
|
522 | 549 | """ |
|
523 | 550 | raise NotImplementedError |
|
524 | 551 | |
|
525 | 552 | def merge(self, state): |
|
526 | 553 | """merge currently-saved state with the new state.""" |
|
527 | 554 | raise NotImplementedError |
|
528 | 555 | |
|
529 | 556 | def push(self, opts): |
|
530 | 557 | """perform whatever action is analogous to 'hg push' |
|
531 | 558 | |
|
532 | 559 | This may be a no-op on some systems. |
|
533 | 560 | """ |
|
534 | 561 | raise NotImplementedError |
|
535 | 562 | |
|
536 | 563 | def add(self, ui, match, prefix, explicitonly, **opts): |
|
537 | 564 | return [] |
|
538 | 565 | |
|
539 | 566 | def addremove(self, matcher, prefix, opts, dry_run, similarity): |
|
540 | 567 | self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) |
|
541 | 568 | return 1 |
|
542 | 569 | |
|
543 | 570 | def cat(self, match, fm, fntemplate, prefix, **opts): |
|
544 | 571 | return 1 |
|
545 | 572 | |
|
546 | 573 | def status(self, rev2, **opts): |
|
547 | 574 | return scmutil.status([], [], [], [], [], [], []) |
|
548 | 575 | |
|
549 | 576 | def diff(self, ui, diffopts, node2, match, prefix, **opts): |
|
550 | 577 | pass |
|
551 | 578 | |
|
552 | 579 | def outgoing(self, ui, dest, opts): |
|
553 | 580 | return 1 |
|
554 | 581 | |
|
555 | 582 | def incoming(self, ui, source, opts): |
|
556 | 583 | return 1 |
|
557 | 584 | |
|
558 | 585 | def files(self): |
|
559 | 586 | """return filename iterator""" |
|
560 | 587 | raise NotImplementedError |
|
561 | 588 | |
|
562 | 589 | def filedata(self, name, decode): |
|
563 | 590 | """return file data, optionally passed through repo decoders""" |
|
564 | 591 | raise NotImplementedError |
|
565 | 592 | |
|
566 | 593 | def fileflags(self, name): |
|
567 | 594 | """return file flags""" |
|
568 | 595 | return '' |
|
569 | 596 | |
|
570 | 597 | def getfileset(self, expr): |
|
571 | 598 | """Resolve the fileset expression for this repo""" |
|
572 | 599 | return set() |
|
573 | 600 | |
|
574 | 601 | def printfiles(self, ui, m, fm, fmt, subrepos): |
|
575 | 602 | """handle the files command for this subrepo""" |
|
576 | 603 | return 1 |
|
577 | 604 | |
|
578 | 605 | def archive(self, archiver, prefix, match=None, decode=True): |
|
579 | 606 | if match is not None: |
|
580 | 607 | files = [f for f in self.files() if match(f)] |
|
581 | 608 | else: |
|
582 | 609 | files = self.files() |
|
583 | 610 | total = len(files) |
|
584 | 611 | relpath = subrelpath(self) |
|
585 | 612 | self.ui.progress(_('archiving (%s)') % relpath, 0, |
|
586 | 613 | unit=_('files'), total=total) |
|
587 | 614 | for i, name in enumerate(files): |
|
588 | 615 | flags = self.fileflags(name) |
|
589 | 616 | mode = 'x' in flags and 0o755 or 0o644 |
|
590 | 617 | symlink = 'l' in flags |
|
591 | 618 | archiver.addfile(prefix + self._path + '/' + name, |
|
592 | 619 | mode, symlink, self.filedata(name, decode)) |
|
593 | 620 | self.ui.progress(_('archiving (%s)') % relpath, i + 1, |
|
594 | 621 | unit=_('files'), total=total) |
|
595 | 622 | self.ui.progress(_('archiving (%s)') % relpath, None) |
|
596 | 623 | return total |
|
597 | 624 | |
|
598 | 625 | def walk(self, match): |
|
599 | 626 | ''' |
|
600 | 627 | walk recursively through the directory tree, finding all files |
|
601 | 628 | matched by the match function |
|
602 | 629 | ''' |
|
603 | 630 | |
|
604 | 631 | def forget(self, match, prefix): |
|
605 | 632 | return ([], []) |
|
606 | 633 | |
|
607 | 634 | def removefiles(self, matcher, prefix, after, force, subrepos, warnings): |
|
608 | 635 | """remove the matched files from the subrepository and the filesystem, |
|
609 | 636 | possibly by force and/or after the file has been removed from the |
|
610 | 637 | filesystem. Return 0 on success, 1 on any warning. |
|
611 | 638 | """ |
|
612 | 639 | warnings.append(_("warning: removefiles not implemented (%s)") |
|
613 | 640 | % self._path) |
|
614 | 641 | return 1 |
|
615 | 642 | |
|
616 | 643 | def revert(self, substate, *pats, **opts): |
|
617 | 644 | self.ui.warn(_('%s: reverting %s subrepos is unsupported\n') \ |
|
618 | 645 | % (substate[0], substate[2])) |
|
619 | 646 | return [] |
|
620 | 647 | |
|
621 | 648 | def shortid(self, revid): |
|
622 | 649 | return revid |
|
623 | 650 | |
|
624 | 651 | def unshare(self): |
|
625 | 652 | ''' |
|
626 | 653 | convert this repository from shared to normal storage. |
|
627 | 654 | ''' |
|
628 | 655 | |
|
629 | 656 | def verify(self): |
|
630 | 657 | '''verify the integrity of the repository. Return 0 on success or |
|
631 | 658 | warning, 1 on any error. |
|
632 | 659 | ''' |
|
633 | 660 | return 0 |
|
634 | 661 | |
|
635 | 662 | @propertycache |
|
636 | 663 | def wvfs(self): |
|
637 | 664 | """return vfs to access the working directory of this subrepository |
|
638 | 665 | """ |
|
639 | 666 | return vfsmod.vfs(self._ctx.repo().wvfs.join(self._path)) |
|
640 | 667 | |
|
641 | 668 | @propertycache |
|
642 | 669 | def _relpath(self): |
|
643 | 670 | """return path to this subrepository as seen from outermost repository |
|
644 | 671 | """ |
|
645 | 672 | return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path) |
|
646 | 673 | |
|
647 | 674 | class hgsubrepo(abstractsubrepo): |
|
648 | 675 | def __init__(self, ctx, path, state, allowcreate): |
|
649 | 676 | super(hgsubrepo, self).__init__(ctx, path) |
|
650 | 677 | self._state = state |
|
651 | 678 | r = ctx.repo() |
|
652 | 679 | root = r.wjoin(path) |
|
653 | 680 | create = allowcreate and not r.wvfs.exists('%s/.hg' % path) |
|
654 | 681 | self._repo = hg.repository(r.baseui, root, create=create) |
|
655 | 682 | |
|
656 | 683 | # Propagate the parent's --hidden option |
|
657 | 684 | if r is r.unfiltered(): |
|
658 | 685 | self._repo = self._repo.unfiltered() |
|
659 | 686 | |
|
660 | 687 | self.ui = self._repo.ui |
|
661 | 688 | for s, k in [('ui', 'commitsubrepos')]: |
|
662 | 689 | v = r.ui.config(s, k) |
|
663 | 690 | if v: |
|
664 | 691 | self.ui.setconfig(s, k, v, 'subrepo') |
|
665 | 692 | # internal config: ui._usedassubrepo |
|
666 | 693 | self.ui.setconfig('ui', '_usedassubrepo', 'True', 'subrepo') |
|
667 | 694 | self._initrepo(r, state[0], create) |
|
668 | 695 | |
|
669 | 696 | @annotatesubrepoerror |
|
670 | 697 | def addwebdirpath(self, serverpath, webconf): |
|
671 | 698 | cmdutil.addwebdirpath(self._repo, subrelpath(self), webconf) |
|
672 | 699 | |
|
673 | 700 | def storeclean(self, path): |
|
674 | 701 | with self._repo.lock(): |
|
675 | 702 | return self._storeclean(path) |
|
676 | 703 | |
|
677 | 704 | def _storeclean(self, path): |
|
678 | 705 | clean = True |
|
679 | 706 | itercache = self._calcstorehash(path) |
|
680 | 707 | for filehash in self._readstorehashcache(path): |
|
681 | 708 | if filehash != next(itercache, None): |
|
682 | 709 | clean = False |
|
683 | 710 | break |
|
684 | 711 | if clean: |
|
685 | 712 | # if not empty: |
|
686 | 713 | # the cached and current pull states have a different size |
|
687 | 714 | clean = next(itercache, None) is None |
|
688 | 715 | return clean |
|
689 | 716 | |
|
690 | 717 | def _calcstorehash(self, remotepath): |
|
691 | 718 | '''calculate a unique "store hash" |
|
692 | 719 | |
|
693 | 720 | This method is used to to detect when there are changes that may |
|
694 | 721 | require a push to a given remote path.''' |
|
695 | 722 | # sort the files that will be hashed in increasing (likely) file size |
|
696 | 723 | filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i') |
|
697 | 724 | yield '# %s\n' % _expandedabspath(remotepath) |
|
698 | 725 | vfs = self._repo.vfs |
|
699 | 726 | for relname in filelist: |
|
700 | 727 | filehash = hashlib.sha1(vfs.tryread(relname)).hexdigest() |
|
701 | 728 | yield '%s = %s\n' % (relname, filehash) |
|
702 | 729 | |
|
703 | 730 | @propertycache |
|
704 | 731 | def _cachestorehashvfs(self): |
|
705 | 732 | return vfsmod.vfs(self._repo.vfs.join('cache/storehash')) |
|
706 | 733 | |
|
707 | 734 | def _readstorehashcache(self, remotepath): |
|
708 | 735 | '''read the store hash cache for a given remote repository''' |
|
709 | 736 | cachefile = _getstorehashcachename(remotepath) |
|
710 | 737 | return self._cachestorehashvfs.tryreadlines(cachefile, 'r') |
|
711 | 738 | |
|
712 | 739 | def _cachestorehash(self, remotepath): |
|
713 | 740 | '''cache the current store hash |
|
714 | 741 | |
|
715 | 742 | Each remote repo requires its own store hash cache, because a subrepo |
|
716 | 743 | store may be "clean" versus a given remote repo, but not versus another |
|
717 | 744 | ''' |
|
718 | 745 | cachefile = _getstorehashcachename(remotepath) |
|
719 | 746 | with self._repo.lock(): |
|
720 | 747 | storehash = list(self._calcstorehash(remotepath)) |
|
721 | 748 | vfs = self._cachestorehashvfs |
|
722 | 749 | vfs.writelines(cachefile, storehash, mode='w', notindexed=True) |
|
723 | 750 | |
|
724 | 751 | def _getctx(self): |
|
725 | 752 | '''fetch the context for this subrepo revision, possibly a workingctx |
|
726 | 753 | ''' |
|
727 | 754 | if self._ctx.rev() is None: |
|
728 | 755 | return self._repo[None] # workingctx if parent is workingctx |
|
729 | 756 | else: |
|
730 | 757 | rev = self._state[1] |
|
731 | 758 | return self._repo[rev] |
|
732 | 759 | |
|
733 | 760 | @annotatesubrepoerror |
|
734 | 761 | def _initrepo(self, parentrepo, source, create): |
|
735 | 762 | self._repo._subparent = parentrepo |
|
736 | 763 | self._repo._subsource = source |
|
737 | 764 | |
|
738 | 765 | if create: |
|
739 | 766 | lines = ['[paths]\n'] |
|
740 | 767 | |
|
741 | 768 | def addpathconfig(key, value): |
|
742 | 769 | if value: |
|
743 | 770 | lines.append('%s = %s\n' % (key, value)) |
|
744 | 771 | self.ui.setconfig('paths', key, value, 'subrepo') |
|
745 | 772 | |
|
746 | 773 | defpath = _abssource(self._repo, abort=False) |
|
747 | 774 | defpushpath = _abssource(self._repo, True, abort=False) |
|
748 | 775 | addpathconfig('default', defpath) |
|
749 | 776 | if defpath != defpushpath: |
|
750 | 777 | addpathconfig('default-push', defpushpath) |
|
751 | 778 | |
|
752 | 779 | fp = self._repo.vfs("hgrc", "w", text=True) |
|
753 | 780 | try: |
|
754 | 781 | fp.write(''.join(lines)) |
|
755 | 782 | finally: |
|
756 | 783 | fp.close() |
|
757 | 784 | |
|
758 | 785 | @annotatesubrepoerror |
|
759 | 786 | def add(self, ui, match, prefix, explicitonly, **opts): |
|
760 | 787 | return cmdutil.add(ui, self._repo, match, |
|
761 | 788 | self.wvfs.reljoin(prefix, self._path), |
|
762 | 789 | explicitonly, **opts) |
|
763 | 790 | |
|
764 | 791 | @annotatesubrepoerror |
|
765 | 792 | def addremove(self, m, prefix, opts, dry_run, similarity): |
|
766 | 793 | # In the same way as sub directories are processed, once in a subrepo, |
|
767 | 794 | # always entry any of its subrepos. Don't corrupt the options that will |
|
768 | 795 | # be used to process sibling subrepos however. |
|
769 | 796 | opts = copy.copy(opts) |
|
770 | 797 | opts['subrepos'] = True |
|
771 | 798 | return scmutil.addremove(self._repo, m, |
|
772 | 799 | self.wvfs.reljoin(prefix, self._path), opts, |
|
773 | 800 | dry_run, similarity) |
|
774 | 801 | |
|
775 | 802 | @annotatesubrepoerror |
|
776 | 803 | def cat(self, match, fm, fntemplate, prefix, **opts): |
|
777 | 804 | rev = self._state[1] |
|
778 | 805 | ctx = self._repo[rev] |
|
779 | 806 | return cmdutil.cat(self.ui, self._repo, ctx, match, fm, fntemplate, |
|
780 | 807 | prefix, **opts) |
|
781 | 808 | |
|
782 | 809 | @annotatesubrepoerror |
|
783 | 810 | def status(self, rev2, **opts): |
|
784 | 811 | try: |
|
785 | 812 | rev1 = self._state[1] |
|
786 | 813 | ctx1 = self._repo[rev1] |
|
787 | 814 | ctx2 = self._repo[rev2] |
|
788 | 815 | return self._repo.status(ctx1, ctx2, **opts) |
|
789 | 816 | except error.RepoLookupError as inst: |
|
790 | 817 | self.ui.warn(_('warning: error "%s" in subrepository "%s"\n') |
|
791 | 818 | % (inst, subrelpath(self))) |
|
792 | 819 | return scmutil.status([], [], [], [], [], [], []) |
|
793 | 820 | |
|
794 | 821 | @annotatesubrepoerror |
|
795 | 822 | def diff(self, ui, diffopts, node2, match, prefix, **opts): |
|
796 | 823 | try: |
|
797 | 824 | node1 = node.bin(self._state[1]) |
|
798 | 825 | # We currently expect node2 to come from substate and be |
|
799 | 826 | # in hex format |
|
800 | 827 | if node2 is not None: |
|
801 | 828 | node2 = node.bin(node2) |
|
802 | 829 | cmdutil.diffordiffstat(ui, self._repo, diffopts, |
|
803 | 830 | node1, node2, match, |
|
804 | 831 | prefix=posixpath.join(prefix, self._path), |
|
805 | 832 | listsubrepos=True, **opts) |
|
806 | 833 | except error.RepoLookupError as inst: |
|
807 | 834 | self.ui.warn(_('warning: error "%s" in subrepository "%s"\n') |
|
808 | 835 | % (inst, subrelpath(self))) |
|
809 | 836 | |
|
810 | 837 | @annotatesubrepoerror |
|
811 | 838 | def archive(self, archiver, prefix, match=None, decode=True): |
|
812 | 839 | self._get(self._state + ('hg',)) |
|
813 | 840 | total = abstractsubrepo.archive(self, archiver, prefix, match) |
|
814 | 841 | rev = self._state[1] |
|
815 | 842 | ctx = self._repo[rev] |
|
816 | 843 | for subpath in ctx.substate: |
|
817 | 844 | s = subrepo(ctx, subpath, True) |
|
818 | 845 | submatch = matchmod.subdirmatcher(subpath, match) |
|
819 | 846 | total += s.archive(archiver, prefix + self._path + '/', submatch, |
|
820 | 847 | decode) |
|
821 | 848 | return total |
|
822 | 849 | |
|
823 | 850 | @annotatesubrepoerror |
|
824 | 851 | def dirty(self, ignoreupdate=False, missing=False): |
|
825 | 852 | r = self._state[1] |
|
826 | 853 | if r == '' and not ignoreupdate: # no state recorded |
|
827 | 854 | return True |
|
828 | 855 | w = self._repo[None] |
|
829 | 856 | if r != w.p1().hex() and not ignoreupdate: |
|
830 | 857 | # different version checked out |
|
831 | 858 | return True |
|
832 | 859 | return w.dirty(missing=missing) # working directory changed |
|
833 | 860 | |
|
834 | 861 | def basestate(self): |
|
835 | 862 | return self._repo['.'].hex() |
|
836 | 863 | |
|
837 | 864 | def checknested(self, path): |
|
838 | 865 | return self._repo._checknested(self._repo.wjoin(path)) |
|
839 | 866 | |
|
840 | 867 | @annotatesubrepoerror |
|
841 | 868 | def commit(self, text, user, date): |
|
842 | 869 | # don't bother committing in the subrepo if it's only been |
|
843 | 870 | # updated |
|
844 | 871 | if not self.dirty(True): |
|
845 | 872 | return self._repo['.'].hex() |
|
846 | 873 | self.ui.debug("committing subrepo %s\n" % subrelpath(self)) |
|
847 | 874 | n = self._repo.commit(text, user, date) |
|
848 | 875 | if not n: |
|
849 | 876 | return self._repo['.'].hex() # different version checked out |
|
850 | 877 | return node.hex(n) |
|
851 | 878 | |
|
852 | 879 | @annotatesubrepoerror |
|
853 | 880 | def phase(self, state): |
|
854 | 881 | return self._repo[state].phase() |
|
855 | 882 | |
|
856 | 883 | @annotatesubrepoerror |
|
857 | 884 | def remove(self): |
|
858 | 885 | # we can't fully delete the repository as it may contain |
|
859 | 886 | # local-only history |
|
860 | 887 | self.ui.note(_('removing subrepo %s\n') % subrelpath(self)) |
|
861 | 888 | hg.clean(self._repo, node.nullid, False) |
|
862 | 889 | |
|
863 | 890 | def _get(self, state): |
|
864 | 891 | source, revision, kind = state |
|
865 | 892 | parentrepo = self._repo._subparent |
|
866 | 893 | |
|
867 | 894 | if revision in self._repo.unfiltered(): |
|
868 | 895 | # Allow shared subrepos tracked at null to setup the sharedpath |
|
869 | 896 | if len(self._repo) != 0 or not parentrepo.shared(): |
|
870 | 897 | return True |
|
871 | 898 | self._repo._subsource = source |
|
872 | 899 | srcurl = _abssource(self._repo) |
|
873 | 900 | other = hg.peer(self._repo, {}, srcurl) |
|
874 | 901 | if len(self._repo) == 0: |
|
875 | 902 | # use self._repo.vfs instead of self.wvfs to remove .hg only |
|
876 | 903 | self._repo.vfs.rmtree() |
|
877 | 904 | if parentrepo.shared(): |
|
878 | 905 | self.ui.status(_('sharing subrepo %s from %s\n') |
|
879 | 906 | % (subrelpath(self), srcurl)) |
|
880 | 907 | shared = hg.share(self._repo._subparent.baseui, |
|
881 | 908 | other, self._repo.root, |
|
882 | 909 | update=False, bookmarks=False) |
|
883 | 910 | self._repo = shared.local() |
|
884 | 911 | else: |
|
885 | 912 | self.ui.status(_('cloning subrepo %s from %s\n') |
|
886 | 913 | % (subrelpath(self), srcurl)) |
|
887 | 914 | other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
|
888 | 915 | other, self._repo.root, |
|
889 | 916 | update=False) |
|
890 | 917 | self._repo = cloned.local() |
|
891 | 918 | self._initrepo(parentrepo, source, create=True) |
|
892 | 919 | self._cachestorehash(srcurl) |
|
893 | 920 | else: |
|
894 | 921 | self.ui.status(_('pulling subrepo %s from %s\n') |
|
895 | 922 | % (subrelpath(self), srcurl)) |
|
896 | 923 | cleansub = self.storeclean(srcurl) |
|
897 | 924 | exchange.pull(self._repo, other) |
|
898 | 925 | if cleansub: |
|
899 | 926 | # keep the repo clean after pull |
|
900 | 927 | self._cachestorehash(srcurl) |
|
901 | 928 | return False |
|
902 | 929 | |
|
903 | 930 | @annotatesubrepoerror |
|
904 | 931 | def get(self, state, overwrite=False): |
|
905 | 932 | inrepo = self._get(state) |
|
906 | 933 | source, revision, kind = state |
|
907 | 934 | repo = self._repo |
|
908 | 935 | repo.ui.debug("getting subrepo %s\n" % self._path) |
|
909 | 936 | if inrepo: |
|
910 | 937 | urepo = repo.unfiltered() |
|
911 | 938 | ctx = urepo[revision] |
|
912 | 939 | if ctx.hidden(): |
|
913 | 940 | urepo.ui.warn( |
|
914 | 941 | _('revision %s in subrepository "%s" is hidden\n') \ |
|
915 | 942 | % (revision[0:12], self._path)) |
|
916 | 943 | repo = urepo |
|
917 | 944 | hg.updaterepo(repo, revision, overwrite) |
|
918 | 945 | |
|
919 | 946 | @annotatesubrepoerror |
|
920 | 947 | def merge(self, state): |
|
921 | 948 | self._get(state) |
|
922 | 949 | cur = self._repo['.'] |
|
923 | 950 | dst = self._repo[state[1]] |
|
924 | 951 | anc = dst.ancestor(cur) |
|
925 | 952 | |
|
926 | 953 | def mergefunc(): |
|
927 | 954 | if anc == cur and dst.branch() == cur.branch(): |
|
928 | 955 | self.ui.debug('updating subrepository "%s"\n' |
|
929 | 956 | % subrelpath(self)) |
|
930 | 957 | hg.update(self._repo, state[1]) |
|
931 | 958 | elif anc == dst: |
|
932 | 959 | self.ui.debug('skipping subrepository "%s"\n' |
|
933 | 960 | % subrelpath(self)) |
|
934 | 961 | else: |
|
935 | 962 | self.ui.debug('merging subrepository "%s"\n' % subrelpath(self)) |
|
936 | 963 | hg.merge(self._repo, state[1], remind=False) |
|
937 | 964 | |
|
938 | 965 | wctx = self._repo[None] |
|
939 | 966 | if self.dirty(): |
|
940 | 967 | if anc != dst: |
|
941 | 968 | if _updateprompt(self.ui, self, wctx.dirty(), cur, dst): |
|
942 | 969 | mergefunc() |
|
943 | 970 | else: |
|
944 | 971 | mergefunc() |
|
945 | 972 | else: |
|
946 | 973 | mergefunc() |
|
947 | 974 | |
|
948 | 975 | @annotatesubrepoerror |
|
949 | 976 | def push(self, opts): |
|
950 | 977 | force = opts.get('force') |
|
951 | 978 | newbranch = opts.get('new_branch') |
|
952 | 979 | ssh = opts.get('ssh') |
|
953 | 980 | |
|
954 | 981 | # push subrepos depth-first for coherent ordering |
|
955 | 982 | c = self._repo[''] |
|
956 | 983 | subs = c.substate # only repos that are committed |
|
957 | 984 | for s in sorted(subs): |
|
958 | 985 | if c.sub(s).push(opts) == 0: |
|
959 | 986 | return False |
|
960 | 987 | |
|
961 | 988 | dsturl = _abssource(self._repo, True) |
|
962 | 989 | if not force: |
|
963 | 990 | if self.storeclean(dsturl): |
|
964 | 991 | self.ui.status( |
|
965 | 992 | _('no changes made to subrepo %s since last push to %s\n') |
|
966 | 993 | % (subrelpath(self), dsturl)) |
|
967 | 994 | return None |
|
968 | 995 | self.ui.status(_('pushing subrepo %s to %s\n') % |
|
969 | 996 | (subrelpath(self), dsturl)) |
|
970 | 997 | other = hg.peer(self._repo, {'ssh': ssh}, dsturl) |
|
971 | 998 | res = exchange.push(self._repo, other, force, newbranch=newbranch) |
|
972 | 999 | |
|
973 | 1000 | # the repo is now clean |
|
974 | 1001 | self._cachestorehash(dsturl) |
|
975 | 1002 | return res.cgresult |
|
976 | 1003 | |
|
977 | 1004 | @annotatesubrepoerror |
|
978 | 1005 | def outgoing(self, ui, dest, opts): |
|
979 | 1006 | if 'rev' in opts or 'branch' in opts: |
|
980 | 1007 | opts = copy.copy(opts) |
|
981 | 1008 | opts.pop('rev', None) |
|
982 | 1009 | opts.pop('branch', None) |
|
983 | 1010 | return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts) |
|
984 | 1011 | |
|
985 | 1012 | @annotatesubrepoerror |
|
986 | 1013 | def incoming(self, ui, source, opts): |
|
987 | 1014 | if 'rev' in opts or 'branch' in opts: |
|
988 | 1015 | opts = copy.copy(opts) |
|
989 | 1016 | opts.pop('rev', None) |
|
990 | 1017 | opts.pop('branch', None) |
|
991 | 1018 | return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts) |
|
992 | 1019 | |
|
993 | 1020 | @annotatesubrepoerror |
|
994 | 1021 | def files(self): |
|
995 | 1022 | rev = self._state[1] |
|
996 | 1023 | ctx = self._repo[rev] |
|
997 | 1024 | return ctx.manifest().keys() |
|
998 | 1025 | |
|
999 | 1026 | def filedata(self, name, decode): |
|
1000 | 1027 | rev = self._state[1] |
|
1001 | 1028 | data = self._repo[rev][name].data() |
|
1002 | 1029 | if decode: |
|
1003 | 1030 | data = self._repo.wwritedata(name, data) |
|
1004 | 1031 | return data |
|
1005 | 1032 | |
|
1006 | 1033 | def fileflags(self, name): |
|
1007 | 1034 | rev = self._state[1] |
|
1008 | 1035 | ctx = self._repo[rev] |
|
1009 | 1036 | return ctx.flags(name) |
|
1010 | 1037 | |
|
1011 | 1038 | @annotatesubrepoerror |
|
1012 | 1039 | def printfiles(self, ui, m, fm, fmt, subrepos): |
|
1013 | 1040 | # If the parent context is a workingctx, use the workingctx here for |
|
1014 | 1041 | # consistency. |
|
1015 | 1042 | if self._ctx.rev() is None: |
|
1016 | 1043 | ctx = self._repo[None] |
|
1017 | 1044 | else: |
|
1018 | 1045 | rev = self._state[1] |
|
1019 | 1046 | ctx = self._repo[rev] |
|
1020 | 1047 | return cmdutil.files(ui, ctx, m, fm, fmt, subrepos) |
|
1021 | 1048 | |
|
1022 | 1049 | @annotatesubrepoerror |
|
1023 | 1050 | def getfileset(self, expr): |
|
1024 | 1051 | if self._ctx.rev() is None: |
|
1025 | 1052 | ctx = self._repo[None] |
|
1026 | 1053 | else: |
|
1027 | 1054 | rev = self._state[1] |
|
1028 | 1055 | ctx = self._repo[rev] |
|
1029 | 1056 | |
|
1030 | 1057 | files = ctx.getfileset(expr) |
|
1031 | 1058 | |
|
1032 | 1059 | for subpath in ctx.substate: |
|
1033 | 1060 | sub = ctx.sub(subpath) |
|
1034 | 1061 | |
|
1035 | 1062 | try: |
|
1036 | 1063 | files.extend(subpath + '/' + f for f in sub.getfileset(expr)) |
|
1037 | 1064 | except error.LookupError: |
|
1038 | 1065 | self.ui.status(_("skipping missing subrepository: %s\n") |
|
1039 | 1066 | % self.wvfs.reljoin(reporelpath(self), subpath)) |
|
1040 | 1067 | return files |
|
1041 | 1068 | |
|
1042 | 1069 | def walk(self, match): |
|
1043 | 1070 | ctx = self._repo[None] |
|
1044 | 1071 | return ctx.walk(match) |
|
1045 | 1072 | |
|
1046 | 1073 | @annotatesubrepoerror |
|
1047 | 1074 | def forget(self, match, prefix): |
|
1048 | 1075 | return cmdutil.forget(self.ui, self._repo, match, |
|
1049 | 1076 | self.wvfs.reljoin(prefix, self._path), True) |
|
1050 | 1077 | |
|
1051 | 1078 | @annotatesubrepoerror |
|
1052 | 1079 | def removefiles(self, matcher, prefix, after, force, subrepos, warnings): |
|
1053 | 1080 | return cmdutil.remove(self.ui, self._repo, matcher, |
|
1054 | 1081 | self.wvfs.reljoin(prefix, self._path), |
|
1055 | 1082 | after, force, subrepos) |
|
1056 | 1083 | |
|
1057 | 1084 | @annotatesubrepoerror |
|
1058 | 1085 | def revert(self, substate, *pats, **opts): |
|
1059 | 1086 | # reverting a subrepo is a 2 step process: |
|
1060 | 1087 | # 1. if the no_backup is not set, revert all modified |
|
1061 | 1088 | # files inside the subrepo |
|
1062 | 1089 | # 2. update the subrepo to the revision specified in |
|
1063 | 1090 | # the corresponding substate dictionary |
|
1064 | 1091 | self.ui.status(_('reverting subrepo %s\n') % substate[0]) |
|
1065 | 1092 | if not opts.get('no_backup'): |
|
1066 | 1093 | # Revert all files on the subrepo, creating backups |
|
1067 | 1094 | # Note that this will not recursively revert subrepos |
|
1068 | 1095 | # We could do it if there was a set:subrepos() predicate |
|
1069 | 1096 | opts = opts.copy() |
|
1070 | 1097 | opts['date'] = None |
|
1071 | 1098 | opts['rev'] = substate[1] |
|
1072 | 1099 | |
|
1073 | 1100 | self.filerevert(*pats, **opts) |
|
1074 | 1101 | |
|
1075 | 1102 | # Update the repo to the revision specified in the given substate |
|
1076 | 1103 | if not opts.get('dry_run'): |
|
1077 | 1104 | self.get(substate, overwrite=True) |
|
1078 | 1105 | |
|
1079 | 1106 | def filerevert(self, *pats, **opts): |
|
1080 | 1107 | ctx = self._repo[opts['rev']] |
|
1081 | 1108 | parents = self._repo.dirstate.parents() |
|
1082 | 1109 | if opts.get('all'): |
|
1083 | 1110 | pats = ['set:modified()'] |
|
1084 | 1111 | else: |
|
1085 | 1112 | pats = [] |
|
1086 | 1113 | cmdutil.revert(self.ui, self._repo, ctx, parents, *pats, **opts) |
|
1087 | 1114 | |
|
1088 | 1115 | def shortid(self, revid): |
|
1089 | 1116 | return revid[:12] |
|
1090 | 1117 | |
|
1091 | 1118 | @annotatesubrepoerror |
|
1092 | 1119 | def unshare(self): |
|
1093 | 1120 | # subrepo inherently violates our import layering rules |
|
1094 | 1121 | # because it wants to make repo objects from deep inside the stack |
|
1095 | 1122 | # so we manually delay the circular imports to not break |
|
1096 | 1123 | # scripts that don't use our demand-loading |
|
1097 | 1124 | global hg |
|
1098 | 1125 | from . import hg as h |
|
1099 | 1126 | hg = h |
|
1100 | 1127 | |
|
1101 | 1128 | # Nothing prevents a user from sharing in a repo, and then making that a |
|
1102 | 1129 | # subrepo. Alternately, the previous unshare attempt may have failed |
|
1103 | 1130 | # part way through. So recurse whether or not this layer is shared. |
|
1104 | 1131 | if self._repo.shared(): |
|
1105 | 1132 | self.ui.status(_("unsharing subrepo '%s'\n") % self._relpath) |
|
1106 | 1133 | |
|
1107 | 1134 | hg.unshare(self.ui, self._repo) |
|
1108 | 1135 | |
|
1109 | 1136 | def verify(self): |
|
1110 | 1137 | try: |
|
1111 | 1138 | rev = self._state[1] |
|
1112 | 1139 | ctx = self._repo.unfiltered()[rev] |
|
1113 | 1140 | if ctx.hidden(): |
|
1114 | 1141 | # Since hidden revisions aren't pushed/pulled, it seems worth an |
|
1115 | 1142 | # explicit warning. |
|
1116 | 1143 | ui = self._repo.ui |
|
1117 | 1144 | ui.warn(_("subrepo '%s' is hidden in revision %s\n") % |
|
1118 | 1145 | (self._relpath, node.short(self._ctx.node()))) |
|
1119 | 1146 | return 0 |
|
1120 | 1147 | except error.RepoLookupError: |
|
1121 | 1148 | # A missing subrepo revision may be a case of needing to pull it, so |
|
1122 | 1149 | # don't treat this as an error. |
|
1123 | 1150 | self._repo.ui.warn(_("subrepo '%s' not found in revision %s\n") % |
|
1124 | 1151 | (self._relpath, node.short(self._ctx.node()))) |
|
1125 | 1152 | return 0 |
|
1126 | 1153 | |
|
1127 | 1154 | @propertycache |
|
1128 | 1155 | def wvfs(self): |
|
1129 | 1156 | """return own wvfs for efficiency and consistency |
|
1130 | 1157 | """ |
|
1131 | 1158 | return self._repo.wvfs |
|
1132 | 1159 | |
|
1133 | 1160 | @propertycache |
|
1134 | 1161 | def _relpath(self): |
|
1135 | 1162 | """return path to this subrepository as seen from outermost repository |
|
1136 | 1163 | """ |
|
1137 | 1164 | # Keep consistent dir separators by avoiding vfs.join(self._path) |
|
1138 | 1165 | return reporelpath(self._repo) |
|
1139 | 1166 | |
|
1140 | 1167 | class svnsubrepo(abstractsubrepo): |
|
1141 | 1168 | def __init__(self, ctx, path, state, allowcreate): |
|
1142 | 1169 | super(svnsubrepo, self).__init__(ctx, path) |
|
1143 | 1170 | self._state = state |
|
1144 | 1171 | self._exe = util.findexe('svn') |
|
1145 | 1172 | if not self._exe: |
|
1146 | 1173 | raise error.Abort(_("'svn' executable not found for subrepo '%s'") |
|
1147 | 1174 | % self._path) |
|
1148 | 1175 | |
|
1149 | 1176 | def _svncommand(self, commands, filename='', failok=False): |
|
1150 | 1177 | cmd = [self._exe] |
|
1151 | 1178 | extrakw = {} |
|
1152 | 1179 | if not self.ui.interactive(): |
|
1153 | 1180 | # Making stdin be a pipe should prevent svn from behaving |
|
1154 | 1181 | # interactively even if we can't pass --non-interactive. |
|
1155 | 1182 | extrakw['stdin'] = subprocess.PIPE |
|
1156 | 1183 | # Starting in svn 1.5 --non-interactive is a global flag |
|
1157 | 1184 | # instead of being per-command, but we need to support 1.4 so |
|
1158 | 1185 | # we have to be intelligent about what commands take |
|
1159 | 1186 | # --non-interactive. |
|
1160 | 1187 | if commands[0] in ('update', 'checkout', 'commit'): |
|
1161 | 1188 | cmd.append('--non-interactive') |
|
1162 | 1189 | cmd.extend(commands) |
|
1163 | 1190 | if filename is not None: |
|
1164 | 1191 | path = self.wvfs.reljoin(self._ctx.repo().origroot, |
|
1165 | 1192 | self._path, filename) |
|
1166 | 1193 | cmd.append(path) |
|
1167 | 1194 | env = dict(encoding.environ) |
|
1168 | 1195 | # Avoid localized output, preserve current locale for everything else. |
|
1169 | 1196 | lc_all = env.get('LC_ALL') |
|
1170 | 1197 | if lc_all: |
|
1171 | 1198 | env['LANG'] = lc_all |
|
1172 | 1199 | del env['LC_ALL'] |
|
1173 | 1200 | env['LC_MESSAGES'] = 'C' |
|
1174 | 1201 | p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds, |
|
1175 | 1202 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
|
1176 | 1203 | universal_newlines=True, env=env, **extrakw) |
|
1177 | 1204 | stdout, stderr = p.communicate() |
|
1178 | 1205 | stderr = stderr.strip() |
|
1179 | 1206 | if not failok: |
|
1180 | 1207 | if p.returncode: |
|
1181 | 1208 | raise error.Abort(stderr or 'exited with code %d' |
|
1182 | 1209 | % p.returncode) |
|
1183 | 1210 | if stderr: |
|
1184 | 1211 | self.ui.warn(stderr + '\n') |
|
1185 | 1212 | return stdout, stderr |
|
1186 | 1213 | |
|
1187 | 1214 | @propertycache |
|
1188 | 1215 | def _svnversion(self): |
|
1189 | 1216 | output, err = self._svncommand(['--version', '--quiet'], filename=None) |
|
1190 | 1217 | m = re.search(br'^(\d+)\.(\d+)', output) |
|
1191 | 1218 | if not m: |
|
1192 | 1219 | raise error.Abort(_('cannot retrieve svn tool version')) |
|
1193 | 1220 | return (int(m.group(1)), int(m.group(2))) |
|
1194 | 1221 | |
|
1195 | 1222 | def _wcrevs(self): |
|
1196 | 1223 | # Get the working directory revision as well as the last |
|
1197 | 1224 | # commit revision so we can compare the subrepo state with |
|
1198 | 1225 | # both. We used to store the working directory one. |
|
1199 | 1226 | output, err = self._svncommand(['info', '--xml']) |
|
1200 | 1227 | doc = xml.dom.minidom.parseString(output) |
|
1201 | 1228 | entries = doc.getElementsByTagName('entry') |
|
1202 | 1229 | lastrev, rev = '0', '0' |
|
1203 | 1230 | if entries: |
|
1204 | 1231 | rev = str(entries[0].getAttribute('revision')) or '0' |
|
1205 | 1232 | commits = entries[0].getElementsByTagName('commit') |
|
1206 | 1233 | if commits: |
|
1207 | 1234 | lastrev = str(commits[0].getAttribute('revision')) or '0' |
|
1208 | 1235 | return (lastrev, rev) |
|
1209 | 1236 | |
|
1210 | 1237 | def _wcrev(self): |
|
1211 | 1238 | return self._wcrevs()[0] |
|
1212 | 1239 | |
|
1213 | 1240 | def _wcchanged(self): |
|
1214 | 1241 | """Return (changes, extchanges, missing) where changes is True |
|
1215 | 1242 | if the working directory was changed, extchanges is |
|
1216 | 1243 | True if any of these changes concern an external entry and missing |
|
1217 | 1244 | is True if any change is a missing entry. |
|
1218 | 1245 | """ |
|
1219 | 1246 | output, err = self._svncommand(['status', '--xml']) |
|
1220 | 1247 | externals, changes, missing = [], [], [] |
|
1221 | 1248 | doc = xml.dom.minidom.parseString(output) |
|
1222 | 1249 | for e in doc.getElementsByTagName('entry'): |
|
1223 | 1250 | s = e.getElementsByTagName('wc-status') |
|
1224 | 1251 | if not s: |
|
1225 | 1252 | continue |
|
1226 | 1253 | item = s[0].getAttribute('item') |
|
1227 | 1254 | props = s[0].getAttribute('props') |
|
1228 | 1255 | path = e.getAttribute('path') |
|
1229 | 1256 | if item == 'external': |
|
1230 | 1257 | externals.append(path) |
|
1231 | 1258 | elif item == 'missing': |
|
1232 | 1259 | missing.append(path) |
|
1233 | 1260 | if (item not in ('', 'normal', 'unversioned', 'external') |
|
1234 | 1261 | or props not in ('', 'none', 'normal')): |
|
1235 | 1262 | changes.append(path) |
|
1236 | 1263 | for path in changes: |
|
1237 | 1264 | for ext in externals: |
|
1238 | 1265 | if path == ext or path.startswith(ext + pycompat.ossep): |
|
1239 | 1266 | return True, True, bool(missing) |
|
1240 | 1267 | return bool(changes), False, bool(missing) |
|
1241 | 1268 | |
|
1242 | 1269 | def dirty(self, ignoreupdate=False, missing=False): |
|
1243 | 1270 | wcchanged = self._wcchanged() |
|
1244 | 1271 | changed = wcchanged[0] or (missing and wcchanged[2]) |
|
1245 | 1272 | if not changed: |
|
1246 | 1273 | if self._state[1] in self._wcrevs() or ignoreupdate: |
|
1247 | 1274 | return False |
|
1248 | 1275 | return True |
|
1249 | 1276 | |
|
1250 | 1277 | def basestate(self): |
|
1251 | 1278 | lastrev, rev = self._wcrevs() |
|
1252 | 1279 | if lastrev != rev: |
|
1253 | 1280 | # Last committed rev is not the same than rev. We would |
|
1254 | 1281 | # like to take lastrev but we do not know if the subrepo |
|
1255 | 1282 | # URL exists at lastrev. Test it and fallback to rev it |
|
1256 | 1283 | # is not there. |
|
1257 | 1284 | try: |
|
1258 | 1285 | self._svncommand(['list', '%s@%s' % (self._state[0], lastrev)]) |
|
1259 | 1286 | return lastrev |
|
1260 | 1287 | except error.Abort: |
|
1261 | 1288 | pass |
|
1262 | 1289 | return rev |
|
1263 | 1290 | |
|
1264 | 1291 | @annotatesubrepoerror |
|
1265 | 1292 | def commit(self, text, user, date): |
|
1266 | 1293 | # user and date are out of our hands since svn is centralized |
|
1267 | 1294 | changed, extchanged, missing = self._wcchanged() |
|
1268 | 1295 | if not changed: |
|
1269 | 1296 | return self.basestate() |
|
1270 | 1297 | if extchanged: |
|
1271 | 1298 | # Do not try to commit externals |
|
1272 | 1299 | raise error.Abort(_('cannot commit svn externals')) |
|
1273 | 1300 | if missing: |
|
1274 | 1301 | # svn can commit with missing entries but aborting like hg |
|
1275 | 1302 | # seems a better approach. |
|
1276 | 1303 | raise error.Abort(_('cannot commit missing svn entries')) |
|
1277 | 1304 | commitinfo, err = self._svncommand(['commit', '-m', text]) |
|
1278 | 1305 | self.ui.status(commitinfo) |
|
1279 | 1306 | newrev = re.search('Committed revision ([0-9]+).', commitinfo) |
|
1280 | 1307 | if not newrev: |
|
1281 | 1308 | if not commitinfo.strip(): |
|
1282 | 1309 | # Sometimes, our definition of "changed" differs from |
|
1283 | 1310 | # svn one. For instance, svn ignores missing files |
|
1284 | 1311 | # when committing. If there are only missing files, no |
|
1285 | 1312 | # commit is made, no output and no error code. |
|
1286 | 1313 | raise error.Abort(_('failed to commit svn changes')) |
|
1287 | 1314 | raise error.Abort(commitinfo.splitlines()[-1]) |
|
1288 | 1315 | newrev = newrev.groups()[0] |
|
1289 | 1316 | self.ui.status(self._svncommand(['update', '-r', newrev])[0]) |
|
1290 | 1317 | return newrev |
|
1291 | 1318 | |
|
1292 | 1319 | @annotatesubrepoerror |
|
1293 | 1320 | def remove(self): |
|
1294 | 1321 | if self.dirty(): |
|
1295 | 1322 | self.ui.warn(_('not removing repo %s because ' |
|
1296 | 1323 | 'it has changes.\n') % self._path) |
|
1297 | 1324 | return |
|
1298 | 1325 | self.ui.note(_('removing subrepo %s\n') % self._path) |
|
1299 | 1326 | |
|
1300 | 1327 | self.wvfs.rmtree(forcibly=True) |
|
1301 | 1328 | try: |
|
1302 | 1329 | pwvfs = self._ctx.repo().wvfs |
|
1303 | 1330 | pwvfs.removedirs(pwvfs.dirname(self._path)) |
|
1304 | 1331 | except OSError: |
|
1305 | 1332 | pass |
|
1306 | 1333 | |
|
1307 | 1334 | @annotatesubrepoerror |
|
1308 | 1335 | def get(self, state, overwrite=False): |
|
1309 | 1336 | if overwrite: |
|
1310 | 1337 | self._svncommand(['revert', '--recursive']) |
|
1311 | 1338 | args = ['checkout'] |
|
1312 | 1339 | if self._svnversion >= (1, 5): |
|
1313 | 1340 | args.append('--force') |
|
1314 | 1341 | # The revision must be specified at the end of the URL to properly |
|
1315 | 1342 | # update to a directory which has since been deleted and recreated. |
|
1316 | 1343 | args.append('%s@%s' % (state[0], state[1])) |
|
1317 | 1344 | |
|
1318 | 1345 | # SEC: check that the ssh url is safe |
|
1319 | 1346 | util.checksafessh(state[0]) |
|
1320 | 1347 | |
|
1321 | 1348 | status, err = self._svncommand(args, failok=True) |
|
1322 | 1349 | _sanitize(self.ui, self.wvfs, '.svn') |
|
1323 | 1350 | if not re.search('Checked out revision [0-9]+.', status): |
|
1324 | 1351 | if ('is already a working copy for a different URL' in err |
|
1325 | 1352 | and (self._wcchanged()[:2] == (False, False))): |
|
1326 | 1353 | # obstructed but clean working copy, so just blow it away. |
|
1327 | 1354 | self.remove() |
|
1328 | 1355 | self.get(state, overwrite=False) |
|
1329 | 1356 | return |
|
1330 | 1357 | raise error.Abort((status or err).splitlines()[-1]) |
|
1331 | 1358 | self.ui.status(status) |
|
1332 | 1359 | |
|
1333 | 1360 | @annotatesubrepoerror |
|
1334 | 1361 | def merge(self, state): |
|
1335 | 1362 | old = self._state[1] |
|
1336 | 1363 | new = state[1] |
|
1337 | 1364 | wcrev = self._wcrev() |
|
1338 | 1365 | if new != wcrev: |
|
1339 | 1366 | dirty = old == wcrev or self._wcchanged()[0] |
|
1340 | 1367 | if _updateprompt(self.ui, self, dirty, wcrev, new): |
|
1341 | 1368 | self.get(state, False) |
|
1342 | 1369 | |
|
1343 | 1370 | def push(self, opts): |
|
1344 | 1371 | # push is a no-op for SVN |
|
1345 | 1372 | return True |
|
1346 | 1373 | |
|
1347 | 1374 | @annotatesubrepoerror |
|
1348 | 1375 | def files(self): |
|
1349 | 1376 | output = self._svncommand(['list', '--recursive', '--xml'])[0] |
|
1350 | 1377 | doc = xml.dom.minidom.parseString(output) |
|
1351 | 1378 | paths = [] |
|
1352 | 1379 | for e in doc.getElementsByTagName('entry'): |
|
1353 | 1380 | kind = str(e.getAttribute('kind')) |
|
1354 | 1381 | if kind != 'file': |
|
1355 | 1382 | continue |
|
1356 | 1383 | name = ''.join(c.data for c |
|
1357 | 1384 | in e.getElementsByTagName('name')[0].childNodes |
|
1358 | 1385 | if c.nodeType == c.TEXT_NODE) |
|
1359 | 1386 | paths.append(name.encode('utf-8')) |
|
1360 | 1387 | return paths |
|
1361 | 1388 | |
|
1362 | 1389 | def filedata(self, name, decode): |
|
1363 | 1390 | return self._svncommand(['cat'], name)[0] |
|
1364 | 1391 | |
|
1365 | 1392 | |
|
1366 | 1393 | class gitsubrepo(abstractsubrepo): |
|
1367 | 1394 | def __init__(self, ctx, path, state, allowcreate): |
|
1368 | 1395 | super(gitsubrepo, self).__init__(ctx, path) |
|
1369 | 1396 | self._state = state |
|
1370 | 1397 | self._abspath = ctx.repo().wjoin(path) |
|
1371 | 1398 | self._subparent = ctx.repo() |
|
1372 | 1399 | self._ensuregit() |
|
1373 | 1400 | |
|
1374 | 1401 | def _ensuregit(self): |
|
1375 | 1402 | try: |
|
1376 | 1403 | self._gitexecutable = 'git' |
|
1377 | 1404 | out, err = self._gitnodir(['--version']) |
|
1378 | 1405 | except OSError as e: |
|
1379 | 1406 | genericerror = _("error executing git for subrepo '%s': %s") |
|
1380 | 1407 | notfoundhint = _("check git is installed and in your PATH") |
|
1381 | 1408 | if e.errno != errno.ENOENT: |
|
1382 | 1409 | raise error.Abort(genericerror % ( |
|
1383 | 1410 | self._path, encoding.strtolocal(e.strerror))) |
|
1384 | 1411 | elif pycompat.iswindows: |
|
1385 | 1412 | try: |
|
1386 | 1413 | self._gitexecutable = 'git.cmd' |
|
1387 | 1414 | out, err = self._gitnodir(['--version']) |
|
1388 | 1415 | except OSError as e2: |
|
1389 | 1416 | if e2.errno == errno.ENOENT: |
|
1390 | 1417 | raise error.Abort(_("couldn't find 'git' or 'git.cmd'" |
|
1391 | 1418 | " for subrepo '%s'") % self._path, |
|
1392 | 1419 | hint=notfoundhint) |
|
1393 | 1420 | else: |
|
1394 | 1421 | raise error.Abort(genericerror % (self._path, |
|
1395 | 1422 | encoding.strtolocal(e2.strerror))) |
|
1396 | 1423 | else: |
|
1397 | 1424 | raise error.Abort(_("couldn't find git for subrepo '%s'") |
|
1398 | 1425 | % self._path, hint=notfoundhint) |
|
1399 | 1426 | versionstatus = self._checkversion(out) |
|
1400 | 1427 | if versionstatus == 'unknown': |
|
1401 | 1428 | self.ui.warn(_('cannot retrieve git version\n')) |
|
1402 | 1429 | elif versionstatus == 'abort': |
|
1403 | 1430 | raise error.Abort(_('git subrepo requires at least 1.6.0 or later')) |
|
1404 | 1431 | elif versionstatus == 'warning': |
|
1405 | 1432 | self.ui.warn(_('git subrepo requires at least 1.6.0 or later\n')) |
|
1406 | 1433 | |
|
1407 | 1434 | @staticmethod |
|
1408 | 1435 | def _gitversion(out): |
|
1409 | 1436 | m = re.search(br'^git version (\d+)\.(\d+)\.(\d+)', out) |
|
1410 | 1437 | if m: |
|
1411 | 1438 | return (int(m.group(1)), int(m.group(2)), int(m.group(3))) |
|
1412 | 1439 | |
|
1413 | 1440 | m = re.search(br'^git version (\d+)\.(\d+)', out) |
|
1414 | 1441 | if m: |
|
1415 | 1442 | return (int(m.group(1)), int(m.group(2)), 0) |
|
1416 | 1443 | |
|
1417 | 1444 | return -1 |
|
1418 | 1445 | |
|
1419 | 1446 | @staticmethod |
|
1420 | 1447 | def _checkversion(out): |
|
1421 | 1448 | '''ensure git version is new enough |
|
1422 | 1449 | |
|
1423 | 1450 | >>> _checkversion = gitsubrepo._checkversion |
|
1424 | 1451 | >>> _checkversion(b'git version 1.6.0') |
|
1425 | 1452 | 'ok' |
|
1426 | 1453 | >>> _checkversion(b'git version 1.8.5') |
|
1427 | 1454 | 'ok' |
|
1428 | 1455 | >>> _checkversion(b'git version 1.4.0') |
|
1429 | 1456 | 'abort' |
|
1430 | 1457 | >>> _checkversion(b'git version 1.5.0') |
|
1431 | 1458 | 'warning' |
|
1432 | 1459 | >>> _checkversion(b'git version 1.9-rc0') |
|
1433 | 1460 | 'ok' |
|
1434 | 1461 | >>> _checkversion(b'git version 1.9.0.265.g81cdec2') |
|
1435 | 1462 | 'ok' |
|
1436 | 1463 | >>> _checkversion(b'git version 1.9.0.GIT') |
|
1437 | 1464 | 'ok' |
|
1438 | 1465 | >>> _checkversion(b'git version 12345') |
|
1439 | 1466 | 'unknown' |
|
1440 | 1467 | >>> _checkversion(b'no') |
|
1441 | 1468 | 'unknown' |
|
1442 | 1469 | ''' |
|
1443 | 1470 | version = gitsubrepo._gitversion(out) |
|
1444 | 1471 | # git 1.4.0 can't work at all, but 1.5.X can in at least some cases, |
|
1445 | 1472 | # despite the docstring comment. For now, error on 1.4.0, warn on |
|
1446 | 1473 | # 1.5.0 but attempt to continue. |
|
1447 | 1474 | if version == -1: |
|
1448 | 1475 | return 'unknown' |
|
1449 | 1476 | if version < (1, 5, 0): |
|
1450 | 1477 | return 'abort' |
|
1451 | 1478 | elif version < (1, 6, 0): |
|
1452 | 1479 | return 'warning' |
|
1453 | 1480 | return 'ok' |
|
1454 | 1481 | |
|
1455 | 1482 | def _gitcommand(self, commands, env=None, stream=False): |
|
1456 | 1483 | return self._gitdir(commands, env=env, stream=stream)[0] |
|
1457 | 1484 | |
|
1458 | 1485 | def _gitdir(self, commands, env=None, stream=False): |
|
1459 | 1486 | return self._gitnodir(commands, env=env, stream=stream, |
|
1460 | 1487 | cwd=self._abspath) |
|
1461 | 1488 | |
|
1462 | 1489 | def _gitnodir(self, commands, env=None, stream=False, cwd=None): |
|
1463 | 1490 | """Calls the git command |
|
1464 | 1491 | |
|
1465 | 1492 | The methods tries to call the git command. versions prior to 1.6.0 |
|
1466 | 1493 | are not supported and very probably fail. |
|
1467 | 1494 | """ |
|
1468 | 1495 | self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands))) |
|
1469 | 1496 | if env is None: |
|
1470 | 1497 | env = encoding.environ.copy() |
|
1471 | 1498 | # disable localization for Git output (issue5176) |
|
1472 | 1499 | env['LC_ALL'] = 'C' |
|
1473 | 1500 | # fix for Git CVE-2015-7545 |
|
1474 | 1501 | if 'GIT_ALLOW_PROTOCOL' not in env: |
|
1475 | 1502 | env['GIT_ALLOW_PROTOCOL'] = 'file:git:http:https:ssh' |
|
1476 | 1503 | # unless ui.quiet is set, print git's stderr, |
|
1477 | 1504 | # which is mostly progress and useful info |
|
1478 | 1505 | errpipe = None |
|
1479 | 1506 | if self.ui.quiet: |
|
1480 | 1507 | errpipe = open(os.devnull, 'w') |
|
1481 | 1508 | if self.ui._colormode and len(commands) and commands[0] == "diff": |
|
1482 | 1509 | # insert the argument in the front, |
|
1483 | 1510 | # the end of git diff arguments is used for paths |
|
1484 | 1511 | commands.insert(1, '--color') |
|
1485 | 1512 | p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1, |
|
1486 | 1513 | cwd=cwd, env=env, close_fds=util.closefds, |
|
1487 | 1514 | stdout=subprocess.PIPE, stderr=errpipe) |
|
1488 | 1515 | if stream: |
|
1489 | 1516 | return p.stdout, None |
|
1490 | 1517 | |
|
1491 | 1518 | retdata = p.stdout.read().strip() |
|
1492 | 1519 | # wait for the child to exit to avoid race condition. |
|
1493 | 1520 | p.wait() |
|
1494 | 1521 | |
|
1495 | 1522 | if p.returncode != 0 and p.returncode != 1: |
|
1496 | 1523 | # there are certain error codes that are ok |
|
1497 | 1524 | command = commands[0] |
|
1498 | 1525 | if command in ('cat-file', 'symbolic-ref'): |
|
1499 | 1526 | return retdata, p.returncode |
|
1500 | 1527 | # for all others, abort |
|
1501 | 1528 | raise error.Abort(_('git %s error %d in %s') % |
|
1502 | 1529 | (command, p.returncode, self._relpath)) |
|
1503 | 1530 | |
|
1504 | 1531 | return retdata, p.returncode |
|
1505 | 1532 | |
|
1506 | 1533 | def _gitmissing(self): |
|
1507 | 1534 | return not self.wvfs.exists('.git') |
|
1508 | 1535 | |
|
1509 | 1536 | def _gitstate(self): |
|
1510 | 1537 | return self._gitcommand(['rev-parse', 'HEAD']) |
|
1511 | 1538 | |
|
1512 | 1539 | def _gitcurrentbranch(self): |
|
1513 | 1540 | current, err = self._gitdir(['symbolic-ref', 'HEAD', '--quiet']) |
|
1514 | 1541 | if err: |
|
1515 | 1542 | current = None |
|
1516 | 1543 | return current |
|
1517 | 1544 | |
|
1518 | 1545 | def _gitremote(self, remote): |
|
1519 | 1546 | out = self._gitcommand(['remote', 'show', '-n', remote]) |
|
1520 | 1547 | line = out.split('\n')[1] |
|
1521 | 1548 | i = line.index('URL: ') + len('URL: ') |
|
1522 | 1549 | return line[i:] |
|
1523 | 1550 | |
|
1524 | 1551 | def _githavelocally(self, revision): |
|
1525 | 1552 | out, code = self._gitdir(['cat-file', '-e', revision]) |
|
1526 | 1553 | return code == 0 |
|
1527 | 1554 | |
|
1528 | 1555 | def _gitisancestor(self, r1, r2): |
|
1529 | 1556 | base = self._gitcommand(['merge-base', r1, r2]) |
|
1530 | 1557 | return base == r1 |
|
1531 | 1558 | |
|
1532 | 1559 | def _gitisbare(self): |
|
1533 | 1560 | return self._gitcommand(['config', '--bool', 'core.bare']) == 'true' |
|
1534 | 1561 | |
|
1535 | 1562 | def _gitupdatestat(self): |
|
1536 | 1563 | """This must be run before git diff-index. |
|
1537 | 1564 | diff-index only looks at changes to file stat; |
|
1538 | 1565 | this command looks at file contents and updates the stat.""" |
|
1539 | 1566 | self._gitcommand(['update-index', '-q', '--refresh']) |
|
1540 | 1567 | |
|
1541 | 1568 | def _gitbranchmap(self): |
|
1542 | 1569 | '''returns 2 things: |
|
1543 | 1570 | a map from git branch to revision |
|
1544 | 1571 | a map from revision to branches''' |
|
1545 | 1572 | branch2rev = {} |
|
1546 | 1573 | rev2branch = {} |
|
1547 | 1574 | |
|
1548 | 1575 | out = self._gitcommand(['for-each-ref', '--format', |
|
1549 | 1576 | '%(objectname) %(refname)']) |
|
1550 | 1577 | for line in out.split('\n'): |
|
1551 | 1578 | revision, ref = line.split(' ') |
|
1552 | 1579 | if (not ref.startswith('refs/heads/') and |
|
1553 | 1580 | not ref.startswith('refs/remotes/')): |
|
1554 | 1581 | continue |
|
1555 | 1582 | if ref.startswith('refs/remotes/') and ref.endswith('/HEAD'): |
|
1556 | 1583 | continue # ignore remote/HEAD redirects |
|
1557 | 1584 | branch2rev[ref] = revision |
|
1558 | 1585 | rev2branch.setdefault(revision, []).append(ref) |
|
1559 | 1586 | return branch2rev, rev2branch |
|
1560 | 1587 | |
|
1561 | 1588 | def _gittracking(self, branches): |
|
1562 | 1589 | 'return map of remote branch to local tracking branch' |
|
1563 | 1590 | # assumes no more than one local tracking branch for each remote |
|
1564 | 1591 | tracking = {} |
|
1565 | 1592 | for b in branches: |
|
1566 | 1593 | if b.startswith('refs/remotes/'): |
|
1567 | 1594 | continue |
|
1568 | 1595 | bname = b.split('/', 2)[2] |
|
1569 | 1596 | remote = self._gitcommand(['config', 'branch.%s.remote' % bname]) |
|
1570 | 1597 | if remote: |
|
1571 | 1598 | ref = self._gitcommand(['config', 'branch.%s.merge' % bname]) |
|
1572 | 1599 | tracking['refs/remotes/%s/%s' % |
|
1573 | 1600 | (remote, ref.split('/', 2)[2])] = b |
|
1574 | 1601 | return tracking |
|
1575 | 1602 | |
|
1576 | 1603 | def _abssource(self, source): |
|
1577 | 1604 | if '://' not in source: |
|
1578 | 1605 | # recognize the scp syntax as an absolute source |
|
1579 | 1606 | colon = source.find(':') |
|
1580 | 1607 | if colon != -1 and '/' not in source[:colon]: |
|
1581 | 1608 | return source |
|
1582 | 1609 | self._subsource = source |
|
1583 | 1610 | return _abssource(self) |
|
1584 | 1611 | |
|
1585 | 1612 | def _fetch(self, source, revision): |
|
1586 | 1613 | if self._gitmissing(): |
|
1587 | 1614 | # SEC: check for safe ssh url |
|
1588 | 1615 | util.checksafessh(source) |
|
1589 | 1616 | |
|
1590 | 1617 | source = self._abssource(source) |
|
1591 | 1618 | self.ui.status(_('cloning subrepo %s from %s\n') % |
|
1592 | 1619 | (self._relpath, source)) |
|
1593 | 1620 | self._gitnodir(['clone', source, self._abspath]) |
|
1594 | 1621 | if self._githavelocally(revision): |
|
1595 | 1622 | return |
|
1596 | 1623 | self.ui.status(_('pulling subrepo %s from %s\n') % |
|
1597 | 1624 | (self._relpath, self._gitremote('origin'))) |
|
1598 | 1625 | # try only origin: the originally cloned repo |
|
1599 | 1626 | self._gitcommand(['fetch']) |
|
1600 | 1627 | if not self._githavelocally(revision): |
|
1601 | 1628 | raise error.Abort(_('revision %s does not exist in subrepository ' |
|
1602 | 1629 | '"%s"\n') % (revision, self._relpath)) |
|
1603 | 1630 | |
|
1604 | 1631 | @annotatesubrepoerror |
|
1605 | 1632 | def dirty(self, ignoreupdate=False, missing=False): |
|
1606 | 1633 | if self._gitmissing(): |
|
1607 | 1634 | return self._state[1] != '' |
|
1608 | 1635 | if self._gitisbare(): |
|
1609 | 1636 | return True |
|
1610 | 1637 | if not ignoreupdate and self._state[1] != self._gitstate(): |
|
1611 | 1638 | # different version checked out |
|
1612 | 1639 | return True |
|
1613 | 1640 | # check for staged changes or modified files; ignore untracked files |
|
1614 | 1641 | self._gitupdatestat() |
|
1615 | 1642 | out, code = self._gitdir(['diff-index', '--quiet', 'HEAD']) |
|
1616 | 1643 | return code == 1 |
|
1617 | 1644 | |
|
1618 | 1645 | def basestate(self): |
|
1619 | 1646 | return self._gitstate() |
|
1620 | 1647 | |
|
1621 | 1648 | @annotatesubrepoerror |
|
1622 | 1649 | def get(self, state, overwrite=False): |
|
1623 | 1650 | source, revision, kind = state |
|
1624 | 1651 | if not revision: |
|
1625 | 1652 | self.remove() |
|
1626 | 1653 | return |
|
1627 | 1654 | self._fetch(source, revision) |
|
1628 | 1655 | # if the repo was set to be bare, unbare it |
|
1629 | 1656 | if self._gitisbare(): |
|
1630 | 1657 | self._gitcommand(['config', 'core.bare', 'false']) |
|
1631 | 1658 | if self._gitstate() == revision: |
|
1632 | 1659 | self._gitcommand(['reset', '--hard', 'HEAD']) |
|
1633 | 1660 | return |
|
1634 | 1661 | elif self._gitstate() == revision: |
|
1635 | 1662 | if overwrite: |
|
1636 | 1663 | # first reset the index to unmark new files for commit, because |
|
1637 | 1664 | # reset --hard will otherwise throw away files added for commit, |
|
1638 | 1665 | # not just unmark them. |
|
1639 | 1666 | self._gitcommand(['reset', 'HEAD']) |
|
1640 | 1667 | self._gitcommand(['reset', '--hard', 'HEAD']) |
|
1641 | 1668 | return |
|
1642 | 1669 | branch2rev, rev2branch = self._gitbranchmap() |
|
1643 | 1670 | |
|
1644 | 1671 | def checkout(args): |
|
1645 | 1672 | cmd = ['checkout'] |
|
1646 | 1673 | if overwrite: |
|
1647 | 1674 | # first reset the index to unmark new files for commit, because |
|
1648 | 1675 | # the -f option will otherwise throw away files added for |
|
1649 | 1676 | # commit, not just unmark them. |
|
1650 | 1677 | self._gitcommand(['reset', 'HEAD']) |
|
1651 | 1678 | cmd.append('-f') |
|
1652 | 1679 | self._gitcommand(cmd + args) |
|
1653 | 1680 | _sanitize(self.ui, self.wvfs, '.git') |
|
1654 | 1681 | |
|
1655 | 1682 | def rawcheckout(): |
|
1656 | 1683 | # no branch to checkout, check it out with no branch |
|
1657 | 1684 | self.ui.warn(_('checking out detached HEAD in ' |
|
1658 | 1685 | 'subrepository "%s"\n') % self._relpath) |
|
1659 | 1686 | self.ui.warn(_('check out a git branch if you intend ' |
|
1660 | 1687 | 'to make changes\n')) |
|
1661 | 1688 | checkout(['-q', revision]) |
|
1662 | 1689 | |
|
1663 | 1690 | if revision not in rev2branch: |
|
1664 | 1691 | rawcheckout() |
|
1665 | 1692 | return |
|
1666 | 1693 | branches = rev2branch[revision] |
|
1667 | 1694 | firstlocalbranch = None |
|
1668 | 1695 | for b in branches: |
|
1669 | 1696 | if b == 'refs/heads/master': |
|
1670 | 1697 | # master trumps all other branches |
|
1671 | 1698 | checkout(['refs/heads/master']) |
|
1672 | 1699 | return |
|
1673 | 1700 | if not firstlocalbranch and not b.startswith('refs/remotes/'): |
|
1674 | 1701 | firstlocalbranch = b |
|
1675 | 1702 | if firstlocalbranch: |
|
1676 | 1703 | checkout([firstlocalbranch]) |
|
1677 | 1704 | return |
|
1678 | 1705 | |
|
1679 | 1706 | tracking = self._gittracking(branch2rev.keys()) |
|
1680 | 1707 | # choose a remote branch already tracked if possible |
|
1681 | 1708 | remote = branches[0] |
|
1682 | 1709 | if remote not in tracking: |
|
1683 | 1710 | for b in branches: |
|
1684 | 1711 | if b in tracking: |
|
1685 | 1712 | remote = b |
|
1686 | 1713 | break |
|
1687 | 1714 | |
|
1688 | 1715 | if remote not in tracking: |
|
1689 | 1716 | # create a new local tracking branch |
|
1690 | 1717 | local = remote.split('/', 3)[3] |
|
1691 | 1718 | checkout(['-b', local, remote]) |
|
1692 | 1719 | elif self._gitisancestor(branch2rev[tracking[remote]], remote): |
|
1693 | 1720 | # When updating to a tracked remote branch, |
|
1694 | 1721 | # if the local tracking branch is downstream of it, |
|
1695 | 1722 | # a normal `git pull` would have performed a "fast-forward merge" |
|
1696 | 1723 | # which is equivalent to updating the local branch to the remote. |
|
1697 | 1724 | # Since we are only looking at branching at update, we need to |
|
1698 | 1725 | # detect this situation and perform this action lazily. |
|
1699 | 1726 | if tracking[remote] != self._gitcurrentbranch(): |
|
1700 | 1727 | checkout([tracking[remote]]) |
|
1701 | 1728 | self._gitcommand(['merge', '--ff', remote]) |
|
1702 | 1729 | _sanitize(self.ui, self.wvfs, '.git') |
|
1703 | 1730 | else: |
|
1704 | 1731 | # a real merge would be required, just checkout the revision |
|
1705 | 1732 | rawcheckout() |
|
1706 | 1733 | |
|
1707 | 1734 | @annotatesubrepoerror |
|
1708 | 1735 | def commit(self, text, user, date): |
|
1709 | 1736 | if self._gitmissing(): |
|
1710 | 1737 | raise error.Abort(_("subrepo %s is missing") % self._relpath) |
|
1711 | 1738 | cmd = ['commit', '-a', '-m', text] |
|
1712 | 1739 | env = encoding.environ.copy() |
|
1713 | 1740 | if user: |
|
1714 | 1741 | cmd += ['--author', user] |
|
1715 | 1742 | if date: |
|
1716 | 1743 | # git's date parser silently ignores when seconds < 1e9 |
|
1717 | 1744 | # convert to ISO8601 |
|
1718 | 1745 | env['GIT_AUTHOR_DATE'] = util.datestr(date, |
|
1719 | 1746 | '%Y-%m-%dT%H:%M:%S %1%2') |
|
1720 | 1747 | self._gitcommand(cmd, env=env) |
|
1721 | 1748 | # make sure commit works otherwise HEAD might not exist under certain |
|
1722 | 1749 | # circumstances |
|
1723 | 1750 | return self._gitstate() |
|
1724 | 1751 | |
|
1725 | 1752 | @annotatesubrepoerror |
|
1726 | 1753 | def merge(self, state): |
|
1727 | 1754 | source, revision, kind = state |
|
1728 | 1755 | self._fetch(source, revision) |
|
1729 | 1756 | base = self._gitcommand(['merge-base', revision, self._state[1]]) |
|
1730 | 1757 | self._gitupdatestat() |
|
1731 | 1758 | out, code = self._gitdir(['diff-index', '--quiet', 'HEAD']) |
|
1732 | 1759 | |
|
1733 | 1760 | def mergefunc(): |
|
1734 | 1761 | if base == revision: |
|
1735 | 1762 | self.get(state) # fast forward merge |
|
1736 | 1763 | elif base != self._state[1]: |
|
1737 | 1764 | self._gitcommand(['merge', '--no-commit', revision]) |
|
1738 | 1765 | _sanitize(self.ui, self.wvfs, '.git') |
|
1739 | 1766 | |
|
1740 | 1767 | if self.dirty(): |
|
1741 | 1768 | if self._gitstate() != revision: |
|
1742 | 1769 | dirty = self._gitstate() == self._state[1] or code != 0 |
|
1743 | 1770 | if _updateprompt(self.ui, self, dirty, |
|
1744 | 1771 | self._state[1][:7], revision[:7]): |
|
1745 | 1772 | mergefunc() |
|
1746 | 1773 | else: |
|
1747 | 1774 | mergefunc() |
|
1748 | 1775 | |
|
1749 | 1776 | @annotatesubrepoerror |
|
1750 | 1777 | def push(self, opts): |
|
1751 | 1778 | force = opts.get('force') |
|
1752 | 1779 | |
|
1753 | 1780 | if not self._state[1]: |
|
1754 | 1781 | return True |
|
1755 | 1782 | if self._gitmissing(): |
|
1756 | 1783 | raise error.Abort(_("subrepo %s is missing") % self._relpath) |
|
1757 | 1784 | # if a branch in origin contains the revision, nothing to do |
|
1758 | 1785 | branch2rev, rev2branch = self._gitbranchmap() |
|
1759 | 1786 | if self._state[1] in rev2branch: |
|
1760 | 1787 | for b in rev2branch[self._state[1]]: |
|
1761 | 1788 | if b.startswith('refs/remotes/origin/'): |
|
1762 | 1789 | return True |
|
1763 | 1790 | for b, revision in branch2rev.iteritems(): |
|
1764 | 1791 | if b.startswith('refs/remotes/origin/'): |
|
1765 | 1792 | if self._gitisancestor(self._state[1], revision): |
|
1766 | 1793 | return True |
|
1767 | 1794 | # otherwise, try to push the currently checked out branch |
|
1768 | 1795 | cmd = ['push'] |
|
1769 | 1796 | if force: |
|
1770 | 1797 | cmd.append('--force') |
|
1771 | 1798 | |
|
1772 | 1799 | current = self._gitcurrentbranch() |
|
1773 | 1800 | if current: |
|
1774 | 1801 | # determine if the current branch is even useful |
|
1775 | 1802 | if not self._gitisancestor(self._state[1], current): |
|
1776 | 1803 | self.ui.warn(_('unrelated git branch checked out ' |
|
1777 | 1804 | 'in subrepository "%s"\n') % self._relpath) |
|
1778 | 1805 | return False |
|
1779 | 1806 | self.ui.status(_('pushing branch %s of subrepository "%s"\n') % |
|
1780 | 1807 | (current.split('/', 2)[2], self._relpath)) |
|
1781 | 1808 | ret = self._gitdir(cmd + ['origin', current]) |
|
1782 | 1809 | return ret[1] == 0 |
|
1783 | 1810 | else: |
|
1784 | 1811 | self.ui.warn(_('no branch checked out in subrepository "%s"\n' |
|
1785 | 1812 | 'cannot push revision %s\n') % |
|
1786 | 1813 | (self._relpath, self._state[1])) |
|
1787 | 1814 | return False |
|
1788 | 1815 | |
|
1789 | 1816 | @annotatesubrepoerror |
|
1790 | 1817 | def add(self, ui, match, prefix, explicitonly, **opts): |
|
1791 | 1818 | if self._gitmissing(): |
|
1792 | 1819 | return [] |
|
1793 | 1820 | |
|
1794 | 1821 | (modified, added, removed, |
|
1795 | 1822 | deleted, unknown, ignored, clean) = self.status(None, unknown=True, |
|
1796 | 1823 | clean=True) |
|
1797 | 1824 | |
|
1798 | 1825 | tracked = set() |
|
1799 | 1826 | # dirstates 'amn' warn, 'r' is added again |
|
1800 | 1827 | for l in (modified, added, deleted, clean): |
|
1801 | 1828 | tracked.update(l) |
|
1802 | 1829 | |
|
1803 | 1830 | # Unknown files not of interest will be rejected by the matcher |
|
1804 | 1831 | files = unknown |
|
1805 | 1832 | files.extend(match.files()) |
|
1806 | 1833 | |
|
1807 | 1834 | rejected = [] |
|
1808 | 1835 | |
|
1809 | 1836 | files = [f for f in sorted(set(files)) if match(f)] |
|
1810 | 1837 | for f in files: |
|
1811 | 1838 | exact = match.exact(f) |
|
1812 | 1839 | command = ["add"] |
|
1813 | 1840 | if exact: |
|
1814 | 1841 | command.append("-f") #should be added, even if ignored |
|
1815 | 1842 | if ui.verbose or not exact: |
|
1816 | 1843 | ui.status(_('adding %s\n') % match.rel(f)) |
|
1817 | 1844 | |
|
1818 | 1845 | if f in tracked: # hg prints 'adding' even if already tracked |
|
1819 | 1846 | if exact: |
|
1820 | 1847 | rejected.append(f) |
|
1821 | 1848 | continue |
|
1822 | 1849 | if not opts.get(r'dry_run'): |
|
1823 | 1850 | self._gitcommand(command + [f]) |
|
1824 | 1851 | |
|
1825 | 1852 | for f in rejected: |
|
1826 | 1853 | ui.warn(_("%s already tracked!\n") % match.abs(f)) |
|
1827 | 1854 | |
|
1828 | 1855 | return rejected |
|
1829 | 1856 | |
|
1830 | 1857 | @annotatesubrepoerror |
|
1831 | 1858 | def remove(self): |
|
1832 | 1859 | if self._gitmissing(): |
|
1833 | 1860 | return |
|
1834 | 1861 | if self.dirty(): |
|
1835 | 1862 | self.ui.warn(_('not removing repo %s because ' |
|
1836 | 1863 | 'it has changes.\n') % self._relpath) |
|
1837 | 1864 | return |
|
1838 | 1865 | # we can't fully delete the repository as it may contain |
|
1839 | 1866 | # local-only history |
|
1840 | 1867 | self.ui.note(_('removing subrepo %s\n') % self._relpath) |
|
1841 | 1868 | self._gitcommand(['config', 'core.bare', 'true']) |
|
1842 | 1869 | for f, kind in self.wvfs.readdir(): |
|
1843 | 1870 | if f == '.git': |
|
1844 | 1871 | continue |
|
1845 | 1872 | if kind == stat.S_IFDIR: |
|
1846 | 1873 | self.wvfs.rmtree(f) |
|
1847 | 1874 | else: |
|
1848 | 1875 | self.wvfs.unlink(f) |
|
1849 | 1876 | |
|
1850 | 1877 | def archive(self, archiver, prefix, match=None, decode=True): |
|
1851 | 1878 | total = 0 |
|
1852 | 1879 | source, revision = self._state |
|
1853 | 1880 | if not revision: |
|
1854 | 1881 | return total |
|
1855 | 1882 | self._fetch(source, revision) |
|
1856 | 1883 | |
|
1857 | 1884 | # Parse git's native archive command. |
|
1858 | 1885 | # This should be much faster than manually traversing the trees |
|
1859 | 1886 | # and objects with many subprocess calls. |
|
1860 | 1887 | tarstream = self._gitcommand(['archive', revision], stream=True) |
|
1861 | 1888 | tar = tarfile.open(fileobj=tarstream, mode='r|') |
|
1862 | 1889 | relpath = subrelpath(self) |
|
1863 | 1890 | self.ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files')) |
|
1864 | 1891 | for i, info in enumerate(tar): |
|
1865 | 1892 | if info.isdir(): |
|
1866 | 1893 | continue |
|
1867 | 1894 | if match and not match(info.name): |
|
1868 | 1895 | continue |
|
1869 | 1896 | if info.issym(): |
|
1870 | 1897 | data = info.linkname |
|
1871 | 1898 | else: |
|
1872 | 1899 | data = tar.extractfile(info).read() |
|
1873 | 1900 | archiver.addfile(prefix + self._path + '/' + info.name, |
|
1874 | 1901 | info.mode, info.issym(), data) |
|
1875 | 1902 | total += 1 |
|
1876 | 1903 | self.ui.progress(_('archiving (%s)') % relpath, i + 1, |
|
1877 | 1904 | unit=_('files')) |
|
1878 | 1905 | self.ui.progress(_('archiving (%s)') % relpath, None) |
|
1879 | 1906 | return total |
|
1880 | 1907 | |
|
1881 | 1908 | |
|
1882 | 1909 | @annotatesubrepoerror |
|
1883 | 1910 | def cat(self, match, fm, fntemplate, prefix, **opts): |
|
1884 | 1911 | rev = self._state[1] |
|
1885 | 1912 | if match.anypats(): |
|
1886 | 1913 | return 1 #No support for include/exclude yet |
|
1887 | 1914 | |
|
1888 | 1915 | if not match.files(): |
|
1889 | 1916 | return 1 |
|
1890 | 1917 | |
|
1891 | 1918 | # TODO: add support for non-plain formatter (see cmdutil.cat()) |
|
1892 | 1919 | for f in match.files(): |
|
1893 | 1920 | output = self._gitcommand(["show", "%s:%s" % (rev, f)]) |
|
1894 | 1921 | fp = cmdutil.makefileobj(self._subparent, fntemplate, |
|
1895 | 1922 | self._ctx.node(), |
|
1896 | 1923 | pathname=self.wvfs.reljoin(prefix, f)) |
|
1897 | 1924 | fp.write(output) |
|
1898 | 1925 | fp.close() |
|
1899 | 1926 | return 0 |
|
1900 | 1927 | |
|
1901 | 1928 | |
|
1902 | 1929 | @annotatesubrepoerror |
|
1903 | 1930 | def status(self, rev2, **opts): |
|
1904 | 1931 | rev1 = self._state[1] |
|
1905 | 1932 | if self._gitmissing() or not rev1: |
|
1906 | 1933 | # if the repo is missing, return no results |
|
1907 | 1934 | return scmutil.status([], [], [], [], [], [], []) |
|
1908 | 1935 | modified, added, removed = [], [], [] |
|
1909 | 1936 | self._gitupdatestat() |
|
1910 | 1937 | if rev2: |
|
1911 | 1938 | command = ['diff-tree', '--no-renames', '-r', rev1, rev2] |
|
1912 | 1939 | else: |
|
1913 | 1940 | command = ['diff-index', '--no-renames', rev1] |
|
1914 | 1941 | out = self._gitcommand(command) |
|
1915 | 1942 | for line in out.split('\n'): |
|
1916 | 1943 | tab = line.find('\t') |
|
1917 | 1944 | if tab == -1: |
|
1918 | 1945 | continue |
|
1919 | 1946 | status, f = line[tab - 1], line[tab + 1:] |
|
1920 | 1947 | if status == 'M': |
|
1921 | 1948 | modified.append(f) |
|
1922 | 1949 | elif status == 'A': |
|
1923 | 1950 | added.append(f) |
|
1924 | 1951 | elif status == 'D': |
|
1925 | 1952 | removed.append(f) |
|
1926 | 1953 | |
|
1927 | 1954 | deleted, unknown, ignored, clean = [], [], [], [] |
|
1928 | 1955 | |
|
1929 | 1956 | command = ['status', '--porcelain', '-z'] |
|
1930 | 1957 | if opts.get(r'unknown'): |
|
1931 | 1958 | command += ['--untracked-files=all'] |
|
1932 | 1959 | if opts.get(r'ignored'): |
|
1933 | 1960 | command += ['--ignored'] |
|
1934 | 1961 | out = self._gitcommand(command) |
|
1935 | 1962 | |
|
1936 | 1963 | changedfiles = set() |
|
1937 | 1964 | changedfiles.update(modified) |
|
1938 | 1965 | changedfiles.update(added) |
|
1939 | 1966 | changedfiles.update(removed) |
|
1940 | 1967 | for line in out.split('\0'): |
|
1941 | 1968 | if not line: |
|
1942 | 1969 | continue |
|
1943 | 1970 | st = line[0:2] |
|
1944 | 1971 | #moves and copies show 2 files on one line |
|
1945 | 1972 | if line.find('\0') >= 0: |
|
1946 | 1973 | filename1, filename2 = line[3:].split('\0') |
|
1947 | 1974 | else: |
|
1948 | 1975 | filename1 = line[3:] |
|
1949 | 1976 | filename2 = None |
|
1950 | 1977 | |
|
1951 | 1978 | changedfiles.add(filename1) |
|
1952 | 1979 | if filename2: |
|
1953 | 1980 | changedfiles.add(filename2) |
|
1954 | 1981 | |
|
1955 | 1982 | if st == '??': |
|
1956 | 1983 | unknown.append(filename1) |
|
1957 | 1984 | elif st == '!!': |
|
1958 | 1985 | ignored.append(filename1) |
|
1959 | 1986 | |
|
1960 | 1987 | if opts.get(r'clean'): |
|
1961 | 1988 | out = self._gitcommand(['ls-files']) |
|
1962 | 1989 | for f in out.split('\n'): |
|
1963 | 1990 | if not f in changedfiles: |
|
1964 | 1991 | clean.append(f) |
|
1965 | 1992 | |
|
1966 | 1993 | return scmutil.status(modified, added, removed, deleted, |
|
1967 | 1994 | unknown, ignored, clean) |
|
1968 | 1995 | |
|
1969 | 1996 | @annotatesubrepoerror |
|
1970 | 1997 | def diff(self, ui, diffopts, node2, match, prefix, **opts): |
|
1971 | 1998 | node1 = self._state[1] |
|
1972 | 1999 | cmd = ['diff', '--no-renames'] |
|
1973 | 2000 | if opts[r'stat']: |
|
1974 | 2001 | cmd.append('--stat') |
|
1975 | 2002 | else: |
|
1976 | 2003 | # for Git, this also implies '-p' |
|
1977 | 2004 | cmd.append('-U%d' % diffopts.context) |
|
1978 | 2005 | |
|
1979 | 2006 | gitprefix = self.wvfs.reljoin(prefix, self._path) |
|
1980 | 2007 | |
|
1981 | 2008 | if diffopts.noprefix: |
|
1982 | 2009 | cmd.extend(['--src-prefix=%s/' % gitprefix, |
|
1983 | 2010 | '--dst-prefix=%s/' % gitprefix]) |
|
1984 | 2011 | else: |
|
1985 | 2012 | cmd.extend(['--src-prefix=a/%s/' % gitprefix, |
|
1986 | 2013 | '--dst-prefix=b/%s/' % gitprefix]) |
|
1987 | 2014 | |
|
1988 | 2015 | if diffopts.ignorews: |
|
1989 | 2016 | cmd.append('--ignore-all-space') |
|
1990 | 2017 | if diffopts.ignorewsamount: |
|
1991 | 2018 | cmd.append('--ignore-space-change') |
|
1992 | 2019 | if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \ |
|
1993 | 2020 | and diffopts.ignoreblanklines: |
|
1994 | 2021 | cmd.append('--ignore-blank-lines') |
|
1995 | 2022 | |
|
1996 | 2023 | cmd.append(node1) |
|
1997 | 2024 | if node2: |
|
1998 | 2025 | cmd.append(node2) |
|
1999 | 2026 | |
|
2000 | 2027 | output = "" |
|
2001 | 2028 | if match.always(): |
|
2002 | 2029 | output += self._gitcommand(cmd) + '\n' |
|
2003 | 2030 | else: |
|
2004 | 2031 | st = self.status(node2)[:3] |
|
2005 | 2032 | files = [f for sublist in st for f in sublist] |
|
2006 | 2033 | for f in files: |
|
2007 | 2034 | if match(f): |
|
2008 | 2035 | output += self._gitcommand(cmd + ['--', f]) + '\n' |
|
2009 | 2036 | |
|
2010 | 2037 | if output.strip(): |
|
2011 | 2038 | ui.write(output) |
|
2012 | 2039 | |
|
2013 | 2040 | @annotatesubrepoerror |
|
2014 | 2041 | def revert(self, substate, *pats, **opts): |
|
2015 | 2042 | self.ui.status(_('reverting subrepo %s\n') % substate[0]) |
|
2016 | 2043 | if not opts.get(r'no_backup'): |
|
2017 | 2044 | status = self.status(None) |
|
2018 | 2045 | names = status.modified |
|
2019 | 2046 | for name in names: |
|
2020 | 2047 | bakname = scmutil.origpath(self.ui, self._subparent, name) |
|
2021 | 2048 | self.ui.note(_('saving current version of %s as %s\n') % |
|
2022 | 2049 | (name, bakname)) |
|
2023 | 2050 | self.wvfs.rename(name, bakname) |
|
2024 | 2051 | |
|
2025 | 2052 | if not opts.get(r'dry_run'): |
|
2026 | 2053 | self.get(substate, overwrite=True) |
|
2027 | 2054 | return [] |
|
2028 | 2055 | |
|
2029 | 2056 | def shortid(self, revid): |
|
2030 | 2057 | return revid[:7] |
|
2031 | 2058 | |
|
2032 | 2059 | types = { |
|
2033 | 2060 | 'hg': hgsubrepo, |
|
2034 | 2061 | 'svn': svnsubrepo, |
|
2035 | 2062 | 'git': gitsubrepo, |
|
2036 | 2063 | } |
@@ -1,1167 +1,1171 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | 3 | $ echo "[core]" >> $HOME/.gitconfig |
|
4 | 4 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
5 | 5 | $ echo "[core]" >> $HOME/.gitconfig |
|
6 | 6 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
7 | 7 | $ echo "[extensions]" >> $HGRCPATH |
|
8 | 8 | $ echo "convert=" >> $HGRCPATH |
|
9 | $ cat >> $HGRCPATH <<EOF | |
|
10 | > [subrepos] | |
|
11 | > git:allowed = true | |
|
12 | > EOF | |
|
9 | 13 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
10 | 14 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
11 | 15 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE |
|
12 | 16 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
13 | 17 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
14 | 18 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
15 | 19 | $ INVALIDID1=afd12345af |
|
16 | 20 | $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86 |
|
17 | 21 | $ VALIDID1=39b3d83f9a69a9ba4ebb111461071a0af0027357 |
|
18 | 22 | $ VALIDID2=8dd6476bd09d9c7776355dc454dafe38efaec5da |
|
19 | 23 | $ count=10 |
|
20 | 24 | $ commit() |
|
21 | 25 | > { |
|
22 | 26 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
23 | 27 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
24 | 28 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" |
|
25 | 29 | > count=`expr $count + 1` |
|
26 | 30 | > } |
|
27 | 31 | $ mkdir git-repo |
|
28 | 32 | $ cd git-repo |
|
29 | 33 | $ git init-db >/dev/null 2>/dev/null |
|
30 | 34 | $ echo a > a |
|
31 | 35 | $ mkdir d |
|
32 | 36 | $ echo b > d/b |
|
33 | 37 | $ git add a d |
|
34 | 38 | $ commit -a -m t1 |
|
35 | 39 | |
|
36 | 40 | Remove the directory, then try to replace it with a file (issue754) |
|
37 | 41 | |
|
38 | 42 | $ git rm -f d/b |
|
39 | 43 | rm 'd/b' |
|
40 | 44 | $ commit -m t2 |
|
41 | 45 | $ echo d > d |
|
42 | 46 | $ git add d |
|
43 | 47 | $ commit -m t3 |
|
44 | 48 | $ echo b >> a |
|
45 | 49 | $ commit -a -m t4.1 |
|
46 | 50 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null |
|
47 | 51 | $ echo c > a |
|
48 | 52 | $ echo a >> a |
|
49 | 53 | $ commit -a -m t4.2 |
|
50 | 54 | $ git checkout master >/dev/null 2>/dev/null |
|
51 | 55 | $ git pull --no-commit . other > /dev/null 2>/dev/null |
|
52 | 56 | $ commit -m 'Merge branch other' |
|
53 | 57 | $ cd .. |
|
54 | 58 | $ hg convert --config extensions.progress= --config progress.assume-tty=1 \ |
|
55 | 59 | > --config progress.delay=0 --config progress.changedelay=0 \ |
|
56 | 60 | > --config progress.refresh=0 --config progress.width=60 \ |
|
57 | 61 | > --config progress.format='topic, bar, number' --datesort git-repo |
|
58 | 62 | \r (no-eol) (esc) |
|
59 | 63 | scanning [======> ] 1/6\r (no-eol) (esc) |
|
60 | 64 | scanning [=============> ] 2/6\r (no-eol) (esc) |
|
61 | 65 | scanning [=====================> ] 3/6\r (no-eol) (esc) |
|
62 | 66 | scanning [============================> ] 4/6\r (no-eol) (esc) |
|
63 | 67 | scanning [===================================> ] 5/6\r (no-eol) (esc) |
|
64 | 68 | scanning [===========================================>] 6/6\r (no-eol) (esc) |
|
65 | 69 | \r (no-eol) (esc) |
|
66 | 70 | \r (no-eol) (esc) |
|
67 | 71 | converting [ ] 0/6\r (no-eol) (esc) |
|
68 | 72 | getting files [==================> ] 1/2\r (no-eol) (esc) |
|
69 | 73 | getting files [======================================>] 2/2\r (no-eol) (esc) |
|
70 | 74 | \r (no-eol) (esc) |
|
71 | 75 | \r (no-eol) (esc) |
|
72 | 76 | converting [======> ] 1/6\r (no-eol) (esc) |
|
73 | 77 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
74 | 78 | \r (no-eol) (esc) |
|
75 | 79 | \r (no-eol) (esc) |
|
76 | 80 | converting [=============> ] 2/6\r (no-eol) (esc) |
|
77 | 81 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
78 | 82 | \r (no-eol) (esc) |
|
79 | 83 | \r (no-eol) (esc) |
|
80 | 84 | converting [====================> ] 3/6\r (no-eol) (esc) |
|
81 | 85 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
82 | 86 | \r (no-eol) (esc) |
|
83 | 87 | \r (no-eol) (esc) |
|
84 | 88 | converting [===========================> ] 4/6\r (no-eol) (esc) |
|
85 | 89 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
86 | 90 | \r (no-eol) (esc) |
|
87 | 91 | \r (no-eol) (esc) |
|
88 | 92 | converting [==================================> ] 5/6\r (no-eol) (esc) |
|
89 | 93 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
90 | 94 | \r (no-eol) (esc) |
|
91 | 95 | assuming destination git-repo-hg |
|
92 | 96 | initializing destination git-repo-hg repository |
|
93 | 97 | scanning source... |
|
94 | 98 | sorting... |
|
95 | 99 | converting... |
|
96 | 100 | 5 t1 |
|
97 | 101 | 4 t2 |
|
98 | 102 | 3 t3 |
|
99 | 103 | 2 t4.1 |
|
100 | 104 | 1 t4.2 |
|
101 | 105 | 0 Merge branch other |
|
102 | 106 | updating bookmarks |
|
103 | 107 | $ hg up -q -R git-repo-hg |
|
104 | 108 | $ hg -R git-repo-hg tip -v |
|
105 | 109 | changeset: 5:c78094926be2 |
|
106 | 110 | bookmark: master |
|
107 | 111 | tag: tip |
|
108 | 112 | parent: 3:f5f5cb45432b |
|
109 | 113 | parent: 4:4e174f80c67c |
|
110 | 114 | user: test <test@example.org> |
|
111 | 115 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
112 | 116 | files: a |
|
113 | 117 | description: |
|
114 | 118 | Merge branch other |
|
115 | 119 | |
|
116 | 120 | |
|
117 | 121 | $ count=10 |
|
118 | 122 | $ mkdir git-repo2 |
|
119 | 123 | $ cd git-repo2 |
|
120 | 124 | $ git init-db >/dev/null 2>/dev/null |
|
121 | 125 | $ echo foo > foo |
|
122 | 126 | $ git add foo |
|
123 | 127 | $ commit -a -m 'add foo' |
|
124 | 128 | $ echo >> foo |
|
125 | 129 | $ commit -a -m 'change foo' |
|
126 | 130 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null |
|
127 | 131 | $ echo quux >> quux |
|
128 | 132 | $ git add quux |
|
129 | 133 | $ commit -a -m 'add quux' |
|
130 | 134 | $ echo bar > bar |
|
131 | 135 | $ git add bar |
|
132 | 136 | $ commit -a -m 'add bar' |
|
133 | 137 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null |
|
134 | 138 | $ echo baz > baz |
|
135 | 139 | $ git add baz |
|
136 | 140 | $ commit -a -m 'add baz' |
|
137 | 141 | $ git checkout master >/dev/null 2>/dev/null |
|
138 | 142 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null |
|
139 | 143 | $ commit -m 'Octopus merge' |
|
140 | 144 | $ echo bar >> bar |
|
141 | 145 | $ commit -a -m 'change bar' |
|
142 | 146 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null |
|
143 | 147 | $ echo >> foo |
|
144 | 148 | $ commit -a -m 'change foo' |
|
145 | 149 | $ git checkout master >/dev/null 2>/dev/null |
|
146 | 150 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null |
|
147 | 151 | $ commit -m 'Discard change to foo' |
|
148 | 152 | $ cd .. |
|
149 | 153 | $ glog() |
|
150 | 154 | > { |
|
151 | 155 | > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
152 | 156 | > } |
|
153 | 157 | $ splitrepo() |
|
154 | 158 | > { |
|
155 | 159 | > msg="$1" |
|
156 | 160 | > files="$2" |
|
157 | 161 | > opts=$3 |
|
158 | 162 | > echo "% $files: $msg" |
|
159 | 163 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
160 | 164 | > fmap="$prefix.fmap" |
|
161 | 165 | > repo="$prefix.repo" |
|
162 | 166 | > for i in $files; do |
|
163 | 167 | > echo "include $i" >> "$fmap" |
|
164 | 168 | > done |
|
165 | 169 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
166 | 170 | > hg up -q -R "$repo" |
|
167 | 171 | > glog -R "$repo" |
|
168 | 172 | > hg -R "$repo" manifest --debug |
|
169 | 173 | > } |
|
170 | 174 | |
|
171 | 175 | full conversion |
|
172 | 176 | |
|
173 | 177 | $ hg convert --datesort git-repo2 fullrepo \ |
|
174 | 178 | > --config extensions.progress= --config progress.assume-tty=1 \ |
|
175 | 179 | > --config progress.delay=0 --config progress.changedelay=0 \ |
|
176 | 180 | > --config progress.refresh=0 --config progress.width=60 \ |
|
177 | 181 | > --config progress.format='topic, bar, number' |
|
178 | 182 | \r (no-eol) (esc) |
|
179 | 183 | scanning [===> ] 1/9\r (no-eol) (esc) |
|
180 | 184 | scanning [========> ] 2/9\r (no-eol) (esc) |
|
181 | 185 | scanning [=============> ] 3/9\r (no-eol) (esc) |
|
182 | 186 | scanning [==================> ] 4/9\r (no-eol) (esc) |
|
183 | 187 | scanning [=======================> ] 5/9\r (no-eol) (esc) |
|
184 | 188 | scanning [============================> ] 6/9\r (no-eol) (esc) |
|
185 | 189 | scanning [=================================> ] 7/9\r (no-eol) (esc) |
|
186 | 190 | scanning [======================================> ] 8/9\r (no-eol) (esc) |
|
187 | 191 | scanning [===========================================>] 9/9\r (no-eol) (esc) |
|
188 | 192 | \r (no-eol) (esc) |
|
189 | 193 | \r (no-eol) (esc) |
|
190 | 194 | converting [ ] 0/9\r (no-eol) (esc) |
|
191 | 195 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
192 | 196 | \r (no-eol) (esc) |
|
193 | 197 | \r (no-eol) (esc) |
|
194 | 198 | converting [===> ] 1/9\r (no-eol) (esc) |
|
195 | 199 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
196 | 200 | \r (no-eol) (esc) |
|
197 | 201 | \r (no-eol) (esc) |
|
198 | 202 | converting [========> ] 2/9\r (no-eol) (esc) |
|
199 | 203 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
200 | 204 | \r (no-eol) (esc) |
|
201 | 205 | \r (no-eol) (esc) |
|
202 | 206 | converting [=============> ] 3/9\r (no-eol) (esc) |
|
203 | 207 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
204 | 208 | \r (no-eol) (esc) |
|
205 | 209 | \r (no-eol) (esc) |
|
206 | 210 | converting [=================> ] 4/9\r (no-eol) (esc) |
|
207 | 211 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
208 | 212 | \r (no-eol) (esc) |
|
209 | 213 | \r (no-eol) (esc) |
|
210 | 214 | converting [======================> ] 5/9\r (no-eol) (esc) |
|
211 | 215 | getting files [===> ] 1/8\r (no-eol) (esc) |
|
212 | 216 | getting files [========> ] 2/8\r (no-eol) (esc) |
|
213 | 217 | getting files [=============> ] 3/8\r (no-eol) (esc) |
|
214 | 218 | getting files [==================> ] 4/8\r (no-eol) (esc) |
|
215 | 219 | getting files [=======================> ] 5/8\r (no-eol) (esc) |
|
216 | 220 | getting files [============================> ] 6/8\r (no-eol) (esc) |
|
217 | 221 | getting files [=================================> ] 7/8\r (no-eol) (esc) |
|
218 | 222 | getting files [======================================>] 8/8\r (no-eol) (esc) |
|
219 | 223 | \r (no-eol) (esc) |
|
220 | 224 | \r (no-eol) (esc) |
|
221 | 225 | converting [===========================> ] 6/9\r (no-eol) (esc) |
|
222 | 226 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
223 | 227 | \r (no-eol) (esc) |
|
224 | 228 | \r (no-eol) (esc) |
|
225 | 229 | converting [===============================> ] 7/9\r (no-eol) (esc) |
|
226 | 230 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
227 | 231 | \r (no-eol) (esc) |
|
228 | 232 | \r (no-eol) (esc) |
|
229 | 233 | converting [====================================> ] 8/9\r (no-eol) (esc) |
|
230 | 234 | getting files [==================> ] 1/2\r (no-eol) (esc) |
|
231 | 235 | getting files [======================================>] 2/2\r (no-eol) (esc) |
|
232 | 236 | \r (no-eol) (esc) |
|
233 | 237 | initializing destination fullrepo repository |
|
234 | 238 | scanning source... |
|
235 | 239 | sorting... |
|
236 | 240 | converting... |
|
237 | 241 | 8 add foo |
|
238 | 242 | 7 change foo |
|
239 | 243 | 6 add quux |
|
240 | 244 | 5 add bar |
|
241 | 245 | 4 add baz |
|
242 | 246 | 3 Octopus merge |
|
243 | 247 | 2 change bar |
|
244 | 248 | 1 change foo |
|
245 | 249 | 0 Discard change to foo |
|
246 | 250 | updating bookmarks |
|
247 | 251 | $ hg up -q -R fullrepo |
|
248 | 252 | $ glog -R fullrepo |
|
249 | 253 | @ 9 "Discard change to foo" files: foo |
|
250 | 254 | |\ |
|
251 | 255 | | o 8 "change foo" files: foo |
|
252 | 256 | | | |
|
253 | 257 | o | 7 "change bar" files: bar |
|
254 | 258 | |/ |
|
255 | 259 | o 6 "(octopus merge fixup)" files: |
|
256 | 260 | |\ |
|
257 | 261 | | o 5 "Octopus merge" files: baz |
|
258 | 262 | | |\ |
|
259 | 263 | o | | 4 "add baz" files: baz |
|
260 | 264 | | | | |
|
261 | 265 | +---o 3 "add bar" files: bar |
|
262 | 266 | | | |
|
263 | 267 | o | 2 "add quux" files: quux |
|
264 | 268 | | | |
|
265 | 269 | | o 1 "change foo" files: foo |
|
266 | 270 | |/ |
|
267 | 271 | o 0 "add foo" files: foo |
|
268 | 272 | |
|
269 | 273 | $ hg -R fullrepo manifest --debug |
|
270 | 274 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
271 | 275 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
272 | 276 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
273 | 277 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
274 | 278 | $ splitrepo 'octopus merge' 'foo bar baz' |
|
275 | 279 | % foo bar baz: octopus merge |
|
276 | 280 | @ 8 "Discard change to foo" files: foo |
|
277 | 281 | |\ |
|
278 | 282 | | o 7 "change foo" files: foo |
|
279 | 283 | | | |
|
280 | 284 | o | 6 "change bar" files: bar |
|
281 | 285 | |/ |
|
282 | 286 | o 5 "(octopus merge fixup)" files: |
|
283 | 287 | |\ |
|
284 | 288 | | o 4 "Octopus merge" files: baz |
|
285 | 289 | | |\ |
|
286 | 290 | o | | 3 "add baz" files: baz |
|
287 | 291 | | | | |
|
288 | 292 | +---o 2 "add bar" files: bar |
|
289 | 293 | | | |
|
290 | 294 | | o 1 "change foo" files: foo |
|
291 | 295 | |/ |
|
292 | 296 | o 0 "add foo" files: foo |
|
293 | 297 | |
|
294 | 298 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
295 | 299 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
296 | 300 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
297 | 301 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
298 | 302 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
299 | 303 | @ 6 "Discard change to foo" files: foo |
|
300 | 304 | | |
|
301 | 305 | o 5 "change foo" files: foo |
|
302 | 306 | | |
|
303 | 307 | o 4 "Octopus merge" files: |
|
304 | 308 | |\ |
|
305 | 309 | | o 3 "add baz" files: baz |
|
306 | 310 | | | |
|
307 | 311 | | o 2 "add quux" files: quux |
|
308 | 312 | | | |
|
309 | 313 | o | 1 "change foo" files: foo |
|
310 | 314 | |/ |
|
311 | 315 | o 0 "add foo" files: foo |
|
312 | 316 | |
|
313 | 317 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
314 | 318 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
315 | 319 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
316 | 320 | |
|
317 | 321 | test importing git renames and copies |
|
318 | 322 | |
|
319 | 323 | $ cd git-repo2 |
|
320 | 324 | $ git mv foo foo-renamed |
|
321 | 325 | since bar is not touched in this commit, this copy will not be detected |
|
322 | 326 | $ cp bar bar-copied |
|
323 | 327 | $ cp baz baz-copied |
|
324 | 328 | $ cp baz baz-copied2 |
|
325 | 329 | $ cp baz ba-copy |
|
326 | 330 | $ echo baz2 >> baz |
|
327 | 331 | $ git add bar-copied baz-copied baz-copied2 ba-copy |
|
328 | 332 | $ commit -a -m 'rename and copy' |
|
329 | 333 | $ cd .. |
|
330 | 334 | |
|
331 | 335 | input validation |
|
332 | 336 | $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo |
|
333 | 337 | abort: convert.git.similarity is not a valid integer ('foo') |
|
334 | 338 | [255] |
|
335 | 339 | $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo |
|
336 | 340 | abort: similarity must be between 0 and 100 |
|
337 | 341 | [255] |
|
338 | 342 | $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo |
|
339 | 343 | abort: similarity must be between 0 and 100 |
|
340 | 344 | [255] |
|
341 | 345 | |
|
342 | 346 | $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo |
|
343 | 347 | $ hg -R fullrepo status -C --change master |
|
344 | 348 | M baz |
|
345 | 349 | A ba-copy |
|
346 | 350 | baz |
|
347 | 351 | A bar-copied |
|
348 | 352 | A baz-copied |
|
349 | 353 | baz |
|
350 | 354 | A baz-copied2 |
|
351 | 355 | baz |
|
352 | 356 | A foo-renamed |
|
353 | 357 | foo |
|
354 | 358 | R foo |
|
355 | 359 | |
|
356 | 360 | Ensure that the modification to the copy source was preserved |
|
357 | 361 | (there was a bug where if the copy dest was alphabetically prior to the copy |
|
358 | 362 | source, the copy source took the contents of the copy dest) |
|
359 | 363 | $ hg cat -r tip fullrepo/baz |
|
360 | 364 | baz |
|
361 | 365 | baz2 |
|
362 | 366 | |
|
363 | 367 | $ cd git-repo2 |
|
364 | 368 | $ echo bar2 >> bar |
|
365 | 369 | $ commit -a -m 'change bar' |
|
366 | 370 | $ cp bar bar-copied2 |
|
367 | 371 | $ git add bar-copied2 |
|
368 | 372 | $ commit -a -m 'copy with no changes' |
|
369 | 373 | $ cd .. |
|
370 | 374 | |
|
371 | 375 | $ hg -q convert --config convert.git.similarity=100 \ |
|
372 | 376 | > --config convert.git.findcopiesharder=1 --datesort git-repo2 fullrepo |
|
373 | 377 | $ hg -R fullrepo status -C --change master |
|
374 | 378 | A bar-copied2 |
|
375 | 379 | bar |
|
376 | 380 | |
|
377 | 381 | renamelimit config option works |
|
378 | 382 | |
|
379 | 383 | $ cd git-repo2 |
|
380 | 384 | $ cat >> copy-source << EOF |
|
381 | 385 | > sc0 |
|
382 | 386 | > sc1 |
|
383 | 387 | > sc2 |
|
384 | 388 | > sc3 |
|
385 | 389 | > sc4 |
|
386 | 390 | > sc5 |
|
387 | 391 | > sc6 |
|
388 | 392 | > EOF |
|
389 | 393 | $ git add copy-source |
|
390 | 394 | $ commit -m 'add copy-source' |
|
391 | 395 | $ cp copy-source source-copy0 |
|
392 | 396 | $ echo 0 >> source-copy0 |
|
393 | 397 | $ cp copy-source source-copy1 |
|
394 | 398 | $ echo 1 >> source-copy1 |
|
395 | 399 | $ git add source-copy0 source-copy1 |
|
396 | 400 | $ commit -a -m 'copy copy-source 2 times' |
|
397 | 401 | $ cd .. |
|
398 | 402 | |
|
399 | 403 | $ hg -q convert --config convert.git.renamelimit=1 \ |
|
400 | 404 | > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo2 |
|
401 | 405 | $ hg -R fullrepo2 status -C --change master |
|
402 | 406 | A source-copy0 |
|
403 | 407 | A source-copy1 |
|
404 | 408 | |
|
405 | 409 | $ hg -q convert --config convert.git.renamelimit=100 \ |
|
406 | 410 | > --config convert.git.findcopiesharder=true --datesort git-repo2 fullrepo3 |
|
407 | 411 | $ hg -R fullrepo3 status -C --change master |
|
408 | 412 | A source-copy0 |
|
409 | 413 | copy-source |
|
410 | 414 | A source-copy1 |
|
411 | 415 | copy-source |
|
412 | 416 | |
|
413 | 417 | test binary conversion (issue1359) |
|
414 | 418 | |
|
415 | 419 | $ count=19 |
|
416 | 420 | $ mkdir git-repo3 |
|
417 | 421 | $ cd git-repo3 |
|
418 | 422 | $ git init-db >/dev/null 2>/dev/null |
|
419 | 423 | $ $PYTHON -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' |
|
420 | 424 | $ git add b |
|
421 | 425 | $ commit -a -m addbinary |
|
422 | 426 | $ cd .. |
|
423 | 427 | |
|
424 | 428 | convert binary file |
|
425 | 429 | |
|
426 | 430 | $ hg convert git-repo3 git-repo3-hg |
|
427 | 431 | initializing destination git-repo3-hg repository |
|
428 | 432 | scanning source... |
|
429 | 433 | sorting... |
|
430 | 434 | converting... |
|
431 | 435 | 0 addbinary |
|
432 | 436 | updating bookmarks |
|
433 | 437 | $ cd git-repo3-hg |
|
434 | 438 | $ hg up -C |
|
435 | 439 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
436 | 440 | $ $PYTHON -c 'print len(file("b", "rb").read())' |
|
437 | 441 | 4096 |
|
438 | 442 | $ cd .. |
|
439 | 443 | |
|
440 | 444 | test author vs committer |
|
441 | 445 | |
|
442 | 446 | $ mkdir git-repo4 |
|
443 | 447 | $ cd git-repo4 |
|
444 | 448 | $ git init-db >/dev/null 2>/dev/null |
|
445 | 449 | $ echo >> foo |
|
446 | 450 | $ git add foo |
|
447 | 451 | $ commit -a -m addfoo |
|
448 | 452 | $ echo >> foo |
|
449 | 453 | $ GIT_AUTHOR_NAME="nottest" |
|
450 | 454 | $ commit -a -m addfoo2 |
|
451 | 455 | $ cd .. |
|
452 | 456 | |
|
453 | 457 | convert author committer |
|
454 | 458 | |
|
455 | 459 | $ hg convert git-repo4 git-repo4-hg |
|
456 | 460 | initializing destination git-repo4-hg repository |
|
457 | 461 | scanning source... |
|
458 | 462 | sorting... |
|
459 | 463 | converting... |
|
460 | 464 | 1 addfoo |
|
461 | 465 | 0 addfoo2 |
|
462 | 466 | updating bookmarks |
|
463 | 467 | $ hg -R git-repo4-hg log -v |
|
464 | 468 | changeset: 1:d63e967f93da |
|
465 | 469 | bookmark: master |
|
466 | 470 | tag: tip |
|
467 | 471 | user: nottest <test@example.org> |
|
468 | 472 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
469 | 473 | files: foo |
|
470 | 474 | description: |
|
471 | 475 | addfoo2 |
|
472 | 476 | |
|
473 | 477 | committer: test <test@example.org> |
|
474 | 478 | |
|
475 | 479 | |
|
476 | 480 | changeset: 0:0735477b0224 |
|
477 | 481 | user: test <test@example.org> |
|
478 | 482 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
479 | 483 | files: foo |
|
480 | 484 | description: |
|
481 | 485 | addfoo |
|
482 | 486 | |
|
483 | 487 | |
|
484 | 488 | |
|
485 | 489 | Various combinations of committeractions fail |
|
486 | 490 | |
|
487 | 491 | $ hg --config convert.git.committeractions=messagedifferent,messagealways convert git-repo4 bad-committer |
|
488 | 492 | initializing destination bad-committer repository |
|
489 | 493 | abort: committeractions cannot define both messagedifferent and messagealways |
|
490 | 494 | [255] |
|
491 | 495 | |
|
492 | 496 | $ hg --config convert.git.committeractions=dropcommitter,replaceauthor convert git-repo4 bad-committer |
|
493 | 497 | initializing destination bad-committer repository |
|
494 | 498 | abort: committeractions cannot define both dropcommitter and replaceauthor |
|
495 | 499 | [255] |
|
496 | 500 | |
|
497 | 501 | $ hg --config convert.git.committeractions=dropcommitter,messagealways convert git-repo4 bad-committer |
|
498 | 502 | initializing destination bad-committer repository |
|
499 | 503 | abort: committeractions cannot define both dropcommitter and messagealways |
|
500 | 504 | [255] |
|
501 | 505 | |
|
502 | 506 | custom prefix on messagedifferent works |
|
503 | 507 | |
|
504 | 508 | $ hg --config convert.git.committeractions=messagedifferent=different: convert git-repo4 git-repo4-hg-messagedifferentprefix |
|
505 | 509 | initializing destination git-repo4-hg-messagedifferentprefix repository |
|
506 | 510 | scanning source... |
|
507 | 511 | sorting... |
|
508 | 512 | converting... |
|
509 | 513 | 1 addfoo |
|
510 | 514 | 0 addfoo2 |
|
511 | 515 | updating bookmarks |
|
512 | 516 | |
|
513 | 517 | $ hg -R git-repo4-hg-messagedifferentprefix log -v |
|
514 | 518 | changeset: 1:2fe0c98a109d |
|
515 | 519 | bookmark: master |
|
516 | 520 | tag: tip |
|
517 | 521 | user: nottest <test@example.org> |
|
518 | 522 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
519 | 523 | files: foo |
|
520 | 524 | description: |
|
521 | 525 | addfoo2 |
|
522 | 526 | |
|
523 | 527 | different: test <test@example.org> |
|
524 | 528 | |
|
525 | 529 | |
|
526 | 530 | changeset: 0:0735477b0224 |
|
527 | 531 | user: test <test@example.org> |
|
528 | 532 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
529 | 533 | files: foo |
|
530 | 534 | description: |
|
531 | 535 | addfoo |
|
532 | 536 | |
|
533 | 537 | |
|
534 | 538 | |
|
535 | 539 | messagealways will always add the "committer: " line even if committer identical |
|
536 | 540 | |
|
537 | 541 | $ hg --config convert.git.committeractions=messagealways convert git-repo4 git-repo4-hg-messagealways |
|
538 | 542 | initializing destination git-repo4-hg-messagealways repository |
|
539 | 543 | scanning source... |
|
540 | 544 | sorting... |
|
541 | 545 | converting... |
|
542 | 546 | 1 addfoo |
|
543 | 547 | 0 addfoo2 |
|
544 | 548 | updating bookmarks |
|
545 | 549 | |
|
546 | 550 | $ hg -R git-repo4-hg-messagealways log -v |
|
547 | 551 | changeset: 1:8db057d8cd37 |
|
548 | 552 | bookmark: master |
|
549 | 553 | tag: tip |
|
550 | 554 | user: nottest <test@example.org> |
|
551 | 555 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
552 | 556 | files: foo |
|
553 | 557 | description: |
|
554 | 558 | addfoo2 |
|
555 | 559 | |
|
556 | 560 | committer: test <test@example.org> |
|
557 | 561 | |
|
558 | 562 | |
|
559 | 563 | changeset: 0:8f71fe9c98be |
|
560 | 564 | user: test <test@example.org> |
|
561 | 565 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
562 | 566 | files: foo |
|
563 | 567 | description: |
|
564 | 568 | addfoo |
|
565 | 569 | |
|
566 | 570 | committer: test <test@example.org> |
|
567 | 571 | |
|
568 | 572 | |
|
569 | 573 | |
|
570 | 574 | custom prefix on messagealways works |
|
571 | 575 | |
|
572 | 576 | $ hg --config convert.git.committeractions=messagealways=always: convert git-repo4 git-repo4-hg-messagealwaysprefix |
|
573 | 577 | initializing destination git-repo4-hg-messagealwaysprefix repository |
|
574 | 578 | scanning source... |
|
575 | 579 | sorting... |
|
576 | 580 | converting... |
|
577 | 581 | 1 addfoo |
|
578 | 582 | 0 addfoo2 |
|
579 | 583 | updating bookmarks |
|
580 | 584 | |
|
581 | 585 | $ hg -R git-repo4-hg-messagealwaysprefix log -v |
|
582 | 586 | changeset: 1:83c17174de79 |
|
583 | 587 | bookmark: master |
|
584 | 588 | tag: tip |
|
585 | 589 | user: nottest <test@example.org> |
|
586 | 590 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
587 | 591 | files: foo |
|
588 | 592 | description: |
|
589 | 593 | addfoo2 |
|
590 | 594 | |
|
591 | 595 | always: test <test@example.org> |
|
592 | 596 | |
|
593 | 597 | |
|
594 | 598 | changeset: 0:2ac9bcb3534a |
|
595 | 599 | user: test <test@example.org> |
|
596 | 600 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
597 | 601 | files: foo |
|
598 | 602 | description: |
|
599 | 603 | addfoo |
|
600 | 604 | |
|
601 | 605 | always: test <test@example.org> |
|
602 | 606 | |
|
603 | 607 | |
|
604 | 608 | |
|
605 | 609 | replaceauthor replaces author with committer |
|
606 | 610 | |
|
607 | 611 | $ hg --config convert.git.committeractions=replaceauthor convert git-repo4 git-repo4-hg-replaceauthor |
|
608 | 612 | initializing destination git-repo4-hg-replaceauthor repository |
|
609 | 613 | scanning source... |
|
610 | 614 | sorting... |
|
611 | 615 | converting... |
|
612 | 616 | 1 addfoo |
|
613 | 617 | 0 addfoo2 |
|
614 | 618 | updating bookmarks |
|
615 | 619 | |
|
616 | 620 | $ hg -R git-repo4-hg-replaceauthor log -v |
|
617 | 621 | changeset: 1:122c1d8999ea |
|
618 | 622 | bookmark: master |
|
619 | 623 | tag: tip |
|
620 | 624 | user: test <test@example.org> |
|
621 | 625 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
622 | 626 | files: foo |
|
623 | 627 | description: |
|
624 | 628 | addfoo2 |
|
625 | 629 | |
|
626 | 630 | |
|
627 | 631 | changeset: 0:0735477b0224 |
|
628 | 632 | user: test <test@example.org> |
|
629 | 633 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
630 | 634 | files: foo |
|
631 | 635 | description: |
|
632 | 636 | addfoo |
|
633 | 637 | |
|
634 | 638 | |
|
635 | 639 | |
|
636 | 640 | dropcommitter removes the committer |
|
637 | 641 | |
|
638 | 642 | $ hg --config convert.git.committeractions=dropcommitter convert git-repo4 git-repo4-hg-dropcommitter |
|
639 | 643 | initializing destination git-repo4-hg-dropcommitter repository |
|
640 | 644 | scanning source... |
|
641 | 645 | sorting... |
|
642 | 646 | converting... |
|
643 | 647 | 1 addfoo |
|
644 | 648 | 0 addfoo2 |
|
645 | 649 | updating bookmarks |
|
646 | 650 | |
|
647 | 651 | $ hg -R git-repo4-hg-dropcommitter log -v |
|
648 | 652 | changeset: 1:190b2da396cc |
|
649 | 653 | bookmark: master |
|
650 | 654 | tag: tip |
|
651 | 655 | user: nottest <test@example.org> |
|
652 | 656 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
653 | 657 | files: foo |
|
654 | 658 | description: |
|
655 | 659 | addfoo2 |
|
656 | 660 | |
|
657 | 661 | |
|
658 | 662 | changeset: 0:0735477b0224 |
|
659 | 663 | user: test <test@example.org> |
|
660 | 664 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
661 | 665 | files: foo |
|
662 | 666 | description: |
|
663 | 667 | addfoo |
|
664 | 668 | |
|
665 | 669 | |
|
666 | 670 | |
|
667 | 671 | --sourceorder should fail |
|
668 | 672 | |
|
669 | 673 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
670 | 674 | initializing destination git-repo4-sourcesort-hg repository |
|
671 | 675 | abort: --sourcesort is not supported by this data source |
|
672 | 676 | [255] |
|
673 | 677 | |
|
674 | 678 | test converting certain branches |
|
675 | 679 | |
|
676 | 680 | $ mkdir git-testrevs |
|
677 | 681 | $ cd git-testrevs |
|
678 | 682 | $ git init |
|
679 | 683 | Initialized empty Git repository in $TESTTMP/git-testrevs/.git/ |
|
680 | 684 | $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null |
|
681 | 685 | $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null |
|
682 | 686 | $ git checkout -b goodbranch 'HEAD^' |
|
683 | 687 | Switched to a new branch 'goodbranch' |
|
684 | 688 | $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null |
|
685 | 689 | $ git checkout -b badbranch 'HEAD^' |
|
686 | 690 | Switched to a new branch 'badbranch' |
|
687 | 691 | $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null |
|
688 | 692 | $ cd .. |
|
689 | 693 | $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch |
|
690 | 694 | initializing destination hg-testrevs repository |
|
691 | 695 | scanning source... |
|
692 | 696 | sorting... |
|
693 | 697 | converting... |
|
694 | 698 | 2 first |
|
695 | 699 | 1 good branch commit |
|
696 | 700 | 0 master commit |
|
697 | 701 | updating bookmarks |
|
698 | 702 | $ cd hg-testrevs |
|
699 | 703 | $ hg log -G -T '{rev} {bookmarks}' |
|
700 | 704 | o 2 master |
|
701 | 705 | | |
|
702 | 706 | | o 1 goodbranch |
|
703 | 707 | |/ |
|
704 | 708 | o 0 |
|
705 | 709 | |
|
706 | 710 | $ cd .. |
|
707 | 711 | |
|
708 | 712 | test sub modules |
|
709 | 713 | |
|
710 | 714 | $ mkdir git-repo5 |
|
711 | 715 | $ cd git-repo5 |
|
712 | 716 | $ git init-db >/dev/null 2>/dev/null |
|
713 | 717 | $ echo 'sub' >> foo |
|
714 | 718 | $ git add foo |
|
715 | 719 | $ commit -a -m 'addfoo' |
|
716 | 720 | $ BASE=`pwd` |
|
717 | 721 | $ cd .. |
|
718 | 722 | $ mkdir git-repo6 |
|
719 | 723 | $ cd git-repo6 |
|
720 | 724 | $ git init-db >/dev/null 2>/dev/null |
|
721 | 725 | $ git submodule add ${BASE} >/dev/null 2>/dev/null |
|
722 | 726 | $ commit -a -m 'addsubmodule' >/dev/null 2>/dev/null |
|
723 | 727 | |
|
724 | 728 | test non-tab whitespace .gitmodules |
|
725 | 729 | |
|
726 | 730 | $ cat >> .gitmodules <<EOF |
|
727 | 731 | > [submodule "git-repo5"] |
|
728 | 732 | > path = git-repo5 |
|
729 | 733 | > url = git-repo5 |
|
730 | 734 | > EOF |
|
731 | 735 | $ git commit -q -a -m "weird white space submodule" |
|
732 | 736 | $ cd .. |
|
733 | 737 | $ hg convert git-repo6 hg-repo6 |
|
734 | 738 | initializing destination hg-repo6 repository |
|
735 | 739 | scanning source... |
|
736 | 740 | sorting... |
|
737 | 741 | converting... |
|
738 | 742 | 1 addsubmodule |
|
739 | 743 | 0 weird white space submodule |
|
740 | 744 | updating bookmarks |
|
741 | 745 | |
|
742 | 746 | $ rm -rf hg-repo6 |
|
743 | 747 | $ cd git-repo6 |
|
744 | 748 | $ git reset --hard 'HEAD^' > /dev/null |
|
745 | 749 | |
|
746 | 750 | test missing .gitmodules |
|
747 | 751 | |
|
748 | 752 | $ git submodule add ../git-repo4 >/dev/null 2>/dev/null |
|
749 | 753 | $ git checkout HEAD .gitmodules |
|
750 | 754 | $ git rm .gitmodules |
|
751 | 755 | rm '.gitmodules' |
|
752 | 756 | $ git commit -q -m "remove .gitmodules" .gitmodules |
|
753 | 757 | $ git commit -q -m "missing .gitmodules" |
|
754 | 758 | $ cd .. |
|
755 | 759 | $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist" |
|
756 | 760 | initializing destination hg-repo6 repository |
|
757 | 761 | scanning source... |
|
758 | 762 | sorting... |
|
759 | 763 | converting... |
|
760 | 764 | 2 addsubmodule |
|
761 | 765 | 1 remove .gitmodules |
|
762 | 766 | 0 missing .gitmodules |
|
763 | 767 | warning: cannot read submodules config file in * (glob) |
|
764 | 768 | updating bookmarks |
|
765 | 769 | $ rm -rf hg-repo6 |
|
766 | 770 | $ cd git-repo6 |
|
767 | 771 | $ rm -rf git-repo4 |
|
768 | 772 | $ git reset --hard 'HEAD^^' > /dev/null |
|
769 | 773 | $ cd .. |
|
770 | 774 | |
|
771 | 775 | test invalid splicemap1 |
|
772 | 776 | |
|
773 | 777 | $ cat > splicemap <<EOF |
|
774 | 778 | > $VALIDID1 |
|
775 | 779 | > EOF |
|
776 | 780 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap1-hg |
|
777 | 781 | initializing destination git-repo2-splicemap1-hg repository |
|
778 | 782 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
779 | 783 | [255] |
|
780 | 784 | |
|
781 | 785 | test invalid splicemap2 |
|
782 | 786 | |
|
783 | 787 | $ cat > splicemap <<EOF |
|
784 | 788 | > $VALIDID1 $VALIDID2, $VALIDID2, $VALIDID2 |
|
785 | 789 | > EOF |
|
786 | 790 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap2-hg |
|
787 | 791 | initializing destination git-repo2-splicemap2-hg repository |
|
788 | 792 | abort: syntax error in splicemap(1): child parent1[,parent2] expected |
|
789 | 793 | [255] |
|
790 | 794 | |
|
791 | 795 | test invalid splicemap3 |
|
792 | 796 | |
|
793 | 797 | $ cat > splicemap <<EOF |
|
794 | 798 | > $INVALIDID1 $INVALIDID2 |
|
795 | 799 | > EOF |
|
796 | 800 | $ hg convert --splicemap splicemap git-repo2 git-repo2-splicemap3-hg |
|
797 | 801 | initializing destination git-repo2-splicemap3-hg repository |
|
798 | 802 | abort: splicemap entry afd12345af is not a valid revision identifier |
|
799 | 803 | [255] |
|
800 | 804 | |
|
801 | 805 | convert sub modules |
|
802 | 806 | $ hg convert git-repo6 git-repo6-hg |
|
803 | 807 | initializing destination git-repo6-hg repository |
|
804 | 808 | scanning source... |
|
805 | 809 | sorting... |
|
806 | 810 | converting... |
|
807 | 811 | 0 addsubmodule |
|
808 | 812 | updating bookmarks |
|
809 | 813 | $ hg -R git-repo6-hg log -v |
|
810 | 814 | changeset: 0:* (glob) |
|
811 | 815 | bookmark: master |
|
812 | 816 | tag: tip |
|
813 | 817 | user: nottest <test@example.org> |
|
814 | 818 | date: Mon Jan 01 00:00:23 2007 +0000 |
|
815 | 819 | files: .hgsub .hgsubstate |
|
816 | 820 | description: |
|
817 | 821 | addsubmodule |
|
818 | 822 | |
|
819 | 823 | committer: test <test@example.org> |
|
820 | 824 | |
|
821 | 825 | |
|
822 | 826 | |
|
823 | 827 | $ cd git-repo6-hg |
|
824 | 828 | $ hg up >/dev/null 2>/dev/null |
|
825 | 829 | $ cat .hgsubstate |
|
826 | 830 | * git-repo5 (glob) |
|
827 | 831 | $ cd git-repo5 |
|
828 | 832 | $ cat foo |
|
829 | 833 | sub |
|
830 | 834 | |
|
831 | 835 | $ cd ../.. |
|
832 | 836 | |
|
833 | 837 | make sure rename detection doesn't break removing and adding gitmodules |
|
834 | 838 | |
|
835 | 839 | $ cd git-repo6 |
|
836 | 840 | $ git mv .gitmodules .gitmodules-renamed |
|
837 | 841 | $ commit -a -m 'rename .gitmodules' |
|
838 | 842 | $ git mv .gitmodules-renamed .gitmodules |
|
839 | 843 | $ commit -a -m 'rename .gitmodules back' |
|
840 | 844 | $ cd .. |
|
841 | 845 | |
|
842 | 846 | $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg |
|
843 | 847 | $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n" |
|
844 | 848 | rename .gitmodules |
|
845 | 849 | $ hg -R git-repo6-hg status -C --change 'tip^' |
|
846 | 850 | A .gitmodules-renamed |
|
847 | 851 | R .hgsub |
|
848 | 852 | R .hgsubstate |
|
849 | 853 | $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n" |
|
850 | 854 | rename .gitmodules back |
|
851 | 855 | $ hg -R git-repo6-hg status -C --change tip |
|
852 | 856 | A .hgsub |
|
853 | 857 | A .hgsubstate |
|
854 | 858 | R .gitmodules-renamed |
|
855 | 859 | |
|
856 | 860 | convert the revision removing '.gitmodules' itself (and related |
|
857 | 861 | submodules) |
|
858 | 862 | |
|
859 | 863 | $ cd git-repo6 |
|
860 | 864 | $ git rm .gitmodules |
|
861 | 865 | rm '.gitmodules' |
|
862 | 866 | $ git rm --cached git-repo5 |
|
863 | 867 | rm 'git-repo5' |
|
864 | 868 | $ commit -a -m 'remove .gitmodules and submodule git-repo5' |
|
865 | 869 | $ cd .. |
|
866 | 870 | |
|
867 | 871 | $ hg convert -q git-repo6 git-repo6-hg |
|
868 | 872 | $ hg -R git-repo6-hg tip -T "{desc|firstline}\n" |
|
869 | 873 | remove .gitmodules and submodule git-repo5 |
|
870 | 874 | $ hg -R git-repo6-hg tip -T "{file_dels}\n" |
|
871 | 875 | .hgsub .hgsubstate |
|
872 | 876 | |
|
873 | 877 | skip submodules in the conversion |
|
874 | 878 | |
|
875 | 879 | $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True |
|
876 | 880 | $ hg -R no-submodules manifest --all |
|
877 | 881 | .gitmodules-renamed |
|
878 | 882 | |
|
879 | 883 | convert using a different remote prefix |
|
880 | 884 | $ git init git-repo7 |
|
881 | 885 | Initialized empty Git repository in $TESTTMP/git-repo7/.git/ |
|
882 | 886 | $ cd git-repo7 |
|
883 | 887 | TODO: it'd be nice to use (?) lines instead of grep -v to handle the |
|
884 | 888 | git output variance, but that doesn't currently work in the middle of |
|
885 | 889 | a block, so do this for now. |
|
886 | 890 | $ touch a && git add a && git commit -am "commit a" | grep -v changed |
|
887 | 891 | [master (root-commit) 8ae5f69] commit a |
|
888 | 892 | Author: nottest <test@example.org> |
|
889 | 893 | create mode 100644 a |
|
890 | 894 | $ cd .. |
|
891 | 895 | $ git clone git-repo7 git-repo7-client |
|
892 | 896 | Cloning into 'git-repo7-client'... |
|
893 | 897 | done. |
|
894 | 898 | $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7 |
|
895 | 899 | initializing destination hg-repo7 repository |
|
896 | 900 | scanning source... |
|
897 | 901 | sorting... |
|
898 | 902 | converting... |
|
899 | 903 | 0 commit a |
|
900 | 904 | updating bookmarks |
|
901 | 905 | $ hg -R hg-repo7 bookmarks |
|
902 | 906 | master 0:03bf38caa4c6 |
|
903 | 907 | origin/master 0:03bf38caa4c6 |
|
904 | 908 | |
|
905 | 909 | Run convert when the remote branches have changed |
|
906 | 910 | (there was an old bug where the local convert read branches from the server) |
|
907 | 911 | |
|
908 | 912 | $ cd git-repo7 |
|
909 | 913 | $ echo a >> a |
|
910 | 914 | $ git commit -q -am "move master forward" |
|
911 | 915 | $ cd .. |
|
912 | 916 | $ rm -rf hg-repo7 |
|
913 | 917 | $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7 |
|
914 | 918 | initializing destination hg-repo7 repository |
|
915 | 919 | scanning source... |
|
916 | 920 | sorting... |
|
917 | 921 | converting... |
|
918 | 922 | 0 commit a |
|
919 | 923 | updating bookmarks |
|
920 | 924 | $ hg -R hg-repo7 bookmarks |
|
921 | 925 | master 0:03bf38caa4c6 |
|
922 | 926 | origin/master 0:03bf38caa4c6 |
|
923 | 927 | |
|
924 | 928 | damaged git repository tests: |
|
925 | 929 | In case the hard-coded hashes change, the following commands can be used to |
|
926 | 930 | list the hashes and their corresponding types in the repository: |
|
927 | 931 | cd git-repo4/.git/objects |
|
928 | 932 | find . -type f | cut -c 3- | sed 's_/__' | xargs -n 1 -t git cat-file -t |
|
929 | 933 | cd ../../.. |
|
930 | 934 | |
|
931 | 935 | damage git repository by renaming a commit object |
|
932 | 936 | $ COMMIT_OBJ=1c/0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
|
933 | 937 | $ mv git-repo4/.git/objects/$COMMIT_OBJ git-repo4/.git/objects/$COMMIT_OBJ.tmp |
|
934 | 938 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
935 | 939 | abort: cannot retrieve number of commits in $TESTTMP/git-repo4/.git (glob) |
|
936 | 940 | $ mv git-repo4/.git/objects/$COMMIT_OBJ.tmp git-repo4/.git/objects/$COMMIT_OBJ |
|
937 | 941 | damage git repository by renaming a blob object |
|
938 | 942 | |
|
939 | 943 | $ BLOB_OBJ=8b/137891791fe96927ad78e64b0aad7bded08bdc |
|
940 | 944 | $ mv git-repo4/.git/objects/$BLOB_OBJ git-repo4/.git/objects/$BLOB_OBJ.tmp |
|
941 | 945 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
942 | 946 | abort: cannot read 'blob' object at 8b137891791fe96927ad78e64b0aad7bded08bdc |
|
943 | 947 | $ mv git-repo4/.git/objects/$BLOB_OBJ.tmp git-repo4/.git/objects/$BLOB_OBJ |
|
944 | 948 | damage git repository by renaming a tree object |
|
945 | 949 | |
|
946 | 950 | $ TREE_OBJ=72/49f083d2a63a41cc737764a86981eb5f3e4635 |
|
947 | 951 | $ mv git-repo4/.git/objects/$TREE_OBJ git-repo4/.git/objects/$TREE_OBJ.tmp |
|
948 | 952 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | grep 'abort:' |
|
949 | 953 | abort: cannot read changes in 1c0ce3c5886f83a1d78a7b517cdff5cf9ca17bdd |
|
950 | 954 | |
|
951 | 955 | #if no-windows git19 |
|
952 | 956 | |
|
953 | 957 | test for escaping the repo name (CVE-2016-3069) |
|
954 | 958 | |
|
955 | 959 | $ git init '`echo pwned >COMMAND-INJECTION`' |
|
956 | 960 | Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/ |
|
957 | 961 | $ cd '`echo pwned >COMMAND-INJECTION`' |
|
958 | 962 | $ git commit -q --allow-empty -m 'empty' |
|
959 | 963 | $ cd .. |
|
960 | 964 | $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted' |
|
961 | 965 | initializing destination converted repository |
|
962 | 966 | scanning source... |
|
963 | 967 | sorting... |
|
964 | 968 | converting... |
|
965 | 969 | 0 empty |
|
966 | 970 | updating bookmarks |
|
967 | 971 | $ test -f COMMAND-INJECTION |
|
968 | 972 | [1] |
|
969 | 973 | |
|
970 | 974 | test for safely passing paths to git (CVE-2016-3105) |
|
971 | 975 | |
|
972 | 976 | $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' |
|
973 | 977 | Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/ |
|
974 | 978 | $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' |
|
975 | 979 | $ git commit -q --allow-empty -m 'empty' |
|
976 | 980 | $ cd .. |
|
977 | 981 | $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext' |
|
978 | 982 | initializing destination converted-git-ext repository |
|
979 | 983 | scanning source... |
|
980 | 984 | sorting... |
|
981 | 985 | converting... |
|
982 | 986 | 0 empty |
|
983 | 987 | updating bookmarks |
|
984 | 988 | $ test -f GIT-EXT-COMMAND-INJECTION |
|
985 | 989 | [1] |
|
986 | 990 | |
|
987 | 991 | #endif |
|
988 | 992 | |
|
989 | 993 | Conversion of extra commit metadata to extras works |
|
990 | 994 | |
|
991 | 995 | $ git init gitextras >/dev/null 2>/dev/null |
|
992 | 996 | $ cd gitextras |
|
993 | 997 | $ touch foo |
|
994 | 998 | $ git add foo |
|
995 | 999 | $ commit -m initial |
|
996 | 1000 | $ echo 1 > foo |
|
997 | 1001 | $ tree=`git write-tree` |
|
998 | 1002 | |
|
999 | 1003 | Git doesn't provider a user-facing API to write extra metadata into the |
|
1000 | 1004 | commit, so create the commit object by hand |
|
1001 | 1005 | |
|
1002 | 1006 | $ git hash-object -t commit -w --stdin << EOF |
|
1003 | 1007 | > tree ${tree} |
|
1004 | 1008 | > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1 |
|
1005 | 1009 | > author test <test@example.com> 1000000000 +0000 |
|
1006 | 1010 | > committer test <test@example.com> 1000000000 +0000 |
|
1007 | 1011 | > extra-1 extra-1 |
|
1008 | 1012 | > extra-2 extra-2 with space |
|
1009 | 1013 | > convert_revision 0000aaaabbbbccccddddeeee |
|
1010 | 1014 | > |
|
1011 | 1015 | > message with extras |
|
1012 | 1016 | > EOF |
|
1013 | 1017 | 8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1014 | 1018 | |
|
1015 | 1019 | $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null |
|
1016 | 1020 | |
|
1017 | 1021 | $ cd .. |
|
1018 | 1022 | |
|
1019 | 1023 | convert will not retain custom metadata keys by default |
|
1020 | 1024 | |
|
1021 | 1025 | $ hg convert gitextras hgextras1 |
|
1022 | 1026 | initializing destination hgextras1 repository |
|
1023 | 1027 | scanning source... |
|
1024 | 1028 | sorting... |
|
1025 | 1029 | converting... |
|
1026 | 1030 | 1 initial |
|
1027 | 1031 | 0 message with extras |
|
1028 | 1032 | updating bookmarks |
|
1029 | 1033 | |
|
1030 | 1034 | $ hg -R hgextras1 log --debug -r 1 |
|
1031 | 1035 | changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09 |
|
1032 | 1036 | bookmark: master |
|
1033 | 1037 | tag: tip |
|
1034 | 1038 | phase: draft |
|
1035 | 1039 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1036 | 1040 | parent: -1:0000000000000000000000000000000000000000 |
|
1037 | 1041 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1038 | 1042 | user: test <test@example.com> |
|
1039 | 1043 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1040 | 1044 | extra: branch=default |
|
1041 | 1045 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1042 | 1046 | description: |
|
1043 | 1047 | message with extras |
|
1044 | 1048 | |
|
1045 | 1049 | |
|
1046 | 1050 | |
|
1047 | 1051 | Attempting to convert a banned extra is disallowed |
|
1048 | 1052 | |
|
1049 | 1053 | $ hg convert --config convert.git.extrakeys=tree,parent gitextras hgextras-banned |
|
1050 | 1054 | initializing destination hgextras-banned repository |
|
1051 | 1055 | abort: copying of extra key is forbidden: parent, tree |
|
1052 | 1056 | [255] |
|
1053 | 1057 | |
|
1054 | 1058 | Converting a specific extra works |
|
1055 | 1059 | |
|
1056 | 1060 | $ hg convert --config convert.git.extrakeys=extra-1 gitextras hgextras2 |
|
1057 | 1061 | initializing destination hgextras2 repository |
|
1058 | 1062 | scanning source... |
|
1059 | 1063 | sorting... |
|
1060 | 1064 | converting... |
|
1061 | 1065 | 1 initial |
|
1062 | 1066 | 0 message with extras |
|
1063 | 1067 | updating bookmarks |
|
1064 | 1068 | |
|
1065 | 1069 | $ hg -R hgextras2 log --debug -r 1 |
|
1066 | 1070 | changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391 |
|
1067 | 1071 | bookmark: master |
|
1068 | 1072 | tag: tip |
|
1069 | 1073 | phase: draft |
|
1070 | 1074 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1071 | 1075 | parent: -1:0000000000000000000000000000000000000000 |
|
1072 | 1076 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1073 | 1077 | user: test <test@example.com> |
|
1074 | 1078 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1075 | 1079 | extra: branch=default |
|
1076 | 1080 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1077 | 1081 | extra: extra-1=extra-1 |
|
1078 | 1082 | description: |
|
1079 | 1083 | message with extras |
|
1080 | 1084 | |
|
1081 | 1085 | |
|
1082 | 1086 | |
|
1083 | 1087 | Converting multiple extras works |
|
1084 | 1088 | |
|
1085 | 1089 | $ hg convert --config convert.git.extrakeys=extra-1,extra-2 gitextras hgextras3 |
|
1086 | 1090 | initializing destination hgextras3 repository |
|
1087 | 1091 | scanning source... |
|
1088 | 1092 | sorting... |
|
1089 | 1093 | converting... |
|
1090 | 1094 | 1 initial |
|
1091 | 1095 | 0 message with extras |
|
1092 | 1096 | updating bookmarks |
|
1093 | 1097 | |
|
1094 | 1098 | $ hg -R hgextras3 log --debug -r 1 |
|
1095 | 1099 | changeset: 1:0105af33379e7b6491501fd34141b7af700fe125 |
|
1096 | 1100 | bookmark: master |
|
1097 | 1101 | tag: tip |
|
1098 | 1102 | phase: draft |
|
1099 | 1103 | parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 |
|
1100 | 1104 | parent: -1:0000000000000000000000000000000000000000 |
|
1101 | 1105 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1102 | 1106 | user: test <test@example.com> |
|
1103 | 1107 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1104 | 1108 | extra: branch=default |
|
1105 | 1109 | extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 |
|
1106 | 1110 | extra: extra-1=extra-1 |
|
1107 | 1111 | extra: extra-2=extra-2 with space |
|
1108 | 1112 | description: |
|
1109 | 1113 | message with extras |
|
1110 | 1114 | |
|
1111 | 1115 | |
|
1112 | 1116 | |
|
1113 | 1117 | convert.git.saverev can be disabled to prevent convert_revision from being written |
|
1114 | 1118 | |
|
1115 | 1119 | $ hg convert --config convert.git.saverev=false gitextras hgextras4 |
|
1116 | 1120 | initializing destination hgextras4 repository |
|
1117 | 1121 | scanning source... |
|
1118 | 1122 | sorting... |
|
1119 | 1123 | converting... |
|
1120 | 1124 | 1 initial |
|
1121 | 1125 | 0 message with extras |
|
1122 | 1126 | updating bookmarks |
|
1123 | 1127 | |
|
1124 | 1128 | $ hg -R hgextras4 log --debug -r 1 |
|
1125 | 1129 | changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c |
|
1126 | 1130 | bookmark: master |
|
1127 | 1131 | tag: tip |
|
1128 | 1132 | phase: draft |
|
1129 | 1133 | parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d |
|
1130 | 1134 | parent: -1:0000000000000000000000000000000000000000 |
|
1131 | 1135 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1132 | 1136 | user: test <test@example.com> |
|
1133 | 1137 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1134 | 1138 | extra: branch=default |
|
1135 | 1139 | description: |
|
1136 | 1140 | message with extras |
|
1137 | 1141 | |
|
1138 | 1142 | |
|
1139 | 1143 | |
|
1140 | 1144 | convert.git.saverev and convert.git.extrakeys can be combined to preserve |
|
1141 | 1145 | convert_revision from source |
|
1142 | 1146 | |
|
1143 | 1147 | $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5 |
|
1144 | 1148 | initializing destination hgextras5 repository |
|
1145 | 1149 | scanning source... |
|
1146 | 1150 | sorting... |
|
1147 | 1151 | converting... |
|
1148 | 1152 | 1 initial |
|
1149 | 1153 | 0 message with extras |
|
1150 | 1154 | updating bookmarks |
|
1151 | 1155 | |
|
1152 | 1156 | $ hg -R hgextras5 log --debug -r 1 |
|
1153 | 1157 | changeset: 1:574d85931544d4542007664fee3747360e85ee28 |
|
1154 | 1158 | bookmark: master |
|
1155 | 1159 | tag: tip |
|
1156 | 1160 | phase: draft |
|
1157 | 1161 | parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d |
|
1158 | 1162 | parent: -1:0000000000000000000000000000000000000000 |
|
1159 | 1163 | manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 |
|
1160 | 1164 | user: test <test@example.com> |
|
1161 | 1165 | date: Sun Sep 09 01:46:40 2001 +0000 |
|
1162 | 1166 | extra: branch=default |
|
1163 | 1167 | extra: convert_revision=0000aaaabbbbccccddddeeee |
|
1164 | 1168 | description: |
|
1165 | 1169 | message with extras |
|
1166 | 1170 | |
|
1167 | 1171 |
@@ -1,53 +1,56 b'' | |||
|
1 | 1 | #require svn13 |
|
2 | 2 | |
|
3 | 3 | $ cat <<EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > mq = |
|
6 | 6 | > [diff] |
|
7 | 7 | > nodates = 1 |
|
8 | > [subrepos] | |
|
9 | > allowed = true | |
|
10 | > svn:allowed = true | |
|
8 | 11 | > EOF |
|
9 | 12 | |
|
10 | 13 | fn to create new repository, and cd into it |
|
11 | 14 | $ mkrepo() { |
|
12 | 15 | > hg init $1 |
|
13 | 16 | > cd $1 |
|
14 | 17 | > hg qinit |
|
15 | 18 | > } |
|
16 | 19 | |
|
17 | 20 | |
|
18 | 21 | handle svn subrepos safely |
|
19 | 22 | |
|
20 | 23 | $ svnadmin create svn-repo-2499 |
|
21 | 24 | |
|
22 | 25 | $ SVNREPOPATH=`pwd`/svn-repo-2499/project |
|
23 | 26 | #if windows |
|
24 | 27 | $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
25 | 28 | #else |
|
26 | 29 | $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
27 | 30 | #endif |
|
28 | 31 | |
|
29 | 32 | $ mkdir -p svn-project-2499/trunk |
|
30 | 33 | $ svn import -qm 'init project' svn-project-2499 "$SVNREPOURL" |
|
31 | 34 | |
|
32 | 35 | qnew on repo w/svn subrepo |
|
33 | 36 | $ mkrepo repo-2499-svn-subrepo |
|
34 | 37 | $ svn co "$SVNREPOURL"/trunk sub |
|
35 | 38 | Checked out revision 1. |
|
36 | 39 | $ echo 'sub = [svn]sub' >> .hgsub |
|
37 | 40 | $ hg add .hgsub |
|
38 | 41 | $ hg status -S -X '**/format' |
|
39 | 42 | A .hgsub |
|
40 | 43 | $ hg qnew -m0 0.diff |
|
41 | 44 | $ cd sub |
|
42 | 45 | $ echo a > a |
|
43 | 46 | $ svn add a |
|
44 | 47 | A a |
|
45 | 48 | $ svn st |
|
46 | 49 | A* a (glob) |
|
47 | 50 | $ cd .. |
|
48 | 51 | $ hg status -S # doesn't show status for svn subrepos (yet) |
|
49 | 52 | $ hg qnew -m1 1.diff |
|
50 | 53 | abort: uncommitted changes in subrepository "sub" |
|
51 | 54 | [255] |
|
52 | 55 | |
|
53 | 56 | $ cd .. |
@@ -1,1216 +1,1254 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | 3 | make git commits repeatable |
|
4 | 4 | |
|
5 | 5 | $ cat >> $HGRCPATH <<EOF |
|
6 | 6 | > [defaults] |
|
7 | 7 | > commit = -d "0 0" |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | $ echo "[core]" >> $HOME/.gitconfig |
|
11 | 11 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
12 | 12 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
13 | 13 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
14 | 14 | $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE |
|
15 | 15 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
16 | 16 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
17 | 17 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
18 | 18 | $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM |
|
19 | 19 | |
|
20 | 20 | root hg repo |
|
21 | 21 | |
|
22 | 22 | $ hg init t |
|
23 | 23 | $ cd t |
|
24 | 24 | $ echo a > a |
|
25 | 25 | $ hg add a |
|
26 | 26 | $ hg commit -m a |
|
27 | 27 | $ cd .. |
|
28 | 28 | |
|
29 | 29 | new external git repo |
|
30 | 30 | |
|
31 | 31 | $ mkdir gitroot |
|
32 | 32 | $ cd gitroot |
|
33 | 33 | $ git init -q |
|
34 | 34 | $ echo g > g |
|
35 | 35 | $ git add g |
|
36 | 36 | $ git commit -q -m g |
|
37 | 37 | |
|
38 | 38 | add subrepo clone |
|
39 | 39 | |
|
40 | 40 | $ cd ../t |
|
41 | 41 | $ echo 's = [git]../gitroot' > .hgsub |
|
42 | 42 | $ git clone -q ../gitroot s |
|
43 | 43 | $ hg add .hgsub |
|
44 | ||
|
45 | git subrepo is disabled by default | |
|
46 | ||
|
44 | 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 | 61 | $ hg debugsub |
|
46 | 62 | path s |
|
47 | 63 | source ../gitroot |
|
48 | 64 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
49 | 65 | |
|
50 | 66 | record a new commit from upstream from a different branch |
|
51 | 67 | |
|
52 | 68 | $ cd ../gitroot |
|
53 | 69 | $ git checkout -q -b testing |
|
54 | 70 | $ echo gg >> g |
|
55 | 71 | $ git commit -q -a -m gg |
|
56 | 72 | |
|
57 | 73 | $ cd ../t/s |
|
58 | 74 | $ git pull -q >/dev/null 2>/dev/null |
|
59 | 75 | $ git checkout -q -b testing origin/testing >/dev/null |
|
60 | 76 | |
|
61 | 77 | $ cd .. |
|
62 | 78 | $ hg status --subrepos |
|
63 | 79 | M s/g |
|
64 | 80 | $ hg commit -m 'update git subrepo' |
|
65 | 81 | $ hg debugsub |
|
66 | 82 | path s |
|
67 | 83 | source ../gitroot |
|
68 | 84 | revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a |
|
69 | 85 | |
|
70 | 86 | make $GITROOT pushable, by replacing it with a clone with nothing checked out |
|
71 | 87 | |
|
72 | 88 | $ cd .. |
|
73 | 89 | $ git clone gitroot gitrootbare --bare -q |
|
74 | 90 | $ rm -rf gitroot |
|
75 | 91 | $ mv gitrootbare gitroot |
|
76 | 92 | |
|
77 | 93 | clone root |
|
78 | 94 | |
|
79 | 95 | $ cd t |
|
80 | 96 | $ hg clone . ../tc 2> /dev/null |
|
81 | 97 | updating to branch default |
|
82 | 98 | cloning subrepo s from $TESTTMP/gitroot |
|
83 | 99 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 | 100 | $ cd ../tc |
|
85 | 101 | $ hg debugsub |
|
86 | 102 | path s |
|
87 | 103 | source ../gitroot |
|
88 | 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 | 125 | update to previous substate |
|
91 | 126 | |
|
127 | $ cd tc | |
|
92 | 128 | $ hg update 1 -q |
|
93 | 129 | $ cat s/g |
|
94 | 130 | g |
|
95 | 131 | $ hg debugsub |
|
96 | 132 | path s |
|
97 | 133 | source ../gitroot |
|
98 | 134 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
99 | 135 | |
|
100 | 136 | clone root, make local change |
|
101 | 137 | |
|
102 | 138 | $ cd ../t |
|
103 | 139 | $ hg clone . ../ta 2> /dev/null |
|
104 | 140 | updating to branch default |
|
105 | 141 | cloning subrepo s from $TESTTMP/gitroot |
|
106 | 142 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
107 | 143 | |
|
108 | 144 | $ cd ../ta |
|
109 | 145 | $ echo ggg >> s/g |
|
110 | 146 | $ hg status --subrepos |
|
111 | 147 | M s/g |
|
112 | 148 | $ hg diff --subrepos |
|
113 | 149 | diff --git a/s/g b/s/g |
|
114 | 150 | index 089258f..85341ee 100644 |
|
115 | 151 | --- a/s/g |
|
116 | 152 | +++ b/s/g |
|
117 | 153 | @@ -1,2 +1,3 @@ |
|
118 | 154 | g |
|
119 | 155 | gg |
|
120 | 156 | +ggg |
|
121 | 157 | $ hg commit --subrepos -m ggg |
|
122 | 158 | committing subrepository s |
|
123 | 159 | $ hg debugsub |
|
124 | 160 | path s |
|
125 | 161 | source ../gitroot |
|
126 | 162 | revision 79695940086840c99328513acbe35f90fcd55e57 |
|
127 | 163 | |
|
128 | 164 | clone root separately, make different local change |
|
129 | 165 | |
|
130 | 166 | $ cd ../t |
|
131 | 167 | $ hg clone . ../tb 2> /dev/null |
|
132 | 168 | updating to branch default |
|
133 | 169 | cloning subrepo s from $TESTTMP/gitroot |
|
134 | 170 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
135 | 171 | |
|
136 | 172 | $ cd ../tb/s |
|
137 | 173 | $ hg status --subrepos |
|
138 | 174 | $ echo f > f |
|
139 | 175 | $ hg status --subrepos |
|
140 | 176 | ? s/f |
|
141 | 177 | $ hg add . |
|
142 | 178 | adding f |
|
143 | 179 | $ git add f |
|
144 | 180 | $ cd .. |
|
145 | 181 | |
|
146 | 182 | $ hg status --subrepos |
|
147 | 183 | A s/f |
|
148 | 184 | $ hg commit --subrepos -m f |
|
149 | 185 | committing subrepository s |
|
150 | 186 | $ hg debugsub |
|
151 | 187 | path s |
|
152 | 188 | source ../gitroot |
|
153 | 189 | revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
154 | 190 | |
|
155 | 191 | user b push changes |
|
156 | 192 | |
|
157 | 193 | $ hg push 2>/dev/null |
|
158 | 194 | pushing to $TESTTMP/t (glob) |
|
159 | 195 | pushing branch testing of subrepository "s" |
|
160 | 196 | searching for changes |
|
161 | 197 | adding changesets |
|
162 | 198 | adding manifests |
|
163 | 199 | adding file changes |
|
164 | 200 | added 1 changesets with 1 changes to 1 files |
|
165 | 201 | |
|
166 | 202 | user a pulls, merges, commits |
|
167 | 203 | |
|
168 | 204 | $ cd ../ta |
|
169 | 205 | $ hg pull |
|
170 | 206 | pulling from $TESTTMP/t (glob) |
|
171 | 207 | searching for changes |
|
172 | 208 | adding changesets |
|
173 | 209 | adding manifests |
|
174 | 210 | adding file changes |
|
175 | 211 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
176 | 212 | new changesets 089416c11d73 |
|
177 | 213 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
178 | 214 | $ hg merge 2>/dev/null |
|
179 | 215 | subrepository s diverged (local revision: 7969594, remote revision: aa84837) |
|
180 | 216 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m |
|
181 | 217 | pulling subrepo s from $TESTTMP/gitroot |
|
182 | 218 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
183 | 219 | (branch merge, don't forget to commit) |
|
184 | 220 | $ hg st --subrepos s |
|
185 | 221 | A s/f |
|
186 | 222 | $ cat s/f |
|
187 | 223 | f |
|
188 | 224 | $ cat s/g |
|
189 | 225 | g |
|
190 | 226 | gg |
|
191 | 227 | ggg |
|
192 | 228 | $ hg commit --subrepos -m 'merge' |
|
193 | 229 | committing subrepository s |
|
194 | 230 | $ hg status --subrepos --rev 1:5 |
|
195 | 231 | M .hgsubstate |
|
196 | 232 | M s/g |
|
197 | 233 | A s/f |
|
198 | 234 | $ hg debugsub |
|
199 | 235 | path s |
|
200 | 236 | source ../gitroot |
|
201 | 237 | revision f47b465e1bce645dbf37232a00574aa1546ca8d3 |
|
202 | 238 | $ hg push 2>/dev/null |
|
203 | 239 | pushing to $TESTTMP/t (glob) |
|
204 | 240 | pushing branch testing of subrepository "s" |
|
205 | 241 | searching for changes |
|
206 | 242 | adding changesets |
|
207 | 243 | adding manifests |
|
208 | 244 | adding file changes |
|
209 | 245 | added 2 changesets with 2 changes to 1 files |
|
210 | 246 | |
|
211 | 247 | make upstream git changes |
|
212 | 248 | |
|
213 | 249 | $ cd .. |
|
214 | 250 | $ git clone -q gitroot gitclone |
|
215 | 251 | $ cd gitclone |
|
216 | 252 | $ echo ff >> f |
|
217 | 253 | $ git commit -q -a -m ff |
|
218 | 254 | $ echo fff >> f |
|
219 | 255 | $ git commit -q -a -m fff |
|
220 | 256 | $ git push origin testing 2>/dev/null |
|
221 | 257 | |
|
222 | 258 | make and push changes to hg without updating the subrepo |
|
223 | 259 | |
|
224 | 260 | $ cd ../t |
|
225 | 261 | $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.' |
|
226 | 262 | updating to branch default |
|
227 | 263 | cloning subrepo s from $TESTTMP/gitroot |
|
228 | 264 | checking out detached HEAD in subrepository "s" |
|
229 | 265 | check out a git branch if you intend to make changes |
|
230 | 266 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
231 | 267 | $ cd ../td |
|
232 | 268 | $ echo aa >> a |
|
233 | 269 | $ hg commit -m aa |
|
234 | 270 | $ hg push |
|
235 | 271 | pushing to $TESTTMP/t (glob) |
|
236 | 272 | searching for changes |
|
237 | 273 | adding changesets |
|
238 | 274 | adding manifests |
|
239 | 275 | adding file changes |
|
240 | 276 | added 1 changesets with 1 changes to 1 files |
|
241 | 277 | |
|
242 | 278 | sync to upstream git, distribute changes |
|
243 | 279 | |
|
244 | 280 | $ cd ../ta |
|
245 | 281 | $ hg pull -u -q |
|
246 | 282 | $ cd s |
|
247 | 283 | $ git pull -q >/dev/null 2>/dev/null |
|
248 | 284 | $ cd .. |
|
249 | 285 | $ hg commit -m 'git upstream sync' |
|
250 | 286 | $ hg debugsub |
|
251 | 287 | path s |
|
252 | 288 | source ../gitroot |
|
253 | 289 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
254 | 290 | $ hg push -q |
|
255 | 291 | |
|
256 | 292 | $ cd ../tb |
|
257 | 293 | $ hg pull -q |
|
258 | 294 | $ hg update 2>/dev/null |
|
259 | 295 | pulling subrepo s from $TESTTMP/gitroot |
|
260 | 296 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
261 | 297 | $ hg debugsub |
|
262 | 298 | path s |
|
263 | 299 | source ../gitroot |
|
264 | 300 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
265 | 301 | |
|
266 | 302 | create a new git branch |
|
267 | 303 | |
|
268 | 304 | $ cd s |
|
269 | 305 | $ git checkout -b b2 |
|
270 | 306 | Switched to a new branch 'b2' |
|
271 | 307 | $ echo a>a |
|
272 | 308 | $ git add a |
|
273 | 309 | $ git commit -qm 'add a' |
|
274 | 310 | $ cd .. |
|
275 | 311 | $ hg commit -m 'add branch in s' |
|
276 | 312 | |
|
277 | 313 | pulling new git branch should not create tracking branch named 'origin/b2' |
|
278 | 314 | (issue3870) |
|
279 | 315 | $ cd ../td/s |
|
280 | 316 | $ git remote set-url origin $TESTTMP/tb/s |
|
281 | 317 | $ git branch --no-track oldtesting |
|
282 | 318 | $ cd .. |
|
283 | 319 | $ hg pull -q ../tb |
|
284 | 320 | $ hg up |
|
285 | 321 | From $TESTTMP/tb/s |
|
286 | 322 | * [new branch] b2 -> origin/b2 |
|
287 | 323 | Previous HEAD position was f47b465... merge |
|
288 | 324 | Switched to a new branch 'b2' |
|
289 | 325 | pulling subrepo s from $TESTTMP/tb/s |
|
290 | 326 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
291 | 327 | |
|
292 | 328 | update to a revision without the subrepo, keeping the local git repository |
|
293 | 329 | |
|
294 | 330 | $ cd ../t |
|
295 | 331 | $ hg up 0 |
|
296 | 332 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
297 | 333 | $ ls -a s |
|
298 | 334 | . |
|
299 | 335 | .. |
|
300 | 336 | .git |
|
301 | 337 | |
|
302 | 338 | $ hg up 2 |
|
303 | 339 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
304 | 340 | $ ls -a s |
|
305 | 341 | . |
|
306 | 342 | .. |
|
307 | 343 | .git |
|
308 | 344 | g |
|
309 | 345 | |
|
310 | 346 | archive subrepos |
|
311 | 347 | |
|
312 | 348 | $ cd ../tc |
|
313 | 349 | $ hg pull -q |
|
314 | 350 | $ hg archive --subrepos -r 5 ../archive 2>/dev/null |
|
315 | 351 | pulling subrepo s from $TESTTMP/gitroot |
|
316 | 352 | $ cd ../archive |
|
317 | 353 | $ cat s/f |
|
318 | 354 | f |
|
319 | 355 | $ cat s/g |
|
320 | 356 | g |
|
321 | 357 | gg |
|
322 | 358 | ggg |
|
323 | 359 | |
|
324 | 360 | $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null |
|
325 | 361 | $ find ../archive_x | sort | grep -v pax_global_header |
|
326 | 362 | ../archive_x |
|
327 | 363 | ../archive_x/.hg_archival.txt |
|
328 | 364 | ../archive_x/.hgsub |
|
329 | 365 | ../archive_x/.hgsubstate |
|
330 | 366 | ../archive_x/a |
|
331 | 367 | ../archive_x/s |
|
332 | 368 | ../archive_x/s/g |
|
333 | 369 | |
|
334 | 370 | $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null |
|
335 | 371 | $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header |
|
336 | 372 | .hg_archival.txt |
|
337 | 373 | .hgsub |
|
338 | 374 | .hgsubstate |
|
339 | 375 | a |
|
340 | 376 | s/g |
|
341 | 377 | |
|
342 | 378 | create nested repo |
|
343 | 379 | |
|
344 | 380 | $ cd .. |
|
345 | 381 | $ hg init outer |
|
346 | 382 | $ cd outer |
|
347 | 383 | $ echo b>b |
|
348 | 384 | $ hg add b |
|
349 | 385 | $ hg commit -m b |
|
350 | 386 | |
|
351 | 387 | $ hg clone ../t inner 2> /dev/null |
|
352 | 388 | updating to branch default |
|
353 | 389 | cloning subrepo s from $TESTTMP/gitroot |
|
354 | 390 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
355 | 391 | $ echo inner = inner > .hgsub |
|
356 | 392 | $ hg add .hgsub |
|
357 | 393 | $ hg commit -m 'nested sub' |
|
358 | 394 | |
|
359 | 395 | nested commit |
|
360 | 396 | |
|
361 | 397 | $ echo ffff >> inner/s/f |
|
362 | 398 | $ hg status --subrepos |
|
363 | 399 | M inner/s/f |
|
364 | 400 | $ hg commit --subrepos -m nested |
|
365 | 401 | committing subrepository inner |
|
366 | 402 | committing subrepository inner/s (glob) |
|
367 | 403 | |
|
368 | 404 | nested archive |
|
369 | 405 | |
|
370 | 406 | $ hg archive --subrepos ../narchive |
|
371 | 407 | $ ls ../narchive/inner/s | grep -v pax_global_header |
|
372 | 408 | f |
|
373 | 409 | g |
|
374 | 410 | |
|
375 | 411 | relative source expansion |
|
376 | 412 | |
|
377 | 413 | $ cd .. |
|
378 | 414 | $ mkdir d |
|
379 | 415 | $ hg clone t d/t 2> /dev/null |
|
380 | 416 | updating to branch default |
|
381 | 417 | cloning subrepo s from $TESTTMP/gitroot |
|
382 | 418 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
383 | 419 | |
|
384 | 420 | Don't crash if the subrepo is missing |
|
385 | 421 | |
|
386 | 422 | $ hg clone t missing -q |
|
387 | 423 | $ cd missing |
|
388 | 424 | $ rm -rf s |
|
389 | 425 | $ hg status -S |
|
390 | 426 | $ hg sum | grep commit |
|
391 | 427 | commit: 1 subrepos |
|
392 | 428 | $ hg push -q |
|
393 | 429 | abort: subrepo s is missing (in subrepository "s") |
|
394 | 430 | [255] |
|
395 | 431 | $ hg commit --subrepos -qm missing |
|
396 | 432 | abort: subrepo s is missing (in subrepository "s") |
|
397 | 433 | [255] |
|
398 | 434 | |
|
399 | 435 | #if symlink |
|
400 | 436 | Don't crash if subrepo is a broken symlink |
|
401 | 437 | $ ln -s broken s |
|
402 | 438 | $ hg status -S |
|
439 | abort: subrepo 's' traverses symbolic link | |
|
440 | [255] | |
|
403 | 441 | $ hg push -q |
|
404 | abort: subrepo s is missing (in subrepository "s") | |
|
442 | abort: subrepo 's' traverses symbolic link | |
|
405 | 443 | [255] |
|
406 | 444 | $ hg commit --subrepos -qm missing |
|
407 | abort: subrepo s is missing (in subrepository "s") | |
|
445 | abort: subrepo 's' traverses symbolic link | |
|
408 | 446 | [255] |
|
409 | 447 | $ rm s |
|
410 | 448 | #endif |
|
411 | 449 | |
|
412 | 450 | $ hg update -C 2> /dev/null |
|
413 | 451 | cloning subrepo s from $TESTTMP/gitroot |
|
414 | 452 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
415 | 453 | $ hg sum | grep commit |
|
416 | 454 | commit: (clean) |
|
417 | 455 | |
|
418 | 456 | Don't crash if the .hgsubstate entry is missing |
|
419 | 457 | |
|
420 | 458 | $ hg update 1 -q |
|
421 | 459 | $ hg rm .hgsubstate |
|
422 | 460 | $ hg commit .hgsubstate -m 'no substate' |
|
423 | 461 | nothing changed |
|
424 | 462 | [1] |
|
425 | 463 | $ hg tag -l nosubstate |
|
426 | 464 | $ hg manifest |
|
427 | 465 | .hgsub |
|
428 | 466 | .hgsubstate |
|
429 | 467 | a |
|
430 | 468 | |
|
431 | 469 | $ hg status -S |
|
432 | 470 | R .hgsubstate |
|
433 | 471 | $ hg sum | grep commit |
|
434 | 472 | commit: 1 removed, 1 subrepos (new branch head) |
|
435 | 473 | |
|
436 | 474 | $ hg commit -m 'restore substate' |
|
437 | 475 | nothing changed |
|
438 | 476 | [1] |
|
439 | 477 | $ hg manifest |
|
440 | 478 | .hgsub |
|
441 | 479 | .hgsubstate |
|
442 | 480 | a |
|
443 | 481 | $ hg sum | grep commit |
|
444 | 482 | commit: 1 removed, 1 subrepos (new branch head) |
|
445 | 483 | |
|
446 | 484 | $ hg update -qC nosubstate |
|
447 | 485 | $ ls s |
|
448 | 486 | g |
|
449 | 487 | |
|
450 | 488 | issue3109: false positives in git diff-index |
|
451 | 489 | |
|
452 | 490 | $ hg update -q |
|
453 | 491 | $ touch -t 200001010000 s/g |
|
454 | 492 | $ hg status --subrepos |
|
455 | 493 | $ touch -t 200001010000 s/g |
|
456 | 494 | $ hg sum | grep commit |
|
457 | 495 | commit: (clean) |
|
458 | 496 | |
|
459 | 497 | Check hg update --clean |
|
460 | 498 | $ cd $TESTTMP/ta |
|
461 | 499 | $ echo > s/g |
|
462 | 500 | $ cd s |
|
463 | 501 | $ echo c1 > f1 |
|
464 | 502 | $ echo c1 > f2 |
|
465 | 503 | $ git add f1 |
|
466 | 504 | $ cd .. |
|
467 | 505 | $ hg status -S |
|
468 | 506 | M s/g |
|
469 | 507 | A s/f1 |
|
470 | 508 | ? s/f2 |
|
471 | 509 | $ ls s |
|
472 | 510 | f |
|
473 | 511 | f1 |
|
474 | 512 | f2 |
|
475 | 513 | g |
|
476 | 514 | $ hg update --clean |
|
477 | 515 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
478 | 516 | $ hg status -S |
|
479 | 517 | ? s/f1 |
|
480 | 518 | ? s/f2 |
|
481 | 519 | $ ls s |
|
482 | 520 | f |
|
483 | 521 | f1 |
|
484 | 522 | f2 |
|
485 | 523 | g |
|
486 | 524 | |
|
487 | 525 | Sticky subrepositories, no changes |
|
488 | 526 | $ cd $TESTTMP/ta |
|
489 | 527 | $ hg id -n |
|
490 | 528 | 7 |
|
491 | 529 | $ cd s |
|
492 | 530 | $ git rev-parse HEAD |
|
493 | 531 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
494 | 532 | $ cd .. |
|
495 | 533 | $ hg update 1 > /dev/null 2>&1 |
|
496 | 534 | $ hg id -n |
|
497 | 535 | 1 |
|
498 | 536 | $ cd s |
|
499 | 537 | $ git rev-parse HEAD |
|
500 | 538 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
501 | 539 | $ cd .. |
|
502 | 540 | |
|
503 | 541 | Sticky subrepositories, file changes |
|
504 | 542 | $ touch s/f1 |
|
505 | 543 | $ cd s |
|
506 | 544 | $ git add f1 |
|
507 | 545 | $ cd .. |
|
508 | 546 | $ hg id -n |
|
509 | 547 | 1+ |
|
510 | 548 | $ cd s |
|
511 | 549 | $ git rev-parse HEAD |
|
512 | 550 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
513 | 551 | $ cd .. |
|
514 | 552 | $ hg update 4 |
|
515 | 553 | subrepository s diverged (local revision: da5f5b1, remote revision: aa84837) |
|
516 | 554 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
517 | 555 | subrepository sources for s differ |
|
518 | 556 | use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l |
|
519 | 557 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
520 | 558 | $ hg id -n |
|
521 | 559 | 4+ |
|
522 | 560 | $ cd s |
|
523 | 561 | $ git rev-parse HEAD |
|
524 | 562 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
525 | 563 | $ cd .. |
|
526 | 564 | $ hg update --clean tip > /dev/null 2>&1 |
|
527 | 565 | |
|
528 | 566 | Sticky subrepository, revision updates |
|
529 | 567 | $ hg id -n |
|
530 | 568 | 7 |
|
531 | 569 | $ cd s |
|
532 | 570 | $ git rev-parse HEAD |
|
533 | 571 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
534 | 572 | $ cd .. |
|
535 | 573 | $ cd s |
|
536 | 574 | $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
537 | 575 | Previous HEAD position was 32a3438... fff |
|
538 | 576 | HEAD is now at aa84837... f |
|
539 | 577 | $ cd .. |
|
540 | 578 | $ hg update 1 |
|
541 | 579 | subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1) |
|
542 | 580 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
543 | 581 | subrepository sources for s differ (in checked out version) |
|
544 | 582 | use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l |
|
545 | 583 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
546 | 584 | $ hg id -n |
|
547 | 585 | 1+ |
|
548 | 586 | $ cd s |
|
549 | 587 | $ git rev-parse HEAD |
|
550 | 588 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
551 | 589 | $ cd .. |
|
552 | 590 | |
|
553 | 591 | Sticky subrepository, file changes and revision updates |
|
554 | 592 | $ touch s/f1 |
|
555 | 593 | $ cd s |
|
556 | 594 | $ git add f1 |
|
557 | 595 | $ git rev-parse HEAD |
|
558 | 596 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
559 | 597 | $ cd .. |
|
560 | 598 | $ hg id -n |
|
561 | 599 | 1+ |
|
562 | 600 | $ hg update 7 |
|
563 | 601 | subrepository s diverged (local revision: 32a3438, remote revision: 32a3438) |
|
564 | 602 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
565 | 603 | subrepository sources for s differ |
|
566 | 604 | use (l)ocal source (32a3438) or (r)emote source (32a3438)? l |
|
567 | 605 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
568 | 606 | $ hg id -n |
|
569 | 607 | 7+ |
|
570 | 608 | $ cd s |
|
571 | 609 | $ git rev-parse HEAD |
|
572 | 610 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
573 | 611 | $ cd .. |
|
574 | 612 | |
|
575 | 613 | Sticky repository, update --clean |
|
576 | 614 | $ hg update --clean tip 2>/dev/null |
|
577 | 615 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
578 | 616 | $ hg id -n |
|
579 | 617 | 7 |
|
580 | 618 | $ cd s |
|
581 | 619 | $ git rev-parse HEAD |
|
582 | 620 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
583 | 621 | $ cd .. |
|
584 | 622 | |
|
585 | 623 | Test subrepo already at intended revision: |
|
586 | 624 | $ cd s |
|
587 | 625 | $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
588 | 626 | HEAD is now at 32a3438... fff |
|
589 | 627 | $ cd .. |
|
590 | 628 | $ hg update 1 |
|
591 | 629 | Previous HEAD position was 32a3438... fff |
|
592 | 630 | HEAD is now at da5f5b1... g |
|
593 | 631 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
594 | 632 | $ hg id -n |
|
595 | 633 | 1 |
|
596 | 634 | $ cd s |
|
597 | 635 | $ git rev-parse HEAD |
|
598 | 636 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
599 | 637 | $ cd .. |
|
600 | 638 | |
|
601 | 639 | Test forgetting files, not implemented in git subrepo, used to |
|
602 | 640 | traceback |
|
603 | 641 | #if no-windows |
|
604 | 642 | $ hg forget 'notafile*' |
|
605 | 643 | notafile*: No such file or directory |
|
606 | 644 | [1] |
|
607 | 645 | #else |
|
608 | 646 | $ hg forget 'notafile' |
|
609 | 647 | notafile: * (glob) |
|
610 | 648 | [1] |
|
611 | 649 | #endif |
|
612 | 650 | |
|
613 | 651 | $ cd .. |
|
614 | 652 | |
|
615 | 653 | Test sanitizing ".hg/hgrc" in subrepo |
|
616 | 654 | |
|
617 | 655 | $ cd t |
|
618 | 656 | $ hg tip -q |
|
619 | 657 | 7:af6d2edbb0d3 |
|
620 | 658 | $ hg update -q -C af6d2edbb0d3 |
|
621 | 659 | $ cd s |
|
622 | 660 | $ git checkout -q -b sanitize-test |
|
623 | 661 | $ mkdir .hg |
|
624 | 662 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
625 | 663 | $ mkdir -p sub/.hg |
|
626 | 664 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
627 | 665 | $ git add .hg sub |
|
628 | 666 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update' |
|
629 | 667 | $ git push -q origin sanitize-test |
|
630 | 668 | $ cd .. |
|
631 | 669 | $ grep ' s$' .hgsubstate |
|
632 | 670 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
633 | 671 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
634 | 672 | $ hg parents -q |
|
635 | 673 | 8:3473d20bddcf |
|
636 | 674 | $ grep ' s$' .hgsubstate |
|
637 | 675 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
638 | 676 | $ cd .. |
|
639 | 677 | |
|
640 | 678 | $ hg -R tc pull -q |
|
641 | 679 | $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort |
|
642 | 680 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) |
|
643 | 681 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) |
|
644 | 682 | $ cd tc |
|
645 | 683 | $ hg parents -q |
|
646 | 684 | 8:3473d20bddcf |
|
647 | 685 | $ grep ' s$' .hgsubstate |
|
648 | 686 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
649 | 687 | $ test -f s/.hg/hgrc |
|
650 | 688 | [1] |
|
651 | 689 | $ test -f s/sub/.hg/hgrc |
|
652 | 690 | [1] |
|
653 | 691 | $ cd .. |
|
654 | 692 | |
|
655 | 693 | additional test for "git merge --ff" route: |
|
656 | 694 | |
|
657 | 695 | $ cd t |
|
658 | 696 | $ hg tip -q |
|
659 | 697 | 8:3473d20bddcf |
|
660 | 698 | $ hg update -q -C af6d2edbb0d3 |
|
661 | 699 | $ cd s |
|
662 | 700 | $ git checkout -q testing |
|
663 | 701 | $ mkdir .hg |
|
664 | 702 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
665 | 703 | $ mkdir -p sub/.hg |
|
666 | 704 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
667 | 705 | $ git add .hg sub |
|
668 | 706 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)' |
|
669 | 707 | $ git push -q origin testing |
|
670 | 708 | $ cd .. |
|
671 | 709 | $ grep ' s$' .hgsubstate |
|
672 | 710 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
673 | 711 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
674 | 712 | $ hg parents -q |
|
675 | 713 | 9:ed23f7fe024e |
|
676 | 714 | $ grep ' s$' .hgsubstate |
|
677 | 715 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
678 | 716 | $ cd .. |
|
679 | 717 | |
|
680 | 718 | $ cd tc |
|
681 | 719 | $ hg update -q -C af6d2edbb0d3 |
|
682 | 720 | $ test -f s/.hg/hgrc |
|
683 | 721 | [1] |
|
684 | 722 | $ test -f s/sub/.hg/hgrc |
|
685 | 723 | [1] |
|
686 | 724 | $ cd .. |
|
687 | 725 | $ hg -R tc pull -q |
|
688 | 726 | $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort |
|
689 | 727 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) |
|
690 | 728 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) |
|
691 | 729 | $ cd tc |
|
692 | 730 | $ hg parents -q |
|
693 | 731 | 9:ed23f7fe024e |
|
694 | 732 | $ grep ' s$' .hgsubstate |
|
695 | 733 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
696 | 734 | $ test -f s/.hg/hgrc |
|
697 | 735 | [1] |
|
698 | 736 | $ test -f s/sub/.hg/hgrc |
|
699 | 737 | [1] |
|
700 | 738 | |
|
701 | 739 | Test that sanitizing is omitted in meta data area: |
|
702 | 740 | |
|
703 | 741 | $ mkdir s/.git/.hg |
|
704 | 742 | $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc |
|
705 | 743 | $ hg update -q -C af6d2edbb0d3 |
|
706 | 744 | checking out detached HEAD in subrepository "s" |
|
707 | 745 | check out a git branch if you intend to make changes |
|
708 | 746 | |
|
709 | 747 | check differences made by most recent change |
|
710 | 748 | $ cd s |
|
711 | 749 | $ cat > foobar << EOF |
|
712 | 750 | > woopwoop |
|
713 | 751 | > |
|
714 | 752 | > foo |
|
715 | 753 | > bar |
|
716 | 754 | > EOF |
|
717 | 755 | $ git add foobar |
|
718 | 756 | $ cd .. |
|
719 | 757 | |
|
720 | 758 | $ hg diff --subrepos |
|
721 | 759 | diff --git a/s/foobar b/s/foobar |
|
722 | 760 | new file mode 100644 |
|
723 | 761 | index 0000000..8a5a5e2 |
|
724 | 762 | --- /dev/null |
|
725 | 763 | +++ b/s/foobar |
|
726 | 764 | @@ -0,0 +1,4 @@ |
|
727 | 765 | +woopwoop |
|
728 | 766 | + |
|
729 | 767 | +foo |
|
730 | 768 | +bar |
|
731 | 769 | |
|
732 | 770 | $ hg commit --subrepos -m "Added foobar" |
|
733 | 771 | committing subrepository s |
|
734 | 772 | created new head |
|
735 | 773 | |
|
736 | 774 | $ hg diff -c . --subrepos --nodates |
|
737 | 775 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
738 | 776 | --- a/.hgsubstate |
|
739 | 777 | +++ b/.hgsubstate |
|
740 | 778 | @@ -1,1 +1,1 @@ |
|
741 | 779 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
742 | 780 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
743 | 781 | diff --git a/s/foobar b/s/foobar |
|
744 | 782 | new file mode 100644 |
|
745 | 783 | index 0000000..8a5a5e2 |
|
746 | 784 | --- /dev/null |
|
747 | 785 | +++ b/s/foobar |
|
748 | 786 | @@ -0,0 +1,4 @@ |
|
749 | 787 | +woopwoop |
|
750 | 788 | + |
|
751 | 789 | +foo |
|
752 | 790 | +bar |
|
753 | 791 | |
|
754 | 792 | check output when only diffing the subrepository |
|
755 | 793 | $ hg diff -c . --subrepos s |
|
756 | 794 | diff --git a/s/foobar b/s/foobar |
|
757 | 795 | new file mode 100644 |
|
758 | 796 | index 0000000..8a5a5e2 |
|
759 | 797 | --- /dev/null |
|
760 | 798 | +++ b/s/foobar |
|
761 | 799 | @@ -0,0 +1,4 @@ |
|
762 | 800 | +woopwoop |
|
763 | 801 | + |
|
764 | 802 | +foo |
|
765 | 803 | +bar |
|
766 | 804 | |
|
767 | 805 | check output when diffing something else |
|
768 | 806 | $ hg diff -c . --subrepos .hgsubstate --nodates |
|
769 | 807 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
770 | 808 | --- a/.hgsubstate |
|
771 | 809 | +++ b/.hgsubstate |
|
772 | 810 | @@ -1,1 +1,1 @@ |
|
773 | 811 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
774 | 812 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
775 | 813 | |
|
776 | 814 | add new changes, including whitespace |
|
777 | 815 | $ cd s |
|
778 | 816 | $ cat > foobar << EOF |
|
779 | 817 | > woop woop |
|
780 | 818 | > |
|
781 | 819 | > foo |
|
782 | 820 | > bar |
|
783 | 821 | > EOF |
|
784 | 822 | $ echo foo > barfoo |
|
785 | 823 | $ git add barfoo |
|
786 | 824 | $ cd .. |
|
787 | 825 | |
|
788 | 826 | $ hg diff --subrepos --ignore-all-space |
|
789 | 827 | diff --git a/s/barfoo b/s/barfoo |
|
790 | 828 | new file mode 100644 |
|
791 | 829 | index 0000000..257cc56 |
|
792 | 830 | --- /dev/null |
|
793 | 831 | +++ b/s/barfoo |
|
794 | 832 | @@ -0,0 +1* @@ (glob) |
|
795 | 833 | +foo |
|
796 | 834 | $ hg diff --subrepos s/foobar |
|
797 | 835 | diff --git a/s/foobar b/s/foobar |
|
798 | 836 | index 8a5a5e2..bd5812a 100644 |
|
799 | 837 | --- a/s/foobar |
|
800 | 838 | +++ b/s/foobar |
|
801 | 839 | @@ -1,4 +1,4 @@ |
|
802 | 840 | -woopwoop |
|
803 | 841 | +woop woop |
|
804 | 842 | |
|
805 | 843 | foo |
|
806 | 844 | bar |
|
807 | 845 | |
|
808 | 846 | execute a diffstat |
|
809 | 847 | the output contains a regex, because git 1.7.10 and 1.7.11 |
|
810 | 848 | change the amount of whitespace |
|
811 | 849 | $ hg diff --subrepos --stat |
|
812 | 850 | \s*barfoo |\s*1 + (re) |
|
813 | 851 | \s*foobar |\s*2 +- (re) |
|
814 | 852 | 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re) |
|
815 | 853 | |
|
816 | 854 | adding an include should ignore the other elements |
|
817 | 855 | $ hg diff --subrepos -I s/foobar |
|
818 | 856 | diff --git a/s/foobar b/s/foobar |
|
819 | 857 | index 8a5a5e2..bd5812a 100644 |
|
820 | 858 | --- a/s/foobar |
|
821 | 859 | +++ b/s/foobar |
|
822 | 860 | @@ -1,4 +1,4 @@ |
|
823 | 861 | -woopwoop |
|
824 | 862 | +woop woop |
|
825 | 863 | |
|
826 | 864 | foo |
|
827 | 865 | bar |
|
828 | 866 | |
|
829 | 867 | adding an exclude should ignore this element |
|
830 | 868 | $ hg diff --subrepos -X s/foobar |
|
831 | 869 | diff --git a/s/barfoo b/s/barfoo |
|
832 | 870 | new file mode 100644 |
|
833 | 871 | index 0000000..257cc56 |
|
834 | 872 | --- /dev/null |
|
835 | 873 | +++ b/s/barfoo |
|
836 | 874 | @@ -0,0 +1* @@ (glob) |
|
837 | 875 | +foo |
|
838 | 876 | |
|
839 | 877 | moving a file should show a removal and an add |
|
840 | 878 | $ hg revert --all |
|
841 | 879 | reverting subrepo ../gitroot |
|
842 | 880 | $ cd s |
|
843 | 881 | $ git mv foobar woop |
|
844 | 882 | $ cd .. |
|
845 | 883 | $ hg diff --subrepos |
|
846 | 884 | diff --git a/s/foobar b/s/foobar |
|
847 | 885 | deleted file mode 100644 |
|
848 | 886 | index 8a5a5e2..0000000 |
|
849 | 887 | --- a/s/foobar |
|
850 | 888 | +++ /dev/null |
|
851 | 889 | @@ -1,4 +0,0 @@ |
|
852 | 890 | -woopwoop |
|
853 | 891 | - |
|
854 | 892 | -foo |
|
855 | 893 | -bar |
|
856 | 894 | diff --git a/s/woop b/s/woop |
|
857 | 895 | new file mode 100644 |
|
858 | 896 | index 0000000..8a5a5e2 |
|
859 | 897 | --- /dev/null |
|
860 | 898 | +++ b/s/woop |
|
861 | 899 | @@ -0,0 +1,4 @@ |
|
862 | 900 | +woopwoop |
|
863 | 901 | + |
|
864 | 902 | +foo |
|
865 | 903 | +bar |
|
866 | 904 | $ rm s/woop |
|
867 | 905 | |
|
868 | 906 | revert the subrepository |
|
869 | 907 | $ hg revert --all |
|
870 | 908 | reverting subrepo ../gitroot |
|
871 | 909 | |
|
872 | 910 | $ hg status --subrepos |
|
873 | 911 | ? s/barfoo |
|
874 | 912 | ? s/foobar.orig |
|
875 | 913 | |
|
876 | 914 | $ mv s/foobar.orig s/foobar |
|
877 | 915 | |
|
878 | 916 | $ hg revert --no-backup s |
|
879 | 917 | reverting subrepo ../gitroot |
|
880 | 918 | |
|
881 | 919 | $ hg status --subrepos |
|
882 | 920 | ? s/barfoo |
|
883 | 921 | |
|
884 | 922 | revert moves orig files to the right place |
|
885 | 923 | $ echo 'bloop' > s/foobar |
|
886 | 924 | $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups' |
|
887 | 925 | reverting subrepo ../gitroot |
|
888 | 926 | creating directory: $TESTTMP/tc/.hg/origbackups (glob) |
|
889 | 927 | saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar (glob) |
|
890 | 928 | $ ls .hg/origbackups |
|
891 | 929 | foobar |
|
892 | 930 | $ rm -rf .hg/origbackups |
|
893 | 931 | |
|
894 | 932 | show file at specific revision |
|
895 | 933 | $ cat > s/foobar << EOF |
|
896 | 934 | > woop woop |
|
897 | 935 | > fooo bar |
|
898 | 936 | > EOF |
|
899 | 937 | $ hg commit --subrepos -m "updated foobar" |
|
900 | 938 | committing subrepository s |
|
901 | 939 | $ cat > s/foobar << EOF |
|
902 | 940 | > current foobar |
|
903 | 941 | > (should not be visible using hg cat) |
|
904 | 942 | > EOF |
|
905 | 943 | |
|
906 | 944 | $ hg cat -r . s/foobar |
|
907 | 945 | woop woop |
|
908 | 946 | fooo bar (no-eol) |
|
909 | 947 | $ hg cat -r "parents(.)" s/foobar > catparents |
|
910 | 948 | |
|
911 | 949 | $ mkdir -p tmp/s |
|
912 | 950 | |
|
913 | 951 | $ hg cat -r "parents(.)" --output tmp/%% s/foobar |
|
914 | 952 | $ diff tmp/% catparents |
|
915 | 953 | |
|
916 | 954 | $ hg cat -r "parents(.)" --output tmp/%s s/foobar |
|
917 | 955 | $ diff tmp/foobar catparents |
|
918 | 956 | |
|
919 | 957 | $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar |
|
920 | 958 | $ diff tmp/s/otherfoobar catparents |
|
921 | 959 | |
|
922 | 960 | $ hg cat -r "parents(.)" --output tmp/%p s/foobar |
|
923 | 961 | $ diff tmp/s/foobar catparents |
|
924 | 962 | |
|
925 | 963 | $ hg cat -r "parents(.)" --output tmp/%H s/foobar |
|
926 | 964 | $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents |
|
927 | 965 | |
|
928 | 966 | $ hg cat -r "parents(.)" --output tmp/%R s/foobar |
|
929 | 967 | $ diff tmp/10 catparents |
|
930 | 968 | |
|
931 | 969 | $ hg cat -r "parents(.)" --output tmp/%h s/foobar |
|
932 | 970 | $ diff tmp/255ee8cf690e catparents |
|
933 | 971 | |
|
934 | 972 | $ rm tmp/10 |
|
935 | 973 | $ hg cat -r "parents(.)" --output tmp/%r s/foobar |
|
936 | 974 | $ diff tmp/10 catparents |
|
937 | 975 | |
|
938 | 976 | $ mkdir tmp/tc |
|
939 | 977 | $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar |
|
940 | 978 | $ diff tmp/tc/foobar catparents |
|
941 | 979 | |
|
942 | 980 | cleanup |
|
943 | 981 | $ rm -r tmp |
|
944 | 982 | $ rm catparents |
|
945 | 983 | |
|
946 | 984 | add git files, using either files or patterns |
|
947 | 985 | $ echo "hsss! hsssssssh!" > s/snake.python |
|
948 | 986 | $ echo "ccc" > s/c.c |
|
949 | 987 | $ echo "cpp" > s/cpp.cpp |
|
950 | 988 | |
|
951 | 989 | $ hg add s/snake.python s/c.c s/cpp.cpp |
|
952 | 990 | $ hg st --subrepos s |
|
953 | 991 | M s/foobar |
|
954 | 992 | A s/c.c |
|
955 | 993 | A s/cpp.cpp |
|
956 | 994 | A s/snake.python |
|
957 | 995 | ? s/barfoo |
|
958 | 996 | $ hg revert s |
|
959 | 997 | reverting subrepo ../gitroot |
|
960 | 998 | |
|
961 | 999 | $ hg add --subrepos "glob:**.python" |
|
962 | 1000 | adding s/snake.python (glob) |
|
963 | 1001 | $ hg st --subrepos s |
|
964 | 1002 | A s/snake.python |
|
965 | 1003 | ? s/barfoo |
|
966 | 1004 | ? s/c.c |
|
967 | 1005 | ? s/cpp.cpp |
|
968 | 1006 | ? s/foobar.orig |
|
969 | 1007 | $ hg revert s |
|
970 | 1008 | reverting subrepo ../gitroot |
|
971 | 1009 | |
|
972 | 1010 | $ hg add --subrepos s |
|
973 | 1011 | adding s/barfoo (glob) |
|
974 | 1012 | adding s/c.c (glob) |
|
975 | 1013 | adding s/cpp.cpp (glob) |
|
976 | 1014 | adding s/foobar.orig (glob) |
|
977 | 1015 | adding s/snake.python (glob) |
|
978 | 1016 | $ hg st --subrepos s |
|
979 | 1017 | A s/barfoo |
|
980 | 1018 | A s/c.c |
|
981 | 1019 | A s/cpp.cpp |
|
982 | 1020 | A s/foobar.orig |
|
983 | 1021 | A s/snake.python |
|
984 | 1022 | $ hg revert s |
|
985 | 1023 | reverting subrepo ../gitroot |
|
986 | 1024 | make sure everything is reverted correctly |
|
987 | 1025 | $ hg st --subrepos s |
|
988 | 1026 | ? s/barfoo |
|
989 | 1027 | ? s/c.c |
|
990 | 1028 | ? s/cpp.cpp |
|
991 | 1029 | ? s/foobar.orig |
|
992 | 1030 | ? s/snake.python |
|
993 | 1031 | |
|
994 | 1032 | $ hg add --subrepos --exclude "path:s/c.c" |
|
995 | 1033 | adding s/barfoo (glob) |
|
996 | 1034 | adding s/cpp.cpp (glob) |
|
997 | 1035 | adding s/foobar.orig (glob) |
|
998 | 1036 | adding s/snake.python (glob) |
|
999 | 1037 | $ hg st --subrepos s |
|
1000 | 1038 | A s/barfoo |
|
1001 | 1039 | A s/cpp.cpp |
|
1002 | 1040 | A s/foobar.orig |
|
1003 | 1041 | A s/snake.python |
|
1004 | 1042 | ? s/c.c |
|
1005 | 1043 | $ hg revert --all -q |
|
1006 | 1044 | |
|
1007 | 1045 | .hgignore should not have influence in subrepos |
|
1008 | 1046 | $ cat > .hgignore << EOF |
|
1009 | 1047 | > syntax: glob |
|
1010 | 1048 | > *.python |
|
1011 | 1049 | > EOF |
|
1012 | 1050 | $ hg add .hgignore |
|
1013 | 1051 | $ hg add --subrepos "glob:**.python" s/barfoo |
|
1014 | 1052 | adding s/snake.python (glob) |
|
1015 | 1053 | $ hg st --subrepos s |
|
1016 | 1054 | A s/barfoo |
|
1017 | 1055 | A s/snake.python |
|
1018 | 1056 | ? s/c.c |
|
1019 | 1057 | ? s/cpp.cpp |
|
1020 | 1058 | ? s/foobar.orig |
|
1021 | 1059 | $ hg revert --all -q |
|
1022 | 1060 | |
|
1023 | 1061 | .gitignore should have influence, |
|
1024 | 1062 | except for explicitly added files (no patterns) |
|
1025 | 1063 | $ cat > s/.gitignore << EOF |
|
1026 | 1064 | > *.python |
|
1027 | 1065 | > EOF |
|
1028 | 1066 | $ hg add s/.gitignore |
|
1029 | 1067 | $ hg st --subrepos s |
|
1030 | 1068 | A s/.gitignore |
|
1031 | 1069 | ? s/barfoo |
|
1032 | 1070 | ? s/c.c |
|
1033 | 1071 | ? s/cpp.cpp |
|
1034 | 1072 | ? s/foobar.orig |
|
1035 | 1073 | $ hg st --subrepos s --all |
|
1036 | 1074 | A s/.gitignore |
|
1037 | 1075 | ? s/barfoo |
|
1038 | 1076 | ? s/c.c |
|
1039 | 1077 | ? s/cpp.cpp |
|
1040 | 1078 | ? s/foobar.orig |
|
1041 | 1079 | I s/snake.python |
|
1042 | 1080 | C s/f |
|
1043 | 1081 | C s/foobar |
|
1044 | 1082 | C s/g |
|
1045 | 1083 | $ hg add --subrepos "glob:**.python" |
|
1046 | 1084 | $ hg st --subrepos s |
|
1047 | 1085 | A s/.gitignore |
|
1048 | 1086 | ? s/barfoo |
|
1049 | 1087 | ? s/c.c |
|
1050 | 1088 | ? s/cpp.cpp |
|
1051 | 1089 | ? s/foobar.orig |
|
1052 | 1090 | $ hg add --subrepos s/snake.python |
|
1053 | 1091 | $ hg st --subrepos s |
|
1054 | 1092 | A s/.gitignore |
|
1055 | 1093 | A s/snake.python |
|
1056 | 1094 | ? s/barfoo |
|
1057 | 1095 | ? s/c.c |
|
1058 | 1096 | ? s/cpp.cpp |
|
1059 | 1097 | ? s/foobar.orig |
|
1060 | 1098 | |
|
1061 | 1099 | correctly do a dry run |
|
1062 | 1100 | $ hg add --subrepos s --dry-run |
|
1063 | 1101 | adding s/barfoo (glob) |
|
1064 | 1102 | adding s/c.c (glob) |
|
1065 | 1103 | adding s/cpp.cpp (glob) |
|
1066 | 1104 | adding s/foobar.orig (glob) |
|
1067 | 1105 | $ hg st --subrepos s |
|
1068 | 1106 | A s/.gitignore |
|
1069 | 1107 | A s/snake.python |
|
1070 | 1108 | ? s/barfoo |
|
1071 | 1109 | ? s/c.c |
|
1072 | 1110 | ? s/cpp.cpp |
|
1073 | 1111 | ? s/foobar.orig |
|
1074 | 1112 | |
|
1075 | 1113 | error given when adding an already tracked file |
|
1076 | 1114 | $ hg add s/.gitignore |
|
1077 | 1115 | s/.gitignore already tracked! |
|
1078 | 1116 | [1] |
|
1079 | 1117 | $ hg add s/g |
|
1080 | 1118 | s/g already tracked! |
|
1081 | 1119 | [1] |
|
1082 | 1120 | |
|
1083 | 1121 | removed files can be re-added |
|
1084 | 1122 | removing files using 'rm' or 'git rm' has the same effect, |
|
1085 | 1123 | since we ignore the staging area |
|
1086 | 1124 | $ hg ci --subrepos -m 'snake' |
|
1087 | 1125 | committing subrepository s |
|
1088 | 1126 | $ cd s |
|
1089 | 1127 | $ rm snake.python |
|
1090 | 1128 | (remove leftover .hg so Mercurial doesn't look for a root here) |
|
1091 | 1129 | $ rm -rf .hg |
|
1092 | 1130 | $ hg status --subrepos --all . |
|
1093 | 1131 | R snake.python |
|
1094 | 1132 | ? barfoo |
|
1095 | 1133 | ? c.c |
|
1096 | 1134 | ? cpp.cpp |
|
1097 | 1135 | ? foobar.orig |
|
1098 | 1136 | C .gitignore |
|
1099 | 1137 | C f |
|
1100 | 1138 | C foobar |
|
1101 | 1139 | C g |
|
1102 | 1140 | $ git rm snake.python |
|
1103 | 1141 | rm 'snake.python' |
|
1104 | 1142 | $ hg status --subrepos --all . |
|
1105 | 1143 | R snake.python |
|
1106 | 1144 | ? barfoo |
|
1107 | 1145 | ? c.c |
|
1108 | 1146 | ? cpp.cpp |
|
1109 | 1147 | ? foobar.orig |
|
1110 | 1148 | C .gitignore |
|
1111 | 1149 | C f |
|
1112 | 1150 | C foobar |
|
1113 | 1151 | C g |
|
1114 | 1152 | $ touch snake.python |
|
1115 | 1153 | $ cd .. |
|
1116 | 1154 | $ hg add s/snake.python |
|
1117 | 1155 | $ hg status -S |
|
1118 | 1156 | M s/snake.python |
|
1119 | 1157 | ? .hgignore |
|
1120 | 1158 | ? s/barfoo |
|
1121 | 1159 | ? s/c.c |
|
1122 | 1160 | ? s/cpp.cpp |
|
1123 | 1161 | ? s/foobar.orig |
|
1124 | 1162 | $ hg revert --all -q |
|
1125 | 1163 | |
|
1126 | 1164 | make sure we show changed files, rather than changed subtrees |
|
1127 | 1165 | $ mkdir s/foo |
|
1128 | 1166 | $ touch s/foo/bwuh |
|
1129 | 1167 | $ hg add s/foo/bwuh |
|
1130 | 1168 | $ hg commit -S -m "add bwuh" |
|
1131 | 1169 | committing subrepository s |
|
1132 | 1170 | $ hg status -S --change . |
|
1133 | 1171 | M .hgsubstate |
|
1134 | 1172 | A s/foo/bwuh |
|
1135 | 1173 | ? s/barfoo |
|
1136 | 1174 | ? s/c.c |
|
1137 | 1175 | ? s/cpp.cpp |
|
1138 | 1176 | ? s/foobar.orig |
|
1139 | 1177 | ? s/snake.python.orig |
|
1140 | 1178 | |
|
1141 | 1179 | #if git19 |
|
1142 | 1180 | |
|
1143 | 1181 | test for Git CVE-2016-3068 |
|
1144 | 1182 | $ hg init malicious-subrepository |
|
1145 | 1183 | $ cd malicious-subrepository |
|
1146 | 1184 | $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub |
|
1147 | 1185 | $ git init s |
|
1148 | 1186 | Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/ |
|
1149 | 1187 | $ cd s |
|
1150 | 1188 | $ git commit --allow-empty -m 'empty' |
|
1151 | 1189 | [master (root-commit) 153f934] empty |
|
1152 | 1190 | $ cd .. |
|
1153 | 1191 | $ hg add .hgsub |
|
1154 | 1192 | $ hg commit -m "add subrepo" |
|
1155 | 1193 | $ cd .. |
|
1156 | 1194 | $ rm -f pwned.txt |
|
1157 | 1195 | $ unset GIT_ALLOW_PROTOCOL |
|
1158 | 1196 | $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \ |
|
1159 | 1197 | > malicious-subrepository malicious-subrepository-protected |
|
1160 | 1198 | Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob) |
|
1161 | 1199 | fatal: transport 'ext' not allowed |
|
1162 | 1200 | updating to branch default |
|
1163 | 1201 | cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt |
|
1164 | 1202 | abort: git clone error 128 in s (in subrepository "s") |
|
1165 | 1203 | [255] |
|
1166 | 1204 | $ f -Dq pwned.txt |
|
1167 | 1205 | pwned.txt: file not found |
|
1168 | 1206 | |
|
1169 | 1207 | whitelisting of ext should be respected (that's the git submodule behaviour) |
|
1170 | 1208 | $ rm -f pwned.txt |
|
1171 | 1209 | $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \ |
|
1172 | 1210 | > malicious-subrepository malicious-subrepository-clone-allowed |
|
1173 | 1211 | Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob) |
|
1174 | 1212 | fatal: Could not read from remote repository. |
|
1175 | 1213 | |
|
1176 | 1214 | Please make sure you have the correct access rights |
|
1177 | 1215 | and the repository exists. |
|
1178 | 1216 | updating to branch default |
|
1179 | 1217 | cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt |
|
1180 | 1218 | abort: git clone error 128 in s (in subrepository "s") |
|
1181 | 1219 | [255] |
|
1182 | 1220 | $ f -Dq pwned.txt |
|
1183 | 1221 | pwned: you asked for it |
|
1184 | 1222 | |
|
1185 | 1223 | #endif |
|
1186 | 1224 | |
|
1187 | 1225 | test for ssh exploit with git subrepos 2017-07-25 |
|
1188 | 1226 | |
|
1189 | 1227 | $ hg init malicious-proxycommand |
|
1190 | 1228 | $ cd malicious-proxycommand |
|
1191 | 1229 | $ echo 's = [git]ssh://-oProxyCommand=rm${IFS}non-existent/path' > .hgsub |
|
1192 | 1230 | $ git init s |
|
1193 | 1231 | Initialized empty Git repository in $TESTTMP/tc/malicious-proxycommand/s/.git/ |
|
1194 | 1232 | $ cd s |
|
1195 | 1233 | $ git commit --allow-empty -m 'empty' |
|
1196 | 1234 | [master (root-commit) 153f934] empty |
|
1197 | 1235 | $ cd .. |
|
1198 | 1236 | $ hg add .hgsub |
|
1199 | 1237 | $ hg ci -m 'add subrepo' |
|
1200 | 1238 | $ cd .. |
|
1201 | 1239 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1202 | 1240 | updating to branch default |
|
1203 | 1241 | abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s") |
|
1204 | 1242 | [255] |
|
1205 | 1243 | |
|
1206 | 1244 | also check that a percent encoded '-' (%2D) doesn't work |
|
1207 | 1245 | |
|
1208 | 1246 | $ cd malicious-proxycommand |
|
1209 | 1247 | $ echo 's = [git]ssh://%2DoProxyCommand=rm${IFS}non-existent/path' > .hgsub |
|
1210 | 1248 | $ hg ci -m 'change url to percent encoded' |
|
1211 | 1249 | $ cd .. |
|
1212 | 1250 | $ rm -r malicious-proxycommand-clone |
|
1213 | 1251 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1214 | 1252 | updating to branch default |
|
1215 | 1253 | abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s") |
|
1216 | 1254 | [255] |
@@ -1,681 +1,696 b'' | |||
|
1 | 1 | #require svn15 |
|
2 | 2 | |
|
3 | 3 | $ SVNREPOPATH=`pwd`/svn-repo |
|
4 | 4 | #if windows |
|
5 | 5 | $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
6 | 6 | #else |
|
7 | 7 | $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
8 | 8 | #endif |
|
9 | 9 | |
|
10 | 10 | $ filter_svn_output () { |
|
11 | 11 | > egrep -v 'Committing|Transmitting|Updating|(^$)' || true |
|
12 | 12 | > } |
|
13 | 13 | |
|
14 | 14 | create subversion repo |
|
15 | 15 | |
|
16 | 16 | $ WCROOT="`pwd`/svn-wc" |
|
17 | 17 | $ svnadmin create svn-repo |
|
18 | 18 | $ svn co "$SVNREPOURL" svn-wc |
|
19 | 19 | Checked out revision 0. |
|
20 | 20 | $ cd svn-wc |
|
21 | 21 | $ mkdir src |
|
22 | 22 | $ echo alpha > src/alpha |
|
23 | 23 | $ svn add src |
|
24 | 24 | A src |
|
25 | 25 | A src/alpha (glob) |
|
26 | 26 | $ mkdir externals |
|
27 | 27 | $ echo other > externals/other |
|
28 | 28 | $ svn add externals |
|
29 | 29 | A externals |
|
30 | 30 | A externals/other (glob) |
|
31 | 31 | $ svn ci -qm 'Add alpha' |
|
32 | 32 | $ svn up -q |
|
33 | 33 | $ echo "externals -r1 $SVNREPOURL/externals" > extdef |
|
34 | 34 | $ svn propset -F extdef svn:externals src |
|
35 | 35 | property 'svn:externals' set on 'src' |
|
36 | 36 | $ svn ci -qm 'Setting externals' |
|
37 | 37 | $ cd .. |
|
38 | 38 | |
|
39 | 39 | create hg repo |
|
40 | 40 | |
|
41 | 41 | $ mkdir sub |
|
42 | 42 | $ cd sub |
|
43 | 43 | $ hg init t |
|
44 | 44 | $ cd t |
|
45 | 45 | |
|
46 | 46 | first revision, no sub |
|
47 | 47 | |
|
48 | 48 | $ echo a > a |
|
49 | 49 | $ hg ci -Am0 |
|
50 | 50 | adding a |
|
51 | 51 | |
|
52 | 52 | add first svn sub with leading whitespaces |
|
53 | 53 | |
|
54 | 54 | $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub |
|
55 | 55 | $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub |
|
56 | 56 | $ svn co --quiet "$SVNREPOURL"/src s |
|
57 | 57 | $ mkdir subdir |
|
58 | 58 | $ svn co --quiet "$SVNREPOURL"/src subdir/s |
|
59 | 59 | $ hg add .hgsub |
|
60 | ||
|
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 | 75 | $ hg ci -m1 |
|
61 | 76 | |
|
62 | 77 | make sure we avoid empty commits (issue2445) |
|
63 | 78 | |
|
64 | 79 | $ hg sum |
|
65 | 80 | parent: 1:* tip (glob) |
|
66 | 81 | 1 |
|
67 | 82 | branch: default |
|
68 | 83 | commit: (clean) |
|
69 | 84 | update: (current) |
|
70 | 85 | phases: 2 draft |
|
71 | 86 | $ hg ci -moops |
|
72 | 87 | nothing changed |
|
73 | 88 | [1] |
|
74 | 89 | |
|
75 | 90 | debugsub |
|
76 | 91 | |
|
77 | 92 | $ hg debugsub |
|
78 | 93 | path s |
|
79 | 94 | source file://*/svn-repo/src (glob) |
|
80 | 95 | revision 2 |
|
81 | 96 | path subdir/s |
|
82 | 97 | source file://*/svn-repo/src (glob) |
|
83 | 98 | revision 2 |
|
84 | 99 | |
|
85 | 100 | change file in svn and hg, commit |
|
86 | 101 | |
|
87 | 102 | $ echo a >> a |
|
88 | 103 | $ echo alpha >> s/alpha |
|
89 | 104 | $ hg sum |
|
90 | 105 | parent: 1:* tip (glob) |
|
91 | 106 | 1 |
|
92 | 107 | branch: default |
|
93 | 108 | commit: 1 modified, 1 subrepos |
|
94 | 109 | update: (current) |
|
95 | 110 | phases: 2 draft |
|
96 | 111 | $ hg commit --subrepos -m 'Message!' | filter_svn_output |
|
97 | 112 | committing subrepository s |
|
98 | 113 | Sending*s/alpha (glob) |
|
99 | 114 | Committed revision 3. |
|
100 | 115 | Fetching external item into '*s/externals'* (glob) |
|
101 | 116 | External at revision 1. |
|
102 | 117 | At revision 3. |
|
103 | 118 | $ hg debugsub |
|
104 | 119 | path s |
|
105 | 120 | source file://*/svn-repo/src (glob) |
|
106 | 121 | revision 3 |
|
107 | 122 | path subdir/s |
|
108 | 123 | source file://*/svn-repo/src (glob) |
|
109 | 124 | revision 2 |
|
110 | 125 | |
|
111 | 126 | missing svn file, commit should fail |
|
112 | 127 | |
|
113 | 128 | $ rm s/alpha |
|
114 | 129 | $ hg commit --subrepos -m 'abort on missing file' |
|
115 | 130 | committing subrepository s |
|
116 | 131 | abort: cannot commit missing svn entries (in subrepository "s") |
|
117 | 132 | [255] |
|
118 | 133 | $ svn revert s/alpha > /dev/null |
|
119 | 134 | |
|
120 | 135 | add an unrelated revision in svn and update the subrepo to without |
|
121 | 136 | bringing any changes. |
|
122 | 137 | |
|
123 | 138 | $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated' |
|
124 | 139 | $ svn up -q s |
|
125 | 140 | $ hg sum |
|
126 | 141 | parent: 2:* tip (glob) |
|
127 | 142 | Message! |
|
128 | 143 | branch: default |
|
129 | 144 | commit: (clean) |
|
130 | 145 | update: (current) |
|
131 | 146 | phases: 3 draft |
|
132 | 147 | |
|
133 | 148 | $ echo a > s/a |
|
134 | 149 | |
|
135 | 150 | should be empty despite change to s/a |
|
136 | 151 | |
|
137 | 152 | $ hg st |
|
138 | 153 | |
|
139 | 154 | add a commit from svn |
|
140 | 155 | |
|
141 | 156 | $ cd "$WCROOT/src" |
|
142 | 157 | $ svn up -q |
|
143 | 158 | $ echo xyz >> alpha |
|
144 | 159 | $ svn propset svn:mime-type 'text/xml' alpha |
|
145 | 160 | property 'svn:mime-type' set on 'alpha' |
|
146 | 161 | $ svn ci -qm 'amend a from svn' |
|
147 | 162 | $ cd ../../sub/t |
|
148 | 163 | |
|
149 | 164 | this commit from hg will fail |
|
150 | 165 | |
|
151 | 166 | $ echo zzz >> s/alpha |
|
152 | 167 | $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date' |
|
153 | 168 | committing subrepository s |
|
154 | 169 | abort: svn:*Commit failed (details follow): (glob) |
|
155 | 170 | [255] |
|
156 | 171 | $ svn revert -q s/alpha |
|
157 | 172 | |
|
158 | 173 | this commit fails because of meta changes |
|
159 | 174 | |
|
160 | 175 | $ svn propset svn:mime-type 'text/html' s/alpha |
|
161 | 176 | property 'svn:mime-type' set on 's/alpha' (glob) |
|
162 | 177 | $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date' |
|
163 | 178 | committing subrepository s |
|
164 | 179 | abort: svn:*Commit failed (details follow): (glob) |
|
165 | 180 | [255] |
|
166 | 181 | $ svn revert -q s/alpha |
|
167 | 182 | |
|
168 | 183 | this commit fails because of externals changes |
|
169 | 184 | |
|
170 | 185 | $ echo zzz > s/externals/other |
|
171 | 186 | $ hg ci --subrepos -m 'amend externals from hg' |
|
172 | 187 | committing subrepository s |
|
173 | 188 | abort: cannot commit svn externals (in subrepository "s") |
|
174 | 189 | [255] |
|
175 | 190 | $ hg diff --subrepos -r 1:2 | grep -v diff |
|
176 | 191 | --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 |
|
177 | 192 | +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000 |
|
178 | 193 | @@ -1,2 +1,2 @@ |
|
179 | 194 | -2 s |
|
180 | 195 | +3 s |
|
181 | 196 | 2 subdir/s |
|
182 | 197 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
183 | 198 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
184 | 199 | @@ -1,1 +1,2 @@ |
|
185 | 200 | a |
|
186 | 201 | +a |
|
187 | 202 | $ svn revert -q s/externals/other |
|
188 | 203 | |
|
189 | 204 | this commit fails because of externals meta changes |
|
190 | 205 | |
|
191 | 206 | $ svn propset svn:mime-type 'text/html' s/externals/other |
|
192 | 207 | property 'svn:mime-type' set on 's/externals/other' (glob) |
|
193 | 208 | $ hg ci --subrepos -m 'amend externals from hg' |
|
194 | 209 | committing subrepository s |
|
195 | 210 | abort: cannot commit svn externals (in subrepository "s") |
|
196 | 211 | [255] |
|
197 | 212 | $ svn revert -q s/externals/other |
|
198 | 213 | |
|
199 | 214 | clone |
|
200 | 215 | |
|
201 | 216 | $ cd .. |
|
202 | 217 | $ hg clone t tc |
|
203 | 218 | updating to branch default |
|
204 | 219 | A tc/s/alpha (glob) |
|
205 | 220 | U tc/s (glob) |
|
206 | 221 | |
|
207 | 222 | Fetching external item into 'tc/s/externals'* (glob) |
|
208 | 223 | A tc/s/externals/other (glob) |
|
209 | 224 | Checked out external at revision 1. |
|
210 | 225 | |
|
211 | 226 | Checked out revision 3. |
|
212 | 227 | A tc/subdir/s/alpha (glob) |
|
213 | 228 | U tc/subdir/s (glob) |
|
214 | 229 | |
|
215 | 230 | Fetching external item into 'tc/subdir/s/externals'* (glob) |
|
216 | 231 | A tc/subdir/s/externals/other (glob) |
|
217 | 232 | Checked out external at revision 1. |
|
218 | 233 | |
|
219 | 234 | Checked out revision 2. |
|
220 | 235 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 236 | $ cd tc |
|
222 | 237 | |
|
223 | 238 | debugsub in clone |
|
224 | 239 | |
|
225 | 240 | $ hg debugsub |
|
226 | 241 | path s |
|
227 | 242 | source file://*/svn-repo/src (glob) |
|
228 | 243 | revision 3 |
|
229 | 244 | path subdir/s |
|
230 | 245 | source file://*/svn-repo/src (glob) |
|
231 | 246 | revision 2 |
|
232 | 247 | |
|
233 | 248 | verify subrepo is contained within the repo directory |
|
234 | 249 | |
|
235 | 250 | $ $PYTHON -c "import os.path; print os.path.exists('s')" |
|
236 | 251 | True |
|
237 | 252 | |
|
238 | 253 | update to nullrev (must delete the subrepo) |
|
239 | 254 | |
|
240 | 255 | $ hg up null |
|
241 | 256 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
242 | 257 | $ ls |
|
243 | 258 | |
|
244 | 259 | Check hg update --clean |
|
245 | 260 | $ cd "$TESTTMP/sub/t" |
|
246 | 261 | $ cd s |
|
247 | 262 | $ echo c0 > alpha |
|
248 | 263 | $ echo c1 > f1 |
|
249 | 264 | $ echo c1 > f2 |
|
250 | 265 | $ svn add f1 -q |
|
251 | 266 | $ svn status | sort |
|
252 | 267 | |
|
253 | 268 | ? * a (glob) |
|
254 | 269 | ? * f2 (glob) |
|
255 | 270 | A * f1 (glob) |
|
256 | 271 | M * alpha (glob) |
|
257 | 272 | Performing status on external item at 'externals'* (glob) |
|
258 | 273 | X * externals (glob) |
|
259 | 274 | $ cd ../.. |
|
260 | 275 | $ hg -R t update -C |
|
261 | 276 | |
|
262 | 277 | Fetching external item into 't/s/externals'* (glob) |
|
263 | 278 | Checked out external at revision 1. |
|
264 | 279 | |
|
265 | 280 | Checked out revision 3. |
|
266 | 281 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
267 | 282 | $ cd t/s |
|
268 | 283 | $ svn status | sort |
|
269 | 284 | |
|
270 | 285 | ? * a (glob) |
|
271 | 286 | ? * f1 (glob) |
|
272 | 287 | ? * f2 (glob) |
|
273 | 288 | Performing status on external item at 'externals'* (glob) |
|
274 | 289 | X * externals (glob) |
|
275 | 290 | |
|
276 | 291 | Sticky subrepositories, no changes |
|
277 | 292 | $ cd "$TESTTMP/sub/t" |
|
278 | 293 | $ hg id -n |
|
279 | 294 | 2 |
|
280 | 295 | $ cd s |
|
281 | 296 | $ svnversion |
|
282 | 297 | 3 |
|
283 | 298 | $ cd .. |
|
284 | 299 | $ hg update 1 |
|
285 | 300 | U *s/alpha (glob) |
|
286 | 301 | |
|
287 | 302 | Fetching external item into '*s/externals'* (glob) |
|
288 | 303 | Checked out external at revision 1. |
|
289 | 304 | |
|
290 | 305 | Checked out revision 2. |
|
291 | 306 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
292 | 307 | $ hg id -n |
|
293 | 308 | 1 |
|
294 | 309 | $ cd s |
|
295 | 310 | $ svnversion |
|
296 | 311 | 2 |
|
297 | 312 | $ cd .. |
|
298 | 313 | |
|
299 | 314 | Sticky subrepositories, file changes |
|
300 | 315 | $ touch s/f1 |
|
301 | 316 | $ cd s |
|
302 | 317 | $ svn add f1 |
|
303 | 318 | A f1 |
|
304 | 319 | $ cd .. |
|
305 | 320 | $ hg id -n |
|
306 | 321 | 1+ |
|
307 | 322 | $ cd s |
|
308 | 323 | $ svnversion |
|
309 | 324 | 2M |
|
310 | 325 | $ cd .. |
|
311 | 326 | $ hg update tip |
|
312 | 327 | subrepository s diverged (local revision: 2, remote revision: 3) |
|
313 | 328 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
314 | 329 | subrepository sources for s differ |
|
315 | 330 | use (l)ocal source (2) or (r)emote source (3)? l |
|
316 | 331 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
317 | 332 | $ hg id -n |
|
318 | 333 | 2+ |
|
319 | 334 | $ cd s |
|
320 | 335 | $ svnversion |
|
321 | 336 | 2M |
|
322 | 337 | $ cd .. |
|
323 | 338 | $ hg update --clean tip |
|
324 | 339 | U *s/alpha (glob) |
|
325 | 340 | |
|
326 | 341 | Fetching external item into '*s/externals'* (glob) |
|
327 | 342 | Checked out external at revision 1. |
|
328 | 343 | |
|
329 | 344 | Checked out revision 3. |
|
330 | 345 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
331 | 346 | |
|
332 | 347 | Sticky subrepository, revision updates |
|
333 | 348 | $ hg id -n |
|
334 | 349 | 2 |
|
335 | 350 | $ cd s |
|
336 | 351 | $ svnversion |
|
337 | 352 | 3 |
|
338 | 353 | $ cd .. |
|
339 | 354 | $ cd s |
|
340 | 355 | $ svn update -qr 1 |
|
341 | 356 | $ cd .. |
|
342 | 357 | $ hg update 1 |
|
343 | 358 | subrepository s diverged (local revision: 3, remote revision: 2) |
|
344 | 359 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
345 | 360 | subrepository sources for s differ (in checked out version) |
|
346 | 361 | use (l)ocal source (1) or (r)emote source (2)? l |
|
347 | 362 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
348 | 363 | $ hg id -n |
|
349 | 364 | 1+ |
|
350 | 365 | $ cd s |
|
351 | 366 | $ svnversion |
|
352 | 367 | 1 |
|
353 | 368 | $ cd .. |
|
354 | 369 | |
|
355 | 370 | Sticky subrepository, file changes and revision updates |
|
356 | 371 | $ touch s/f1 |
|
357 | 372 | $ cd s |
|
358 | 373 | $ svn add f1 |
|
359 | 374 | A f1 |
|
360 | 375 | $ svnversion |
|
361 | 376 | 1M |
|
362 | 377 | $ cd .. |
|
363 | 378 | $ hg id -n |
|
364 | 379 | 1+ |
|
365 | 380 | $ hg update tip |
|
366 | 381 | subrepository s diverged (local revision: 3, remote revision: 3) |
|
367 | 382 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
368 | 383 | subrepository sources for s differ |
|
369 | 384 | use (l)ocal source (1) or (r)emote source (3)? l |
|
370 | 385 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
371 | 386 | $ hg id -n |
|
372 | 387 | 2+ |
|
373 | 388 | $ cd s |
|
374 | 389 | $ svnversion |
|
375 | 390 | 1M |
|
376 | 391 | $ cd .. |
|
377 | 392 | |
|
378 | 393 | Sticky repository, update --clean |
|
379 | 394 | $ hg update --clean tip | grep -v 's[/\]externals[/\]other' |
|
380 | 395 | U *s/alpha (glob) |
|
381 | 396 | U *s (glob) |
|
382 | 397 | |
|
383 | 398 | Fetching external item into '*s/externals'* (glob) |
|
384 | 399 | Checked out external at revision 1. |
|
385 | 400 | |
|
386 | 401 | Checked out revision 3. |
|
387 | 402 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
388 | 403 | $ hg id -n |
|
389 | 404 | 2 |
|
390 | 405 | $ cd s |
|
391 | 406 | $ svnversion |
|
392 | 407 | 3 |
|
393 | 408 | $ cd .. |
|
394 | 409 | |
|
395 | 410 | Test subrepo already at intended revision: |
|
396 | 411 | $ cd s |
|
397 | 412 | $ svn update -qr 2 |
|
398 | 413 | $ cd .. |
|
399 | 414 | $ hg update 1 |
|
400 | 415 | subrepository s diverged (local revision: 3, remote revision: 2) |
|
401 | 416 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
402 | 417 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
403 | 418 | $ hg id -n |
|
404 | 419 | 1+ |
|
405 | 420 | $ cd s |
|
406 | 421 | $ svnversion |
|
407 | 422 | 2 |
|
408 | 423 | $ cd .. |
|
409 | 424 | |
|
410 | 425 | Test case where subversion would fail to update the subrepo because there |
|
411 | 426 | are unknown directories being replaced by tracked ones (happens with rebase). |
|
412 | 427 | |
|
413 | 428 | $ cd "$WCROOT/src" |
|
414 | 429 | $ mkdir dir |
|
415 | 430 | $ echo epsilon.py > dir/epsilon.py |
|
416 | 431 | $ svn add dir |
|
417 | 432 | A dir |
|
418 | 433 | A dir/epsilon.py (glob) |
|
419 | 434 | $ svn ci -qm 'Add dir/epsilon.py' |
|
420 | 435 | $ cd ../.. |
|
421 | 436 | $ hg init rebaserepo |
|
422 | 437 | $ cd rebaserepo |
|
423 | 438 | $ svn co -r5 --quiet "$SVNREPOURL"/src s |
|
424 | 439 | $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub |
|
425 | 440 | $ hg add .hgsub |
|
426 | 441 | $ hg ci -m addsub |
|
427 | 442 | $ echo a > a |
|
428 | 443 | $ hg add . |
|
429 | 444 | adding a |
|
430 | 445 | $ hg ci -m adda |
|
431 | 446 | $ hg up 0 |
|
432 | 447 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
433 | 448 | $ svn up -qr6 s |
|
434 | 449 | $ hg ci -m updatesub |
|
435 | 450 | created new head |
|
436 | 451 | $ echo pyc > s/dir/epsilon.pyc |
|
437 | 452 | $ hg up 1 |
|
438 | 453 | D *s/dir (glob) |
|
439 | 454 | |
|
440 | 455 | Fetching external item into '*s/externals'* (glob) |
|
441 | 456 | Checked out external at revision 1. |
|
442 | 457 | |
|
443 | 458 | Checked out revision 5. |
|
444 | 459 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
445 | 460 | $ hg up -q 2 |
|
446 | 461 | |
|
447 | 462 | Modify one of the externals to point to a different path so we can |
|
448 | 463 | test having obstructions when switching branches on checkout: |
|
449 | 464 | $ hg checkout tip |
|
450 | 465 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
451 | 466 | $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub |
|
452 | 467 | $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct |
|
453 | 468 | $ hg commit -m 'Start making obstructed working copy' |
|
454 | 469 | $ hg book other |
|
455 | 470 | $ hg co -r 'p1(tip)' |
|
456 | 471 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
457 | 472 | (leaving bookmark other) |
|
458 | 473 | $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub |
|
459 | 474 | $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct |
|
460 | 475 | $ hg commit -m 'Other branch which will be obstructed' |
|
461 | 476 | created new head |
|
462 | 477 | |
|
463 | 478 | Switching back to the head where we have another path mapped to the |
|
464 | 479 | same subrepo should work if the subrepo is clean. |
|
465 | 480 | $ hg co other |
|
466 | 481 | A *obstruct/other (glob) |
|
467 | 482 | Checked out revision 1. |
|
468 | 483 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
469 | 484 | (activating bookmark other) |
|
470 | 485 | |
|
471 | 486 | This is surprising, but is also correct based on the current code: |
|
472 | 487 | $ echo "updating should (maybe) fail" > obstruct/other |
|
473 | 488 | $ hg co tip |
|
474 | 489 | abort: uncommitted changes |
|
475 | 490 | (commit or update --clean to discard changes) |
|
476 | 491 | [255] |
|
477 | 492 | |
|
478 | 493 | Point to a Subversion branch which has since been deleted and recreated |
|
479 | 494 | First, create that condition in the repository. |
|
480 | 495 | |
|
481 | 496 | $ hg ci --subrepos -m cleanup | filter_svn_output |
|
482 | 497 | committing subrepository obstruct |
|
483 | 498 | Sending obstruct/other (glob) |
|
484 | 499 | Committed revision 7. |
|
485 | 500 | At revision 7. |
|
486 | 501 | $ svn mkdir -qm "baseline" $SVNREPOURL/trunk |
|
487 | 502 | $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch |
|
488 | 503 | $ svn co --quiet "$SVNREPOURL"/branch tempwc |
|
489 | 504 | $ cd tempwc |
|
490 | 505 | $ echo "something old" > somethingold |
|
491 | 506 | $ svn add somethingold |
|
492 | 507 | A somethingold |
|
493 | 508 | $ svn ci -qm 'Something old' |
|
494 | 509 | $ svn rm -qm "remove branch" $SVNREPOURL/branch |
|
495 | 510 | $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch |
|
496 | 511 | $ svn up -q |
|
497 | 512 | $ echo "something new" > somethingnew |
|
498 | 513 | $ svn add somethingnew |
|
499 | 514 | A somethingnew |
|
500 | 515 | $ svn ci -qm 'Something new' |
|
501 | 516 | $ cd .. |
|
502 | 517 | $ rm -rf tempwc |
|
503 | 518 | $ svn co "$SVNREPOURL/branch"@10 recreated |
|
504 | 519 | A recreated/somethingold (glob) |
|
505 | 520 | Checked out revision 10. |
|
506 | 521 | $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub |
|
507 | 522 | $ hg ci -m addsub |
|
508 | 523 | $ cd recreated |
|
509 | 524 | $ svn up -q |
|
510 | 525 | $ cd .. |
|
511 | 526 | $ hg ci -m updatesub |
|
512 | 527 | $ hg up -r-2 |
|
513 | 528 | D *recreated/somethingnew (glob) |
|
514 | 529 | A *recreated/somethingold (glob) |
|
515 | 530 | Checked out revision 10. |
|
516 | 531 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
517 | 532 | (leaving bookmark other) |
|
518 | 533 | $ test -f recreated/somethingold |
|
519 | 534 | |
|
520 | 535 | Test archive |
|
521 | 536 | |
|
522 | 537 | $ hg archive -S ../archive-all --debug --config progress.debug=true |
|
523 | 538 | archiving: 0/2 files (0.00%) |
|
524 | 539 | archiving: .hgsub 1/2 files (50.00%) |
|
525 | 540 | archiving: .hgsubstate 2/2 files (100.00%) |
|
526 | 541 | archiving (obstruct): 0/1 files (0.00%) |
|
527 | 542 | archiving (obstruct): 1/1 files (100.00%) |
|
528 | 543 | archiving (recreated): 0/1 files (0.00%) |
|
529 | 544 | archiving (recreated): 1/1 files (100.00%) |
|
530 | 545 | archiving (s): 0/2 files (0.00%) |
|
531 | 546 | archiving (s): 1/2 files (50.00%) |
|
532 | 547 | archiving (s): 2/2 files (100.00%) |
|
533 | 548 | |
|
534 | 549 | $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old |
|
535 | 550 | archiving: 0/2 files (0.00%) |
|
536 | 551 | archiving: .hgsub 1/2 files (50.00%) |
|
537 | 552 | archiving: .hgsubstate 2/2 files (100.00%) |
|
538 | 553 | archiving (obstruct): 0/1 files (0.00%) |
|
539 | 554 | archiving (obstruct): 1/1 files (100.00%) |
|
540 | 555 | archiving (recreated): 0 files |
|
541 | 556 | archiving (s): 0/2 files (0.00%) |
|
542 | 557 | archiving (s): 1/2 files (50.00%) |
|
543 | 558 | archiving (s): 2/2 files (100.00%) |
|
544 | 559 | $ find ../archive-exclude | sort |
|
545 | 560 | ../archive-exclude |
|
546 | 561 | ../archive-exclude/.hg_archival.txt |
|
547 | 562 | ../archive-exclude/.hgsub |
|
548 | 563 | ../archive-exclude/.hgsubstate |
|
549 | 564 | ../archive-exclude/obstruct |
|
550 | 565 | ../archive-exclude/obstruct/other |
|
551 | 566 | ../archive-exclude/s |
|
552 | 567 | ../archive-exclude/s/alpha |
|
553 | 568 | ../archive-exclude/s/dir |
|
554 | 569 | ../archive-exclude/s/dir/epsilon.py |
|
555 | 570 | |
|
556 | 571 | Test forgetting files, not implemented in svn subrepo, used to |
|
557 | 572 | traceback |
|
558 | 573 | |
|
559 | 574 | #if no-windows |
|
560 | 575 | $ hg forget 'notafile*' |
|
561 | 576 | notafile*: No such file or directory |
|
562 | 577 | [1] |
|
563 | 578 | #else |
|
564 | 579 | $ hg forget 'notafile' |
|
565 | 580 | notafile: * (glob) |
|
566 | 581 | [1] |
|
567 | 582 | #endif |
|
568 | 583 | |
|
569 | 584 | Test a subrepo referencing a just moved svn path. Last commit rev will |
|
570 | 585 | be different from the revision, and the path will be different as |
|
571 | 586 | well. |
|
572 | 587 | |
|
573 | 588 | $ cd "$WCROOT" |
|
574 | 589 | $ svn up > /dev/null |
|
575 | 590 | $ mkdir trunk/subdir branches |
|
576 | 591 | $ echo a > trunk/subdir/a |
|
577 | 592 | $ svn add trunk/subdir branches |
|
578 | 593 | A trunk/subdir (glob) |
|
579 | 594 | A trunk/subdir/a (glob) |
|
580 | 595 | A branches |
|
581 | 596 | $ svn ci -qm addsubdir |
|
582 | 597 | $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch |
|
583 | 598 | $ cd .. |
|
584 | 599 | |
|
585 | 600 | $ hg init repo2 |
|
586 | 601 | $ cd repo2 |
|
587 | 602 | $ svn co $SVNREPOURL/branches/somebranch/subdir |
|
588 | 603 | A subdir/a (glob) |
|
589 | 604 | Checked out revision 15. |
|
590 | 605 | $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub |
|
591 | 606 | $ hg add .hgsub |
|
592 | 607 | $ hg ci -m addsub |
|
593 | 608 | $ hg up null |
|
594 | 609 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
595 | 610 | $ hg up |
|
596 | 611 | A *subdir/a (glob) |
|
597 | 612 | Checked out revision 15. |
|
598 | 613 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
599 | 614 | $ cd .. |
|
600 | 615 | |
|
601 | 616 | Test sanitizing ".hg/hgrc" in subrepo |
|
602 | 617 | |
|
603 | 618 | $ cd sub/t |
|
604 | 619 | $ hg update -q -C tip |
|
605 | 620 | $ cd s |
|
606 | 621 | $ mkdir .hg |
|
607 | 622 | $ echo '.hg/hgrc in svn repo' > .hg/hgrc |
|
608 | 623 | $ mkdir -p sub/.hg |
|
609 | 624 | $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc |
|
610 | 625 | $ svn add .hg sub |
|
611 | 626 | A .hg |
|
612 | 627 | A .hg/hgrc (glob) |
|
613 | 628 | A sub |
|
614 | 629 | A sub/.hg (glob) |
|
615 | 630 | A sub/.hg/hgrc (glob) |
|
616 | 631 | $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update' |
|
617 | 632 | $ svn up -q |
|
618 | 633 | $ cd .. |
|
619 | 634 | $ hg commit -S -m 'commit with svn revision including .hg/hgrc' |
|
620 | 635 | $ grep ' s$' .hgsubstate |
|
621 | 636 | 16 s |
|
622 | 637 | $ cd .. |
|
623 | 638 | |
|
624 | 639 | $ hg -R tc pull -u -q 2>&1 | sort |
|
625 | 640 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob) |
|
626 | 641 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob) |
|
627 | 642 | $ cd tc |
|
628 | 643 | $ grep ' s$' .hgsubstate |
|
629 | 644 | 16 s |
|
630 | 645 | $ test -f s/.hg/hgrc |
|
631 | 646 | [1] |
|
632 | 647 | $ test -f s/sub/.hg/hgrc |
|
633 | 648 | [1] |
|
634 | 649 | |
|
635 | 650 | Test that sanitizing is omitted in meta data area: |
|
636 | 651 | |
|
637 | 652 | $ mkdir s/.svn/.hg |
|
638 | 653 | $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc |
|
639 | 654 | $ hg update -q -C '.^1' |
|
640 | 655 | |
|
641 | 656 | $ cd ../.. |
|
642 | 657 | |
|
643 | 658 | SEC: test for ssh exploit |
|
644 | 659 | |
|
645 | 660 | $ hg init ssh-vuln |
|
646 | 661 | $ cd ssh-vuln |
|
647 | 662 | $ echo "s = [svn]$SVNREPOURL/src" >> .hgsub |
|
648 | 663 | $ svn co --quiet "$SVNREPOURL"/src s |
|
649 | 664 | $ hg add .hgsub |
|
650 | 665 | $ hg ci -m1 |
|
651 | 666 | $ echo "s = [svn]svn+ssh://-oProxyCommand=touch%20owned%20nested" > .hgsub |
|
652 | 667 | $ hg ci -m2 |
|
653 | 668 | $ cd .. |
|
654 | 669 | $ hg clone ssh-vuln ssh-vuln-clone |
|
655 | 670 | updating to branch default |
|
656 | 671 | abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s") |
|
657 | 672 | [255] |
|
658 | 673 | |
|
659 | 674 | also check that a percent encoded '-' (%2D) doesn't work |
|
660 | 675 | |
|
661 | 676 | $ cd ssh-vuln |
|
662 | 677 | $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20nested" > .hgsub |
|
663 | 678 | $ hg ci -m3 |
|
664 | 679 | $ cd .. |
|
665 | 680 | $ rm -r ssh-vuln-clone |
|
666 | 681 | $ hg clone ssh-vuln ssh-vuln-clone |
|
667 | 682 | updating to branch default |
|
668 | 683 | abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned nested' (in subrepository "s") |
|
669 | 684 | [255] |
|
670 | 685 | |
|
671 | 686 | also check that hiding the attack in the username doesn't work: |
|
672 | 687 | |
|
673 | 688 | $ cd ssh-vuln |
|
674 | 689 | $ echo "s = [svn]svn+ssh://%2DoProxyCommand=touch%20owned%20foo@example.com/nested" > .hgsub |
|
675 | 690 | $ hg ci -m3 |
|
676 | 691 | $ cd .. |
|
677 | 692 | $ rm -r ssh-vuln-clone |
|
678 | 693 | $ hg clone ssh-vuln ssh-vuln-clone |
|
679 | 694 | updating to branch default |
|
680 | 695 | abort: potentially unsafe url: 'svn+ssh://-oProxyCommand=touch owned foo@example.com/nested' (in subrepository "s") |
|
681 | 696 | [255] |
@@ -1,1893 +1,1931 b'' | |||
|
1 | 1 | Let commit recurse into subrepos by default to match pre-2.0 behavior: |
|
2 | 2 | |
|
3 | 3 | $ echo "[ui]" >> $HGRCPATH |
|
4 | 4 | $ echo "commitsubrepos = Yes" >> $HGRCPATH |
|
5 | 5 | |
|
6 | 6 | $ hg init t |
|
7 | 7 | $ cd t |
|
8 | 8 | |
|
9 | 9 | first revision, no sub |
|
10 | 10 | |
|
11 | 11 | $ echo a > a |
|
12 | 12 | $ hg ci -Am0 |
|
13 | 13 | adding a |
|
14 | 14 | |
|
15 | 15 | add first sub |
|
16 | 16 | |
|
17 | 17 | $ echo s = s > .hgsub |
|
18 | 18 | $ hg add .hgsub |
|
19 | 19 | $ hg init s |
|
20 | 20 | $ echo a > s/a |
|
21 | 21 | |
|
22 | 22 | Issue2232: committing a subrepo without .hgsub |
|
23 | 23 | |
|
24 | 24 | $ hg ci -mbad s |
|
25 | 25 | abort: can't commit subrepos without .hgsub |
|
26 | 26 | [255] |
|
27 | 27 | |
|
28 | 28 | $ hg -R s add s/a |
|
29 | 29 | $ hg files -S |
|
30 | 30 | .hgsub |
|
31 | 31 | a |
|
32 | 32 | s/a (glob) |
|
33 | 33 | |
|
34 | 34 | $ hg -R s ci -Ams0 |
|
35 | 35 | $ hg sum |
|
36 | 36 | parent: 0:f7b1eb17ad24 tip |
|
37 | 37 | 0 |
|
38 | 38 | branch: default |
|
39 | 39 | commit: 1 added, 1 subrepos |
|
40 | 40 | update: (current) |
|
41 | 41 | phases: 1 draft |
|
42 | 42 | $ hg ci -m1 |
|
43 | 43 | |
|
44 | 44 | test handling .hgsubstate "added" explicitly. |
|
45 | 45 | |
|
46 | 46 | $ hg parents --template '{node}\n{files}\n' |
|
47 | 47 | 7cf8cfea66e410e8e3336508dfeec07b3192de51 |
|
48 | 48 | .hgsub .hgsubstate |
|
49 | 49 | $ hg rollback -q |
|
50 | 50 | $ hg add .hgsubstate |
|
51 | 51 | $ hg ci -m1 |
|
52 | 52 | $ hg parents --template '{node}\n{files}\n' |
|
53 | 53 | 7cf8cfea66e410e8e3336508dfeec07b3192de51 |
|
54 | 54 | .hgsub .hgsubstate |
|
55 | 55 | |
|
56 | 56 | Subrepopath which overlaps with filepath, does not change warnings in remove() |
|
57 | 57 | |
|
58 | 58 | $ mkdir snot |
|
59 | 59 | $ touch snot/file |
|
60 | 60 | $ hg remove -S snot/file |
|
61 | 61 | not removing snot/file: file is untracked (glob) |
|
62 | 62 | [1] |
|
63 | 63 | $ hg cat snot/filenot |
|
64 | 64 | snot/filenot: no such file in rev 7cf8cfea66e4 (glob) |
|
65 | 65 | [1] |
|
66 | 66 | $ rm -r snot |
|
67 | 67 | |
|
68 | 68 | Revert subrepo and test subrepo fileset keyword: |
|
69 | 69 | |
|
70 | 70 | $ echo b > s/a |
|
71 | 71 | $ hg revert --dry-run "set:subrepo('glob:s*')" |
|
72 | 72 | reverting subrepo s |
|
73 | 73 | reverting s/a (glob) |
|
74 | 74 | $ cat s/a |
|
75 | 75 | b |
|
76 | 76 | $ hg revert "set:subrepo('glob:s*')" |
|
77 | 77 | reverting subrepo s |
|
78 | 78 | reverting s/a (glob) |
|
79 | 79 | $ cat s/a |
|
80 | 80 | a |
|
81 | 81 | $ rm s/a.orig |
|
82 | 82 | |
|
83 | 83 | Revert subrepo with no backup. The "reverting s/a" line is gone since |
|
84 | 84 | we're really running 'hg update' in the subrepo: |
|
85 | 85 | |
|
86 | 86 | $ echo b > s/a |
|
87 | 87 | $ hg revert --no-backup s |
|
88 | 88 | reverting subrepo s |
|
89 | 89 | |
|
90 | 90 | Issue2022: update -C |
|
91 | 91 | |
|
92 | 92 | $ echo b > s/a |
|
93 | 93 | $ hg sum |
|
94 | 94 | parent: 1:7cf8cfea66e4 tip |
|
95 | 95 | 1 |
|
96 | 96 | branch: default |
|
97 | 97 | commit: 1 subrepos |
|
98 | 98 | update: (current) |
|
99 | 99 | phases: 2 draft |
|
100 | 100 | $ hg co -C 1 |
|
101 | 101 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 102 | $ hg sum |
|
103 | 103 | parent: 1:7cf8cfea66e4 tip |
|
104 | 104 | 1 |
|
105 | 105 | branch: default |
|
106 | 106 | commit: (clean) |
|
107 | 107 | update: (current) |
|
108 | 108 | phases: 2 draft |
|
109 | 109 | |
|
110 | 110 | commands that require a clean repo should respect subrepos |
|
111 | 111 | |
|
112 | 112 | $ echo b >> s/a |
|
113 | 113 | $ hg backout tip |
|
114 | 114 | abort: uncommitted changes in subrepository "s" |
|
115 | 115 | [255] |
|
116 | 116 | $ hg revert -C -R s s/a |
|
117 | 117 | |
|
118 | 118 | add sub sub |
|
119 | 119 | |
|
120 | 120 | $ echo ss = ss > s/.hgsub |
|
121 | 121 | $ hg init s/ss |
|
122 | 122 | $ echo a > s/ss/a |
|
123 | 123 | $ hg -R s add s/.hgsub |
|
124 | 124 | $ hg -R s/ss add s/ss/a |
|
125 | 125 | $ hg sum |
|
126 | 126 | parent: 1:7cf8cfea66e4 tip |
|
127 | 127 | 1 |
|
128 | 128 | branch: default |
|
129 | 129 | commit: 1 subrepos |
|
130 | 130 | update: (current) |
|
131 | 131 | phases: 2 draft |
|
132 | 132 | $ hg ci -m2 |
|
133 | 133 | committing subrepository s |
|
134 | 134 | committing subrepository s/ss (glob) |
|
135 | 135 | $ hg sum |
|
136 | 136 | parent: 2:df30734270ae tip |
|
137 | 137 | 2 |
|
138 | 138 | branch: default |
|
139 | 139 | commit: (clean) |
|
140 | 140 | update: (current) |
|
141 | 141 | phases: 3 draft |
|
142 | 142 | |
|
143 | 143 | test handling .hgsubstate "modified" explicitly. |
|
144 | 144 | |
|
145 | 145 | $ hg parents --template '{node}\n{files}\n' |
|
146 | 146 | df30734270ae757feb35e643b7018e818e78a9aa |
|
147 | 147 | .hgsubstate |
|
148 | 148 | $ hg rollback -q |
|
149 | 149 | $ hg status -A .hgsubstate |
|
150 | 150 | M .hgsubstate |
|
151 | 151 | $ hg ci -m2 |
|
152 | 152 | $ hg parents --template '{node}\n{files}\n' |
|
153 | 153 | df30734270ae757feb35e643b7018e818e78a9aa |
|
154 | 154 | .hgsubstate |
|
155 | 155 | |
|
156 | 156 | bump sub rev (and check it is ignored by ui.commitsubrepos) |
|
157 | 157 | |
|
158 | 158 | $ echo b > s/a |
|
159 | 159 | $ hg -R s ci -ms1 |
|
160 | 160 | $ hg --config ui.commitsubrepos=no ci -m3 |
|
161 | 161 | |
|
162 | 162 | leave sub dirty (and check ui.commitsubrepos=no aborts the commit) |
|
163 | 163 | |
|
164 | 164 | $ echo c > s/a |
|
165 | 165 | $ hg --config ui.commitsubrepos=no ci -m4 |
|
166 | 166 | abort: uncommitted changes in subrepository "s" |
|
167 | 167 | (use --subrepos for recursive commit) |
|
168 | 168 | [255] |
|
169 | 169 | $ hg id |
|
170 | 170 | f6affe3fbfaa+ tip |
|
171 | 171 | $ hg -R s ci -mc |
|
172 | 172 | $ hg id |
|
173 | 173 | f6affe3fbfaa+ tip |
|
174 | 174 | $ echo d > s/a |
|
175 | 175 | $ hg ci -m4 |
|
176 | 176 | committing subrepository s |
|
177 | 177 | $ hg tip -R s |
|
178 | 178 | changeset: 4:02dcf1d70411 |
|
179 | 179 | tag: tip |
|
180 | 180 | user: test |
|
181 | 181 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
182 | 182 | summary: 4 |
|
183 | 183 | |
|
184 | 184 | |
|
185 | 185 | check caching |
|
186 | 186 | |
|
187 | 187 | $ hg co 0 |
|
188 | 188 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
189 | 189 | $ hg debugsub |
|
190 | 190 | |
|
191 | 191 | restore |
|
192 | 192 | |
|
193 | 193 | $ hg co |
|
194 | 194 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
195 | 195 | $ hg debugsub |
|
196 | 196 | path s |
|
197 | 197 | source s |
|
198 | 198 | revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef |
|
199 | 199 | |
|
200 | 200 | new branch for merge tests |
|
201 | 201 | |
|
202 | 202 | $ hg co 1 |
|
203 | 203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
204 | 204 | $ echo t = t >> .hgsub |
|
205 | 205 | $ hg init t |
|
206 | 206 | $ echo t > t/t |
|
207 | 207 | $ hg -R t add t |
|
208 | 208 | adding t/t (glob) |
|
209 | 209 | |
|
210 | 210 | 5 |
|
211 | 211 | |
|
212 | 212 | $ hg ci -m5 # add sub |
|
213 | 213 | committing subrepository t |
|
214 | 214 | created new head |
|
215 | 215 | $ echo t2 > t/t |
|
216 | 216 | |
|
217 | 217 | 6 |
|
218 | 218 | |
|
219 | 219 | $ hg st -R s |
|
220 | 220 | $ hg ci -m6 # change sub |
|
221 | 221 | committing subrepository t |
|
222 | 222 | $ hg debugsub |
|
223 | 223 | path s |
|
224 | 224 | source s |
|
225 | 225 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
226 | 226 | path t |
|
227 | 227 | source t |
|
228 | 228 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
229 | 229 | $ echo t3 > t/t |
|
230 | 230 | |
|
231 | 231 | 7 |
|
232 | 232 | |
|
233 | 233 | $ hg ci -m7 # change sub again for conflict test |
|
234 | 234 | committing subrepository t |
|
235 | 235 | $ hg rm .hgsub |
|
236 | 236 | |
|
237 | 237 | 8 |
|
238 | 238 | |
|
239 | 239 | $ hg ci -m8 # remove sub |
|
240 | 240 | |
|
241 | 241 | test handling .hgsubstate "removed" explicitly. |
|
242 | 242 | |
|
243 | 243 | $ hg parents --template '{node}\n{files}\n' |
|
244 | 244 | 96615c1dad2dc8e3796d7332c77ce69156f7b78e |
|
245 | 245 | .hgsub .hgsubstate |
|
246 | 246 | $ hg rollback -q |
|
247 | 247 | $ hg remove .hgsubstate |
|
248 | 248 | $ hg ci -m8 |
|
249 | 249 | $ hg parents --template '{node}\n{files}\n' |
|
250 | 250 | 96615c1dad2dc8e3796d7332c77ce69156f7b78e |
|
251 | 251 | .hgsub .hgsubstate |
|
252 | 252 | |
|
253 | 253 | merge tests |
|
254 | 254 | |
|
255 | 255 | $ hg co -C 3 |
|
256 | 256 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
257 | 257 | $ hg merge 5 # test adding |
|
258 | 258 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
259 | 259 | (branch merge, don't forget to commit) |
|
260 | 260 | $ hg debugsub |
|
261 | 261 | path s |
|
262 | 262 | source s |
|
263 | 263 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
264 | 264 | path t |
|
265 | 265 | source t |
|
266 | 266 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 |
|
267 | 267 | $ hg ci -m9 |
|
268 | 268 | created new head |
|
269 | 269 | $ hg merge 6 --debug # test change |
|
270 | 270 | searching for copies back to rev 2 |
|
271 | 271 | resolving manifests |
|
272 | 272 | branchmerge: True, force: False, partial: False |
|
273 | 273 | ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4 |
|
274 | 274 | starting 4 threads for background file closing (?) |
|
275 | 275 | .hgsubstate: versions differ -> m (premerge) |
|
276 | 276 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec |
|
277 | 277 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg |
|
278 | 278 | getting subrepo t |
|
279 | 279 | resolving manifests |
|
280 | 280 | branchmerge: False, force: False, partial: False |
|
281 | 281 | ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a |
|
282 | 282 | t: remote is newer -> g |
|
283 | 283 | getting t |
|
284 | 284 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
285 | 285 | (branch merge, don't forget to commit) |
|
286 | 286 | $ hg debugsub |
|
287 | 287 | path s |
|
288 | 288 | source s |
|
289 | 289 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
290 | 290 | path t |
|
291 | 291 | source t |
|
292 | 292 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
293 | 293 | $ echo conflict > t/t |
|
294 | 294 | $ hg ci -m10 |
|
295 | 295 | committing subrepository t |
|
296 | 296 | $ HGMERGE=internal:merge hg merge --debug 7 # test conflict |
|
297 | 297 | searching for copies back to rev 2 |
|
298 | 298 | resolving manifests |
|
299 | 299 | branchmerge: True, force: False, partial: False |
|
300 | 300 | ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf |
|
301 | 301 | starting 4 threads for background file closing (?) |
|
302 | 302 | .hgsubstate: versions differ -> m (premerge) |
|
303 | 303 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 |
|
304 | 304 | subrepo t: both sides changed |
|
305 | 305 | subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198) |
|
306 | 306 | starting 4 threads for background file closing (?) |
|
307 | 307 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m |
|
308 | 308 | merging subrepository "t" |
|
309 | 309 | searching for copies back to rev 2 |
|
310 | 310 | resolving manifests |
|
311 | 311 | branchmerge: True, force: False, partial: False |
|
312 | 312 | ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198 |
|
313 | 313 | preserving t for resolve of t |
|
314 | 314 | starting 4 threads for background file closing (?) |
|
315 | 315 | t: versions differ -> m (premerge) |
|
316 | 316 | picked tool ':merge' for t (binary False symlink False changedelete False) |
|
317 | 317 | merging t |
|
318 | 318 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
319 | 319 | t: versions differ -> m (merge) |
|
320 | 320 | picked tool ':merge' for t (binary False symlink False changedelete False) |
|
321 | 321 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
322 | 322 | warning: conflicts while merging t! (edit, then use 'hg resolve --mark') |
|
323 | 323 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
324 | 324 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
325 | 325 | subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg |
|
326 | 326 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
327 | 327 | (branch merge, don't forget to commit) |
|
328 | 328 | |
|
329 | 329 | should conflict |
|
330 | 330 | |
|
331 | 331 | $ cat t/t |
|
332 | 332 | <<<<<<< local: 20a0db6fbf6c - test: 10 |
|
333 | 333 | conflict |
|
334 | 334 | ======= |
|
335 | 335 | t3 |
|
336 | 336 | >>>>>>> other: 7af322bc1198 - test: 7 |
|
337 | 337 | |
|
338 | 338 | 11: remove subrepo t |
|
339 | 339 | |
|
340 | 340 | $ hg co -C 5 |
|
341 | 341 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
342 | 342 | $ hg revert -r 4 .hgsub # remove t |
|
343 | 343 | $ hg ci -m11 |
|
344 | 344 | created new head |
|
345 | 345 | $ hg debugsub |
|
346 | 346 | path s |
|
347 | 347 | source s |
|
348 | 348 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
349 | 349 | |
|
350 | 350 | local removed, remote changed, keep changed |
|
351 | 351 | |
|
352 | 352 | $ hg merge 6 |
|
353 | 353 | remote [merge rev] changed subrepository t which local [working copy] removed |
|
354 | 354 | use (c)hanged version or (d)elete? c |
|
355 | 355 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
356 | 356 | (branch merge, don't forget to commit) |
|
357 | 357 | BROKEN: should include subrepo t |
|
358 | 358 | $ hg debugsub |
|
359 | 359 | path s |
|
360 | 360 | source s |
|
361 | 361 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
362 | 362 | $ cat .hgsubstate |
|
363 | 363 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
364 | 364 | 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t |
|
365 | 365 | $ hg ci -m 'local removed, remote changed, keep changed' |
|
366 | 366 | BROKEN: should include subrepo t |
|
367 | 367 | $ hg debugsub |
|
368 | 368 | path s |
|
369 | 369 | source s |
|
370 | 370 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
371 | 371 | BROKEN: should include subrepo t |
|
372 | 372 | $ cat .hgsubstate |
|
373 | 373 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
374 | 374 | $ cat t/t |
|
375 | 375 | t2 |
|
376 | 376 | |
|
377 | 377 | local removed, remote changed, keep removed |
|
378 | 378 | |
|
379 | 379 | $ hg co -C 11 |
|
380 | 380 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
381 | 381 | $ hg merge --config ui.interactive=true 6 <<EOF |
|
382 | 382 | > d |
|
383 | 383 | > EOF |
|
384 | 384 | remote [merge rev] changed subrepository t which local [working copy] removed |
|
385 | 385 | use (c)hanged version or (d)elete? d |
|
386 | 386 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
387 | 387 | (branch merge, don't forget to commit) |
|
388 | 388 | $ hg debugsub |
|
389 | 389 | path s |
|
390 | 390 | source s |
|
391 | 391 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
392 | 392 | $ cat .hgsubstate |
|
393 | 393 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
394 | 394 | $ hg ci -m 'local removed, remote changed, keep removed' |
|
395 | 395 | created new head |
|
396 | 396 | $ hg debugsub |
|
397 | 397 | path s |
|
398 | 398 | source s |
|
399 | 399 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
400 | 400 | $ cat .hgsubstate |
|
401 | 401 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
402 | 402 | |
|
403 | 403 | local changed, remote removed, keep changed |
|
404 | 404 | |
|
405 | 405 | $ hg co -C 6 |
|
406 | 406 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
407 | 407 | $ hg merge 11 |
|
408 | 408 | local [working copy] changed subrepository t which remote [merge rev] removed |
|
409 | 409 | use (c)hanged version or (d)elete? c |
|
410 | 410 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
411 | 411 | (branch merge, don't forget to commit) |
|
412 | 412 | BROKEN: should include subrepo t |
|
413 | 413 | $ hg debugsub |
|
414 | 414 | path s |
|
415 | 415 | source s |
|
416 | 416 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
417 | 417 | BROKEN: should include subrepo t |
|
418 | 418 | $ cat .hgsubstate |
|
419 | 419 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
420 | 420 | $ hg ci -m 'local changed, remote removed, keep changed' |
|
421 | 421 | created new head |
|
422 | 422 | BROKEN: should include subrepo t |
|
423 | 423 | $ hg debugsub |
|
424 | 424 | path s |
|
425 | 425 | source s |
|
426 | 426 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
427 | 427 | BROKEN: should include subrepo t |
|
428 | 428 | $ cat .hgsubstate |
|
429 | 429 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
430 | 430 | $ cat t/t |
|
431 | 431 | t2 |
|
432 | 432 | |
|
433 | 433 | local changed, remote removed, keep removed |
|
434 | 434 | |
|
435 | 435 | $ hg co -C 6 |
|
436 | 436 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
437 | 437 | $ hg merge --config ui.interactive=true 11 <<EOF |
|
438 | 438 | > d |
|
439 | 439 | > EOF |
|
440 | 440 | local [working copy] changed subrepository t which remote [merge rev] removed |
|
441 | 441 | use (c)hanged version or (d)elete? d |
|
442 | 442 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
443 | 443 | (branch merge, don't forget to commit) |
|
444 | 444 | $ hg debugsub |
|
445 | 445 | path s |
|
446 | 446 | source s |
|
447 | 447 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
448 | 448 | $ cat .hgsubstate |
|
449 | 449 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
450 | 450 | $ hg ci -m 'local changed, remote removed, keep removed' |
|
451 | 451 | created new head |
|
452 | 452 | $ hg debugsub |
|
453 | 453 | path s |
|
454 | 454 | source s |
|
455 | 455 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
456 | 456 | $ cat .hgsubstate |
|
457 | 457 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
458 | 458 | |
|
459 | 459 | clean up to avoid having to fix up the tests below |
|
460 | 460 | |
|
461 | 461 | $ hg co -C 10 |
|
462 | 462 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
463 | 463 | $ cat >> $HGRCPATH <<EOF |
|
464 | 464 | > [extensions] |
|
465 | 465 | > strip= |
|
466 | 466 | > EOF |
|
467 | 467 | $ hg strip -r 11:15 |
|
468 | 468 | saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob) |
|
469 | 469 | |
|
470 | 470 | clone |
|
471 | 471 | |
|
472 | 472 | $ cd .. |
|
473 | 473 | $ hg clone t tc |
|
474 | 474 | updating to branch default |
|
475 | 475 | cloning subrepo s from $TESTTMP/t/s |
|
476 | 476 | cloning subrepo s/ss from $TESTTMP/t/s/ss (glob) |
|
477 | 477 | cloning subrepo t from $TESTTMP/t/t |
|
478 | 478 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
479 | 479 | $ cd tc |
|
480 | 480 | $ hg debugsub |
|
481 | 481 | path s |
|
482 | 482 | source s |
|
483 | 483 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
484 | 484 | path t |
|
485 | 485 | source t |
|
486 | 486 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e |
|
487 | $ 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 | 525 | push |
|
489 | 526 | |
|
527 | $ cd tc | |
|
490 | 528 | $ echo bah > t/t |
|
491 | 529 | $ hg ci -m11 |
|
492 | 530 | committing subrepository t |
|
493 | 531 | $ hg push |
|
494 | 532 | pushing to $TESTTMP/t (glob) |
|
495 | 533 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
496 | 534 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
497 | 535 | pushing subrepo t to $TESTTMP/t/t |
|
498 | 536 | searching for changes |
|
499 | 537 | adding changesets |
|
500 | 538 | adding manifests |
|
501 | 539 | adding file changes |
|
502 | 540 | added 1 changesets with 1 changes to 1 files |
|
503 | 541 | searching for changes |
|
504 | 542 | adding changesets |
|
505 | 543 | adding manifests |
|
506 | 544 | adding file changes |
|
507 | 545 | added 1 changesets with 1 changes to 1 files |
|
508 | 546 | |
|
509 | 547 | push -f |
|
510 | 548 | |
|
511 | 549 | $ echo bah > s/a |
|
512 | 550 | $ hg ci -m12 |
|
513 | 551 | committing subrepository s |
|
514 | 552 | $ hg push |
|
515 | 553 | pushing to $TESTTMP/t (glob) |
|
516 | 554 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
517 | 555 | pushing subrepo s to $TESTTMP/t/s |
|
518 | 556 | searching for changes |
|
519 | 557 | abort: push creates new remote head 12a213df6fa9! (in subrepository "s") |
|
520 | 558 | (merge or see 'hg help push' for details about pushing new heads) |
|
521 | 559 | [255] |
|
522 | 560 | $ hg push -f |
|
523 | 561 | pushing to $TESTTMP/t (glob) |
|
524 | 562 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
525 | 563 | searching for changes |
|
526 | 564 | no changes found |
|
527 | 565 | pushing subrepo s to $TESTTMP/t/s |
|
528 | 566 | searching for changes |
|
529 | 567 | adding changesets |
|
530 | 568 | adding manifests |
|
531 | 569 | adding file changes |
|
532 | 570 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
533 | 571 | pushing subrepo t to $TESTTMP/t/t |
|
534 | 572 | searching for changes |
|
535 | 573 | no changes found |
|
536 | 574 | searching for changes |
|
537 | 575 | adding changesets |
|
538 | 576 | adding manifests |
|
539 | 577 | adding file changes |
|
540 | 578 | added 1 changesets with 1 changes to 1 files |
|
541 | 579 | |
|
542 | 580 | check that unmodified subrepos are not pushed |
|
543 | 581 | |
|
544 | 582 | $ hg clone . ../tcc |
|
545 | 583 | updating to branch default |
|
546 | 584 | cloning subrepo s from $TESTTMP/tc/s |
|
547 | 585 | cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob) |
|
548 | 586 | cloning subrepo t from $TESTTMP/tc/t |
|
549 | 587 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
550 | 588 | |
|
551 | 589 | the subrepos on the new clone have nothing to push to its source |
|
552 | 590 | |
|
553 | 591 | $ hg push -R ../tcc . |
|
554 | 592 | pushing to . |
|
555 | 593 | no changes made to subrepo s/ss since last push to s/ss (glob) |
|
556 | 594 | no changes made to subrepo s since last push to s |
|
557 | 595 | no changes made to subrepo t since last push to t |
|
558 | 596 | searching for changes |
|
559 | 597 | no changes found |
|
560 | 598 | [1] |
|
561 | 599 | |
|
562 | 600 | the subrepos on the source do not have a clean store versus the clone target |
|
563 | 601 | because they were never explicitly pushed to the source |
|
564 | 602 | |
|
565 | 603 | $ hg push ../tcc |
|
566 | 604 | pushing to ../tcc |
|
567 | 605 | pushing subrepo s/ss to ../tcc/s/ss (glob) |
|
568 | 606 | searching for changes |
|
569 | 607 | no changes found |
|
570 | 608 | pushing subrepo s to ../tcc/s |
|
571 | 609 | searching for changes |
|
572 | 610 | no changes found |
|
573 | 611 | pushing subrepo t to ../tcc/t |
|
574 | 612 | searching for changes |
|
575 | 613 | no changes found |
|
576 | 614 | searching for changes |
|
577 | 615 | no changes found |
|
578 | 616 | [1] |
|
579 | 617 | |
|
580 | 618 | after push their stores become clean |
|
581 | 619 | |
|
582 | 620 | $ hg push ../tcc |
|
583 | 621 | pushing to ../tcc |
|
584 | 622 | no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob) |
|
585 | 623 | no changes made to subrepo s since last push to ../tcc/s |
|
586 | 624 | no changes made to subrepo t since last push to ../tcc/t |
|
587 | 625 | searching for changes |
|
588 | 626 | no changes found |
|
589 | 627 | [1] |
|
590 | 628 | |
|
591 | 629 | updating a subrepo to a different revision or changing |
|
592 | 630 | its working directory does not make its store dirty |
|
593 | 631 | |
|
594 | 632 | $ hg -R s update '.^' |
|
595 | 633 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
596 | 634 | $ hg push |
|
597 | 635 | pushing to $TESTTMP/t (glob) |
|
598 | 636 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
599 | 637 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
600 | 638 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
601 | 639 | searching for changes |
|
602 | 640 | no changes found |
|
603 | 641 | [1] |
|
604 | 642 | $ echo foo >> s/a |
|
605 | 643 | $ hg push |
|
606 | 644 | pushing to $TESTTMP/t (glob) |
|
607 | 645 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
608 | 646 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
609 | 647 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
610 | 648 | searching for changes |
|
611 | 649 | no changes found |
|
612 | 650 | [1] |
|
613 | 651 | $ hg -R s update -C tip |
|
614 | 652 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
615 | 653 | |
|
616 | 654 | committing into a subrepo makes its store (but not its parent's store) dirty |
|
617 | 655 | |
|
618 | 656 | $ echo foo >> s/ss/a |
|
619 | 657 | $ hg -R s/ss commit -m 'test dirty store detection' |
|
620 | 658 | |
|
621 | 659 | $ hg out -S -r `hg log -r tip -T "{node|short}"` |
|
622 | 660 | comparing with $TESTTMP/t (glob) |
|
623 | 661 | searching for changes |
|
624 | 662 | no changes found |
|
625 | 663 | comparing with $TESTTMP/t/s |
|
626 | 664 | searching for changes |
|
627 | 665 | no changes found |
|
628 | 666 | comparing with $TESTTMP/t/s/ss |
|
629 | 667 | searching for changes |
|
630 | 668 | changeset: 1:79ea5566a333 |
|
631 | 669 | tag: tip |
|
632 | 670 | user: test |
|
633 | 671 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
634 | 672 | summary: test dirty store detection |
|
635 | 673 | |
|
636 | 674 | comparing with $TESTTMP/t/t |
|
637 | 675 | searching for changes |
|
638 | 676 | no changes found |
|
639 | 677 | |
|
640 | 678 | $ hg push |
|
641 | 679 | pushing to $TESTTMP/t (glob) |
|
642 | 680 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
643 | 681 | searching for changes |
|
644 | 682 | adding changesets |
|
645 | 683 | adding manifests |
|
646 | 684 | adding file changes |
|
647 | 685 | added 1 changesets with 1 changes to 1 files |
|
648 | 686 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
649 | 687 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
650 | 688 | searching for changes |
|
651 | 689 | no changes found |
|
652 | 690 | [1] |
|
653 | 691 | |
|
654 | 692 | a subrepo store may be clean versus one repo but not versus another |
|
655 | 693 | |
|
656 | 694 | $ hg push |
|
657 | 695 | pushing to $TESTTMP/t (glob) |
|
658 | 696 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
659 | 697 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
660 | 698 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
661 | 699 | searching for changes |
|
662 | 700 | no changes found |
|
663 | 701 | [1] |
|
664 | 702 | $ hg push ../tcc |
|
665 | 703 | pushing to ../tcc |
|
666 | 704 | pushing subrepo s/ss to ../tcc/s/ss (glob) |
|
667 | 705 | searching for changes |
|
668 | 706 | adding changesets |
|
669 | 707 | adding manifests |
|
670 | 708 | adding file changes |
|
671 | 709 | added 1 changesets with 1 changes to 1 files |
|
672 | 710 | no changes made to subrepo s since last push to ../tcc/s |
|
673 | 711 | no changes made to subrepo t since last push to ../tcc/t |
|
674 | 712 | searching for changes |
|
675 | 713 | no changes found |
|
676 | 714 | [1] |
|
677 | 715 | |
|
678 | 716 | update |
|
679 | 717 | |
|
680 | 718 | $ cd ../t |
|
681 | 719 | $ hg up -C # discard our earlier merge |
|
682 | 720 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
683 | 721 | updated to "c373c8102e68: 12" |
|
684 | 722 | 2 other heads for branch "default" |
|
685 | 723 | $ echo blah > t/t |
|
686 | 724 | $ hg ci -m13 |
|
687 | 725 | committing subrepository t |
|
688 | 726 | |
|
689 | 727 | backout calls revert internally with minimal opts, which should not raise |
|
690 | 728 | KeyError |
|
691 | 729 | |
|
692 | 730 | $ hg backout ".^" --no-commit |
|
693 | 731 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
694 | 732 | changeset c373c8102e68 backed out, don't forget to commit. |
|
695 | 733 | |
|
696 | 734 | $ hg up -C # discard changes |
|
697 | 735 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
698 | 736 | updated to "925c17564ef8: 13" |
|
699 | 737 | 2 other heads for branch "default" |
|
700 | 738 | |
|
701 | 739 | pull |
|
702 | 740 | |
|
703 | 741 | $ cd ../tc |
|
704 | 742 | $ hg pull |
|
705 | 743 | pulling from $TESTTMP/t (glob) |
|
706 | 744 | searching for changes |
|
707 | 745 | adding changesets |
|
708 | 746 | adding manifests |
|
709 | 747 | adding file changes |
|
710 | 748 | added 1 changesets with 1 changes to 1 files |
|
711 | 749 | new changesets 925c17564ef8 |
|
712 | 750 | (run 'hg update' to get a working copy) |
|
713 | 751 | |
|
714 | 752 | should pull t |
|
715 | 753 | |
|
716 | 754 | $ hg incoming -S -r `hg log -r tip -T "{node|short}"` |
|
717 | 755 | comparing with $TESTTMP/t (glob) |
|
718 | 756 | no changes found |
|
719 | 757 | comparing with $TESTTMP/t/s |
|
720 | 758 | searching for changes |
|
721 | 759 | no changes found |
|
722 | 760 | comparing with $TESTTMP/t/s/ss |
|
723 | 761 | searching for changes |
|
724 | 762 | no changes found |
|
725 | 763 | comparing with $TESTTMP/t/t |
|
726 | 764 | searching for changes |
|
727 | 765 | changeset: 5:52c0adc0515a |
|
728 | 766 | tag: tip |
|
729 | 767 | user: test |
|
730 | 768 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
731 | 769 | summary: 13 |
|
732 | 770 | |
|
733 | 771 | |
|
734 | 772 | $ hg up |
|
735 | 773 | pulling subrepo t from $TESTTMP/t/t |
|
736 | 774 | searching for changes |
|
737 | 775 | adding changesets |
|
738 | 776 | adding manifests |
|
739 | 777 | adding file changes |
|
740 | 778 | added 1 changesets with 1 changes to 1 files |
|
741 | 779 | new changesets 52c0adc0515a |
|
742 | 780 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
743 | 781 | updated to "925c17564ef8: 13" |
|
744 | 782 | 2 other heads for branch "default" |
|
745 | 783 | $ cat t/t |
|
746 | 784 | blah |
|
747 | 785 | |
|
748 | 786 | bogus subrepo path aborts |
|
749 | 787 | |
|
750 | 788 | $ echo 'bogus=[boguspath' >> .hgsub |
|
751 | 789 | $ hg ci -m 'bogus subrepo path' |
|
752 | 790 | abort: missing ] in subrepository source |
|
753 | 791 | [255] |
|
754 | 792 | |
|
755 | 793 | Issue1986: merge aborts when trying to merge a subrepo that |
|
756 | 794 | shouldn't need merging |
|
757 | 795 | |
|
758 | 796 | # subrepo layout |
|
759 | 797 | # |
|
760 | 798 | # o 5 br |
|
761 | 799 | # /| |
|
762 | 800 | # o | 4 default |
|
763 | 801 | # | | |
|
764 | 802 | # | o 3 br |
|
765 | 803 | # |/| |
|
766 | 804 | # o | 2 default |
|
767 | 805 | # | | |
|
768 | 806 | # | o 1 br |
|
769 | 807 | # |/ |
|
770 | 808 | # o 0 default |
|
771 | 809 | |
|
772 | 810 | $ cd .. |
|
773 | 811 | $ rm -rf sub |
|
774 | 812 | $ hg init main |
|
775 | 813 | $ cd main |
|
776 | 814 | $ hg init s |
|
777 | 815 | $ cd s |
|
778 | 816 | $ echo a > a |
|
779 | 817 | $ hg ci -Am1 |
|
780 | 818 | adding a |
|
781 | 819 | $ hg branch br |
|
782 | 820 | marked working directory as branch br |
|
783 | 821 | (branches are permanent and global, did you want a bookmark?) |
|
784 | 822 | $ echo a >> a |
|
785 | 823 | $ hg ci -m1 |
|
786 | 824 | $ hg up default |
|
787 | 825 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
788 | 826 | $ echo b > b |
|
789 | 827 | $ hg ci -Am1 |
|
790 | 828 | adding b |
|
791 | 829 | $ hg up br |
|
792 | 830 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
793 | 831 | $ hg merge tip |
|
794 | 832 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
795 | 833 | (branch merge, don't forget to commit) |
|
796 | 834 | $ hg ci -m1 |
|
797 | 835 | $ hg up 2 |
|
798 | 836 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
799 | 837 | $ echo c > c |
|
800 | 838 | $ hg ci -Am1 |
|
801 | 839 | adding c |
|
802 | 840 | $ hg up 3 |
|
803 | 841 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
804 | 842 | $ hg merge 4 |
|
805 | 843 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
806 | 844 | (branch merge, don't forget to commit) |
|
807 | 845 | $ hg ci -m1 |
|
808 | 846 | |
|
809 | 847 | # main repo layout: |
|
810 | 848 | # |
|
811 | 849 | # * <-- try to merge default into br again |
|
812 | 850 | # .`| |
|
813 | 851 | # . o 5 br --> substate = 5 |
|
814 | 852 | # . | |
|
815 | 853 | # o | 4 default --> substate = 4 |
|
816 | 854 | # | | |
|
817 | 855 | # | o 3 br --> substate = 2 |
|
818 | 856 | # |/| |
|
819 | 857 | # o | 2 default --> substate = 2 |
|
820 | 858 | # | | |
|
821 | 859 | # | o 1 br --> substate = 3 |
|
822 | 860 | # |/ |
|
823 | 861 | # o 0 default --> substate = 2 |
|
824 | 862 | |
|
825 | 863 | $ cd .. |
|
826 | 864 | $ echo 's = s' > .hgsub |
|
827 | 865 | $ hg -R s up 2 |
|
828 | 866 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
829 | 867 | $ hg ci -Am1 |
|
830 | 868 | adding .hgsub |
|
831 | 869 | $ hg branch br |
|
832 | 870 | marked working directory as branch br |
|
833 | 871 | (branches are permanent and global, did you want a bookmark?) |
|
834 | 872 | $ echo b > b |
|
835 | 873 | $ hg -R s up 3 |
|
836 | 874 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
837 | 875 | $ hg ci -Am1 |
|
838 | 876 | adding b |
|
839 | 877 | $ hg up default |
|
840 | 878 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
841 | 879 | $ echo c > c |
|
842 | 880 | $ hg ci -Am1 |
|
843 | 881 | adding c |
|
844 | 882 | $ hg up 1 |
|
845 | 883 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
846 | 884 | $ hg merge 2 |
|
847 | 885 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
848 | 886 | (branch merge, don't forget to commit) |
|
849 | 887 | $ hg ci -m1 |
|
850 | 888 | $ hg up 2 |
|
851 | 889 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
852 | 890 | $ hg -R s up 4 |
|
853 | 891 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
854 | 892 | $ echo d > d |
|
855 | 893 | $ hg ci -Am1 |
|
856 | 894 | adding d |
|
857 | 895 | $ hg up 3 |
|
858 | 896 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
859 | 897 | $ hg -R s up 5 |
|
860 | 898 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
861 | 899 | $ echo e > e |
|
862 | 900 | $ hg ci -Am1 |
|
863 | 901 | adding e |
|
864 | 902 | |
|
865 | 903 | $ hg up 5 |
|
866 | 904 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
867 | 905 | $ hg merge 4 # try to merge default into br again |
|
868 | 906 | subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88) |
|
869 | 907 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m |
|
870 | 908 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
871 | 909 | (branch merge, don't forget to commit) |
|
872 | 910 | $ cd .. |
|
873 | 911 | |
|
874 | 912 | test subrepo delete from .hgsubstate |
|
875 | 913 | |
|
876 | 914 | $ hg init testdelete |
|
877 | 915 | $ mkdir testdelete/nested testdelete/nested2 |
|
878 | 916 | $ hg init testdelete/nested |
|
879 | 917 | $ hg init testdelete/nested2 |
|
880 | 918 | $ echo test > testdelete/nested/foo |
|
881 | 919 | $ echo test > testdelete/nested2/foo |
|
882 | 920 | $ hg -R testdelete/nested add |
|
883 | 921 | adding testdelete/nested/foo (glob) |
|
884 | 922 | $ hg -R testdelete/nested2 add |
|
885 | 923 | adding testdelete/nested2/foo (glob) |
|
886 | 924 | $ hg -R testdelete/nested ci -m test |
|
887 | 925 | $ hg -R testdelete/nested2 ci -m test |
|
888 | 926 | $ echo nested = nested > testdelete/.hgsub |
|
889 | 927 | $ echo nested2 = nested2 >> testdelete/.hgsub |
|
890 | 928 | $ hg -R testdelete add |
|
891 | 929 | adding testdelete/.hgsub (glob) |
|
892 | 930 | $ hg -R testdelete ci -m "nested 1 & 2 added" |
|
893 | 931 | $ echo nested = nested > testdelete/.hgsub |
|
894 | 932 | $ hg -R testdelete ci -m "nested 2 deleted" |
|
895 | 933 | $ cat testdelete/.hgsubstate |
|
896 | 934 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
897 | 935 | $ hg -R testdelete remove testdelete/.hgsub |
|
898 | 936 | $ hg -R testdelete ci -m ".hgsub deleted" |
|
899 | 937 | $ cat testdelete/.hgsubstate |
|
900 | 938 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
901 | 939 | |
|
902 | 940 | test repository cloning |
|
903 | 941 | |
|
904 | 942 | $ mkdir mercurial mercurial2 |
|
905 | 943 | $ hg init nested_absolute |
|
906 | 944 | $ echo test > nested_absolute/foo |
|
907 | 945 | $ hg -R nested_absolute add |
|
908 | 946 | adding nested_absolute/foo (glob) |
|
909 | 947 | $ hg -R nested_absolute ci -mtest |
|
910 | 948 | $ cd mercurial |
|
911 | 949 | $ hg init nested_relative |
|
912 | 950 | $ echo test2 > nested_relative/foo2 |
|
913 | 951 | $ hg -R nested_relative add |
|
914 | 952 | adding nested_relative/foo2 (glob) |
|
915 | 953 | $ hg -R nested_relative ci -mtest2 |
|
916 | 954 | $ hg init main |
|
917 | 955 | $ echo "nested_relative = ../nested_relative" > main/.hgsub |
|
918 | 956 | $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub |
|
919 | 957 | $ hg -R main add |
|
920 | 958 | adding main/.hgsub (glob) |
|
921 | 959 | $ hg -R main ci -m "add subrepos" |
|
922 | 960 | $ cd .. |
|
923 | 961 | $ hg clone mercurial/main mercurial2/main |
|
924 | 962 | updating to branch default |
|
925 | 963 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
926 | 964 | $ cat mercurial2/main/nested_absolute/.hg/hgrc \ |
|
927 | 965 | > mercurial2/main/nested_relative/.hg/hgrc |
|
928 | 966 | [paths] |
|
929 | 967 | default = $TESTTMP/mercurial/nested_absolute |
|
930 | 968 | [paths] |
|
931 | 969 | default = $TESTTMP/mercurial/nested_relative |
|
932 | 970 | $ rm -rf mercurial mercurial2 |
|
933 | 971 | |
|
934 | 972 | Issue1977: multirepo push should fail if subrepo push fails |
|
935 | 973 | |
|
936 | 974 | $ hg init repo |
|
937 | 975 | $ hg init repo/s |
|
938 | 976 | $ echo a > repo/s/a |
|
939 | 977 | $ hg -R repo/s ci -Am0 |
|
940 | 978 | adding a |
|
941 | 979 | $ echo s = s > repo/.hgsub |
|
942 | 980 | $ hg -R repo ci -Am1 |
|
943 | 981 | adding .hgsub |
|
944 | 982 | $ hg clone repo repo2 |
|
945 | 983 | updating to branch default |
|
946 | 984 | cloning subrepo s from $TESTTMP/repo/s |
|
947 | 985 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
948 | 986 | $ hg -q -R repo2 pull -u |
|
949 | 987 | $ echo 1 > repo2/s/a |
|
950 | 988 | $ hg -R repo2/s ci -m2 |
|
951 | 989 | $ hg -q -R repo2/s push |
|
952 | 990 | $ hg -R repo2/s up -C 0 |
|
953 | 991 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
954 | 992 | $ echo 2 > repo2/s/b |
|
955 | 993 | $ hg -R repo2/s ci -m3 -A |
|
956 | 994 | adding b |
|
957 | 995 | created new head |
|
958 | 996 | $ hg -R repo2 ci -m3 |
|
959 | 997 | $ hg -q -R repo2 push |
|
960 | 998 | abort: push creates new remote head cc505f09a8b2! (in subrepository "s") |
|
961 | 999 | (merge or see 'hg help push' for details about pushing new heads) |
|
962 | 1000 | [255] |
|
963 | 1001 | $ hg -R repo update |
|
964 | 1002 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
965 | 1003 | |
|
966 | 1004 | test if untracked file is not overwritten |
|
967 | 1005 | |
|
968 | 1006 | (this also tests that updated .hgsubstate is treated as "modified", |
|
969 | 1007 | when 'merge.update()' is aborted before 'merge.recordupdates()', even |
|
970 | 1008 | if none of mode, size and timestamp of it isn't changed on the |
|
971 | 1009 | filesystem (see also issue4583)) |
|
972 | 1010 | |
|
973 | 1011 | $ echo issue3276_ok > repo/s/b |
|
974 | 1012 | $ hg -R repo2 push -f -q |
|
975 | 1013 | $ touch -t 200001010000 repo/.hgsubstate |
|
976 | 1014 | |
|
977 | 1015 | $ cat >> repo/.hg/hgrc <<EOF |
|
978 | 1016 | > [fakedirstatewritetime] |
|
979 | 1017 | > # emulate invoking dirstate.write() via repo.status() |
|
980 | 1018 | > # at 2000-01-01 00:00 |
|
981 | 1019 | > fakenow = 200001010000 |
|
982 | 1020 | > |
|
983 | 1021 | > [extensions] |
|
984 | 1022 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
985 | 1023 | > EOF |
|
986 | 1024 | $ hg -R repo update |
|
987 | 1025 | b: untracked file differs |
|
988 | 1026 | abort: untracked files in working directory differ from files in requested revision (in subrepository "s") |
|
989 | 1027 | [255] |
|
990 | 1028 | $ cat >> repo/.hg/hgrc <<EOF |
|
991 | 1029 | > [extensions] |
|
992 | 1030 | > fakedirstatewritetime = ! |
|
993 | 1031 | > EOF |
|
994 | 1032 | |
|
995 | 1033 | $ cat repo/s/b |
|
996 | 1034 | issue3276_ok |
|
997 | 1035 | $ rm repo/s/b |
|
998 | 1036 | $ touch -t 200001010000 repo/.hgsubstate |
|
999 | 1037 | $ hg -R repo revert --all |
|
1000 | 1038 | reverting repo/.hgsubstate (glob) |
|
1001 | 1039 | reverting subrepo s |
|
1002 | 1040 | $ hg -R repo update |
|
1003 | 1041 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1004 | 1042 | $ cat repo/s/b |
|
1005 | 1043 | 2 |
|
1006 | 1044 | $ rm -rf repo2 repo |
|
1007 | 1045 | |
|
1008 | 1046 | |
|
1009 | 1047 | Issue1852 subrepos with relative paths always push/pull relative to default |
|
1010 | 1048 | |
|
1011 | 1049 | Prepare a repo with subrepo |
|
1012 | 1050 | |
|
1013 | 1051 | $ hg init issue1852a |
|
1014 | 1052 | $ cd issue1852a |
|
1015 | 1053 | $ hg init sub/repo |
|
1016 | 1054 | $ echo test > sub/repo/foo |
|
1017 | 1055 | $ hg -R sub/repo add sub/repo/foo |
|
1018 | 1056 | $ echo sub/repo = sub/repo > .hgsub |
|
1019 | 1057 | $ hg add .hgsub |
|
1020 | 1058 | $ hg ci -mtest |
|
1021 | 1059 | committing subrepository sub/repo (glob) |
|
1022 | 1060 | $ echo test >> sub/repo/foo |
|
1023 | 1061 | $ hg ci -mtest |
|
1024 | 1062 | committing subrepository sub/repo (glob) |
|
1025 | 1063 | $ hg cat sub/repo/foo |
|
1026 | 1064 | test |
|
1027 | 1065 | test |
|
1028 | 1066 | $ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g' |
|
1029 | 1067 | [ |
|
1030 | 1068 | { |
|
1031 | 1069 | "abspath": "foo", |
|
1032 | 1070 | "data": "test\ntest\n", |
|
1033 | 1071 | "path": "sub/repo/foo" |
|
1034 | 1072 | } |
|
1035 | 1073 | ] |
|
1036 | 1074 | $ mkdir -p tmp/sub/repo |
|
1037 | 1075 | $ hg cat -r 0 --output tmp/%p_p sub/repo/foo |
|
1038 | 1076 | $ cat tmp/sub/repo/foo_p |
|
1039 | 1077 | test |
|
1040 | 1078 | $ mv sub/repo sub_ |
|
1041 | 1079 | $ hg cat sub/repo/baz |
|
1042 | 1080 | skipping missing subrepository: sub/repo |
|
1043 | 1081 | [1] |
|
1044 | 1082 | $ rm -rf sub/repo |
|
1045 | 1083 | $ mv sub_ sub/repo |
|
1046 | 1084 | $ cd .. |
|
1047 | 1085 | |
|
1048 | 1086 | Create repo without default path, pull top repo, and see what happens on update |
|
1049 | 1087 | |
|
1050 | 1088 | $ hg init issue1852b |
|
1051 | 1089 | $ hg -R issue1852b pull issue1852a |
|
1052 | 1090 | pulling from issue1852a |
|
1053 | 1091 | requesting all changes |
|
1054 | 1092 | adding changesets |
|
1055 | 1093 | adding manifests |
|
1056 | 1094 | adding file changes |
|
1057 | 1095 | added 2 changesets with 3 changes to 2 files |
|
1058 | 1096 | new changesets 19487b456929:be5eb94e7215 |
|
1059 | 1097 | (run 'hg update' to get a working copy) |
|
1060 | 1098 | $ hg -R issue1852b update |
|
1061 | 1099 | abort: default path for subrepository not found (in subrepository "sub/repo") (glob) |
|
1062 | 1100 | [255] |
|
1063 | 1101 | |
|
1064 | 1102 | Ensure a full traceback, not just the SubrepoAbort part |
|
1065 | 1103 | |
|
1066 | 1104 | $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort' |
|
1067 | 1105 | raise error.Abort(_("default path for subrepository not found")) |
|
1068 | 1106 | |
|
1069 | 1107 | Pull -u now doesn't help |
|
1070 | 1108 | |
|
1071 | 1109 | $ hg -R issue1852b pull -u issue1852a |
|
1072 | 1110 | pulling from issue1852a |
|
1073 | 1111 | searching for changes |
|
1074 | 1112 | no changes found |
|
1075 | 1113 | |
|
1076 | 1114 | Try the same, but with pull -u |
|
1077 | 1115 | |
|
1078 | 1116 | $ hg init issue1852c |
|
1079 | 1117 | $ hg -R issue1852c pull -r0 -u issue1852a |
|
1080 | 1118 | pulling from issue1852a |
|
1081 | 1119 | adding changesets |
|
1082 | 1120 | adding manifests |
|
1083 | 1121 | adding file changes |
|
1084 | 1122 | added 1 changesets with 2 changes to 2 files |
|
1085 | 1123 | new changesets 19487b456929 |
|
1086 | 1124 | cloning subrepo sub/repo from issue1852a/sub/repo (glob) |
|
1087 | 1125 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1088 | 1126 | |
|
1089 | 1127 | Try to push from the other side |
|
1090 | 1128 | |
|
1091 | 1129 | $ hg -R issue1852a push `pwd`/issue1852c |
|
1092 | 1130 | pushing to $TESTTMP/issue1852c (glob) |
|
1093 | 1131 | pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob) |
|
1094 | 1132 | searching for changes |
|
1095 | 1133 | no changes found |
|
1096 | 1134 | searching for changes |
|
1097 | 1135 | adding changesets |
|
1098 | 1136 | adding manifests |
|
1099 | 1137 | adding file changes |
|
1100 | 1138 | added 1 changesets with 1 changes to 1 files |
|
1101 | 1139 | |
|
1102 | 1140 | Incoming and outgoing should not use the default path: |
|
1103 | 1141 | |
|
1104 | 1142 | $ hg clone -q issue1852a issue1852d |
|
1105 | 1143 | $ hg -R issue1852d outgoing --subrepos issue1852c |
|
1106 | 1144 | comparing with issue1852c |
|
1107 | 1145 | searching for changes |
|
1108 | 1146 | no changes found |
|
1109 | 1147 | comparing with issue1852c/sub/repo |
|
1110 | 1148 | searching for changes |
|
1111 | 1149 | no changes found |
|
1112 | 1150 | [1] |
|
1113 | 1151 | $ hg -R issue1852d incoming --subrepos issue1852c |
|
1114 | 1152 | comparing with issue1852c |
|
1115 | 1153 | searching for changes |
|
1116 | 1154 | no changes found |
|
1117 | 1155 | comparing with issue1852c/sub/repo |
|
1118 | 1156 | searching for changes |
|
1119 | 1157 | no changes found |
|
1120 | 1158 | [1] |
|
1121 | 1159 | |
|
1122 | 1160 | Check that merge of a new subrepo doesn't write the uncommitted state to |
|
1123 | 1161 | .hgsubstate (issue4622) |
|
1124 | 1162 | |
|
1125 | 1163 | $ hg init issue1852a/addedsub |
|
1126 | 1164 | $ echo zzz > issue1852a/addedsub/zz.txt |
|
1127 | 1165 | $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ" |
|
1128 | 1166 | |
|
1129 | 1167 | $ hg clone issue1852a/addedsub issue1852d/addedsub |
|
1130 | 1168 | updating to branch default |
|
1131 | 1169 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1132 | 1170 | |
|
1133 | 1171 | $ echo def > issue1852a/sub/repo/foo |
|
1134 | 1172 | $ hg -R issue1852a ci -SAm 'tweaked subrepo' |
|
1135 | 1173 | adding tmp/sub/repo/foo_p |
|
1136 | 1174 | committing subrepository sub/repo (glob) |
|
1137 | 1175 | |
|
1138 | 1176 | $ echo 'addedsub = addedsub' >> issue1852d/.hgsub |
|
1139 | 1177 | $ echo xyz > issue1852d/sub/repo/foo |
|
1140 | 1178 | $ hg -R issue1852d pull -u |
|
1141 | 1179 | pulling from $TESTTMP/issue1852a (glob) |
|
1142 | 1180 | searching for changes |
|
1143 | 1181 | adding changesets |
|
1144 | 1182 | adding manifests |
|
1145 | 1183 | adding file changes |
|
1146 | 1184 | added 1 changesets with 2 changes to 2 files |
|
1147 | 1185 | new changesets c82b79fdcc5b |
|
1148 | 1186 | subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c) |
|
1149 | 1187 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1150 | 1188 | pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob) |
|
1151 | 1189 | searching for changes |
|
1152 | 1190 | adding changesets |
|
1153 | 1191 | adding manifests |
|
1154 | 1192 | adding file changes |
|
1155 | 1193 | added 1 changesets with 1 changes to 1 files |
|
1156 | 1194 | new changesets 46cd4aac504c |
|
1157 | 1195 | subrepository sources for sub/repo differ (glob) |
|
1158 | 1196 | use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l |
|
1159 | 1197 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1160 | 1198 | $ cat issue1852d/.hgsubstate |
|
1161 | 1199 | f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo |
|
1162 | 1200 | |
|
1163 | 1201 | Check status of files when none of them belong to the first |
|
1164 | 1202 | subrepository: |
|
1165 | 1203 | |
|
1166 | 1204 | $ hg init subrepo-status |
|
1167 | 1205 | $ cd subrepo-status |
|
1168 | 1206 | $ hg init subrepo-1 |
|
1169 | 1207 | $ hg init subrepo-2 |
|
1170 | 1208 | $ cd subrepo-2 |
|
1171 | 1209 | $ touch file |
|
1172 | 1210 | $ hg add file |
|
1173 | 1211 | $ cd .. |
|
1174 | 1212 | $ echo subrepo-1 = subrepo-1 > .hgsub |
|
1175 | 1213 | $ echo subrepo-2 = subrepo-2 >> .hgsub |
|
1176 | 1214 | $ hg add .hgsub |
|
1177 | 1215 | $ hg ci -m 'Added subrepos' |
|
1178 | 1216 | committing subrepository subrepo-2 |
|
1179 | 1217 | $ hg st subrepo-2/file |
|
1180 | 1218 | |
|
1181 | 1219 | Check that share works with subrepo |
|
1182 | 1220 | $ hg --config extensions.share= share . ../shared |
|
1183 | 1221 | updating working directory |
|
1184 | 1222 | sharing subrepo subrepo-1 from $TESTTMP/subrepo-status/subrepo-1 |
|
1185 | 1223 | sharing subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2 |
|
1186 | 1224 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1187 | 1225 | $ find ../shared/* | sort |
|
1188 | 1226 | ../shared/subrepo-1 |
|
1189 | 1227 | ../shared/subrepo-1/.hg |
|
1190 | 1228 | ../shared/subrepo-1/.hg/cache |
|
1191 | 1229 | ../shared/subrepo-1/.hg/cache/storehash |
|
1192 | 1230 | ../shared/subrepo-1/.hg/cache/storehash/* (glob) |
|
1193 | 1231 | ../shared/subrepo-1/.hg/hgrc |
|
1194 | 1232 | ../shared/subrepo-1/.hg/requires |
|
1195 | 1233 | ../shared/subrepo-1/.hg/sharedpath |
|
1196 | 1234 | ../shared/subrepo-2 |
|
1197 | 1235 | ../shared/subrepo-2/.hg |
|
1198 | 1236 | ../shared/subrepo-2/.hg/branch |
|
1199 | 1237 | ../shared/subrepo-2/.hg/cache |
|
1200 | 1238 | ../shared/subrepo-2/.hg/cache/checkisexec (execbit !) |
|
1201 | 1239 | ../shared/subrepo-2/.hg/cache/checklink (symlink !) |
|
1202 | 1240 | ../shared/subrepo-2/.hg/cache/checklink-target (symlink !) |
|
1203 | 1241 | ../shared/subrepo-2/.hg/cache/storehash |
|
1204 | 1242 | ../shared/subrepo-2/.hg/cache/storehash/* (glob) |
|
1205 | 1243 | ../shared/subrepo-2/.hg/dirstate |
|
1206 | 1244 | ../shared/subrepo-2/.hg/hgrc |
|
1207 | 1245 | ../shared/subrepo-2/.hg/requires |
|
1208 | 1246 | ../shared/subrepo-2/.hg/sharedpath |
|
1209 | 1247 | ../shared/subrepo-2/file |
|
1210 | 1248 | $ hg -R ../shared in |
|
1211 | 1249 | abort: repository default not found! |
|
1212 | 1250 | [255] |
|
1213 | 1251 | $ hg -R ../shared/subrepo-2 showconfig paths |
|
1214 | 1252 | paths.default=$TESTTMP/subrepo-status/subrepo-2 |
|
1215 | 1253 | $ hg -R ../shared/subrepo-1 sum --remote |
|
1216 | 1254 | parent: -1:000000000000 tip (empty repository) |
|
1217 | 1255 | branch: default |
|
1218 | 1256 | commit: (clean) |
|
1219 | 1257 | update: (current) |
|
1220 | 1258 | remote: (synced) |
|
1221 | 1259 | |
|
1222 | 1260 | Check hg update --clean |
|
1223 | 1261 | $ cd $TESTTMP/t |
|
1224 | 1262 | $ rm -r t/t.orig |
|
1225 | 1263 | $ hg status -S --all |
|
1226 | 1264 | C .hgsub |
|
1227 | 1265 | C .hgsubstate |
|
1228 | 1266 | C a |
|
1229 | 1267 | C s/.hgsub |
|
1230 | 1268 | C s/.hgsubstate |
|
1231 | 1269 | C s/a |
|
1232 | 1270 | C s/ss/a |
|
1233 | 1271 | C t/t |
|
1234 | 1272 | $ echo c1 > s/a |
|
1235 | 1273 | $ cd s |
|
1236 | 1274 | $ echo c1 > b |
|
1237 | 1275 | $ echo c1 > c |
|
1238 | 1276 | $ hg add b |
|
1239 | 1277 | $ cd .. |
|
1240 | 1278 | $ hg status -S |
|
1241 | 1279 | M s/a |
|
1242 | 1280 | A s/b |
|
1243 | 1281 | ? s/c |
|
1244 | 1282 | $ hg update -C |
|
1245 | 1283 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1246 | 1284 | updated to "925c17564ef8: 13" |
|
1247 | 1285 | 2 other heads for branch "default" |
|
1248 | 1286 | $ hg status -S |
|
1249 | 1287 | ? s/b |
|
1250 | 1288 | ? s/c |
|
1251 | 1289 | |
|
1252 | 1290 | Sticky subrepositories, no changes |
|
1253 | 1291 | $ cd $TESTTMP/t |
|
1254 | 1292 | $ hg id |
|
1255 | 1293 | 925c17564ef8 tip |
|
1256 | 1294 | $ hg -R s id |
|
1257 | 1295 | 12a213df6fa9 tip |
|
1258 | 1296 | $ hg -R t id |
|
1259 | 1297 | 52c0adc0515a tip |
|
1260 | 1298 | $ hg update 11 |
|
1261 | 1299 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1262 | 1300 | $ hg id |
|
1263 | 1301 | 365661e5936a |
|
1264 | 1302 | $ hg -R s id |
|
1265 | 1303 | fc627a69481f |
|
1266 | 1304 | $ hg -R t id |
|
1267 | 1305 | e95bcfa18a35 |
|
1268 | 1306 | |
|
1269 | 1307 | Sticky subrepositories, file changes |
|
1270 | 1308 | $ touch s/f1 |
|
1271 | 1309 | $ touch t/f1 |
|
1272 | 1310 | $ hg add -S s/f1 |
|
1273 | 1311 | $ hg add -S t/f1 |
|
1274 | 1312 | $ hg id |
|
1275 | 1313 | 365661e5936a+ |
|
1276 | 1314 | $ hg -R s id |
|
1277 | 1315 | fc627a69481f+ |
|
1278 | 1316 | $ hg -R t id |
|
1279 | 1317 | e95bcfa18a35+ |
|
1280 | 1318 | $ hg update tip |
|
1281 | 1319 | subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9) |
|
1282 | 1320 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1283 | 1321 | subrepository sources for s differ |
|
1284 | 1322 | use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l |
|
1285 | 1323 | subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a) |
|
1286 | 1324 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1287 | 1325 | subrepository sources for t differ |
|
1288 | 1326 | use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l |
|
1289 | 1327 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1290 | 1328 | $ hg id |
|
1291 | 1329 | 925c17564ef8+ tip |
|
1292 | 1330 | $ hg -R s id |
|
1293 | 1331 | fc627a69481f+ |
|
1294 | 1332 | $ hg -R t id |
|
1295 | 1333 | e95bcfa18a35+ |
|
1296 | 1334 | $ hg update --clean tip |
|
1297 | 1335 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1298 | 1336 | |
|
1299 | 1337 | Sticky subrepository, revision updates |
|
1300 | 1338 | $ hg id |
|
1301 | 1339 | 925c17564ef8 tip |
|
1302 | 1340 | $ hg -R s id |
|
1303 | 1341 | 12a213df6fa9 tip |
|
1304 | 1342 | $ hg -R t id |
|
1305 | 1343 | 52c0adc0515a tip |
|
1306 | 1344 | $ cd s |
|
1307 | 1345 | $ hg update -r -2 |
|
1308 | 1346 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1309 | 1347 | $ cd ../t |
|
1310 | 1348 | $ hg update -r 2 |
|
1311 | 1349 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1312 | 1350 | $ cd .. |
|
1313 | 1351 | $ hg update 10 |
|
1314 | 1352 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) |
|
1315 | 1353 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1316 | 1354 | subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c) |
|
1317 | 1355 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1318 | 1356 | subrepository sources for t differ (in checked out version) |
|
1319 | 1357 | use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l |
|
1320 | 1358 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1321 | 1359 | $ hg id |
|
1322 | 1360 | e45c8b14af55+ |
|
1323 | 1361 | $ hg -R s id |
|
1324 | 1362 | 02dcf1d70411 |
|
1325 | 1363 | $ hg -R t id |
|
1326 | 1364 | 7af322bc1198 |
|
1327 | 1365 | |
|
1328 | 1366 | Sticky subrepository, file changes and revision updates |
|
1329 | 1367 | $ touch s/f1 |
|
1330 | 1368 | $ touch t/f1 |
|
1331 | 1369 | $ hg add -S s/f1 |
|
1332 | 1370 | $ hg add -S t/f1 |
|
1333 | 1371 | $ hg id |
|
1334 | 1372 | e45c8b14af55+ |
|
1335 | 1373 | $ hg -R s id |
|
1336 | 1374 | 02dcf1d70411+ |
|
1337 | 1375 | $ hg -R t id |
|
1338 | 1376 | 7af322bc1198+ |
|
1339 | 1377 | $ hg update tip |
|
1340 | 1378 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9) |
|
1341 | 1379 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1342 | 1380 | subrepository sources for s differ |
|
1343 | 1381 | use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l |
|
1344 | 1382 | subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a) |
|
1345 | 1383 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1346 | 1384 | subrepository sources for t differ |
|
1347 | 1385 | use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l |
|
1348 | 1386 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1349 | 1387 | $ hg id |
|
1350 | 1388 | 925c17564ef8+ tip |
|
1351 | 1389 | $ hg -R s id |
|
1352 | 1390 | 02dcf1d70411+ |
|
1353 | 1391 | $ hg -R t id |
|
1354 | 1392 | 7af322bc1198+ |
|
1355 | 1393 | |
|
1356 | 1394 | Sticky repository, update --clean |
|
1357 | 1395 | $ hg update --clean tip |
|
1358 | 1396 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1359 | 1397 | $ hg id |
|
1360 | 1398 | 925c17564ef8 tip |
|
1361 | 1399 | $ hg -R s id |
|
1362 | 1400 | 12a213df6fa9 tip |
|
1363 | 1401 | $ hg -R t id |
|
1364 | 1402 | 52c0adc0515a tip |
|
1365 | 1403 | |
|
1366 | 1404 | Test subrepo already at intended revision: |
|
1367 | 1405 | $ cd s |
|
1368 | 1406 | $ hg update fc627a69481f |
|
1369 | 1407 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1370 | 1408 | $ cd .. |
|
1371 | 1409 | $ hg update 11 |
|
1372 | 1410 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) |
|
1373 | 1411 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m |
|
1374 | 1412 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1375 | 1413 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1376 | 1414 | $ hg id -n |
|
1377 | 1415 | 11+ |
|
1378 | 1416 | $ hg -R s id |
|
1379 | 1417 | fc627a69481f |
|
1380 | 1418 | $ hg -R t id |
|
1381 | 1419 | e95bcfa18a35 |
|
1382 | 1420 | |
|
1383 | 1421 | Test that removing .hgsubstate doesn't break anything: |
|
1384 | 1422 | |
|
1385 | 1423 | $ hg rm -f .hgsubstate |
|
1386 | 1424 | $ hg ci -mrm |
|
1387 | 1425 | nothing changed |
|
1388 | 1426 | [1] |
|
1389 | 1427 | $ hg log -vr tip |
|
1390 | 1428 | changeset: 13:925c17564ef8 |
|
1391 | 1429 | tag: tip |
|
1392 | 1430 | user: test |
|
1393 | 1431 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1394 | 1432 | files: .hgsubstate |
|
1395 | 1433 | description: |
|
1396 | 1434 | 13 |
|
1397 | 1435 | |
|
1398 | 1436 | |
|
1399 | 1437 | |
|
1400 | 1438 | Test that removing .hgsub removes .hgsubstate: |
|
1401 | 1439 | |
|
1402 | 1440 | $ hg rm .hgsub |
|
1403 | 1441 | $ hg ci -mrm2 |
|
1404 | 1442 | created new head |
|
1405 | 1443 | $ hg log -vr tip |
|
1406 | 1444 | changeset: 14:2400bccd50af |
|
1407 | 1445 | tag: tip |
|
1408 | 1446 | parent: 11:365661e5936a |
|
1409 | 1447 | user: test |
|
1410 | 1448 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1411 | 1449 | files: .hgsub .hgsubstate |
|
1412 | 1450 | description: |
|
1413 | 1451 | rm2 |
|
1414 | 1452 | |
|
1415 | 1453 | |
|
1416 | 1454 | Test issue3153: diff -S with deleted subrepos |
|
1417 | 1455 | |
|
1418 | 1456 | $ hg diff --nodates -S -c . |
|
1419 | 1457 | diff -r 365661e5936a -r 2400bccd50af .hgsub |
|
1420 | 1458 | --- a/.hgsub |
|
1421 | 1459 | +++ /dev/null |
|
1422 | 1460 | @@ -1,2 +0,0 @@ |
|
1423 | 1461 | -s = s |
|
1424 | 1462 | -t = t |
|
1425 | 1463 | diff -r 365661e5936a -r 2400bccd50af .hgsubstate |
|
1426 | 1464 | --- a/.hgsubstate |
|
1427 | 1465 | +++ /dev/null |
|
1428 | 1466 | @@ -1,2 +0,0 @@ |
|
1429 | 1467 | -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
1430 | 1468 | -e95bcfa18a358dc4936da981ebf4147b4cad1362 t |
|
1431 | 1469 | |
|
1432 | 1470 | Test behavior of add for explicit path in subrepo: |
|
1433 | 1471 | $ cd .. |
|
1434 | 1472 | $ hg init explicit |
|
1435 | 1473 | $ cd explicit |
|
1436 | 1474 | $ echo s = s > .hgsub |
|
1437 | 1475 | $ hg add .hgsub |
|
1438 | 1476 | $ hg init s |
|
1439 | 1477 | $ hg ci -m0 |
|
1440 | 1478 | Adding with an explicit path in a subrepo adds the file |
|
1441 | 1479 | $ echo c1 > f1 |
|
1442 | 1480 | $ echo c2 > s/f2 |
|
1443 | 1481 | $ hg st -S |
|
1444 | 1482 | ? f1 |
|
1445 | 1483 | ? s/f2 |
|
1446 | 1484 | $ hg add s/f2 |
|
1447 | 1485 | $ hg st -S |
|
1448 | 1486 | A s/f2 |
|
1449 | 1487 | ? f1 |
|
1450 | 1488 | $ hg ci -R s -m0 |
|
1451 | 1489 | $ hg ci -Am1 |
|
1452 | 1490 | adding f1 |
|
1453 | 1491 | Adding with an explicit path in a subrepo with -S has the same behavior |
|
1454 | 1492 | $ echo c3 > f3 |
|
1455 | 1493 | $ echo c4 > s/f4 |
|
1456 | 1494 | $ hg st -S |
|
1457 | 1495 | ? f3 |
|
1458 | 1496 | ? s/f4 |
|
1459 | 1497 | $ hg add -S s/f4 |
|
1460 | 1498 | $ hg st -S |
|
1461 | 1499 | A s/f4 |
|
1462 | 1500 | ? f3 |
|
1463 | 1501 | $ hg ci -R s -m1 |
|
1464 | 1502 | $ hg ci -Ama2 |
|
1465 | 1503 | adding f3 |
|
1466 | 1504 | Adding without a path or pattern silently ignores subrepos |
|
1467 | 1505 | $ echo c5 > f5 |
|
1468 | 1506 | $ echo c6 > s/f6 |
|
1469 | 1507 | $ echo c7 > s/f7 |
|
1470 | 1508 | $ hg st -S |
|
1471 | 1509 | ? f5 |
|
1472 | 1510 | ? s/f6 |
|
1473 | 1511 | ? s/f7 |
|
1474 | 1512 | $ hg add |
|
1475 | 1513 | adding f5 |
|
1476 | 1514 | $ hg st -S |
|
1477 | 1515 | A f5 |
|
1478 | 1516 | ? s/f6 |
|
1479 | 1517 | ? s/f7 |
|
1480 | 1518 | $ hg ci -R s -Am2 |
|
1481 | 1519 | adding f6 |
|
1482 | 1520 | adding f7 |
|
1483 | 1521 | $ hg ci -m3 |
|
1484 | 1522 | Adding without a path or pattern with -S also adds files in subrepos |
|
1485 | 1523 | $ echo c8 > f8 |
|
1486 | 1524 | $ echo c9 > s/f9 |
|
1487 | 1525 | $ echo c10 > s/f10 |
|
1488 | 1526 | $ hg st -S |
|
1489 | 1527 | ? f8 |
|
1490 | 1528 | ? s/f10 |
|
1491 | 1529 | ? s/f9 |
|
1492 | 1530 | $ hg add -S |
|
1493 | 1531 | adding f8 |
|
1494 | 1532 | adding s/f10 (glob) |
|
1495 | 1533 | adding s/f9 (glob) |
|
1496 | 1534 | $ hg st -S |
|
1497 | 1535 | A f8 |
|
1498 | 1536 | A s/f10 |
|
1499 | 1537 | A s/f9 |
|
1500 | 1538 | $ hg ci -R s -m3 |
|
1501 | 1539 | $ hg ci -m4 |
|
1502 | 1540 | Adding with a pattern silently ignores subrepos |
|
1503 | 1541 | $ echo c11 > fm11 |
|
1504 | 1542 | $ echo c12 > fn12 |
|
1505 | 1543 | $ echo c13 > s/fm13 |
|
1506 | 1544 | $ echo c14 > s/fn14 |
|
1507 | 1545 | $ hg st -S |
|
1508 | 1546 | ? fm11 |
|
1509 | 1547 | ? fn12 |
|
1510 | 1548 | ? s/fm13 |
|
1511 | 1549 | ? s/fn14 |
|
1512 | 1550 | $ hg add 'glob:**fm*' |
|
1513 | 1551 | adding fm11 |
|
1514 | 1552 | $ hg st -S |
|
1515 | 1553 | A fm11 |
|
1516 | 1554 | ? fn12 |
|
1517 | 1555 | ? s/fm13 |
|
1518 | 1556 | ? s/fn14 |
|
1519 | 1557 | $ hg ci -R s -Am4 |
|
1520 | 1558 | adding fm13 |
|
1521 | 1559 | adding fn14 |
|
1522 | 1560 | $ hg ci -Am5 |
|
1523 | 1561 | adding fn12 |
|
1524 | 1562 | Adding with a pattern with -S also adds matches in subrepos |
|
1525 | 1563 | $ echo c15 > fm15 |
|
1526 | 1564 | $ echo c16 > fn16 |
|
1527 | 1565 | $ echo c17 > s/fm17 |
|
1528 | 1566 | $ echo c18 > s/fn18 |
|
1529 | 1567 | $ hg st -S |
|
1530 | 1568 | ? fm15 |
|
1531 | 1569 | ? fn16 |
|
1532 | 1570 | ? s/fm17 |
|
1533 | 1571 | ? s/fn18 |
|
1534 | 1572 | $ hg add -S 'glob:**fm*' |
|
1535 | 1573 | adding fm15 |
|
1536 | 1574 | adding s/fm17 (glob) |
|
1537 | 1575 | $ hg st -S |
|
1538 | 1576 | A fm15 |
|
1539 | 1577 | A s/fm17 |
|
1540 | 1578 | ? fn16 |
|
1541 | 1579 | ? s/fn18 |
|
1542 | 1580 | $ hg ci -R s -Am5 |
|
1543 | 1581 | adding fn18 |
|
1544 | 1582 | $ hg ci -Am6 |
|
1545 | 1583 | adding fn16 |
|
1546 | 1584 | |
|
1547 | 1585 | Test behavior of forget for explicit path in subrepo: |
|
1548 | 1586 | Forgetting an explicit path in a subrepo untracks the file |
|
1549 | 1587 | $ echo c19 > s/f19 |
|
1550 | 1588 | $ hg add s/f19 |
|
1551 | 1589 | $ hg st -S |
|
1552 | 1590 | A s/f19 |
|
1553 | 1591 | $ hg forget s/f19 |
|
1554 | 1592 | $ hg st -S |
|
1555 | 1593 | ? s/f19 |
|
1556 | 1594 | $ rm s/f19 |
|
1557 | 1595 | $ cd .. |
|
1558 | 1596 | |
|
1559 | 1597 | Courtesy phases synchronisation to publishing server does not block the push |
|
1560 | 1598 | (issue3781) |
|
1561 | 1599 | |
|
1562 | 1600 | $ cp -R main issue3781 |
|
1563 | 1601 | $ cp -R main issue3781-dest |
|
1564 | 1602 | $ cd issue3781-dest/s |
|
1565 | 1603 | $ hg phase tip # show we have draft changeset |
|
1566 | 1604 | 5: draft |
|
1567 | 1605 | $ chmod a-w .hg/store/phaseroots # prevent phase push |
|
1568 | 1606 | $ cd ../../issue3781 |
|
1569 | 1607 | $ cat >> .hg/hgrc << EOF |
|
1570 | 1608 | > [paths] |
|
1571 | 1609 | > default=../issue3781-dest/ |
|
1572 | 1610 | > EOF |
|
1573 | 1611 | $ hg push --config devel.legacy.exchange=bundle1 |
|
1574 | 1612 | pushing to $TESTTMP/issue3781-dest (glob) |
|
1575 | 1613 | pushing subrepo s to $TESTTMP/issue3781-dest/s |
|
1576 | 1614 | searching for changes |
|
1577 | 1615 | no changes found |
|
1578 | 1616 | searching for changes |
|
1579 | 1617 | no changes found |
|
1580 | 1618 | [1] |
|
1581 | 1619 | # clean the push cache |
|
1582 | 1620 | $ rm s/.hg/cache/storehash/* |
|
1583 | 1621 | $ hg push # bundle2+ |
|
1584 | 1622 | pushing to $TESTTMP/issue3781-dest (glob) |
|
1585 | 1623 | pushing subrepo s to $TESTTMP/issue3781-dest/s |
|
1586 | 1624 | searching for changes |
|
1587 | 1625 | no changes found |
|
1588 | 1626 | searching for changes |
|
1589 | 1627 | no changes found |
|
1590 | 1628 | [1] |
|
1591 | 1629 | $ cd .. |
|
1592 | 1630 | |
|
1593 | 1631 | Test phase choice for newly created commit with "phases.subrepochecks" |
|
1594 | 1632 | configuration |
|
1595 | 1633 | |
|
1596 | 1634 | $ cd t |
|
1597 | 1635 | $ hg update -q -r 12 |
|
1598 | 1636 | |
|
1599 | 1637 | $ cat >> s/ss/.hg/hgrc <<EOF |
|
1600 | 1638 | > [phases] |
|
1601 | 1639 | > new-commit = secret |
|
1602 | 1640 | > EOF |
|
1603 | 1641 | $ cat >> s/.hg/hgrc <<EOF |
|
1604 | 1642 | > [phases] |
|
1605 | 1643 | > new-commit = draft |
|
1606 | 1644 | > EOF |
|
1607 | 1645 | $ echo phasecheck1 >> s/ss/a |
|
1608 | 1646 | $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1 |
|
1609 | 1647 | committing subrepository ss |
|
1610 | 1648 | transaction abort! |
|
1611 | 1649 | rollback completed |
|
1612 | 1650 | abort: can't commit in draft phase conflicting secret from subrepository ss |
|
1613 | 1651 | [255] |
|
1614 | 1652 | $ echo phasecheck2 >> s/ss/a |
|
1615 | 1653 | $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2 |
|
1616 | 1654 | committing subrepository ss |
|
1617 | 1655 | $ hg -R s/ss phase tip |
|
1618 | 1656 | 3: secret |
|
1619 | 1657 | $ hg -R s phase tip |
|
1620 | 1658 | 6: draft |
|
1621 | 1659 | $ echo phasecheck3 >> s/ss/a |
|
1622 | 1660 | $ hg -R s commit -S -m phasecheck3 |
|
1623 | 1661 | committing subrepository ss |
|
1624 | 1662 | warning: changes are committed in secret phase from subrepository ss |
|
1625 | 1663 | $ hg -R s/ss phase tip |
|
1626 | 1664 | 4: secret |
|
1627 | 1665 | $ hg -R s phase tip |
|
1628 | 1666 | 7: secret |
|
1629 | 1667 | |
|
1630 | 1668 | $ cat >> t/.hg/hgrc <<EOF |
|
1631 | 1669 | > [phases] |
|
1632 | 1670 | > new-commit = draft |
|
1633 | 1671 | > EOF |
|
1634 | 1672 | $ cat >> .hg/hgrc <<EOF |
|
1635 | 1673 | > [phases] |
|
1636 | 1674 | > new-commit = public |
|
1637 | 1675 | > EOF |
|
1638 | 1676 | $ echo phasecheck4 >> s/ss/a |
|
1639 | 1677 | $ echo phasecheck4 >> t/t |
|
1640 | 1678 | $ hg commit -S -m phasecheck4 |
|
1641 | 1679 | committing subrepository s |
|
1642 | 1680 | committing subrepository s/ss (glob) |
|
1643 | 1681 | warning: changes are committed in secret phase from subrepository ss |
|
1644 | 1682 | committing subrepository t |
|
1645 | 1683 | warning: changes are committed in secret phase from subrepository s |
|
1646 | 1684 | created new head |
|
1647 | 1685 | $ hg -R s/ss phase tip |
|
1648 | 1686 | 5: secret |
|
1649 | 1687 | $ hg -R s phase tip |
|
1650 | 1688 | 8: secret |
|
1651 | 1689 | $ hg -R t phase tip |
|
1652 | 1690 | 6: draft |
|
1653 | 1691 | $ hg phase tip |
|
1654 | 1692 | 15: secret |
|
1655 | 1693 | |
|
1656 | 1694 | $ cd .. |
|
1657 | 1695 | |
|
1658 | 1696 | |
|
1659 | 1697 | Test that commit --secret works on both repo and subrepo (issue4182) |
|
1660 | 1698 | |
|
1661 | 1699 | $ cd main |
|
1662 | 1700 | $ echo secret >> b |
|
1663 | 1701 | $ echo secret >> s/b |
|
1664 | 1702 | $ hg commit --secret --subrepo -m "secret" |
|
1665 | 1703 | committing subrepository s |
|
1666 | 1704 | $ hg phase -r . |
|
1667 | 1705 | 6: secret |
|
1668 | 1706 | $ cd s |
|
1669 | 1707 | $ hg phase -r . |
|
1670 | 1708 | 6: secret |
|
1671 | 1709 | $ cd ../../ |
|
1672 | 1710 | |
|
1673 | 1711 | Test "subrepos" template keyword |
|
1674 | 1712 | |
|
1675 | 1713 | $ cd t |
|
1676 | 1714 | $ hg update -q 15 |
|
1677 | 1715 | $ cat > .hgsub <<EOF |
|
1678 | 1716 | > s = s |
|
1679 | 1717 | > EOF |
|
1680 | 1718 | $ hg commit -m "16" |
|
1681 | 1719 | warning: changes are committed in secret phase from subrepository s |
|
1682 | 1720 | |
|
1683 | 1721 | (addition of ".hgsub" itself) |
|
1684 | 1722 | |
|
1685 | 1723 | $ hg diff --nodates -c 1 .hgsubstate |
|
1686 | 1724 | diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate |
|
1687 | 1725 | --- /dev/null |
|
1688 | 1726 | +++ b/.hgsubstate |
|
1689 | 1727 | @@ -0,0 +1,1 @@ |
|
1690 | 1728 | +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1691 | 1729 | $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1692 | 1730 | f7b1eb17ad24 000000000000 |
|
1693 | 1731 | s |
|
1694 | 1732 | |
|
1695 | 1733 | (modification of existing entry) |
|
1696 | 1734 | |
|
1697 | 1735 | $ hg diff --nodates -c 2 .hgsubstate |
|
1698 | 1736 | diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate |
|
1699 | 1737 | --- a/.hgsubstate |
|
1700 | 1738 | +++ b/.hgsubstate |
|
1701 | 1739 | @@ -1,1 +1,1 @@ |
|
1702 | 1740 | -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1703 | 1741 | +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s |
|
1704 | 1742 | $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1705 | 1743 | 7cf8cfea66e4 000000000000 |
|
1706 | 1744 | s |
|
1707 | 1745 | |
|
1708 | 1746 | (addition of entry) |
|
1709 | 1747 | |
|
1710 | 1748 | $ hg diff --nodates -c 5 .hgsubstate |
|
1711 | 1749 | diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate |
|
1712 | 1750 | --- a/.hgsubstate |
|
1713 | 1751 | +++ b/.hgsubstate |
|
1714 | 1752 | @@ -1,1 +1,2 @@ |
|
1715 | 1753 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1716 | 1754 | +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t |
|
1717 | 1755 | $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1718 | 1756 | 7cf8cfea66e4 000000000000 |
|
1719 | 1757 | t |
|
1720 | 1758 | |
|
1721 | 1759 | (removal of existing entry) |
|
1722 | 1760 | |
|
1723 | 1761 | $ hg diff --nodates -c 16 .hgsubstate |
|
1724 | 1762 | diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate |
|
1725 | 1763 | --- a/.hgsubstate |
|
1726 | 1764 | +++ b/.hgsubstate |
|
1727 | 1765 | @@ -1,2 +1,1 @@ |
|
1728 | 1766 | 0731af8ca9423976d3743119d0865097c07bdc1b s |
|
1729 | 1767 | -e202dc79b04c88a636ea8913d9182a1346d9b3dc t |
|
1730 | 1768 | $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1731 | 1769 | 8bec38d2bd0b 000000000000 |
|
1732 | 1770 | t |
|
1733 | 1771 | |
|
1734 | 1772 | (merging) |
|
1735 | 1773 | |
|
1736 | 1774 | $ hg diff --nodates -c 9 .hgsubstate |
|
1737 | 1775 | diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate |
|
1738 | 1776 | --- a/.hgsubstate |
|
1739 | 1777 | +++ b/.hgsubstate |
|
1740 | 1778 | @@ -1,1 +1,2 @@ |
|
1741 | 1779 | fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
1742 | 1780 | +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t |
|
1743 | 1781 | $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1744 | 1782 | f6affe3fbfaa 1f14a2e2d3ec |
|
1745 | 1783 | t |
|
1746 | 1784 | |
|
1747 | 1785 | (removal of ".hgsub" itself) |
|
1748 | 1786 | |
|
1749 | 1787 | $ hg diff --nodates -c 8 .hgsubstate |
|
1750 | 1788 | diff -r f94576341bcf -r 96615c1dad2d .hgsubstate |
|
1751 | 1789 | --- a/.hgsubstate |
|
1752 | 1790 | +++ /dev/null |
|
1753 | 1791 | @@ -1,2 +0,0 @@ |
|
1754 | 1792 | -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1755 | 1793 | -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t |
|
1756 | 1794 | $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1757 | 1795 | f94576341bcf 000000000000 |
|
1758 | 1796 | |
|
1759 | 1797 | Test that '[paths]' is configured correctly at subrepo creation |
|
1760 | 1798 | |
|
1761 | 1799 | $ cd $TESTTMP/tc |
|
1762 | 1800 | $ cat > .hgsub <<EOF |
|
1763 | 1801 | > # to clear bogus subrepo path 'bogus=[boguspath' |
|
1764 | 1802 | > s = s |
|
1765 | 1803 | > t = t |
|
1766 | 1804 | > EOF |
|
1767 | 1805 | $ hg update -q --clean null |
|
1768 | 1806 | $ rm -rf s t |
|
1769 | 1807 | $ cat >> .hg/hgrc <<EOF |
|
1770 | 1808 | > [paths] |
|
1771 | 1809 | > default-push = /foo/bar |
|
1772 | 1810 | > EOF |
|
1773 | 1811 | $ hg update -q |
|
1774 | 1812 | $ cat s/.hg/hgrc |
|
1775 | 1813 | [paths] |
|
1776 | 1814 | default = $TESTTMP/t/s |
|
1777 | 1815 | default-push = /foo/bar/s |
|
1778 | 1816 | $ cat s/ss/.hg/hgrc |
|
1779 | 1817 | [paths] |
|
1780 | 1818 | default = $TESTTMP/t/s/ss |
|
1781 | 1819 | default-push = /foo/bar/s/ss |
|
1782 | 1820 | $ cat t/.hg/hgrc |
|
1783 | 1821 | [paths] |
|
1784 | 1822 | default = $TESTTMP/t/t |
|
1785 | 1823 | default-push = /foo/bar/t |
|
1786 | 1824 | |
|
1787 | 1825 | $ cd $TESTTMP/t |
|
1788 | 1826 | $ hg up -qC 0 |
|
1789 | 1827 | $ echo 'bar' > bar.txt |
|
1790 | 1828 | $ hg ci -Am 'branch before subrepo add' |
|
1791 | 1829 | adding bar.txt |
|
1792 | 1830 | created new head |
|
1793 | 1831 | $ hg merge -r "first(subrepo('s'))" |
|
1794 | 1832 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1795 | 1833 | (branch merge, don't forget to commit) |
|
1796 | 1834 | $ hg status -S -X '.hgsub*' |
|
1797 | 1835 | A s/a |
|
1798 | 1836 | ? s/b |
|
1799 | 1837 | ? s/c |
|
1800 | 1838 | ? s/f1 |
|
1801 | 1839 | $ hg status -S --rev 'p2()' |
|
1802 | 1840 | A bar.txt |
|
1803 | 1841 | ? s/b |
|
1804 | 1842 | ? s/c |
|
1805 | 1843 | ? s/f1 |
|
1806 | 1844 | $ hg diff -S -X '.hgsub*' --nodates |
|
1807 | 1845 | diff -r 000000000000 s/a |
|
1808 | 1846 | --- /dev/null |
|
1809 | 1847 | +++ b/s/a |
|
1810 | 1848 | @@ -0,0 +1,1 @@ |
|
1811 | 1849 | +a |
|
1812 | 1850 | $ hg diff -S --rev 'p2()' --nodates |
|
1813 | 1851 | diff -r 7cf8cfea66e4 bar.txt |
|
1814 | 1852 | --- /dev/null |
|
1815 | 1853 | +++ b/bar.txt |
|
1816 | 1854 | @@ -0,0 +1,1 @@ |
|
1817 | 1855 | +bar |
|
1818 | 1856 | |
|
1819 | 1857 | $ cd .. |
|
1820 | 1858 | |
|
1821 | 1859 | test for ssh exploit 2017-07-25 |
|
1822 | 1860 | |
|
1823 | 1861 | $ cat >> $HGRCPATH << EOF |
|
1824 | 1862 | > [ui] |
|
1825 | 1863 | > ssh = sh -c "read l; read l; read l" |
|
1826 | 1864 | > EOF |
|
1827 | 1865 | |
|
1828 | 1866 | $ hg init malicious-proxycommand |
|
1829 | 1867 | $ cd malicious-proxycommand |
|
1830 | 1868 | $ echo 's = [hg]ssh://-oProxyCommand=touch${IFS}owned/path' > .hgsub |
|
1831 | 1869 | $ hg init s |
|
1832 | 1870 | $ cd s |
|
1833 | 1871 | $ echo init > init |
|
1834 | 1872 | $ hg add |
|
1835 | 1873 | adding init |
|
1836 | 1874 | $ hg commit -m init |
|
1837 | 1875 | $ cd .. |
|
1838 | 1876 | $ hg add .hgsub |
|
1839 | 1877 | $ hg ci -m 'add subrepo' |
|
1840 | 1878 | $ cd .. |
|
1841 | 1879 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1842 | 1880 | updating to branch default |
|
1843 | 1881 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") |
|
1844 | 1882 | [255] |
|
1845 | 1883 | |
|
1846 | 1884 | also check that a percent encoded '-' (%2D) doesn't work |
|
1847 | 1885 | |
|
1848 | 1886 | $ cd malicious-proxycommand |
|
1849 | 1887 | $ echo 's = [hg]ssh://%2DoProxyCommand=touch${IFS}owned/path' > .hgsub |
|
1850 | 1888 | $ hg ci -m 'change url to percent encoded' |
|
1851 | 1889 | $ cd .. |
|
1852 | 1890 | $ rm -r malicious-proxycommand-clone |
|
1853 | 1891 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1854 | 1892 | updating to branch default |
|
1855 | 1893 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") |
|
1856 | 1894 | [255] |
|
1857 | 1895 | |
|
1858 | 1896 | also check for a pipe |
|
1859 | 1897 | |
|
1860 | 1898 | $ cd malicious-proxycommand |
|
1861 | 1899 | $ echo 's = [hg]ssh://fakehost|touch${IFS}owned/path' > .hgsub |
|
1862 | 1900 | $ hg ci -m 'change url to pipe' |
|
1863 | 1901 | $ cd .. |
|
1864 | 1902 | $ rm -r malicious-proxycommand-clone |
|
1865 | 1903 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1866 | 1904 | updating to branch default |
|
1867 | 1905 | abort: no suitable response from remote hg! |
|
1868 | 1906 | [255] |
|
1869 | 1907 | $ [ ! -f owned ] || echo 'you got owned' |
|
1870 | 1908 | |
|
1871 | 1909 | also check that a percent encoded '|' (%7C) doesn't work |
|
1872 | 1910 | |
|
1873 | 1911 | $ cd malicious-proxycommand |
|
1874 | 1912 | $ echo 's = [hg]ssh://fakehost%7Ctouch%20owned/path' > .hgsub |
|
1875 | 1913 | $ hg ci -m 'change url to percent encoded pipe' |
|
1876 | 1914 | $ cd .. |
|
1877 | 1915 | $ rm -r malicious-proxycommand-clone |
|
1878 | 1916 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1879 | 1917 | updating to branch default |
|
1880 | 1918 | abort: no suitable response from remote hg! |
|
1881 | 1919 | [255] |
|
1882 | 1920 | $ [ ! -f owned ] || echo 'you got owned' |
|
1883 | 1921 | |
|
1884 | 1922 | and bad usernames: |
|
1885 | 1923 | $ cd malicious-proxycommand |
|
1886 | 1924 | $ echo 's = [hg]ssh://-oProxyCommand=touch owned@example.com/path' > .hgsub |
|
1887 | 1925 | $ hg ci -m 'owned username' |
|
1888 | 1926 | $ cd .. |
|
1889 | 1927 | $ rm -r malicious-proxycommand-clone |
|
1890 | 1928 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1891 | 1929 | updating to branch default |
|
1892 | 1930 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s") |
|
1893 | 1931 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now