##// END OF EJS Templates
minirst: change hgrole to use single quotes...
timeless -
r27729:58f8b29c default
parent child Browse files
Show More
@@ -1,816 +1,816 b''
1 # minirst.py - minimal reStructuredText parser
1 # minirst.py - minimal reStructuredText parser
2 #
2 #
3 # Copyright 2009, 2010 Matt Mackall <mpm@selenic.com> and others
3 # Copyright 2009, 2010 Matt Mackall <mpm@selenic.com> and others
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 """simplified reStructuredText parser.
8 """simplified reStructuredText parser.
9
9
10 This parser knows just enough about reStructuredText to parse the
10 This parser knows just enough about reStructuredText to parse the
11 Mercurial docstrings.
11 Mercurial docstrings.
12
12
13 It cheats in a major way: nested blocks are not really nested. They
13 It cheats in a major way: nested blocks are not really nested. They
14 are just indented blocks that look like they are nested. This relies
14 are just indented blocks that look like they are nested. This relies
15 on the user to keep the right indentation for the blocks.
15 on the user to keep the right indentation for the blocks.
16
16
17 Remember to update https://mercurial-scm.org/wiki/HelpStyleGuide
17 Remember to update https://mercurial-scm.org/wiki/HelpStyleGuide
18 when adding support for new constructs.
18 when adding support for new constructs.
19 """
19 """
20
20
21 from __future__ import absolute_import
21 from __future__ import absolute_import
22
22
23 import cgi
23 import cgi
24 import re
24 import re
25
25
26 from .i18n import _
26 from .i18n import _
27 from . import (
27 from . import (
28 encoding,
28 encoding,
29 util,
29 util,
30 )
30 )
31
31
32 def section(s):
32 def section(s):
33 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
33 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
34
34
35 def subsection(s):
35 def subsection(s):
36 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
36 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
37
37
38 def subsubsection(s):
38 def subsubsection(s):
39 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
39 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
40
40
41 def subsubsubsection(s):
41 def subsubsubsection(s):
42 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
42 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
43
43
44 def replace(text, substs):
44 def replace(text, substs):
45 '''
45 '''
46 Apply a list of (find, replace) pairs to a text.
46 Apply a list of (find, replace) pairs to a text.
47
47
48 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
48 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
49 'Foo Bar'
49 'Foo Bar'
50 >>> encoding.encoding = 'latin1'
50 >>> encoding.encoding = 'latin1'
51 >>> replace('\\x81\\\\', [('\\\\', '/')])
51 >>> replace('\\x81\\\\', [('\\\\', '/')])
52 '\\x81/'
52 '\\x81/'
53 >>> encoding.encoding = 'shiftjis'
53 >>> encoding.encoding = 'shiftjis'
54 >>> replace('\\x81\\\\', [('\\\\', '/')])
54 >>> replace('\\x81\\\\', [('\\\\', '/')])
55 '\\x81\\\\'
55 '\\x81\\\\'
56 '''
56 '''
57
57
58 # some character encodings (cp932 for Japanese, at least) use
58 # some character encodings (cp932 for Japanese, at least) use
59 # ASCII characters other than control/alphabet/digit as a part of
59 # ASCII characters other than control/alphabet/digit as a part of
60 # multi-bytes characters, so direct replacing with such characters
60 # multi-bytes characters, so direct replacing with such characters
61 # on strings in local encoding causes invalid byte sequences.
61 # on strings in local encoding causes invalid byte sequences.
62 utext = text.decode(encoding.encoding)
62 utext = text.decode(encoding.encoding)
63 for f, t in substs:
63 for f, t in substs:
64 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
64 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
65 return utext.encode(encoding.encoding)
65 return utext.encode(encoding.encoding)
66
66
67 _blockre = re.compile(r"\n(?:\s*\n)+")
67 _blockre = re.compile(r"\n(?:\s*\n)+")
68
68
69 def findblocks(text):
69 def findblocks(text):
70 """Find continuous blocks of lines in text.
70 """Find continuous blocks of lines in text.
71
71
72 Returns a list of dictionaries representing the blocks. Each block
72 Returns a list of dictionaries representing the blocks. Each block
73 has an 'indent' field and a 'lines' field.
73 has an 'indent' field and a 'lines' field.
74 """
74 """
75 blocks = []
75 blocks = []
76 for b in _blockre.split(text.lstrip('\n').rstrip()):
76 for b in _blockre.split(text.lstrip('\n').rstrip()):
77 lines = b.splitlines()
77 lines = b.splitlines()
78 if lines:
78 if lines:
79 indent = min((len(l) - len(l.lstrip())) for l in lines)
79 indent = min((len(l) - len(l.lstrip())) for l in lines)
80 lines = [l[indent:] for l in lines]
80 lines = [l[indent:] for l in lines]
81 blocks.append({'indent': indent, 'lines': lines})
81 blocks.append({'indent': indent, 'lines': lines})
82 return blocks
82 return blocks
83
83
84 def findliteralblocks(blocks):
84 def findliteralblocks(blocks):
85 """Finds literal blocks and adds a 'type' field to the blocks.
85 """Finds literal blocks and adds a 'type' field to the blocks.
86
86
87 Literal blocks are given the type 'literal', all other blocks are
87 Literal blocks are given the type 'literal', all other blocks are
88 given type the 'paragraph'.
88 given type the 'paragraph'.
89 """
89 """
90 i = 0
90 i = 0
91 while i < len(blocks):
91 while i < len(blocks):
92 # Searching for a block that looks like this:
92 # Searching for a block that looks like this:
93 #
93 #
94 # +------------------------------+
94 # +------------------------------+
95 # | paragraph |
95 # | paragraph |
96 # | (ends with "::") |
96 # | (ends with "::") |
97 # +------------------------------+
97 # +------------------------------+
98 # +---------------------------+
98 # +---------------------------+
99 # | indented literal block |
99 # | indented literal block |
100 # +---------------------------+
100 # +---------------------------+
101 blocks[i]['type'] = 'paragraph'
101 blocks[i]['type'] = 'paragraph'
102 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
102 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
103 indent = blocks[i]['indent']
103 indent = blocks[i]['indent']
104 adjustment = blocks[i + 1]['indent'] - indent
104 adjustment = blocks[i + 1]['indent'] - indent
105
105
106 if blocks[i]['lines'] == ['::']:
106 if blocks[i]['lines'] == ['::']:
107 # Expanded form: remove block
107 # Expanded form: remove block
108 del blocks[i]
108 del blocks[i]
109 i -= 1
109 i -= 1
110 elif blocks[i]['lines'][-1].endswith(' ::'):
110 elif blocks[i]['lines'][-1].endswith(' ::'):
111 # Partially minimized form: remove space and both
111 # Partially minimized form: remove space and both
112 # colons.
112 # colons.
113 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
113 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
114 elif len(blocks[i]['lines']) == 1 and \
114 elif len(blocks[i]['lines']) == 1 and \
115 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
115 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
116 blocks[i]['lines'][0].find(' ', 3) == -1:
116 blocks[i]['lines'][0].find(' ', 3) == -1:
117 # directive on its own line, not a literal block
117 # directive on its own line, not a literal block
118 i += 1
118 i += 1
119 continue
119 continue
120 else:
120 else:
121 # Fully minimized form: remove just one colon.
121 # Fully minimized form: remove just one colon.
122 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
122 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
123
123
124 # List items are formatted with a hanging indent. We must
124 # List items are formatted with a hanging indent. We must
125 # correct for this here while we still have the original
125 # correct for this here while we still have the original
126 # information on the indentation of the subsequent literal
126 # information on the indentation of the subsequent literal
127 # blocks available.
127 # blocks available.
128 m = _bulletre.match(blocks[i]['lines'][0])
128 m = _bulletre.match(blocks[i]['lines'][0])
129 if m:
129 if m:
130 indent += m.end()
130 indent += m.end()
131 adjustment -= m.end()
131 adjustment -= m.end()
132
132
133 # Mark the following indented blocks.
133 # Mark the following indented blocks.
134 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
134 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
135 blocks[i + 1]['type'] = 'literal'
135 blocks[i + 1]['type'] = 'literal'
136 blocks[i + 1]['indent'] -= adjustment
136 blocks[i + 1]['indent'] -= adjustment
137 i += 1
137 i += 1
138 i += 1
138 i += 1
139 return blocks
139 return blocks
140
140
141 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
141 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
142 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
142 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
143 r'((.*) +)(.*)$')
143 r'((.*) +)(.*)$')
144 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
144 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
145 _definitionre = re.compile(r'[^ ]')
145 _definitionre = re.compile(r'[^ ]')
146 _tablere = re.compile(r'(=+\s+)*=+')
146 _tablere = re.compile(r'(=+\s+)*=+')
147
147
148 def splitparagraphs(blocks):
148 def splitparagraphs(blocks):
149 """Split paragraphs into lists."""
149 """Split paragraphs into lists."""
150 # Tuples with (list type, item regexp, single line items?). Order
150 # Tuples with (list type, item regexp, single line items?). Order
151 # matters: definition lists has the least specific regexp and must
151 # matters: definition lists has the least specific regexp and must
152 # come last.
152 # come last.
153 listtypes = [('bullet', _bulletre, True),
153 listtypes = [('bullet', _bulletre, True),
154 ('option', _optionre, True),
154 ('option', _optionre, True),
155 ('field', _fieldre, True),
155 ('field', _fieldre, True),
156 ('definition', _definitionre, False)]
156 ('definition', _definitionre, False)]
157
157
158 def match(lines, i, itemre, singleline):
158 def match(lines, i, itemre, singleline):
159 """Does itemre match an item at line i?
159 """Does itemre match an item at line i?
160
160
161 A list item can be followed by an indented line or another list
161 A list item can be followed by an indented line or another list
162 item (but only if singleline is True).
162 item (but only if singleline is True).
163 """
163 """
164 line1 = lines[i]
164 line1 = lines[i]
165 line2 = i + 1 < len(lines) and lines[i + 1] or ''
165 line2 = i + 1 < len(lines) and lines[i + 1] or ''
166 if not itemre.match(line1):
166 if not itemre.match(line1):
167 return False
167 return False
168 if singleline:
168 if singleline:
169 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
169 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
170 else:
170 else:
171 return line2.startswith(' ')
171 return line2.startswith(' ')
172
172
173 i = 0
173 i = 0
174 while i < len(blocks):
174 while i < len(blocks):
175 if blocks[i]['type'] == 'paragraph':
175 if blocks[i]['type'] == 'paragraph':
176 lines = blocks[i]['lines']
176 lines = blocks[i]['lines']
177 for type, itemre, singleline in listtypes:
177 for type, itemre, singleline in listtypes:
178 if match(lines, 0, itemre, singleline):
178 if match(lines, 0, itemre, singleline):
179 items = []
179 items = []
180 for j, line in enumerate(lines):
180 for j, line in enumerate(lines):
181 if match(lines, j, itemre, singleline):
181 if match(lines, j, itemre, singleline):
182 items.append({'type': type, 'lines': [],
182 items.append({'type': type, 'lines': [],
183 'indent': blocks[i]['indent']})
183 'indent': blocks[i]['indent']})
184 items[-1]['lines'].append(line)
184 items[-1]['lines'].append(line)
185 blocks[i:i + 1] = items
185 blocks[i:i + 1] = items
186 break
186 break
187 i += 1
187 i += 1
188 return blocks
188 return blocks
189
189
190 _fieldwidth = 14
190 _fieldwidth = 14
191
191
192 def updatefieldlists(blocks):
192 def updatefieldlists(blocks):
193 """Find key for field lists."""
193 """Find key for field lists."""
194 i = 0
194 i = 0
195 while i < len(blocks):
195 while i < len(blocks):
196 if blocks[i]['type'] != 'field':
196 if blocks[i]['type'] != 'field':
197 i += 1
197 i += 1
198 continue
198 continue
199
199
200 j = i
200 j = i
201 while j < len(blocks) and blocks[j]['type'] == 'field':
201 while j < len(blocks) and blocks[j]['type'] == 'field':
202 m = _fieldre.match(blocks[j]['lines'][0])
202 m = _fieldre.match(blocks[j]['lines'][0])
203 key, rest = m.groups()
203 key, rest = m.groups()
204 blocks[j]['lines'][0] = rest
204 blocks[j]['lines'][0] = rest
205 blocks[j]['key'] = key
205 blocks[j]['key'] = key
206 j += 1
206 j += 1
207
207
208 i = j + 1
208 i = j + 1
209
209
210 return blocks
210 return blocks
211
211
212 def updateoptionlists(blocks):
212 def updateoptionlists(blocks):
213 i = 0
213 i = 0
214 while i < len(blocks):
214 while i < len(blocks):
215 if blocks[i]['type'] != 'option':
215 if blocks[i]['type'] != 'option':
216 i += 1
216 i += 1
217 continue
217 continue
218
218
219 optstrwidth = 0
219 optstrwidth = 0
220 j = i
220 j = i
221 while j < len(blocks) and blocks[j]['type'] == 'option':
221 while j < len(blocks) and blocks[j]['type'] == 'option':
222 m = _optionre.match(blocks[j]['lines'][0])
222 m = _optionre.match(blocks[j]['lines'][0])
223
223
224 shortoption = m.group(2)
224 shortoption = m.group(2)
225 group3 = m.group(3)
225 group3 = m.group(3)
226 longoption = group3[2:].strip()
226 longoption = group3[2:].strip()
227 desc = m.group(6).strip()
227 desc = m.group(6).strip()
228 longoptionarg = m.group(5).strip()
228 longoptionarg = m.group(5).strip()
229 blocks[j]['lines'][0] = desc
229 blocks[j]['lines'][0] = desc
230
230
231 noshortop = ''
231 noshortop = ''
232 if not shortoption:
232 if not shortoption:
233 noshortop = ' '
233 noshortop = ' '
234
234
235 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
235 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
236 ("%s--%s %s") % (noshortop, longoption,
236 ("%s--%s %s") % (noshortop, longoption,
237 longoptionarg))
237 longoptionarg))
238 opt = opt.rstrip()
238 opt = opt.rstrip()
239 blocks[j]['optstr'] = opt
239 blocks[j]['optstr'] = opt
240 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
240 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
241 j += 1
241 j += 1
242
242
243 for block in blocks[i:j]:
243 for block in blocks[i:j]:
244 block['optstrwidth'] = optstrwidth
244 block['optstrwidth'] = optstrwidth
245 i = j + 1
245 i = j + 1
246 return blocks
246 return blocks
247
247
248 def prunecontainers(blocks, keep):
248 def prunecontainers(blocks, keep):
249 """Prune unwanted containers.
249 """Prune unwanted containers.
250
250
251 The blocks must have a 'type' field, i.e., they should have been
251 The blocks must have a 'type' field, i.e., they should have been
252 run through findliteralblocks first.
252 run through findliteralblocks first.
253 """
253 """
254 pruned = []
254 pruned = []
255 i = 0
255 i = 0
256 while i + 1 < len(blocks):
256 while i + 1 < len(blocks):
257 # Searching for a block that looks like this:
257 # Searching for a block that looks like this:
258 #
258 #
259 # +-------+---------------------------+
259 # +-------+---------------------------+
260 # | ".. container ::" type |
260 # | ".. container ::" type |
261 # +---+ |
261 # +---+ |
262 # | blocks |
262 # | blocks |
263 # +-------------------------------+
263 # +-------------------------------+
264 if (blocks[i]['type'] == 'paragraph' and
264 if (blocks[i]['type'] == 'paragraph' and
265 blocks[i]['lines'][0].startswith('.. container::')):
265 blocks[i]['lines'][0].startswith('.. container::')):
266 indent = blocks[i]['indent']
266 indent = blocks[i]['indent']
267 adjustment = blocks[i + 1]['indent'] - indent
267 adjustment = blocks[i + 1]['indent'] - indent
268 containertype = blocks[i]['lines'][0][15:]
268 containertype = blocks[i]['lines'][0][15:]
269 prune = True
269 prune = True
270 for c in keep:
270 for c in keep:
271 if c in containertype.split('.'):
271 if c in containertype.split('.'):
272 prune = False
272 prune = False
273 if prune:
273 if prune:
274 pruned.append(containertype)
274 pruned.append(containertype)
275
275
276 # Always delete "..container:: type" block
276 # Always delete "..container:: type" block
277 del blocks[i]
277 del blocks[i]
278 j = i
278 j = i
279 i -= 1
279 i -= 1
280 while j < len(blocks) and blocks[j]['indent'] > indent:
280 while j < len(blocks) and blocks[j]['indent'] > indent:
281 if prune:
281 if prune:
282 del blocks[j]
282 del blocks[j]
283 else:
283 else:
284 blocks[j]['indent'] -= adjustment
284 blocks[j]['indent'] -= adjustment
285 j += 1
285 j += 1
286 i += 1
286 i += 1
287 return blocks, pruned
287 return blocks, pruned
288
288
289 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
289 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
290
290
291 def findtables(blocks):
291 def findtables(blocks):
292 '''Find simple tables
292 '''Find simple tables
293
293
294 Only simple one-line table elements are supported
294 Only simple one-line table elements are supported
295 '''
295 '''
296
296
297 for block in blocks:
297 for block in blocks:
298 # Searching for a block that looks like this:
298 # Searching for a block that looks like this:
299 #
299 #
300 # === ==== ===
300 # === ==== ===
301 # A B C
301 # A B C
302 # === ==== === <- optional
302 # === ==== === <- optional
303 # 1 2 3
303 # 1 2 3
304 # x y z
304 # x y z
305 # === ==== ===
305 # === ==== ===
306 if (block['type'] == 'paragraph' and
306 if (block['type'] == 'paragraph' and
307 len(block['lines']) > 2 and
307 len(block['lines']) > 2 and
308 _tablere.match(block['lines'][0]) and
308 _tablere.match(block['lines'][0]) and
309 block['lines'][0] == block['lines'][-1]):
309 block['lines'][0] == block['lines'][-1]):
310 block['type'] = 'table'
310 block['type'] = 'table'
311 block['header'] = False
311 block['header'] = False
312 div = block['lines'][0]
312 div = block['lines'][0]
313
313
314 # column markers are ASCII so we can calculate column
314 # column markers are ASCII so we can calculate column
315 # position in bytes
315 # position in bytes
316 columns = [x for x in xrange(len(div))
316 columns = [x for x in xrange(len(div))
317 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
317 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
318 rows = []
318 rows = []
319 for l in block['lines'][1:-1]:
319 for l in block['lines'][1:-1]:
320 if l == div:
320 if l == div:
321 block['header'] = True
321 block['header'] = True
322 continue
322 continue
323 row = []
323 row = []
324 # we measure columns not in bytes or characters but in
324 # we measure columns not in bytes or characters but in
325 # colwidth which makes things tricky
325 # colwidth which makes things tricky
326 pos = columns[0] # leading whitespace is bytes
326 pos = columns[0] # leading whitespace is bytes
327 for n, start in enumerate(columns):
327 for n, start in enumerate(columns):
328 if n + 1 < len(columns):
328 if n + 1 < len(columns):
329 width = columns[n + 1] - start
329 width = columns[n + 1] - start
330 v = encoding.getcols(l, pos, width) # gather columns
330 v = encoding.getcols(l, pos, width) # gather columns
331 pos += len(v) # calculate byte position of end
331 pos += len(v) # calculate byte position of end
332 row.append(v.strip())
332 row.append(v.strip())
333 else:
333 else:
334 row.append(l[pos:].strip())
334 row.append(l[pos:].strip())
335 rows.append(row)
335 rows.append(row)
336
336
337 block['table'] = rows
337 block['table'] = rows
338
338
339 return blocks
339 return blocks
340
340
341 def findsections(blocks):
341 def findsections(blocks):
342 """Finds sections.
342 """Finds sections.
343
343
344 The blocks must have a 'type' field, i.e., they should have been
344 The blocks must have a 'type' field, i.e., they should have been
345 run through findliteralblocks first.
345 run through findliteralblocks first.
346 """
346 """
347 for block in blocks:
347 for block in blocks:
348 # Searching for a block that looks like this:
348 # Searching for a block that looks like this:
349 #
349 #
350 # +------------------------------+
350 # +------------------------------+
351 # | Section title |
351 # | Section title |
352 # | ------------- |
352 # | ------------- |
353 # +------------------------------+
353 # +------------------------------+
354 if (block['type'] == 'paragraph' and
354 if (block['type'] == 'paragraph' and
355 len(block['lines']) == 2 and
355 len(block['lines']) == 2 and
356 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
356 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
357 _sectionre.match(block['lines'][1])):
357 _sectionre.match(block['lines'][1])):
358 block['underline'] = block['lines'][1][0]
358 block['underline'] = block['lines'][1][0]
359 block['type'] = 'section'
359 block['type'] = 'section'
360 del block['lines'][1]
360 del block['lines'][1]
361 return blocks
361 return blocks
362
362
363 def inlineliterals(blocks):
363 def inlineliterals(blocks):
364 substs = [('``', '"')]
364 substs = [('``', '"')]
365 for b in blocks:
365 for b in blocks:
366 if b['type'] in ('paragraph', 'section'):
366 if b['type'] in ('paragraph', 'section'):
367 b['lines'] = [replace(l, substs) for l in b['lines']]
367 b['lines'] = [replace(l, substs) for l in b['lines']]
368 return blocks
368 return blocks
369
369
370 def hgrole(blocks):
370 def hgrole(blocks):
371 substs = [(':hg:`', '"hg '), ('`', '"')]
371 substs = [(':hg:`', "'hg "), ('`', "'")]
372 for b in blocks:
372 for b in blocks:
373 if b['type'] in ('paragraph', 'section'):
373 if b['type'] in ('paragraph', 'section'):
374 # Turn :hg:`command` into "hg command". This also works
374 # Turn :hg:`command` into "hg command". This also works
375 # when there is a line break in the command and relies on
375 # when there is a line break in the command and relies on
376 # the fact that we have no stray back-quotes in the input
376 # the fact that we have no stray back-quotes in the input
377 # (run the blocks through inlineliterals first).
377 # (run the blocks through inlineliterals first).
378 b['lines'] = [replace(l, substs) for l in b['lines']]
378 b['lines'] = [replace(l, substs) for l in b['lines']]
379 return blocks
379 return blocks
380
380
381 def addmargins(blocks):
381 def addmargins(blocks):
382 """Adds empty blocks for vertical spacing.
382 """Adds empty blocks for vertical spacing.
383
383
384 This groups bullets, options, and definitions together with no vertical
384 This groups bullets, options, and definitions together with no vertical
385 space between them, and adds an empty block between all other blocks.
385 space between them, and adds an empty block between all other blocks.
386 """
386 """
387 i = 1
387 i = 1
388 while i < len(blocks):
388 while i < len(blocks):
389 if (blocks[i]['type'] == blocks[i - 1]['type'] and
389 if (blocks[i]['type'] == blocks[i - 1]['type'] and
390 blocks[i]['type'] in ('bullet', 'option', 'field')):
390 blocks[i]['type'] in ('bullet', 'option', 'field')):
391 i += 1
391 i += 1
392 elif not blocks[i - 1]['lines']:
392 elif not blocks[i - 1]['lines']:
393 # no lines in previous block, do not separate
393 # no lines in previous block, do not separate
394 i += 1
394 i += 1
395 else:
395 else:
396 blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'})
396 blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'})
397 i += 2
397 i += 2
398 return blocks
398 return blocks
399
399
400 def prunecomments(blocks):
400 def prunecomments(blocks):
401 """Remove comments."""
401 """Remove comments."""
402 i = 0
402 i = 0
403 while i < len(blocks):
403 while i < len(blocks):
404 b = blocks[i]
404 b = blocks[i]
405 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
405 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
406 b['lines'] == ['..']):
406 b['lines'] == ['..']):
407 del blocks[i]
407 del blocks[i]
408 if i < len(blocks) and blocks[i]['type'] == 'margin':
408 if i < len(blocks) and blocks[i]['type'] == 'margin':
409 del blocks[i]
409 del blocks[i]
410 else:
410 else:
411 i += 1
411 i += 1
412 return blocks
412 return blocks
413
413
414 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
414 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
415 r"error|hint|important|note|tip|warning)::",
415 r"error|hint|important|note|tip|warning)::",
416 flags=re.IGNORECASE)
416 flags=re.IGNORECASE)
417
417
418 def findadmonitions(blocks):
418 def findadmonitions(blocks):
419 """
419 """
420 Makes the type of the block an admonition block if
420 Makes the type of the block an admonition block if
421 the first line is an admonition directive
421 the first line is an admonition directive
422 """
422 """
423 i = 0
423 i = 0
424 while i < len(blocks):
424 while i < len(blocks):
425 m = _admonitionre.match(blocks[i]['lines'][0])
425 m = _admonitionre.match(blocks[i]['lines'][0])
426 if m:
426 if m:
427 blocks[i]['type'] = 'admonition'
427 blocks[i]['type'] = 'admonition'
428 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
428 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
429
429
430 firstline = blocks[i]['lines'][0][m.end() + 1:]
430 firstline = blocks[i]['lines'][0][m.end() + 1:]
431 if firstline:
431 if firstline:
432 blocks[i]['lines'].insert(1, ' ' + firstline)
432 blocks[i]['lines'].insert(1, ' ' + firstline)
433
433
434 blocks[i]['admonitiontitle'] = admonitiontitle
434 blocks[i]['admonitiontitle'] = admonitiontitle
435 del blocks[i]['lines'][0]
435 del blocks[i]['lines'][0]
436 i = i + 1
436 i = i + 1
437 return blocks
437 return blocks
438
438
439 _admonitiontitles = {'attention': _('Attention:'),
439 _admonitiontitles = {'attention': _('Attention:'),
440 'caution': _('Caution:'),
440 'caution': _('Caution:'),
441 'danger': _('!Danger!') ,
441 'danger': _('!Danger!') ,
442 'error': _('Error:'),
442 'error': _('Error:'),
443 'hint': _('Hint:'),
443 'hint': _('Hint:'),
444 'important': _('Important:'),
444 'important': _('Important:'),
445 'note': _('Note:'),
445 'note': _('Note:'),
446 'tip': _('Tip:'),
446 'tip': _('Tip:'),
447 'warning': _('Warning!')}
447 'warning': _('Warning!')}
448
448
449 def formatoption(block, width):
449 def formatoption(block, width):
450 desc = ' '.join(map(str.strip, block['lines']))
450 desc = ' '.join(map(str.strip, block['lines']))
451 colwidth = encoding.colwidth(block['optstr'])
451 colwidth = encoding.colwidth(block['optstr'])
452 usablewidth = width - 1
452 usablewidth = width - 1
453 hanging = block['optstrwidth']
453 hanging = block['optstrwidth']
454 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
454 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
455 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
455 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
456 return ' %s\n' % (util.wrap(desc, usablewidth,
456 return ' %s\n' % (util.wrap(desc, usablewidth,
457 initindent=initindent,
457 initindent=initindent,
458 hangindent=hangindent))
458 hangindent=hangindent))
459
459
460 def formatblock(block, width):
460 def formatblock(block, width):
461 """Format a block according to width."""
461 """Format a block according to width."""
462 if width <= 0:
462 if width <= 0:
463 width = 78
463 width = 78
464 indent = ' ' * block['indent']
464 indent = ' ' * block['indent']
465 if block['type'] == 'admonition':
465 if block['type'] == 'admonition':
466 admonition = _admonitiontitles[block['admonitiontitle']]
466 admonition = _admonitiontitles[block['admonitiontitle']]
467 if not block['lines']:
467 if not block['lines']:
468 return indent + admonition + '\n'
468 return indent + admonition + '\n'
469 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
469 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
470
470
471 defindent = indent + hang * ' '
471 defindent = indent + hang * ' '
472 text = ' '.join(map(str.strip, block['lines']))
472 text = ' '.join(map(str.strip, block['lines']))
473 return '%s\n%s\n' % (indent + admonition,
473 return '%s\n%s\n' % (indent + admonition,
474 util.wrap(text, width=width,
474 util.wrap(text, width=width,
475 initindent=defindent,
475 initindent=defindent,
476 hangindent=defindent))
476 hangindent=defindent))
477 if block['type'] == 'margin':
477 if block['type'] == 'margin':
478 return '\n'
478 return '\n'
479 if block['type'] == 'literal':
479 if block['type'] == 'literal':
480 indent += ' '
480 indent += ' '
481 return indent + ('\n' + indent).join(block['lines']) + '\n'
481 return indent + ('\n' + indent).join(block['lines']) + '\n'
482 if block['type'] == 'section':
482 if block['type'] == 'section':
483 underline = encoding.colwidth(block['lines'][0]) * block['underline']
483 underline = encoding.colwidth(block['lines'][0]) * block['underline']
484 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
484 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
485 if block['type'] == 'table':
485 if block['type'] == 'table':
486 table = block['table']
486 table = block['table']
487 # compute column widths
487 # compute column widths
488 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
488 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
489 text = ''
489 text = ''
490 span = sum(widths) + len(widths) - 1
490 span = sum(widths) + len(widths) - 1
491 indent = ' ' * block['indent']
491 indent = ' ' * block['indent']
492 hang = ' ' * (len(indent) + span - widths[-1])
492 hang = ' ' * (len(indent) + span - widths[-1])
493
493
494 for row in table:
494 for row in table:
495 l = []
495 l = []
496 for w, v in zip(widths, row):
496 for w, v in zip(widths, row):
497 pad = ' ' * (w - encoding.colwidth(v))
497 pad = ' ' * (w - encoding.colwidth(v))
498 l.append(v + pad)
498 l.append(v + pad)
499 l = ' '.join(l)
499 l = ' '.join(l)
500 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
500 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
501 if not text and block['header']:
501 if not text and block['header']:
502 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
502 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
503 else:
503 else:
504 text += l + "\n"
504 text += l + "\n"
505 return text
505 return text
506 if block['type'] == 'definition':
506 if block['type'] == 'definition':
507 term = indent + block['lines'][0]
507 term = indent + block['lines'][0]
508 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
508 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
509 defindent = indent + hang * ' '
509 defindent = indent + hang * ' '
510 text = ' '.join(map(str.strip, block['lines'][1:]))
510 text = ' '.join(map(str.strip, block['lines'][1:]))
511 return '%s\n%s\n' % (term, util.wrap(text, width=width,
511 return '%s\n%s\n' % (term, util.wrap(text, width=width,
512 initindent=defindent,
512 initindent=defindent,
513 hangindent=defindent))
513 hangindent=defindent))
514 subindent = indent
514 subindent = indent
515 if block['type'] == 'bullet':
515 if block['type'] == 'bullet':
516 if block['lines'][0].startswith('| '):
516 if block['lines'][0].startswith('| '):
517 # Remove bullet for line blocks and add no extra
517 # Remove bullet for line blocks and add no extra
518 # indentation.
518 # indentation.
519 block['lines'][0] = block['lines'][0][2:]
519 block['lines'][0] = block['lines'][0][2:]
520 else:
520 else:
521 m = _bulletre.match(block['lines'][0])
521 m = _bulletre.match(block['lines'][0])
522 subindent = indent + m.end() * ' '
522 subindent = indent + m.end() * ' '
523 elif block['type'] == 'field':
523 elif block['type'] == 'field':
524 key = block['key']
524 key = block['key']
525 subindent = indent + _fieldwidth * ' '
525 subindent = indent + _fieldwidth * ' '
526 if len(key) + 2 > _fieldwidth:
526 if len(key) + 2 > _fieldwidth:
527 # key too large, use full line width
527 # key too large, use full line width
528 key = key.ljust(width)
528 key = key.ljust(width)
529 else:
529 else:
530 # key fits within field width
530 # key fits within field width
531 key = key.ljust(_fieldwidth)
531 key = key.ljust(_fieldwidth)
532 block['lines'][0] = key + block['lines'][0]
532 block['lines'][0] = key + block['lines'][0]
533 elif block['type'] == 'option':
533 elif block['type'] == 'option':
534 return formatoption(block, width)
534 return formatoption(block, width)
535
535
536 text = ' '.join(map(str.strip, block['lines']))
536 text = ' '.join(map(str.strip, block['lines']))
537 return util.wrap(text, width=width,
537 return util.wrap(text, width=width,
538 initindent=indent,
538 initindent=indent,
539 hangindent=subindent) + '\n'
539 hangindent=subindent) + '\n'
540
540
541 def formathtml(blocks):
541 def formathtml(blocks):
542 """Format RST blocks as HTML"""
542 """Format RST blocks as HTML"""
543
543
544 out = []
544 out = []
545 headernest = ''
545 headernest = ''
546 listnest = []
546 listnest = []
547
547
548 def escape(s):
548 def escape(s):
549 return cgi.escape(s, True)
549 return cgi.escape(s, True)
550
550
551 def openlist(start, level):
551 def openlist(start, level):
552 if not listnest or listnest[-1][0] != start:
552 if not listnest or listnest[-1][0] != start:
553 listnest.append((start, level))
553 listnest.append((start, level))
554 out.append('<%s>\n' % start)
554 out.append('<%s>\n' % start)
555
555
556 blocks = [b for b in blocks if b['type'] != 'margin']
556 blocks = [b for b in blocks if b['type'] != 'margin']
557
557
558 for pos, b in enumerate(blocks):
558 for pos, b in enumerate(blocks):
559 btype = b['type']
559 btype = b['type']
560 level = b['indent']
560 level = b['indent']
561 lines = b['lines']
561 lines = b['lines']
562
562
563 if btype == 'admonition':
563 if btype == 'admonition':
564 admonition = escape(_admonitiontitles[b['admonitiontitle']])
564 admonition = escape(_admonitiontitles[b['admonitiontitle']])
565 text = escape(' '.join(map(str.strip, lines)))
565 text = escape(' '.join(map(str.strip, lines)))
566 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
566 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
567 elif btype == 'paragraph':
567 elif btype == 'paragraph':
568 out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
568 out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
569 elif btype == 'margin':
569 elif btype == 'margin':
570 pass
570 pass
571 elif btype == 'literal':
571 elif btype == 'literal':
572 out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines)))
572 out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines)))
573 elif btype == 'section':
573 elif btype == 'section':
574 i = b['underline']
574 i = b['underline']
575 if i not in headernest:
575 if i not in headernest:
576 headernest += i
576 headernest += i
577 level = headernest.index(i) + 1
577 level = headernest.index(i) + 1
578 out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level))
578 out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level))
579 elif btype == 'table':
579 elif btype == 'table':
580 table = b['table']
580 table = b['table']
581 out.append('<table>\n')
581 out.append('<table>\n')
582 for row in table:
582 for row in table:
583 out.append('<tr>')
583 out.append('<tr>')
584 for v in row:
584 for v in row:
585 out.append('<td>')
585 out.append('<td>')
586 out.append(escape(v))
586 out.append(escape(v))
587 out.append('</td>')
587 out.append('</td>')
588 out.append('\n')
588 out.append('\n')
589 out.pop()
589 out.pop()
590 out.append('</tr>\n')
590 out.append('</tr>\n')
591 out.append('</table>\n')
591 out.append('</table>\n')
592 elif btype == 'definition':
592 elif btype == 'definition':
593 openlist('dl', level)
593 openlist('dl', level)
594 term = escape(lines[0])
594 term = escape(lines[0])
595 text = escape(' '.join(map(str.strip, lines[1:])))
595 text = escape(' '.join(map(str.strip, lines[1:])))
596 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
596 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
597 elif btype == 'bullet':
597 elif btype == 'bullet':
598 bullet, head = lines[0].split(' ', 1)
598 bullet, head = lines[0].split(' ', 1)
599 if bullet == '-':
599 if bullet == '-':
600 openlist('ul', level)
600 openlist('ul', level)
601 else:
601 else:
602 openlist('ol', level)
602 openlist('ol', level)
603 out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:])))
603 out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:])))
604 elif btype == 'field':
604 elif btype == 'field':
605 openlist('dl', level)
605 openlist('dl', level)
606 key = escape(b['key'])
606 key = escape(b['key'])
607 text = escape(' '.join(map(str.strip, lines)))
607 text = escape(' '.join(map(str.strip, lines)))
608 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
608 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
609 elif btype == 'option':
609 elif btype == 'option':
610 openlist('dl', level)
610 openlist('dl', level)
611 opt = escape(b['optstr'])
611 opt = escape(b['optstr'])
612 desc = escape(' '.join(map(str.strip, lines)))
612 desc = escape(' '.join(map(str.strip, lines)))
613 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
613 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
614
614
615 # close lists if indent level of next block is lower
615 # close lists if indent level of next block is lower
616 if listnest:
616 if listnest:
617 start, level = listnest[-1]
617 start, level = listnest[-1]
618 if pos == len(blocks) - 1:
618 if pos == len(blocks) - 1:
619 out.append('</%s>\n' % start)
619 out.append('</%s>\n' % start)
620 listnest.pop()
620 listnest.pop()
621 else:
621 else:
622 nb = blocks[pos + 1]
622 nb = blocks[pos + 1]
623 ni = nb['indent']
623 ni = nb['indent']
624 if (ni < level or
624 if (ni < level or
625 (ni == level and
625 (ni == level and
626 nb['type'] not in 'definition bullet field option')):
626 nb['type'] not in 'definition bullet field option')):
627 out.append('</%s>\n' % start)
627 out.append('</%s>\n' % start)
628 listnest.pop()
628 listnest.pop()
629
629
630 return ''.join(out)
630 return ''.join(out)
631
631
632 def parse(text, indent=0, keep=None):
632 def parse(text, indent=0, keep=None):
633 """Parse text into a list of blocks"""
633 """Parse text into a list of blocks"""
634 pruned = []
634 pruned = []
635 blocks = findblocks(text)
635 blocks = findblocks(text)
636 for b in blocks:
636 for b in blocks:
637 b['indent'] += indent
637 b['indent'] += indent
638 blocks = findliteralblocks(blocks)
638 blocks = findliteralblocks(blocks)
639 blocks = findtables(blocks)
639 blocks = findtables(blocks)
640 blocks, pruned = prunecontainers(blocks, keep or [])
640 blocks, pruned = prunecontainers(blocks, keep or [])
641 blocks = findsections(blocks)
641 blocks = findsections(blocks)
642 blocks = inlineliterals(blocks)
642 blocks = inlineliterals(blocks)
643 blocks = hgrole(blocks)
643 blocks = hgrole(blocks)
644 blocks = splitparagraphs(blocks)
644 blocks = splitparagraphs(blocks)
645 blocks = updatefieldlists(blocks)
645 blocks = updatefieldlists(blocks)
646 blocks = updateoptionlists(blocks)
646 blocks = updateoptionlists(blocks)
647 blocks = findadmonitions(blocks)
647 blocks = findadmonitions(blocks)
648 blocks = addmargins(blocks)
648 blocks = addmargins(blocks)
649 blocks = prunecomments(blocks)
649 blocks = prunecomments(blocks)
650 return blocks, pruned
650 return blocks, pruned
651
651
652 def formatblocks(blocks, width):
652 def formatblocks(blocks, width):
653 text = ''.join(formatblock(b, width) for b in blocks)
653 text = ''.join(formatblock(b, width) for b in blocks)
654 return text
654 return text
655
655
656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
657 """Parse and format the text according to width."""
657 """Parse and format the text according to width."""
658 blocks, pruned = parse(text, indent, keep or [])
658 blocks, pruned = parse(text, indent, keep or [])
659 parents = []
659 parents = []
660 if section:
660 if section:
661 sections = getsections(blocks)
661 sections = getsections(blocks)
662 blocks = []
662 blocks = []
663 i = 0
663 i = 0
664 lastparents = []
664 lastparents = []
665 synthetic = []
665 synthetic = []
666 collapse = True
666 collapse = True
667 while i < len(sections):
667 while i < len(sections):
668 name, nest, b = sections[i]
668 name, nest, b = sections[i]
669 del parents[nest:]
669 del parents[nest:]
670 parents.append(i)
670 parents.append(i)
671 if name == section:
671 if name == section:
672 if lastparents != parents:
672 if lastparents != parents:
673 llen = len(lastparents)
673 llen = len(lastparents)
674 plen = len(parents)
674 plen = len(parents)
675 if llen and llen != plen:
675 if llen and llen != plen:
676 collapse = False
676 collapse = False
677 s = []
677 s = []
678 for j in xrange(3, plen - 1):
678 for j in xrange(3, plen - 1):
679 parent = parents[j]
679 parent = parents[j]
680 if (j >= llen or
680 if (j >= llen or
681 lastparents[j] != parent):
681 lastparents[j] != parent):
682 s.append(len(blocks))
682 s.append(len(blocks))
683 sec = sections[parent][2]
683 sec = sections[parent][2]
684 blocks.append(sec[0])
684 blocks.append(sec[0])
685 blocks.append(sec[-1])
685 blocks.append(sec[-1])
686 if s:
686 if s:
687 synthetic.append(s)
687 synthetic.append(s)
688
688
689 lastparents = parents[:]
689 lastparents = parents[:]
690 blocks.extend(b)
690 blocks.extend(b)
691
691
692 ## Also show all subnested sections
692 ## Also show all subnested sections
693 while i + 1 < len(sections) and sections[i + 1][1] > nest:
693 while i + 1 < len(sections) and sections[i + 1][1] > nest:
694 i += 1
694 i += 1
695 blocks.extend(sections[i][2])
695 blocks.extend(sections[i][2])
696 i += 1
696 i += 1
697 if collapse:
697 if collapse:
698 synthetic.reverse()
698 synthetic.reverse()
699 for s in synthetic:
699 for s in synthetic:
700 path = [blocks[i]['lines'][0] for i in s]
700 path = [blocks[i]['lines'][0] for i in s]
701 real = s[-1] + 2
701 real = s[-1] + 2
702 realline = blocks[real]['lines']
702 realline = blocks[real]['lines']
703 realline[0] = ('"%s"' %
703 realline[0] = ('"%s"' %
704 '.'.join(path + [realline[0]]).replace('"', ''))
704 '.'.join(path + [realline[0]]).replace('"', ''))
705 del blocks[s[0]:real]
705 del blocks[s[0]:real]
706
706
707 if style == 'html':
707 if style == 'html':
708 text = formathtml(blocks)
708 text = formathtml(blocks)
709 else:
709 else:
710 text = ''.join(formatblock(b, width) for b in blocks)
710 text = ''.join(formatblock(b, width) for b in blocks)
711 if keep is None:
711 if keep is None:
712 return text
712 return text
713 else:
713 else:
714 return text, pruned
714 return text, pruned
715
715
716 def getsections(blocks):
716 def getsections(blocks):
717 '''return a list of (section name, nesting level, blocks) tuples'''
717 '''return a list of (section name, nesting level, blocks) tuples'''
718 nest = ""
718 nest = ""
719 level = 0
719 level = 0
720 secs = []
720 secs = []
721
721
722 def getname(b):
722 def getname(b):
723 if b['type'] == 'field':
723 if b['type'] == 'field':
724 x = b['key']
724 x = b['key']
725 else:
725 else:
726 x = b['lines'][0]
726 x = b['lines'][0]
727 x = x.lower().strip('"')
727 x = x.lower().strip('"')
728 if '(' in x:
728 if '(' in x:
729 x = x.split('(')[0]
729 x = x.split('(')[0]
730 return x
730 return x
731
731
732 for b in blocks:
732 for b in blocks:
733 if b['type'] == 'section':
733 if b['type'] == 'section':
734 i = b['underline']
734 i = b['underline']
735 if i not in nest:
735 if i not in nest:
736 nest += i
736 nest += i
737 level = nest.index(i) + 1
737 level = nest.index(i) + 1
738 nest = nest[:level]
738 nest = nest[:level]
739 secs.append((getname(b), level, [b]))
739 secs.append((getname(b), level, [b]))
740 elif b['type'] in ('definition', 'field'):
740 elif b['type'] in ('definition', 'field'):
741 i = ' '
741 i = ' '
742 if i not in nest:
742 if i not in nest:
743 nest += i
743 nest += i
744 level = nest.index(i) + 1
744 level = nest.index(i) + 1
745 nest = nest[:level]
745 nest = nest[:level]
746 for i in range(1, len(secs) + 1):
746 for i in range(1, len(secs) + 1):
747 sec = secs[-i]
747 sec = secs[-i]
748 if sec[1] < level:
748 if sec[1] < level:
749 break
749 break
750 siblings = [a for a in sec[2] if a['type'] == 'definition']
750 siblings = [a for a in sec[2] if a['type'] == 'definition']
751 if siblings:
751 if siblings:
752 siblingindent = siblings[-1]['indent']
752 siblingindent = siblings[-1]['indent']
753 indent = b['indent']
753 indent = b['indent']
754 if siblingindent < indent:
754 if siblingindent < indent:
755 level += 1
755 level += 1
756 break
756 break
757 elif siblingindent == indent:
757 elif siblingindent == indent:
758 level = sec[1]
758 level = sec[1]
759 break
759 break
760 secs.append((getname(b), level, [b]))
760 secs.append((getname(b), level, [b]))
761 else:
761 else:
762 if not secs:
762 if not secs:
763 # add an initial empty section
763 # add an initial empty section
764 secs = [('', 0, [])]
764 secs = [('', 0, [])]
765 if b['type'] != 'margin':
765 if b['type'] != 'margin':
766 pointer = 1
766 pointer = 1
767 bindent = b['indent']
767 bindent = b['indent']
768 while pointer < len(secs):
768 while pointer < len(secs):
769 section = secs[-pointer][2][0]
769 section = secs[-pointer][2][0]
770 if section['type'] != 'margin':
770 if section['type'] != 'margin':
771 sindent = section['indent']
771 sindent = section['indent']
772 if len(section['lines']) > 1:
772 if len(section['lines']) > 1:
773 sindent += len(section['lines'][1]) - \
773 sindent += len(section['lines'][1]) - \
774 len(section['lines'][1].lstrip(' '))
774 len(section['lines'][1].lstrip(' '))
775 if bindent >= sindent:
775 if bindent >= sindent:
776 break
776 break
777 pointer += 1
777 pointer += 1
778 if pointer > 1:
778 if pointer > 1:
779 blevel = secs[-pointer][1]
779 blevel = secs[-pointer][1]
780 if section['type'] != b['type']:
780 if section['type'] != b['type']:
781 blevel += 1
781 blevel += 1
782 secs.append(('', blevel, []))
782 secs.append(('', blevel, []))
783 secs[-1][2].append(b)
783 secs[-1][2].append(b)
784 return secs
784 return secs
785
785
786 def decorateblocks(blocks, width):
786 def decorateblocks(blocks, width):
787 '''generate a list of (section name, line text) pairs for search'''
787 '''generate a list of (section name, line text) pairs for search'''
788 lines = []
788 lines = []
789 for s in getsections(blocks):
789 for s in getsections(blocks):
790 section = s[0]
790 section = s[0]
791 text = formatblocks(s[2], width)
791 text = formatblocks(s[2], width)
792 lines.append([(section, l) for l in text.splitlines(True)])
792 lines.append([(section, l) for l in text.splitlines(True)])
793 return lines
793 return lines
794
794
795 def maketable(data, indent=0, header=False):
795 def maketable(data, indent=0, header=False):
796 '''Generate an RST table for the given table data as a list of lines'''
796 '''Generate an RST table for the given table data as a list of lines'''
797
797
798 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
798 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
799 indent = ' ' * indent
799 indent = ' ' * indent
800 div = indent + ' '.join('=' * w for w in widths) + '\n'
800 div = indent + ' '.join('=' * w for w in widths) + '\n'
801
801
802 out = [div]
802 out = [div]
803 for row in data:
803 for row in data:
804 l = []
804 l = []
805 for w, v in zip(widths, row):
805 for w, v in zip(widths, row):
806 if '\n' in v:
806 if '\n' in v:
807 # only remove line breaks and indentation, long lines are
807 # only remove line breaks and indentation, long lines are
808 # handled by the next tool
808 # handled by the next tool
809 v = ' '.join(e.lstrip() for e in v.split('\n'))
809 v = ' '.join(e.lstrip() for e in v.split('\n'))
810 pad = ' ' * (w - encoding.colwidth(v))
810 pad = ' ' * (w - encoding.colwidth(v))
811 l.append(v + pad)
811 l.append(v + pad)
812 out.append(indent + ' '.join(l) + "\n")
812 out.append(indent + ' '.join(l) + "\n")
813 if header and len(data) > 1:
813 if header and len(data) > 1:
814 out.insert(2, div)
814 out.insert(2, div)
815 out.append(div)
815 out.append(div)
816 return out
816 return out
@@ -1,535 +1,535 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > convert=
3 > convert=
4 > [convert]
4 > [convert]
5 > hg.saverev=False
5 > hg.saverev=False
6 > EOF
6 > EOF
7 $ hg help convert
7 $ hg help convert
8 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
8 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
9
9
10 convert a foreign SCM repository to a Mercurial one.
10 convert a foreign SCM repository to a Mercurial one.
11
11
12 Accepted source formats [identifiers]:
12 Accepted source formats [identifiers]:
13
13
14 - Mercurial [hg]
14 - Mercurial [hg]
15 - CVS [cvs]
15 - CVS [cvs]
16 - Darcs [darcs]
16 - Darcs [darcs]
17 - git [git]
17 - git [git]
18 - Subversion [svn]
18 - Subversion [svn]
19 - Monotone [mtn]
19 - Monotone [mtn]
20 - GNU Arch [gnuarch]
20 - GNU Arch [gnuarch]
21 - Bazaar [bzr]
21 - Bazaar [bzr]
22 - Perforce [p4]
22 - Perforce [p4]
23
23
24 Accepted destination formats [identifiers]:
24 Accepted destination formats [identifiers]:
25
25
26 - Mercurial [hg]
26 - Mercurial [hg]
27 - Subversion [svn] (history on branches is not preserved)
27 - Subversion [svn] (history on branches is not preserved)
28
28
29 If no revision is given, all revisions will be converted. Otherwise,
29 If no revision is given, all revisions will be converted. Otherwise,
30 convert will only import up to the named revision (given in a format
30 convert will only import up to the named revision (given in a format
31 understood by the source).
31 understood by the source).
32
32
33 If no destination directory name is specified, it defaults to the basename
33 If no destination directory name is specified, it defaults to the basename
34 of the source with "-hg" appended. If the destination repository doesn't
34 of the source with "-hg" appended. If the destination repository doesn't
35 exist, it will be created.
35 exist, it will be created.
36
36
37 By default, all sources except Mercurial will use --branchsort. Mercurial
37 By default, all sources except Mercurial will use --branchsort. Mercurial
38 uses --sourcesort to preserve original revision numbers order. Sort modes
38 uses --sourcesort to preserve original revision numbers order. Sort modes
39 have the following effects:
39 have the following effects:
40
40
41 --branchsort convert from parent to child revision when possible, which
41 --branchsort convert from parent to child revision when possible, which
42 means branches are usually converted one after the other.
42 means branches are usually converted one after the other.
43 It generates more compact repositories.
43 It generates more compact repositories.
44 --datesort sort revisions by date. Converted repositories have good-
44 --datesort sort revisions by date. Converted repositories have good-
45 looking changelogs but are often an order of magnitude
45 looking changelogs but are often an order of magnitude
46 larger than the same ones generated by --branchsort.
46 larger than the same ones generated by --branchsort.
47 --sourcesort try to preserve source revisions order, only supported by
47 --sourcesort try to preserve source revisions order, only supported by
48 Mercurial sources.
48 Mercurial sources.
49 --closesort try to move closed revisions as close as possible to parent
49 --closesort try to move closed revisions as close as possible to parent
50 branches, only supported by Mercurial sources.
50 branches, only supported by Mercurial sources.
51
51
52 If "REVMAP" isn't given, it will be put in a default location
52 If "REVMAP" isn't given, it will be put in a default location
53 ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that
53 ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that
54 maps each source commit ID to the destination ID for that revision, like
54 maps each source commit ID to the destination ID for that revision, like
55 so:
55 so:
56
56
57 <source ID> <destination ID>
57 <source ID> <destination ID>
58
58
59 If the file doesn't exist, it's automatically created. It's updated on
59 If the file doesn't exist, it's automatically created. It's updated on
60 each commit copied, so "hg convert" can be interrupted and can be run
60 each commit copied, so 'hg convert' can be interrupted and can be run
61 repeatedly to copy new commits.
61 repeatedly to copy new commits.
62
62
63 The authormap is a simple text file that maps each source commit author to
63 The authormap is a simple text file that maps each source commit author to
64 a destination commit author. It is handy for source SCMs that use unix
64 a destination commit author. It is handy for source SCMs that use unix
65 logins to identify authors (e.g.: CVS). One line per author mapping and
65 logins to identify authors (e.g.: CVS). One line per author mapping and
66 the line format is:
66 the line format is:
67
67
68 source author = destination author
68 source author = destination author
69
69
70 Empty lines and lines starting with a "#" are ignored.
70 Empty lines and lines starting with a "#" are ignored.
71
71
72 The filemap is a file that allows filtering and remapping of files and
72 The filemap is a file that allows filtering and remapping of files and
73 directories. Each line can contain one of the following directives:
73 directories. Each line can contain one of the following directives:
74
74
75 include path/to/file-or-dir
75 include path/to/file-or-dir
76
76
77 exclude path/to/file-or-dir
77 exclude path/to/file-or-dir
78
78
79 rename path/to/source path/to/destination
79 rename path/to/source path/to/destination
80
80
81 Comment lines start with "#". A specified path matches if it equals the
81 Comment lines start with "#". A specified path matches if it equals the
82 full relative name of a file or one of its parent directories. The
82 full relative name of a file or one of its parent directories. The
83 "include" or "exclude" directive with the longest matching path applies,
83 "include" or "exclude" directive with the longest matching path applies,
84 so line order does not matter.
84 so line order does not matter.
85
85
86 The "include" directive causes a file, or all files under a directory, to
86 The "include" directive causes a file, or all files under a directory, to
87 be included in the destination repository. The default if there are no
87 be included in the destination repository. The default if there are no
88 "include" statements is to include everything. If there are any "include"
88 "include" statements is to include everything. If there are any "include"
89 statements, nothing else is included. The "exclude" directive causes files
89 statements, nothing else is included. The "exclude" directive causes files
90 or directories to be omitted. The "rename" directive renames a file or
90 or directories to be omitted. The "rename" directive renames a file or
91 directory if it is converted. To rename from a subdirectory into the root
91 directory if it is converted. To rename from a subdirectory into the root
92 of the repository, use "." as the path to rename to.
92 of the repository, use "." as the path to rename to.
93
93
94 "--full" will make sure the converted changesets contain exactly the right
94 "--full" will make sure the converted changesets contain exactly the right
95 files with the right content. It will make a full conversion of all files,
95 files with the right content. It will make a full conversion of all files,
96 not just the ones that have changed. Files that already are correct will
96 not just the ones that have changed. Files that already are correct will
97 not be changed. This can be used to apply filemap changes when converting
97 not be changed. This can be used to apply filemap changes when converting
98 incrementally. This is currently only supported for Mercurial and
98 incrementally. This is currently only supported for Mercurial and
99 Subversion.
99 Subversion.
100
100
101 The splicemap is a file that allows insertion of synthetic history,
101 The splicemap is a file that allows insertion of synthetic history,
102 letting you specify the parents of a revision. This is useful if you want
102 letting you specify the parents of a revision. This is useful if you want
103 to e.g. give a Subversion merge two parents, or graft two disconnected
103 to e.g. give a Subversion merge two parents, or graft two disconnected
104 series of history together. Each entry contains a key, followed by a
104 series of history together. Each entry contains a key, followed by a
105 space, followed by one or two comma-separated values:
105 space, followed by one or two comma-separated values:
106
106
107 key parent1, parent2
107 key parent1, parent2
108
108
109 The key is the revision ID in the source revision control system whose
109 The key is the revision ID in the source revision control system whose
110 parents should be modified (same format as a key in .hg/shamap). The
110 parents should be modified (same format as a key in .hg/shamap). The
111 values are the revision IDs (in either the source or destination revision
111 values are the revision IDs (in either the source or destination revision
112 control system) that should be used as the new parents for that node. For
112 control system) that should be used as the new parents for that node. For
113 example, if you have merged "release-1.0" into "trunk", then you should
113 example, if you have merged "release-1.0" into "trunk", then you should
114 specify the revision on "trunk" as the first parent and the one on the
114 specify the revision on "trunk" as the first parent and the one on the
115 "release-1.0" branch as the second.
115 "release-1.0" branch as the second.
116
116
117 The branchmap is a file that allows you to rename a branch when it is
117 The branchmap is a file that allows you to rename a branch when it is
118 being brought in from whatever external repository. When used in
118 being brought in from whatever external repository. When used in
119 conjunction with a splicemap, it allows for a powerful combination to help
119 conjunction with a splicemap, it allows for a powerful combination to help
120 fix even the most badly mismanaged repositories and turn them into nicely
120 fix even the most badly mismanaged repositories and turn them into nicely
121 structured Mercurial repositories. The branchmap contains lines of the
121 structured Mercurial repositories. The branchmap contains lines of the
122 form:
122 form:
123
123
124 original_branch_name new_branch_name
124 original_branch_name new_branch_name
125
125
126 where "original_branch_name" is the name of the branch in the source
126 where "original_branch_name" is the name of the branch in the source
127 repository, and "new_branch_name" is the name of the branch is the
127 repository, and "new_branch_name" is the name of the branch is the
128 destination repository. No whitespace is allowed in the branch names. This
128 destination repository. No whitespace is allowed in the branch names. This
129 can be used to (for instance) move code in one repository from "default"
129 can be used to (for instance) move code in one repository from "default"
130 to a named branch.
130 to a named branch.
131
131
132 Mercurial Source
132 Mercurial Source
133 ################
133 ################
134
134
135 The Mercurial source recognizes the following configuration options, which
135 The Mercurial source recognizes the following configuration options, which
136 you can set on the command line with "--config":
136 you can set on the command line with "--config":
137
137
138 convert.hg.ignoreerrors
138 convert.hg.ignoreerrors
139 ignore integrity errors when reading. Use it to fix
139 ignore integrity errors when reading. Use it to fix
140 Mercurial repositories with missing revlogs, by converting
140 Mercurial repositories with missing revlogs, by converting
141 from and to Mercurial. Default is False.
141 from and to Mercurial. Default is False.
142 convert.hg.saverev
142 convert.hg.saverev
143 store original revision ID in changeset (forces target IDs
143 store original revision ID in changeset (forces target IDs
144 to change). It takes a boolean argument and defaults to
144 to change). It takes a boolean argument and defaults to
145 False.
145 False.
146 convert.hg.startrev
146 convert.hg.startrev
147 specify the initial Mercurial revision. The default is 0.
147 specify the initial Mercurial revision. The default is 0.
148 convert.hg.revs
148 convert.hg.revs
149 revset specifying the source revisions to convert.
149 revset specifying the source revisions to convert.
150
150
151 CVS Source
151 CVS Source
152 ##########
152 ##########
153
153
154 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
154 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
155 indicate the starting point of what will be converted. Direct access to
155 indicate the starting point of what will be converted. Direct access to
156 the repository files is not needed, unless of course the repository is
156 the repository files is not needed, unless of course the repository is
157 ":local:". The conversion uses the top level directory in the sandbox to
157 ":local:". The conversion uses the top level directory in the sandbox to
158 find the CVS repository, and then uses CVS rlog commands to find files to
158 find the CVS repository, and then uses CVS rlog commands to find files to
159 convert. This means that unless a filemap is given, all files under the
159 convert. This means that unless a filemap is given, all files under the
160 starting directory will be converted, and that any directory
160 starting directory will be converted, and that any directory
161 reorganization in the CVS sandbox is ignored.
161 reorganization in the CVS sandbox is ignored.
162
162
163 The following options can be used with "--config":
163 The following options can be used with "--config":
164
164
165 convert.cvsps.cache
165 convert.cvsps.cache
166 Set to False to disable remote log caching, for testing and
166 Set to False to disable remote log caching, for testing and
167 debugging purposes. Default is True.
167 debugging purposes. Default is True.
168 convert.cvsps.fuzz
168 convert.cvsps.fuzz
169 Specify the maximum time (in seconds) that is allowed
169 Specify the maximum time (in seconds) that is allowed
170 between commits with identical user and log message in a
170 between commits with identical user and log message in a
171 single changeset. When very large files were checked in as
171 single changeset. When very large files were checked in as
172 part of a changeset then the default may not be long enough.
172 part of a changeset then the default may not be long enough.
173 The default is 60.
173 The default is 60.
174 convert.cvsps.mergeto
174 convert.cvsps.mergeto
175 Specify a regular expression to which commit log messages
175 Specify a regular expression to which commit log messages
176 are matched. If a match occurs, then the conversion process
176 are matched. If a match occurs, then the conversion process
177 will insert a dummy revision merging the branch on which
177 will insert a dummy revision merging the branch on which
178 this log message occurs to the branch indicated in the
178 this log message occurs to the branch indicated in the
179 regex. Default is "{{mergetobranch ([-\w]+)}}"
179 regex. Default is "{{mergetobranch ([-\w]+)}}"
180 convert.cvsps.mergefrom
180 convert.cvsps.mergefrom
181 Specify a regular expression to which commit log messages
181 Specify a regular expression to which commit log messages
182 are matched. If a match occurs, then the conversion process
182 are matched. If a match occurs, then the conversion process
183 will add the most recent revision on the branch indicated in
183 will add the most recent revision on the branch indicated in
184 the regex as the second parent of the changeset. Default is
184 the regex as the second parent of the changeset. Default is
185 "{{mergefrombranch ([-\w]+)}}"
185 "{{mergefrombranch ([-\w]+)}}"
186 convert.localtimezone
186 convert.localtimezone
187 use local time (as determined by the TZ environment
187 use local time (as determined by the TZ environment
188 variable) for changeset date/times. The default is False
188 variable) for changeset date/times. The default is False
189 (use UTC).
189 (use UTC).
190 hooks.cvslog Specify a Python function to be called at the end of
190 hooks.cvslog Specify a Python function to be called at the end of
191 gathering the CVS log. The function is passed a list with
191 gathering the CVS log. The function is passed a list with
192 the log entries, and can modify the entries in-place, or add
192 the log entries, and can modify the entries in-place, or add
193 or delete them.
193 or delete them.
194 hooks.cvschangesets
194 hooks.cvschangesets
195 Specify a Python function to be called after the changesets
195 Specify a Python function to be called after the changesets
196 are calculated from the CVS log. The function is passed a
196 are calculated from the CVS log. The function is passed a
197 list with the changeset entries, and can modify the
197 list with the changeset entries, and can modify the
198 changesets in-place, or add or delete them.
198 changesets in-place, or add or delete them.
199
199
200 An additional "debugcvsps" Mercurial command allows the builtin changeset
200 An additional "debugcvsps" Mercurial command allows the builtin changeset
201 merging code to be run without doing a conversion. Its parameters and
201 merging code to be run without doing a conversion. Its parameters and
202 output are similar to that of cvsps 2.1. Please see the command help for
202 output are similar to that of cvsps 2.1. Please see the command help for
203 more details.
203 more details.
204
204
205 Subversion Source
205 Subversion Source
206 #################
206 #################
207
207
208 Subversion source detects classical trunk/branches/tags layouts. By
208 Subversion source detects classical trunk/branches/tags layouts. By
209 default, the supplied "svn://repo/path/" source URL is converted as a
209 default, the supplied "svn://repo/path/" source URL is converted as a
210 single branch. If "svn://repo/path/trunk" exists it replaces the default
210 single branch. If "svn://repo/path/trunk" exists it replaces the default
211 branch. If "svn://repo/path/branches" exists, its subdirectories are
211 branch. If "svn://repo/path/branches" exists, its subdirectories are
212 listed as possible branches. If "svn://repo/path/tags" exists, it is
212 listed as possible branches. If "svn://repo/path/tags" exists, it is
213 looked for tags referencing converted branches. Default "trunk",
213 looked for tags referencing converted branches. Default "trunk",
214 "branches" and "tags" values can be overridden with following options. Set
214 "branches" and "tags" values can be overridden with following options. Set
215 them to paths relative to the source URL, or leave them blank to disable
215 them to paths relative to the source URL, or leave them blank to disable
216 auto detection.
216 auto detection.
217
217
218 The following options can be set with "--config":
218 The following options can be set with "--config":
219
219
220 convert.svn.branches
220 convert.svn.branches
221 specify the directory containing branches. The default is
221 specify the directory containing branches. The default is
222 "branches".
222 "branches".
223 convert.svn.tags
223 convert.svn.tags
224 specify the directory containing tags. The default is
224 specify the directory containing tags. The default is
225 "tags".
225 "tags".
226 convert.svn.trunk
226 convert.svn.trunk
227 specify the name of the trunk branch. The default is
227 specify the name of the trunk branch. The default is
228 "trunk".
228 "trunk".
229 convert.localtimezone
229 convert.localtimezone
230 use local time (as determined by the TZ environment
230 use local time (as determined by the TZ environment
231 variable) for changeset date/times. The default is False
231 variable) for changeset date/times. The default is False
232 (use UTC).
232 (use UTC).
233
233
234 Source history can be retrieved starting at a specific revision, instead
234 Source history can be retrieved starting at a specific revision, instead
235 of being integrally converted. Only single branch conversions are
235 of being integrally converted. Only single branch conversions are
236 supported.
236 supported.
237
237
238 convert.svn.startrev
238 convert.svn.startrev
239 specify start Subversion revision number. The default is 0.
239 specify start Subversion revision number. The default is 0.
240
240
241 Git Source
241 Git Source
242 ##########
242 ##########
243
243
244 The Git importer converts commits from all reachable branches (refs in
244 The Git importer converts commits from all reachable branches (refs in
245 refs/heads) and remotes (refs in refs/remotes) to Mercurial. Branches are
245 refs/heads) and remotes (refs in refs/remotes) to Mercurial. Branches are
246 converted to bookmarks with the same name, with the leading 'refs/heads'
246 converted to bookmarks with the same name, with the leading 'refs/heads'
247 stripped. Git submodules are converted to Git subrepos in Mercurial.
247 stripped. Git submodules are converted to Git subrepos in Mercurial.
248
248
249 The following options can be set with "--config":
249 The following options can be set with "--config":
250
250
251 convert.git.similarity
251 convert.git.similarity
252 specify how similar files modified in a commit must be to be
252 specify how similar files modified in a commit must be to be
253 imported as renames or copies, as a percentage between "0"
253 imported as renames or copies, as a percentage between "0"
254 (disabled) and "100" (files must be identical). For example,
254 (disabled) and "100" (files must be identical). For example,
255 "90" means that a delete/add pair will be imported as a
255 "90" means that a delete/add pair will be imported as a
256 rename if more than 90% of the file hasn't changed. The
256 rename if more than 90% of the file hasn't changed. The
257 default is "50".
257 default is "50".
258 convert.git.findcopiesharder
258 convert.git.findcopiesharder
259 while detecting copies, look at all files in the working
259 while detecting copies, look at all files in the working
260 copy instead of just changed ones. This is very expensive
260 copy instead of just changed ones. This is very expensive
261 for large projects, and is only effective when
261 for large projects, and is only effective when
262 "convert.git.similarity" is greater than 0. The default is
262 "convert.git.similarity" is greater than 0. The default is
263 False.
263 False.
264 convert.git.remoteprefix
264 convert.git.remoteprefix
265 remote refs are converted as bookmarks with
265 remote refs are converted as bookmarks with
266 "convert.git.remoteprefix" as a prefix followed by a /. The
266 "convert.git.remoteprefix" as a prefix followed by a /. The
267 default is 'remote'.
267 default is 'remote'.
268 convert.git.skipsubmodules
268 convert.git.skipsubmodules
269 does not convert root level .gitmodules files or files with
269 does not convert root level .gitmodules files or files with
270 160000 mode indicating a submodule. Default is False.
270 160000 mode indicating a submodule. Default is False.
271
271
272 Perforce Source
272 Perforce Source
273 ###############
273 ###############
274
274
275 The Perforce (P4) importer can be given a p4 depot path or a client
275 The Perforce (P4) importer can be given a p4 depot path or a client
276 specification as source. It will convert all files in the source to a flat
276 specification as source. It will convert all files in the source to a flat
277 Mercurial repository, ignoring labels, branches and integrations. Note
277 Mercurial repository, ignoring labels, branches and integrations. Note
278 that when a depot path is given you then usually should specify a target
278 that when a depot path is given you then usually should specify a target
279 directory, because otherwise the target may be named "...-hg".
279 directory, because otherwise the target may be named "...-hg".
280
280
281 The following options can be set with "--config":
281 The following options can be set with "--config":
282
282
283 convert.p4.encoding
283 convert.p4.encoding
284 specify the encoding to use when decoding standard output of
284 specify the encoding to use when decoding standard output of
285 the Perforce command line tool. The default is default
285 the Perforce command line tool. The default is default
286 system encoding.
286 system encoding.
287 convert.p4.startrev
287 convert.p4.startrev
288 specify initial Perforce revision (a Perforce changelist
288 specify initial Perforce revision (a Perforce changelist
289 number).
289 number).
290
290
291 Mercurial Destination
291 Mercurial Destination
292 #####################
292 #####################
293
293
294 The Mercurial destination will recognize Mercurial subrepositories in the
294 The Mercurial destination will recognize Mercurial subrepositories in the
295 destination directory, and update the .hgsubstate file automatically if
295 destination directory, and update the .hgsubstate file automatically if
296 the destination subrepositories contain the <dest>/<sub>/.hg/shamap file.
296 the destination subrepositories contain the <dest>/<sub>/.hg/shamap file.
297 Converting a repository with subrepositories requires converting a single
297 Converting a repository with subrepositories requires converting a single
298 repository at a time, from the bottom up.
298 repository at a time, from the bottom up.
299
299
300 The following options are supported:
300 The following options are supported:
301
301
302 convert.hg.clonebranches
302 convert.hg.clonebranches
303 dispatch source branches in separate clones. The default is
303 dispatch source branches in separate clones. The default is
304 False.
304 False.
305 convert.hg.tagsbranch
305 convert.hg.tagsbranch
306 branch name for tag revisions, defaults to "default".
306 branch name for tag revisions, defaults to "default".
307 convert.hg.usebranchnames
307 convert.hg.usebranchnames
308 preserve branch names. The default is True.
308 preserve branch names. The default is True.
309 convert.hg.sourcename
309 convert.hg.sourcename
310 records the given string as a 'convert_source' extra value
310 records the given string as a 'convert_source' extra value
311 on each commit made in the target repository. The default is
311 on each commit made in the target repository. The default is
312 None.
312 None.
313
313
314 All Destinations
314 All Destinations
315 ################
315 ################
316
316
317 All destination types accept the following options:
317 All destination types accept the following options:
318
318
319 convert.skiptags
319 convert.skiptags
320 does not convert tags from the source repo to the target
320 does not convert tags from the source repo to the target
321 repo. The default is False.
321 repo. The default is False.
322
322
323 options ([+] can be repeated):
323 options ([+] can be repeated):
324
324
325 -s --source-type TYPE source repository type
325 -s --source-type TYPE source repository type
326 -d --dest-type TYPE destination repository type
326 -d --dest-type TYPE destination repository type
327 -r --rev REV [+] import up to source revision REV
327 -r --rev REV [+] import up to source revision REV
328 -A --authormap FILE remap usernames using this file
328 -A --authormap FILE remap usernames using this file
329 --filemap FILE remap file names using contents of file
329 --filemap FILE remap file names using contents of file
330 --full apply filemap changes by converting all files again
330 --full apply filemap changes by converting all files again
331 --splicemap FILE splice synthesized history into place
331 --splicemap FILE splice synthesized history into place
332 --branchmap FILE change branch names while converting
332 --branchmap FILE change branch names while converting
333 --branchsort try to sort changesets by branches
333 --branchsort try to sort changesets by branches
334 --datesort try to sort changesets by date
334 --datesort try to sort changesets by date
335 --sourcesort preserve source changesets order
335 --sourcesort preserve source changesets order
336 --closesort try to reorder closed revisions
336 --closesort try to reorder closed revisions
337
337
338 (some details hidden, use --verbose to show complete help)
338 (some details hidden, use --verbose to show complete help)
339 $ hg init a
339 $ hg init a
340 $ cd a
340 $ cd a
341 $ echo a > a
341 $ echo a > a
342 $ hg ci -d'0 0' -Ama
342 $ hg ci -d'0 0' -Ama
343 adding a
343 adding a
344 $ hg cp a b
344 $ hg cp a b
345 $ hg ci -d'1 0' -mb
345 $ hg ci -d'1 0' -mb
346 $ hg rm a
346 $ hg rm a
347 $ hg ci -d'2 0' -mc
347 $ hg ci -d'2 0' -mc
348 $ hg mv b a
348 $ hg mv b a
349 $ hg ci -d'3 0' -md
349 $ hg ci -d'3 0' -md
350 $ echo a >> a
350 $ echo a >> a
351 $ hg ci -d'4 0' -me
351 $ hg ci -d'4 0' -me
352 $ cd ..
352 $ cd ..
353 $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded'
353 $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded'
354 assuming destination a-hg
354 assuming destination a-hg
355 initializing destination a-hg repository
355 initializing destination a-hg repository
356 scanning source...
356 scanning source...
357 sorting...
357 sorting...
358 converting...
358 converting...
359 4 a
359 4 a
360 3 b
360 3 b
361 2 c
361 2 c
362 1 d
362 1 d
363 0 e
363 0 e
364 $ hg --cwd a-hg pull ../a
364 $ hg --cwd a-hg pull ../a
365 pulling from ../a
365 pulling from ../a
366 searching for changes
366 searching for changes
367 no changes found
367 no changes found
368
368
369 conversion to existing file should fail
369 conversion to existing file should fail
370
370
371 $ touch bogusfile
371 $ touch bogusfile
372 $ hg convert a bogusfile
372 $ hg convert a bogusfile
373 initializing destination bogusfile repository
373 initializing destination bogusfile repository
374 abort: cannot create new bundle repository
374 abort: cannot create new bundle repository
375 [255]
375 [255]
376
376
377 #if unix-permissions no-root
377 #if unix-permissions no-root
378
378
379 conversion to dir without permissions should fail
379 conversion to dir without permissions should fail
380
380
381 $ mkdir bogusdir
381 $ mkdir bogusdir
382 $ chmod 000 bogusdir
382 $ chmod 000 bogusdir
383
383
384 $ hg convert a bogusdir
384 $ hg convert a bogusdir
385 abort: Permission denied: 'bogusdir'
385 abort: Permission denied: 'bogusdir'
386 [255]
386 [255]
387
387
388 user permissions should succeed
388 user permissions should succeed
389
389
390 $ chmod 700 bogusdir
390 $ chmod 700 bogusdir
391 $ hg convert a bogusdir
391 $ hg convert a bogusdir
392 initializing destination bogusdir repository
392 initializing destination bogusdir repository
393 scanning source...
393 scanning source...
394 sorting...
394 sorting...
395 converting...
395 converting...
396 4 a
396 4 a
397 3 b
397 3 b
398 2 c
398 2 c
399 1 d
399 1 d
400 0 e
400 0 e
401
401
402 #endif
402 #endif
403
403
404 test pre and post conversion actions
404 test pre and post conversion actions
405
405
406 $ echo 'include b' > filemap
406 $ echo 'include b' > filemap
407 $ hg convert --debug --filemap filemap a partialb | \
407 $ hg convert --debug --filemap filemap a partialb | \
408 > grep 'run hg'
408 > grep 'run hg'
409 run hg source pre-conversion action
409 run hg source pre-conversion action
410 run hg sink pre-conversion action
410 run hg sink pre-conversion action
411 run hg sink post-conversion action
411 run hg sink post-conversion action
412 run hg source post-conversion action
412 run hg source post-conversion action
413
413
414 converting empty dir should fail "nicely
414 converting empty dir should fail "nicely
415
415
416 $ mkdir emptydir
416 $ mkdir emptydir
417
417
418 override $PATH to ensure p4 not visible; use $PYTHON in case we're
418 override $PATH to ensure p4 not visible; use $PYTHON in case we're
419 running from a devel copy, not a temp installation
419 running from a devel copy, not a temp installation
420
420
421 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir
421 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir
422 assuming destination emptydir-hg
422 assuming destination emptydir-hg
423 initializing destination emptydir-hg repository
423 initializing destination emptydir-hg repository
424 emptydir does not look like a CVS checkout
424 emptydir does not look like a CVS checkout
425 emptydir does not look like a Git repository
425 emptydir does not look like a Git repository
426 emptydir does not look like a Subversion repository
426 emptydir does not look like a Subversion repository
427 emptydir is not a local Mercurial repository
427 emptydir is not a local Mercurial repository
428 emptydir does not look like a darcs repository
428 emptydir does not look like a darcs repository
429 emptydir does not look like a monotone repository
429 emptydir does not look like a monotone repository
430 emptydir does not look like a GNU Arch repository
430 emptydir does not look like a GNU Arch repository
431 emptydir does not look like a Bazaar repository
431 emptydir does not look like a Bazaar repository
432 cannot find required "p4" tool
432 cannot find required "p4" tool
433 abort: emptydir: missing or unsupported repository
433 abort: emptydir: missing or unsupported repository
434 [255]
434 [255]
435
435
436 convert with imaginary source type
436 convert with imaginary source type
437
437
438 $ hg convert --source-type foo a a-foo
438 $ hg convert --source-type foo a a-foo
439 initializing destination a-foo repository
439 initializing destination a-foo repository
440 abort: foo: invalid source repository type
440 abort: foo: invalid source repository type
441 [255]
441 [255]
442
442
443 convert with imaginary sink type
443 convert with imaginary sink type
444
444
445 $ hg convert --dest-type foo a a-foo
445 $ hg convert --dest-type foo a a-foo
446 abort: foo: invalid destination repository type
446 abort: foo: invalid destination repository type
447 [255]
447 [255]
448
448
449 testing: convert must not produce duplicate entries in fncache
449 testing: convert must not produce duplicate entries in fncache
450
450
451 $ hg convert a b
451 $ hg convert a b
452 initializing destination b repository
452 initializing destination b repository
453 scanning source...
453 scanning source...
454 sorting...
454 sorting...
455 converting...
455 converting...
456 4 a
456 4 a
457 3 b
457 3 b
458 2 c
458 2 c
459 1 d
459 1 d
460 0 e
460 0 e
461
461
462 contents of fncache file:
462 contents of fncache file:
463
463
464 $ cat b/.hg/store/fncache | sort
464 $ cat b/.hg/store/fncache | sort
465 data/a.i
465 data/a.i
466 data/b.i
466 data/b.i
467
467
468 test bogus URL
468 test bogus URL
469
469
470 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
470 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
471 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
471 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
472 [255]
472 [255]
473
473
474 test revset converted() lookup
474 test revset converted() lookup
475
475
476 $ hg --config convert.hg.saverev=True convert a c
476 $ hg --config convert.hg.saverev=True convert a c
477 initializing destination c repository
477 initializing destination c repository
478 scanning source...
478 scanning source...
479 sorting...
479 sorting...
480 converting...
480 converting...
481 4 a
481 4 a
482 3 b
482 3 b
483 2 c
483 2 c
484 1 d
484 1 d
485 0 e
485 0 e
486 $ echo f > c/f
486 $ echo f > c/f
487 $ hg -R c ci -d'0 0' -Amf
487 $ hg -R c ci -d'0 0' -Amf
488 adding f
488 adding f
489 created new head
489 created new head
490 $ hg -R c log -r "converted(09d945a62ce6)"
490 $ hg -R c log -r "converted(09d945a62ce6)"
491 changeset: 1:98c3dd46a874
491 changeset: 1:98c3dd46a874
492 user: test
492 user: test
493 date: Thu Jan 01 00:00:01 1970 +0000
493 date: Thu Jan 01 00:00:01 1970 +0000
494 summary: b
494 summary: b
495
495
496 $ hg -R c log -r "converted()"
496 $ hg -R c log -r "converted()"
497 changeset: 0:31ed57b2037c
497 changeset: 0:31ed57b2037c
498 user: test
498 user: test
499 date: Thu Jan 01 00:00:00 1970 +0000
499 date: Thu Jan 01 00:00:00 1970 +0000
500 summary: a
500 summary: a
501
501
502 changeset: 1:98c3dd46a874
502 changeset: 1:98c3dd46a874
503 user: test
503 user: test
504 date: Thu Jan 01 00:00:01 1970 +0000
504 date: Thu Jan 01 00:00:01 1970 +0000
505 summary: b
505 summary: b
506
506
507 changeset: 2:3b9ca06ef716
507 changeset: 2:3b9ca06ef716
508 user: test
508 user: test
509 date: Thu Jan 01 00:00:02 1970 +0000
509 date: Thu Jan 01 00:00:02 1970 +0000
510 summary: c
510 summary: c
511
511
512 changeset: 3:4e0debd37cf2
512 changeset: 3:4e0debd37cf2
513 user: test
513 user: test
514 date: Thu Jan 01 00:00:03 1970 +0000
514 date: Thu Jan 01 00:00:03 1970 +0000
515 summary: d
515 summary: d
516
516
517 changeset: 4:9de3bc9349c5
517 changeset: 4:9de3bc9349c5
518 user: test
518 user: test
519 date: Thu Jan 01 00:00:04 1970 +0000
519 date: Thu Jan 01 00:00:04 1970 +0000
520 summary: e
520 summary: e
521
521
522
522
523 test specifying a sourcename
523 test specifying a sourcename
524 $ echo g > a/g
524 $ echo g > a/g
525 $ hg -R a ci -d'0 0' -Amg
525 $ hg -R a ci -d'0 0' -Amg
526 adding g
526 adding g
527 $ hg --config convert.hg.sourcename=mysource --config convert.hg.saverev=True convert a c
527 $ hg --config convert.hg.sourcename=mysource --config convert.hg.saverev=True convert a c
528 scanning source...
528 scanning source...
529 sorting...
529 sorting...
530 converting...
530 converting...
531 0 g
531 0 g
532 $ hg -R c log -r tip --template '{extras % "{extra}\n"}'
532 $ hg -R c log -r tip --template '{extras % "{extra}\n"}'
533 branch=default
533 branch=default
534 convert_revision=a3bc6100aa8ec03e00aaf271f1f50046fb432072
534 convert_revision=a3bc6100aa8ec03e00aaf271f1f50046fb432072
535 convert_source=mysource
535 convert_source=mysource
@@ -1,1224 +1,1224 b''
1 Test basic extension support
1 Test basic extension support
2
2
3 $ cat > foobar.py <<EOF
3 $ cat > foobar.py <<EOF
4 > import os
4 > import os
5 > from mercurial import cmdutil, commands
5 > from mercurial import cmdutil, commands
6 > cmdtable = {}
6 > cmdtable = {}
7 > command = cmdutil.command(cmdtable)
7 > command = cmdutil.command(cmdtable)
8 > def uisetup(ui):
8 > def uisetup(ui):
9 > ui.write("uisetup called\\n")
9 > ui.write("uisetup called\\n")
10 > def reposetup(ui, repo):
10 > def reposetup(ui, repo):
11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
13 > @command('foo', [], 'hg foo')
13 > @command('foo', [], 'hg foo')
14 > def foo(ui, *args, **kwargs):
14 > def foo(ui, *args, **kwargs):
15 > ui.write("Foo\\n")
15 > ui.write("Foo\\n")
16 > @command('bar', [], 'hg bar', norepo=True)
16 > @command('bar', [], 'hg bar', norepo=True)
17 > def bar(ui, *args, **kwargs):
17 > def bar(ui, *args, **kwargs):
18 > ui.write("Bar\\n")
18 > ui.write("Bar\\n")
19 > EOF
19 > EOF
20 $ abspath=`pwd`/foobar.py
20 $ abspath=`pwd`/foobar.py
21
21
22 $ mkdir barfoo
22 $ mkdir barfoo
23 $ cp foobar.py barfoo/__init__.py
23 $ cp foobar.py barfoo/__init__.py
24 $ barfoopath=`pwd`/barfoo
24 $ barfoopath=`pwd`/barfoo
25
25
26 $ hg init a
26 $ hg init a
27 $ cd a
27 $ cd a
28 $ echo foo > file
28 $ echo foo > file
29 $ hg add file
29 $ hg add file
30 $ hg commit -m 'add file'
30 $ hg commit -m 'add file'
31
31
32 $ echo '[extensions]' >> $HGRCPATH
32 $ echo '[extensions]' >> $HGRCPATH
33 $ echo "foobar = $abspath" >> $HGRCPATH
33 $ echo "foobar = $abspath" >> $HGRCPATH
34 $ hg foo
34 $ hg foo
35 uisetup called
35 uisetup called
36 reposetup called for a
36 reposetup called for a
37 ui == repo.ui
37 ui == repo.ui
38 Foo
38 Foo
39
39
40 $ cd ..
40 $ cd ..
41 $ hg clone a b
41 $ hg clone a b
42 uisetup called
42 uisetup called
43 reposetup called for a
43 reposetup called for a
44 ui == repo.ui
44 ui == repo.ui
45 reposetup called for b
45 reposetup called for b
46 ui == repo.ui
46 ui == repo.ui
47 updating to branch default
47 updating to branch default
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49
49
50 $ hg bar
50 $ hg bar
51 uisetup called
51 uisetup called
52 Bar
52 Bar
53 $ echo 'foobar = !' >> $HGRCPATH
53 $ echo 'foobar = !' >> $HGRCPATH
54
54
55 module/__init__.py-style
55 module/__init__.py-style
56
56
57 $ echo "barfoo = $barfoopath" >> $HGRCPATH
57 $ echo "barfoo = $barfoopath" >> $HGRCPATH
58 $ cd a
58 $ cd a
59 $ hg foo
59 $ hg foo
60 uisetup called
60 uisetup called
61 reposetup called for a
61 reposetup called for a
62 ui == repo.ui
62 ui == repo.ui
63 Foo
63 Foo
64 $ echo 'barfoo = !' >> $HGRCPATH
64 $ echo 'barfoo = !' >> $HGRCPATH
65
65
66 Check that extensions are loaded in phases:
66 Check that extensions are loaded in phases:
67
67
68 $ cat > foo.py <<EOF
68 $ cat > foo.py <<EOF
69 > import os
69 > import os
70 > name = os.path.basename(__file__).rsplit('.', 1)[0]
70 > name = os.path.basename(__file__).rsplit('.', 1)[0]
71 > print "1) %s imported" % name
71 > print "1) %s imported" % name
72 > def uisetup(ui):
72 > def uisetup(ui):
73 > print "2) %s uisetup" % name
73 > print "2) %s uisetup" % name
74 > def extsetup():
74 > def extsetup():
75 > print "3) %s extsetup" % name
75 > print "3) %s extsetup" % name
76 > def reposetup(ui, repo):
76 > def reposetup(ui, repo):
77 > print "4) %s reposetup" % name
77 > print "4) %s reposetup" % name
78 > EOF
78 > EOF
79
79
80 $ cp foo.py bar.py
80 $ cp foo.py bar.py
81 $ echo 'foo = foo.py' >> $HGRCPATH
81 $ echo 'foo = foo.py' >> $HGRCPATH
82 $ echo 'bar = bar.py' >> $HGRCPATH
82 $ echo 'bar = bar.py' >> $HGRCPATH
83
83
84 Command with no output, we just want to see the extensions loaded:
84 Command with no output, we just want to see the extensions loaded:
85
85
86 $ hg paths
86 $ hg paths
87 1) foo imported
87 1) foo imported
88 1) bar imported
88 1) bar imported
89 2) foo uisetup
89 2) foo uisetup
90 2) bar uisetup
90 2) bar uisetup
91 3) foo extsetup
91 3) foo extsetup
92 3) bar extsetup
92 3) bar extsetup
93 4) foo reposetup
93 4) foo reposetup
94 4) bar reposetup
94 4) bar reposetup
95
95
96 Check hgweb's load order:
96 Check hgweb's load order:
97
97
98 $ cat > hgweb.cgi <<EOF
98 $ cat > hgweb.cgi <<EOF
99 > #!/usr/bin/env python
99 > #!/usr/bin/env python
100 > from mercurial import demandimport; demandimport.enable()
100 > from mercurial import demandimport; demandimport.enable()
101 > from mercurial.hgweb import hgweb
101 > from mercurial.hgweb import hgweb
102 > from mercurial.hgweb import wsgicgi
102 > from mercurial.hgweb import wsgicgi
103 > application = hgweb('.', 'test repo')
103 > application = hgweb('.', 'test repo')
104 > wsgicgi.launch(application)
104 > wsgicgi.launch(application)
105 > EOF
105 > EOF
106
106
107 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
107 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
108 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
108 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
109 > | grep '^[0-9]) ' # ignores HTML output
109 > | grep '^[0-9]) ' # ignores HTML output
110 1) foo imported
110 1) foo imported
111 1) bar imported
111 1) bar imported
112 2) foo uisetup
112 2) foo uisetup
113 2) bar uisetup
113 2) bar uisetup
114 3) foo extsetup
114 3) foo extsetup
115 3) bar extsetup
115 3) bar extsetup
116 4) foo reposetup
116 4) foo reposetup
117 4) bar reposetup
117 4) bar reposetup
118
118
119 $ echo 'foo = !' >> $HGRCPATH
119 $ echo 'foo = !' >> $HGRCPATH
120 $ echo 'bar = !' >> $HGRCPATH
120 $ echo 'bar = !' >> $HGRCPATH
121
121
122 Check "from __future__ import absolute_import" support for external libraries
122 Check "from __future__ import absolute_import" support for external libraries
123
123
124 #if windows
124 #if windows
125 $ PATHSEP=";"
125 $ PATHSEP=";"
126 #else
126 #else
127 $ PATHSEP=":"
127 $ PATHSEP=":"
128 #endif
128 #endif
129 $ export PATHSEP
129 $ export PATHSEP
130
130
131 $ mkdir $TESTTMP/libroot
131 $ mkdir $TESTTMP/libroot
132 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
132 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
133 $ mkdir $TESTTMP/libroot/mod
133 $ mkdir $TESTTMP/libroot/mod
134 $ touch $TESTTMP/libroot/mod/__init__.py
134 $ touch $TESTTMP/libroot/mod/__init__.py
135 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
135 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
136
136
137 #if absimport
137 #if absimport
138 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
138 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
139 > from __future__ import absolute_import
139 > from __future__ import absolute_import
140 > import ambig # should load "libroot/ambig.py"
140 > import ambig # should load "libroot/ambig.py"
141 > s = ambig.s
141 > s = ambig.s
142 > EOF
142 > EOF
143 $ cat > loadabs.py <<EOF
143 $ cat > loadabs.py <<EOF
144 > import mod.ambigabs as ambigabs
144 > import mod.ambigabs as ambigabs
145 > def extsetup():
145 > def extsetup():
146 > print 'ambigabs.s=%s' % ambigabs.s
146 > print 'ambigabs.s=%s' % ambigabs.s
147 > EOF
147 > EOF
148 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
148 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
149 ambigabs.s=libroot/ambig.py
149 ambigabs.s=libroot/ambig.py
150 $TESTTMP/a (glob)
150 $TESTTMP/a (glob)
151 #endif
151 #endif
152
152
153 #if no-py3k
153 #if no-py3k
154 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
154 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
155 > import ambig # should load "libroot/mod/ambig.py"
155 > import ambig # should load "libroot/mod/ambig.py"
156 > s = ambig.s
156 > s = ambig.s
157 > EOF
157 > EOF
158 $ cat > loadrel.py <<EOF
158 $ cat > loadrel.py <<EOF
159 > import mod.ambigrel as ambigrel
159 > import mod.ambigrel as ambigrel
160 > def extsetup():
160 > def extsetup():
161 > print 'ambigrel.s=%s' % ambigrel.s
161 > print 'ambigrel.s=%s' % ambigrel.s
162 > EOF
162 > EOF
163 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
163 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
164 ambigrel.s=libroot/mod/ambig.py
164 ambigrel.s=libroot/mod/ambig.py
165 $TESTTMP/a (glob)
165 $TESTTMP/a (glob)
166 #endif
166 #endif
167
167
168 Check absolute/relative import of extension specific modules
168 Check absolute/relative import of extension specific modules
169
169
170 $ mkdir $TESTTMP/extroot
170 $ mkdir $TESTTMP/extroot
171 $ cat > $TESTTMP/extroot/bar.py <<EOF
171 $ cat > $TESTTMP/extroot/bar.py <<EOF
172 > s = 'this is extroot.bar'
172 > s = 'this is extroot.bar'
173 > EOF
173 > EOF
174 $ mkdir $TESTTMP/extroot/sub1
174 $ mkdir $TESTTMP/extroot/sub1
175 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
175 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
176 > s = 'this is extroot.sub1.__init__'
176 > s = 'this is extroot.sub1.__init__'
177 > EOF
177 > EOF
178 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
178 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
179 > s = 'this is extroot.sub1.baz'
179 > s = 'this is extroot.sub1.baz'
180 > EOF
180 > EOF
181 $ cat > $TESTTMP/extroot/__init__.py <<EOF
181 $ cat > $TESTTMP/extroot/__init__.py <<EOF
182 > s = 'this is extroot.__init__'
182 > s = 'this is extroot.__init__'
183 > import foo
183 > import foo
184 > def extsetup(ui):
184 > def extsetup(ui):
185 > ui.write('(extroot) ', foo.func(), '\n')
185 > ui.write('(extroot) ', foo.func(), '\n')
186 > EOF
186 > EOF
187
187
188 $ cat > $TESTTMP/extroot/foo.py <<EOF
188 $ cat > $TESTTMP/extroot/foo.py <<EOF
189 > # test absolute import
189 > # test absolute import
190 > buf = []
190 > buf = []
191 > def func():
191 > def func():
192 > # "not locals" case
192 > # "not locals" case
193 > import extroot.bar
193 > import extroot.bar
194 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
194 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
195 > return '\n(extroot) '.join(buf)
195 > return '\n(extroot) '.join(buf)
196 > # "fromlist == ('*',)" case
196 > # "fromlist == ('*',)" case
197 > from extroot.bar import *
197 > from extroot.bar import *
198 > buf.append('from extroot.bar import *: %s' % s)
198 > buf.append('from extroot.bar import *: %s' % s)
199 > # "not fromlist" and "if '.' in name" case
199 > # "not fromlist" and "if '.' in name" case
200 > import extroot.sub1.baz
200 > import extroot.sub1.baz
201 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
201 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
202 > # "not fromlist" and NOT "if '.' in name" case
202 > # "not fromlist" and NOT "if '.' in name" case
203 > import extroot
203 > import extroot
204 > buf.append('import extroot: %s' % extroot.s)
204 > buf.append('import extroot: %s' % extroot.s)
205 > # NOT "not fromlist" and NOT "level != -1" case
205 > # NOT "not fromlist" and NOT "level != -1" case
206 > from extroot.bar import s
206 > from extroot.bar import s
207 > buf.append('from extroot.bar import s: %s' % s)
207 > buf.append('from extroot.bar import s: %s' % s)
208 > EOF
208 > EOF
209 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
209 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
210 (extroot) from extroot.bar import *: this is extroot.bar
210 (extroot) from extroot.bar import *: this is extroot.bar
211 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
211 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
212 (extroot) import extroot: this is extroot.__init__
212 (extroot) import extroot: this is extroot.__init__
213 (extroot) from extroot.bar import s: this is extroot.bar
213 (extroot) from extroot.bar import s: this is extroot.bar
214 (extroot) import extroot.bar in func(): this is extroot.bar
214 (extroot) import extroot.bar in func(): this is extroot.bar
215 $TESTTMP/a (glob)
215 $TESTTMP/a (glob)
216
216
217 #if no-py3k
217 #if no-py3k
218 $ rm "$TESTTMP"/extroot/foo.*
218 $ rm "$TESTTMP"/extroot/foo.*
219 $ cat > $TESTTMP/extroot/foo.py <<EOF
219 $ cat > $TESTTMP/extroot/foo.py <<EOF
220 > # test relative import
220 > # test relative import
221 > buf = []
221 > buf = []
222 > def func():
222 > def func():
223 > # "not locals" case
223 > # "not locals" case
224 > import bar
224 > import bar
225 > buf.append('import bar in func(): %s' % bar.s)
225 > buf.append('import bar in func(): %s' % bar.s)
226 > return '\n(extroot) '.join(buf)
226 > return '\n(extroot) '.join(buf)
227 > # "fromlist == ('*',)" case
227 > # "fromlist == ('*',)" case
228 > from bar import *
228 > from bar import *
229 > buf.append('from bar import *: %s' % s)
229 > buf.append('from bar import *: %s' % s)
230 > # "not fromlist" and "if '.' in name" case
230 > # "not fromlist" and "if '.' in name" case
231 > import sub1.baz
231 > import sub1.baz
232 > buf.append('import sub1.baz: %s' % sub1.baz.s)
232 > buf.append('import sub1.baz: %s' % sub1.baz.s)
233 > # "not fromlist" and NOT "if '.' in name" case
233 > # "not fromlist" and NOT "if '.' in name" case
234 > import sub1
234 > import sub1
235 > buf.append('import sub1: %s' % sub1.s)
235 > buf.append('import sub1: %s' % sub1.s)
236 > # NOT "not fromlist" and NOT "level != -1" case
236 > # NOT "not fromlist" and NOT "level != -1" case
237 > from bar import s
237 > from bar import s
238 > buf.append('from bar import s: %s' % s)
238 > buf.append('from bar import s: %s' % s)
239 > EOF
239 > EOF
240 $ hg --config extensions.extroot=$TESTTMP/extroot root
240 $ hg --config extensions.extroot=$TESTTMP/extroot root
241 (extroot) from bar import *: this is extroot.bar
241 (extroot) from bar import *: this is extroot.bar
242 (extroot) import sub1.baz: this is extroot.sub1.baz
242 (extroot) import sub1.baz: this is extroot.sub1.baz
243 (extroot) import sub1: this is extroot.sub1.__init__
243 (extroot) import sub1: this is extroot.sub1.__init__
244 (extroot) from bar import s: this is extroot.bar
244 (extroot) from bar import s: this is extroot.bar
245 (extroot) import bar in func(): this is extroot.bar
245 (extroot) import bar in func(): this is extroot.bar
246 $TESTTMP/a (glob)
246 $TESTTMP/a (glob)
247 #endif
247 #endif
248
248
249 $ cd ..
249 $ cd ..
250
250
251 hide outer repo
251 hide outer repo
252 $ hg init
252 $ hg init
253
253
254 $ cat > empty.py <<EOF
254 $ cat > empty.py <<EOF
255 > '''empty cmdtable
255 > '''empty cmdtable
256 > '''
256 > '''
257 > cmdtable = {}
257 > cmdtable = {}
258 > EOF
258 > EOF
259 $ emptypath=`pwd`/empty.py
259 $ emptypath=`pwd`/empty.py
260 $ echo "empty = $emptypath" >> $HGRCPATH
260 $ echo "empty = $emptypath" >> $HGRCPATH
261 $ hg help empty
261 $ hg help empty
262 empty extension - empty cmdtable
262 empty extension - empty cmdtable
263
263
264 no commands defined
264 no commands defined
265
265
266
266
267 $ echo 'empty = !' >> $HGRCPATH
267 $ echo 'empty = !' >> $HGRCPATH
268
268
269 $ cat > debugextension.py <<EOF
269 $ cat > debugextension.py <<EOF
270 > '''only debugcommands
270 > '''only debugcommands
271 > '''
271 > '''
272 > from mercurial import cmdutil
272 > from mercurial import cmdutil
273 > cmdtable = {}
273 > cmdtable = {}
274 > command = cmdutil.command(cmdtable)
274 > command = cmdutil.command(cmdtable)
275 > @command('debugfoobar', [], 'hg debugfoobar')
275 > @command('debugfoobar', [], 'hg debugfoobar')
276 > def debugfoobar(ui, repo, *args, **opts):
276 > def debugfoobar(ui, repo, *args, **opts):
277 > "yet another debug command"
277 > "yet another debug command"
278 > pass
278 > pass
279 > @command('foo', [], 'hg foo')
279 > @command('foo', [], 'hg foo')
280 > def foo(ui, repo, *args, **opts):
280 > def foo(ui, repo, *args, **opts):
281 > """yet another foo command
281 > """yet another foo command
282 > This command has been DEPRECATED since forever.
282 > This command has been DEPRECATED since forever.
283 > """
283 > """
284 > pass
284 > pass
285 > EOF
285 > EOF
286 $ debugpath=`pwd`/debugextension.py
286 $ debugpath=`pwd`/debugextension.py
287 $ echo "debugextension = $debugpath" >> $HGRCPATH
287 $ echo "debugextension = $debugpath" >> $HGRCPATH
288
288
289 $ hg help debugextension
289 $ hg help debugextension
290 hg debugextensions
290 hg debugextensions
291
291
292 show information about active extensions
292 show information about active extensions
293
293
294 options:
294 options:
295
295
296 (some details hidden, use --verbose to show complete help)
296 (some details hidden, use --verbose to show complete help)
297
297
298
298
299 $ hg --verbose help debugextension
299 $ hg --verbose help debugextension
300 hg debugextensions
300 hg debugextensions
301
301
302 show information about active extensions
302 show information about active extensions
303
303
304 options:
304 options:
305
305
306 -T --template TEMPLATE display with template (EXPERIMENTAL)
306 -T --template TEMPLATE display with template (EXPERIMENTAL)
307
307
308 global options ([+] can be repeated):
308 global options ([+] can be repeated):
309
309
310 -R --repository REPO repository root directory or name of overlay bundle
310 -R --repository REPO repository root directory or name of overlay bundle
311 file
311 file
312 --cwd DIR change working directory
312 --cwd DIR change working directory
313 -y --noninteractive do not prompt, automatically pick the first choice for
313 -y --noninteractive do not prompt, automatically pick the first choice for
314 all prompts
314 all prompts
315 -q --quiet suppress output
315 -q --quiet suppress output
316 -v --verbose enable additional output
316 -v --verbose enable additional output
317 --config CONFIG [+] set/override config option (use 'section.name=value')
317 --config CONFIG [+] set/override config option (use 'section.name=value')
318 --debug enable debugging output
318 --debug enable debugging output
319 --debugger start debugger
319 --debugger start debugger
320 --encoding ENCODE set the charset encoding (default: ascii)
320 --encoding ENCODE set the charset encoding (default: ascii)
321 --encodingmode MODE set the charset encoding mode (default: strict)
321 --encodingmode MODE set the charset encoding mode (default: strict)
322 --traceback always print a traceback on exception
322 --traceback always print a traceback on exception
323 --time time how long the command takes
323 --time time how long the command takes
324 --profile print command execution profile
324 --profile print command execution profile
325 --version output version information and exit
325 --version output version information and exit
326 -h --help display help and exit
326 -h --help display help and exit
327 --hidden consider hidden changesets
327 --hidden consider hidden changesets
328
328
329
329
330
330
331
331
332
332
333
333
334 $ hg --debug help debugextension
334 $ hg --debug help debugextension
335 hg debugextensions
335 hg debugextensions
336
336
337 show information about active extensions
337 show information about active extensions
338
338
339 options:
339 options:
340
340
341 -T --template TEMPLATE display with template (EXPERIMENTAL)
341 -T --template TEMPLATE display with template (EXPERIMENTAL)
342
342
343 global options ([+] can be repeated):
343 global options ([+] can be repeated):
344
344
345 -R --repository REPO repository root directory or name of overlay bundle
345 -R --repository REPO repository root directory or name of overlay bundle
346 file
346 file
347 --cwd DIR change working directory
347 --cwd DIR change working directory
348 -y --noninteractive do not prompt, automatically pick the first choice for
348 -y --noninteractive do not prompt, automatically pick the first choice for
349 all prompts
349 all prompts
350 -q --quiet suppress output
350 -q --quiet suppress output
351 -v --verbose enable additional output
351 -v --verbose enable additional output
352 --config CONFIG [+] set/override config option (use 'section.name=value')
352 --config CONFIG [+] set/override config option (use 'section.name=value')
353 --debug enable debugging output
353 --debug enable debugging output
354 --debugger start debugger
354 --debugger start debugger
355 --encoding ENCODE set the charset encoding (default: ascii)
355 --encoding ENCODE set the charset encoding (default: ascii)
356 --encodingmode MODE set the charset encoding mode (default: strict)
356 --encodingmode MODE set the charset encoding mode (default: strict)
357 --traceback always print a traceback on exception
357 --traceback always print a traceback on exception
358 --time time how long the command takes
358 --time time how long the command takes
359 --profile print command execution profile
359 --profile print command execution profile
360 --version output version information and exit
360 --version output version information and exit
361 -h --help display help and exit
361 -h --help display help and exit
362 --hidden consider hidden changesets
362 --hidden consider hidden changesets
363
363
364
364
365
365
366
366
367
367
368 $ echo 'debugextension = !' >> $HGRCPATH
368 $ echo 'debugextension = !' >> $HGRCPATH
369
369
370 Asking for help about a deprecated extension should do something useful:
370 Asking for help about a deprecated extension should do something useful:
371
371
372 $ hg help glog
372 $ hg help glog
373 'glog' is provided by the following extension:
373 'glog' is provided by the following extension:
374
374
375 graphlog command to view revision graphs from a shell (DEPRECATED)
375 graphlog command to view revision graphs from a shell (DEPRECATED)
376
376
377 (use "hg help extensions" for information on enabling extensions)
377 (use "hg help extensions" for information on enabling extensions)
378
378
379 Extension module help vs command help:
379 Extension module help vs command help:
380
380
381 $ echo 'extdiff =' >> $HGRCPATH
381 $ echo 'extdiff =' >> $HGRCPATH
382 $ hg help extdiff
382 $ hg help extdiff
383 hg extdiff [OPT]... [FILE]...
383 hg extdiff [OPT]... [FILE]...
384
384
385 use external program to diff repository (or selected files)
385 use external program to diff repository (or selected files)
386
386
387 Show differences between revisions for the specified files, using an
387 Show differences between revisions for the specified files, using an
388 external program. The default program used is diff, with default options
388 external program. The default program used is diff, with default options
389 "-Npru".
389 "-Npru".
390
390
391 To select a different program, use the -p/--program option. The program
391 To select a different program, use the -p/--program option. The program
392 will be passed the names of two directories to compare. To pass additional
392 will be passed the names of two directories to compare. To pass additional
393 options to the program, use -o/--option. These will be passed before the
393 options to the program, use -o/--option. These will be passed before the
394 names of the directories to compare.
394 names of the directories to compare.
395
395
396 When two revision arguments are given, then changes are shown between
396 When two revision arguments are given, then changes are shown between
397 those revisions. If only one revision is specified then that revision is
397 those revisions. If only one revision is specified then that revision is
398 compared to the working directory, and, when no revisions are specified,
398 compared to the working directory, and, when no revisions are specified,
399 the working directory files are compared to its parent.
399 the working directory files are compared to its parent.
400
400
401 (use "hg help -e extdiff" to show help for the extdiff extension)
401 (use "hg help -e extdiff" to show help for the extdiff extension)
402
402
403 options ([+] can be repeated):
403 options ([+] can be repeated):
404
404
405 -p --program CMD comparison program to run
405 -p --program CMD comparison program to run
406 -o --option OPT [+] pass option to comparison program
406 -o --option OPT [+] pass option to comparison program
407 -r --rev REV [+] revision
407 -r --rev REV [+] revision
408 -c --change REV change made by revision
408 -c --change REV change made by revision
409 --patch compare patches for two revisions
409 --patch compare patches for two revisions
410 -I --include PATTERN [+] include names matching the given patterns
410 -I --include PATTERN [+] include names matching the given patterns
411 -X --exclude PATTERN [+] exclude names matching the given patterns
411 -X --exclude PATTERN [+] exclude names matching the given patterns
412 -S --subrepos recurse into subrepositories
412 -S --subrepos recurse into subrepositories
413
413
414 (some details hidden, use --verbose to show complete help)
414 (some details hidden, use --verbose to show complete help)
415
415
416
416
417
417
418
418
419
419
420
420
421
421
422
422
423
423
424
424
425 $ hg help --extension extdiff
425 $ hg help --extension extdiff
426 extdiff extension - command to allow external programs to compare revisions
426 extdiff extension - command to allow external programs to compare revisions
427
427
428 The extdiff Mercurial extension allows you to use external programs to compare
428 The extdiff Mercurial extension allows you to use external programs to compare
429 revisions, or revision with working directory. The external diff programs are
429 revisions, or revision with working directory. The external diff programs are
430 called with a configurable set of options and two non-option arguments: paths
430 called with a configurable set of options and two non-option arguments: paths
431 to directories containing snapshots of files to compare.
431 to directories containing snapshots of files to compare.
432
432
433 The extdiff extension also allows you to configure new diff commands, so you
433 The extdiff extension also allows you to configure new diff commands, so you
434 do not need to type "hg extdiff -p kdiff3" always.
434 do not need to type 'hg extdiff -p kdiff3' always.
435
435
436 [extdiff]
436 [extdiff]
437 # add new command that runs GNU diff(1) in 'context diff' mode
437 # add new command that runs GNU diff(1) in 'context diff' mode
438 cdiff = gdiff -Nprc5
438 cdiff = gdiff -Nprc5
439 ## or the old way:
439 ## or the old way:
440 #cmd.cdiff = gdiff
440 #cmd.cdiff = gdiff
441 #opts.cdiff = -Nprc5
441 #opts.cdiff = -Nprc5
442
442
443 # add new command called meld, runs meld (no need to name twice). If
443 # add new command called meld, runs meld (no need to name twice). If
444 # the meld executable is not available, the meld tool in [merge-tools]
444 # the meld executable is not available, the meld tool in [merge-tools]
445 # will be used, if available
445 # will be used, if available
446 meld =
446 meld =
447
447
448 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
448 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
449 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
449 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
450 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
450 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
451 # your .vimrc
451 # your .vimrc
452 vimdiff = gvim -f "+next" \
452 vimdiff = gvim -f "+next" \
453 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
453 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
454
454
455 Tool arguments can include variables that are expanded at runtime:
455 Tool arguments can include variables that are expanded at runtime:
456
456
457 $parent1, $plabel1 - filename, descriptive label of first parent
457 $parent1, $plabel1 - filename, descriptive label of first parent
458 $child, $clabel - filename, descriptive label of child revision
458 $child, $clabel - filename, descriptive label of child revision
459 $parent2, $plabel2 - filename, descriptive label of second parent
459 $parent2, $plabel2 - filename, descriptive label of second parent
460 $root - repository root
460 $root - repository root
461 $parent is an alias for $parent1.
461 $parent is an alias for $parent1.
462
462
463 The extdiff extension will look in your [diff-tools] and [merge-tools]
463 The extdiff extension will look in your [diff-tools] and [merge-tools]
464 sections for diff tool arguments, when none are specified in [extdiff].
464 sections for diff tool arguments, when none are specified in [extdiff].
465
465
466 [extdiff]
466 [extdiff]
467 kdiff3 =
467 kdiff3 =
468
468
469 [diff-tools]
469 [diff-tools]
470 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
470 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
471
471
472 You can use -I/-X and list of file or directory names like normal "hg diff"
472 You can use -I/-X and list of file or directory names like normal 'hg diff'
473 command. The extdiff extension makes snapshots of only needed files, so
473 command. The extdiff extension makes snapshots of only needed files, so
474 running the external diff program will actually be pretty fast (at least
474 running the external diff program will actually be pretty fast (at least
475 faster than having to compare the entire tree).
475 faster than having to compare the entire tree).
476
476
477 list of commands:
477 list of commands:
478
478
479 extdiff use external program to diff repository (or selected files)
479 extdiff use external program to diff repository (or selected files)
480
480
481 (use "hg help -v -e extdiff" to show built-in aliases and global options)
481 (use "hg help -v -e extdiff" to show built-in aliases and global options)
482
482
483
483
484
484
485
485
486
486
487
487
488
488
489
489
490
490
491
491
492
492
493
493
494
494
495
495
496
496
497
497
498 $ echo 'extdiff = !' >> $HGRCPATH
498 $ echo 'extdiff = !' >> $HGRCPATH
499
499
500 Test help topic with same name as extension
500 Test help topic with same name as extension
501
501
502 $ cat > multirevs.py <<EOF
502 $ cat > multirevs.py <<EOF
503 > from mercurial import cmdutil, commands
503 > from mercurial import cmdutil, commands
504 > cmdtable = {}
504 > cmdtable = {}
505 > command = cmdutil.command(cmdtable)
505 > command = cmdutil.command(cmdtable)
506 > """multirevs extension
506 > """multirevs extension
507 > Big multi-line module docstring."""
507 > Big multi-line module docstring."""
508 > @command('multirevs', [], 'ARG', norepo=True)
508 > @command('multirevs', [], 'ARG', norepo=True)
509 > def multirevs(ui, repo, arg, *args, **opts):
509 > def multirevs(ui, repo, arg, *args, **opts):
510 > """multirevs command"""
510 > """multirevs command"""
511 > pass
511 > pass
512 > EOF
512 > EOF
513 $ echo "multirevs = multirevs.py" >> $HGRCPATH
513 $ echo "multirevs = multirevs.py" >> $HGRCPATH
514
514
515 $ hg help multirevs
515 $ hg help multirevs
516 Specifying Multiple Revisions
516 Specifying Multiple Revisions
517 """""""""""""""""""""""""""""
517 """""""""""""""""""""""""""""
518
518
519 When Mercurial accepts more than one revision, they may be specified
519 When Mercurial accepts more than one revision, they may be specified
520 individually, or provided as a topologically continuous range, separated
520 individually, or provided as a topologically continuous range, separated
521 by the ":" character.
521 by the ":" character.
522
522
523 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
523 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
524 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
524 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
525 specified, it defaults to revision number 0. If END is not specified, it
525 specified, it defaults to revision number 0. If END is not specified, it
526 defaults to the tip. The range ":" thus means "all revisions".
526 defaults to the tip. The range ":" thus means "all revisions".
527
527
528 If BEGIN is greater than END, revisions are treated in reverse order.
528 If BEGIN is greater than END, revisions are treated in reverse order.
529
529
530 A range acts as a closed interval. This means that a range of 3:5 gives 3,
530 A range acts as a closed interval. This means that a range of 3:5 gives 3,
531 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
531 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
532
532
533 use "hg help -c multirevs" to see help for the multirevs command
533 use "hg help -c multirevs" to see help for the multirevs command
534
534
535
535
536
536
537
537
538
538
539
539
540 $ hg help -c multirevs
540 $ hg help -c multirevs
541 hg multirevs ARG
541 hg multirevs ARG
542
542
543 multirevs command
543 multirevs command
544
544
545 (some details hidden, use --verbose to show complete help)
545 (some details hidden, use --verbose to show complete help)
546
546
547
547
548
548
549 $ hg multirevs
549 $ hg multirevs
550 hg multirevs: invalid arguments
550 hg multirevs: invalid arguments
551 hg multirevs ARG
551 hg multirevs ARG
552
552
553 multirevs command
553 multirevs command
554
554
555 (use "hg multirevs -h" to show more help)
555 (use "hg multirevs -h" to show more help)
556 [255]
556 [255]
557
557
558
558
559
559
560 $ echo "multirevs = !" >> $HGRCPATH
560 $ echo "multirevs = !" >> $HGRCPATH
561
561
562 Issue811: Problem loading extensions twice (by site and by user)
562 Issue811: Problem loading extensions twice (by site and by user)
563
563
564 $ cat <<EOF >> $HGRCPATH
564 $ cat <<EOF >> $HGRCPATH
565 > mq =
565 > mq =
566 > strip =
566 > strip =
567 > hgext.mq =
567 > hgext.mq =
568 > hgext/mq =
568 > hgext/mq =
569 > EOF
569 > EOF
570
570
571 Show extensions:
571 Show extensions:
572 (note that mq force load strip, also checking it's not loaded twice)
572 (note that mq force load strip, also checking it's not loaded twice)
573
573
574 $ hg debugextensions
574 $ hg debugextensions
575 mq
575 mq
576 strip
576 strip
577
577
578 For extensions, which name matches one of its commands, help
578 For extensions, which name matches one of its commands, help
579 message should ask '-v -e' to get list of built-in aliases
579 message should ask '-v -e' to get list of built-in aliases
580 along with extension help itself
580 along with extension help itself
581
581
582 $ mkdir $TESTTMP/d
582 $ mkdir $TESTTMP/d
583 $ cat > $TESTTMP/d/dodo.py <<EOF
583 $ cat > $TESTTMP/d/dodo.py <<EOF
584 > """
584 > """
585 > This is an awesome 'dodo' extension. It does nothing and
585 > This is an awesome 'dodo' extension. It does nothing and
586 > writes 'Foo foo'
586 > writes 'Foo foo'
587 > """
587 > """
588 > from mercurial import cmdutil, commands
588 > from mercurial import cmdutil, commands
589 > cmdtable = {}
589 > cmdtable = {}
590 > command = cmdutil.command(cmdtable)
590 > command = cmdutil.command(cmdtable)
591 > @command('dodo', [], 'hg dodo')
591 > @command('dodo', [], 'hg dodo')
592 > def dodo(ui, *args, **kwargs):
592 > def dodo(ui, *args, **kwargs):
593 > """Does nothing"""
593 > """Does nothing"""
594 > ui.write("I do nothing. Yay\\n")
594 > ui.write("I do nothing. Yay\\n")
595 > @command('foofoo', [], 'hg foofoo')
595 > @command('foofoo', [], 'hg foofoo')
596 > def foofoo(ui, *args, **kwargs):
596 > def foofoo(ui, *args, **kwargs):
597 > """Writes 'Foo foo'"""
597 > """Writes 'Foo foo'"""
598 > ui.write("Foo foo\\n")
598 > ui.write("Foo foo\\n")
599 > EOF
599 > EOF
600 $ dodopath=$TESTTMP/d/dodo.py
600 $ dodopath=$TESTTMP/d/dodo.py
601
601
602 $ echo "dodo = $dodopath" >> $HGRCPATH
602 $ echo "dodo = $dodopath" >> $HGRCPATH
603
603
604 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
604 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
605 $ hg help -e dodo
605 $ hg help -e dodo
606 dodo extension -
606 dodo extension -
607
607
608 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
608 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
609
609
610 list of commands:
610 list of commands:
611
611
612 dodo Does nothing
612 dodo Does nothing
613 foofoo Writes 'Foo foo'
613 foofoo Writes 'Foo foo'
614
614
615 (use "hg help -v -e dodo" to show built-in aliases and global options)
615 (use "hg help -v -e dodo" to show built-in aliases and global options)
616
616
617 Make sure that '-v -e' prints list of built-in aliases along with
617 Make sure that '-v -e' prints list of built-in aliases along with
618 extension help itself
618 extension help itself
619 $ hg help -v -e dodo
619 $ hg help -v -e dodo
620 dodo extension -
620 dodo extension -
621
621
622 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
622 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
623
623
624 list of commands:
624 list of commands:
625
625
626 dodo Does nothing
626 dodo Does nothing
627 foofoo Writes 'Foo foo'
627 foofoo Writes 'Foo foo'
628
628
629 global options ([+] can be repeated):
629 global options ([+] can be repeated):
630
630
631 -R --repository REPO repository root directory or name of overlay bundle
631 -R --repository REPO repository root directory or name of overlay bundle
632 file
632 file
633 --cwd DIR change working directory
633 --cwd DIR change working directory
634 -y --noninteractive do not prompt, automatically pick the first choice for
634 -y --noninteractive do not prompt, automatically pick the first choice for
635 all prompts
635 all prompts
636 -q --quiet suppress output
636 -q --quiet suppress output
637 -v --verbose enable additional output
637 -v --verbose enable additional output
638 --config CONFIG [+] set/override config option (use 'section.name=value')
638 --config CONFIG [+] set/override config option (use 'section.name=value')
639 --debug enable debugging output
639 --debug enable debugging output
640 --debugger start debugger
640 --debugger start debugger
641 --encoding ENCODE set the charset encoding (default: ascii)
641 --encoding ENCODE set the charset encoding (default: ascii)
642 --encodingmode MODE set the charset encoding mode (default: strict)
642 --encodingmode MODE set the charset encoding mode (default: strict)
643 --traceback always print a traceback on exception
643 --traceback always print a traceback on exception
644 --time time how long the command takes
644 --time time how long the command takes
645 --profile print command execution profile
645 --profile print command execution profile
646 --version output version information and exit
646 --version output version information and exit
647 -h --help display help and exit
647 -h --help display help and exit
648 --hidden consider hidden changesets
648 --hidden consider hidden changesets
649
649
650 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
650 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
651 $ hg help -v dodo
651 $ hg help -v dodo
652 hg dodo
652 hg dodo
653
653
654 Does nothing
654 Does nothing
655
655
656 (use "hg help -e dodo" to show help for the dodo extension)
656 (use "hg help -e dodo" to show help for the dodo extension)
657
657
658 options:
658 options:
659
659
660 --mq operate on patch repository
660 --mq operate on patch repository
661
661
662 global options ([+] can be repeated):
662 global options ([+] can be repeated):
663
663
664 -R --repository REPO repository root directory or name of overlay bundle
664 -R --repository REPO repository root directory or name of overlay bundle
665 file
665 file
666 --cwd DIR change working directory
666 --cwd DIR change working directory
667 -y --noninteractive do not prompt, automatically pick the first choice for
667 -y --noninteractive do not prompt, automatically pick the first choice for
668 all prompts
668 all prompts
669 -q --quiet suppress output
669 -q --quiet suppress output
670 -v --verbose enable additional output
670 -v --verbose enable additional output
671 --config CONFIG [+] set/override config option (use 'section.name=value')
671 --config CONFIG [+] set/override config option (use 'section.name=value')
672 --debug enable debugging output
672 --debug enable debugging output
673 --debugger start debugger
673 --debugger start debugger
674 --encoding ENCODE set the charset encoding (default: ascii)
674 --encoding ENCODE set the charset encoding (default: ascii)
675 --encodingmode MODE set the charset encoding mode (default: strict)
675 --encodingmode MODE set the charset encoding mode (default: strict)
676 --traceback always print a traceback on exception
676 --traceback always print a traceback on exception
677 --time time how long the command takes
677 --time time how long the command takes
678 --profile print command execution profile
678 --profile print command execution profile
679 --version output version information and exit
679 --version output version information and exit
680 -h --help display help and exit
680 -h --help display help and exit
681 --hidden consider hidden changesets
681 --hidden consider hidden changesets
682
682
683 In case when extension name doesn't match any of its commands,
683 In case when extension name doesn't match any of its commands,
684 help message should ask for '-v' to get list of built-in aliases
684 help message should ask for '-v' to get list of built-in aliases
685 along with extension help
685 along with extension help
686 $ cat > $TESTTMP/d/dudu.py <<EOF
686 $ cat > $TESTTMP/d/dudu.py <<EOF
687 > """
687 > """
688 > This is an awesome 'dudu' extension. It does something and
688 > This is an awesome 'dudu' extension. It does something and
689 > also writes 'Beep beep'
689 > also writes 'Beep beep'
690 > """
690 > """
691 > from mercurial import cmdutil, commands
691 > from mercurial import cmdutil, commands
692 > cmdtable = {}
692 > cmdtable = {}
693 > command = cmdutil.command(cmdtable)
693 > command = cmdutil.command(cmdtable)
694 > @command('something', [], 'hg something')
694 > @command('something', [], 'hg something')
695 > def something(ui, *args, **kwargs):
695 > def something(ui, *args, **kwargs):
696 > """Does something"""
696 > """Does something"""
697 > ui.write("I do something. Yaaay\\n")
697 > ui.write("I do something. Yaaay\\n")
698 > @command('beep', [], 'hg beep')
698 > @command('beep', [], 'hg beep')
699 > def beep(ui, *args, **kwargs):
699 > def beep(ui, *args, **kwargs):
700 > """Writes 'Beep beep'"""
700 > """Writes 'Beep beep'"""
701 > ui.write("Beep beep\\n")
701 > ui.write("Beep beep\\n")
702 > EOF
702 > EOF
703 $ dudupath=$TESTTMP/d/dudu.py
703 $ dudupath=$TESTTMP/d/dudu.py
704
704
705 $ echo "dudu = $dudupath" >> $HGRCPATH
705 $ echo "dudu = $dudupath" >> $HGRCPATH
706
706
707 $ hg help -e dudu
707 $ hg help -e dudu
708 dudu extension -
708 dudu extension -
709
709
710 This is an awesome 'dudu' extension. It does something and also writes 'Beep
710 This is an awesome 'dudu' extension. It does something and also writes 'Beep
711 beep'
711 beep'
712
712
713 list of commands:
713 list of commands:
714
714
715 beep Writes 'Beep beep'
715 beep Writes 'Beep beep'
716 something Does something
716 something Does something
717
717
718 (use "hg help -v dudu" to show built-in aliases and global options)
718 (use "hg help -v dudu" to show built-in aliases and global options)
719
719
720 In case when extension name doesn't match any of its commands,
720 In case when extension name doesn't match any of its commands,
721 help options '-v' and '-v -e' should be equivalent
721 help options '-v' and '-v -e' should be equivalent
722 $ hg help -v dudu
722 $ hg help -v dudu
723 dudu extension -
723 dudu extension -
724
724
725 This is an awesome 'dudu' extension. It does something and also writes 'Beep
725 This is an awesome 'dudu' extension. It does something and also writes 'Beep
726 beep'
726 beep'
727
727
728 list of commands:
728 list of commands:
729
729
730 beep Writes 'Beep beep'
730 beep Writes 'Beep beep'
731 something Does something
731 something Does something
732
732
733 global options ([+] can be repeated):
733 global options ([+] can be repeated):
734
734
735 -R --repository REPO repository root directory or name of overlay bundle
735 -R --repository REPO repository root directory or name of overlay bundle
736 file
736 file
737 --cwd DIR change working directory
737 --cwd DIR change working directory
738 -y --noninteractive do not prompt, automatically pick the first choice for
738 -y --noninteractive do not prompt, automatically pick the first choice for
739 all prompts
739 all prompts
740 -q --quiet suppress output
740 -q --quiet suppress output
741 -v --verbose enable additional output
741 -v --verbose enable additional output
742 --config CONFIG [+] set/override config option (use 'section.name=value')
742 --config CONFIG [+] set/override config option (use 'section.name=value')
743 --debug enable debugging output
743 --debug enable debugging output
744 --debugger start debugger
744 --debugger start debugger
745 --encoding ENCODE set the charset encoding (default: ascii)
745 --encoding ENCODE set the charset encoding (default: ascii)
746 --encodingmode MODE set the charset encoding mode (default: strict)
746 --encodingmode MODE set the charset encoding mode (default: strict)
747 --traceback always print a traceback on exception
747 --traceback always print a traceback on exception
748 --time time how long the command takes
748 --time time how long the command takes
749 --profile print command execution profile
749 --profile print command execution profile
750 --version output version information and exit
750 --version output version information and exit
751 -h --help display help and exit
751 -h --help display help and exit
752 --hidden consider hidden changesets
752 --hidden consider hidden changesets
753
753
754 $ hg help -v -e dudu
754 $ hg help -v -e dudu
755 dudu extension -
755 dudu extension -
756
756
757 This is an awesome 'dudu' extension. It does something and also writes 'Beep
757 This is an awesome 'dudu' extension. It does something and also writes 'Beep
758 beep'
758 beep'
759
759
760 list of commands:
760 list of commands:
761
761
762 beep Writes 'Beep beep'
762 beep Writes 'Beep beep'
763 something Does something
763 something Does something
764
764
765 global options ([+] can be repeated):
765 global options ([+] can be repeated):
766
766
767 -R --repository REPO repository root directory or name of overlay bundle
767 -R --repository REPO repository root directory or name of overlay bundle
768 file
768 file
769 --cwd DIR change working directory
769 --cwd DIR change working directory
770 -y --noninteractive do not prompt, automatically pick the first choice for
770 -y --noninteractive do not prompt, automatically pick the first choice for
771 all prompts
771 all prompts
772 -q --quiet suppress output
772 -q --quiet suppress output
773 -v --verbose enable additional output
773 -v --verbose enable additional output
774 --config CONFIG [+] set/override config option (use 'section.name=value')
774 --config CONFIG [+] set/override config option (use 'section.name=value')
775 --debug enable debugging output
775 --debug enable debugging output
776 --debugger start debugger
776 --debugger start debugger
777 --encoding ENCODE set the charset encoding (default: ascii)
777 --encoding ENCODE set the charset encoding (default: ascii)
778 --encodingmode MODE set the charset encoding mode (default: strict)
778 --encodingmode MODE set the charset encoding mode (default: strict)
779 --traceback always print a traceback on exception
779 --traceback always print a traceback on exception
780 --time time how long the command takes
780 --time time how long the command takes
781 --profile print command execution profile
781 --profile print command execution profile
782 --version output version information and exit
782 --version output version information and exit
783 -h --help display help and exit
783 -h --help display help and exit
784 --hidden consider hidden changesets
784 --hidden consider hidden changesets
785
785
786 Disabled extension commands:
786 Disabled extension commands:
787
787
788 $ ORGHGRCPATH=$HGRCPATH
788 $ ORGHGRCPATH=$HGRCPATH
789 $ HGRCPATH=
789 $ HGRCPATH=
790 $ export HGRCPATH
790 $ export HGRCPATH
791 $ hg help email
791 $ hg help email
792 'email' is provided by the following extension:
792 'email' is provided by the following extension:
793
793
794 patchbomb command to send changesets as (a series of) patch emails
794 patchbomb command to send changesets as (a series of) patch emails
795
795
796 (use "hg help extensions" for information on enabling extensions)
796 (use "hg help extensions" for information on enabling extensions)
797
797
798
798
799 $ hg qdel
799 $ hg qdel
800 hg: unknown command 'qdel'
800 hg: unknown command 'qdel'
801 'qdelete' is provided by the following extension:
801 'qdelete' is provided by the following extension:
802
802
803 mq manage a stack of patches
803 mq manage a stack of patches
804
804
805 (use "hg help extensions" for information on enabling extensions)
805 (use "hg help extensions" for information on enabling extensions)
806 [255]
806 [255]
807
807
808
808
809 $ hg churn
809 $ hg churn
810 hg: unknown command 'churn'
810 hg: unknown command 'churn'
811 'churn' is provided by the following extension:
811 'churn' is provided by the following extension:
812
812
813 churn command to display statistics about repository history
813 churn command to display statistics about repository history
814
814
815 (use "hg help extensions" for information on enabling extensions)
815 (use "hg help extensions" for information on enabling extensions)
816 [255]
816 [255]
817
817
818
818
819
819
820 Disabled extensions:
820 Disabled extensions:
821
821
822 $ hg help churn
822 $ hg help churn
823 churn extension - command to display statistics about repository history
823 churn extension - command to display statistics about repository history
824
824
825 (use "hg help extensions" for information on enabling extensions)
825 (use "hg help extensions" for information on enabling extensions)
826
826
827 $ hg help patchbomb
827 $ hg help patchbomb
828 patchbomb extension - command to send changesets as (a series of) patch emails
828 patchbomb extension - command to send changesets as (a series of) patch emails
829
829
830 (use "hg help extensions" for information on enabling extensions)
830 (use "hg help extensions" for information on enabling extensions)
831
831
832
832
833 Broken disabled extension and command:
833 Broken disabled extension and command:
834
834
835 $ mkdir hgext
835 $ mkdir hgext
836 $ echo > hgext/__init__.py
836 $ echo > hgext/__init__.py
837 $ cat > hgext/broken.py <<EOF
837 $ cat > hgext/broken.py <<EOF
838 > "broken extension'
838 > "broken extension'
839 > EOF
839 > EOF
840 $ cat > path.py <<EOF
840 $ cat > path.py <<EOF
841 > import os, sys
841 > import os, sys
842 > sys.path.insert(0, os.environ['HGEXTPATH'])
842 > sys.path.insert(0, os.environ['HGEXTPATH'])
843 > EOF
843 > EOF
844 $ HGEXTPATH=`pwd`
844 $ HGEXTPATH=`pwd`
845 $ export HGEXTPATH
845 $ export HGEXTPATH
846
846
847 $ hg --config extensions.path=./path.py help broken
847 $ hg --config extensions.path=./path.py help broken
848 broken extension - (no help text available)
848 broken extension - (no help text available)
849
849
850 (use "hg help extensions" for information on enabling extensions)
850 (use "hg help extensions" for information on enabling extensions)
851
851
852
852
853 $ cat > hgext/forest.py <<EOF
853 $ cat > hgext/forest.py <<EOF
854 > cmdtable = None
854 > cmdtable = None
855 > EOF
855 > EOF
856 $ hg --config extensions.path=./path.py help foo > /dev/null
856 $ hg --config extensions.path=./path.py help foo > /dev/null
857 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
857 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
858 abort: no such help topic: foo
858 abort: no such help topic: foo
859 (try "hg help --keyword foo")
859 (try "hg help --keyword foo")
860 [255]
860 [255]
861
861
862 $ cat > throw.py <<EOF
862 $ cat > throw.py <<EOF
863 > from mercurial import cmdutil, commands, util
863 > from mercurial import cmdutil, commands, util
864 > cmdtable = {}
864 > cmdtable = {}
865 > command = cmdutil.command(cmdtable)
865 > command = cmdutil.command(cmdtable)
866 > class Bogon(Exception): pass
866 > class Bogon(Exception): pass
867 > @command('throw', [], 'hg throw', norepo=True)
867 > @command('throw', [], 'hg throw', norepo=True)
868 > def throw(ui, **opts):
868 > def throw(ui, **opts):
869 > """throws an exception"""
869 > """throws an exception"""
870 > raise Bogon()
870 > raise Bogon()
871 > EOF
871 > EOF
872
872
873 No declared supported version, extension complains:
873 No declared supported version, extension complains:
874 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
874 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
875 ** Unknown exception encountered with possibly-broken third-party extension throw
875 ** Unknown exception encountered with possibly-broken third-party extension throw
876 ** which supports versions unknown of Mercurial.
876 ** which supports versions unknown of Mercurial.
877 ** Please disable throw and try your action again.
877 ** Please disable throw and try your action again.
878 ** If that fixes the bug please report it to the extension author.
878 ** If that fixes the bug please report it to the extension author.
879 ** Python * (glob)
879 ** Python * (glob)
880 ** Mercurial Distributed SCM * (glob)
880 ** Mercurial Distributed SCM * (glob)
881 ** Extensions loaded: throw
881 ** Extensions loaded: throw
882
882
883 empty declaration of supported version, extension complains:
883 empty declaration of supported version, extension complains:
884 $ echo "testedwith = ''" >> throw.py
884 $ echo "testedwith = ''" >> throw.py
885 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
885 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
886 ** Unknown exception encountered with possibly-broken third-party extension throw
886 ** Unknown exception encountered with possibly-broken third-party extension throw
887 ** which supports versions unknown of Mercurial.
887 ** which supports versions unknown of Mercurial.
888 ** Please disable throw and try your action again.
888 ** Please disable throw and try your action again.
889 ** If that fixes the bug please report it to the extension author.
889 ** If that fixes the bug please report it to the extension author.
890 ** Python * (glob)
890 ** Python * (glob)
891 ** Mercurial Distributed SCM (*) (glob)
891 ** Mercurial Distributed SCM (*) (glob)
892 ** Extensions loaded: throw
892 ** Extensions loaded: throw
893
893
894 If the extension specifies a buglink, show that:
894 If the extension specifies a buglink, show that:
895 $ echo 'buglink = "http://example.com/bts"' >> throw.py
895 $ echo 'buglink = "http://example.com/bts"' >> throw.py
896 $ rm -f throw.pyc throw.pyo
896 $ rm -f throw.pyc throw.pyo
897 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
897 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
898 ** Unknown exception encountered with possibly-broken third-party extension throw
898 ** Unknown exception encountered with possibly-broken third-party extension throw
899 ** which supports versions unknown of Mercurial.
899 ** which supports versions unknown of Mercurial.
900 ** Please disable throw and try your action again.
900 ** Please disable throw and try your action again.
901 ** If that fixes the bug please report it to http://example.com/bts
901 ** If that fixes the bug please report it to http://example.com/bts
902 ** Python * (glob)
902 ** Python * (glob)
903 ** Mercurial Distributed SCM (*) (glob)
903 ** Mercurial Distributed SCM (*) (glob)
904 ** Extensions loaded: throw
904 ** Extensions loaded: throw
905
905
906 If the extensions declare outdated versions, accuse the older extension first:
906 If the extensions declare outdated versions, accuse the older extension first:
907 $ echo "from mercurial import util" >> older.py
907 $ echo "from mercurial import util" >> older.py
908 $ echo "util.version = lambda:'2.2'" >> older.py
908 $ echo "util.version = lambda:'2.2'" >> older.py
909 $ echo "testedwith = '1.9.3'" >> older.py
909 $ echo "testedwith = '1.9.3'" >> older.py
910 $ echo "testedwith = '2.1.1'" >> throw.py
910 $ echo "testedwith = '2.1.1'" >> throw.py
911 $ rm -f throw.pyc throw.pyo
911 $ rm -f throw.pyc throw.pyo
912 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
912 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
913 > throw 2>&1 | egrep '^\*\*'
913 > throw 2>&1 | egrep '^\*\*'
914 ** Unknown exception encountered with possibly-broken third-party extension older
914 ** Unknown exception encountered with possibly-broken third-party extension older
915 ** which supports versions 1.9 of Mercurial.
915 ** which supports versions 1.9 of Mercurial.
916 ** Please disable older and try your action again.
916 ** Please disable older and try your action again.
917 ** If that fixes the bug please report it to the extension author.
917 ** If that fixes the bug please report it to the extension author.
918 ** Python * (glob)
918 ** Python * (glob)
919 ** Mercurial Distributed SCM (version 2.2)
919 ** Mercurial Distributed SCM (version 2.2)
920 ** Extensions loaded: throw, older
920 ** Extensions loaded: throw, older
921
921
922 One extension only tested with older, one only with newer versions:
922 One extension only tested with older, one only with newer versions:
923 $ echo "util.version = lambda:'2.1'" >> older.py
923 $ echo "util.version = lambda:'2.1'" >> older.py
924 $ rm -f older.pyc older.pyo
924 $ rm -f older.pyc older.pyo
925 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
925 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
926 > throw 2>&1 | egrep '^\*\*'
926 > throw 2>&1 | egrep '^\*\*'
927 ** Unknown exception encountered with possibly-broken third-party extension older
927 ** Unknown exception encountered with possibly-broken third-party extension older
928 ** which supports versions 1.9 of Mercurial.
928 ** which supports versions 1.9 of Mercurial.
929 ** Please disable older and try your action again.
929 ** Please disable older and try your action again.
930 ** If that fixes the bug please report it to the extension author.
930 ** If that fixes the bug please report it to the extension author.
931 ** Python * (glob)
931 ** Python * (glob)
932 ** Mercurial Distributed SCM (version 2.1)
932 ** Mercurial Distributed SCM (version 2.1)
933 ** Extensions loaded: throw, older
933 ** Extensions loaded: throw, older
934
934
935 Older extension is tested with current version, the other only with newer:
935 Older extension is tested with current version, the other only with newer:
936 $ echo "util.version = lambda:'1.9.3'" >> older.py
936 $ echo "util.version = lambda:'1.9.3'" >> older.py
937 $ rm -f older.pyc older.pyo
937 $ rm -f older.pyc older.pyo
938 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
938 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
939 > throw 2>&1 | egrep '^\*\*'
939 > throw 2>&1 | egrep '^\*\*'
940 ** Unknown exception encountered with possibly-broken third-party extension throw
940 ** Unknown exception encountered with possibly-broken third-party extension throw
941 ** which supports versions 2.1 of Mercurial.
941 ** which supports versions 2.1 of Mercurial.
942 ** Please disable throw and try your action again.
942 ** Please disable throw and try your action again.
943 ** If that fixes the bug please report it to http://example.com/bts
943 ** If that fixes the bug please report it to http://example.com/bts
944 ** Python * (glob)
944 ** Python * (glob)
945 ** Mercurial Distributed SCM (version 1.9.3)
945 ** Mercurial Distributed SCM (version 1.9.3)
946 ** Extensions loaded: throw, older
946 ** Extensions loaded: throw, older
947
947
948 Ability to point to a different point
948 Ability to point to a different point
949 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
949 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
950 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
950 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
951 ** unknown exception encountered, please report by visiting
951 ** unknown exception encountered, please report by visiting
952 ** Your Local Goat Lenders
952 ** Your Local Goat Lenders
953 ** Python * (glob)
953 ** Python * (glob)
954 ** Mercurial Distributed SCM (*) (glob)
954 ** Mercurial Distributed SCM (*) (glob)
955 ** Extensions loaded: throw, older
955 ** Extensions loaded: throw, older
956
956
957 Declare the version as supporting this hg version, show regular bts link:
957 Declare the version as supporting this hg version, show regular bts link:
958 $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'`
958 $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'`
959 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
959 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
960 $ if [ -z "$hgver" ]; then
960 $ if [ -z "$hgver" ]; then
961 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
961 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
962 > fi
962 > fi
963 $ rm -f throw.pyc throw.pyo
963 $ rm -f throw.pyc throw.pyo
964 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
964 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
965 ** unknown exception encountered, please report by visiting
965 ** unknown exception encountered, please report by visiting
966 ** https://mercurial-scm.org/wiki/BugTracker
966 ** https://mercurial-scm.org/wiki/BugTracker
967 ** Python * (glob)
967 ** Python * (glob)
968 ** Mercurial Distributed SCM (*) (glob)
968 ** Mercurial Distributed SCM (*) (glob)
969 ** Extensions loaded: throw
969 ** Extensions loaded: throw
970
970
971 Patch version is ignored during compatibility check
971 Patch version is ignored during compatibility check
972 $ echo "testedwith = '3.2'" >> throw.py
972 $ echo "testedwith = '3.2'" >> throw.py
973 $ echo "util.version = lambda:'3.2.2'" >> throw.py
973 $ echo "util.version = lambda:'3.2.2'" >> throw.py
974 $ rm -f throw.pyc throw.pyo
974 $ rm -f throw.pyc throw.pyo
975 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
975 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
976 ** unknown exception encountered, please report by visiting
976 ** unknown exception encountered, please report by visiting
977 ** https://mercurial-scm.org/wiki/BugTracker
977 ** https://mercurial-scm.org/wiki/BugTracker
978 ** Python * (glob)
978 ** Python * (glob)
979 ** Mercurial Distributed SCM (*) (glob)
979 ** Mercurial Distributed SCM (*) (glob)
980 ** Extensions loaded: throw
980 ** Extensions loaded: throw
981
981
982 Test version number support in 'hg version':
982 Test version number support in 'hg version':
983 $ echo '__version__ = (1, 2, 3)' >> throw.py
983 $ echo '__version__ = (1, 2, 3)' >> throw.py
984 $ rm -f throw.pyc throw.pyo
984 $ rm -f throw.pyc throw.pyo
985 $ hg version -v
985 $ hg version -v
986 Mercurial Distributed SCM (version *) (glob)
986 Mercurial Distributed SCM (version *) (glob)
987 (see https://mercurial-scm.org for more information)
987 (see https://mercurial-scm.org for more information)
988
988
989 Copyright (C) 2005-* Matt Mackall and others (glob)
989 Copyright (C) 2005-* Matt Mackall and others (glob)
990 This is free software; see the source for copying conditions. There is NO
990 This is free software; see the source for copying conditions. There is NO
991 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
991 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
992
992
993 Enabled extensions:
993 Enabled extensions:
994
994
995
995
996 $ hg version -v --config extensions.throw=throw.py
996 $ hg version -v --config extensions.throw=throw.py
997 Mercurial Distributed SCM (version *) (glob)
997 Mercurial Distributed SCM (version *) (glob)
998 (see https://mercurial-scm.org for more information)
998 (see https://mercurial-scm.org for more information)
999
999
1000 Copyright (C) 2005-* Matt Mackall and others (glob)
1000 Copyright (C) 2005-* Matt Mackall and others (glob)
1001 This is free software; see the source for copying conditions. There is NO
1001 This is free software; see the source for copying conditions. There is NO
1002 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1002 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1003
1003
1004 Enabled extensions:
1004 Enabled extensions:
1005
1005
1006 throw 1.2.3
1006 throw 1.2.3
1007 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
1007 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
1008 $ rm -f throw.pyc throw.pyo
1008 $ rm -f throw.pyc throw.pyo
1009 $ hg version -v --config extensions.throw=throw.py
1009 $ hg version -v --config extensions.throw=throw.py
1010 Mercurial Distributed SCM (version *) (glob)
1010 Mercurial Distributed SCM (version *) (glob)
1011 (see https://mercurial-scm.org for more information)
1011 (see https://mercurial-scm.org for more information)
1012
1012
1013 Copyright (C) 2005-* Matt Mackall and others (glob)
1013 Copyright (C) 2005-* Matt Mackall and others (glob)
1014 This is free software; see the source for copying conditions. There is NO
1014 This is free software; see the source for copying conditions. There is NO
1015 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1015 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1016
1016
1017 Enabled extensions:
1017 Enabled extensions:
1018
1018
1019 throw 1.twentythree
1019 throw 1.twentythree
1020
1020
1021 Refuse to load extensions with minimum version requirements
1021 Refuse to load extensions with minimum version requirements
1022
1022
1023 $ cat > minversion1.py << EOF
1023 $ cat > minversion1.py << EOF
1024 > from mercurial import util
1024 > from mercurial import util
1025 > util.version = lambda: '3.5.2'
1025 > util.version = lambda: '3.5.2'
1026 > minimumhgversion = '3.6'
1026 > minimumhgversion = '3.6'
1027 > EOF
1027 > EOF
1028 $ hg --config extensions.minversion=minversion1.py version
1028 $ hg --config extensions.minversion=minversion1.py version
1029 (third party extension minversion requires version 3.6 or newer of Mercurial; disabling)
1029 (third party extension minversion requires version 3.6 or newer of Mercurial; disabling)
1030 Mercurial Distributed SCM (version 3.5.2)
1030 Mercurial Distributed SCM (version 3.5.2)
1031 (see https://mercurial-scm.org for more information)
1031 (see https://mercurial-scm.org for more information)
1032
1032
1033 Copyright (C) 2005-* Matt Mackall and others (glob)
1033 Copyright (C) 2005-* Matt Mackall and others (glob)
1034 This is free software; see the source for copying conditions. There is NO
1034 This is free software; see the source for copying conditions. There is NO
1035 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1035 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1036
1036
1037 $ cat > minversion2.py << EOF
1037 $ cat > minversion2.py << EOF
1038 > from mercurial import util
1038 > from mercurial import util
1039 > util.version = lambda: '3.6'
1039 > util.version = lambda: '3.6'
1040 > minimumhgversion = '3.7'
1040 > minimumhgversion = '3.7'
1041 > EOF
1041 > EOF
1042 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1042 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1043 (third party extension minversion requires version 3.7 or newer of Mercurial; disabling)
1043 (third party extension minversion requires version 3.7 or newer of Mercurial; disabling)
1044
1044
1045 Can load version that is only off by point release
1045 Can load version that is only off by point release
1046
1046
1047 $ cat > minversion2.py << EOF
1047 $ cat > minversion2.py << EOF
1048 > from mercurial import util
1048 > from mercurial import util
1049 > util.version = lambda: '3.6.1'
1049 > util.version = lambda: '3.6.1'
1050 > minimumhgversion = '3.6'
1050 > minimumhgversion = '3.6'
1051 > EOF
1051 > EOF
1052 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1052 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1053 [1]
1053 [1]
1054
1054
1055 Can load minimum version identical to current
1055 Can load minimum version identical to current
1056
1056
1057 $ cat > minversion3.py << EOF
1057 $ cat > minversion3.py << EOF
1058 > from mercurial import util
1058 > from mercurial import util
1059 > util.version = lambda: '3.5'
1059 > util.version = lambda: '3.5'
1060 > minimumhgversion = '3.5'
1060 > minimumhgversion = '3.5'
1061 > EOF
1061 > EOF
1062 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1062 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1063 [1]
1063 [1]
1064
1064
1065 Restore HGRCPATH
1065 Restore HGRCPATH
1066
1066
1067 $ HGRCPATH=$ORGHGRCPATH
1067 $ HGRCPATH=$ORGHGRCPATH
1068 $ export HGRCPATH
1068 $ export HGRCPATH
1069
1069
1070 Commands handling multiple repositories at a time should invoke only
1070 Commands handling multiple repositories at a time should invoke only
1071 "reposetup()" of extensions enabling in the target repository.
1071 "reposetup()" of extensions enabling in the target repository.
1072
1072
1073 $ mkdir reposetup-test
1073 $ mkdir reposetup-test
1074 $ cd reposetup-test
1074 $ cd reposetup-test
1075
1075
1076 $ cat > $TESTTMP/reposetuptest.py <<EOF
1076 $ cat > $TESTTMP/reposetuptest.py <<EOF
1077 > from mercurial import extensions
1077 > from mercurial import extensions
1078 > def reposetup(ui, repo):
1078 > def reposetup(ui, repo):
1079 > ui.write('reposetup() for %s\n' % (repo.root))
1079 > ui.write('reposetup() for %s\n' % (repo.root))
1080 > EOF
1080 > EOF
1081 $ hg init src
1081 $ hg init src
1082 $ echo a > src/a
1082 $ echo a > src/a
1083 $ hg -R src commit -Am '#0 at src/a'
1083 $ hg -R src commit -Am '#0 at src/a'
1084 adding a
1084 adding a
1085 $ echo '[extensions]' >> src/.hg/hgrc
1085 $ echo '[extensions]' >> src/.hg/hgrc
1086 $ echo '# enable extension locally' >> src/.hg/hgrc
1086 $ echo '# enable extension locally' >> src/.hg/hgrc
1087 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1087 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1088 $ hg -R src status
1088 $ hg -R src status
1089 reposetup() for $TESTTMP/reposetup-test/src (glob)
1089 reposetup() for $TESTTMP/reposetup-test/src (glob)
1090
1090
1091 $ hg clone -U src clone-dst1
1091 $ hg clone -U src clone-dst1
1092 reposetup() for $TESTTMP/reposetup-test/src (glob)
1092 reposetup() for $TESTTMP/reposetup-test/src (glob)
1093 $ hg init push-dst1
1093 $ hg init push-dst1
1094 $ hg -q -R src push push-dst1
1094 $ hg -q -R src push push-dst1
1095 reposetup() for $TESTTMP/reposetup-test/src (glob)
1095 reposetup() for $TESTTMP/reposetup-test/src (glob)
1096 $ hg init pull-src1
1096 $ hg init pull-src1
1097 $ hg -q -R pull-src1 pull src
1097 $ hg -q -R pull-src1 pull src
1098 reposetup() for $TESTTMP/reposetup-test/src (glob)
1098 reposetup() for $TESTTMP/reposetup-test/src (glob)
1099
1099
1100 $ cat <<EOF >> $HGRCPATH
1100 $ cat <<EOF >> $HGRCPATH
1101 > [extensions]
1101 > [extensions]
1102 > # disable extension globally and explicitly
1102 > # disable extension globally and explicitly
1103 > reposetuptest = !
1103 > reposetuptest = !
1104 > EOF
1104 > EOF
1105 $ hg clone -U src clone-dst2
1105 $ hg clone -U src clone-dst2
1106 reposetup() for $TESTTMP/reposetup-test/src (glob)
1106 reposetup() for $TESTTMP/reposetup-test/src (glob)
1107 $ hg init push-dst2
1107 $ hg init push-dst2
1108 $ hg -q -R src push push-dst2
1108 $ hg -q -R src push push-dst2
1109 reposetup() for $TESTTMP/reposetup-test/src (glob)
1109 reposetup() for $TESTTMP/reposetup-test/src (glob)
1110 $ hg init pull-src2
1110 $ hg init pull-src2
1111 $ hg -q -R pull-src2 pull src
1111 $ hg -q -R pull-src2 pull src
1112 reposetup() for $TESTTMP/reposetup-test/src (glob)
1112 reposetup() for $TESTTMP/reposetup-test/src (glob)
1113
1113
1114 $ cat <<EOF >> $HGRCPATH
1114 $ cat <<EOF >> $HGRCPATH
1115 > [extensions]
1115 > [extensions]
1116 > # enable extension globally
1116 > # enable extension globally
1117 > reposetuptest = $TESTTMP/reposetuptest.py
1117 > reposetuptest = $TESTTMP/reposetuptest.py
1118 > EOF
1118 > EOF
1119 $ hg clone -U src clone-dst3
1119 $ hg clone -U src clone-dst3
1120 reposetup() for $TESTTMP/reposetup-test/src (glob)
1120 reposetup() for $TESTTMP/reposetup-test/src (glob)
1121 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
1121 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
1122 $ hg init push-dst3
1122 $ hg init push-dst3
1123 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1123 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1124 $ hg -q -R src push push-dst3
1124 $ hg -q -R src push push-dst3
1125 reposetup() for $TESTTMP/reposetup-test/src (glob)
1125 reposetup() for $TESTTMP/reposetup-test/src (glob)
1126 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1126 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1127 $ hg init pull-src3
1127 $ hg init pull-src3
1128 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1128 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1129 $ hg -q -R pull-src3 pull src
1129 $ hg -q -R pull-src3 pull src
1130 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1130 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1131 reposetup() for $TESTTMP/reposetup-test/src (glob)
1131 reposetup() for $TESTTMP/reposetup-test/src (glob)
1132
1132
1133 $ echo '[extensions]' >> src/.hg/hgrc
1133 $ echo '[extensions]' >> src/.hg/hgrc
1134 $ echo '# disable extension locally' >> src/.hg/hgrc
1134 $ echo '# disable extension locally' >> src/.hg/hgrc
1135 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1135 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1136 $ hg clone -U src clone-dst4
1136 $ hg clone -U src clone-dst4
1137 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
1137 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
1138 $ hg init push-dst4
1138 $ hg init push-dst4
1139 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1139 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1140 $ hg -q -R src push push-dst4
1140 $ hg -q -R src push push-dst4
1141 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1141 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1142 $ hg init pull-src4
1142 $ hg init pull-src4
1143 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1143 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1144 $ hg -q -R pull-src4 pull src
1144 $ hg -q -R pull-src4 pull src
1145 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1145 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1146
1146
1147 disabling in command line overlays with all configuration
1147 disabling in command line overlays with all configuration
1148 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1148 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1149 $ hg --config extensions.reposetuptest=! init push-dst5
1149 $ hg --config extensions.reposetuptest=! init push-dst5
1150 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1150 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1151 $ hg --config extensions.reposetuptest=! init pull-src5
1151 $ hg --config extensions.reposetuptest=! init pull-src5
1152 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1152 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1153
1153
1154 $ cat <<EOF >> $HGRCPATH
1154 $ cat <<EOF >> $HGRCPATH
1155 > [extensions]
1155 > [extensions]
1156 > # disable extension globally and explicitly
1156 > # disable extension globally and explicitly
1157 > reposetuptest = !
1157 > reposetuptest = !
1158 > EOF
1158 > EOF
1159 $ hg init parent
1159 $ hg init parent
1160 $ hg init parent/sub1
1160 $ hg init parent/sub1
1161 $ echo 1 > parent/sub1/1
1161 $ echo 1 > parent/sub1/1
1162 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1162 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1163 adding 1
1163 adding 1
1164 $ hg init parent/sub2
1164 $ hg init parent/sub2
1165 $ hg init parent/sub2/sub21
1165 $ hg init parent/sub2/sub21
1166 $ echo 21 > parent/sub2/sub21/21
1166 $ echo 21 > parent/sub2/sub21/21
1167 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1167 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1168 adding 21
1168 adding 21
1169 $ cat > parent/sub2/.hgsub <<EOF
1169 $ cat > parent/sub2/.hgsub <<EOF
1170 > sub21 = sub21
1170 > sub21 = sub21
1171 > EOF
1171 > EOF
1172 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1172 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1173 adding .hgsub
1173 adding .hgsub
1174 $ hg init parent/sub3
1174 $ hg init parent/sub3
1175 $ echo 3 > parent/sub3/3
1175 $ echo 3 > parent/sub3/3
1176 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1176 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1177 adding 3
1177 adding 3
1178 $ cat > parent/.hgsub <<EOF
1178 $ cat > parent/.hgsub <<EOF
1179 > sub1 = sub1
1179 > sub1 = sub1
1180 > sub2 = sub2
1180 > sub2 = sub2
1181 > sub3 = sub3
1181 > sub3 = sub3
1182 > EOF
1182 > EOF
1183 $ hg -R parent commit -Am '#0 at parent'
1183 $ hg -R parent commit -Am '#0 at parent'
1184 adding .hgsub
1184 adding .hgsub
1185 $ echo '[extensions]' >> parent/.hg/hgrc
1185 $ echo '[extensions]' >> parent/.hg/hgrc
1186 $ echo '# enable extension locally' >> parent/.hg/hgrc
1186 $ echo '# enable extension locally' >> parent/.hg/hgrc
1187 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1187 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1188 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1188 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1189 $ hg -R parent status -S -A
1189 $ hg -R parent status -S -A
1190 reposetup() for $TESTTMP/reposetup-test/parent (glob)
1190 reposetup() for $TESTTMP/reposetup-test/parent (glob)
1191 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
1191 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
1192 C .hgsub
1192 C .hgsub
1193 C .hgsubstate
1193 C .hgsubstate
1194 C sub1/1
1194 C sub1/1
1195 C sub2/.hgsub
1195 C sub2/.hgsub
1196 C sub2/.hgsubstate
1196 C sub2/.hgsubstate
1197 C sub2/sub21/21
1197 C sub2/sub21/21
1198 C sub3/3
1198 C sub3/3
1199
1199
1200 $ cd ..
1200 $ cd ..
1201
1201
1202 Test synopsis and docstring extending
1202 Test synopsis and docstring extending
1203
1203
1204 $ hg init exthelp
1204 $ hg init exthelp
1205 $ cat > exthelp.py <<EOF
1205 $ cat > exthelp.py <<EOF
1206 > from mercurial import commands, extensions
1206 > from mercurial import commands, extensions
1207 > def exbookmarks(orig, *args, **opts):
1207 > def exbookmarks(orig, *args, **opts):
1208 > return orig(*args, **opts)
1208 > return orig(*args, **opts)
1209 > def uisetup(ui):
1209 > def uisetup(ui):
1210 > synopsis = ' GREPME [--foo] [-x]'
1210 > synopsis = ' GREPME [--foo] [-x]'
1211 > docstring = '''
1211 > docstring = '''
1212 > GREPME make sure that this is in the help!
1212 > GREPME make sure that this is in the help!
1213 > '''
1213 > '''
1214 > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
1214 > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
1215 > synopsis, docstring)
1215 > synopsis, docstring)
1216 > EOF
1216 > EOF
1217 $ abspath=`pwd`/exthelp.py
1217 $ abspath=`pwd`/exthelp.py
1218 $ echo '[extensions]' >> $HGRCPATH
1218 $ echo '[extensions]' >> $HGRCPATH
1219 $ echo "exthelp = $abspath" >> $HGRCPATH
1219 $ echo "exthelp = $abspath" >> $HGRCPATH
1220 $ cd exthelp
1220 $ cd exthelp
1221 $ hg help bookmarks | grep GREPME
1221 $ hg help bookmarks | grep GREPME
1222 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1222 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1223 GREPME make sure that this is in the help!
1223 GREPME make sure that this is in the help!
1224
1224
@@ -1,2986 +1,2986 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use "hg help" for the full list of commands or "hg -v" for details)
26 (use "hg help" for the full list of commands or "hg -v" for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a changegroup file
61 bundle create a changegroup file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 files list tracked files
69 files list tracked files
70 forget forget the specified files on the next commit
70 forget forget the specified files on the next commit
71 graft copy changes from other branches onto the current branch
71 graft copy changes from other branches onto the current branch
72 grep search for a pattern in specified files and revisions
72 grep search for a pattern in specified files and revisions
73 heads show branch heads
73 heads show branch heads
74 help show help for a given topic or a help overview
74 help show help for a given topic or a help overview
75 identify identify the working directory or specified revision
75 identify identify the working directory or specified revision
76 import import an ordered set of patches
76 import import an ordered set of patches
77 incoming show new changesets found in source
77 incoming show new changesets found in source
78 init create a new repository in the given directory
78 init create a new repository in the given directory
79 log show revision history of entire repository or files
79 log show revision history of entire repository or files
80 manifest output the current or given revision of the project manifest
80 manifest output the current or given revision of the project manifest
81 merge merge another revision into working directory
81 merge merge another revision into working directory
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 status show changed files in the working directory
94 status show changed files in the working directory
95 summary summarize working directory state
95 summary summarize working directory state
96 tag add one or more tags for the current or given revision
96 tag add one or more tags for the current or given revision
97 tags list repository tags
97 tags list repository tags
98 unbundle apply one or more changegroup files
98 unbundle apply one or more changegroup files
99 update update working directory (or switch revisions)
99 update update working directory (or switch revisions)
100 verify verify the integrity of the repository
100 verify verify the integrity of the repository
101 version output version and copyright information
101 version output version and copyright information
102
102
103 additional help topics:
103 additional help topics:
104
104
105 config Configuration Files
105 config Configuration Files
106 dates Date Formats
106 dates Date Formats
107 diffs Diff Formats
107 diffs Diff Formats
108 environment Environment Variables
108 environment Environment Variables
109 extensions Using Additional Features
109 extensions Using Additional Features
110 filesets Specifying File Sets
110 filesets Specifying File Sets
111 glossary Glossary
111 glossary Glossary
112 hgignore Syntax for Mercurial Ignore Files
112 hgignore Syntax for Mercurial Ignore Files
113 hgweb Configuring hgweb
113 hgweb Configuring hgweb
114 internals Technical implementation topics
114 internals Technical implementation topics
115 merge-tools Merge Tools
115 merge-tools Merge Tools
116 multirevs Specifying Multiple Revisions
116 multirevs Specifying Multiple Revisions
117 patterns File Name Patterns
117 patterns File Name Patterns
118 phases Working with Phases
118 phases Working with Phases
119 revisions Specifying Single Revisions
119 revisions Specifying Single Revisions
120 revsets Specifying Revision Sets
120 revsets Specifying Revision Sets
121 scripting Using Mercurial from scripts and automation
121 scripting Using Mercurial from scripts and automation
122 subrepos Subrepositories
122 subrepos Subrepositories
123 templating Template Usage
123 templating Template Usage
124 urls URL Paths
124 urls URL Paths
125
125
126 (use "hg help -v" to show built-in aliases and global options)
126 (use "hg help -v" to show built-in aliases and global options)
127
127
128 $ hg -q help
128 $ hg -q help
129 add add the specified files on the next commit
129 add add the specified files on the next commit
130 addremove add all new files, delete all missing files
130 addremove add all new files, delete all missing files
131 annotate show changeset information by line for each file
131 annotate show changeset information by line for each file
132 archive create an unversioned archive of a repository revision
132 archive create an unversioned archive of a repository revision
133 backout reverse effect of earlier changeset
133 backout reverse effect of earlier changeset
134 bisect subdivision search of changesets
134 bisect subdivision search of changesets
135 bookmarks create a new bookmark or list existing bookmarks
135 bookmarks create a new bookmark or list existing bookmarks
136 branch set or show the current branch name
136 branch set or show the current branch name
137 branches list repository named branches
137 branches list repository named branches
138 bundle create a changegroup file
138 bundle create a changegroup file
139 cat output the current or given revision of files
139 cat output the current or given revision of files
140 clone make a copy of an existing repository
140 clone make a copy of an existing repository
141 commit commit the specified files or all outstanding changes
141 commit commit the specified files or all outstanding changes
142 config show combined config settings from all hgrc files
142 config show combined config settings from all hgrc files
143 copy mark files as copied for the next commit
143 copy mark files as copied for the next commit
144 diff diff repository (or selected files)
144 diff diff repository (or selected files)
145 export dump the header and diffs for one or more changesets
145 export dump the header and diffs for one or more changesets
146 files list tracked files
146 files list tracked files
147 forget forget the specified files on the next commit
147 forget forget the specified files on the next commit
148 graft copy changes from other branches onto the current branch
148 graft copy changes from other branches onto the current branch
149 grep search for a pattern in specified files and revisions
149 grep search for a pattern in specified files and revisions
150 heads show branch heads
150 heads show branch heads
151 help show help for a given topic or a help overview
151 help show help for a given topic or a help overview
152 identify identify the working directory or specified revision
152 identify identify the working directory or specified revision
153 import import an ordered set of patches
153 import import an ordered set of patches
154 incoming show new changesets found in source
154 incoming show new changesets found in source
155 init create a new repository in the given directory
155 init create a new repository in the given directory
156 log show revision history of entire repository or files
156 log show revision history of entire repository or files
157 manifest output the current or given revision of the project manifest
157 manifest output the current or given revision of the project manifest
158 merge merge another revision into working directory
158 merge merge another revision into working directory
159 outgoing show changesets not found in the destination
159 outgoing show changesets not found in the destination
160 paths show aliases for remote repositories
160 paths show aliases for remote repositories
161 phase set or show the current phase name
161 phase set or show the current phase name
162 pull pull changes from the specified source
162 pull pull changes from the specified source
163 push push changes to the specified destination
163 push push changes to the specified destination
164 recover roll back an interrupted transaction
164 recover roll back an interrupted transaction
165 remove remove the specified files on the next commit
165 remove remove the specified files on the next commit
166 rename rename files; equivalent of copy + remove
166 rename rename files; equivalent of copy + remove
167 resolve redo merges or set/view the merge status of files
167 resolve redo merges or set/view the merge status of files
168 revert restore files to their checkout state
168 revert restore files to their checkout state
169 root print the root (top) of the current working directory
169 root print the root (top) of the current working directory
170 serve start stand-alone webserver
170 serve start stand-alone webserver
171 status show changed files in the working directory
171 status show changed files in the working directory
172 summary summarize working directory state
172 summary summarize working directory state
173 tag add one or more tags for the current or given revision
173 tag add one or more tags for the current or given revision
174 tags list repository tags
174 tags list repository tags
175 unbundle apply one or more changegroup files
175 unbundle apply one or more changegroup files
176 update update working directory (or switch revisions)
176 update update working directory (or switch revisions)
177 verify verify the integrity of the repository
177 verify verify the integrity of the repository
178 version output version and copyright information
178 version output version and copyright information
179
179
180 additional help topics:
180 additional help topics:
181
181
182 config Configuration Files
182 config Configuration Files
183 dates Date Formats
183 dates Date Formats
184 diffs Diff Formats
184 diffs Diff Formats
185 environment Environment Variables
185 environment Environment Variables
186 extensions Using Additional Features
186 extensions Using Additional Features
187 filesets Specifying File Sets
187 filesets Specifying File Sets
188 glossary Glossary
188 glossary Glossary
189 hgignore Syntax for Mercurial Ignore Files
189 hgignore Syntax for Mercurial Ignore Files
190 hgweb Configuring hgweb
190 hgweb Configuring hgweb
191 internals Technical implementation topics
191 internals Technical implementation topics
192 merge-tools Merge Tools
192 merge-tools Merge Tools
193 multirevs Specifying Multiple Revisions
193 multirevs Specifying Multiple Revisions
194 patterns File Name Patterns
194 patterns File Name Patterns
195 phases Working with Phases
195 phases Working with Phases
196 revisions Specifying Single Revisions
196 revisions Specifying Single Revisions
197 revsets Specifying Revision Sets
197 revsets Specifying Revision Sets
198 scripting Using Mercurial from scripts and automation
198 scripting Using Mercurial from scripts and automation
199 subrepos Subrepositories
199 subrepos Subrepositories
200 templating Template Usage
200 templating Template Usage
201 urls URL Paths
201 urls URL Paths
202
202
203 Test extension help:
203 Test extension help:
204 $ hg help extensions --config extensions.rebase= --config extensions.children=
204 $ hg help extensions --config extensions.rebase= --config extensions.children=
205 Using Additional Features
205 Using Additional Features
206 """""""""""""""""""""""""
206 """""""""""""""""""""""""
207
207
208 Mercurial has the ability to add new features through the use of
208 Mercurial has the ability to add new features through the use of
209 extensions. Extensions may add new commands, add options to existing
209 extensions. Extensions may add new commands, add options to existing
210 commands, change the default behavior of commands, or implement hooks.
210 commands, change the default behavior of commands, or implement hooks.
211
211
212 To enable the "foo" extension, either shipped with Mercurial or in the
212 To enable the "foo" extension, either shipped with Mercurial or in the
213 Python search path, create an entry for it in your configuration file,
213 Python search path, create an entry for it in your configuration file,
214 like this:
214 like this:
215
215
216 [extensions]
216 [extensions]
217 foo =
217 foo =
218
218
219 You may also specify the full path to an extension:
219 You may also specify the full path to an extension:
220
220
221 [extensions]
221 [extensions]
222 myfeature = ~/.hgext/myfeature.py
222 myfeature = ~/.hgext/myfeature.py
223
223
224 See "hg help config" for more information on configuration files.
224 See 'hg help config' for more information on configuration files.
225
225
226 Extensions are not loaded by default for a variety of reasons: they can
226 Extensions are not loaded by default for a variety of reasons: they can
227 increase startup overhead; they may be meant for advanced usage only; they
227 increase startup overhead; they may be meant for advanced usage only; they
228 may provide potentially dangerous abilities (such as letting you destroy
228 may provide potentially dangerous abilities (such as letting you destroy
229 or modify history); they might not be ready for prime time; or they may
229 or modify history); they might not be ready for prime time; or they may
230 alter some usual behaviors of stock Mercurial. It is thus up to the user
230 alter some usual behaviors of stock Mercurial. It is thus up to the user
231 to activate extensions as needed.
231 to activate extensions as needed.
232
232
233 To explicitly disable an extension enabled in a configuration file of
233 To explicitly disable an extension enabled in a configuration file of
234 broader scope, prepend its path with !:
234 broader scope, prepend its path with !:
235
235
236 [extensions]
236 [extensions]
237 # disabling extension bar residing in /path/to/extension/bar.py
237 # disabling extension bar residing in /path/to/extension/bar.py
238 bar = !/path/to/extension/bar.py
238 bar = !/path/to/extension/bar.py
239 # ditto, but no path was supplied for extension baz
239 # ditto, but no path was supplied for extension baz
240 baz = !
240 baz = !
241
241
242 enabled extensions:
242 enabled extensions:
243
243
244 children command to display child changesets (DEPRECATED)
244 children command to display child changesets (DEPRECATED)
245 rebase command to move sets of revisions to a different ancestor
245 rebase command to move sets of revisions to a different ancestor
246
246
247 disabled extensions:
247 disabled extensions:
248
248
249 acl hooks for controlling repository access
249 acl hooks for controlling repository access
250 blackbox log repository events to a blackbox for debugging
250 blackbox log repository events to a blackbox for debugging
251 bugzilla hooks for integrating with the Bugzilla bug tracker
251 bugzilla hooks for integrating with the Bugzilla bug tracker
252 censor erase file content at a given revision
252 censor erase file content at a given revision
253 churn command to display statistics about repository history
253 churn command to display statistics about repository history
254 clonebundles advertise pre-generated bundles to seed clones
254 clonebundles advertise pre-generated bundles to seed clones
255 (experimental)
255 (experimental)
256 color colorize output from some commands
256 color colorize output from some commands
257 convert import revisions from foreign VCS repositories into
257 convert import revisions from foreign VCS repositories into
258 Mercurial
258 Mercurial
259 eol automatically manage newlines in repository files
259 eol automatically manage newlines in repository files
260 extdiff command to allow external programs to compare revisions
260 extdiff command to allow external programs to compare revisions
261 factotum http authentication with factotum
261 factotum http authentication with factotum
262 gpg commands to sign and verify changesets
262 gpg commands to sign and verify changesets
263 hgcia hooks for integrating with the CIA.vc notification service
263 hgcia hooks for integrating with the CIA.vc notification service
264 hgk browse the repository in a graphical way
264 hgk browse the repository in a graphical way
265 highlight syntax highlighting for hgweb (requires Pygments)
265 highlight syntax highlighting for hgweb (requires Pygments)
266 histedit interactive history editing
266 histedit interactive history editing
267 keyword expand keywords in tracked files
267 keyword expand keywords in tracked files
268 largefiles track large binary files
268 largefiles track large binary files
269 mq manage a stack of patches
269 mq manage a stack of patches
270 notify hooks for sending email push notifications
270 notify hooks for sending email push notifications
271 pager browse command output with an external pager
271 pager browse command output with an external pager
272 patchbomb command to send changesets as (a series of) patch emails
272 patchbomb command to send changesets as (a series of) patch emails
273 purge command to delete untracked files from the working
273 purge command to delete untracked files from the working
274 directory
274 directory
275 record commands to interactively select changes for
275 record commands to interactively select changes for
276 commit/qrefresh
276 commit/qrefresh
277 relink recreates hardlinks between repository clones
277 relink recreates hardlinks between repository clones
278 schemes extend schemes with shortcuts to repository swarms
278 schemes extend schemes with shortcuts to repository swarms
279 share share a common history between several working directories
279 share share a common history between several working directories
280 shelve save and restore changes to the working directory
280 shelve save and restore changes to the working directory
281 strip strip changesets and their descendants from history
281 strip strip changesets and their descendants from history
282 transplant command to transplant changesets from another branch
282 transplant command to transplant changesets from another branch
283 win32mbcs allow the use of MBCS paths with problematic encodings
283 win32mbcs allow the use of MBCS paths with problematic encodings
284 zeroconf discover and advertise repositories on the local network
284 zeroconf discover and advertise repositories on the local network
285
285
286 Verify that extension keywords appear in help templates
286 Verify that extension keywords appear in help templates
287
287
288 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
288 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
289
289
290 Test short command list with verbose option
290 Test short command list with verbose option
291
291
292 $ hg -v help shortlist
292 $ hg -v help shortlist
293 Mercurial Distributed SCM
293 Mercurial Distributed SCM
294
294
295 basic commands:
295 basic commands:
296
296
297 add add the specified files on the next commit
297 add add the specified files on the next commit
298 annotate, blame
298 annotate, blame
299 show changeset information by line for each file
299 show changeset information by line for each file
300 clone make a copy of an existing repository
300 clone make a copy of an existing repository
301 commit, ci commit the specified files or all outstanding changes
301 commit, ci commit the specified files or all outstanding changes
302 diff diff repository (or selected files)
302 diff diff repository (or selected files)
303 export dump the header and diffs for one or more changesets
303 export dump the header and diffs for one or more changesets
304 forget forget the specified files on the next commit
304 forget forget the specified files on the next commit
305 init create a new repository in the given directory
305 init create a new repository in the given directory
306 log, history show revision history of entire repository or files
306 log, history show revision history of entire repository or files
307 merge merge another revision into working directory
307 merge merge another revision into working directory
308 pull pull changes from the specified source
308 pull pull changes from the specified source
309 push push changes to the specified destination
309 push push changes to the specified destination
310 remove, rm remove the specified files on the next commit
310 remove, rm remove the specified files on the next commit
311 serve start stand-alone webserver
311 serve start stand-alone webserver
312 status, st show changed files in the working directory
312 status, st show changed files in the working directory
313 summary, sum summarize working directory state
313 summary, sum summarize working directory state
314 update, up, checkout, co
314 update, up, checkout, co
315 update working directory (or switch revisions)
315 update working directory (or switch revisions)
316
316
317 global options ([+] can be repeated):
317 global options ([+] can be repeated):
318
318
319 -R --repository REPO repository root directory or name of overlay bundle
319 -R --repository REPO repository root directory or name of overlay bundle
320 file
320 file
321 --cwd DIR change working directory
321 --cwd DIR change working directory
322 -y --noninteractive do not prompt, automatically pick the first choice for
322 -y --noninteractive do not prompt, automatically pick the first choice for
323 all prompts
323 all prompts
324 -q --quiet suppress output
324 -q --quiet suppress output
325 -v --verbose enable additional output
325 -v --verbose enable additional output
326 --config CONFIG [+] set/override config option (use 'section.name=value')
326 --config CONFIG [+] set/override config option (use 'section.name=value')
327 --debug enable debugging output
327 --debug enable debugging output
328 --debugger start debugger
328 --debugger start debugger
329 --encoding ENCODE set the charset encoding (default: ascii)
329 --encoding ENCODE set the charset encoding (default: ascii)
330 --encodingmode MODE set the charset encoding mode (default: strict)
330 --encodingmode MODE set the charset encoding mode (default: strict)
331 --traceback always print a traceback on exception
331 --traceback always print a traceback on exception
332 --time time how long the command takes
332 --time time how long the command takes
333 --profile print command execution profile
333 --profile print command execution profile
334 --version output version information and exit
334 --version output version information and exit
335 -h --help display help and exit
335 -h --help display help and exit
336 --hidden consider hidden changesets
336 --hidden consider hidden changesets
337
337
338 (use "hg help" for the full list of commands)
338 (use "hg help" for the full list of commands)
339
339
340 $ hg add -h
340 $ hg add -h
341 hg add [OPTION]... [FILE]...
341 hg add [OPTION]... [FILE]...
342
342
343 add the specified files on the next commit
343 add the specified files on the next commit
344
344
345 Schedule files to be version controlled and added to the repository.
345 Schedule files to be version controlled and added to the repository.
346
346
347 The files will be added to the repository at the next commit. To undo an
347 The files will be added to the repository at the next commit. To undo an
348 add before that, see "hg forget".
348 add before that, see 'hg forget'.
349
349
350 If no names are given, add all files to the repository (except files
350 If no names are given, add all files to the repository (except files
351 matching ".hgignore").
351 matching ".hgignore").
352
352
353 Returns 0 if all files are successfully added.
353 Returns 0 if all files are successfully added.
354
354
355 options ([+] can be repeated):
355 options ([+] can be repeated):
356
356
357 -I --include PATTERN [+] include names matching the given patterns
357 -I --include PATTERN [+] include names matching the given patterns
358 -X --exclude PATTERN [+] exclude names matching the given patterns
358 -X --exclude PATTERN [+] exclude names matching the given patterns
359 -S --subrepos recurse into subrepositories
359 -S --subrepos recurse into subrepositories
360 -n --dry-run do not perform actions, just print output
360 -n --dry-run do not perform actions, just print output
361
361
362 (some details hidden, use --verbose to show complete help)
362 (some details hidden, use --verbose to show complete help)
363
363
364 Verbose help for add
364 Verbose help for add
365
365
366 $ hg add -hv
366 $ hg add -hv
367 hg add [OPTION]... [FILE]...
367 hg add [OPTION]... [FILE]...
368
368
369 add the specified files on the next commit
369 add the specified files on the next commit
370
370
371 Schedule files to be version controlled and added to the repository.
371 Schedule files to be version controlled and added to the repository.
372
372
373 The files will be added to the repository at the next commit. To undo an
373 The files will be added to the repository at the next commit. To undo an
374 add before that, see "hg forget".
374 add before that, see 'hg forget'.
375
375
376 If no names are given, add all files to the repository (except files
376 If no names are given, add all files to the repository (except files
377 matching ".hgignore").
377 matching ".hgignore").
378
378
379 Examples:
379 Examples:
380
380
381 - New (unknown) files are added automatically by "hg add":
381 - New (unknown) files are added automatically by 'hg add':
382
382
383 $ ls
383 $ ls
384 foo.c
384 foo.c
385 $ hg status
385 $ hg status
386 ? foo.c
386 ? foo.c
387 $ hg add
387 $ hg add
388 adding foo.c
388 adding foo.c
389 $ hg status
389 $ hg status
390 A foo.c
390 A foo.c
391
391
392 - Specific files to be added can be specified:
392 - Specific files to be added can be specified:
393
393
394 $ ls
394 $ ls
395 bar.c foo.c
395 bar.c foo.c
396 $ hg status
396 $ hg status
397 ? bar.c
397 ? bar.c
398 ? foo.c
398 ? foo.c
399 $ hg add bar.c
399 $ hg add bar.c
400 $ hg status
400 $ hg status
401 A bar.c
401 A bar.c
402 ? foo.c
402 ? foo.c
403
403
404 Returns 0 if all files are successfully added.
404 Returns 0 if all files are successfully added.
405
405
406 options ([+] can be repeated):
406 options ([+] can be repeated):
407
407
408 -I --include PATTERN [+] include names matching the given patterns
408 -I --include PATTERN [+] include names matching the given patterns
409 -X --exclude PATTERN [+] exclude names matching the given patterns
409 -X --exclude PATTERN [+] exclude names matching the given patterns
410 -S --subrepos recurse into subrepositories
410 -S --subrepos recurse into subrepositories
411 -n --dry-run do not perform actions, just print output
411 -n --dry-run do not perform actions, just print output
412
412
413 global options ([+] can be repeated):
413 global options ([+] can be repeated):
414
414
415 -R --repository REPO repository root directory or name of overlay bundle
415 -R --repository REPO repository root directory or name of overlay bundle
416 file
416 file
417 --cwd DIR change working directory
417 --cwd DIR change working directory
418 -y --noninteractive do not prompt, automatically pick the first choice for
418 -y --noninteractive do not prompt, automatically pick the first choice for
419 all prompts
419 all prompts
420 -q --quiet suppress output
420 -q --quiet suppress output
421 -v --verbose enable additional output
421 -v --verbose enable additional output
422 --config CONFIG [+] set/override config option (use 'section.name=value')
422 --config CONFIG [+] set/override config option (use 'section.name=value')
423 --debug enable debugging output
423 --debug enable debugging output
424 --debugger start debugger
424 --debugger start debugger
425 --encoding ENCODE set the charset encoding (default: ascii)
425 --encoding ENCODE set the charset encoding (default: ascii)
426 --encodingmode MODE set the charset encoding mode (default: strict)
426 --encodingmode MODE set the charset encoding mode (default: strict)
427 --traceback always print a traceback on exception
427 --traceback always print a traceback on exception
428 --time time how long the command takes
428 --time time how long the command takes
429 --profile print command execution profile
429 --profile print command execution profile
430 --version output version information and exit
430 --version output version information and exit
431 -h --help display help and exit
431 -h --help display help and exit
432 --hidden consider hidden changesets
432 --hidden consider hidden changesets
433
433
434 Test help option with version option
434 Test help option with version option
435
435
436 $ hg add -h --version
436 $ hg add -h --version
437 Mercurial Distributed SCM (version *) (glob)
437 Mercurial Distributed SCM (version *) (glob)
438 (see https://mercurial-scm.org for more information)
438 (see https://mercurial-scm.org for more information)
439
439
440 Copyright (C) 2005-2015 Matt Mackall and others
440 Copyright (C) 2005-2015 Matt Mackall and others
441 This is free software; see the source for copying conditions. There is NO
441 This is free software; see the source for copying conditions. There is NO
442 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
442 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
443
443
444 $ hg add --skjdfks
444 $ hg add --skjdfks
445 hg add: option --skjdfks not recognized
445 hg add: option --skjdfks not recognized
446 hg add [OPTION]... [FILE]...
446 hg add [OPTION]... [FILE]...
447
447
448 add the specified files on the next commit
448 add the specified files on the next commit
449
449
450 options ([+] can be repeated):
450 options ([+] can be repeated):
451
451
452 -I --include PATTERN [+] include names matching the given patterns
452 -I --include PATTERN [+] include names matching the given patterns
453 -X --exclude PATTERN [+] exclude names matching the given patterns
453 -X --exclude PATTERN [+] exclude names matching the given patterns
454 -S --subrepos recurse into subrepositories
454 -S --subrepos recurse into subrepositories
455 -n --dry-run do not perform actions, just print output
455 -n --dry-run do not perform actions, just print output
456
456
457 (use "hg add -h" to show more help)
457 (use "hg add -h" to show more help)
458 [255]
458 [255]
459
459
460 Test ambiguous command help
460 Test ambiguous command help
461
461
462 $ hg help ad
462 $ hg help ad
463 list of commands:
463 list of commands:
464
464
465 add add the specified files on the next commit
465 add add the specified files on the next commit
466 addremove add all new files, delete all missing files
466 addremove add all new files, delete all missing files
467
467
468 (use "hg help -v ad" to show built-in aliases and global options)
468 (use "hg help -v ad" to show built-in aliases and global options)
469
469
470 Test command without options
470 Test command without options
471
471
472 $ hg help verify
472 $ hg help verify
473 hg verify
473 hg verify
474
474
475 verify the integrity of the repository
475 verify the integrity of the repository
476
476
477 Verify the integrity of the current repository.
477 Verify the integrity of the current repository.
478
478
479 This will perform an extensive check of the repository's integrity,
479 This will perform an extensive check of the repository's integrity,
480 validating the hashes and checksums of each entry in the changelog,
480 validating the hashes and checksums of each entry in the changelog,
481 manifest, and tracked files, as well as the integrity of their crosslinks
481 manifest, and tracked files, as well as the integrity of their crosslinks
482 and indices.
482 and indices.
483
483
484 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
484 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
485 information about recovery from corruption of the repository.
485 information about recovery from corruption of the repository.
486
486
487 Returns 0 on success, 1 if errors are encountered.
487 Returns 0 on success, 1 if errors are encountered.
488
488
489 (some details hidden, use --verbose to show complete help)
489 (some details hidden, use --verbose to show complete help)
490
490
491 $ hg help diff
491 $ hg help diff
492 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
492 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
493
493
494 diff repository (or selected files)
494 diff repository (or selected files)
495
495
496 Show differences between revisions for the specified files.
496 Show differences between revisions for the specified files.
497
497
498 Differences between files are shown using the unified diff format.
498 Differences between files are shown using the unified diff format.
499
499
500 Note:
500 Note:
501 "hg diff" may generate unexpected results for merges, as it will
501 'hg diff' may generate unexpected results for merges, as it will
502 default to comparing against the working directory's first parent
502 default to comparing against the working directory's first parent
503 changeset if no revisions are specified.
503 changeset if no revisions are specified.
504
504
505 When two revision arguments are given, then changes are shown between
505 When two revision arguments are given, then changes are shown between
506 those revisions. If only one revision is specified then that revision is
506 those revisions. If only one revision is specified then that revision is
507 compared to the working directory, and, when no revisions are specified,
507 compared to the working directory, and, when no revisions are specified,
508 the working directory files are compared to its first parent.
508 the working directory files are compared to its first parent.
509
509
510 Alternatively you can specify -c/--change with a revision to see the
510 Alternatively you can specify -c/--change with a revision to see the
511 changes in that changeset relative to its first parent.
511 changes in that changeset relative to its first parent.
512
512
513 Without the -a/--text option, diff will avoid generating diffs of files it
513 Without the -a/--text option, diff will avoid generating diffs of files it
514 detects as binary. With -a, diff will generate a diff anyway, probably
514 detects as binary. With -a, diff will generate a diff anyway, probably
515 with undesirable results.
515 with undesirable results.
516
516
517 Use the -g/--git option to generate diffs in the git extended diff format.
517 Use the -g/--git option to generate diffs in the git extended diff format.
518 For more information, read "hg help diffs".
518 For more information, read 'hg help diffs'.
519
519
520 Returns 0 on success.
520 Returns 0 on success.
521
521
522 options ([+] can be repeated):
522 options ([+] can be repeated):
523
523
524 -r --rev REV [+] revision
524 -r --rev REV [+] revision
525 -c --change REV change made by revision
525 -c --change REV change made by revision
526 -a --text treat all files as text
526 -a --text treat all files as text
527 -g --git use git extended diff format
527 -g --git use git extended diff format
528 --nodates omit dates from diff headers
528 --nodates omit dates from diff headers
529 --noprefix omit a/ and b/ prefixes from filenames
529 --noprefix omit a/ and b/ prefixes from filenames
530 -p --show-function show which function each change is in
530 -p --show-function show which function each change is in
531 --reverse produce a diff that undoes the changes
531 --reverse produce a diff that undoes the changes
532 -w --ignore-all-space ignore white space when comparing lines
532 -w --ignore-all-space ignore white space when comparing lines
533 -b --ignore-space-change ignore changes in the amount of white space
533 -b --ignore-space-change ignore changes in the amount of white space
534 -B --ignore-blank-lines ignore changes whose lines are all blank
534 -B --ignore-blank-lines ignore changes whose lines are all blank
535 -U --unified NUM number of lines of context to show
535 -U --unified NUM number of lines of context to show
536 --stat output diffstat-style summary of changes
536 --stat output diffstat-style summary of changes
537 --root DIR produce diffs relative to subdirectory
537 --root DIR produce diffs relative to subdirectory
538 -I --include PATTERN [+] include names matching the given patterns
538 -I --include PATTERN [+] include names matching the given patterns
539 -X --exclude PATTERN [+] exclude names matching the given patterns
539 -X --exclude PATTERN [+] exclude names matching the given patterns
540 -S --subrepos recurse into subrepositories
540 -S --subrepos recurse into subrepositories
541
541
542 (some details hidden, use --verbose to show complete help)
542 (some details hidden, use --verbose to show complete help)
543
543
544 $ hg help status
544 $ hg help status
545 hg status [OPTION]... [FILE]...
545 hg status [OPTION]... [FILE]...
546
546
547 aliases: st
547 aliases: st
548
548
549 show changed files in the working directory
549 show changed files in the working directory
550
550
551 Show status of files in the repository. If names are given, only files
551 Show status of files in the repository. If names are given, only files
552 that match are shown. Files that are clean or ignored or the source of a
552 that match are shown. Files that are clean or ignored or the source of a
553 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
553 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
554 -C/--copies or -A/--all are given. Unless options described with "show
554 -C/--copies or -A/--all are given. Unless options described with "show
555 only ..." are given, the options -mardu are used.
555 only ..." are given, the options -mardu are used.
556
556
557 Option -q/--quiet hides untracked (unknown and ignored) files unless
557 Option -q/--quiet hides untracked (unknown and ignored) files unless
558 explicitly requested with -u/--unknown or -i/--ignored.
558 explicitly requested with -u/--unknown or -i/--ignored.
559
559
560 Note:
560 Note:
561 "hg status" may appear to disagree with diff if permissions have
561 'hg status' may appear to disagree with diff if permissions have
562 changed or a merge has occurred. The standard diff format does not
562 changed or a merge has occurred. The standard diff format does not
563 report permission changes and diff only reports changes relative to one
563 report permission changes and diff only reports changes relative to one
564 merge parent.
564 merge parent.
565
565
566 If one revision is given, it is used as the base revision. If two
566 If one revision is given, it is used as the base revision. If two
567 revisions are given, the differences between them are shown. The --change
567 revisions are given, the differences between them are shown. The --change
568 option can also be used as a shortcut to list the changed files of a
568 option can also be used as a shortcut to list the changed files of a
569 revision from its first parent.
569 revision from its first parent.
570
570
571 The codes used to show the status of files are:
571 The codes used to show the status of files are:
572
572
573 M = modified
573 M = modified
574 A = added
574 A = added
575 R = removed
575 R = removed
576 C = clean
576 C = clean
577 ! = missing (deleted by non-hg command, but still tracked)
577 ! = missing (deleted by non-hg command, but still tracked)
578 ? = not tracked
578 ? = not tracked
579 I = ignored
579 I = ignored
580 = origin of the previous file (with --copies)
580 = origin of the previous file (with --copies)
581
581
582 Returns 0 on success.
582 Returns 0 on success.
583
583
584 options ([+] can be repeated):
584 options ([+] can be repeated):
585
585
586 -A --all show status of all files
586 -A --all show status of all files
587 -m --modified show only modified files
587 -m --modified show only modified files
588 -a --added show only added files
588 -a --added show only added files
589 -r --removed show only removed files
589 -r --removed show only removed files
590 -d --deleted show only deleted (but tracked) files
590 -d --deleted show only deleted (but tracked) files
591 -c --clean show only files without changes
591 -c --clean show only files without changes
592 -u --unknown show only unknown (not tracked) files
592 -u --unknown show only unknown (not tracked) files
593 -i --ignored show only ignored files
593 -i --ignored show only ignored files
594 -n --no-status hide status prefix
594 -n --no-status hide status prefix
595 -C --copies show source of copied files
595 -C --copies show source of copied files
596 -0 --print0 end filenames with NUL, for use with xargs
596 -0 --print0 end filenames with NUL, for use with xargs
597 --rev REV [+] show difference from revision
597 --rev REV [+] show difference from revision
598 --change REV list the changed files of a revision
598 --change REV list the changed files of a revision
599 -I --include PATTERN [+] include names matching the given patterns
599 -I --include PATTERN [+] include names matching the given patterns
600 -X --exclude PATTERN [+] exclude names matching the given patterns
600 -X --exclude PATTERN [+] exclude names matching the given patterns
601 -S --subrepos recurse into subrepositories
601 -S --subrepos recurse into subrepositories
602
602
603 (some details hidden, use --verbose to show complete help)
603 (some details hidden, use --verbose to show complete help)
604
604
605 $ hg -q help status
605 $ hg -q help status
606 hg status [OPTION]... [FILE]...
606 hg status [OPTION]... [FILE]...
607
607
608 show changed files in the working directory
608 show changed files in the working directory
609
609
610 $ hg help foo
610 $ hg help foo
611 abort: no such help topic: foo
611 abort: no such help topic: foo
612 (try "hg help --keyword foo")
612 (try "hg help --keyword foo")
613 [255]
613 [255]
614
614
615 $ hg skjdfks
615 $ hg skjdfks
616 hg: unknown command 'skjdfks'
616 hg: unknown command 'skjdfks'
617 Mercurial Distributed SCM
617 Mercurial Distributed SCM
618
618
619 basic commands:
619 basic commands:
620
620
621 add add the specified files on the next commit
621 add add the specified files on the next commit
622 annotate show changeset information by line for each file
622 annotate show changeset information by line for each file
623 clone make a copy of an existing repository
623 clone make a copy of an existing repository
624 commit commit the specified files or all outstanding changes
624 commit commit the specified files or all outstanding changes
625 diff diff repository (or selected files)
625 diff diff repository (or selected files)
626 export dump the header and diffs for one or more changesets
626 export dump the header and diffs for one or more changesets
627 forget forget the specified files on the next commit
627 forget forget the specified files on the next commit
628 init create a new repository in the given directory
628 init create a new repository in the given directory
629 log show revision history of entire repository or files
629 log show revision history of entire repository or files
630 merge merge another revision into working directory
630 merge merge another revision into working directory
631 pull pull changes from the specified source
631 pull pull changes from the specified source
632 push push changes to the specified destination
632 push push changes to the specified destination
633 remove remove the specified files on the next commit
633 remove remove the specified files on the next commit
634 serve start stand-alone webserver
634 serve start stand-alone webserver
635 status show changed files in the working directory
635 status show changed files in the working directory
636 summary summarize working directory state
636 summary summarize working directory state
637 update update working directory (or switch revisions)
637 update update working directory (or switch revisions)
638
638
639 (use "hg help" for the full list of commands or "hg -v" for details)
639 (use "hg help" for the full list of commands or "hg -v" for details)
640 [255]
640 [255]
641
641
642
642
643 Make sure that we don't run afoul of the help system thinking that
643 Make sure that we don't run afoul of the help system thinking that
644 this is a section and erroring out weirdly.
644 this is a section and erroring out weirdly.
645
645
646 $ hg .log
646 $ hg .log
647 hg: unknown command '.log'
647 hg: unknown command '.log'
648 (did you mean log?)
648 (did you mean log?)
649 [255]
649 [255]
650
650
651 $ hg log.
651 $ hg log.
652 hg: unknown command 'log.'
652 hg: unknown command 'log.'
653 (did you mean log?)
653 (did you mean log?)
654 [255]
654 [255]
655 $ hg pu.lh
655 $ hg pu.lh
656 hg: unknown command 'pu.lh'
656 hg: unknown command 'pu.lh'
657 (did you mean one of pull, push?)
657 (did you mean one of pull, push?)
658 [255]
658 [255]
659
659
660 $ cat > helpext.py <<EOF
660 $ cat > helpext.py <<EOF
661 > import os
661 > import os
662 > from mercurial import cmdutil, commands
662 > from mercurial import cmdutil, commands
663 >
663 >
664 > cmdtable = {}
664 > cmdtable = {}
665 > command = cmdutil.command(cmdtable)
665 > command = cmdutil.command(cmdtable)
666 >
666 >
667 > @command('nohelp',
667 > @command('nohelp',
668 > [('', 'longdesc', 3, 'x'*90),
668 > [('', 'longdesc', 3, 'x'*90),
669 > ('n', '', None, 'normal desc'),
669 > ('n', '', None, 'normal desc'),
670 > ('', 'newline', '', 'line1\nline2')],
670 > ('', 'newline', '', 'line1\nline2')],
671 > 'hg nohelp',
671 > 'hg nohelp',
672 > norepo=True)
672 > norepo=True)
673 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
673 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
674 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
674 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
675 > def nohelp(ui, *args, **kwargs):
675 > def nohelp(ui, *args, **kwargs):
676 > pass
676 > pass
677 >
677 >
678 > EOF
678 > EOF
679 $ echo '[extensions]' >> $HGRCPATH
679 $ echo '[extensions]' >> $HGRCPATH
680 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
680 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
681
681
682 Test command with no help text
682 Test command with no help text
683
683
684 $ hg help nohelp
684 $ hg help nohelp
685 hg nohelp
685 hg nohelp
686
686
687 (no help text available)
687 (no help text available)
688
688
689 options:
689 options:
690
690
691 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
691 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
692 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
692 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
693 -n -- normal desc
693 -n -- normal desc
694 --newline VALUE line1 line2
694 --newline VALUE line1 line2
695
695
696 (some details hidden, use --verbose to show complete help)
696 (some details hidden, use --verbose to show complete help)
697
697
698 $ hg help -k nohelp
698 $ hg help -k nohelp
699 Commands:
699 Commands:
700
700
701 nohelp hg nohelp
701 nohelp hg nohelp
702
702
703 Extension Commands:
703 Extension Commands:
704
704
705 nohelp (no help text available)
705 nohelp (no help text available)
706
706
707 Test that default list of commands omits extension commands
707 Test that default list of commands omits extension commands
708
708
709 $ hg help
709 $ hg help
710 Mercurial Distributed SCM
710 Mercurial Distributed SCM
711
711
712 list of commands:
712 list of commands:
713
713
714 add add the specified files on the next commit
714 add add the specified files on the next commit
715 addremove add all new files, delete all missing files
715 addremove add all new files, delete all missing files
716 annotate show changeset information by line for each file
716 annotate show changeset information by line for each file
717 archive create an unversioned archive of a repository revision
717 archive create an unversioned archive of a repository revision
718 backout reverse effect of earlier changeset
718 backout reverse effect of earlier changeset
719 bisect subdivision search of changesets
719 bisect subdivision search of changesets
720 bookmarks create a new bookmark or list existing bookmarks
720 bookmarks create a new bookmark or list existing bookmarks
721 branch set or show the current branch name
721 branch set or show the current branch name
722 branches list repository named branches
722 branches list repository named branches
723 bundle create a changegroup file
723 bundle create a changegroup file
724 cat output the current or given revision of files
724 cat output the current or given revision of files
725 clone make a copy of an existing repository
725 clone make a copy of an existing repository
726 commit commit the specified files or all outstanding changes
726 commit commit the specified files or all outstanding changes
727 config show combined config settings from all hgrc files
727 config show combined config settings from all hgrc files
728 copy mark files as copied for the next commit
728 copy mark files as copied for the next commit
729 diff diff repository (or selected files)
729 diff diff repository (or selected files)
730 export dump the header and diffs for one or more changesets
730 export dump the header and diffs for one or more changesets
731 files list tracked files
731 files list tracked files
732 forget forget the specified files on the next commit
732 forget forget the specified files on the next commit
733 graft copy changes from other branches onto the current branch
733 graft copy changes from other branches onto the current branch
734 grep search for a pattern in specified files and revisions
734 grep search for a pattern in specified files and revisions
735 heads show branch heads
735 heads show branch heads
736 help show help for a given topic or a help overview
736 help show help for a given topic or a help overview
737 identify identify the working directory or specified revision
737 identify identify the working directory or specified revision
738 import import an ordered set of patches
738 import import an ordered set of patches
739 incoming show new changesets found in source
739 incoming show new changesets found in source
740 init create a new repository in the given directory
740 init create a new repository in the given directory
741 log show revision history of entire repository or files
741 log show revision history of entire repository or files
742 manifest output the current or given revision of the project manifest
742 manifest output the current or given revision of the project manifest
743 merge merge another revision into working directory
743 merge merge another revision into working directory
744 outgoing show changesets not found in the destination
744 outgoing show changesets not found in the destination
745 paths show aliases for remote repositories
745 paths show aliases for remote repositories
746 phase set or show the current phase name
746 phase set or show the current phase name
747 pull pull changes from the specified source
747 pull pull changes from the specified source
748 push push changes to the specified destination
748 push push changes to the specified destination
749 recover roll back an interrupted transaction
749 recover roll back an interrupted transaction
750 remove remove the specified files on the next commit
750 remove remove the specified files on the next commit
751 rename rename files; equivalent of copy + remove
751 rename rename files; equivalent of copy + remove
752 resolve redo merges or set/view the merge status of files
752 resolve redo merges or set/view the merge status of files
753 revert restore files to their checkout state
753 revert restore files to their checkout state
754 root print the root (top) of the current working directory
754 root print the root (top) of the current working directory
755 serve start stand-alone webserver
755 serve start stand-alone webserver
756 status show changed files in the working directory
756 status show changed files in the working directory
757 summary summarize working directory state
757 summary summarize working directory state
758 tag add one or more tags for the current or given revision
758 tag add one or more tags for the current or given revision
759 tags list repository tags
759 tags list repository tags
760 unbundle apply one or more changegroup files
760 unbundle apply one or more changegroup files
761 update update working directory (or switch revisions)
761 update update working directory (or switch revisions)
762 verify verify the integrity of the repository
762 verify verify the integrity of the repository
763 version output version and copyright information
763 version output version and copyright information
764
764
765 enabled extensions:
765 enabled extensions:
766
766
767 helpext (no help text available)
767 helpext (no help text available)
768
768
769 additional help topics:
769 additional help topics:
770
770
771 config Configuration Files
771 config Configuration Files
772 dates Date Formats
772 dates Date Formats
773 diffs Diff Formats
773 diffs Diff Formats
774 environment Environment Variables
774 environment Environment Variables
775 extensions Using Additional Features
775 extensions Using Additional Features
776 filesets Specifying File Sets
776 filesets Specifying File Sets
777 glossary Glossary
777 glossary Glossary
778 hgignore Syntax for Mercurial Ignore Files
778 hgignore Syntax for Mercurial Ignore Files
779 hgweb Configuring hgweb
779 hgweb Configuring hgweb
780 internals Technical implementation topics
780 internals Technical implementation topics
781 merge-tools Merge Tools
781 merge-tools Merge Tools
782 multirevs Specifying Multiple Revisions
782 multirevs Specifying Multiple Revisions
783 patterns File Name Patterns
783 patterns File Name Patterns
784 phases Working with Phases
784 phases Working with Phases
785 revisions Specifying Single Revisions
785 revisions Specifying Single Revisions
786 revsets Specifying Revision Sets
786 revsets Specifying Revision Sets
787 scripting Using Mercurial from scripts and automation
787 scripting Using Mercurial from scripts and automation
788 subrepos Subrepositories
788 subrepos Subrepositories
789 templating Template Usage
789 templating Template Usage
790 urls URL Paths
790 urls URL Paths
791
791
792 (use "hg help -v" to show built-in aliases and global options)
792 (use "hg help -v" to show built-in aliases and global options)
793
793
794
794
795 Test list of internal help commands
795 Test list of internal help commands
796
796
797 $ hg help debug
797 $ hg help debug
798 debug commands (internal and unsupported):
798 debug commands (internal and unsupported):
799
799
800 debugancestor
800 debugancestor
801 find the ancestor revision of two revisions in a given index
801 find the ancestor revision of two revisions in a given index
802 debugapplystreamclonebundle
802 debugapplystreamclonebundle
803 apply a stream clone bundle file
803 apply a stream clone bundle file
804 debugbuilddag
804 debugbuilddag
805 builds a repo with a given DAG from scratch in the current
805 builds a repo with a given DAG from scratch in the current
806 empty repo
806 empty repo
807 debugbundle lists the contents of a bundle
807 debugbundle lists the contents of a bundle
808 debugcheckstate
808 debugcheckstate
809 validate the correctness of the current dirstate
809 validate the correctness of the current dirstate
810 debugcommands
810 debugcommands
811 list all available commands and options
811 list all available commands and options
812 debugcomplete
812 debugcomplete
813 returns the completion list associated with the given command
813 returns the completion list associated with the given command
814 debugcreatestreamclonebundle
814 debugcreatestreamclonebundle
815 create a stream clone bundle file
815 create a stream clone bundle file
816 debugdag format the changelog or an index DAG as a concise textual
816 debugdag format the changelog or an index DAG as a concise textual
817 description
817 description
818 debugdata dump the contents of a data file revision
818 debugdata dump the contents of a data file revision
819 debugdate parse and display a date
819 debugdate parse and display a date
820 debugdeltachain
820 debugdeltachain
821 dump information about delta chains in a revlog
821 dump information about delta chains in a revlog
822 debugdirstate
822 debugdirstate
823 show the contents of the current dirstate
823 show the contents of the current dirstate
824 debugdiscovery
824 debugdiscovery
825 runs the changeset discovery protocol in isolation
825 runs the changeset discovery protocol in isolation
826 debugextensions
826 debugextensions
827 show information about active extensions
827 show information about active extensions
828 debugfileset parse and apply a fileset specification
828 debugfileset parse and apply a fileset specification
829 debugfsinfo show information detected about current filesystem
829 debugfsinfo show information detected about current filesystem
830 debuggetbundle
830 debuggetbundle
831 retrieves a bundle from a repo
831 retrieves a bundle from a repo
832 debugignore display the combined ignore pattern and information about
832 debugignore display the combined ignore pattern and information about
833 ignored files
833 ignored files
834 debugindex dump the contents of an index file
834 debugindex dump the contents of an index file
835 debugindexdot
835 debugindexdot
836 dump an index DAG as a graphviz dot file
836 dump an index DAG as a graphviz dot file
837 debuginstall test Mercurial installation
837 debuginstall test Mercurial installation
838 debugknown test whether node ids are known to a repo
838 debugknown test whether node ids are known to a repo
839 debuglocks show or modify state of locks
839 debuglocks show or modify state of locks
840 debugmergestate
840 debugmergestate
841 print merge state
841 print merge state
842 debugnamecomplete
842 debugnamecomplete
843 complete "names" - tags, open branch names, bookmark names
843 complete "names" - tags, open branch names, bookmark names
844 debugobsolete
844 debugobsolete
845 create arbitrary obsolete marker
845 create arbitrary obsolete marker
846 debugoptDEP (no help text available)
846 debugoptDEP (no help text available)
847 debugoptEXP (no help text available)
847 debugoptEXP (no help text available)
848 debugpathcomplete
848 debugpathcomplete
849 complete part or all of a tracked path
849 complete part or all of a tracked path
850 debugpushkey access the pushkey key/value protocol
850 debugpushkey access the pushkey key/value protocol
851 debugpvec (no help text available)
851 debugpvec (no help text available)
852 debugrebuilddirstate
852 debugrebuilddirstate
853 rebuild the dirstate as it would look like for the given
853 rebuild the dirstate as it would look like for the given
854 revision
854 revision
855 debugrebuildfncache
855 debugrebuildfncache
856 rebuild the fncache file
856 rebuild the fncache file
857 debugrename dump rename information
857 debugrename dump rename information
858 debugrevlog show data and statistics about a revlog
858 debugrevlog show data and statistics about a revlog
859 debugrevspec parse and apply a revision specification
859 debugrevspec parse and apply a revision specification
860 debugsetparents
860 debugsetparents
861 manually set the parents of the current working directory
861 manually set the parents of the current working directory
862 debugsub (no help text available)
862 debugsub (no help text available)
863 debugsuccessorssets
863 debugsuccessorssets
864 show set of successors for revision
864 show set of successors for revision
865 debugwalk show how files match on given patterns
865 debugwalk show how files match on given patterns
866 debugwireargs
866 debugwireargs
867 (no help text available)
867 (no help text available)
868
868
869 (use "hg help -v debug" to show built-in aliases and global options)
869 (use "hg help -v debug" to show built-in aliases and global options)
870
870
871 internals topic renders index of available sub-topics
871 internals topic renders index of available sub-topics
872
872
873 $ hg help internals
873 $ hg help internals
874 Technical implementation topics
874 Technical implementation topics
875 """""""""""""""""""""""""""""""
875 """""""""""""""""""""""""""""""
876
876
877 bundles container for exchange of repository data
877 bundles container for exchange of repository data
878 changegroups representation of revlog data
878 changegroups representation of revlog data
879 revlogs revision storage mechanism
879 revlogs revision storage mechanism
880
880
881 sub-topics can be accessed
881 sub-topics can be accessed
882
882
883 $ hg help internals.changegroups
883 $ hg help internals.changegroups
884 Changegroups
884 Changegroups
885 ============
885 ============
886
886
887 Changegroups are representations of repository revlog data, specifically
887 Changegroups are representations of repository revlog data, specifically
888 the changelog, manifest, and filelogs.
888 the changelog, manifest, and filelogs.
889
889
890 There are 3 versions of changegroups: "1", "2", and "3". From a high-
890 There are 3 versions of changegroups: "1", "2", and "3". From a high-
891 level, versions "1" and "2" are almost exactly the same, with the only
891 level, versions "1" and "2" are almost exactly the same, with the only
892 difference being a header on entries in the changeset segment. Version "3"
892 difference being a header on entries in the changeset segment. Version "3"
893 adds support for exchanging treemanifests and includes revlog flags in the
893 adds support for exchanging treemanifests and includes revlog flags in the
894 delta header.
894 delta header.
895
895
896 Changegroups consists of 3 logical segments:
896 Changegroups consists of 3 logical segments:
897
897
898 +---------------------------------+
898 +---------------------------------+
899 | | | |
899 | | | |
900 | changeset | manifest | filelogs |
900 | changeset | manifest | filelogs |
901 | | | |
901 | | | |
902 +---------------------------------+
902 +---------------------------------+
903
903
904 The principle building block of each segment is a *chunk*. A *chunk* is a
904 The principle building block of each segment is a *chunk*. A *chunk* is a
905 framed piece of data:
905 framed piece of data:
906
906
907 +---------------------------------------+
907 +---------------------------------------+
908 | | |
908 | | |
909 | length | data |
909 | length | data |
910 | (32 bits) | <length> bytes |
910 | (32 bits) | <length> bytes |
911 | | |
911 | | |
912 +---------------------------------------+
912 +---------------------------------------+
913
913
914 Each chunk starts with a 32-bit big-endian signed integer indicating the
914 Each chunk starts with a 32-bit big-endian signed integer indicating the
915 length of the raw data that follows.
915 length of the raw data that follows.
916
916
917 There is a special case chunk that has 0 length ("0x00000000"). We call
917 There is a special case chunk that has 0 length ("0x00000000"). We call
918 this an *empty chunk*.
918 this an *empty chunk*.
919
919
920 Delta Groups
920 Delta Groups
921 ------------
921 ------------
922
922
923 A *delta group* expresses the content of a revlog as a series of deltas,
923 A *delta group* expresses the content of a revlog as a series of deltas,
924 or patches against previous revisions.
924 or patches against previous revisions.
925
925
926 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
926 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
927 to signal the end of the delta group:
927 to signal the end of the delta group:
928
928
929 +------------------------------------------------------------------------+
929 +------------------------------------------------------------------------+
930 | | | | | |
930 | | | | | |
931 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
931 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
932 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
932 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
933 | | | | | |
933 | | | | | |
934 +------------------------------------------------------------+-----------+
934 +------------------------------------------------------------+-----------+
935
935
936 Each *chunk*'s data consists of the following:
936 Each *chunk*'s data consists of the following:
937
937
938 +-----------------------------------------+
938 +-----------------------------------------+
939 | | | |
939 | | | |
940 | delta header | mdiff header | delta |
940 | delta header | mdiff header | delta |
941 | (various) | (12 bytes) | (various) |
941 | (various) | (12 bytes) | (various) |
942 | | | |
942 | | | |
943 +-----------------------------------------+
943 +-----------------------------------------+
944
944
945 The *length* field is the byte length of the remaining 3 logical pieces of
945 The *length* field is the byte length of the remaining 3 logical pieces of
946 data. The *delta* is a diff from an existing entry in the changelog.
946 data. The *delta* is a diff from an existing entry in the changelog.
947
947
948 The *delta header* is different between versions "1", "2", and "3" of the
948 The *delta header* is different between versions "1", "2", and "3" of the
949 changegroup format.
949 changegroup format.
950
950
951 Version 1:
951 Version 1:
952
952
953 +------------------------------------------------------+
953 +------------------------------------------------------+
954 | | | | |
954 | | | | |
955 | node | p1 node | p2 node | link node |
955 | node | p1 node | p2 node | link node |
956 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
956 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
957 | | | | |
957 | | | | |
958 +------------------------------------------------------+
958 +------------------------------------------------------+
959
959
960 Version 2:
960 Version 2:
961
961
962 +------------------------------------------------------------------+
962 +------------------------------------------------------------------+
963 | | | | | |
963 | | | | | |
964 | node | p1 node | p2 node | base node | link node |
964 | node | p1 node | p2 node | base node | link node |
965 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
965 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
966 | | | | | |
966 | | | | | |
967 +------------------------------------------------------------------+
967 +------------------------------------------------------------------+
968
968
969 Version 3:
969 Version 3:
970
970
971 +------------------------------------------------------------------------------+
971 +------------------------------------------------------------------------------+
972 | | | | | | |
972 | | | | | | |
973 | node | p1 node | p2 node | base node | link node | flags |
973 | node | p1 node | p2 node | base node | link node | flags |
974 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
974 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
975 | | | | | | |
975 | | | | | | |
976 +------------------------------------------------------------------------------+
976 +------------------------------------------------------------------------------+
977
977
978 The *mdiff header* consists of 3 32-bit big-endian signed integers
978 The *mdiff header* consists of 3 32-bit big-endian signed integers
979 describing offsets at which to apply the following delta content:
979 describing offsets at which to apply the following delta content:
980
980
981 +-------------------------------------+
981 +-------------------------------------+
982 | | | |
982 | | | |
983 | offset | old length | new length |
983 | offset | old length | new length |
984 | (32 bits) | (32 bits) | (32 bits) |
984 | (32 bits) | (32 bits) | (32 bits) |
985 | | | |
985 | | | |
986 +-------------------------------------+
986 +-------------------------------------+
987
987
988 In version 1, the delta is always applied against the previous node from
988 In version 1, the delta is always applied against the previous node from
989 the changegroup or the first parent if this is the first entry in the
989 the changegroup or the first parent if this is the first entry in the
990 changegroup.
990 changegroup.
991
991
992 In version 2, the delta base node is encoded in the entry in the
992 In version 2, the delta base node is encoded in the entry in the
993 changegroup. This allows the delta to be expressed against any parent,
993 changegroup. This allows the delta to be expressed against any parent,
994 which can result in smaller deltas and more efficient encoding of data.
994 which can result in smaller deltas and more efficient encoding of data.
995
995
996 Changeset Segment
996 Changeset Segment
997 -----------------
997 -----------------
998
998
999 The *changeset segment* consists of a single *delta group* holding
999 The *changeset segment* consists of a single *delta group* holding
1000 changelog data. It is followed by an *empty chunk* to denote the boundary
1000 changelog data. It is followed by an *empty chunk* to denote the boundary
1001 to the *manifests segment*.
1001 to the *manifests segment*.
1002
1002
1003 Manifest Segment
1003 Manifest Segment
1004 ----------------
1004 ----------------
1005
1005
1006 The *manifest segment* consists of a single *delta group* holding manifest
1006 The *manifest segment* consists of a single *delta group* holding manifest
1007 data. It is followed by an *empty chunk* to denote the boundary to the
1007 data. It is followed by an *empty chunk* to denote the boundary to the
1008 *filelogs segment*.
1008 *filelogs segment*.
1009
1009
1010 Filelogs Segment
1010 Filelogs Segment
1011 ----------------
1011 ----------------
1012
1012
1013 The *filelogs* segment consists of multiple sub-segments, each
1013 The *filelogs* segment consists of multiple sub-segments, each
1014 corresponding to an individual file whose data is being described:
1014 corresponding to an individual file whose data is being described:
1015
1015
1016 +--------------------------------------+
1016 +--------------------------------------+
1017 | | | | |
1017 | | | | |
1018 | filelog0 | filelog1 | filelog2 | ... |
1018 | filelog0 | filelog1 | filelog2 | ... |
1019 | | | | |
1019 | | | | |
1020 +--------------------------------------+
1020 +--------------------------------------+
1021
1021
1022 In version "3" of the changegroup format, filelogs may include directory
1022 In version "3" of the changegroup format, filelogs may include directory
1023 logs when treemanifests are in use. directory logs are identified by
1023 logs when treemanifests are in use. directory logs are identified by
1024 having a trailing '/' on their filename (see below).
1024 having a trailing '/' on their filename (see below).
1025
1025
1026 The final filelog sub-segment is followed by an *empty chunk* to denote
1026 The final filelog sub-segment is followed by an *empty chunk* to denote
1027 the end of the segment and the overall changegroup.
1027 the end of the segment and the overall changegroup.
1028
1028
1029 Each filelog sub-segment consists of the following:
1029 Each filelog sub-segment consists of the following:
1030
1030
1031 +------------------------------------------+
1031 +------------------------------------------+
1032 | | | |
1032 | | | |
1033 | filename size | filename | delta group |
1033 | filename size | filename | delta group |
1034 | (32 bits) | (various) | (various) |
1034 | (32 bits) | (various) | (various) |
1035 | | | |
1035 | | | |
1036 +------------------------------------------+
1036 +------------------------------------------+
1037
1037
1038 That is, a *chunk* consisting of the filename (not terminated or padded)
1038 That is, a *chunk* consisting of the filename (not terminated or padded)
1039 followed by N chunks constituting the *delta group* for this file.
1039 followed by N chunks constituting the *delta group* for this file.
1040
1040
1041 Test list of commands with command with no help text
1041 Test list of commands with command with no help text
1042
1042
1043 $ hg help helpext
1043 $ hg help helpext
1044 helpext extension - no help text available
1044 helpext extension - no help text available
1045
1045
1046 list of commands:
1046 list of commands:
1047
1047
1048 nohelp (no help text available)
1048 nohelp (no help text available)
1049
1049
1050 (use "hg help -v helpext" to show built-in aliases and global options)
1050 (use "hg help -v helpext" to show built-in aliases and global options)
1051
1051
1052
1052
1053 test deprecated and experimental options are hidden in command help
1053 test deprecated and experimental options are hidden in command help
1054 $ hg help debugoptDEP
1054 $ hg help debugoptDEP
1055 hg debugoptDEP
1055 hg debugoptDEP
1056
1056
1057 (no help text available)
1057 (no help text available)
1058
1058
1059 options:
1059 options:
1060
1060
1061 (some details hidden, use --verbose to show complete help)
1061 (some details hidden, use --verbose to show complete help)
1062
1062
1063 $ hg help debugoptEXP
1063 $ hg help debugoptEXP
1064 hg debugoptEXP
1064 hg debugoptEXP
1065
1065
1066 (no help text available)
1066 (no help text available)
1067
1067
1068 options:
1068 options:
1069
1069
1070 (some details hidden, use --verbose to show complete help)
1070 (some details hidden, use --verbose to show complete help)
1071
1071
1072 test deprecated and experimental options is shown with -v
1072 test deprecated and experimental options is shown with -v
1073 $ hg help -v debugoptDEP | grep dopt
1073 $ hg help -v debugoptDEP | grep dopt
1074 --dopt option is (DEPRECATED)
1074 --dopt option is (DEPRECATED)
1075 $ hg help -v debugoptEXP | grep eopt
1075 $ hg help -v debugoptEXP | grep eopt
1076 --eopt option is (EXPERIMENTAL)
1076 --eopt option is (EXPERIMENTAL)
1077
1077
1078 #if gettext
1078 #if gettext
1079 test deprecated option is hidden with translation with untranslated description
1079 test deprecated option is hidden with translation with untranslated description
1080 (use many globy for not failing on changed transaction)
1080 (use many globy for not failing on changed transaction)
1081 $ LANGUAGE=sv hg help debugoptDEP
1081 $ LANGUAGE=sv hg help debugoptDEP
1082 hg debugoptDEP
1082 hg debugoptDEP
1083
1083
1084 (*) (glob)
1084 (*) (glob)
1085
1085
1086 options:
1086 options:
1087
1087
1088 (some details hidden, use --verbose to show complete help)
1088 (some details hidden, use --verbose to show complete help)
1089 #endif
1089 #endif
1090
1090
1091 Test commands that collide with topics (issue4240)
1091 Test commands that collide with topics (issue4240)
1092
1092
1093 $ hg config -hq
1093 $ hg config -hq
1094 hg config [-u] [NAME]...
1094 hg config [-u] [NAME]...
1095
1095
1096 show combined config settings from all hgrc files
1096 show combined config settings from all hgrc files
1097 $ hg showconfig -hq
1097 $ hg showconfig -hq
1098 hg config [-u] [NAME]...
1098 hg config [-u] [NAME]...
1099
1099
1100 show combined config settings from all hgrc files
1100 show combined config settings from all hgrc files
1101
1101
1102 Test a help topic
1102 Test a help topic
1103
1103
1104 $ hg help revs
1104 $ hg help revs
1105 Specifying Single Revisions
1105 Specifying Single Revisions
1106 """""""""""""""""""""""""""
1106 """""""""""""""""""""""""""
1107
1107
1108 Mercurial supports several ways to specify individual revisions.
1108 Mercurial supports several ways to specify individual revisions.
1109
1109
1110 A plain integer is treated as a revision number. Negative integers are
1110 A plain integer is treated as a revision number. Negative integers are
1111 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1111 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1112 denoting the revision prior to the tip, and so forth.
1112 denoting the revision prior to the tip, and so forth.
1113
1113
1114 A 40-digit hexadecimal string is treated as a unique revision identifier.
1114 A 40-digit hexadecimal string is treated as a unique revision identifier.
1115
1115
1116 A hexadecimal string less than 40 characters long is treated as a unique
1116 A hexadecimal string less than 40 characters long is treated as a unique
1117 revision identifier and is referred to as a short-form identifier. A
1117 revision identifier and is referred to as a short-form identifier. A
1118 short-form identifier is only valid if it is the prefix of exactly one
1118 short-form identifier is only valid if it is the prefix of exactly one
1119 full-length identifier.
1119 full-length identifier.
1120
1120
1121 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1121 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1122 is a movable pointer to a revision. A tag is a permanent name associated
1122 is a movable pointer to a revision. A tag is a permanent name associated
1123 with a revision. A branch name denotes the tipmost open branch head of
1123 with a revision. A branch name denotes the tipmost open branch head of
1124 that branch - or if they are all closed, the tipmost closed head of the
1124 that branch - or if they are all closed, the tipmost closed head of the
1125 branch. Bookmark, tag, and branch names must not contain the ":"
1125 branch. Bookmark, tag, and branch names must not contain the ":"
1126 character.
1126 character.
1127
1127
1128 The reserved name "tip" always identifies the most recent revision.
1128 The reserved name "tip" always identifies the most recent revision.
1129
1129
1130 The reserved name "null" indicates the null revision. This is the revision
1130 The reserved name "null" indicates the null revision. This is the revision
1131 of an empty repository, and the parent of revision 0.
1131 of an empty repository, and the parent of revision 0.
1132
1132
1133 The reserved name "." indicates the working directory parent. If no
1133 The reserved name "." indicates the working directory parent. If no
1134 working directory is checked out, it is equivalent to null. If an
1134 working directory is checked out, it is equivalent to null. If an
1135 uncommitted merge is in progress, "." is the revision of the first parent.
1135 uncommitted merge is in progress, "." is the revision of the first parent.
1136
1136
1137 Test repeated config section name
1137 Test repeated config section name
1138
1138
1139 $ hg help config.host
1139 $ hg help config.host
1140 "http_proxy.host"
1140 "http_proxy.host"
1141 Host name and (optional) port of the proxy server, for example
1141 Host name and (optional) port of the proxy server, for example
1142 "myproxy:8000".
1142 "myproxy:8000".
1143
1143
1144 "smtp.host"
1144 "smtp.host"
1145 Host name of mail server, e.g. "mail.example.com".
1145 Host name of mail server, e.g. "mail.example.com".
1146
1146
1147 Unrelated trailing paragraphs shouldn't be included
1147 Unrelated trailing paragraphs shouldn't be included
1148
1148
1149 $ hg help config.extramsg | grep '^$'
1149 $ hg help config.extramsg | grep '^$'
1150
1150
1151
1151
1152 Test capitalized section name
1152 Test capitalized section name
1153
1153
1154 $ hg help scripting.HGPLAIN > /dev/null
1154 $ hg help scripting.HGPLAIN > /dev/null
1155
1155
1156 Help subsection:
1156 Help subsection:
1157
1157
1158 $ hg help config.charsets |grep "Email example:" > /dev/null
1158 $ hg help config.charsets |grep "Email example:" > /dev/null
1159 [1]
1159 [1]
1160
1160
1161 Show nested definitions
1161 Show nested definitions
1162 ("profiling.type"[break]"ls"[break]"stat"[break])
1162 ("profiling.type"[break]"ls"[break]"stat"[break])
1163
1163
1164 $ hg help config.type | egrep '^$'|wc -l
1164 $ hg help config.type | egrep '^$'|wc -l
1165 \s*3 (re)
1165 \s*3 (re)
1166
1166
1167 Separate sections from subsections
1167 Separate sections from subsections
1168
1168
1169 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1169 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1170 "format"
1170 "format"
1171 --------
1171 --------
1172
1172
1173 "usegeneraldelta"
1173 "usegeneraldelta"
1174
1174
1175 "dotencode"
1175 "dotencode"
1176
1176
1177 "usefncache"
1177 "usefncache"
1178
1178
1179 "usestore"
1179 "usestore"
1180
1180
1181 "profiling"
1181 "profiling"
1182 -----------
1182 -----------
1183
1183
1184 "format"
1184 "format"
1185
1185
1186 "progress"
1186 "progress"
1187 ----------
1187 ----------
1188
1188
1189 "format"
1189 "format"
1190
1190
1191
1191
1192 Last item in help config.*:
1192 Last item in help config.*:
1193
1193
1194 $ hg help config.`hg help config|grep '^ "'| \
1194 $ hg help config.`hg help config|grep '^ "'| \
1195 > tail -1|sed 's![ "]*!!g'`| \
1195 > tail -1|sed 's![ "]*!!g'`| \
1196 > grep "hg help -c config" > /dev/null
1196 > grep "hg help -c config" > /dev/null
1197 [1]
1197 [1]
1198
1198
1199 note to use help -c for general hg help config:
1199 note to use help -c for general hg help config:
1200
1200
1201 $ hg help config |grep "hg help -c config" > /dev/null
1201 $ hg help config |grep "hg help -c config" > /dev/null
1202
1202
1203 Test templating help
1203 Test templating help
1204
1204
1205 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1205 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1206 desc String. The text of the changeset description.
1206 desc String. The text of the changeset description.
1207 diffstat String. Statistics of changes with the following format:
1207 diffstat String. Statistics of changes with the following format:
1208 firstline Any text. Returns the first line of text.
1208 firstline Any text. Returns the first line of text.
1209 nonempty Any text. Returns '(none)' if the string is empty.
1209 nonempty Any text. Returns '(none)' if the string is empty.
1210
1210
1211 Test deprecated items
1211 Test deprecated items
1212
1212
1213 $ hg help -v templating | grep currentbookmark
1213 $ hg help -v templating | grep currentbookmark
1214 currentbookmark
1214 currentbookmark
1215 $ hg help templating | (grep currentbookmark || true)
1215 $ hg help templating | (grep currentbookmark || true)
1216
1216
1217 Test help hooks
1217 Test help hooks
1218
1218
1219 $ cat > helphook1.py <<EOF
1219 $ cat > helphook1.py <<EOF
1220 > from mercurial import help
1220 > from mercurial import help
1221 >
1221 >
1222 > def rewrite(ui, topic, doc):
1222 > def rewrite(ui, topic, doc):
1223 > return doc + '\nhelphook1\n'
1223 > return doc + '\nhelphook1\n'
1224 >
1224 >
1225 > def extsetup(ui):
1225 > def extsetup(ui):
1226 > help.addtopichook('revsets', rewrite)
1226 > help.addtopichook('revsets', rewrite)
1227 > EOF
1227 > EOF
1228 $ cat > helphook2.py <<EOF
1228 $ cat > helphook2.py <<EOF
1229 > from mercurial import help
1229 > from mercurial import help
1230 >
1230 >
1231 > def rewrite(ui, topic, doc):
1231 > def rewrite(ui, topic, doc):
1232 > return doc + '\nhelphook2\n'
1232 > return doc + '\nhelphook2\n'
1233 >
1233 >
1234 > def extsetup(ui):
1234 > def extsetup(ui):
1235 > help.addtopichook('revsets', rewrite)
1235 > help.addtopichook('revsets', rewrite)
1236 > EOF
1236 > EOF
1237 $ echo '[extensions]' >> $HGRCPATH
1237 $ echo '[extensions]' >> $HGRCPATH
1238 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1238 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1239 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1239 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1240 $ hg help revsets | grep helphook
1240 $ hg help revsets | grep helphook
1241 helphook1
1241 helphook1
1242 helphook2
1242 helphook2
1243
1243
1244 help -c should only show debug --debug
1244 help -c should only show debug --debug
1245
1245
1246 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1246 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1247 [1]
1247 [1]
1248
1248
1249 help -c should only show deprecated for -v
1249 help -c should only show deprecated for -v
1250
1250
1251 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1251 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1252 [1]
1252 [1]
1253
1253
1254 Test -e / -c / -k combinations
1254 Test -e / -c / -k combinations
1255
1255
1256 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1256 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1257 Commands:
1257 Commands:
1258 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1258 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1259 Extensions:
1259 Extensions:
1260 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1260 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1261 Topics:
1261 Topics:
1262 Commands:
1262 Commands:
1263 Extensions:
1263 Extensions:
1264 Extension Commands:
1264 Extension Commands:
1265 $ hg help -c schemes
1265 $ hg help -c schemes
1266 abort: no such help topic: schemes
1266 abort: no such help topic: schemes
1267 (try "hg help --keyword schemes")
1267 (try "hg help --keyword schemes")
1268 [255]
1268 [255]
1269 $ hg help -e schemes |head -1
1269 $ hg help -e schemes |head -1
1270 schemes extension - extend schemes with shortcuts to repository swarms
1270 schemes extension - extend schemes with shortcuts to repository swarms
1271 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1271 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1272 Commands:
1272 Commands:
1273 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1273 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1274 Extensions:
1274 Extensions:
1275 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1275 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1276 Extensions:
1276 Extensions:
1277 Commands:
1277 Commands:
1278 $ hg help -c commit > /dev/null
1278 $ hg help -c commit > /dev/null
1279 $ hg help -e -c commit > /dev/null
1279 $ hg help -e -c commit > /dev/null
1280 $ hg help -e commit > /dev/null
1280 $ hg help -e commit > /dev/null
1281 abort: no such help topic: commit
1281 abort: no such help topic: commit
1282 (try "hg help --keyword commit")
1282 (try "hg help --keyword commit")
1283 [255]
1283 [255]
1284
1284
1285 Test keyword search help
1285 Test keyword search help
1286
1286
1287 $ cat > prefixedname.py <<EOF
1287 $ cat > prefixedname.py <<EOF
1288 > '''matched against word "clone"
1288 > '''matched against word "clone"
1289 > '''
1289 > '''
1290 > EOF
1290 > EOF
1291 $ echo '[extensions]' >> $HGRCPATH
1291 $ echo '[extensions]' >> $HGRCPATH
1292 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1292 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1293 $ hg help -k clone
1293 $ hg help -k clone
1294 Topics:
1294 Topics:
1295
1295
1296 config Configuration Files
1296 config Configuration Files
1297 extensions Using Additional Features
1297 extensions Using Additional Features
1298 glossary Glossary
1298 glossary Glossary
1299 phases Working with Phases
1299 phases Working with Phases
1300 subrepos Subrepositories
1300 subrepos Subrepositories
1301 urls URL Paths
1301 urls URL Paths
1302
1302
1303 Commands:
1303 Commands:
1304
1304
1305 bookmarks create a new bookmark or list existing bookmarks
1305 bookmarks create a new bookmark or list existing bookmarks
1306 clone make a copy of an existing repository
1306 clone make a copy of an existing repository
1307 paths show aliases for remote repositories
1307 paths show aliases for remote repositories
1308 update update working directory (or switch revisions)
1308 update update working directory (or switch revisions)
1309
1309
1310 Extensions:
1310 Extensions:
1311
1311
1312 clonebundles advertise pre-generated bundles to seed clones (experimental)
1312 clonebundles advertise pre-generated bundles to seed clones (experimental)
1313 prefixedname matched against word "clone"
1313 prefixedname matched against word "clone"
1314 relink recreates hardlinks between repository clones
1314 relink recreates hardlinks between repository clones
1315
1315
1316 Extension Commands:
1316 Extension Commands:
1317
1317
1318 qclone clone main and patch repository at same time
1318 qclone clone main and patch repository at same time
1319
1319
1320 Test unfound topic
1320 Test unfound topic
1321
1321
1322 $ hg help nonexistingtopicthatwillneverexisteverever
1322 $ hg help nonexistingtopicthatwillneverexisteverever
1323 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1323 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1324 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1324 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1325 [255]
1325 [255]
1326
1326
1327 Test unfound keyword
1327 Test unfound keyword
1328
1328
1329 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1329 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1330 abort: no matches
1330 abort: no matches
1331 (try "hg help" for a list of topics)
1331 (try "hg help" for a list of topics)
1332 [255]
1332 [255]
1333
1333
1334 Test omit indicating for help
1334 Test omit indicating for help
1335
1335
1336 $ cat > addverboseitems.py <<EOF
1336 $ cat > addverboseitems.py <<EOF
1337 > '''extension to test omit indicating.
1337 > '''extension to test omit indicating.
1338 >
1338 >
1339 > This paragraph is never omitted (for extension)
1339 > This paragraph is never omitted (for extension)
1340 >
1340 >
1341 > .. container:: verbose
1341 > .. container:: verbose
1342 >
1342 >
1343 > This paragraph is omitted,
1343 > This paragraph is omitted,
1344 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1344 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1345 >
1345 >
1346 > This paragraph is never omitted, too (for extension)
1346 > This paragraph is never omitted, too (for extension)
1347 > '''
1347 > '''
1348 >
1348 >
1349 > from mercurial import help, commands
1349 > from mercurial import help, commands
1350 > testtopic = """This paragraph is never omitted (for topic).
1350 > testtopic = """This paragraph is never omitted (for topic).
1351 >
1351 >
1352 > .. container:: verbose
1352 > .. container:: verbose
1353 >
1353 >
1354 > This paragraph is omitted,
1354 > This paragraph is omitted,
1355 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1355 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1356 >
1356 >
1357 > This paragraph is never omitted, too (for topic)
1357 > This paragraph is never omitted, too (for topic)
1358 > """
1358 > """
1359 > def extsetup(ui):
1359 > def extsetup(ui):
1360 > help.helptable.append((["topic-containing-verbose"],
1360 > help.helptable.append((["topic-containing-verbose"],
1361 > "This is the topic to test omit indicating.",
1361 > "This is the topic to test omit indicating.",
1362 > lambda ui: testtopic))
1362 > lambda ui: testtopic))
1363 > EOF
1363 > EOF
1364 $ echo '[extensions]' >> $HGRCPATH
1364 $ echo '[extensions]' >> $HGRCPATH
1365 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1365 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1366 $ hg help addverboseitems
1366 $ hg help addverboseitems
1367 addverboseitems extension - extension to test omit indicating.
1367 addverboseitems extension - extension to test omit indicating.
1368
1368
1369 This paragraph is never omitted (for extension)
1369 This paragraph is never omitted (for extension)
1370
1370
1371 This paragraph is never omitted, too (for extension)
1371 This paragraph is never omitted, too (for extension)
1372
1372
1373 (some details hidden, use --verbose to show complete help)
1373 (some details hidden, use --verbose to show complete help)
1374
1374
1375 no commands defined
1375 no commands defined
1376 $ hg help -v addverboseitems
1376 $ hg help -v addverboseitems
1377 addverboseitems extension - extension to test omit indicating.
1377 addverboseitems extension - extension to test omit indicating.
1378
1378
1379 This paragraph is never omitted (for extension)
1379 This paragraph is never omitted (for extension)
1380
1380
1381 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1381 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1382 extension)
1382 extension)
1383
1383
1384 This paragraph is never omitted, too (for extension)
1384 This paragraph is never omitted, too (for extension)
1385
1385
1386 no commands defined
1386 no commands defined
1387 $ hg help topic-containing-verbose
1387 $ hg help topic-containing-verbose
1388 This is the topic to test omit indicating.
1388 This is the topic to test omit indicating.
1389 """"""""""""""""""""""""""""""""""""""""""
1389 """"""""""""""""""""""""""""""""""""""""""
1390
1390
1391 This paragraph is never omitted (for topic).
1391 This paragraph is never omitted (for topic).
1392
1392
1393 This paragraph is never omitted, too (for topic)
1393 This paragraph is never omitted, too (for topic)
1394
1394
1395 (some details hidden, use --verbose to show complete help)
1395 (some details hidden, use --verbose to show complete help)
1396 $ hg help -v topic-containing-verbose
1396 $ hg help -v topic-containing-verbose
1397 This is the topic to test omit indicating.
1397 This is the topic to test omit indicating.
1398 """"""""""""""""""""""""""""""""""""""""""
1398 """"""""""""""""""""""""""""""""""""""""""
1399
1399
1400 This paragraph is never omitted (for topic).
1400 This paragraph is never omitted (for topic).
1401
1401
1402 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1402 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1403 topic)
1403 topic)
1404
1404
1405 This paragraph is never omitted, too (for topic)
1405 This paragraph is never omitted, too (for topic)
1406
1406
1407 Test section lookup
1407 Test section lookup
1408
1408
1409 $ hg help revset.merge
1409 $ hg help revset.merge
1410 "merge()"
1410 "merge()"
1411 Changeset is a merge changeset.
1411 Changeset is a merge changeset.
1412
1412
1413 $ hg help glossary.dag
1413 $ hg help glossary.dag
1414 DAG
1414 DAG
1415 The repository of changesets of a distributed version control system
1415 The repository of changesets of a distributed version control system
1416 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1416 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1417 of nodes and edges, where nodes correspond to changesets and edges
1417 of nodes and edges, where nodes correspond to changesets and edges
1418 imply a parent -> child relation. This graph can be visualized by
1418 imply a parent -> child relation. This graph can be visualized by
1419 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1419 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1420 limited by the requirement for children to have at most two parents.
1420 limited by the requirement for children to have at most two parents.
1421
1421
1422
1422
1423 $ hg help hgrc.paths
1423 $ hg help hgrc.paths
1424 "paths"
1424 "paths"
1425 -------
1425 -------
1426
1426
1427 Assigns symbolic names and behavior to repositories.
1427 Assigns symbolic names and behavior to repositories.
1428
1428
1429 Options are symbolic names defining the URL or directory that is the
1429 Options are symbolic names defining the URL or directory that is the
1430 location of the repository. Example:
1430 location of the repository. Example:
1431
1431
1432 [paths]
1432 [paths]
1433 my_server = https://example.com/my_repo
1433 my_server = https://example.com/my_repo
1434 local_path = /home/me/repo
1434 local_path = /home/me/repo
1435
1435
1436 These symbolic names can be used from the command line. To pull from
1436 These symbolic names can be used from the command line. To pull from
1437 "my_server": "hg pull my_server". To push to "local_path": "hg push
1437 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1438 local_path".
1438 local_path'.
1439
1439
1440 Options containing colons (":") denote sub-options that can influence
1440 Options containing colons (":") denote sub-options that can influence
1441 behavior for that specific path. Example:
1441 behavior for that specific path. Example:
1442
1442
1443 [paths]
1443 [paths]
1444 my_server = https://example.com/my_path
1444 my_server = https://example.com/my_path
1445 my_server:pushurl = ssh://example.com/my_path
1445 my_server:pushurl = ssh://example.com/my_path
1446
1446
1447 The following sub-options can be defined:
1447 The following sub-options can be defined:
1448
1448
1449 "pushurl"
1449 "pushurl"
1450 The URL to use for push operations. If not defined, the location
1450 The URL to use for push operations. If not defined, the location
1451 defined by the path's main entry is used.
1451 defined by the path's main entry is used.
1452
1452
1453 The following special named paths exist:
1453 The following special named paths exist:
1454
1454
1455 "default"
1455 "default"
1456 The URL or directory to use when no source or remote is specified.
1456 The URL or directory to use when no source or remote is specified.
1457
1457
1458 "hg clone" will automatically define this path to the location the
1458 'hg clone' will automatically define this path to the location the
1459 repository was cloned from.
1459 repository was cloned from.
1460
1460
1461 "default-push"
1461 "default-push"
1462 (deprecated) The URL or directory for the default "hg push" location.
1462 (deprecated) The URL or directory for the default 'hg push' location.
1463 "default:pushurl" should be used instead.
1463 "default:pushurl" should be used instead.
1464
1464
1465 $ hg help glossary.mcguffin
1465 $ hg help glossary.mcguffin
1466 abort: help section not found
1466 abort: help section not found
1467 [255]
1467 [255]
1468
1468
1469 $ hg help glossary.mc.guffin
1469 $ hg help glossary.mc.guffin
1470 abort: help section not found
1470 abort: help section not found
1471 [255]
1471 [255]
1472
1472
1473 $ hg help template.files
1473 $ hg help template.files
1474 files List of strings. All files modified, added, or removed by
1474 files List of strings. All files modified, added, or removed by
1475 this changeset.
1475 this changeset.
1476
1476
1477 Test dynamic list of merge tools only shows up once
1477 Test dynamic list of merge tools only shows up once
1478 $ hg help merge-tools
1478 $ hg help merge-tools
1479 Merge Tools
1479 Merge Tools
1480 """""""""""
1480 """""""""""
1481
1481
1482 To merge files Mercurial uses merge tools.
1482 To merge files Mercurial uses merge tools.
1483
1483
1484 A merge tool combines two different versions of a file into a merged file.
1484 A merge tool combines two different versions of a file into a merged file.
1485 Merge tools are given the two files and the greatest common ancestor of
1485 Merge tools are given the two files and the greatest common ancestor of
1486 the two file versions, so they can determine the changes made on both
1486 the two file versions, so they can determine the changes made on both
1487 branches.
1487 branches.
1488
1488
1489 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1489 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1490 backout" and in several extensions.
1490 backout' and in several extensions.
1491
1491
1492 Usually, the merge tool tries to automatically reconcile the files by
1492 Usually, the merge tool tries to automatically reconcile the files by
1493 combining all non-overlapping changes that occurred separately in the two
1493 combining all non-overlapping changes that occurred separately in the two
1494 different evolutions of the same initial base file. Furthermore, some
1494 different evolutions of the same initial base file. Furthermore, some
1495 interactive merge programs make it easier to manually resolve conflicting
1495 interactive merge programs make it easier to manually resolve conflicting
1496 merges, either in a graphical way, or by inserting some conflict markers.
1496 merges, either in a graphical way, or by inserting some conflict markers.
1497 Mercurial does not include any interactive merge programs but relies on
1497 Mercurial does not include any interactive merge programs but relies on
1498 external tools for that.
1498 external tools for that.
1499
1499
1500 Available merge tools
1500 Available merge tools
1501 =====================
1501 =====================
1502
1502
1503 External merge tools and their properties are configured in the merge-
1503 External merge tools and their properties are configured in the merge-
1504 tools configuration section - see hgrc(5) - but they can often just be
1504 tools configuration section - see hgrc(5) - but they can often just be
1505 named by their executable.
1505 named by their executable.
1506
1506
1507 A merge tool is generally usable if its executable can be found on the
1507 A merge tool is generally usable if its executable can be found on the
1508 system and if it can handle the merge. The executable is found if it is an
1508 system and if it can handle the merge. The executable is found if it is an
1509 absolute or relative executable path or the name of an application in the
1509 absolute or relative executable path or the name of an application in the
1510 executable search path. The tool is assumed to be able to handle the merge
1510 executable search path. The tool is assumed to be able to handle the merge
1511 if it can handle symlinks if the file is a symlink, if it can handle
1511 if it can handle symlinks if the file is a symlink, if it can handle
1512 binary files if the file is binary, and if a GUI is available if the tool
1512 binary files if the file is binary, and if a GUI is available if the tool
1513 requires a GUI.
1513 requires a GUI.
1514
1514
1515 There are some internal merge tools which can be used. The internal merge
1515 There are some internal merge tools which can be used. The internal merge
1516 tools are:
1516 tools are:
1517
1517
1518 ":dump"
1518 ":dump"
1519 Creates three versions of the files to merge, containing the contents of
1519 Creates three versions of the files to merge, containing the contents of
1520 local, other and base. These files can then be used to perform a merge
1520 local, other and base. These files can then be used to perform a merge
1521 manually. If the file to be merged is named "a.txt", these files will
1521 manually. If the file to be merged is named "a.txt", these files will
1522 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1522 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1523 they will be placed in the same directory as "a.txt".
1523 they will be placed in the same directory as "a.txt".
1524
1524
1525 ":fail"
1525 ":fail"
1526 Rather than attempting to merge files that were modified on both
1526 Rather than attempting to merge files that were modified on both
1527 branches, it marks them as unresolved. The resolve command must be used
1527 branches, it marks them as unresolved. The resolve command must be used
1528 to resolve these conflicts.
1528 to resolve these conflicts.
1529
1529
1530 ":local"
1530 ":local"
1531 Uses the local version of files as the merged version.
1531 Uses the local version of files as the merged version.
1532
1532
1533 ":merge"
1533 ":merge"
1534 Uses the internal non-interactive simple merge algorithm for merging
1534 Uses the internal non-interactive simple merge algorithm for merging
1535 files. It will fail if there are any conflicts and leave markers in the
1535 files. It will fail if there are any conflicts and leave markers in the
1536 partially merged file. Markers will have two sections, one for each side
1536 partially merged file. Markers will have two sections, one for each side
1537 of merge.
1537 of merge.
1538
1538
1539 ":merge-local"
1539 ":merge-local"
1540 Like :merge, but resolve all conflicts non-interactively in favor of the
1540 Like :merge, but resolve all conflicts non-interactively in favor of the
1541 local changes.
1541 local changes.
1542
1542
1543 ":merge-other"
1543 ":merge-other"
1544 Like :merge, but resolve all conflicts non-interactively in favor of the
1544 Like :merge, but resolve all conflicts non-interactively in favor of the
1545 other changes.
1545 other changes.
1546
1546
1547 ":merge3"
1547 ":merge3"
1548 Uses the internal non-interactive simple merge algorithm for merging
1548 Uses the internal non-interactive simple merge algorithm for merging
1549 files. It will fail if there are any conflicts and leave markers in the
1549 files. It will fail if there are any conflicts and leave markers in the
1550 partially merged file. Marker will have three sections, one from each
1550 partially merged file. Marker will have three sections, one from each
1551 side of the merge and one for the base content.
1551 side of the merge and one for the base content.
1552
1552
1553 ":other"
1553 ":other"
1554 Uses the other version of files as the merged version.
1554 Uses the other version of files as the merged version.
1555
1555
1556 ":prompt"
1556 ":prompt"
1557 Asks the user which of the local or the other version to keep as the
1557 Asks the user which of the local or the other version to keep as the
1558 merged version.
1558 merged version.
1559
1559
1560 ":tagmerge"
1560 ":tagmerge"
1561 Uses the internal tag merge algorithm (experimental).
1561 Uses the internal tag merge algorithm (experimental).
1562
1562
1563 ":union"
1563 ":union"
1564 Uses the internal non-interactive simple merge algorithm for merging
1564 Uses the internal non-interactive simple merge algorithm for merging
1565 files. It will use both left and right sides for conflict regions. No
1565 files. It will use both left and right sides for conflict regions. No
1566 markers are inserted.
1566 markers are inserted.
1567
1567
1568 Internal tools are always available and do not require a GUI but will by
1568 Internal tools are always available and do not require a GUI but will by
1569 default not handle symlinks or binary files.
1569 default not handle symlinks or binary files.
1570
1570
1571 Choosing a merge tool
1571 Choosing a merge tool
1572 =====================
1572 =====================
1573
1573
1574 Mercurial uses these rules when deciding which merge tool to use:
1574 Mercurial uses these rules when deciding which merge tool to use:
1575
1575
1576 1. If a tool has been specified with the --tool option to merge or
1576 1. If a tool has been specified with the --tool option to merge or
1577 resolve, it is used. If it is the name of a tool in the merge-tools
1577 resolve, it is used. If it is the name of a tool in the merge-tools
1578 configuration, its configuration is used. Otherwise the specified tool
1578 configuration, its configuration is used. Otherwise the specified tool
1579 must be executable by the shell.
1579 must be executable by the shell.
1580 2. If the "HGMERGE" environment variable is present, its value is used and
1580 2. If the "HGMERGE" environment variable is present, its value is used and
1581 must be executable by the shell.
1581 must be executable by the shell.
1582 3. If the filename of the file to be merged matches any of the patterns in
1582 3. If the filename of the file to be merged matches any of the patterns in
1583 the merge-patterns configuration section, the first usable merge tool
1583 the merge-patterns configuration section, the first usable merge tool
1584 corresponding to a matching pattern is used. Here, binary capabilities
1584 corresponding to a matching pattern is used. Here, binary capabilities
1585 of the merge tool are not considered.
1585 of the merge tool are not considered.
1586 4. If ui.merge is set it will be considered next. If the value is not the
1586 4. If ui.merge is set it will be considered next. If the value is not the
1587 name of a configured tool, the specified value is used and must be
1587 name of a configured tool, the specified value is used and must be
1588 executable by the shell. Otherwise the named tool is used if it is
1588 executable by the shell. Otherwise the named tool is used if it is
1589 usable.
1589 usable.
1590 5. If any usable merge tools are present in the merge-tools configuration
1590 5. If any usable merge tools are present in the merge-tools configuration
1591 section, the one with the highest priority is used.
1591 section, the one with the highest priority is used.
1592 6. If a program named "hgmerge" can be found on the system, it is used -
1592 6. If a program named "hgmerge" can be found on the system, it is used -
1593 but it will by default not be used for symlinks and binary files.
1593 but it will by default not be used for symlinks and binary files.
1594 7. If the file to be merged is not binary and is not a symlink, then
1594 7. If the file to be merged is not binary and is not a symlink, then
1595 internal ":merge" is used.
1595 internal ":merge" is used.
1596 8. The merge of the file fails and must be resolved before commit.
1596 8. The merge of the file fails and must be resolved before commit.
1597
1597
1598 Note:
1598 Note:
1599 After selecting a merge program, Mercurial will by default attempt to
1599 After selecting a merge program, Mercurial will by default attempt to
1600 merge the files using a simple merge algorithm first. Only if it
1600 merge the files using a simple merge algorithm first. Only if it
1601 doesn't succeed because of conflicting changes Mercurial will actually
1601 doesn't succeed because of conflicting changes Mercurial will actually
1602 execute the merge program. Whether to use the simple merge algorithm
1602 execute the merge program. Whether to use the simple merge algorithm
1603 first can be controlled by the premerge setting of the merge tool.
1603 first can be controlled by the premerge setting of the merge tool.
1604 Premerge is enabled by default unless the file is binary or a symlink.
1604 Premerge is enabled by default unless the file is binary or a symlink.
1605
1605
1606 See the merge-tools and ui sections of hgrc(5) for details on the
1606 See the merge-tools and ui sections of hgrc(5) for details on the
1607 configuration of merge tools.
1607 configuration of merge tools.
1608
1608
1609 Test usage of section marks in help documents
1609 Test usage of section marks in help documents
1610
1610
1611 $ cd "$TESTDIR"/../doc
1611 $ cd "$TESTDIR"/../doc
1612 $ python check-seclevel.py
1612 $ python check-seclevel.py
1613 $ cd $TESTTMP
1613 $ cd $TESTTMP
1614
1614
1615 #if serve
1615 #if serve
1616
1616
1617 Test the help pages in hgweb.
1617 Test the help pages in hgweb.
1618
1618
1619 Dish up an empty repo; serve it cold.
1619 Dish up an empty repo; serve it cold.
1620
1620
1621 $ hg init "$TESTTMP/test"
1621 $ hg init "$TESTTMP/test"
1622 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1622 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1623 $ cat hg.pid >> $DAEMON_PIDS
1623 $ cat hg.pid >> $DAEMON_PIDS
1624
1624
1625 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1625 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1626 200 Script output follows
1626 200 Script output follows
1627
1627
1628 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1628 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1629 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1629 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1630 <head>
1630 <head>
1631 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1631 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1632 <meta name="robots" content="index, nofollow" />
1632 <meta name="robots" content="index, nofollow" />
1633 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1633 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1634 <script type="text/javascript" src="/static/mercurial.js"></script>
1634 <script type="text/javascript" src="/static/mercurial.js"></script>
1635
1635
1636 <title>Help: Index</title>
1636 <title>Help: Index</title>
1637 </head>
1637 </head>
1638 <body>
1638 <body>
1639
1639
1640 <div class="container">
1640 <div class="container">
1641 <div class="menu">
1641 <div class="menu">
1642 <div class="logo">
1642 <div class="logo">
1643 <a href="https://mercurial-scm.org/">
1643 <a href="https://mercurial-scm.org/">
1644 <img src="/static/hglogo.png" alt="mercurial" /></a>
1644 <img src="/static/hglogo.png" alt="mercurial" /></a>
1645 </div>
1645 </div>
1646 <ul>
1646 <ul>
1647 <li><a href="/shortlog">log</a></li>
1647 <li><a href="/shortlog">log</a></li>
1648 <li><a href="/graph">graph</a></li>
1648 <li><a href="/graph">graph</a></li>
1649 <li><a href="/tags">tags</a></li>
1649 <li><a href="/tags">tags</a></li>
1650 <li><a href="/bookmarks">bookmarks</a></li>
1650 <li><a href="/bookmarks">bookmarks</a></li>
1651 <li><a href="/branches">branches</a></li>
1651 <li><a href="/branches">branches</a></li>
1652 </ul>
1652 </ul>
1653 <ul>
1653 <ul>
1654 <li class="active">help</li>
1654 <li class="active">help</li>
1655 </ul>
1655 </ul>
1656 </div>
1656 </div>
1657
1657
1658 <div class="main">
1658 <div class="main">
1659 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1659 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1660 <form class="search" action="/log">
1660 <form class="search" action="/log">
1661
1661
1662 <p><input name="rev" id="search1" type="text" size="30" /></p>
1662 <p><input name="rev" id="search1" type="text" size="30" /></p>
1663 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1663 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1664 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1664 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1665 </form>
1665 </form>
1666 <table class="bigtable">
1666 <table class="bigtable">
1667 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1667 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1668
1668
1669 <tr><td>
1669 <tr><td>
1670 <a href="/help/config">
1670 <a href="/help/config">
1671 config
1671 config
1672 </a>
1672 </a>
1673 </td><td>
1673 </td><td>
1674 Configuration Files
1674 Configuration Files
1675 </td></tr>
1675 </td></tr>
1676 <tr><td>
1676 <tr><td>
1677 <a href="/help/dates">
1677 <a href="/help/dates">
1678 dates
1678 dates
1679 </a>
1679 </a>
1680 </td><td>
1680 </td><td>
1681 Date Formats
1681 Date Formats
1682 </td></tr>
1682 </td></tr>
1683 <tr><td>
1683 <tr><td>
1684 <a href="/help/diffs">
1684 <a href="/help/diffs">
1685 diffs
1685 diffs
1686 </a>
1686 </a>
1687 </td><td>
1687 </td><td>
1688 Diff Formats
1688 Diff Formats
1689 </td></tr>
1689 </td></tr>
1690 <tr><td>
1690 <tr><td>
1691 <a href="/help/environment">
1691 <a href="/help/environment">
1692 environment
1692 environment
1693 </a>
1693 </a>
1694 </td><td>
1694 </td><td>
1695 Environment Variables
1695 Environment Variables
1696 </td></tr>
1696 </td></tr>
1697 <tr><td>
1697 <tr><td>
1698 <a href="/help/extensions">
1698 <a href="/help/extensions">
1699 extensions
1699 extensions
1700 </a>
1700 </a>
1701 </td><td>
1701 </td><td>
1702 Using Additional Features
1702 Using Additional Features
1703 </td></tr>
1703 </td></tr>
1704 <tr><td>
1704 <tr><td>
1705 <a href="/help/filesets">
1705 <a href="/help/filesets">
1706 filesets
1706 filesets
1707 </a>
1707 </a>
1708 </td><td>
1708 </td><td>
1709 Specifying File Sets
1709 Specifying File Sets
1710 </td></tr>
1710 </td></tr>
1711 <tr><td>
1711 <tr><td>
1712 <a href="/help/glossary">
1712 <a href="/help/glossary">
1713 glossary
1713 glossary
1714 </a>
1714 </a>
1715 </td><td>
1715 </td><td>
1716 Glossary
1716 Glossary
1717 </td></tr>
1717 </td></tr>
1718 <tr><td>
1718 <tr><td>
1719 <a href="/help/hgignore">
1719 <a href="/help/hgignore">
1720 hgignore
1720 hgignore
1721 </a>
1721 </a>
1722 </td><td>
1722 </td><td>
1723 Syntax for Mercurial Ignore Files
1723 Syntax for Mercurial Ignore Files
1724 </td></tr>
1724 </td></tr>
1725 <tr><td>
1725 <tr><td>
1726 <a href="/help/hgweb">
1726 <a href="/help/hgweb">
1727 hgweb
1727 hgweb
1728 </a>
1728 </a>
1729 </td><td>
1729 </td><td>
1730 Configuring hgweb
1730 Configuring hgweb
1731 </td></tr>
1731 </td></tr>
1732 <tr><td>
1732 <tr><td>
1733 <a href="/help/internals">
1733 <a href="/help/internals">
1734 internals
1734 internals
1735 </a>
1735 </a>
1736 </td><td>
1736 </td><td>
1737 Technical implementation topics
1737 Technical implementation topics
1738 </td></tr>
1738 </td></tr>
1739 <tr><td>
1739 <tr><td>
1740 <a href="/help/merge-tools">
1740 <a href="/help/merge-tools">
1741 merge-tools
1741 merge-tools
1742 </a>
1742 </a>
1743 </td><td>
1743 </td><td>
1744 Merge Tools
1744 Merge Tools
1745 </td></tr>
1745 </td></tr>
1746 <tr><td>
1746 <tr><td>
1747 <a href="/help/multirevs">
1747 <a href="/help/multirevs">
1748 multirevs
1748 multirevs
1749 </a>
1749 </a>
1750 </td><td>
1750 </td><td>
1751 Specifying Multiple Revisions
1751 Specifying Multiple Revisions
1752 </td></tr>
1752 </td></tr>
1753 <tr><td>
1753 <tr><td>
1754 <a href="/help/patterns">
1754 <a href="/help/patterns">
1755 patterns
1755 patterns
1756 </a>
1756 </a>
1757 </td><td>
1757 </td><td>
1758 File Name Patterns
1758 File Name Patterns
1759 </td></tr>
1759 </td></tr>
1760 <tr><td>
1760 <tr><td>
1761 <a href="/help/phases">
1761 <a href="/help/phases">
1762 phases
1762 phases
1763 </a>
1763 </a>
1764 </td><td>
1764 </td><td>
1765 Working with Phases
1765 Working with Phases
1766 </td></tr>
1766 </td></tr>
1767 <tr><td>
1767 <tr><td>
1768 <a href="/help/revisions">
1768 <a href="/help/revisions">
1769 revisions
1769 revisions
1770 </a>
1770 </a>
1771 </td><td>
1771 </td><td>
1772 Specifying Single Revisions
1772 Specifying Single Revisions
1773 </td></tr>
1773 </td></tr>
1774 <tr><td>
1774 <tr><td>
1775 <a href="/help/revsets">
1775 <a href="/help/revsets">
1776 revsets
1776 revsets
1777 </a>
1777 </a>
1778 </td><td>
1778 </td><td>
1779 Specifying Revision Sets
1779 Specifying Revision Sets
1780 </td></tr>
1780 </td></tr>
1781 <tr><td>
1781 <tr><td>
1782 <a href="/help/scripting">
1782 <a href="/help/scripting">
1783 scripting
1783 scripting
1784 </a>
1784 </a>
1785 </td><td>
1785 </td><td>
1786 Using Mercurial from scripts and automation
1786 Using Mercurial from scripts and automation
1787 </td></tr>
1787 </td></tr>
1788 <tr><td>
1788 <tr><td>
1789 <a href="/help/subrepos">
1789 <a href="/help/subrepos">
1790 subrepos
1790 subrepos
1791 </a>
1791 </a>
1792 </td><td>
1792 </td><td>
1793 Subrepositories
1793 Subrepositories
1794 </td></tr>
1794 </td></tr>
1795 <tr><td>
1795 <tr><td>
1796 <a href="/help/templating">
1796 <a href="/help/templating">
1797 templating
1797 templating
1798 </a>
1798 </a>
1799 </td><td>
1799 </td><td>
1800 Template Usage
1800 Template Usage
1801 </td></tr>
1801 </td></tr>
1802 <tr><td>
1802 <tr><td>
1803 <a href="/help/urls">
1803 <a href="/help/urls">
1804 urls
1804 urls
1805 </a>
1805 </a>
1806 </td><td>
1806 </td><td>
1807 URL Paths
1807 URL Paths
1808 </td></tr>
1808 </td></tr>
1809 <tr><td>
1809 <tr><td>
1810 <a href="/help/topic-containing-verbose">
1810 <a href="/help/topic-containing-verbose">
1811 topic-containing-verbose
1811 topic-containing-verbose
1812 </a>
1812 </a>
1813 </td><td>
1813 </td><td>
1814 This is the topic to test omit indicating.
1814 This is the topic to test omit indicating.
1815 </td></tr>
1815 </td></tr>
1816
1816
1817
1817
1818 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1818 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1819
1819
1820 <tr><td>
1820 <tr><td>
1821 <a href="/help/add">
1821 <a href="/help/add">
1822 add
1822 add
1823 </a>
1823 </a>
1824 </td><td>
1824 </td><td>
1825 add the specified files on the next commit
1825 add the specified files on the next commit
1826 </td></tr>
1826 </td></tr>
1827 <tr><td>
1827 <tr><td>
1828 <a href="/help/annotate">
1828 <a href="/help/annotate">
1829 annotate
1829 annotate
1830 </a>
1830 </a>
1831 </td><td>
1831 </td><td>
1832 show changeset information by line for each file
1832 show changeset information by line for each file
1833 </td></tr>
1833 </td></tr>
1834 <tr><td>
1834 <tr><td>
1835 <a href="/help/clone">
1835 <a href="/help/clone">
1836 clone
1836 clone
1837 </a>
1837 </a>
1838 </td><td>
1838 </td><td>
1839 make a copy of an existing repository
1839 make a copy of an existing repository
1840 </td></tr>
1840 </td></tr>
1841 <tr><td>
1841 <tr><td>
1842 <a href="/help/commit">
1842 <a href="/help/commit">
1843 commit
1843 commit
1844 </a>
1844 </a>
1845 </td><td>
1845 </td><td>
1846 commit the specified files or all outstanding changes
1846 commit the specified files or all outstanding changes
1847 </td></tr>
1847 </td></tr>
1848 <tr><td>
1848 <tr><td>
1849 <a href="/help/diff">
1849 <a href="/help/diff">
1850 diff
1850 diff
1851 </a>
1851 </a>
1852 </td><td>
1852 </td><td>
1853 diff repository (or selected files)
1853 diff repository (or selected files)
1854 </td></tr>
1854 </td></tr>
1855 <tr><td>
1855 <tr><td>
1856 <a href="/help/export">
1856 <a href="/help/export">
1857 export
1857 export
1858 </a>
1858 </a>
1859 </td><td>
1859 </td><td>
1860 dump the header and diffs for one or more changesets
1860 dump the header and diffs for one or more changesets
1861 </td></tr>
1861 </td></tr>
1862 <tr><td>
1862 <tr><td>
1863 <a href="/help/forget">
1863 <a href="/help/forget">
1864 forget
1864 forget
1865 </a>
1865 </a>
1866 </td><td>
1866 </td><td>
1867 forget the specified files on the next commit
1867 forget the specified files on the next commit
1868 </td></tr>
1868 </td></tr>
1869 <tr><td>
1869 <tr><td>
1870 <a href="/help/init">
1870 <a href="/help/init">
1871 init
1871 init
1872 </a>
1872 </a>
1873 </td><td>
1873 </td><td>
1874 create a new repository in the given directory
1874 create a new repository in the given directory
1875 </td></tr>
1875 </td></tr>
1876 <tr><td>
1876 <tr><td>
1877 <a href="/help/log">
1877 <a href="/help/log">
1878 log
1878 log
1879 </a>
1879 </a>
1880 </td><td>
1880 </td><td>
1881 show revision history of entire repository or files
1881 show revision history of entire repository or files
1882 </td></tr>
1882 </td></tr>
1883 <tr><td>
1883 <tr><td>
1884 <a href="/help/merge">
1884 <a href="/help/merge">
1885 merge
1885 merge
1886 </a>
1886 </a>
1887 </td><td>
1887 </td><td>
1888 merge another revision into working directory
1888 merge another revision into working directory
1889 </td></tr>
1889 </td></tr>
1890 <tr><td>
1890 <tr><td>
1891 <a href="/help/pull">
1891 <a href="/help/pull">
1892 pull
1892 pull
1893 </a>
1893 </a>
1894 </td><td>
1894 </td><td>
1895 pull changes from the specified source
1895 pull changes from the specified source
1896 </td></tr>
1896 </td></tr>
1897 <tr><td>
1897 <tr><td>
1898 <a href="/help/push">
1898 <a href="/help/push">
1899 push
1899 push
1900 </a>
1900 </a>
1901 </td><td>
1901 </td><td>
1902 push changes to the specified destination
1902 push changes to the specified destination
1903 </td></tr>
1903 </td></tr>
1904 <tr><td>
1904 <tr><td>
1905 <a href="/help/remove">
1905 <a href="/help/remove">
1906 remove
1906 remove
1907 </a>
1907 </a>
1908 </td><td>
1908 </td><td>
1909 remove the specified files on the next commit
1909 remove the specified files on the next commit
1910 </td></tr>
1910 </td></tr>
1911 <tr><td>
1911 <tr><td>
1912 <a href="/help/serve">
1912 <a href="/help/serve">
1913 serve
1913 serve
1914 </a>
1914 </a>
1915 </td><td>
1915 </td><td>
1916 start stand-alone webserver
1916 start stand-alone webserver
1917 </td></tr>
1917 </td></tr>
1918 <tr><td>
1918 <tr><td>
1919 <a href="/help/status">
1919 <a href="/help/status">
1920 status
1920 status
1921 </a>
1921 </a>
1922 </td><td>
1922 </td><td>
1923 show changed files in the working directory
1923 show changed files in the working directory
1924 </td></tr>
1924 </td></tr>
1925 <tr><td>
1925 <tr><td>
1926 <a href="/help/summary">
1926 <a href="/help/summary">
1927 summary
1927 summary
1928 </a>
1928 </a>
1929 </td><td>
1929 </td><td>
1930 summarize working directory state
1930 summarize working directory state
1931 </td></tr>
1931 </td></tr>
1932 <tr><td>
1932 <tr><td>
1933 <a href="/help/update">
1933 <a href="/help/update">
1934 update
1934 update
1935 </a>
1935 </a>
1936 </td><td>
1936 </td><td>
1937 update working directory (or switch revisions)
1937 update working directory (or switch revisions)
1938 </td></tr>
1938 </td></tr>
1939
1939
1940
1940
1941
1941
1942 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1942 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1943
1943
1944 <tr><td>
1944 <tr><td>
1945 <a href="/help/addremove">
1945 <a href="/help/addremove">
1946 addremove
1946 addremove
1947 </a>
1947 </a>
1948 </td><td>
1948 </td><td>
1949 add all new files, delete all missing files
1949 add all new files, delete all missing files
1950 </td></tr>
1950 </td></tr>
1951 <tr><td>
1951 <tr><td>
1952 <a href="/help/archive">
1952 <a href="/help/archive">
1953 archive
1953 archive
1954 </a>
1954 </a>
1955 </td><td>
1955 </td><td>
1956 create an unversioned archive of a repository revision
1956 create an unversioned archive of a repository revision
1957 </td></tr>
1957 </td></tr>
1958 <tr><td>
1958 <tr><td>
1959 <a href="/help/backout">
1959 <a href="/help/backout">
1960 backout
1960 backout
1961 </a>
1961 </a>
1962 </td><td>
1962 </td><td>
1963 reverse effect of earlier changeset
1963 reverse effect of earlier changeset
1964 </td></tr>
1964 </td></tr>
1965 <tr><td>
1965 <tr><td>
1966 <a href="/help/bisect">
1966 <a href="/help/bisect">
1967 bisect
1967 bisect
1968 </a>
1968 </a>
1969 </td><td>
1969 </td><td>
1970 subdivision search of changesets
1970 subdivision search of changesets
1971 </td></tr>
1971 </td></tr>
1972 <tr><td>
1972 <tr><td>
1973 <a href="/help/bookmarks">
1973 <a href="/help/bookmarks">
1974 bookmarks
1974 bookmarks
1975 </a>
1975 </a>
1976 </td><td>
1976 </td><td>
1977 create a new bookmark or list existing bookmarks
1977 create a new bookmark or list existing bookmarks
1978 </td></tr>
1978 </td></tr>
1979 <tr><td>
1979 <tr><td>
1980 <a href="/help/branch">
1980 <a href="/help/branch">
1981 branch
1981 branch
1982 </a>
1982 </a>
1983 </td><td>
1983 </td><td>
1984 set or show the current branch name
1984 set or show the current branch name
1985 </td></tr>
1985 </td></tr>
1986 <tr><td>
1986 <tr><td>
1987 <a href="/help/branches">
1987 <a href="/help/branches">
1988 branches
1988 branches
1989 </a>
1989 </a>
1990 </td><td>
1990 </td><td>
1991 list repository named branches
1991 list repository named branches
1992 </td></tr>
1992 </td></tr>
1993 <tr><td>
1993 <tr><td>
1994 <a href="/help/bundle">
1994 <a href="/help/bundle">
1995 bundle
1995 bundle
1996 </a>
1996 </a>
1997 </td><td>
1997 </td><td>
1998 create a changegroup file
1998 create a changegroup file
1999 </td></tr>
1999 </td></tr>
2000 <tr><td>
2000 <tr><td>
2001 <a href="/help/cat">
2001 <a href="/help/cat">
2002 cat
2002 cat
2003 </a>
2003 </a>
2004 </td><td>
2004 </td><td>
2005 output the current or given revision of files
2005 output the current or given revision of files
2006 </td></tr>
2006 </td></tr>
2007 <tr><td>
2007 <tr><td>
2008 <a href="/help/config">
2008 <a href="/help/config">
2009 config
2009 config
2010 </a>
2010 </a>
2011 </td><td>
2011 </td><td>
2012 show combined config settings from all hgrc files
2012 show combined config settings from all hgrc files
2013 </td></tr>
2013 </td></tr>
2014 <tr><td>
2014 <tr><td>
2015 <a href="/help/copy">
2015 <a href="/help/copy">
2016 copy
2016 copy
2017 </a>
2017 </a>
2018 </td><td>
2018 </td><td>
2019 mark files as copied for the next commit
2019 mark files as copied for the next commit
2020 </td></tr>
2020 </td></tr>
2021 <tr><td>
2021 <tr><td>
2022 <a href="/help/files">
2022 <a href="/help/files">
2023 files
2023 files
2024 </a>
2024 </a>
2025 </td><td>
2025 </td><td>
2026 list tracked files
2026 list tracked files
2027 </td></tr>
2027 </td></tr>
2028 <tr><td>
2028 <tr><td>
2029 <a href="/help/graft">
2029 <a href="/help/graft">
2030 graft
2030 graft
2031 </a>
2031 </a>
2032 </td><td>
2032 </td><td>
2033 copy changes from other branches onto the current branch
2033 copy changes from other branches onto the current branch
2034 </td></tr>
2034 </td></tr>
2035 <tr><td>
2035 <tr><td>
2036 <a href="/help/grep">
2036 <a href="/help/grep">
2037 grep
2037 grep
2038 </a>
2038 </a>
2039 </td><td>
2039 </td><td>
2040 search for a pattern in specified files and revisions
2040 search for a pattern in specified files and revisions
2041 </td></tr>
2041 </td></tr>
2042 <tr><td>
2042 <tr><td>
2043 <a href="/help/heads">
2043 <a href="/help/heads">
2044 heads
2044 heads
2045 </a>
2045 </a>
2046 </td><td>
2046 </td><td>
2047 show branch heads
2047 show branch heads
2048 </td></tr>
2048 </td></tr>
2049 <tr><td>
2049 <tr><td>
2050 <a href="/help/help">
2050 <a href="/help/help">
2051 help
2051 help
2052 </a>
2052 </a>
2053 </td><td>
2053 </td><td>
2054 show help for a given topic or a help overview
2054 show help for a given topic or a help overview
2055 </td></tr>
2055 </td></tr>
2056 <tr><td>
2056 <tr><td>
2057 <a href="/help/identify">
2057 <a href="/help/identify">
2058 identify
2058 identify
2059 </a>
2059 </a>
2060 </td><td>
2060 </td><td>
2061 identify the working directory or specified revision
2061 identify the working directory or specified revision
2062 </td></tr>
2062 </td></tr>
2063 <tr><td>
2063 <tr><td>
2064 <a href="/help/import">
2064 <a href="/help/import">
2065 import
2065 import
2066 </a>
2066 </a>
2067 </td><td>
2067 </td><td>
2068 import an ordered set of patches
2068 import an ordered set of patches
2069 </td></tr>
2069 </td></tr>
2070 <tr><td>
2070 <tr><td>
2071 <a href="/help/incoming">
2071 <a href="/help/incoming">
2072 incoming
2072 incoming
2073 </a>
2073 </a>
2074 </td><td>
2074 </td><td>
2075 show new changesets found in source
2075 show new changesets found in source
2076 </td></tr>
2076 </td></tr>
2077 <tr><td>
2077 <tr><td>
2078 <a href="/help/manifest">
2078 <a href="/help/manifest">
2079 manifest
2079 manifest
2080 </a>
2080 </a>
2081 </td><td>
2081 </td><td>
2082 output the current or given revision of the project manifest
2082 output the current or given revision of the project manifest
2083 </td></tr>
2083 </td></tr>
2084 <tr><td>
2084 <tr><td>
2085 <a href="/help/nohelp">
2085 <a href="/help/nohelp">
2086 nohelp
2086 nohelp
2087 </a>
2087 </a>
2088 </td><td>
2088 </td><td>
2089 (no help text available)
2089 (no help text available)
2090 </td></tr>
2090 </td></tr>
2091 <tr><td>
2091 <tr><td>
2092 <a href="/help/outgoing">
2092 <a href="/help/outgoing">
2093 outgoing
2093 outgoing
2094 </a>
2094 </a>
2095 </td><td>
2095 </td><td>
2096 show changesets not found in the destination
2096 show changesets not found in the destination
2097 </td></tr>
2097 </td></tr>
2098 <tr><td>
2098 <tr><td>
2099 <a href="/help/paths">
2099 <a href="/help/paths">
2100 paths
2100 paths
2101 </a>
2101 </a>
2102 </td><td>
2102 </td><td>
2103 show aliases for remote repositories
2103 show aliases for remote repositories
2104 </td></tr>
2104 </td></tr>
2105 <tr><td>
2105 <tr><td>
2106 <a href="/help/phase">
2106 <a href="/help/phase">
2107 phase
2107 phase
2108 </a>
2108 </a>
2109 </td><td>
2109 </td><td>
2110 set or show the current phase name
2110 set or show the current phase name
2111 </td></tr>
2111 </td></tr>
2112 <tr><td>
2112 <tr><td>
2113 <a href="/help/recover">
2113 <a href="/help/recover">
2114 recover
2114 recover
2115 </a>
2115 </a>
2116 </td><td>
2116 </td><td>
2117 roll back an interrupted transaction
2117 roll back an interrupted transaction
2118 </td></tr>
2118 </td></tr>
2119 <tr><td>
2119 <tr><td>
2120 <a href="/help/rename">
2120 <a href="/help/rename">
2121 rename
2121 rename
2122 </a>
2122 </a>
2123 </td><td>
2123 </td><td>
2124 rename files; equivalent of copy + remove
2124 rename files; equivalent of copy + remove
2125 </td></tr>
2125 </td></tr>
2126 <tr><td>
2126 <tr><td>
2127 <a href="/help/resolve">
2127 <a href="/help/resolve">
2128 resolve
2128 resolve
2129 </a>
2129 </a>
2130 </td><td>
2130 </td><td>
2131 redo merges or set/view the merge status of files
2131 redo merges or set/view the merge status of files
2132 </td></tr>
2132 </td></tr>
2133 <tr><td>
2133 <tr><td>
2134 <a href="/help/revert">
2134 <a href="/help/revert">
2135 revert
2135 revert
2136 </a>
2136 </a>
2137 </td><td>
2137 </td><td>
2138 restore files to their checkout state
2138 restore files to their checkout state
2139 </td></tr>
2139 </td></tr>
2140 <tr><td>
2140 <tr><td>
2141 <a href="/help/root">
2141 <a href="/help/root">
2142 root
2142 root
2143 </a>
2143 </a>
2144 </td><td>
2144 </td><td>
2145 print the root (top) of the current working directory
2145 print the root (top) of the current working directory
2146 </td></tr>
2146 </td></tr>
2147 <tr><td>
2147 <tr><td>
2148 <a href="/help/tag">
2148 <a href="/help/tag">
2149 tag
2149 tag
2150 </a>
2150 </a>
2151 </td><td>
2151 </td><td>
2152 add one or more tags for the current or given revision
2152 add one or more tags for the current or given revision
2153 </td></tr>
2153 </td></tr>
2154 <tr><td>
2154 <tr><td>
2155 <a href="/help/tags">
2155 <a href="/help/tags">
2156 tags
2156 tags
2157 </a>
2157 </a>
2158 </td><td>
2158 </td><td>
2159 list repository tags
2159 list repository tags
2160 </td></tr>
2160 </td></tr>
2161 <tr><td>
2161 <tr><td>
2162 <a href="/help/unbundle">
2162 <a href="/help/unbundle">
2163 unbundle
2163 unbundle
2164 </a>
2164 </a>
2165 </td><td>
2165 </td><td>
2166 apply one or more changegroup files
2166 apply one or more changegroup files
2167 </td></tr>
2167 </td></tr>
2168 <tr><td>
2168 <tr><td>
2169 <a href="/help/verify">
2169 <a href="/help/verify">
2170 verify
2170 verify
2171 </a>
2171 </a>
2172 </td><td>
2172 </td><td>
2173 verify the integrity of the repository
2173 verify the integrity of the repository
2174 </td></tr>
2174 </td></tr>
2175 <tr><td>
2175 <tr><td>
2176 <a href="/help/version">
2176 <a href="/help/version">
2177 version
2177 version
2178 </a>
2178 </a>
2179 </td><td>
2179 </td><td>
2180 output version and copyright information
2180 output version and copyright information
2181 </td></tr>
2181 </td></tr>
2182
2182
2183
2183
2184 </table>
2184 </table>
2185 </div>
2185 </div>
2186 </div>
2186 </div>
2187
2187
2188 <script type="text/javascript">process_dates()</script>
2188 <script type="text/javascript">process_dates()</script>
2189
2189
2190
2190
2191 </body>
2191 </body>
2192 </html>
2192 </html>
2193
2193
2194
2194
2195 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2195 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2196 200 Script output follows
2196 200 Script output follows
2197
2197
2198 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2198 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2199 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2199 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2200 <head>
2200 <head>
2201 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2201 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2202 <meta name="robots" content="index, nofollow" />
2202 <meta name="robots" content="index, nofollow" />
2203 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2203 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2204 <script type="text/javascript" src="/static/mercurial.js"></script>
2204 <script type="text/javascript" src="/static/mercurial.js"></script>
2205
2205
2206 <title>Help: add</title>
2206 <title>Help: add</title>
2207 </head>
2207 </head>
2208 <body>
2208 <body>
2209
2209
2210 <div class="container">
2210 <div class="container">
2211 <div class="menu">
2211 <div class="menu">
2212 <div class="logo">
2212 <div class="logo">
2213 <a href="https://mercurial-scm.org/">
2213 <a href="https://mercurial-scm.org/">
2214 <img src="/static/hglogo.png" alt="mercurial" /></a>
2214 <img src="/static/hglogo.png" alt="mercurial" /></a>
2215 </div>
2215 </div>
2216 <ul>
2216 <ul>
2217 <li><a href="/shortlog">log</a></li>
2217 <li><a href="/shortlog">log</a></li>
2218 <li><a href="/graph">graph</a></li>
2218 <li><a href="/graph">graph</a></li>
2219 <li><a href="/tags">tags</a></li>
2219 <li><a href="/tags">tags</a></li>
2220 <li><a href="/bookmarks">bookmarks</a></li>
2220 <li><a href="/bookmarks">bookmarks</a></li>
2221 <li><a href="/branches">branches</a></li>
2221 <li><a href="/branches">branches</a></li>
2222 </ul>
2222 </ul>
2223 <ul>
2223 <ul>
2224 <li class="active"><a href="/help">help</a></li>
2224 <li class="active"><a href="/help">help</a></li>
2225 </ul>
2225 </ul>
2226 </div>
2226 </div>
2227
2227
2228 <div class="main">
2228 <div class="main">
2229 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2229 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2230 <h3>Help: add</h3>
2230 <h3>Help: add</h3>
2231
2231
2232 <form class="search" action="/log">
2232 <form class="search" action="/log">
2233
2233
2234 <p><input name="rev" id="search1" type="text" size="30" /></p>
2234 <p><input name="rev" id="search1" type="text" size="30" /></p>
2235 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2235 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2236 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2236 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2237 </form>
2237 </form>
2238 <div id="doc">
2238 <div id="doc">
2239 <p>
2239 <p>
2240 hg add [OPTION]... [FILE]...
2240 hg add [OPTION]... [FILE]...
2241 </p>
2241 </p>
2242 <p>
2242 <p>
2243 add the specified files on the next commit
2243 add the specified files on the next commit
2244 </p>
2244 </p>
2245 <p>
2245 <p>
2246 Schedule files to be version controlled and added to the
2246 Schedule files to be version controlled and added to the
2247 repository.
2247 repository.
2248 </p>
2248 </p>
2249 <p>
2249 <p>
2250 The files will be added to the repository at the next commit. To
2250 The files will be added to the repository at the next commit. To
2251 undo an add before that, see &quot;hg forget&quot;.
2251 undo an add before that, see 'hg forget'.
2252 </p>
2252 </p>
2253 <p>
2253 <p>
2254 If no names are given, add all files to the repository (except
2254 If no names are given, add all files to the repository (except
2255 files matching &quot;.hgignore&quot;).
2255 files matching &quot;.hgignore&quot;).
2256 </p>
2256 </p>
2257 <p>
2257 <p>
2258 Examples:
2258 Examples:
2259 </p>
2259 </p>
2260 <ul>
2260 <ul>
2261 <li> New (unknown) files are added automatically by &quot;hg add&quot;:
2261 <li> New (unknown) files are added automatically by 'hg add':
2262 <pre>
2262 <pre>
2263 \$ ls (re)
2263 \$ ls (re)
2264 foo.c
2264 foo.c
2265 \$ hg status (re)
2265 \$ hg status (re)
2266 ? foo.c
2266 ? foo.c
2267 \$ hg add (re)
2267 \$ hg add (re)
2268 adding foo.c
2268 adding foo.c
2269 \$ hg status (re)
2269 \$ hg status (re)
2270 A foo.c
2270 A foo.c
2271 </pre>
2271 </pre>
2272 <li> Specific files to be added can be specified:
2272 <li> Specific files to be added can be specified:
2273 <pre>
2273 <pre>
2274 \$ ls (re)
2274 \$ ls (re)
2275 bar.c foo.c
2275 bar.c foo.c
2276 \$ hg status (re)
2276 \$ hg status (re)
2277 ? bar.c
2277 ? bar.c
2278 ? foo.c
2278 ? foo.c
2279 \$ hg add bar.c (re)
2279 \$ hg add bar.c (re)
2280 \$ hg status (re)
2280 \$ hg status (re)
2281 A bar.c
2281 A bar.c
2282 ? foo.c
2282 ? foo.c
2283 </pre>
2283 </pre>
2284 </ul>
2284 </ul>
2285 <p>
2285 <p>
2286 Returns 0 if all files are successfully added.
2286 Returns 0 if all files are successfully added.
2287 </p>
2287 </p>
2288 <p>
2288 <p>
2289 options ([+] can be repeated):
2289 options ([+] can be repeated):
2290 </p>
2290 </p>
2291 <table>
2291 <table>
2292 <tr><td>-I</td>
2292 <tr><td>-I</td>
2293 <td>--include PATTERN [+]</td>
2293 <td>--include PATTERN [+]</td>
2294 <td>include names matching the given patterns</td></tr>
2294 <td>include names matching the given patterns</td></tr>
2295 <tr><td>-X</td>
2295 <tr><td>-X</td>
2296 <td>--exclude PATTERN [+]</td>
2296 <td>--exclude PATTERN [+]</td>
2297 <td>exclude names matching the given patterns</td></tr>
2297 <td>exclude names matching the given patterns</td></tr>
2298 <tr><td>-S</td>
2298 <tr><td>-S</td>
2299 <td>--subrepos</td>
2299 <td>--subrepos</td>
2300 <td>recurse into subrepositories</td></tr>
2300 <td>recurse into subrepositories</td></tr>
2301 <tr><td>-n</td>
2301 <tr><td>-n</td>
2302 <td>--dry-run</td>
2302 <td>--dry-run</td>
2303 <td>do not perform actions, just print output</td></tr>
2303 <td>do not perform actions, just print output</td></tr>
2304 </table>
2304 </table>
2305 <p>
2305 <p>
2306 global options ([+] can be repeated):
2306 global options ([+] can be repeated):
2307 </p>
2307 </p>
2308 <table>
2308 <table>
2309 <tr><td>-R</td>
2309 <tr><td>-R</td>
2310 <td>--repository REPO</td>
2310 <td>--repository REPO</td>
2311 <td>repository root directory or name of overlay bundle file</td></tr>
2311 <td>repository root directory or name of overlay bundle file</td></tr>
2312 <tr><td></td>
2312 <tr><td></td>
2313 <td>--cwd DIR</td>
2313 <td>--cwd DIR</td>
2314 <td>change working directory</td></tr>
2314 <td>change working directory</td></tr>
2315 <tr><td>-y</td>
2315 <tr><td>-y</td>
2316 <td>--noninteractive</td>
2316 <td>--noninteractive</td>
2317 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2317 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2318 <tr><td>-q</td>
2318 <tr><td>-q</td>
2319 <td>--quiet</td>
2319 <td>--quiet</td>
2320 <td>suppress output</td></tr>
2320 <td>suppress output</td></tr>
2321 <tr><td>-v</td>
2321 <tr><td>-v</td>
2322 <td>--verbose</td>
2322 <td>--verbose</td>
2323 <td>enable additional output</td></tr>
2323 <td>enable additional output</td></tr>
2324 <tr><td></td>
2324 <tr><td></td>
2325 <td>--config CONFIG [+]</td>
2325 <td>--config CONFIG [+]</td>
2326 <td>set/override config option (use 'section.name=value')</td></tr>
2326 <td>set/override config option (use 'section.name=value')</td></tr>
2327 <tr><td></td>
2327 <tr><td></td>
2328 <td>--debug</td>
2328 <td>--debug</td>
2329 <td>enable debugging output</td></tr>
2329 <td>enable debugging output</td></tr>
2330 <tr><td></td>
2330 <tr><td></td>
2331 <td>--debugger</td>
2331 <td>--debugger</td>
2332 <td>start debugger</td></tr>
2332 <td>start debugger</td></tr>
2333 <tr><td></td>
2333 <tr><td></td>
2334 <td>--encoding ENCODE</td>
2334 <td>--encoding ENCODE</td>
2335 <td>set the charset encoding (default: ascii)</td></tr>
2335 <td>set the charset encoding (default: ascii)</td></tr>
2336 <tr><td></td>
2336 <tr><td></td>
2337 <td>--encodingmode MODE</td>
2337 <td>--encodingmode MODE</td>
2338 <td>set the charset encoding mode (default: strict)</td></tr>
2338 <td>set the charset encoding mode (default: strict)</td></tr>
2339 <tr><td></td>
2339 <tr><td></td>
2340 <td>--traceback</td>
2340 <td>--traceback</td>
2341 <td>always print a traceback on exception</td></tr>
2341 <td>always print a traceback on exception</td></tr>
2342 <tr><td></td>
2342 <tr><td></td>
2343 <td>--time</td>
2343 <td>--time</td>
2344 <td>time how long the command takes</td></tr>
2344 <td>time how long the command takes</td></tr>
2345 <tr><td></td>
2345 <tr><td></td>
2346 <td>--profile</td>
2346 <td>--profile</td>
2347 <td>print command execution profile</td></tr>
2347 <td>print command execution profile</td></tr>
2348 <tr><td></td>
2348 <tr><td></td>
2349 <td>--version</td>
2349 <td>--version</td>
2350 <td>output version information and exit</td></tr>
2350 <td>output version information and exit</td></tr>
2351 <tr><td>-h</td>
2351 <tr><td>-h</td>
2352 <td>--help</td>
2352 <td>--help</td>
2353 <td>display help and exit</td></tr>
2353 <td>display help and exit</td></tr>
2354 <tr><td></td>
2354 <tr><td></td>
2355 <td>--hidden</td>
2355 <td>--hidden</td>
2356 <td>consider hidden changesets</td></tr>
2356 <td>consider hidden changesets</td></tr>
2357 </table>
2357 </table>
2358
2358
2359 </div>
2359 </div>
2360 </div>
2360 </div>
2361 </div>
2361 </div>
2362
2362
2363 <script type="text/javascript">process_dates()</script>
2363 <script type="text/javascript">process_dates()</script>
2364
2364
2365
2365
2366 </body>
2366 </body>
2367 </html>
2367 </html>
2368
2368
2369
2369
2370 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2370 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2371 200 Script output follows
2371 200 Script output follows
2372
2372
2373 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2373 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2374 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2374 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2375 <head>
2375 <head>
2376 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2376 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2377 <meta name="robots" content="index, nofollow" />
2377 <meta name="robots" content="index, nofollow" />
2378 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2378 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2379 <script type="text/javascript" src="/static/mercurial.js"></script>
2379 <script type="text/javascript" src="/static/mercurial.js"></script>
2380
2380
2381 <title>Help: remove</title>
2381 <title>Help: remove</title>
2382 </head>
2382 </head>
2383 <body>
2383 <body>
2384
2384
2385 <div class="container">
2385 <div class="container">
2386 <div class="menu">
2386 <div class="menu">
2387 <div class="logo">
2387 <div class="logo">
2388 <a href="https://mercurial-scm.org/">
2388 <a href="https://mercurial-scm.org/">
2389 <img src="/static/hglogo.png" alt="mercurial" /></a>
2389 <img src="/static/hglogo.png" alt="mercurial" /></a>
2390 </div>
2390 </div>
2391 <ul>
2391 <ul>
2392 <li><a href="/shortlog">log</a></li>
2392 <li><a href="/shortlog">log</a></li>
2393 <li><a href="/graph">graph</a></li>
2393 <li><a href="/graph">graph</a></li>
2394 <li><a href="/tags">tags</a></li>
2394 <li><a href="/tags">tags</a></li>
2395 <li><a href="/bookmarks">bookmarks</a></li>
2395 <li><a href="/bookmarks">bookmarks</a></li>
2396 <li><a href="/branches">branches</a></li>
2396 <li><a href="/branches">branches</a></li>
2397 </ul>
2397 </ul>
2398 <ul>
2398 <ul>
2399 <li class="active"><a href="/help">help</a></li>
2399 <li class="active"><a href="/help">help</a></li>
2400 </ul>
2400 </ul>
2401 </div>
2401 </div>
2402
2402
2403 <div class="main">
2403 <div class="main">
2404 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2404 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2405 <h3>Help: remove</h3>
2405 <h3>Help: remove</h3>
2406
2406
2407 <form class="search" action="/log">
2407 <form class="search" action="/log">
2408
2408
2409 <p><input name="rev" id="search1" type="text" size="30" /></p>
2409 <p><input name="rev" id="search1" type="text" size="30" /></p>
2410 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2410 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2411 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2411 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2412 </form>
2412 </form>
2413 <div id="doc">
2413 <div id="doc">
2414 <p>
2414 <p>
2415 hg remove [OPTION]... FILE...
2415 hg remove [OPTION]... FILE...
2416 </p>
2416 </p>
2417 <p>
2417 <p>
2418 aliases: rm
2418 aliases: rm
2419 </p>
2419 </p>
2420 <p>
2420 <p>
2421 remove the specified files on the next commit
2421 remove the specified files on the next commit
2422 </p>
2422 </p>
2423 <p>
2423 <p>
2424 Schedule the indicated files for removal from the current branch.
2424 Schedule the indicated files for removal from the current branch.
2425 </p>
2425 </p>
2426 <p>
2426 <p>
2427 This command schedules the files to be removed at the next commit.
2427 This command schedules the files to be removed at the next commit.
2428 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2428 To undo a remove before that, see 'hg revert'. To undo added
2429 files, see &quot;hg forget&quot;.
2429 files, see 'hg forget'.
2430 </p>
2430 </p>
2431 <p>
2431 <p>
2432 -A/--after can be used to remove only files that have already
2432 -A/--after can be used to remove only files that have already
2433 been deleted, -f/--force can be used to force deletion, and -Af
2433 been deleted, -f/--force can be used to force deletion, and -Af
2434 can be used to remove files from the next revision without
2434 can be used to remove files from the next revision without
2435 deleting them from the working directory.
2435 deleting them from the working directory.
2436 </p>
2436 </p>
2437 <p>
2437 <p>
2438 The following table details the behavior of remove for different
2438 The following table details the behavior of remove for different
2439 file states (columns) and option combinations (rows). The file
2439 file states (columns) and option combinations (rows). The file
2440 states are Added [A], Clean [C], Modified [M] and Missing [!]
2440 states are Added [A], Clean [C], Modified [M] and Missing [!]
2441 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2441 (as reported by 'hg status'). The actions are Warn, Remove
2442 (from branch) and Delete (from disk):
2442 (from branch) and Delete (from disk):
2443 </p>
2443 </p>
2444 <table>
2444 <table>
2445 <tr><td>opt/state</td>
2445 <tr><td>opt/state</td>
2446 <td>A</td>
2446 <td>A</td>
2447 <td>C</td>
2447 <td>C</td>
2448 <td>M</td>
2448 <td>M</td>
2449 <td>!</td></tr>
2449 <td>!</td></tr>
2450 <tr><td>none</td>
2450 <tr><td>none</td>
2451 <td>W</td>
2451 <td>W</td>
2452 <td>RD</td>
2452 <td>RD</td>
2453 <td>W</td>
2453 <td>W</td>
2454 <td>R</td></tr>
2454 <td>R</td></tr>
2455 <tr><td>-f</td>
2455 <tr><td>-f</td>
2456 <td>R</td>
2456 <td>R</td>
2457 <td>RD</td>
2457 <td>RD</td>
2458 <td>RD</td>
2458 <td>RD</td>
2459 <td>R</td></tr>
2459 <td>R</td></tr>
2460 <tr><td>-A</td>
2460 <tr><td>-A</td>
2461 <td>W</td>
2461 <td>W</td>
2462 <td>W</td>
2462 <td>W</td>
2463 <td>W</td>
2463 <td>W</td>
2464 <td>R</td></tr>
2464 <td>R</td></tr>
2465 <tr><td>-Af</td>
2465 <tr><td>-Af</td>
2466 <td>R</td>
2466 <td>R</td>
2467 <td>R</td>
2467 <td>R</td>
2468 <td>R</td>
2468 <td>R</td>
2469 <td>R</td></tr>
2469 <td>R</td></tr>
2470 </table>
2470 </table>
2471 <p>
2471 <p>
2472 <b>Note:</b>
2472 <b>Note:</b>
2473 </p>
2473 </p>
2474 <p>
2474 <p>
2475 &quot;hg remove&quot; never deletes files in Added [A] state from the
2475 'hg remove' never deletes files in Added [A] state from the
2476 working directory, not even if &quot;--force&quot; is specified.
2476 working directory, not even if &quot;--force&quot; is specified.
2477 </p>
2477 </p>
2478 <p>
2478 <p>
2479 Returns 0 on success, 1 if any warnings encountered.
2479 Returns 0 on success, 1 if any warnings encountered.
2480 </p>
2480 </p>
2481 <p>
2481 <p>
2482 options ([+] can be repeated):
2482 options ([+] can be repeated):
2483 </p>
2483 </p>
2484 <table>
2484 <table>
2485 <tr><td>-A</td>
2485 <tr><td>-A</td>
2486 <td>--after</td>
2486 <td>--after</td>
2487 <td>record delete for missing files</td></tr>
2487 <td>record delete for missing files</td></tr>
2488 <tr><td>-f</td>
2488 <tr><td>-f</td>
2489 <td>--force</td>
2489 <td>--force</td>
2490 <td>remove (and delete) file even if added or modified</td></tr>
2490 <td>remove (and delete) file even if added or modified</td></tr>
2491 <tr><td>-S</td>
2491 <tr><td>-S</td>
2492 <td>--subrepos</td>
2492 <td>--subrepos</td>
2493 <td>recurse into subrepositories</td></tr>
2493 <td>recurse into subrepositories</td></tr>
2494 <tr><td>-I</td>
2494 <tr><td>-I</td>
2495 <td>--include PATTERN [+]</td>
2495 <td>--include PATTERN [+]</td>
2496 <td>include names matching the given patterns</td></tr>
2496 <td>include names matching the given patterns</td></tr>
2497 <tr><td>-X</td>
2497 <tr><td>-X</td>
2498 <td>--exclude PATTERN [+]</td>
2498 <td>--exclude PATTERN [+]</td>
2499 <td>exclude names matching the given patterns</td></tr>
2499 <td>exclude names matching the given patterns</td></tr>
2500 </table>
2500 </table>
2501 <p>
2501 <p>
2502 global options ([+] can be repeated):
2502 global options ([+] can be repeated):
2503 </p>
2503 </p>
2504 <table>
2504 <table>
2505 <tr><td>-R</td>
2505 <tr><td>-R</td>
2506 <td>--repository REPO</td>
2506 <td>--repository REPO</td>
2507 <td>repository root directory or name of overlay bundle file</td></tr>
2507 <td>repository root directory or name of overlay bundle file</td></tr>
2508 <tr><td></td>
2508 <tr><td></td>
2509 <td>--cwd DIR</td>
2509 <td>--cwd DIR</td>
2510 <td>change working directory</td></tr>
2510 <td>change working directory</td></tr>
2511 <tr><td>-y</td>
2511 <tr><td>-y</td>
2512 <td>--noninteractive</td>
2512 <td>--noninteractive</td>
2513 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2513 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2514 <tr><td>-q</td>
2514 <tr><td>-q</td>
2515 <td>--quiet</td>
2515 <td>--quiet</td>
2516 <td>suppress output</td></tr>
2516 <td>suppress output</td></tr>
2517 <tr><td>-v</td>
2517 <tr><td>-v</td>
2518 <td>--verbose</td>
2518 <td>--verbose</td>
2519 <td>enable additional output</td></tr>
2519 <td>enable additional output</td></tr>
2520 <tr><td></td>
2520 <tr><td></td>
2521 <td>--config CONFIG [+]</td>
2521 <td>--config CONFIG [+]</td>
2522 <td>set/override config option (use 'section.name=value')</td></tr>
2522 <td>set/override config option (use 'section.name=value')</td></tr>
2523 <tr><td></td>
2523 <tr><td></td>
2524 <td>--debug</td>
2524 <td>--debug</td>
2525 <td>enable debugging output</td></tr>
2525 <td>enable debugging output</td></tr>
2526 <tr><td></td>
2526 <tr><td></td>
2527 <td>--debugger</td>
2527 <td>--debugger</td>
2528 <td>start debugger</td></tr>
2528 <td>start debugger</td></tr>
2529 <tr><td></td>
2529 <tr><td></td>
2530 <td>--encoding ENCODE</td>
2530 <td>--encoding ENCODE</td>
2531 <td>set the charset encoding (default: ascii)</td></tr>
2531 <td>set the charset encoding (default: ascii)</td></tr>
2532 <tr><td></td>
2532 <tr><td></td>
2533 <td>--encodingmode MODE</td>
2533 <td>--encodingmode MODE</td>
2534 <td>set the charset encoding mode (default: strict)</td></tr>
2534 <td>set the charset encoding mode (default: strict)</td></tr>
2535 <tr><td></td>
2535 <tr><td></td>
2536 <td>--traceback</td>
2536 <td>--traceback</td>
2537 <td>always print a traceback on exception</td></tr>
2537 <td>always print a traceback on exception</td></tr>
2538 <tr><td></td>
2538 <tr><td></td>
2539 <td>--time</td>
2539 <td>--time</td>
2540 <td>time how long the command takes</td></tr>
2540 <td>time how long the command takes</td></tr>
2541 <tr><td></td>
2541 <tr><td></td>
2542 <td>--profile</td>
2542 <td>--profile</td>
2543 <td>print command execution profile</td></tr>
2543 <td>print command execution profile</td></tr>
2544 <tr><td></td>
2544 <tr><td></td>
2545 <td>--version</td>
2545 <td>--version</td>
2546 <td>output version information and exit</td></tr>
2546 <td>output version information and exit</td></tr>
2547 <tr><td>-h</td>
2547 <tr><td>-h</td>
2548 <td>--help</td>
2548 <td>--help</td>
2549 <td>display help and exit</td></tr>
2549 <td>display help and exit</td></tr>
2550 <tr><td></td>
2550 <tr><td></td>
2551 <td>--hidden</td>
2551 <td>--hidden</td>
2552 <td>consider hidden changesets</td></tr>
2552 <td>consider hidden changesets</td></tr>
2553 </table>
2553 </table>
2554
2554
2555 </div>
2555 </div>
2556 </div>
2556 </div>
2557 </div>
2557 </div>
2558
2558
2559 <script type="text/javascript">process_dates()</script>
2559 <script type="text/javascript">process_dates()</script>
2560
2560
2561
2561
2562 </body>
2562 </body>
2563 </html>
2563 </html>
2564
2564
2565
2565
2566 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2566 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2567 200 Script output follows
2567 200 Script output follows
2568
2568
2569 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2569 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2570 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2570 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2571 <head>
2571 <head>
2572 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2572 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2573 <meta name="robots" content="index, nofollow" />
2573 <meta name="robots" content="index, nofollow" />
2574 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2574 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2575 <script type="text/javascript" src="/static/mercurial.js"></script>
2575 <script type="text/javascript" src="/static/mercurial.js"></script>
2576
2576
2577 <title>Help: revisions</title>
2577 <title>Help: revisions</title>
2578 </head>
2578 </head>
2579 <body>
2579 <body>
2580
2580
2581 <div class="container">
2581 <div class="container">
2582 <div class="menu">
2582 <div class="menu">
2583 <div class="logo">
2583 <div class="logo">
2584 <a href="https://mercurial-scm.org/">
2584 <a href="https://mercurial-scm.org/">
2585 <img src="/static/hglogo.png" alt="mercurial" /></a>
2585 <img src="/static/hglogo.png" alt="mercurial" /></a>
2586 </div>
2586 </div>
2587 <ul>
2587 <ul>
2588 <li><a href="/shortlog">log</a></li>
2588 <li><a href="/shortlog">log</a></li>
2589 <li><a href="/graph">graph</a></li>
2589 <li><a href="/graph">graph</a></li>
2590 <li><a href="/tags">tags</a></li>
2590 <li><a href="/tags">tags</a></li>
2591 <li><a href="/bookmarks">bookmarks</a></li>
2591 <li><a href="/bookmarks">bookmarks</a></li>
2592 <li><a href="/branches">branches</a></li>
2592 <li><a href="/branches">branches</a></li>
2593 </ul>
2593 </ul>
2594 <ul>
2594 <ul>
2595 <li class="active"><a href="/help">help</a></li>
2595 <li class="active"><a href="/help">help</a></li>
2596 </ul>
2596 </ul>
2597 </div>
2597 </div>
2598
2598
2599 <div class="main">
2599 <div class="main">
2600 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2600 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2601 <h3>Help: revisions</h3>
2601 <h3>Help: revisions</h3>
2602
2602
2603 <form class="search" action="/log">
2603 <form class="search" action="/log">
2604
2604
2605 <p><input name="rev" id="search1" type="text" size="30" /></p>
2605 <p><input name="rev" id="search1" type="text" size="30" /></p>
2606 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2606 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2607 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2607 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2608 </form>
2608 </form>
2609 <div id="doc">
2609 <div id="doc">
2610 <h1>Specifying Single Revisions</h1>
2610 <h1>Specifying Single Revisions</h1>
2611 <p>
2611 <p>
2612 Mercurial supports several ways to specify individual revisions.
2612 Mercurial supports several ways to specify individual revisions.
2613 </p>
2613 </p>
2614 <p>
2614 <p>
2615 A plain integer is treated as a revision number. Negative integers are
2615 A plain integer is treated as a revision number. Negative integers are
2616 treated as sequential offsets from the tip, with -1 denoting the tip,
2616 treated as sequential offsets from the tip, with -1 denoting the tip,
2617 -2 denoting the revision prior to the tip, and so forth.
2617 -2 denoting the revision prior to the tip, and so forth.
2618 </p>
2618 </p>
2619 <p>
2619 <p>
2620 A 40-digit hexadecimal string is treated as a unique revision
2620 A 40-digit hexadecimal string is treated as a unique revision
2621 identifier.
2621 identifier.
2622 </p>
2622 </p>
2623 <p>
2623 <p>
2624 A hexadecimal string less than 40 characters long is treated as a
2624 A hexadecimal string less than 40 characters long is treated as a
2625 unique revision identifier and is referred to as a short-form
2625 unique revision identifier and is referred to as a short-form
2626 identifier. A short-form identifier is only valid if it is the prefix
2626 identifier. A short-form identifier is only valid if it is the prefix
2627 of exactly one full-length identifier.
2627 of exactly one full-length identifier.
2628 </p>
2628 </p>
2629 <p>
2629 <p>
2630 Any other string is treated as a bookmark, tag, or branch name. A
2630 Any other string is treated as a bookmark, tag, or branch name. A
2631 bookmark is a movable pointer to a revision. A tag is a permanent name
2631 bookmark is a movable pointer to a revision. A tag is a permanent name
2632 associated with a revision. A branch name denotes the tipmost open branch head
2632 associated with a revision. A branch name denotes the tipmost open branch head
2633 of that branch - or if they are all closed, the tipmost closed head of the
2633 of that branch - or if they are all closed, the tipmost closed head of the
2634 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2634 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2635 </p>
2635 </p>
2636 <p>
2636 <p>
2637 The reserved name &quot;tip&quot; always identifies the most recent revision.
2637 The reserved name &quot;tip&quot; always identifies the most recent revision.
2638 </p>
2638 </p>
2639 <p>
2639 <p>
2640 The reserved name &quot;null&quot; indicates the null revision. This is the
2640 The reserved name &quot;null&quot; indicates the null revision. This is the
2641 revision of an empty repository, and the parent of revision 0.
2641 revision of an empty repository, and the parent of revision 0.
2642 </p>
2642 </p>
2643 <p>
2643 <p>
2644 The reserved name &quot;.&quot; indicates the working directory parent. If no
2644 The reserved name &quot;.&quot; indicates the working directory parent. If no
2645 working directory is checked out, it is equivalent to null. If an
2645 working directory is checked out, it is equivalent to null. If an
2646 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2646 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2647 parent.
2647 parent.
2648 </p>
2648 </p>
2649
2649
2650 </div>
2650 </div>
2651 </div>
2651 </div>
2652 </div>
2652 </div>
2653
2653
2654 <script type="text/javascript">process_dates()</script>
2654 <script type="text/javascript">process_dates()</script>
2655
2655
2656
2656
2657 </body>
2657 </body>
2658 </html>
2658 </html>
2659
2659
2660
2660
2661 Sub-topic indexes rendered properly
2661 Sub-topic indexes rendered properly
2662
2662
2663 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2663 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2664 200 Script output follows
2664 200 Script output follows
2665
2665
2666 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2666 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2667 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2667 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2668 <head>
2668 <head>
2669 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2669 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2670 <meta name="robots" content="index, nofollow" />
2670 <meta name="robots" content="index, nofollow" />
2671 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2671 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2672 <script type="text/javascript" src="/static/mercurial.js"></script>
2672 <script type="text/javascript" src="/static/mercurial.js"></script>
2673
2673
2674 <title>Help: internals</title>
2674 <title>Help: internals</title>
2675 </head>
2675 </head>
2676 <body>
2676 <body>
2677
2677
2678 <div class="container">
2678 <div class="container">
2679 <div class="menu">
2679 <div class="menu">
2680 <div class="logo">
2680 <div class="logo">
2681 <a href="https://mercurial-scm.org/">
2681 <a href="https://mercurial-scm.org/">
2682 <img src="/static/hglogo.png" alt="mercurial" /></a>
2682 <img src="/static/hglogo.png" alt="mercurial" /></a>
2683 </div>
2683 </div>
2684 <ul>
2684 <ul>
2685 <li><a href="/shortlog">log</a></li>
2685 <li><a href="/shortlog">log</a></li>
2686 <li><a href="/graph">graph</a></li>
2686 <li><a href="/graph">graph</a></li>
2687 <li><a href="/tags">tags</a></li>
2687 <li><a href="/tags">tags</a></li>
2688 <li><a href="/bookmarks">bookmarks</a></li>
2688 <li><a href="/bookmarks">bookmarks</a></li>
2689 <li><a href="/branches">branches</a></li>
2689 <li><a href="/branches">branches</a></li>
2690 </ul>
2690 </ul>
2691 <ul>
2691 <ul>
2692 <li><a href="/help">help</a></li>
2692 <li><a href="/help">help</a></li>
2693 </ul>
2693 </ul>
2694 </div>
2694 </div>
2695
2695
2696 <div class="main">
2696 <div class="main">
2697 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2697 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2698 <form class="search" action="/log">
2698 <form class="search" action="/log">
2699
2699
2700 <p><input name="rev" id="search1" type="text" size="30" /></p>
2700 <p><input name="rev" id="search1" type="text" size="30" /></p>
2701 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2701 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2702 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2702 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2703 </form>
2703 </form>
2704 <table class="bigtable">
2704 <table class="bigtable">
2705 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2705 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2706
2706
2707 <tr><td>
2707 <tr><td>
2708 <a href="/help/internals.bundles">
2708 <a href="/help/internals.bundles">
2709 bundles
2709 bundles
2710 </a>
2710 </a>
2711 </td><td>
2711 </td><td>
2712 container for exchange of repository data
2712 container for exchange of repository data
2713 </td></tr>
2713 </td></tr>
2714 <tr><td>
2714 <tr><td>
2715 <a href="/help/internals.changegroups">
2715 <a href="/help/internals.changegroups">
2716 changegroups
2716 changegroups
2717 </a>
2717 </a>
2718 </td><td>
2718 </td><td>
2719 representation of revlog data
2719 representation of revlog data
2720 </td></tr>
2720 </td></tr>
2721 <tr><td>
2721 <tr><td>
2722 <a href="/help/internals.revlogs">
2722 <a href="/help/internals.revlogs">
2723 revlogs
2723 revlogs
2724 </a>
2724 </a>
2725 </td><td>
2725 </td><td>
2726 revision storage mechanism
2726 revision storage mechanism
2727 </td></tr>
2727 </td></tr>
2728
2728
2729
2729
2730
2730
2731
2731
2732
2732
2733 </table>
2733 </table>
2734 </div>
2734 </div>
2735 </div>
2735 </div>
2736
2736
2737 <script type="text/javascript">process_dates()</script>
2737 <script type="text/javascript">process_dates()</script>
2738
2738
2739
2739
2740 </body>
2740 </body>
2741 </html>
2741 </html>
2742
2742
2743
2743
2744 Sub-topic topics rendered properly
2744 Sub-topic topics rendered properly
2745
2745
2746 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2746 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2747 200 Script output follows
2747 200 Script output follows
2748
2748
2749 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2749 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2750 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2750 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2751 <head>
2751 <head>
2752 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2752 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2753 <meta name="robots" content="index, nofollow" />
2753 <meta name="robots" content="index, nofollow" />
2754 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2754 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2755 <script type="text/javascript" src="/static/mercurial.js"></script>
2755 <script type="text/javascript" src="/static/mercurial.js"></script>
2756
2756
2757 <title>Help: internals.changegroups</title>
2757 <title>Help: internals.changegroups</title>
2758 </head>
2758 </head>
2759 <body>
2759 <body>
2760
2760
2761 <div class="container">
2761 <div class="container">
2762 <div class="menu">
2762 <div class="menu">
2763 <div class="logo">
2763 <div class="logo">
2764 <a href="https://mercurial-scm.org/">
2764 <a href="https://mercurial-scm.org/">
2765 <img src="/static/hglogo.png" alt="mercurial" /></a>
2765 <img src="/static/hglogo.png" alt="mercurial" /></a>
2766 </div>
2766 </div>
2767 <ul>
2767 <ul>
2768 <li><a href="/shortlog">log</a></li>
2768 <li><a href="/shortlog">log</a></li>
2769 <li><a href="/graph">graph</a></li>
2769 <li><a href="/graph">graph</a></li>
2770 <li><a href="/tags">tags</a></li>
2770 <li><a href="/tags">tags</a></li>
2771 <li><a href="/bookmarks">bookmarks</a></li>
2771 <li><a href="/bookmarks">bookmarks</a></li>
2772 <li><a href="/branches">branches</a></li>
2772 <li><a href="/branches">branches</a></li>
2773 </ul>
2773 </ul>
2774 <ul>
2774 <ul>
2775 <li class="active"><a href="/help">help</a></li>
2775 <li class="active"><a href="/help">help</a></li>
2776 </ul>
2776 </ul>
2777 </div>
2777 </div>
2778
2778
2779 <div class="main">
2779 <div class="main">
2780 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2780 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2781 <h3>Help: internals.changegroups</h3>
2781 <h3>Help: internals.changegroups</h3>
2782
2782
2783 <form class="search" action="/log">
2783 <form class="search" action="/log">
2784
2784
2785 <p><input name="rev" id="search1" type="text" size="30" /></p>
2785 <p><input name="rev" id="search1" type="text" size="30" /></p>
2786 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2786 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2787 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2787 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2788 </form>
2788 </form>
2789 <div id="doc">
2789 <div id="doc">
2790 <h1>representation of revlog data</h1>
2790 <h1>representation of revlog data</h1>
2791 <h2>Changegroups</h2>
2791 <h2>Changegroups</h2>
2792 <p>
2792 <p>
2793 Changegroups are representations of repository revlog data, specifically
2793 Changegroups are representations of repository revlog data, specifically
2794 the changelog, manifest, and filelogs.
2794 the changelog, manifest, and filelogs.
2795 </p>
2795 </p>
2796 <p>
2796 <p>
2797 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2797 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2798 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2798 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2799 the only difference being a header on entries in the changeset
2799 the only difference being a header on entries in the changeset
2800 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2800 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2801 includes revlog flags in the delta header.
2801 includes revlog flags in the delta header.
2802 </p>
2802 </p>
2803 <p>
2803 <p>
2804 Changegroups consists of 3 logical segments:
2804 Changegroups consists of 3 logical segments:
2805 </p>
2805 </p>
2806 <pre>
2806 <pre>
2807 +---------------------------------+
2807 +---------------------------------+
2808 | | | |
2808 | | | |
2809 | changeset | manifest | filelogs |
2809 | changeset | manifest | filelogs |
2810 | | | |
2810 | | | |
2811 +---------------------------------+
2811 +---------------------------------+
2812 </pre>
2812 </pre>
2813 <p>
2813 <p>
2814 The principle building block of each segment is a *chunk*. A *chunk*
2814 The principle building block of each segment is a *chunk*. A *chunk*
2815 is a framed piece of data:
2815 is a framed piece of data:
2816 </p>
2816 </p>
2817 <pre>
2817 <pre>
2818 +---------------------------------------+
2818 +---------------------------------------+
2819 | | |
2819 | | |
2820 | length | data |
2820 | length | data |
2821 | (32 bits) | &lt;length&gt; bytes |
2821 | (32 bits) | &lt;length&gt; bytes |
2822 | | |
2822 | | |
2823 +---------------------------------------+
2823 +---------------------------------------+
2824 </pre>
2824 </pre>
2825 <p>
2825 <p>
2826 Each chunk starts with a 32-bit big-endian signed integer indicating
2826 Each chunk starts with a 32-bit big-endian signed integer indicating
2827 the length of the raw data that follows.
2827 the length of the raw data that follows.
2828 </p>
2828 </p>
2829 <p>
2829 <p>
2830 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2830 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2831 call this an *empty chunk*.
2831 call this an *empty chunk*.
2832 </p>
2832 </p>
2833 <h3>Delta Groups</h3>
2833 <h3>Delta Groups</h3>
2834 <p>
2834 <p>
2835 A *delta group* expresses the content of a revlog as a series of deltas,
2835 A *delta group* expresses the content of a revlog as a series of deltas,
2836 or patches against previous revisions.
2836 or patches against previous revisions.
2837 </p>
2837 </p>
2838 <p>
2838 <p>
2839 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2839 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2840 to signal the end of the delta group:
2840 to signal the end of the delta group:
2841 </p>
2841 </p>
2842 <pre>
2842 <pre>
2843 +------------------------------------------------------------------------+
2843 +------------------------------------------------------------------------+
2844 | | | | | |
2844 | | | | | |
2845 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2845 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2846 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2846 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2847 | | | | | |
2847 | | | | | |
2848 +------------------------------------------------------------+-----------+
2848 +------------------------------------------------------------+-----------+
2849 </pre>
2849 </pre>
2850 <p>
2850 <p>
2851 Each *chunk*'s data consists of the following:
2851 Each *chunk*'s data consists of the following:
2852 </p>
2852 </p>
2853 <pre>
2853 <pre>
2854 +-----------------------------------------+
2854 +-----------------------------------------+
2855 | | | |
2855 | | | |
2856 | delta header | mdiff header | delta |
2856 | delta header | mdiff header | delta |
2857 | (various) | (12 bytes) | (various) |
2857 | (various) | (12 bytes) | (various) |
2858 | | | |
2858 | | | |
2859 +-----------------------------------------+
2859 +-----------------------------------------+
2860 </pre>
2860 </pre>
2861 <p>
2861 <p>
2862 The *length* field is the byte length of the remaining 3 logical pieces
2862 The *length* field is the byte length of the remaining 3 logical pieces
2863 of data. The *delta* is a diff from an existing entry in the changelog.
2863 of data. The *delta* is a diff from an existing entry in the changelog.
2864 </p>
2864 </p>
2865 <p>
2865 <p>
2866 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
2866 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
2867 &quot;3&quot; of the changegroup format.
2867 &quot;3&quot; of the changegroup format.
2868 </p>
2868 </p>
2869 <p>
2869 <p>
2870 Version 1:
2870 Version 1:
2871 </p>
2871 </p>
2872 <pre>
2872 <pre>
2873 +------------------------------------------------------+
2873 +------------------------------------------------------+
2874 | | | | |
2874 | | | | |
2875 | node | p1 node | p2 node | link node |
2875 | node | p1 node | p2 node | link node |
2876 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2876 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2877 | | | | |
2877 | | | | |
2878 +------------------------------------------------------+
2878 +------------------------------------------------------+
2879 </pre>
2879 </pre>
2880 <p>
2880 <p>
2881 Version 2:
2881 Version 2:
2882 </p>
2882 </p>
2883 <pre>
2883 <pre>
2884 +------------------------------------------------------------------+
2884 +------------------------------------------------------------------+
2885 | | | | | |
2885 | | | | | |
2886 | node | p1 node | p2 node | base node | link node |
2886 | node | p1 node | p2 node | base node | link node |
2887 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2887 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2888 | | | | | |
2888 | | | | | |
2889 +------------------------------------------------------------------+
2889 +------------------------------------------------------------------+
2890 </pre>
2890 </pre>
2891 <p>
2891 <p>
2892 Version 3:
2892 Version 3:
2893 </p>
2893 </p>
2894 <pre>
2894 <pre>
2895 +------------------------------------------------------------------------------+
2895 +------------------------------------------------------------------------------+
2896 | | | | | | |
2896 | | | | | | |
2897 | node | p1 node | p2 node | base node | link node | flags |
2897 | node | p1 node | p2 node | base node | link node | flags |
2898 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
2898 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
2899 | | | | | | |
2899 | | | | | | |
2900 +------------------------------------------------------------------------------+
2900 +------------------------------------------------------------------------------+
2901 </pre>
2901 </pre>
2902 <p>
2902 <p>
2903 The *mdiff header* consists of 3 32-bit big-endian signed integers
2903 The *mdiff header* consists of 3 32-bit big-endian signed integers
2904 describing offsets at which to apply the following delta content:
2904 describing offsets at which to apply the following delta content:
2905 </p>
2905 </p>
2906 <pre>
2906 <pre>
2907 +-------------------------------------+
2907 +-------------------------------------+
2908 | | | |
2908 | | | |
2909 | offset | old length | new length |
2909 | offset | old length | new length |
2910 | (32 bits) | (32 bits) | (32 bits) |
2910 | (32 bits) | (32 bits) | (32 bits) |
2911 | | | |
2911 | | | |
2912 +-------------------------------------+
2912 +-------------------------------------+
2913 </pre>
2913 </pre>
2914 <p>
2914 <p>
2915 In version 1, the delta is always applied against the previous node from
2915 In version 1, the delta is always applied against the previous node from
2916 the changegroup or the first parent if this is the first entry in the
2916 the changegroup or the first parent if this is the first entry in the
2917 changegroup.
2917 changegroup.
2918 </p>
2918 </p>
2919 <p>
2919 <p>
2920 In version 2, the delta base node is encoded in the entry in the
2920 In version 2, the delta base node is encoded in the entry in the
2921 changegroup. This allows the delta to be expressed against any parent,
2921 changegroup. This allows the delta to be expressed against any parent,
2922 which can result in smaller deltas and more efficient encoding of data.
2922 which can result in smaller deltas and more efficient encoding of data.
2923 </p>
2923 </p>
2924 <h3>Changeset Segment</h3>
2924 <h3>Changeset Segment</h3>
2925 <p>
2925 <p>
2926 The *changeset segment* consists of a single *delta group* holding
2926 The *changeset segment* consists of a single *delta group* holding
2927 changelog data. It is followed by an *empty chunk* to denote the
2927 changelog data. It is followed by an *empty chunk* to denote the
2928 boundary to the *manifests segment*.
2928 boundary to the *manifests segment*.
2929 </p>
2929 </p>
2930 <h3>Manifest Segment</h3>
2930 <h3>Manifest Segment</h3>
2931 <p>
2931 <p>
2932 The *manifest segment* consists of a single *delta group* holding
2932 The *manifest segment* consists of a single *delta group* holding
2933 manifest data. It is followed by an *empty chunk* to denote the boundary
2933 manifest data. It is followed by an *empty chunk* to denote the boundary
2934 to the *filelogs segment*.
2934 to the *filelogs segment*.
2935 </p>
2935 </p>
2936 <h3>Filelogs Segment</h3>
2936 <h3>Filelogs Segment</h3>
2937 <p>
2937 <p>
2938 The *filelogs* segment consists of multiple sub-segments, each
2938 The *filelogs* segment consists of multiple sub-segments, each
2939 corresponding to an individual file whose data is being described:
2939 corresponding to an individual file whose data is being described:
2940 </p>
2940 </p>
2941 <pre>
2941 <pre>
2942 +--------------------------------------+
2942 +--------------------------------------+
2943 | | | | |
2943 | | | | |
2944 | filelog0 | filelog1 | filelog2 | ... |
2944 | filelog0 | filelog1 | filelog2 | ... |
2945 | | | | |
2945 | | | | |
2946 +--------------------------------------+
2946 +--------------------------------------+
2947 </pre>
2947 </pre>
2948 <p>
2948 <p>
2949 In version &quot;3&quot; of the changegroup format, filelogs may include
2949 In version &quot;3&quot; of the changegroup format, filelogs may include
2950 directory logs when treemanifests are in use. directory logs are
2950 directory logs when treemanifests are in use. directory logs are
2951 identified by having a trailing '/' on their filename (see below).
2951 identified by having a trailing '/' on their filename (see below).
2952 </p>
2952 </p>
2953 <p>
2953 <p>
2954 The final filelog sub-segment is followed by an *empty chunk* to denote
2954 The final filelog sub-segment is followed by an *empty chunk* to denote
2955 the end of the segment and the overall changegroup.
2955 the end of the segment and the overall changegroup.
2956 </p>
2956 </p>
2957 <p>
2957 <p>
2958 Each filelog sub-segment consists of the following:
2958 Each filelog sub-segment consists of the following:
2959 </p>
2959 </p>
2960 <pre>
2960 <pre>
2961 +------------------------------------------+
2961 +------------------------------------------+
2962 | | | |
2962 | | | |
2963 | filename size | filename | delta group |
2963 | filename size | filename | delta group |
2964 | (32 bits) | (various) | (various) |
2964 | (32 bits) | (various) | (various) |
2965 | | | |
2965 | | | |
2966 +------------------------------------------+
2966 +------------------------------------------+
2967 </pre>
2967 </pre>
2968 <p>
2968 <p>
2969 That is, a *chunk* consisting of the filename (not terminated or padded)
2969 That is, a *chunk* consisting of the filename (not terminated or padded)
2970 followed by N chunks constituting the *delta group* for this file.
2970 followed by N chunks constituting the *delta group* for this file.
2971 </p>
2971 </p>
2972
2972
2973 </div>
2973 </div>
2974 </div>
2974 </div>
2975 </div>
2975 </div>
2976
2976
2977 <script type="text/javascript">process_dates()</script>
2977 <script type="text/javascript">process_dates()</script>
2978
2978
2979
2979
2980 </body>
2980 </body>
2981 </html>
2981 </html>
2982
2982
2983
2983
2984 $ killdaemons.py
2984 $ killdaemons.py
2985
2985
2986 #endif
2986 #endif
@@ -1,806 +1,806 b''
1 == paragraphs ==
1 == paragraphs ==
2 60 column format:
2 60 column format:
3 ----------------------------------------------------------------------
3 ----------------------------------------------------------------------
4 This is some text in the first paragraph.
4 This is some text in the first paragraph.
5
5
6 A small indented paragraph. It is followed by some lines
6 A small indented paragraph. It is followed by some lines
7 containing random whitespace.
7 containing random whitespace.
8
8
9 The third and final paragraph.
9 The third and final paragraph.
10 ----------------------------------------------------------------------
10 ----------------------------------------------------------------------
11
11
12 30 column format:
12 30 column format:
13 ----------------------------------------------------------------------
13 ----------------------------------------------------------------------
14 This is some text in the first
14 This is some text in the first
15 paragraph.
15 paragraph.
16
16
17 A small indented paragraph.
17 A small indented paragraph.
18 It is followed by some lines
18 It is followed by some lines
19 containing random
19 containing random
20 whitespace.
20 whitespace.
21
21
22 The third and final paragraph.
22 The third and final paragraph.
23 ----------------------------------------------------------------------
23 ----------------------------------------------------------------------
24
24
25 html format:
25 html format:
26 ----------------------------------------------------------------------
26 ----------------------------------------------------------------------
27 <p>
27 <p>
28 This is some text in the first paragraph.
28 This is some text in the first paragraph.
29 </p>
29 </p>
30 <p>
30 <p>
31 A small indented paragraph.
31 A small indented paragraph.
32 It is followed by some lines
32 It is followed by some lines
33 containing random whitespace.
33 containing random whitespace.
34 </p>
34 </p>
35 <p>
35 <p>
36 The third and final paragraph.
36 The third and final paragraph.
37 </p>
37 </p>
38 ----------------------------------------------------------------------
38 ----------------------------------------------------------------------
39
39
40 == definitions ==
40 == definitions ==
41 60 column format:
41 60 column format:
42 ----------------------------------------------------------------------
42 ----------------------------------------------------------------------
43 A Term
43 A Term
44 Definition. The indented lines make up the definition.
44 Definition. The indented lines make up the definition.
45
45
46 Another Term
46 Another Term
47 Another definition. The final line in the definition
47 Another definition. The final line in the definition
48 determines the indentation, so this will be indented
48 determines the indentation, so this will be indented
49 with four spaces.
49 with four spaces.
50
50
51 A Nested/Indented Term
51 A Nested/Indented Term
52 Definition.
52 Definition.
53 ----------------------------------------------------------------------
53 ----------------------------------------------------------------------
54
54
55 30 column format:
55 30 column format:
56 ----------------------------------------------------------------------
56 ----------------------------------------------------------------------
57 A Term
57 A Term
58 Definition. The indented
58 Definition. The indented
59 lines make up the
59 lines make up the
60 definition.
60 definition.
61
61
62 Another Term
62 Another Term
63 Another definition. The
63 Another definition. The
64 final line in the
64 final line in the
65 definition determines the
65 definition determines the
66 indentation, so this will
66 indentation, so this will
67 be indented with four
67 be indented with four
68 spaces.
68 spaces.
69
69
70 A Nested/Indented Term
70 A Nested/Indented Term
71 Definition.
71 Definition.
72 ----------------------------------------------------------------------
72 ----------------------------------------------------------------------
73
73
74 html format:
74 html format:
75 ----------------------------------------------------------------------
75 ----------------------------------------------------------------------
76 <dl>
76 <dl>
77 <dt>A Term
77 <dt>A Term
78 <dd>Definition. The indented lines make up the definition.
78 <dd>Definition. The indented lines make up the definition.
79 <dt>Another Term
79 <dt>Another Term
80 <dd>Another definition. The final line in the definition determines the indentation, so this will be indented with four spaces.
80 <dd>Another definition. The final line in the definition determines the indentation, so this will be indented with four spaces.
81 <dt>A Nested/Indented Term
81 <dt>A Nested/Indented Term
82 <dd>Definition.
82 <dd>Definition.
83 </dl>
83 </dl>
84 ----------------------------------------------------------------------
84 ----------------------------------------------------------------------
85
85
86 == literals ==
86 == literals ==
87 60 column format:
87 60 column format:
88 ----------------------------------------------------------------------
88 ----------------------------------------------------------------------
89 The fully minimized form is the most convenient form:
89 The fully minimized form is the most convenient form:
90
90
91 Hello
91 Hello
92 literal
92 literal
93 world
93 world
94
94
95 In the partially minimized form a paragraph simply ends with
95 In the partially minimized form a paragraph simply ends with
96 space-double-colon.
96 space-double-colon.
97
97
98 ////////////////////////////////////////
98 ////////////////////////////////////////
99 long un-wrapped line in a literal block
99 long un-wrapped line in a literal block
100 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
100 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
101
101
102 This literal block is started with '::',
102 This literal block is started with '::',
103 the so-called expanded form. The paragraph
103 the so-called expanded form. The paragraph
104 with '::' disappears in the final output.
104 with '::' disappears in the final output.
105 ----------------------------------------------------------------------
105 ----------------------------------------------------------------------
106
106
107 30 column format:
107 30 column format:
108 ----------------------------------------------------------------------
108 ----------------------------------------------------------------------
109 The fully minimized form is
109 The fully minimized form is
110 the most convenient form:
110 the most convenient form:
111
111
112 Hello
112 Hello
113 literal
113 literal
114 world
114 world
115
115
116 In the partially minimized
116 In the partially minimized
117 form a paragraph simply ends
117 form a paragraph simply ends
118 with space-double-colon.
118 with space-double-colon.
119
119
120 ////////////////////////////////////////
120 ////////////////////////////////////////
121 long un-wrapped line in a literal block
121 long un-wrapped line in a literal block
122 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
122 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
123
123
124 This literal block is started with '::',
124 This literal block is started with '::',
125 the so-called expanded form. The paragraph
125 the so-called expanded form. The paragraph
126 with '::' disappears in the final output.
126 with '::' disappears in the final output.
127 ----------------------------------------------------------------------
127 ----------------------------------------------------------------------
128
128
129 html format:
129 html format:
130 ----------------------------------------------------------------------
130 ----------------------------------------------------------------------
131 <p>
131 <p>
132 The fully minimized form is the most
132 The fully minimized form is the most
133 convenient form:
133 convenient form:
134 </p>
134 </p>
135 <pre>
135 <pre>
136 Hello
136 Hello
137 literal
137 literal
138 world
138 world
139 </pre>
139 </pre>
140 <p>
140 <p>
141 In the partially minimized form a paragraph
141 In the partially minimized form a paragraph
142 simply ends with space-double-colon.
142 simply ends with space-double-colon.
143 </p>
143 </p>
144 <pre>
144 <pre>
145 ////////////////////////////////////////
145 ////////////////////////////////////////
146 long un-wrapped line in a literal block
146 long un-wrapped line in a literal block
147 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
147 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
148 </pre>
148 </pre>
149 <pre>
149 <pre>
150 This literal block is started with '::',
150 This literal block is started with '::',
151 the so-called expanded form. The paragraph
151 the so-called expanded form. The paragraph
152 with '::' disappears in the final output.
152 with '::' disappears in the final output.
153 </pre>
153 </pre>
154 ----------------------------------------------------------------------
154 ----------------------------------------------------------------------
155
155
156 == lists ==
156 == lists ==
157 60 column format:
157 60 column format:
158 ----------------------------------------------------------------------
158 ----------------------------------------------------------------------
159 - This is the first list item.
159 - This is the first list item.
160
160
161 Second paragraph in the first list item.
161 Second paragraph in the first list item.
162
162
163 - List items need not be separated by a blank line.
163 - List items need not be separated by a blank line.
164 - And will be rendered without one in any case.
164 - And will be rendered without one in any case.
165
165
166 We can have indented lists:
166 We can have indented lists:
167
167
168 - This is an indented list item
168 - This is an indented list item
169 - Another indented list item:
169 - Another indented list item:
170
170
171 - A literal block in the middle
171 - A literal block in the middle
172 of an indented list.
172 of an indented list.
173
173
174 (The above is not a list item since we are in the literal block.)
174 (The above is not a list item since we are in the literal block.)
175
175
176 Literal block with no indentation (apart from
176 Literal block with no indentation (apart from
177 the two spaces added to all literal blocks).
177 the two spaces added to all literal blocks).
178
178
179 1. This is an enumerated list (first item).
179 1. This is an enumerated list (first item).
180 2. Continuing with the second item.
180 2. Continuing with the second item.
181 (1) foo
181 (1) foo
182 (2) bar
182 (2) bar
183 1) Another
183 1) Another
184 2) List
184 2) List
185
185
186 Line blocks are also a form of list:
186 Line blocks are also a form of list:
187
187
188 This is the first line. The line continues here.
188 This is the first line. The line continues here.
189 This is the second line.
189 This is the second line.
190 ----------------------------------------------------------------------
190 ----------------------------------------------------------------------
191
191
192 30 column format:
192 30 column format:
193 ----------------------------------------------------------------------
193 ----------------------------------------------------------------------
194 - This is the first list item.
194 - This is the first list item.
195
195
196 Second paragraph in the
196 Second paragraph in the
197 first list item.
197 first list item.
198
198
199 - List items need not be
199 - List items need not be
200 separated by a blank line.
200 separated by a blank line.
201 - And will be rendered without
201 - And will be rendered without
202 one in any case.
202 one in any case.
203
203
204 We can have indented lists:
204 We can have indented lists:
205
205
206 - This is an indented list
206 - This is an indented list
207 item
207 item
208 - Another indented list
208 - Another indented list
209 item:
209 item:
210
210
211 - A literal block in the middle
211 - A literal block in the middle
212 of an indented list.
212 of an indented list.
213
213
214 (The above is not a list item since we are in the literal block.)
214 (The above is not a list item since we are in the literal block.)
215
215
216 Literal block with no indentation (apart from
216 Literal block with no indentation (apart from
217 the two spaces added to all literal blocks).
217 the two spaces added to all literal blocks).
218
218
219 1. This is an enumerated list
219 1. This is an enumerated list
220 (first item).
220 (first item).
221 2. Continuing with the second
221 2. Continuing with the second
222 item.
222 item.
223 (1) foo
223 (1) foo
224 (2) bar
224 (2) bar
225 1) Another
225 1) Another
226 2) List
226 2) List
227
227
228 Line blocks are also a form of
228 Line blocks are also a form of
229 list:
229 list:
230
230
231 This is the first line. The
231 This is the first line. The
232 line continues here.
232 line continues here.
233 This is the second line.
233 This is the second line.
234 ----------------------------------------------------------------------
234 ----------------------------------------------------------------------
235
235
236 html format:
236 html format:
237 ----------------------------------------------------------------------
237 ----------------------------------------------------------------------
238 <ul>
238 <ul>
239 <li> This is the first list item.
239 <li> This is the first list item.
240 <p>
240 <p>
241 Second paragraph in the first list item.
241 Second paragraph in the first list item.
242 </p>
242 </p>
243 <li> List items need not be separated by a blank line.
243 <li> List items need not be separated by a blank line.
244 <li> And will be rendered without one in any case.
244 <li> And will be rendered without one in any case.
245 </ul>
245 </ul>
246 <p>
246 <p>
247 We can have indented lists:
247 We can have indented lists:
248 </p>
248 </p>
249 <ul>
249 <ul>
250 <li> This is an indented list item
250 <li> This is an indented list item
251 <li> Another indented list item:
251 <li> Another indented list item:
252 <pre>
252 <pre>
253 - A literal block in the middle
253 - A literal block in the middle
254 of an indented list.
254 of an indented list.
255 </pre>
255 </pre>
256 <pre>
256 <pre>
257 (The above is not a list item since we are in the literal block.)
257 (The above is not a list item since we are in the literal block.)
258 </pre>
258 </pre>
259 </ul>
259 </ul>
260 <pre>
260 <pre>
261 Literal block with no indentation (apart from
261 Literal block with no indentation (apart from
262 the two spaces added to all literal blocks).
262 the two spaces added to all literal blocks).
263 </pre>
263 </pre>
264 <ol>
264 <ol>
265 <li> This is an enumerated list (first item).
265 <li> This is an enumerated list (first item).
266 <li> Continuing with the second item.
266 <li> Continuing with the second item.
267 <li> foo
267 <li> foo
268 <li> bar
268 <li> bar
269 <li> Another
269 <li> Another
270 <li> List
270 <li> List
271 </ol>
271 </ol>
272 <p>
272 <p>
273 Line blocks are also a form of list:
273 Line blocks are also a form of list:
274 </p>
274 </p>
275 <ol>
275 <ol>
276 <li> This is the first line. The line continues here.
276 <li> This is the first line. The line continues here.
277 <li> This is the second line.
277 <li> This is the second line.
278 </ol>
278 </ol>
279 ----------------------------------------------------------------------
279 ----------------------------------------------------------------------
280
280
281 == options ==
281 == options ==
282 60 column format:
282 60 column format:
283 ----------------------------------------------------------------------
283 ----------------------------------------------------------------------
284 There is support for simple option lists, but only with long
284 There is support for simple option lists, but only with long
285 options:
285 options:
286
286
287 -X --exclude filter an option with a short and long option
287 -X --exclude filter an option with a short and long option
288 with an argument
288 with an argument
289 -I --include an option with both a short option and
289 -I --include an option with both a short option and
290 a long option
290 a long option
291 --all Output all.
291 --all Output all.
292 --both Output both (this description is quite
292 --both Output both (this description is quite
293 long).
293 long).
294 --long Output all day long.
294 --long Output all day long.
295 --par This option has two paragraphs in its
295 --par This option has two paragraphs in its
296 description. This is the first.
296 description. This is the first.
297
297
298 This is the second. Blank lines may
298 This is the second. Blank lines may
299 be omitted between options (as above)
299 be omitted between options (as above)
300 or left in (as here).
300 or left in (as here).
301
301
302 The next paragraph looks like an option list, but lacks the
302 The next paragraph looks like an option list, but lacks the
303 two-space marker after the option. It is treated as a normal
303 two-space marker after the option. It is treated as a normal
304 paragraph:
304 paragraph:
305
305
306 --foo bar baz
306 --foo bar baz
307 ----------------------------------------------------------------------
307 ----------------------------------------------------------------------
308
308
309 30 column format:
309 30 column format:
310 ----------------------------------------------------------------------
310 ----------------------------------------------------------------------
311 There is support for simple
311 There is support for simple
312 option lists, but only with
312 option lists, but only with
313 long options:
313 long options:
314
314
315 -X --exclude filter an
315 -X --exclude filter an
316 option
316 option
317 with a
317 with a
318 short
318 short
319 and
319 and
320 long
320 long
321 option
321 option
322 with an
322 with an
323 argumen
323 argumen
324 t
324 t
325 -I --include an
325 -I --include an
326 option
326 option
327 with
327 with
328 both a
328 both a
329 short
329 short
330 option
330 option
331 and a
331 and a
332 long
332 long
333 option
333 option
334 --all Output
334 --all Output
335 all.
335 all.
336 --both Output
336 --both Output
337 both
337 both
338 (this d
338 (this d
339 escript
339 escript
340 ion is
340 ion is
341 quite
341 quite
342 long).
342 long).
343 --long Output
343 --long Output
344 all day
344 all day
345 long.
345 long.
346 --par This
346 --par This
347 option
347 option
348 has two
348 has two
349 paragra
349 paragra
350 phs in
350 phs in
351 its des
351 its des
352 criptio
352 criptio
353 n. This
353 n. This
354 is the
354 is the
355 first.
355 first.
356
356
357 This is
357 This is
358 the
358 the
359 second.
359 second.
360 Blank
360 Blank
361 lines
361 lines
362 may be
362 may be
363 omitted
363 omitted
364 between
364 between
365 options
365 options
366 (as
366 (as
367 above)
367 above)
368 or left
368 or left
369 in (as
369 in (as
370 here).
370 here).
371
371
372 The next paragraph looks like
372 The next paragraph looks like
373 an option list, but lacks the
373 an option list, but lacks the
374 two-space marker after the
374 two-space marker after the
375 option. It is treated as a
375 option. It is treated as a
376 normal paragraph:
376 normal paragraph:
377
377
378 --foo bar baz
378 --foo bar baz
379 ----------------------------------------------------------------------
379 ----------------------------------------------------------------------
380
380
381 html format:
381 html format:
382 ----------------------------------------------------------------------
382 ----------------------------------------------------------------------
383 <p>
383 <p>
384 There is support for simple option lists,
384 There is support for simple option lists,
385 but only with long options:
385 but only with long options:
386 </p>
386 </p>
387 <dl>
387 <dl>
388 <dt>-X --exclude filter
388 <dt>-X --exclude filter
389 <dd>an option with a short and long option with an argument
389 <dd>an option with a short and long option with an argument
390 <dt>-I --include
390 <dt>-I --include
391 <dd>an option with both a short option and a long option
391 <dd>an option with both a short option and a long option
392 <dt> --all
392 <dt> --all
393 <dd>Output all.
393 <dd>Output all.
394 <dt> --both
394 <dt> --both
395 <dd>Output both (this description is quite long).
395 <dd>Output both (this description is quite long).
396 <dt> --long
396 <dt> --long
397 <dd>Output all day long.
397 <dd>Output all day long.
398 <dt> --par
398 <dt> --par
399 <dd>This option has two paragraphs in its description. This is the first.
399 <dd>This option has two paragraphs in its description. This is the first.
400 <p>
400 <p>
401 This is the second. Blank lines may be omitted between
401 This is the second. Blank lines may be omitted between
402 options (as above) or left in (as here).
402 options (as above) or left in (as here).
403 </p>
403 </p>
404 </dl>
404 </dl>
405 <p>
405 <p>
406 The next paragraph looks like an option list, but lacks the two-space
406 The next paragraph looks like an option list, but lacks the two-space
407 marker after the option. It is treated as a normal paragraph:
407 marker after the option. It is treated as a normal paragraph:
408 </p>
408 </p>
409 <p>
409 <p>
410 --foo bar baz
410 --foo bar baz
411 </p>
411 </p>
412 ----------------------------------------------------------------------
412 ----------------------------------------------------------------------
413
413
414 == fields ==
414 == fields ==
415 60 column format:
415 60 column format:
416 ----------------------------------------------------------------------
416 ----------------------------------------------------------------------
417 a First item.
417 a First item.
418 ab Second item. Indentation and wrapping is
418 ab Second item. Indentation and wrapping is
419 handled automatically.
419 handled automatically.
420
420
421 Next list:
421 Next list:
422
422
423 small The larger key below triggers full indentation
423 small The larger key below triggers full indentation
424 here.
424 here.
425 much too large
425 much too large
426 This key is big enough to get its own line.
426 This key is big enough to get its own line.
427 ----------------------------------------------------------------------
427 ----------------------------------------------------------------------
428
428
429 30 column format:
429 30 column format:
430 ----------------------------------------------------------------------
430 ----------------------------------------------------------------------
431 a First item.
431 a First item.
432 ab Second item.
432 ab Second item.
433 Indentation and
433 Indentation and
434 wrapping is
434 wrapping is
435 handled
435 handled
436 automatically.
436 automatically.
437
437
438 Next list:
438 Next list:
439
439
440 small The larger key
440 small The larger key
441 below triggers
441 below triggers
442 full indentation
442 full indentation
443 here.
443 here.
444 much too large
444 much too large
445 This key is big
445 This key is big
446 enough to get
446 enough to get
447 its own line.
447 its own line.
448 ----------------------------------------------------------------------
448 ----------------------------------------------------------------------
449
449
450 html format:
450 html format:
451 ----------------------------------------------------------------------
451 ----------------------------------------------------------------------
452 <dl>
452 <dl>
453 <dt>a
453 <dt>a
454 <dd>First item.
454 <dd>First item.
455 <dt>ab
455 <dt>ab
456 <dd>Second item. Indentation and wrapping is handled automatically.
456 <dd>Second item. Indentation and wrapping is handled automatically.
457 </dl>
457 </dl>
458 <p>
458 <p>
459 Next list:
459 Next list:
460 </p>
460 </p>
461 <dl>
461 <dl>
462 <dt>small
462 <dt>small
463 <dd>The larger key below triggers full indentation here.
463 <dd>The larger key below triggers full indentation here.
464 <dt>much too large
464 <dt>much too large
465 <dd>This key is big enough to get its own line.
465 <dd>This key is big enough to get its own line.
466 </dl>
466 </dl>
467 ----------------------------------------------------------------------
467 ----------------------------------------------------------------------
468
468
469 == containers (normal) ==
469 == containers (normal) ==
470 60 column format:
470 60 column format:
471 ----------------------------------------------------------------------
471 ----------------------------------------------------------------------
472 Normal output.
472 Normal output.
473 ----------------------------------------------------------------------
473 ----------------------------------------------------------------------
474
474
475 30 column format:
475 30 column format:
476 ----------------------------------------------------------------------
476 ----------------------------------------------------------------------
477 Normal output.
477 Normal output.
478 ----------------------------------------------------------------------
478 ----------------------------------------------------------------------
479
479
480 html format:
480 html format:
481 ----------------------------------------------------------------------
481 ----------------------------------------------------------------------
482 <p>
482 <p>
483 Normal output.
483 Normal output.
484 </p>
484 </p>
485 ----------------------------------------------------------------------
485 ----------------------------------------------------------------------
486
486
487 == containers (verbose) ==
487 == containers (verbose) ==
488 60 column format:
488 60 column format:
489 ----------------------------------------------------------------------
489 ----------------------------------------------------------------------
490 Normal output.
490 Normal output.
491
491
492 Verbose output.
492 Verbose output.
493 ----------------------------------------------------------------------
493 ----------------------------------------------------------------------
494 ['debug', 'debug']
494 ['debug', 'debug']
495 ----------------------------------------------------------------------
495 ----------------------------------------------------------------------
496
496
497 30 column format:
497 30 column format:
498 ----------------------------------------------------------------------
498 ----------------------------------------------------------------------
499 Normal output.
499 Normal output.
500
500
501 Verbose output.
501 Verbose output.
502 ----------------------------------------------------------------------
502 ----------------------------------------------------------------------
503 ['debug', 'debug']
503 ['debug', 'debug']
504 ----------------------------------------------------------------------
504 ----------------------------------------------------------------------
505
505
506 html format:
506 html format:
507 ----------------------------------------------------------------------
507 ----------------------------------------------------------------------
508 <p>
508 <p>
509 Normal output.
509 Normal output.
510 </p>
510 </p>
511 <p>
511 <p>
512 Verbose output.
512 Verbose output.
513 </p>
513 </p>
514 ----------------------------------------------------------------------
514 ----------------------------------------------------------------------
515 ['debug', 'debug']
515 ['debug', 'debug']
516 ----------------------------------------------------------------------
516 ----------------------------------------------------------------------
517
517
518 == containers (debug) ==
518 == containers (debug) ==
519 60 column format:
519 60 column format:
520 ----------------------------------------------------------------------
520 ----------------------------------------------------------------------
521 Normal output.
521 Normal output.
522
522
523 Initial debug output.
523 Initial debug output.
524 ----------------------------------------------------------------------
524 ----------------------------------------------------------------------
525 ['verbose']
525 ['verbose']
526 ----------------------------------------------------------------------
526 ----------------------------------------------------------------------
527
527
528 30 column format:
528 30 column format:
529 ----------------------------------------------------------------------
529 ----------------------------------------------------------------------
530 Normal output.
530 Normal output.
531
531
532 Initial debug output.
532 Initial debug output.
533 ----------------------------------------------------------------------
533 ----------------------------------------------------------------------
534 ['verbose']
534 ['verbose']
535 ----------------------------------------------------------------------
535 ----------------------------------------------------------------------
536
536
537 html format:
537 html format:
538 ----------------------------------------------------------------------
538 ----------------------------------------------------------------------
539 <p>
539 <p>
540 Normal output.
540 Normal output.
541 </p>
541 </p>
542 <p>
542 <p>
543 Initial debug output.
543 Initial debug output.
544 </p>
544 </p>
545 ----------------------------------------------------------------------
545 ----------------------------------------------------------------------
546 ['verbose']
546 ['verbose']
547 ----------------------------------------------------------------------
547 ----------------------------------------------------------------------
548
548
549 == containers (verbose debug) ==
549 == containers (verbose debug) ==
550 60 column format:
550 60 column format:
551 ----------------------------------------------------------------------
551 ----------------------------------------------------------------------
552 Normal output.
552 Normal output.
553
553
554 Initial debug output.
554 Initial debug output.
555
555
556 Verbose output.
556 Verbose output.
557
557
558 Debug output.
558 Debug output.
559 ----------------------------------------------------------------------
559 ----------------------------------------------------------------------
560 []
560 []
561 ----------------------------------------------------------------------
561 ----------------------------------------------------------------------
562
562
563 30 column format:
563 30 column format:
564 ----------------------------------------------------------------------
564 ----------------------------------------------------------------------
565 Normal output.
565 Normal output.
566
566
567 Initial debug output.
567 Initial debug output.
568
568
569 Verbose output.
569 Verbose output.
570
570
571 Debug output.
571 Debug output.
572 ----------------------------------------------------------------------
572 ----------------------------------------------------------------------
573 []
573 []
574 ----------------------------------------------------------------------
574 ----------------------------------------------------------------------
575
575
576 html format:
576 html format:
577 ----------------------------------------------------------------------
577 ----------------------------------------------------------------------
578 <p>
578 <p>
579 Normal output.
579 Normal output.
580 </p>
580 </p>
581 <p>
581 <p>
582 Initial debug output.
582 Initial debug output.
583 </p>
583 </p>
584 <p>
584 <p>
585 Verbose output.
585 Verbose output.
586 </p>
586 </p>
587 <p>
587 <p>
588 Debug output.
588 Debug output.
589 </p>
589 </p>
590 ----------------------------------------------------------------------
590 ----------------------------------------------------------------------
591 []
591 []
592 ----------------------------------------------------------------------
592 ----------------------------------------------------------------------
593
593
594 == roles ==
594 == roles ==
595 60 column format:
595 60 column format:
596 ----------------------------------------------------------------------
596 ----------------------------------------------------------------------
597 Please see "hg add".
597 Please see 'hg add'.
598 ----------------------------------------------------------------------
598 ----------------------------------------------------------------------
599
599
600 30 column format:
600 30 column format:
601 ----------------------------------------------------------------------
601 ----------------------------------------------------------------------
602 Please see "hg add".
602 Please see 'hg add'.
603 ----------------------------------------------------------------------
603 ----------------------------------------------------------------------
604
604
605 html format:
605 html format:
606 ----------------------------------------------------------------------
606 ----------------------------------------------------------------------
607 <p>
607 <p>
608 Please see &quot;hg add&quot;.
608 Please see 'hg add'.
609 </p>
609 </p>
610 ----------------------------------------------------------------------
610 ----------------------------------------------------------------------
611
611
612 == sections ==
612 == sections ==
613 60 column format:
613 60 column format:
614 ----------------------------------------------------------------------
614 ----------------------------------------------------------------------
615 Title
615 Title
616 =====
616 =====
617
617
618 Section
618 Section
619 -------
619 -------
620
620
621 Subsection
621 Subsection
622 ''''''''''
622 ''''''''''
623
623
624 Markup: "foo" and "hg help"
624 Markup: "foo" and 'hg help'
625 ---------------------------
625 ---------------------------
626 ----------------------------------------------------------------------
626 ----------------------------------------------------------------------
627
627
628 30 column format:
628 30 column format:
629 ----------------------------------------------------------------------
629 ----------------------------------------------------------------------
630 Title
630 Title
631 =====
631 =====
632
632
633 Section
633 Section
634 -------
634 -------
635
635
636 Subsection
636 Subsection
637 ''''''''''
637 ''''''''''
638
638
639 Markup: "foo" and "hg help"
639 Markup: "foo" and 'hg help'
640 ---------------------------
640 ---------------------------
641 ----------------------------------------------------------------------
641 ----------------------------------------------------------------------
642
642
643 html format:
643 html format:
644 ----------------------------------------------------------------------
644 ----------------------------------------------------------------------
645 <h1>Title</h1>
645 <h1>Title</h1>
646 <h2>Section</h2>
646 <h2>Section</h2>
647 <h3>Subsection</h3>
647 <h3>Subsection</h3>
648 <h2>Markup: &quot;foo&quot; and &quot;hg help&quot;</h2>
648 <h2>Markup: &quot;foo&quot; and 'hg help'</h2>
649 ----------------------------------------------------------------------
649 ----------------------------------------------------------------------
650
650
651 == admonitions ==
651 == admonitions ==
652 60 column format:
652 60 column format:
653 ----------------------------------------------------------------------
653 ----------------------------------------------------------------------
654 Note:
654 Note:
655 This is a note
655 This is a note
656
656
657 - Bullet 1
657 - Bullet 1
658 - Bullet 2
658 - Bullet 2
659
659
660 Warning!
660 Warning!
661 This is a warning Second input line of warning
661 This is a warning Second input line of warning
662
662
663 !Danger!
663 !Danger!
664 This is danger
664 This is danger
665 ----------------------------------------------------------------------
665 ----------------------------------------------------------------------
666
666
667 30 column format:
667 30 column format:
668 ----------------------------------------------------------------------
668 ----------------------------------------------------------------------
669 Note:
669 Note:
670 This is a note
670 This is a note
671
671
672 - Bullet 1
672 - Bullet 1
673 - Bullet 2
673 - Bullet 2
674
674
675 Warning!
675 Warning!
676 This is a warning Second
676 This is a warning Second
677 input line of warning
677 input line of warning
678
678
679 !Danger!
679 !Danger!
680 This is danger
680 This is danger
681 ----------------------------------------------------------------------
681 ----------------------------------------------------------------------
682
682
683 html format:
683 html format:
684 ----------------------------------------------------------------------
684 ----------------------------------------------------------------------
685 <p>
685 <p>
686 <b>Note:</b>
686 <b>Note:</b>
687 </p>
687 </p>
688 <p>
688 <p>
689 This is a note
689 This is a note
690 </p>
690 </p>
691 <ul>
691 <ul>
692 <li> Bullet 1
692 <li> Bullet 1
693 <li> Bullet 2
693 <li> Bullet 2
694 </ul>
694 </ul>
695 <p>
695 <p>
696 <b>Warning!</b> This is a warning Second input line of warning
696 <b>Warning!</b> This is a warning Second input line of warning
697 </p>
697 </p>
698 <p>
698 <p>
699 <b>!Danger!</b> This is danger
699 <b>!Danger!</b> This is danger
700 </p>
700 </p>
701 ----------------------------------------------------------------------
701 ----------------------------------------------------------------------
702
702
703 == comments ==
703 == comments ==
704 60 column format:
704 60 column format:
705 ----------------------------------------------------------------------
705 ----------------------------------------------------------------------
706 Some text.
706 Some text.
707
707
708 Some indented text.
708 Some indented text.
709
709
710 Empty comment above
710 Empty comment above
711 ----------------------------------------------------------------------
711 ----------------------------------------------------------------------
712
712
713 30 column format:
713 30 column format:
714 ----------------------------------------------------------------------
714 ----------------------------------------------------------------------
715 Some text.
715 Some text.
716
716
717 Some indented text.
717 Some indented text.
718
718
719 Empty comment above
719 Empty comment above
720 ----------------------------------------------------------------------
720 ----------------------------------------------------------------------
721
721
722 html format:
722 html format:
723 ----------------------------------------------------------------------
723 ----------------------------------------------------------------------
724 <p>
724 <p>
725 Some text.
725 Some text.
726 </p>
726 </p>
727 <p>
727 <p>
728 Some indented text.
728 Some indented text.
729 </p>
729 </p>
730 <p>
730 <p>
731 Empty comment above
731 Empty comment above
732 </p>
732 </p>
733 ----------------------------------------------------------------------
733 ----------------------------------------------------------------------
734
734
735 === === ========================================
735 === === ========================================
736 a b c
736 a b c
737 === === ========================================
737 === === ========================================
738 1 2 3
738 1 2 3
739 foo bar baz this list is very very very long man
739 foo bar baz this list is very very very long man
740 === === ========================================
740 === === ========================================
741
741
742 == table ==
742 == table ==
743 60 column format:
743 60 column format:
744 ----------------------------------------------------------------------
744 ----------------------------------------------------------------------
745 a b c
745 a b c
746 ------------------------------------------------
746 ------------------------------------------------
747 1 2 3
747 1 2 3
748 foo bar baz this list is very very very long man
748 foo bar baz this list is very very very long man
749 ----------------------------------------------------------------------
749 ----------------------------------------------------------------------
750
750
751 30 column format:
751 30 column format:
752 ----------------------------------------------------------------------
752 ----------------------------------------------------------------------
753 a b c
753 a b c
754 ------------------------------
754 ------------------------------
755 1 2 3
755 1 2 3
756 foo bar baz this list is
756 foo bar baz this list is
757 very very very long
757 very very very long
758 man
758 man
759 ----------------------------------------------------------------------
759 ----------------------------------------------------------------------
760
760
761 html format:
761 html format:
762 ----------------------------------------------------------------------
762 ----------------------------------------------------------------------
763 <table>
763 <table>
764 <tr><td>a</td>
764 <tr><td>a</td>
765 <td>b</td>
765 <td>b</td>
766 <td>c</td></tr>
766 <td>c</td></tr>
767 <tr><td>1</td>
767 <tr><td>1</td>
768 <td>2</td>
768 <td>2</td>
769 <td>3</td></tr>
769 <td>3</td></tr>
770 <tr><td>foo</td>
770 <tr><td>foo</td>
771 <td>bar</td>
771 <td>bar</td>
772 <td>baz this list is very very very long man</td></tr>
772 <td>baz this list is very very very long man</td></tr>
773 </table>
773 </table>
774 ----------------------------------------------------------------------
774 ----------------------------------------------------------------------
775
775
776 = ==== ======================================
776 = ==== ======================================
777 s long line goes on here
777 s long line goes on here
778 xy tried to fix here by indenting
778 xy tried to fix here by indenting
779 = ==== ======================================
779 = ==== ======================================
780
780
781 == table+nl ==
781 == table+nl ==
782 60 column format:
782 60 column format:
783 ----------------------------------------------------------------------
783 ----------------------------------------------------------------------
784 s long line goes on here
784 s long line goes on here
785 xy tried to fix here by indenting
785 xy tried to fix here by indenting
786 ----------------------------------------------------------------------
786 ----------------------------------------------------------------------
787
787
788 30 column format:
788 30 column format:
789 ----------------------------------------------------------------------
789 ----------------------------------------------------------------------
790 s long line goes on here
790 s long line goes on here
791 xy tried to fix here by
791 xy tried to fix here by
792 indenting
792 indenting
793 ----------------------------------------------------------------------
793 ----------------------------------------------------------------------
794
794
795 html format:
795 html format:
796 ----------------------------------------------------------------------
796 ----------------------------------------------------------------------
797 <table>
797 <table>
798 <tr><td>s</td>
798 <tr><td>s</td>
799 <td>long</td>
799 <td>long</td>
800 <td>line goes on here</td></tr>
800 <td>line goes on here</td></tr>
801 <tr><td></td>
801 <tr><td></td>
802 <td>xy</td>
802 <td>xy</td>
803 <td>tried to fix here by indenting</td></tr>
803 <td>tried to fix here by indenting</td></tr>
804 </table>
804 </table>
805 ----------------------------------------------------------------------
805 ----------------------------------------------------------------------
806
806
@@ -1,1612 +1,1612 b''
1 $ checkundo()
1 $ checkundo()
2 > {
2 > {
3 > if [ -f .hg/store/undo ]; then
3 > if [ -f .hg/store/undo ]; then
4 > echo ".hg/store/undo still exists after $1"
4 > echo ".hg/store/undo still exists after $1"
5 > fi
5 > fi
6 > }
6 > }
7
7
8 $ cat <<EOF >> $HGRCPATH
8 $ cat <<EOF >> $HGRCPATH
9 > [extensions]
9 > [extensions]
10 > mq =
10 > mq =
11 > [mq]
11 > [mq]
12 > plain = true
12 > plain = true
13 > EOF
13 > EOF
14
14
15
15
16 help
16 help
17
17
18 $ hg help mq
18 $ hg help mq
19 mq extension - manage a stack of patches
19 mq extension - manage a stack of patches
20
20
21 This extension lets you work with a stack of patches in a Mercurial
21 This extension lets you work with a stack of patches in a Mercurial
22 repository. It manages two stacks of patches - all known patches, and applied
22 repository. It manages two stacks of patches - all known patches, and applied
23 patches (subset of known patches).
23 patches (subset of known patches).
24
24
25 Known patches are represented as patch files in the .hg/patches directory.
25 Known patches are represented as patch files in the .hg/patches directory.
26 Applied patches are both patch files and changesets.
26 Applied patches are both patch files and changesets.
27
27
28 Common tasks (use "hg help command" for more details):
28 Common tasks (use 'hg help command' for more details):
29
29
30 create new patch qnew
30 create new patch qnew
31 import existing patch qimport
31 import existing patch qimport
32
32
33 print patch series qseries
33 print patch series qseries
34 print applied patches qapplied
34 print applied patches qapplied
35
35
36 add known patch to applied stack qpush
36 add known patch to applied stack qpush
37 remove patch from applied stack qpop
37 remove patch from applied stack qpop
38 refresh contents of top applied patch qrefresh
38 refresh contents of top applied patch qrefresh
39
39
40 By default, mq will automatically use git patches when required to avoid
40 By default, mq will automatically use git patches when required to avoid
41 losing file mode changes, copy records, binary files or empty files creations
41 losing file mode changes, copy records, binary files or empty files creations
42 or deletions. This behavior can be configured with:
42 or deletions. This behavior can be configured with:
43
43
44 [mq]
44 [mq]
45 git = auto/keep/yes/no
45 git = auto/keep/yes/no
46
46
47 If set to 'keep', mq will obey the [diff] section configuration while
47 If set to 'keep', mq will obey the [diff] section configuration while
48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
49 will override the [diff] section and always generate git or regular patches,
49 will override the [diff] section and always generate git or regular patches,
50 possibly losing data in the second case.
50 possibly losing data in the second case.
51
51
52 It may be desirable for mq changesets to be kept in the secret phase (see "hg
52 It may be desirable for mq changesets to be kept in the secret phase (see 'hg
53 help phases"), which can be enabled with the following setting:
53 help phases'), which can be enabled with the following setting:
54
54
55 [mq]
55 [mq]
56 secret = True
56 secret = True
57
57
58 You will by default be managing a patch queue named "patches". You can create
58 You will by default be managing a patch queue named "patches". You can create
59 other, independent patch queues with the "hg qqueue" command.
59 other, independent patch queues with the 'hg qqueue' command.
60
60
61 If the working directory contains uncommitted files, qpush, qpop and qgoto
61 If the working directory contains uncommitted files, qpush, qpop and qgoto
62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
63
63
64 [mq]
64 [mq]
65 keepchanges = True
65 keepchanges = True
66
66
67 make them behave as if --keep-changes were passed, and non-conflicting local
67 make them behave as if --keep-changes were passed, and non-conflicting local
68 changes will be tolerated and preserved. If incompatible options such as
68 changes will be tolerated and preserved. If incompatible options such as
69 -f/--force or --exact are passed, this setting is ignored.
69 -f/--force or --exact are passed, this setting is ignored.
70
70
71 This extension used to provide a strip command. This command now lives in the
71 This extension used to provide a strip command. This command now lives in the
72 strip extension.
72 strip extension.
73
73
74 list of commands:
74 list of commands:
75
75
76 qapplied print the patches already applied
76 qapplied print the patches already applied
77 qclone clone main and patch repository at same time
77 qclone clone main and patch repository at same time
78 qdelete remove patches from queue
78 qdelete remove patches from queue
79 qdiff diff of the current patch and subsequent modifications
79 qdiff diff of the current patch and subsequent modifications
80 qfinish move applied patches into repository history
80 qfinish move applied patches into repository history
81 qfold fold the named patches into the current patch
81 qfold fold the named patches into the current patch
82 qgoto push or pop patches until named patch is at top of stack
82 qgoto push or pop patches until named patch is at top of stack
83 qguard set or print guards for a patch
83 qguard set or print guards for a patch
84 qheader print the header of the topmost or specified patch
84 qheader print the header of the topmost or specified patch
85 qimport import a patch or existing changeset
85 qimport import a patch or existing changeset
86 qnew create a new patch
86 qnew create a new patch
87 qnext print the name of the next pushable patch
87 qnext print the name of the next pushable patch
88 qpop pop the current patch off the stack
88 qpop pop the current patch off the stack
89 qprev print the name of the preceding applied patch
89 qprev print the name of the preceding applied patch
90 qpush push the next patch onto the stack
90 qpush push the next patch onto the stack
91 qqueue manage multiple patch queues
91 qqueue manage multiple patch queues
92 qrefresh update the current patch
92 qrefresh update the current patch
93 qrename rename a patch
93 qrename rename a patch
94 qselect set or print guarded patches to push
94 qselect set or print guarded patches to push
95 qseries print the entire series file
95 qseries print the entire series file
96 qtop print the name of the current patch
96 qtop print the name of the current patch
97 qunapplied print the patches not yet applied
97 qunapplied print the patches not yet applied
98
98
99 (use "hg help -v mq" to show built-in aliases and global options)
99 (use "hg help -v mq" to show built-in aliases and global options)
100
100
101 $ hg init a
101 $ hg init a
102 $ cd a
102 $ cd a
103 $ echo a > a
103 $ echo a > a
104 $ hg ci -Ama
104 $ hg ci -Ama
105 adding a
105 adding a
106
106
107 $ hg clone . ../k
107 $ hg clone . ../k
108 updating to branch default
108 updating to branch default
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110
110
111 $ mkdir b
111 $ mkdir b
112 $ echo z > b/z
112 $ echo z > b/z
113 $ hg ci -Ama
113 $ hg ci -Ama
114 adding b/z
114 adding b/z
115
115
116
116
117 qinit
117 qinit
118
118
119 $ hg qinit
119 $ hg qinit
120
120
121 $ cd ..
121 $ cd ..
122 $ hg init b
122 $ hg init b
123
123
124
124
125 -R qinit
125 -R qinit
126
126
127 $ hg -R b qinit
127 $ hg -R b qinit
128
128
129 $ hg init c
129 $ hg init c
130
130
131
131
132 qinit -c
132 qinit -c
133
133
134 $ hg --cwd c qinit -c
134 $ hg --cwd c qinit -c
135 $ hg -R c/.hg/patches st
135 $ hg -R c/.hg/patches st
136 A .hgignore
136 A .hgignore
137 A series
137 A series
138
138
139
139
140 qinit; qinit -c
140 qinit; qinit -c
141
141
142 $ hg init d
142 $ hg init d
143 $ cd d
143 $ cd d
144 $ hg qinit
144 $ hg qinit
145 $ hg qinit -c
145 $ hg qinit -c
146
146
147 qinit -c should create both files if they don't exist
147 qinit -c should create both files if they don't exist
148
148
149 $ cat .hg/patches/.hgignore
149 $ cat .hg/patches/.hgignore
150 ^\.hg
150 ^\.hg
151 ^\.mq
151 ^\.mq
152 syntax: glob
152 syntax: glob
153 status
153 status
154 guards
154 guards
155 $ cat .hg/patches/series
155 $ cat .hg/patches/series
156 $ hg qinit -c
156 $ hg qinit -c
157 abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
157 abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
158 [255]
158 [255]
159 $ cd ..
159 $ cd ..
160
160
161 $ echo '% qinit; <stuff>; qinit -c'
161 $ echo '% qinit; <stuff>; qinit -c'
162 % qinit; <stuff>; qinit -c
162 % qinit; <stuff>; qinit -c
163 $ hg init e
163 $ hg init e
164 $ cd e
164 $ cd e
165 $ hg qnew A
165 $ hg qnew A
166 $ checkundo qnew
166 $ checkundo qnew
167 $ echo foo > foo
167 $ echo foo > foo
168 $ hg phase -r qbase
168 $ hg phase -r qbase
169 0: draft
169 0: draft
170 $ hg add foo
170 $ hg add foo
171 $ hg qrefresh
171 $ hg qrefresh
172 $ hg phase -r qbase
172 $ hg phase -r qbase
173 0: draft
173 0: draft
174 $ hg qnew B
174 $ hg qnew B
175 $ echo >> foo
175 $ echo >> foo
176 $ hg qrefresh
176 $ hg qrefresh
177 $ echo status >> .hg/patches/.hgignore
177 $ echo status >> .hg/patches/.hgignore
178 $ echo bleh >> .hg/patches/.hgignore
178 $ echo bleh >> .hg/patches/.hgignore
179 $ hg qinit -c
179 $ hg qinit -c
180 adding .hg/patches/A (glob)
180 adding .hg/patches/A (glob)
181 adding .hg/patches/B (glob)
181 adding .hg/patches/B (glob)
182 $ hg -R .hg/patches status
182 $ hg -R .hg/patches status
183 A .hgignore
183 A .hgignore
184 A A
184 A A
185 A B
185 A B
186 A series
186 A series
187
187
188 qinit -c shouldn't touch these files if they already exist
188 qinit -c shouldn't touch these files if they already exist
189
189
190 $ cat .hg/patches/.hgignore
190 $ cat .hg/patches/.hgignore
191 status
191 status
192 bleh
192 bleh
193 $ cat .hg/patches/series
193 $ cat .hg/patches/series
194 A
194 A
195 B
195 B
196
196
197 add an untracked file
197 add an untracked file
198
198
199 $ echo >> .hg/patches/flaf
199 $ echo >> .hg/patches/flaf
200
200
201 status --mq with color (issue2096)
201 status --mq with color (issue2096)
202
202
203 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
203 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
204 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
204 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
205 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
205 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
206 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
206 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
207 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
207 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
208 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
208 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
209
209
210 try the --mq option on a command provided by an extension
210 try the --mq option on a command provided by an extension
211
211
212 $ hg purge --mq --verbose --config extensions.purge=
212 $ hg purge --mq --verbose --config extensions.purge=
213 removing file flaf
213 removing file flaf
214
214
215 $ cd ..
215 $ cd ..
216
216
217 #if no-outer-repo
217 #if no-outer-repo
218
218
219 init --mq without repo
219 init --mq without repo
220
220
221 $ mkdir f
221 $ mkdir f
222 $ cd f
222 $ cd f
223 $ hg init --mq
223 $ hg init --mq
224 abort: there is no Mercurial repository here (.hg not found)
224 abort: there is no Mercurial repository here (.hg not found)
225 [255]
225 [255]
226 $ cd ..
226 $ cd ..
227
227
228 #endif
228 #endif
229
229
230 init --mq with repo path
230 init --mq with repo path
231
231
232 $ hg init g
232 $ hg init g
233 $ hg init --mq g
233 $ hg init --mq g
234 $ test -d g/.hg/patches/.hg
234 $ test -d g/.hg/patches/.hg
235
235
236 init --mq with nonexistent directory
236 init --mq with nonexistent directory
237
237
238 $ hg init --mq nonexistentdir
238 $ hg init --mq nonexistentdir
239 abort: repository nonexistentdir not found!
239 abort: repository nonexistentdir not found!
240 [255]
240 [255]
241
241
242
242
243 init --mq with bundle (non "local")
243 init --mq with bundle (non "local")
244
244
245 $ hg -R a bundle --all a.bundle >/dev/null
245 $ hg -R a bundle --all a.bundle >/dev/null
246 $ hg init --mq a.bundle
246 $ hg init --mq a.bundle
247 abort: only a local queue repository may be initialized
247 abort: only a local queue repository may be initialized
248 [255]
248 [255]
249
249
250 $ cd a
250 $ cd a
251
251
252 $ hg qnew -m 'foo bar' test.patch
252 $ hg qnew -m 'foo bar' test.patch
253
253
254 $ echo '# comment' > .hg/patches/series.tmp
254 $ echo '# comment' > .hg/patches/series.tmp
255 $ echo >> .hg/patches/series.tmp # empty line
255 $ echo >> .hg/patches/series.tmp # empty line
256 $ cat .hg/patches/series >> .hg/patches/series.tmp
256 $ cat .hg/patches/series >> .hg/patches/series.tmp
257 $ mv .hg/patches/series.tmp .hg/patches/series
257 $ mv .hg/patches/series.tmp .hg/patches/series
258
258
259
259
260 qrefresh
260 qrefresh
261
261
262 $ echo a >> a
262 $ echo a >> a
263 $ hg qrefresh
263 $ hg qrefresh
264 $ cat .hg/patches/test.patch
264 $ cat .hg/patches/test.patch
265 foo bar
265 foo bar
266
266
267 diff -r [a-f0-9]* a (re)
267 diff -r [a-f0-9]* a (re)
268 --- a/a\t(?P<date>.*) (re)
268 --- a/a\t(?P<date>.*) (re)
269 \+\+\+ b/a\t(?P<date2>.*) (re)
269 \+\+\+ b/a\t(?P<date2>.*) (re)
270 @@ -1,1 +1,2 @@
270 @@ -1,1 +1,2 @@
271 a
271 a
272 +a
272 +a
273
273
274 empty qrefresh
274 empty qrefresh
275
275
276 $ hg qrefresh -X a
276 $ hg qrefresh -X a
277
277
278 revision:
278 revision:
279
279
280 $ hg diff -r -2 -r -1
280 $ hg diff -r -2 -r -1
281
281
282 patch:
282 patch:
283
283
284 $ cat .hg/patches/test.patch
284 $ cat .hg/patches/test.patch
285 foo bar
285 foo bar
286
286
287
287
288 working dir diff:
288 working dir diff:
289
289
290 $ hg diff --nodates -q
290 $ hg diff --nodates -q
291 --- a/a
291 --- a/a
292 +++ b/a
292 +++ b/a
293 @@ -1,1 +1,2 @@
293 @@ -1,1 +1,2 @@
294 a
294 a
295 +a
295 +a
296
296
297 restore things
297 restore things
298
298
299 $ hg qrefresh
299 $ hg qrefresh
300 $ checkundo qrefresh
300 $ checkundo qrefresh
301
301
302
302
303 qpop
303 qpop
304
304
305 $ hg qpop
305 $ hg qpop
306 popping test.patch
306 popping test.patch
307 patch queue now empty
307 patch queue now empty
308 $ checkundo qpop
308 $ checkundo qpop
309
309
310
310
311 qpush with dump of tag cache
311 qpush with dump of tag cache
312 Dump the tag cache to ensure that it has exactly one head after qpush.
312 Dump the tag cache to ensure that it has exactly one head after qpush.
313
313
314 $ rm -f .hg/cache/tags2-visible
314 $ rm -f .hg/cache/tags2-visible
315 $ hg tags > /dev/null
315 $ hg tags > /dev/null
316
316
317 .hg/cache/tags2-visible (pre qpush):
317 .hg/cache/tags2-visible (pre qpush):
318
318
319 $ cat .hg/cache/tags2-visible
319 $ cat .hg/cache/tags2-visible
320 1 [\da-f]{40} (re)
320 1 [\da-f]{40} (re)
321 $ hg qpush
321 $ hg qpush
322 applying test.patch
322 applying test.patch
323 now at: test.patch
323 now at: test.patch
324 $ hg phase -r qbase
324 $ hg phase -r qbase
325 2: draft
325 2: draft
326 $ hg tags > /dev/null
326 $ hg tags > /dev/null
327
327
328 .hg/cache/tags2-visible (post qpush):
328 .hg/cache/tags2-visible (post qpush):
329
329
330 $ cat .hg/cache/tags2-visible
330 $ cat .hg/cache/tags2-visible
331 2 [\da-f]{40} (re)
331 2 [\da-f]{40} (re)
332 $ checkundo qpush
332 $ checkundo qpush
333 $ cd ..
333 $ cd ..
334
334
335
335
336 pop/push outside repo
336 pop/push outside repo
337 $ hg -R a qpop
337 $ hg -R a qpop
338 popping test.patch
338 popping test.patch
339 patch queue now empty
339 patch queue now empty
340 $ hg -R a qpush
340 $ hg -R a qpush
341 applying test.patch
341 applying test.patch
342 now at: test.patch
342 now at: test.patch
343
343
344 $ cd a
344 $ cd a
345 $ hg qnew test2.patch
345 $ hg qnew test2.patch
346
346
347 qrefresh in subdir
347 qrefresh in subdir
348
348
349 $ cd b
349 $ cd b
350 $ echo a > a
350 $ echo a > a
351 $ hg add a
351 $ hg add a
352 $ hg qrefresh
352 $ hg qrefresh
353
353
354 pop/push -a in subdir
354 pop/push -a in subdir
355
355
356 $ hg qpop -a
356 $ hg qpop -a
357 popping test2.patch
357 popping test2.patch
358 popping test.patch
358 popping test.patch
359 patch queue now empty
359 patch queue now empty
360 $ hg --traceback qpush -a
360 $ hg --traceback qpush -a
361 applying test.patch
361 applying test.patch
362 applying test2.patch
362 applying test2.patch
363 now at: test2.patch
363 now at: test2.patch
364
364
365
365
366 setting columns & formatted tests truncating (issue1912)
366 setting columns & formatted tests truncating (issue1912)
367
367
368 $ COLUMNS=4 hg qseries --config ui.formatted=true
368 $ COLUMNS=4 hg qseries --config ui.formatted=true
369 test.patch
369 test.patch
370 test2.patch
370 test2.patch
371 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
371 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
372 0 A test.patch: f...
372 0 A test.patch: f...
373 1 A test2.patch:
373 1 A test2.patch:
374 $ hg qpop
374 $ hg qpop
375 popping test2.patch
375 popping test2.patch
376 now at: test.patch
376 now at: test.patch
377 $ hg qseries -vs
377 $ hg qseries -vs
378 0 A test.patch: foo bar
378 0 A test.patch: foo bar
379 1 U test2.patch:
379 1 U test2.patch:
380 $ hg sum | grep mq
380 $ hg sum | grep mq
381 mq: 1 applied, 1 unapplied
381 mq: 1 applied, 1 unapplied
382 $ hg qpush
382 $ hg qpush
383 applying test2.patch
383 applying test2.patch
384 now at: test2.patch
384 now at: test2.patch
385 $ hg sum | grep mq
385 $ hg sum | grep mq
386 mq: 2 applied
386 mq: 2 applied
387 $ hg qapplied
387 $ hg qapplied
388 test.patch
388 test.patch
389 test2.patch
389 test2.patch
390 $ hg qtop
390 $ hg qtop
391 test2.patch
391 test2.patch
392
392
393
393
394 prev
394 prev
395
395
396 $ hg qapp -1
396 $ hg qapp -1
397 test.patch
397 test.patch
398
398
399 next
399 next
400
400
401 $ hg qunapp -1
401 $ hg qunapp -1
402 all patches applied
402 all patches applied
403 [1]
403 [1]
404
404
405 $ hg qpop
405 $ hg qpop
406 popping test2.patch
406 popping test2.patch
407 now at: test.patch
407 now at: test.patch
408
408
409 commit should fail
409 commit should fail
410
410
411 $ hg commit
411 $ hg commit
412 abort: cannot commit over an applied mq patch
412 abort: cannot commit over an applied mq patch
413 [255]
413 [255]
414
414
415 push should fail if draft
415 push should fail if draft
416
416
417 $ hg push ../../k
417 $ hg push ../../k
418 pushing to ../../k
418 pushing to ../../k
419 abort: source has mq patches applied
419 abort: source has mq patches applied
420 [255]
420 [255]
421
421
422
422
423 import should fail
423 import should fail
424
424
425 $ hg st .
425 $ hg st .
426 $ echo foo >> ../a
426 $ echo foo >> ../a
427 $ hg diff > ../../import.diff
427 $ hg diff > ../../import.diff
428 $ hg revert --no-backup ../a
428 $ hg revert --no-backup ../a
429 $ hg import ../../import.diff
429 $ hg import ../../import.diff
430 abort: cannot import over an applied patch
430 abort: cannot import over an applied patch
431 [255]
431 [255]
432 $ hg st
432 $ hg st
433
433
434 import --no-commit should succeed
434 import --no-commit should succeed
435
435
436 $ hg import --no-commit ../../import.diff
436 $ hg import --no-commit ../../import.diff
437 applying ../../import.diff
437 applying ../../import.diff
438 $ hg st
438 $ hg st
439 M a
439 M a
440 $ hg revert --no-backup ../a
440 $ hg revert --no-backup ../a
441
441
442
442
443 qunapplied
443 qunapplied
444
444
445 $ hg qunapplied
445 $ hg qunapplied
446 test2.patch
446 test2.patch
447
447
448
448
449 qpush/qpop with index
449 qpush/qpop with index
450
450
451 $ hg qnew test1b.patch
451 $ hg qnew test1b.patch
452 $ echo 1b > 1b
452 $ echo 1b > 1b
453 $ hg add 1b
453 $ hg add 1b
454 $ hg qrefresh
454 $ hg qrefresh
455 $ hg qpush 2
455 $ hg qpush 2
456 applying test2.patch
456 applying test2.patch
457 now at: test2.patch
457 now at: test2.patch
458 $ hg qpop 0
458 $ hg qpop 0
459 popping test2.patch
459 popping test2.patch
460 popping test1b.patch
460 popping test1b.patch
461 now at: test.patch
461 now at: test.patch
462 $ hg qpush test.patch+1
462 $ hg qpush test.patch+1
463 applying test1b.patch
463 applying test1b.patch
464 now at: test1b.patch
464 now at: test1b.patch
465 $ hg qpush test.patch+2
465 $ hg qpush test.patch+2
466 applying test2.patch
466 applying test2.patch
467 now at: test2.patch
467 now at: test2.patch
468 $ hg qpop test2.patch-1
468 $ hg qpop test2.patch-1
469 popping test2.patch
469 popping test2.patch
470 now at: test1b.patch
470 now at: test1b.patch
471 $ hg qpop test2.patch-2
471 $ hg qpop test2.patch-2
472 popping test1b.patch
472 popping test1b.patch
473 now at: test.patch
473 now at: test.patch
474 $ hg qpush test1b.patch+1
474 $ hg qpush test1b.patch+1
475 applying test1b.patch
475 applying test1b.patch
476 applying test2.patch
476 applying test2.patch
477 now at: test2.patch
477 now at: test2.patch
478
478
479
479
480 qpush --move
480 qpush --move
481
481
482 $ hg qpop -a
482 $ hg qpop -a
483 popping test2.patch
483 popping test2.patch
484 popping test1b.patch
484 popping test1b.patch
485 popping test.patch
485 popping test.patch
486 patch queue now empty
486 patch queue now empty
487 $ hg qguard test1b.patch -- -negguard
487 $ hg qguard test1b.patch -- -negguard
488 $ hg qguard test2.patch -- +posguard
488 $ hg qguard test2.patch -- +posguard
489 $ hg qpush --move test2.patch # can't move guarded patch
489 $ hg qpush --move test2.patch # can't move guarded patch
490 cannot push 'test2.patch' - guarded by '+posguard'
490 cannot push 'test2.patch' - guarded by '+posguard'
491 [1]
491 [1]
492 $ hg qselect posguard
492 $ hg qselect posguard
493 number of unguarded, unapplied patches has changed from 2 to 3
493 number of unguarded, unapplied patches has changed from 2 to 3
494 $ hg qpush --move test2.patch # move to front
494 $ hg qpush --move test2.patch # move to front
495 applying test2.patch
495 applying test2.patch
496 now at: test2.patch
496 now at: test2.patch
497 $ hg qpush --move test1b.patch # negative guard unselected
497 $ hg qpush --move test1b.patch # negative guard unselected
498 applying test1b.patch
498 applying test1b.patch
499 now at: test1b.patch
499 now at: test1b.patch
500 $ hg qpush --move test.patch # noop move
500 $ hg qpush --move test.patch # noop move
501 applying test.patch
501 applying test.patch
502 now at: test.patch
502 now at: test.patch
503 $ hg qseries -v
503 $ hg qseries -v
504 0 A test2.patch
504 0 A test2.patch
505 1 A test1b.patch
505 1 A test1b.patch
506 2 A test.patch
506 2 A test.patch
507 $ hg qpop -a
507 $ hg qpop -a
508 popping test.patch
508 popping test.patch
509 popping test1b.patch
509 popping test1b.patch
510 popping test2.patch
510 popping test2.patch
511 patch queue now empty
511 patch queue now empty
512
512
513 cleaning up
513 cleaning up
514
514
515 $ hg qselect --none
515 $ hg qselect --none
516 guards deactivated
516 guards deactivated
517 number of unguarded, unapplied patches has changed from 3 to 2
517 number of unguarded, unapplied patches has changed from 3 to 2
518 $ hg qguard --none test1b.patch
518 $ hg qguard --none test1b.patch
519 $ hg qguard --none test2.patch
519 $ hg qguard --none test2.patch
520 $ hg qpush --move test.patch
520 $ hg qpush --move test.patch
521 applying test.patch
521 applying test.patch
522 now at: test.patch
522 now at: test.patch
523 $ hg qpush --move test1b.patch
523 $ hg qpush --move test1b.patch
524 applying test1b.patch
524 applying test1b.patch
525 now at: test1b.patch
525 now at: test1b.patch
526 $ hg qpush --move bogus # nonexistent patch
526 $ hg qpush --move bogus # nonexistent patch
527 abort: patch bogus not in series
527 abort: patch bogus not in series
528 [255]
528 [255]
529 $ hg qpush --move # no patch
529 $ hg qpush --move # no patch
530 abort: please specify the patch to move
530 abort: please specify the patch to move
531 [255]
531 [255]
532 $ hg qpush --move test.patch # already applied
532 $ hg qpush --move test.patch # already applied
533 abort: cannot push to a previous patch: test.patch
533 abort: cannot push to a previous patch: test.patch
534 [255]
534 [255]
535 $ sed '2i\
535 $ sed '2i\
536 > # make qtip index different in series and fullseries
536 > # make qtip index different in series and fullseries
537 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
537 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
538 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
538 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
539 $ cat `hg root`/.hg/patches/series
539 $ cat `hg root`/.hg/patches/series
540 # comment
540 # comment
541 # make qtip index different in series and fullseries
541 # make qtip index different in series and fullseries
542
542
543 test.patch
543 test.patch
544 test1b.patch
544 test1b.patch
545 test2.patch
545 test2.patch
546 $ hg qpush --move test2.patch
546 $ hg qpush --move test2.patch
547 applying test2.patch
547 applying test2.patch
548 now at: test2.patch
548 now at: test2.patch
549
549
550
550
551 series after move
551 series after move
552
552
553 $ cat `hg root`/.hg/patches/series
553 $ cat `hg root`/.hg/patches/series
554 # comment
554 # comment
555 # make qtip index different in series and fullseries
555 # make qtip index different in series and fullseries
556
556
557 test.patch
557 test.patch
558 test1b.patch
558 test1b.patch
559 test2.patch
559 test2.patch
560
560
561
561
562 pop, qapplied, qunapplied
562 pop, qapplied, qunapplied
563
563
564 $ hg qseries -v
564 $ hg qseries -v
565 0 A test.patch
565 0 A test.patch
566 1 A test1b.patch
566 1 A test1b.patch
567 2 A test2.patch
567 2 A test2.patch
568
568
569 qapplied -1 test.patch
569 qapplied -1 test.patch
570
570
571 $ hg qapplied -1 test.patch
571 $ hg qapplied -1 test.patch
572 only one patch applied
572 only one patch applied
573 [1]
573 [1]
574
574
575 qapplied -1 test1b.patch
575 qapplied -1 test1b.patch
576
576
577 $ hg qapplied -1 test1b.patch
577 $ hg qapplied -1 test1b.patch
578 test.patch
578 test.patch
579
579
580 qapplied -1 test2.patch
580 qapplied -1 test2.patch
581
581
582 $ hg qapplied -1 test2.patch
582 $ hg qapplied -1 test2.patch
583 test1b.patch
583 test1b.patch
584
584
585 qapplied -1
585 qapplied -1
586
586
587 $ hg qapplied -1
587 $ hg qapplied -1
588 test1b.patch
588 test1b.patch
589
589
590 qapplied
590 qapplied
591
591
592 $ hg qapplied
592 $ hg qapplied
593 test.patch
593 test.patch
594 test1b.patch
594 test1b.patch
595 test2.patch
595 test2.patch
596
596
597 qapplied test1b.patch
597 qapplied test1b.patch
598
598
599 $ hg qapplied test1b.patch
599 $ hg qapplied test1b.patch
600 test.patch
600 test.patch
601 test1b.patch
601 test1b.patch
602
602
603 qunapplied -1
603 qunapplied -1
604
604
605 $ hg qunapplied -1
605 $ hg qunapplied -1
606 all patches applied
606 all patches applied
607 [1]
607 [1]
608
608
609 qunapplied
609 qunapplied
610
610
611 $ hg qunapplied
611 $ hg qunapplied
612
612
613 popping
613 popping
614
614
615 $ hg qpop
615 $ hg qpop
616 popping test2.patch
616 popping test2.patch
617 now at: test1b.patch
617 now at: test1b.patch
618
618
619 qunapplied -1
619 qunapplied -1
620
620
621 $ hg qunapplied -1
621 $ hg qunapplied -1
622 test2.patch
622 test2.patch
623
623
624 qunapplied
624 qunapplied
625
625
626 $ hg qunapplied
626 $ hg qunapplied
627 test2.patch
627 test2.patch
628
628
629 qunapplied test2.patch
629 qunapplied test2.patch
630
630
631 $ hg qunapplied test2.patch
631 $ hg qunapplied test2.patch
632
632
633 qunapplied -1 test2.patch
633 qunapplied -1 test2.patch
634
634
635 $ hg qunapplied -1 test2.patch
635 $ hg qunapplied -1 test2.patch
636 all patches applied
636 all patches applied
637 [1]
637 [1]
638
638
639 popping -a
639 popping -a
640
640
641 $ hg qpop -a
641 $ hg qpop -a
642 popping test1b.patch
642 popping test1b.patch
643 popping test.patch
643 popping test.patch
644 patch queue now empty
644 patch queue now empty
645
645
646 qapplied
646 qapplied
647
647
648 $ hg qapplied
648 $ hg qapplied
649
649
650 qapplied -1
650 qapplied -1
651
651
652 $ hg qapplied -1
652 $ hg qapplied -1
653 no patches applied
653 no patches applied
654 [1]
654 [1]
655 $ hg qpush
655 $ hg qpush
656 applying test.patch
656 applying test.patch
657 now at: test.patch
657 now at: test.patch
658
658
659
659
660 push should succeed
660 push should succeed
661
661
662 $ hg qpop -a
662 $ hg qpop -a
663 popping test.patch
663 popping test.patch
664 patch queue now empty
664 patch queue now empty
665 $ hg push ../../k
665 $ hg push ../../k
666 pushing to ../../k
666 pushing to ../../k
667 searching for changes
667 searching for changes
668 adding changesets
668 adding changesets
669 adding manifests
669 adding manifests
670 adding file changes
670 adding file changes
671 added 1 changesets with 1 changes to 1 files
671 added 1 changesets with 1 changes to 1 files
672
672
673
673
674 we want to start with some patches applied
674 we want to start with some patches applied
675
675
676 $ hg qpush -a
676 $ hg qpush -a
677 applying test.patch
677 applying test.patch
678 applying test1b.patch
678 applying test1b.patch
679 applying test2.patch
679 applying test2.patch
680 now at: test2.patch
680 now at: test2.patch
681
681
682 % pops all patches and succeeds
682 % pops all patches and succeeds
683
683
684 $ hg qpop -a
684 $ hg qpop -a
685 popping test2.patch
685 popping test2.patch
686 popping test1b.patch
686 popping test1b.patch
687 popping test.patch
687 popping test.patch
688 patch queue now empty
688 patch queue now empty
689
689
690 % does nothing and succeeds
690 % does nothing and succeeds
691
691
692 $ hg qpop -a
692 $ hg qpop -a
693 no patches applied
693 no patches applied
694
694
695 % fails - nothing else to pop
695 % fails - nothing else to pop
696
696
697 $ hg qpop
697 $ hg qpop
698 no patches applied
698 no patches applied
699 [1]
699 [1]
700
700
701 % pushes a patch and succeeds
701 % pushes a patch and succeeds
702
702
703 $ hg qpush
703 $ hg qpush
704 applying test.patch
704 applying test.patch
705 now at: test.patch
705 now at: test.patch
706
706
707 % pops a patch and succeeds
707 % pops a patch and succeeds
708
708
709 $ hg qpop
709 $ hg qpop
710 popping test.patch
710 popping test.patch
711 patch queue now empty
711 patch queue now empty
712
712
713 % pushes up to test1b.patch and succeeds
713 % pushes up to test1b.patch and succeeds
714
714
715 $ hg qpush test1b.patch
715 $ hg qpush test1b.patch
716 applying test.patch
716 applying test.patch
717 applying test1b.patch
717 applying test1b.patch
718 now at: test1b.patch
718 now at: test1b.patch
719
719
720 % does nothing and succeeds
720 % does nothing and succeeds
721
721
722 $ hg qpush test1b.patch
722 $ hg qpush test1b.patch
723 qpush: test1b.patch is already at the top
723 qpush: test1b.patch is already at the top
724
724
725 % does nothing and succeeds
725 % does nothing and succeeds
726
726
727 $ hg qpop test1b.patch
727 $ hg qpop test1b.patch
728 qpop: test1b.patch is already at the top
728 qpop: test1b.patch is already at the top
729
729
730 % fails - can't push to this patch
730 % fails - can't push to this patch
731
731
732 $ hg qpush test.patch
732 $ hg qpush test.patch
733 abort: cannot push to a previous patch: test.patch
733 abort: cannot push to a previous patch: test.patch
734 [255]
734 [255]
735
735
736 % fails - can't pop to this patch
736 % fails - can't pop to this patch
737
737
738 $ hg qpop test2.patch
738 $ hg qpop test2.patch
739 abort: patch test2.patch is not applied
739 abort: patch test2.patch is not applied
740 [255]
740 [255]
741
741
742 % pops up to test.patch and succeeds
742 % pops up to test.patch and succeeds
743
743
744 $ hg qpop test.patch
744 $ hg qpop test.patch
745 popping test1b.patch
745 popping test1b.patch
746 now at: test.patch
746 now at: test.patch
747
747
748 % pushes all patches and succeeds
748 % pushes all patches and succeeds
749
749
750 $ hg qpush -a
750 $ hg qpush -a
751 applying test1b.patch
751 applying test1b.patch
752 applying test2.patch
752 applying test2.patch
753 now at: test2.patch
753 now at: test2.patch
754
754
755 % does nothing and succeeds
755 % does nothing and succeeds
756
756
757 $ hg qpush -a
757 $ hg qpush -a
758 all patches are currently applied
758 all patches are currently applied
759
759
760 % fails - nothing else to push
760 % fails - nothing else to push
761
761
762 $ hg qpush
762 $ hg qpush
763 patch series already fully applied
763 patch series already fully applied
764 [1]
764 [1]
765
765
766 % does nothing and succeeds
766 % does nothing and succeeds
767
767
768 $ hg qpush test2.patch
768 $ hg qpush test2.patch
769 qpush: test2.patch is already at the top
769 qpush: test2.patch is already at the top
770
770
771 strip
771 strip
772
772
773 $ cd ../../b
773 $ cd ../../b
774 $ echo x>x
774 $ echo x>x
775 $ hg ci -Ama
775 $ hg ci -Ama
776 adding x
776 adding x
777 $ hg strip tip
777 $ hg strip tip
778 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
778 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
779 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
779 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
780 $ hg unbundle .hg/strip-backup/*
780 $ hg unbundle .hg/strip-backup/*
781 adding changesets
781 adding changesets
782 adding manifests
782 adding manifests
783 adding file changes
783 adding file changes
784 added 1 changesets with 1 changes to 1 files
784 added 1 changesets with 1 changes to 1 files
785 (run 'hg update' to get a working copy)
785 (run 'hg update' to get a working copy)
786
786
787
787
788 strip with local changes, should complain
788 strip with local changes, should complain
789
789
790 $ hg up
790 $ hg up
791 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
791 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
792 $ echo y>y
792 $ echo y>y
793 $ hg add y
793 $ hg add y
794 $ hg strip tip
794 $ hg strip tip
795 abort: local changes found
795 abort: local changes found
796 [255]
796 [255]
797
797
798 --force strip with local changes
798 --force strip with local changes
799
799
800 $ hg strip -f tip
800 $ hg strip -f tip
801 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
801 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
802 saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg (glob)
802 saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg (glob)
803 $ cd ..
803 $ cd ..
804
804
805
805
806 cd b; hg qrefresh
806 cd b; hg qrefresh
807
807
808 $ hg init refresh
808 $ hg init refresh
809 $ cd refresh
809 $ cd refresh
810 $ echo a > a
810 $ echo a > a
811 $ hg ci -Ama
811 $ hg ci -Ama
812 adding a
812 adding a
813 $ hg qnew -mfoo foo
813 $ hg qnew -mfoo foo
814 $ echo a >> a
814 $ echo a >> a
815 $ hg qrefresh
815 $ hg qrefresh
816 $ mkdir b
816 $ mkdir b
817 $ cd b
817 $ cd b
818 $ echo f > f
818 $ echo f > f
819 $ hg add f
819 $ hg add f
820 $ hg qrefresh
820 $ hg qrefresh
821 $ cat ../.hg/patches/foo
821 $ cat ../.hg/patches/foo
822 foo
822 foo
823
823
824 diff -r cb9a9f314b8b a
824 diff -r cb9a9f314b8b a
825 --- a/a\t(?P<date>.*) (re)
825 --- a/a\t(?P<date>.*) (re)
826 \+\+\+ b/a\t(?P<date>.*) (re)
826 \+\+\+ b/a\t(?P<date>.*) (re)
827 @@ -1,1 +1,2 @@
827 @@ -1,1 +1,2 @@
828 a
828 a
829 +a
829 +a
830 diff -r cb9a9f314b8b b/f
830 diff -r cb9a9f314b8b b/f
831 --- /dev/null\t(?P<date>.*) (re)
831 --- /dev/null\t(?P<date>.*) (re)
832 \+\+\+ b/b/f\t(?P<date>.*) (re)
832 \+\+\+ b/b/f\t(?P<date>.*) (re)
833 @@ -0,0 +1,1 @@
833 @@ -0,0 +1,1 @@
834 +f
834 +f
835
835
836 hg qrefresh .
836 hg qrefresh .
837
837
838 $ hg qrefresh .
838 $ hg qrefresh .
839 $ cat ../.hg/patches/foo
839 $ cat ../.hg/patches/foo
840 foo
840 foo
841
841
842 diff -r cb9a9f314b8b b/f
842 diff -r cb9a9f314b8b b/f
843 --- /dev/null\t(?P<date>.*) (re)
843 --- /dev/null\t(?P<date>.*) (re)
844 \+\+\+ b/b/f\t(?P<date>.*) (re)
844 \+\+\+ b/b/f\t(?P<date>.*) (re)
845 @@ -0,0 +1,1 @@
845 @@ -0,0 +1,1 @@
846 +f
846 +f
847 $ hg status
847 $ hg status
848 M a
848 M a
849
849
850
850
851 qpush failure
851 qpush failure
852
852
853 $ cd ..
853 $ cd ..
854 $ hg qrefresh
854 $ hg qrefresh
855 $ hg qnew -mbar bar
855 $ hg qnew -mbar bar
856 $ echo foo > foo
856 $ echo foo > foo
857 $ echo bar > bar
857 $ echo bar > bar
858 $ hg add foo bar
858 $ hg add foo bar
859 $ hg qrefresh
859 $ hg qrefresh
860 $ hg qpop -a
860 $ hg qpop -a
861 popping bar
861 popping bar
862 popping foo
862 popping foo
863 patch queue now empty
863 patch queue now empty
864 $ echo bar > foo
864 $ echo bar > foo
865 $ hg qpush -a
865 $ hg qpush -a
866 applying foo
866 applying foo
867 applying bar
867 applying bar
868 file foo already exists
868 file foo already exists
869 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
869 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
870 patch failed, unable to continue (try -v)
870 patch failed, unable to continue (try -v)
871 patch failed, rejects left in working directory
871 patch failed, rejects left in working directory
872 errors during apply, please fix and qrefresh bar
872 errors during apply, please fix and qrefresh bar
873 [2]
873 [2]
874 $ hg st
874 $ hg st
875 ? foo
875 ? foo
876 ? foo.rej
876 ? foo.rej
877
877
878
878
879 mq tags
879 mq tags
880
880
881 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
881 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
882 0 qparent
882 0 qparent
883 1 foo qbase
883 1 foo qbase
884 2 bar qtip tip
884 2 bar qtip tip
885
885
886 mq revset
886 mq revset
887
887
888 $ hg log -r 'mq()' --template '{rev}\n'
888 $ hg log -r 'mq()' --template '{rev}\n'
889 1
889 1
890 2
890 2
891 $ hg help revsets | grep -i mq
891 $ hg help revsets | grep -i mq
892 "mq()"
892 "mq()"
893 Changesets managed by MQ.
893 Changesets managed by MQ.
894
894
895 bad node in status
895 bad node in status
896
896
897 $ hg qpop
897 $ hg qpop
898 popping bar
898 popping bar
899 now at: foo
899 now at: foo
900 $ hg strip -qn tip
900 $ hg strip -qn tip
901 $ hg tip
901 $ hg tip
902 changeset: 0:cb9a9f314b8b
902 changeset: 0:cb9a9f314b8b
903 tag: tip
903 tag: tip
904 user: test
904 user: test
905 date: Thu Jan 01 00:00:00 1970 +0000
905 date: Thu Jan 01 00:00:00 1970 +0000
906 summary: a
906 summary: a
907
907
908 $ hg branches
908 $ hg branches
909 default 0:cb9a9f314b8b
909 default 0:cb9a9f314b8b
910 $ hg qpop
910 $ hg qpop
911 no patches applied
911 no patches applied
912 [1]
912 [1]
913
913
914 $ cd ..
914 $ cd ..
915
915
916
916
917 git patches
917 git patches
918
918
919 $ cat >>$HGRCPATH <<EOF
919 $ cat >>$HGRCPATH <<EOF
920 > [diff]
920 > [diff]
921 > git = True
921 > git = True
922 > EOF
922 > EOF
923 $ hg init git
923 $ hg init git
924 $ cd git
924 $ cd git
925 $ hg qinit
925 $ hg qinit
926
926
927 $ hg qnew -m'new file' new
927 $ hg qnew -m'new file' new
928 $ echo foo > new
928 $ echo foo > new
929 #if execbit
929 #if execbit
930 $ chmod +x new
930 $ chmod +x new
931 #endif
931 #endif
932 $ hg add new
932 $ hg add new
933 $ hg qrefresh
933 $ hg qrefresh
934 #if execbit
934 #if execbit
935 $ cat .hg/patches/new
935 $ cat .hg/patches/new
936 new file
936 new file
937
937
938 diff --git a/new b/new
938 diff --git a/new b/new
939 new file mode 100755
939 new file mode 100755
940 --- /dev/null
940 --- /dev/null
941 +++ b/new
941 +++ b/new
942 @@ -0,0 +1,1 @@
942 @@ -0,0 +1,1 @@
943 +foo
943 +foo
944 #else
944 #else
945 $ cat .hg/patches/new
945 $ cat .hg/patches/new
946 new file
946 new file
947
947
948 diff --git a/new b/new
948 diff --git a/new b/new
949 new file mode 100644
949 new file mode 100644
950 --- /dev/null
950 --- /dev/null
951 +++ b/new
951 +++ b/new
952 @@ -0,0 +1,1 @@
952 @@ -0,0 +1,1 @@
953 +foo
953 +foo
954 #endif
954 #endif
955
955
956 $ hg qnew -m'copy file' copy
956 $ hg qnew -m'copy file' copy
957 $ hg cp new copy
957 $ hg cp new copy
958 $ hg qrefresh
958 $ hg qrefresh
959 $ cat .hg/patches/copy
959 $ cat .hg/patches/copy
960 copy file
960 copy file
961
961
962 diff --git a/new b/copy
962 diff --git a/new b/copy
963 copy from new
963 copy from new
964 copy to copy
964 copy to copy
965
965
966 $ hg qpop
966 $ hg qpop
967 popping copy
967 popping copy
968 now at: new
968 now at: new
969 $ hg qpush
969 $ hg qpush
970 applying copy
970 applying copy
971 now at: copy
971 now at: copy
972 $ hg qdiff
972 $ hg qdiff
973 diff --git a/new b/copy
973 diff --git a/new b/copy
974 copy from new
974 copy from new
975 copy to copy
975 copy to copy
976 $ cat >>$HGRCPATH <<EOF
976 $ cat >>$HGRCPATH <<EOF
977 > [diff]
977 > [diff]
978 > git = False
978 > git = False
979 > EOF
979 > EOF
980 $ hg qdiff --git
980 $ hg qdiff --git
981 diff --git a/new b/copy
981 diff --git a/new b/copy
982 copy from new
982 copy from new
983 copy to copy
983 copy to copy
984 $ cd ..
984 $ cd ..
985
985
986 empty lines in status
986 empty lines in status
987
987
988 $ hg init emptystatus
988 $ hg init emptystatus
989 $ cd emptystatus
989 $ cd emptystatus
990 $ hg qinit
990 $ hg qinit
991 $ printf '\n\n' > .hg/patches/status
991 $ printf '\n\n' > .hg/patches/status
992 $ hg qser
992 $ hg qser
993 $ cd ..
993 $ cd ..
994
994
995 bad line in status (without ":")
995 bad line in status (without ":")
996
996
997 $ hg init badstatus
997 $ hg init badstatus
998 $ cd badstatus
998 $ cd badstatus
999 $ hg qinit
999 $ hg qinit
1000 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1000 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1001 $ hg qser
1001 $ hg qser
1002 malformated mq status line: ['babar has no colon in this line']
1002 malformated mq status line: ['babar has no colon in this line']
1003 $ cd ..
1003 $ cd ..
1004
1004
1005
1005
1006 test file addition in slow path
1006 test file addition in slow path
1007
1007
1008 $ hg init slow
1008 $ hg init slow
1009 $ cd slow
1009 $ cd slow
1010 $ hg qinit
1010 $ hg qinit
1011 $ echo foo > foo
1011 $ echo foo > foo
1012 $ hg add foo
1012 $ hg add foo
1013 $ hg ci -m 'add foo'
1013 $ hg ci -m 'add foo'
1014 $ hg qnew bar
1014 $ hg qnew bar
1015 $ echo bar > bar
1015 $ echo bar > bar
1016 $ hg add bar
1016 $ hg add bar
1017 $ hg mv foo baz
1017 $ hg mv foo baz
1018 $ hg qrefresh --git
1018 $ hg qrefresh --git
1019 $ hg up -C 0
1019 $ hg up -C 0
1020 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1020 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1021 $ echo >> foo
1021 $ echo >> foo
1022 $ hg ci -m 'change foo'
1022 $ hg ci -m 'change foo'
1023 created new head
1023 created new head
1024 $ hg up -C 1
1024 $ hg up -C 1
1025 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1025 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1026 $ hg qrefresh --git
1026 $ hg qrefresh --git
1027 $ cat .hg/patches/bar
1027 $ cat .hg/patches/bar
1028 diff --git a/bar b/bar
1028 diff --git a/bar b/bar
1029 new file mode 100644
1029 new file mode 100644
1030 --- /dev/null
1030 --- /dev/null
1031 +++ b/bar
1031 +++ b/bar
1032 @@ -0,0 +1,1 @@
1032 @@ -0,0 +1,1 @@
1033 +bar
1033 +bar
1034 diff --git a/foo b/baz
1034 diff --git a/foo b/baz
1035 rename from foo
1035 rename from foo
1036 rename to baz
1036 rename to baz
1037 $ hg log -v --template '{rev} {file_copies}\n' -r .
1037 $ hg log -v --template '{rev} {file_copies}\n' -r .
1038 2 baz (foo)
1038 2 baz (foo)
1039 $ hg qrefresh --git
1039 $ hg qrefresh --git
1040 $ cat .hg/patches/bar
1040 $ cat .hg/patches/bar
1041 diff --git a/bar b/bar
1041 diff --git a/bar b/bar
1042 new file mode 100644
1042 new file mode 100644
1043 --- /dev/null
1043 --- /dev/null
1044 +++ b/bar
1044 +++ b/bar
1045 @@ -0,0 +1,1 @@
1045 @@ -0,0 +1,1 @@
1046 +bar
1046 +bar
1047 diff --git a/foo b/baz
1047 diff --git a/foo b/baz
1048 rename from foo
1048 rename from foo
1049 rename to baz
1049 rename to baz
1050 $ hg log -v --template '{rev} {file_copies}\n' -r .
1050 $ hg log -v --template '{rev} {file_copies}\n' -r .
1051 2 baz (foo)
1051 2 baz (foo)
1052 $ hg qrefresh
1052 $ hg qrefresh
1053 $ grep 'diff --git' .hg/patches/bar
1053 $ grep 'diff --git' .hg/patches/bar
1054 diff --git a/bar b/bar
1054 diff --git a/bar b/bar
1055 diff --git a/foo b/baz
1055 diff --git a/foo b/baz
1056
1056
1057
1057
1058 test file move chains in the slow path
1058 test file move chains in the slow path
1059
1059
1060 $ hg up -C 1
1060 $ hg up -C 1
1061 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1061 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1062 $ echo >> foo
1062 $ echo >> foo
1063 $ hg ci -m 'change foo again'
1063 $ hg ci -m 'change foo again'
1064 $ hg up -C 2
1064 $ hg up -C 2
1065 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1065 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1066 $ hg mv bar quux
1066 $ hg mv bar quux
1067 $ hg mv baz bleh
1067 $ hg mv baz bleh
1068 $ hg qrefresh --git
1068 $ hg qrefresh --git
1069 $ cat .hg/patches/bar
1069 $ cat .hg/patches/bar
1070 diff --git a/foo b/bleh
1070 diff --git a/foo b/bleh
1071 rename from foo
1071 rename from foo
1072 rename to bleh
1072 rename to bleh
1073 diff --git a/quux b/quux
1073 diff --git a/quux b/quux
1074 new file mode 100644
1074 new file mode 100644
1075 --- /dev/null
1075 --- /dev/null
1076 +++ b/quux
1076 +++ b/quux
1077 @@ -0,0 +1,1 @@
1077 @@ -0,0 +1,1 @@
1078 +bar
1078 +bar
1079 $ hg log -v --template '{rev} {file_copies}\n' -r .
1079 $ hg log -v --template '{rev} {file_copies}\n' -r .
1080 3 bleh (foo)
1080 3 bleh (foo)
1081 $ hg mv quux fred
1081 $ hg mv quux fred
1082 $ hg mv bleh barney
1082 $ hg mv bleh barney
1083 $ hg qrefresh --git
1083 $ hg qrefresh --git
1084 $ cat .hg/patches/bar
1084 $ cat .hg/patches/bar
1085 diff --git a/foo b/barney
1085 diff --git a/foo b/barney
1086 rename from foo
1086 rename from foo
1087 rename to barney
1087 rename to barney
1088 diff --git a/fred b/fred
1088 diff --git a/fred b/fred
1089 new file mode 100644
1089 new file mode 100644
1090 --- /dev/null
1090 --- /dev/null
1091 +++ b/fred
1091 +++ b/fred
1092 @@ -0,0 +1,1 @@
1092 @@ -0,0 +1,1 @@
1093 +bar
1093 +bar
1094 $ hg log -v --template '{rev} {file_copies}\n' -r .
1094 $ hg log -v --template '{rev} {file_copies}\n' -r .
1095 3 barney (foo)
1095 3 barney (foo)
1096
1096
1097
1097
1098 refresh omitting an added file
1098 refresh omitting an added file
1099
1099
1100 $ hg qnew baz
1100 $ hg qnew baz
1101 $ echo newfile > newfile
1101 $ echo newfile > newfile
1102 $ hg add newfile
1102 $ hg add newfile
1103 $ hg qrefresh
1103 $ hg qrefresh
1104 $ hg st -A newfile
1104 $ hg st -A newfile
1105 C newfile
1105 C newfile
1106 $ hg qrefresh -X newfile
1106 $ hg qrefresh -X newfile
1107 $ hg st -A newfile
1107 $ hg st -A newfile
1108 A newfile
1108 A newfile
1109 $ hg revert newfile
1109 $ hg revert newfile
1110 $ rm newfile
1110 $ rm newfile
1111 $ hg qpop
1111 $ hg qpop
1112 popping baz
1112 popping baz
1113 now at: bar
1113 now at: bar
1114
1114
1115 test qdel/qrm
1115 test qdel/qrm
1116
1116
1117 $ hg qdel baz
1117 $ hg qdel baz
1118 $ echo p >> .hg/patches/series
1118 $ echo p >> .hg/patches/series
1119 $ hg qrm p
1119 $ hg qrm p
1120 $ hg qser
1120 $ hg qser
1121 bar
1121 bar
1122
1122
1123 create a git patch
1123 create a git patch
1124
1124
1125 $ echo a > alexander
1125 $ echo a > alexander
1126 $ hg add alexander
1126 $ hg add alexander
1127 $ hg qnew -f --git addalexander
1127 $ hg qnew -f --git addalexander
1128 $ grep diff .hg/patches/addalexander
1128 $ grep diff .hg/patches/addalexander
1129 diff --git a/alexander b/alexander
1129 diff --git a/alexander b/alexander
1130
1130
1131
1131
1132 create a git binary patch
1132 create a git binary patch
1133
1133
1134 $ cat > writebin.py <<EOF
1134 $ cat > writebin.py <<EOF
1135 > import sys
1135 > import sys
1136 > path = sys.argv[1]
1136 > path = sys.argv[1]
1137 > open(path, 'wb').write('BIN\x00ARY')
1137 > open(path, 'wb').write('BIN\x00ARY')
1138 > EOF
1138 > EOF
1139 $ python writebin.py bucephalus
1139 $ python writebin.py bucephalus
1140
1140
1141 $ python "$TESTDIR/md5sum.py" bucephalus
1141 $ python "$TESTDIR/md5sum.py" bucephalus
1142 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1142 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1143 $ hg add bucephalus
1143 $ hg add bucephalus
1144 $ hg qnew -f --git addbucephalus
1144 $ hg qnew -f --git addbucephalus
1145 $ grep diff .hg/patches/addbucephalus
1145 $ grep diff .hg/patches/addbucephalus
1146 diff --git a/bucephalus b/bucephalus
1146 diff --git a/bucephalus b/bucephalus
1147
1147
1148
1148
1149 check binary patches can be popped and pushed
1149 check binary patches can be popped and pushed
1150
1150
1151 $ hg qpop
1151 $ hg qpop
1152 popping addbucephalus
1152 popping addbucephalus
1153 now at: addalexander
1153 now at: addalexander
1154 $ test -f bucephalus && echo % bucephalus should not be there
1154 $ test -f bucephalus && echo % bucephalus should not be there
1155 [1]
1155 [1]
1156 $ hg qpush
1156 $ hg qpush
1157 applying addbucephalus
1157 applying addbucephalus
1158 now at: addbucephalus
1158 now at: addbucephalus
1159 $ test -f bucephalus
1159 $ test -f bucephalus
1160 $ python "$TESTDIR/md5sum.py" bucephalus
1160 $ python "$TESTDIR/md5sum.py" bucephalus
1161 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1161 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1162
1162
1163
1163
1164
1164
1165 strip again
1165 strip again
1166
1166
1167 $ cd ..
1167 $ cd ..
1168 $ hg init strip
1168 $ hg init strip
1169 $ cd strip
1169 $ cd strip
1170 $ touch foo
1170 $ touch foo
1171 $ hg add foo
1171 $ hg add foo
1172 $ hg ci -m 'add foo'
1172 $ hg ci -m 'add foo'
1173 $ echo >> foo
1173 $ echo >> foo
1174 $ hg ci -m 'change foo 1'
1174 $ hg ci -m 'change foo 1'
1175 $ hg up -C 0
1175 $ hg up -C 0
1176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1177 $ echo 1 >> foo
1177 $ echo 1 >> foo
1178 $ hg ci -m 'change foo 2'
1178 $ hg ci -m 'change foo 2'
1179 created new head
1179 created new head
1180 $ HGMERGE=true hg merge
1180 $ HGMERGE=true hg merge
1181 merging foo
1181 merging foo
1182 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1182 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1183 (branch merge, don't forget to commit)
1183 (branch merge, don't forget to commit)
1184 $ hg ci -m merge
1184 $ hg ci -m merge
1185 $ hg log
1185 $ hg log
1186 changeset: 3:99615015637b
1186 changeset: 3:99615015637b
1187 tag: tip
1187 tag: tip
1188 parent: 2:20cbbe65cff7
1188 parent: 2:20cbbe65cff7
1189 parent: 1:d2871fc282d4
1189 parent: 1:d2871fc282d4
1190 user: test
1190 user: test
1191 date: Thu Jan 01 00:00:00 1970 +0000
1191 date: Thu Jan 01 00:00:00 1970 +0000
1192 summary: merge
1192 summary: merge
1193
1193
1194 changeset: 2:20cbbe65cff7
1194 changeset: 2:20cbbe65cff7
1195 parent: 0:53245c60e682
1195 parent: 0:53245c60e682
1196 user: test
1196 user: test
1197 date: Thu Jan 01 00:00:00 1970 +0000
1197 date: Thu Jan 01 00:00:00 1970 +0000
1198 summary: change foo 2
1198 summary: change foo 2
1199
1199
1200 changeset: 1:d2871fc282d4
1200 changeset: 1:d2871fc282d4
1201 user: test
1201 user: test
1202 date: Thu Jan 01 00:00:00 1970 +0000
1202 date: Thu Jan 01 00:00:00 1970 +0000
1203 summary: change foo 1
1203 summary: change foo 1
1204
1204
1205 changeset: 0:53245c60e682
1205 changeset: 0:53245c60e682
1206 user: test
1206 user: test
1207 date: Thu Jan 01 00:00:00 1970 +0000
1207 date: Thu Jan 01 00:00:00 1970 +0000
1208 summary: add foo
1208 summary: add foo
1209
1209
1210 $ hg strip 1
1210 $ hg strip 1
1211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1212 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1212 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1213 $ checkundo strip
1213 $ checkundo strip
1214 $ hg log
1214 $ hg log
1215 changeset: 1:20cbbe65cff7
1215 changeset: 1:20cbbe65cff7
1216 tag: tip
1216 tag: tip
1217 user: test
1217 user: test
1218 date: Thu Jan 01 00:00:00 1970 +0000
1218 date: Thu Jan 01 00:00:00 1970 +0000
1219 summary: change foo 2
1219 summary: change foo 2
1220
1220
1221 changeset: 0:53245c60e682
1221 changeset: 0:53245c60e682
1222 user: test
1222 user: test
1223 date: Thu Jan 01 00:00:00 1970 +0000
1223 date: Thu Jan 01 00:00:00 1970 +0000
1224 summary: add foo
1224 summary: add foo
1225
1225
1226 $ cd ..
1226 $ cd ..
1227
1227
1228
1228
1229 qclone
1229 qclone
1230
1230
1231 $ qlog()
1231 $ qlog()
1232 > {
1232 > {
1233 > echo 'main repo:'
1233 > echo 'main repo:'
1234 > hg log --template ' rev {rev}: {desc}\n'
1234 > hg log --template ' rev {rev}: {desc}\n'
1235 > echo 'patch repo:'
1235 > echo 'patch repo:'
1236 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1236 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1237 > }
1237 > }
1238 $ hg init qclonesource
1238 $ hg init qclonesource
1239 $ cd qclonesource
1239 $ cd qclonesource
1240 $ echo foo > foo
1240 $ echo foo > foo
1241 $ hg add foo
1241 $ hg add foo
1242 $ hg ci -m 'add foo'
1242 $ hg ci -m 'add foo'
1243 $ hg qinit
1243 $ hg qinit
1244 $ hg qnew patch1
1244 $ hg qnew patch1
1245 $ echo bar >> foo
1245 $ echo bar >> foo
1246 $ hg qrefresh -m 'change foo'
1246 $ hg qrefresh -m 'change foo'
1247 $ cd ..
1247 $ cd ..
1248
1248
1249
1249
1250 repo with unversioned patch dir
1250 repo with unversioned patch dir
1251
1251
1252 $ hg qclone qclonesource failure
1252 $ hg qclone qclonesource failure
1253 abort: versioned patch repository not found (see init --mq)
1253 abort: versioned patch repository not found (see init --mq)
1254 [255]
1254 [255]
1255
1255
1256 $ cd qclonesource
1256 $ cd qclonesource
1257 $ hg qinit -c
1257 $ hg qinit -c
1258 adding .hg/patches/patch1 (glob)
1258 adding .hg/patches/patch1 (glob)
1259 $ hg qci -m checkpoint
1259 $ hg qci -m checkpoint
1260 $ qlog
1260 $ qlog
1261 main repo:
1261 main repo:
1262 rev 1: change foo
1262 rev 1: change foo
1263 rev 0: add foo
1263 rev 0: add foo
1264 patch repo:
1264 patch repo:
1265 rev 0: checkpoint
1265 rev 0: checkpoint
1266 $ cd ..
1266 $ cd ..
1267
1267
1268
1268
1269 repo with patches applied
1269 repo with patches applied
1270
1270
1271 $ hg qclone qclonesource qclonedest
1271 $ hg qclone qclonesource qclonedest
1272 updating to branch default
1272 updating to branch default
1273 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1273 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1275 $ cd qclonedest
1275 $ cd qclonedest
1276 $ qlog
1276 $ qlog
1277 main repo:
1277 main repo:
1278 rev 0: add foo
1278 rev 0: add foo
1279 patch repo:
1279 patch repo:
1280 rev 0: checkpoint
1280 rev 0: checkpoint
1281 $ cd ..
1281 $ cd ..
1282
1282
1283
1283
1284 repo with patches unapplied
1284 repo with patches unapplied
1285
1285
1286 $ cd qclonesource
1286 $ cd qclonesource
1287 $ hg qpop -a
1287 $ hg qpop -a
1288 popping patch1
1288 popping patch1
1289 patch queue now empty
1289 patch queue now empty
1290 $ qlog
1290 $ qlog
1291 main repo:
1291 main repo:
1292 rev 0: add foo
1292 rev 0: add foo
1293 patch repo:
1293 patch repo:
1294 rev 0: checkpoint
1294 rev 0: checkpoint
1295 $ cd ..
1295 $ cd ..
1296 $ hg qclone qclonesource qclonedest2
1296 $ hg qclone qclonesource qclonedest2
1297 updating to branch default
1297 updating to branch default
1298 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1298 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1300 $ cd qclonedest2
1300 $ cd qclonedest2
1301 $ qlog
1301 $ qlog
1302 main repo:
1302 main repo:
1303 rev 0: add foo
1303 rev 0: add foo
1304 patch repo:
1304 patch repo:
1305 rev 0: checkpoint
1305 rev 0: checkpoint
1306 $ cd ..
1306 $ cd ..
1307
1307
1308
1308
1309 Issue1033: test applying on an empty file
1309 Issue1033: test applying on an empty file
1310
1310
1311 $ hg init empty
1311 $ hg init empty
1312 $ cd empty
1312 $ cd empty
1313 $ touch a
1313 $ touch a
1314 $ hg ci -Am addempty
1314 $ hg ci -Am addempty
1315 adding a
1315 adding a
1316 $ echo a > a
1316 $ echo a > a
1317 $ hg qnew -f -e changea
1317 $ hg qnew -f -e changea
1318 $ hg qpop
1318 $ hg qpop
1319 popping changea
1319 popping changea
1320 patch queue now empty
1320 patch queue now empty
1321 $ hg qpush
1321 $ hg qpush
1322 applying changea
1322 applying changea
1323 now at: changea
1323 now at: changea
1324 $ cd ..
1324 $ cd ..
1325
1325
1326 test qpush with --force, issue1087
1326 test qpush with --force, issue1087
1327
1327
1328 $ hg init forcepush
1328 $ hg init forcepush
1329 $ cd forcepush
1329 $ cd forcepush
1330 $ echo hello > hello.txt
1330 $ echo hello > hello.txt
1331 $ echo bye > bye.txt
1331 $ echo bye > bye.txt
1332 $ hg ci -Ama
1332 $ hg ci -Ama
1333 adding bye.txt
1333 adding bye.txt
1334 adding hello.txt
1334 adding hello.txt
1335 $ hg qnew -d '0 0' empty
1335 $ hg qnew -d '0 0' empty
1336 $ hg qpop
1336 $ hg qpop
1337 popping empty
1337 popping empty
1338 patch queue now empty
1338 patch queue now empty
1339 $ echo world >> hello.txt
1339 $ echo world >> hello.txt
1340
1340
1341
1341
1342 qpush should fail, local changes
1342 qpush should fail, local changes
1343
1343
1344 $ hg qpush
1344 $ hg qpush
1345 abort: local changes found
1345 abort: local changes found
1346 [255]
1346 [255]
1347
1347
1348
1348
1349 apply force, should not discard changes with empty patch
1349 apply force, should not discard changes with empty patch
1350
1350
1351 $ hg qpush -f
1351 $ hg qpush -f
1352 applying empty
1352 applying empty
1353 patch empty is empty
1353 patch empty is empty
1354 now at: empty
1354 now at: empty
1355 $ hg diff --config diff.nodates=True
1355 $ hg diff --config diff.nodates=True
1356 diff -r d58265112590 hello.txt
1356 diff -r d58265112590 hello.txt
1357 --- a/hello.txt
1357 --- a/hello.txt
1358 +++ b/hello.txt
1358 +++ b/hello.txt
1359 @@ -1,1 +1,2 @@
1359 @@ -1,1 +1,2 @@
1360 hello
1360 hello
1361 +world
1361 +world
1362 $ hg qdiff --config diff.nodates=True
1362 $ hg qdiff --config diff.nodates=True
1363 diff -r 9ecee4f634e3 hello.txt
1363 diff -r 9ecee4f634e3 hello.txt
1364 --- a/hello.txt
1364 --- a/hello.txt
1365 +++ b/hello.txt
1365 +++ b/hello.txt
1366 @@ -1,1 +1,2 @@
1366 @@ -1,1 +1,2 @@
1367 hello
1367 hello
1368 +world
1368 +world
1369 $ hg log -l1 -p
1369 $ hg log -l1 -p
1370 changeset: 1:d58265112590
1370 changeset: 1:d58265112590
1371 tag: empty
1371 tag: empty
1372 tag: qbase
1372 tag: qbase
1373 tag: qtip
1373 tag: qtip
1374 tag: tip
1374 tag: tip
1375 user: test
1375 user: test
1376 date: Thu Jan 01 00:00:00 1970 +0000
1376 date: Thu Jan 01 00:00:00 1970 +0000
1377 summary: imported patch empty
1377 summary: imported patch empty
1378
1378
1379
1379
1380 $ hg qref -d '0 0'
1380 $ hg qref -d '0 0'
1381 $ hg qpop
1381 $ hg qpop
1382 popping empty
1382 popping empty
1383 patch queue now empty
1383 patch queue now empty
1384 $ echo universe >> hello.txt
1384 $ echo universe >> hello.txt
1385 $ echo universe >> bye.txt
1385 $ echo universe >> bye.txt
1386
1386
1387
1387
1388 qpush should fail, local changes
1388 qpush should fail, local changes
1389
1389
1390 $ hg qpush
1390 $ hg qpush
1391 abort: local changes found
1391 abort: local changes found
1392 [255]
1392 [255]
1393
1393
1394
1394
1395 apply force, should discard changes in hello, but not bye
1395 apply force, should discard changes in hello, but not bye
1396
1396
1397 $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
1397 $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
1398 applying empty
1398 applying empty
1399 creating directory: $TESTTMP/forcepush/.hg/origbackups (glob)
1399 creating directory: $TESTTMP/forcepush/.hg/origbackups (glob)
1400 saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt.orig (glob)
1400 saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt.orig (glob)
1401 patching file hello.txt
1401 patching file hello.txt
1402 committing files:
1402 committing files:
1403 hello.txt
1403 hello.txt
1404 committing manifest
1404 committing manifest
1405 committing changelog
1405 committing changelog
1406 now at: empty
1406 now at: empty
1407 $ hg st
1407 $ hg st
1408 M bye.txt
1408 M bye.txt
1409 $ hg diff --config diff.nodates=True
1409 $ hg diff --config diff.nodates=True
1410 diff -r ba252371dbc1 bye.txt
1410 diff -r ba252371dbc1 bye.txt
1411 --- a/bye.txt
1411 --- a/bye.txt
1412 +++ b/bye.txt
1412 +++ b/bye.txt
1413 @@ -1,1 +1,2 @@
1413 @@ -1,1 +1,2 @@
1414 bye
1414 bye
1415 +universe
1415 +universe
1416 $ hg qdiff --config diff.nodates=True
1416 $ hg qdiff --config diff.nodates=True
1417 diff -r 9ecee4f634e3 bye.txt
1417 diff -r 9ecee4f634e3 bye.txt
1418 --- a/bye.txt
1418 --- a/bye.txt
1419 +++ b/bye.txt
1419 +++ b/bye.txt
1420 @@ -1,1 +1,2 @@
1420 @@ -1,1 +1,2 @@
1421 bye
1421 bye
1422 +universe
1422 +universe
1423 diff -r 9ecee4f634e3 hello.txt
1423 diff -r 9ecee4f634e3 hello.txt
1424 --- a/hello.txt
1424 --- a/hello.txt
1425 +++ b/hello.txt
1425 +++ b/hello.txt
1426 @@ -1,1 +1,3 @@
1426 @@ -1,1 +1,3 @@
1427 hello
1427 hello
1428 +world
1428 +world
1429 +universe
1429 +universe
1430
1430
1431 test that the previous call to qpush with -f (--force) and --config actually put
1431 test that the previous call to qpush with -f (--force) and --config actually put
1432 the orig files out of the working copy
1432 the orig files out of the working copy
1433 $ ls .hg/origbackups
1433 $ ls .hg/origbackups
1434 hello.txt.orig
1434 hello.txt.orig
1435
1435
1436 test popping revisions not in working dir ancestry
1436 test popping revisions not in working dir ancestry
1437
1437
1438 $ hg qseries -v
1438 $ hg qseries -v
1439 0 A empty
1439 0 A empty
1440 $ hg up qparent
1440 $ hg up qparent
1441 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1441 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1442 $ hg qpop
1442 $ hg qpop
1443 popping empty
1443 popping empty
1444 patch queue now empty
1444 patch queue now empty
1445
1445
1446 $ cd ..
1446 $ cd ..
1447 $ hg init deletion-order
1447 $ hg init deletion-order
1448 $ cd deletion-order
1448 $ cd deletion-order
1449
1449
1450 $ touch a
1450 $ touch a
1451 $ hg ci -Aqm0
1451 $ hg ci -Aqm0
1452
1452
1453 $ hg qnew rename-dir
1453 $ hg qnew rename-dir
1454 $ hg rm a
1454 $ hg rm a
1455 $ hg qrefresh
1455 $ hg qrefresh
1456
1456
1457 $ mkdir a b
1457 $ mkdir a b
1458 $ touch a/a b/b
1458 $ touch a/a b/b
1459 $ hg add -q a b
1459 $ hg add -q a b
1460 $ hg qrefresh
1460 $ hg qrefresh
1461
1461
1462
1462
1463 test popping must remove files added in subdirectories first
1463 test popping must remove files added in subdirectories first
1464
1464
1465 $ hg qpop
1465 $ hg qpop
1466 popping rename-dir
1466 popping rename-dir
1467 patch queue now empty
1467 patch queue now empty
1468 $ cd ..
1468 $ cd ..
1469
1469
1470
1470
1471 test case preservation through patch pushing especially on case
1471 test case preservation through patch pushing especially on case
1472 insensitive filesystem
1472 insensitive filesystem
1473
1473
1474 $ hg init casepreserve
1474 $ hg init casepreserve
1475 $ cd casepreserve
1475 $ cd casepreserve
1476
1476
1477 $ hg qnew add-file1
1477 $ hg qnew add-file1
1478 $ echo a > TeXtFiLe.TxT
1478 $ echo a > TeXtFiLe.TxT
1479 $ hg add TeXtFiLe.TxT
1479 $ hg add TeXtFiLe.TxT
1480 $ hg qrefresh
1480 $ hg qrefresh
1481
1481
1482 $ hg qnew add-file2
1482 $ hg qnew add-file2
1483 $ echo b > AnOtHeRFiLe.TxT
1483 $ echo b > AnOtHeRFiLe.TxT
1484 $ hg add AnOtHeRFiLe.TxT
1484 $ hg add AnOtHeRFiLe.TxT
1485 $ hg qrefresh
1485 $ hg qrefresh
1486
1486
1487 $ hg qnew modify-file
1487 $ hg qnew modify-file
1488 $ echo c >> AnOtHeRFiLe.TxT
1488 $ echo c >> AnOtHeRFiLe.TxT
1489 $ hg qrefresh
1489 $ hg qrefresh
1490
1490
1491 $ hg qapplied
1491 $ hg qapplied
1492 add-file1
1492 add-file1
1493 add-file2
1493 add-file2
1494 modify-file
1494 modify-file
1495 $ hg qpop -a
1495 $ hg qpop -a
1496 popping modify-file
1496 popping modify-file
1497 popping add-file2
1497 popping add-file2
1498 popping add-file1
1498 popping add-file1
1499 patch queue now empty
1499 patch queue now empty
1500
1500
1501 this qpush causes problems below, if case preservation on case
1501 this qpush causes problems below, if case preservation on case
1502 insensitive filesystem is not enough:
1502 insensitive filesystem is not enough:
1503 (1) unexpected "adding ..." messages are shown
1503 (1) unexpected "adding ..." messages are shown
1504 (2) patching fails in modification of (1) files
1504 (2) patching fails in modification of (1) files
1505
1505
1506 $ hg qpush -a
1506 $ hg qpush -a
1507 applying add-file1
1507 applying add-file1
1508 applying add-file2
1508 applying add-file2
1509 applying modify-file
1509 applying modify-file
1510 now at: modify-file
1510 now at: modify-file
1511
1511
1512 Proper phase default with mq:
1512 Proper phase default with mq:
1513
1513
1514 1. mq.secret=false
1514 1. mq.secret=false
1515
1515
1516 $ rm .hg/store/phaseroots
1516 $ rm .hg/store/phaseroots
1517 $ hg phase 'qparent::'
1517 $ hg phase 'qparent::'
1518 -1: public
1518 -1: public
1519 0: draft
1519 0: draft
1520 1: draft
1520 1: draft
1521 2: draft
1521 2: draft
1522 $ echo '[mq]' >> $HGRCPATH
1522 $ echo '[mq]' >> $HGRCPATH
1523 $ echo 'secret=true' >> $HGRCPATH
1523 $ echo 'secret=true' >> $HGRCPATH
1524 $ rm -f .hg/store/phaseroots
1524 $ rm -f .hg/store/phaseroots
1525 $ hg phase 'qparent::'
1525 $ hg phase 'qparent::'
1526 -1: public
1526 -1: public
1527 0: secret
1527 0: secret
1528 1: secret
1528 1: secret
1529 2: secret
1529 2: secret
1530
1530
1531 Test that qfinish change phase when mq.secret=true
1531 Test that qfinish change phase when mq.secret=true
1532
1532
1533 $ hg qfinish qbase
1533 $ hg qfinish qbase
1534 patch add-file1 finalized without changeset message
1534 patch add-file1 finalized without changeset message
1535 $ hg phase 'all()'
1535 $ hg phase 'all()'
1536 0: draft
1536 0: draft
1537 1: secret
1537 1: secret
1538 2: secret
1538 2: secret
1539
1539
1540 Test that qfinish respect phases.new-commit setting
1540 Test that qfinish respect phases.new-commit setting
1541
1541
1542 $ echo '[phases]' >> $HGRCPATH
1542 $ echo '[phases]' >> $HGRCPATH
1543 $ echo 'new-commit=secret' >> $HGRCPATH
1543 $ echo 'new-commit=secret' >> $HGRCPATH
1544 $ hg qfinish qbase
1544 $ hg qfinish qbase
1545 patch add-file2 finalized without changeset message
1545 patch add-file2 finalized without changeset message
1546 $ hg phase 'all()'
1546 $ hg phase 'all()'
1547 0: draft
1547 0: draft
1548 1: secret
1548 1: secret
1549 2: secret
1549 2: secret
1550
1550
1551 (restore env for next test)
1551 (restore env for next test)
1552
1552
1553 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1553 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1554 $ cp $TESTTMP/sedtmp $HGRCPATH
1554 $ cp $TESTTMP/sedtmp $HGRCPATH
1555 $ hg qimport -r 1 --name add-file2
1555 $ hg qimport -r 1 --name add-file2
1556
1556
1557 Test that qfinish preserve phase when mq.secret=false
1557 Test that qfinish preserve phase when mq.secret=false
1558
1558
1559 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1559 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1560 $ cp $TESTTMP/sedtmp $HGRCPATH
1560 $ cp $TESTTMP/sedtmp $HGRCPATH
1561 $ hg qfinish qbase
1561 $ hg qfinish qbase
1562 patch add-file2 finalized without changeset message
1562 patch add-file2 finalized without changeset message
1563 $ hg phase 'all()'
1563 $ hg phase 'all()'
1564 0: draft
1564 0: draft
1565 1: secret
1565 1: secret
1566 2: secret
1566 2: secret
1567
1567
1568 Test that secret mq patch does not break hgweb
1568 Test that secret mq patch does not break hgweb
1569
1569
1570 $ cat > hgweb.cgi <<HGWEB
1570 $ cat > hgweb.cgi <<HGWEB
1571 > from mercurial import demandimport; demandimport.enable()
1571 > from mercurial import demandimport; demandimport.enable()
1572 > from mercurial.hgweb import hgweb
1572 > from mercurial.hgweb import hgweb
1573 > from mercurial.hgweb import wsgicgi
1573 > from mercurial.hgweb import wsgicgi
1574 > import cgitb
1574 > import cgitb
1575 > cgitb.enable()
1575 > cgitb.enable()
1576 > app = hgweb('.', 'test')
1576 > app = hgweb('.', 'test')
1577 > wsgicgi.launch(app)
1577 > wsgicgi.launch(app)
1578 > HGWEB
1578 > HGWEB
1579 $ . "$TESTDIR/cgienv"
1579 $ . "$TESTDIR/cgienv"
1580 #if msys
1580 #if msys
1581 $ PATH_INFO=//tags; export PATH_INFO
1581 $ PATH_INFO=//tags; export PATH_INFO
1582 #else
1582 #else
1583 $ PATH_INFO=/tags; export PATH_INFO
1583 $ PATH_INFO=/tags; export PATH_INFO
1584 #endif
1584 #endif
1585 $ QUERY_STRING='style=raw'
1585 $ QUERY_STRING='style=raw'
1586 $ python hgweb.cgi | grep '^tip'
1586 $ python hgweb.cgi | grep '^tip'
1587 tip [0-9a-f]{40} (re)
1587 tip [0-9a-f]{40} (re)
1588
1588
1589 $ cd ..
1589 $ cd ..
1590
1590
1591 Test interaction with revset (issue4426)
1591 Test interaction with revset (issue4426)
1592
1592
1593 $ hg init issue4426
1593 $ hg init issue4426
1594 $ cd issue4426
1594 $ cd issue4426
1595
1595
1596 $ echo a > a
1596 $ echo a > a
1597 $ hg ci -Am a
1597 $ hg ci -Am a
1598 adding a
1598 adding a
1599 $ echo a >> a
1599 $ echo a >> a
1600 $ hg ci -m a
1600 $ hg ci -m a
1601 $ echo a >> a
1601 $ echo a >> a
1602 $ hg ci -m a
1602 $ hg ci -m a
1603 $ hg qimport -r 0::
1603 $ hg qimport -r 0::
1604
1604
1605 reimport things
1605 reimport things
1606
1606
1607 $ hg qimport -r 1::
1607 $ hg qimport -r 1::
1608 abort: revision 2 is already managed
1608 abort: revision 2 is already managed
1609 [255]
1609 [255]
1610
1610
1611
1611
1612 $ cd ..
1612 $ cd ..
@@ -1,555 +1,555 b''
1
1
2 $ cat <<EOF >> $HGRCPATH
2 $ cat <<EOF >> $HGRCPATH
3 > [extensions]
3 > [extensions]
4 > notify=
4 > notify=
5 >
5 >
6 > [hooks]
6 > [hooks]
7 > incoming.notify = python:hgext.notify.hook
7 > incoming.notify = python:hgext.notify.hook
8 >
8 >
9 > [notify]
9 > [notify]
10 > sources = pull
10 > sources = pull
11 > diffstat = False
11 > diffstat = False
12 >
12 >
13 > [usersubs]
13 > [usersubs]
14 > foo@bar = *
14 > foo@bar = *
15 >
15 >
16 > [reposubs]
16 > [reposubs]
17 > * = baz
17 > * = baz
18 > EOF
18 > EOF
19 $ hg help notify
19 $ hg help notify
20 notify extension - hooks for sending email push notifications
20 notify extension - hooks for sending email push notifications
21
21
22 This extension implements hooks to send email notifications when changesets
22 This extension implements hooks to send email notifications when changesets
23 are sent from or received by the local repository.
23 are sent from or received by the local repository.
24
24
25 First, enable the extension as explained in "hg help extensions", and register
25 First, enable the extension as explained in 'hg help extensions', and register
26 the hook you want to run. "incoming" and "changegroup" hooks are run when
26 the hook you want to run. "incoming" and "changegroup" hooks are run when
27 changesets are received, while "outgoing" hooks are for changesets sent to
27 changesets are received, while "outgoing" hooks are for changesets sent to
28 another repository:
28 another repository:
29
29
30 [hooks]
30 [hooks]
31 # one email for each incoming changeset
31 # one email for each incoming changeset
32 incoming.notify = python:hgext.notify.hook
32 incoming.notify = python:hgext.notify.hook
33 # one email for all incoming changesets
33 # one email for all incoming changesets
34 changegroup.notify = python:hgext.notify.hook
34 changegroup.notify = python:hgext.notify.hook
35
35
36 # one email for all outgoing changesets
36 # one email for all outgoing changesets
37 outgoing.notify = python:hgext.notify.hook
37 outgoing.notify = python:hgext.notify.hook
38
38
39 This registers the hooks. To enable notification, subscribers must be assigned
39 This registers the hooks. To enable notification, subscribers must be assigned
40 to repositories. The "[usersubs]" section maps multiple repositories to a
40 to repositories. The "[usersubs]" section maps multiple repositories to a
41 given recipient. The "[reposubs]" section maps multiple recipients to a single
41 given recipient. The "[reposubs]" section maps multiple recipients to a single
42 repository:
42 repository:
43
43
44 [usersubs]
44 [usersubs]
45 # key is subscriber email, value is a comma-separated list of repo patterns
45 # key is subscriber email, value is a comma-separated list of repo patterns
46 user@host = pattern
46 user@host = pattern
47
47
48 [reposubs]
48 [reposubs]
49 # key is repo pattern, value is a comma-separated list of subscriber emails
49 # key is repo pattern, value is a comma-separated list of subscriber emails
50 pattern = user@host
50 pattern = user@host
51
51
52 A "pattern" is a "glob" matching the absolute path to a repository, optionally
52 A "pattern" is a "glob" matching the absolute path to a repository, optionally
53 combined with a revset expression. A revset expression, if present, is
53 combined with a revset expression. A revset expression, if present, is
54 separated from the glob by a hash. Example:
54 separated from the glob by a hash. Example:
55
55
56 [reposubs]
56 [reposubs]
57 */widgets#branch(release) = qa-team@example.com
57 */widgets#branch(release) = qa-team@example.com
58
58
59 This sends to "qa-team@example.com" whenever a changeset on the "release"
59 This sends to "qa-team@example.com" whenever a changeset on the "release"
60 branch triggers a notification in any repository ending in "widgets".
60 branch triggers a notification in any repository ending in "widgets".
61
61
62 In order to place them under direct user management, "[usersubs]" and
62 In order to place them under direct user management, "[usersubs]" and
63 "[reposubs]" sections may be placed in a separate "hgrc" file and incorporated
63 "[reposubs]" sections may be placed in a separate "hgrc" file and incorporated
64 by reference:
64 by reference:
65
65
66 [notify]
66 [notify]
67 config = /path/to/subscriptionsfile
67 config = /path/to/subscriptionsfile
68
68
69 Notifications will not be sent until the "notify.test" value is set to
69 Notifications will not be sent until the "notify.test" value is set to
70 "False"; see below.
70 "False"; see below.
71
71
72 Notifications content can be tweaked with the following configuration entries:
72 Notifications content can be tweaked with the following configuration entries:
73
73
74 notify.test
74 notify.test
75 If "True", print messages to stdout instead of sending them. Default: True.
75 If "True", print messages to stdout instead of sending them. Default: True.
76
76
77 notify.sources
77 notify.sources
78 Space-separated list of change sources. Notifications are activated only
78 Space-separated list of change sources. Notifications are activated only
79 when a changeset's source is in this list. Sources may be:
79 when a changeset's source is in this list. Sources may be:
80
80
81 "serve" changesets received via http or ssh
81 "serve" changesets received via http or ssh
82 "pull" changesets received via "hg pull"
82 "pull" changesets received via "hg pull"
83 "unbundle" changesets received via "hg unbundle"
83 "unbundle" changesets received via "hg unbundle"
84 "push" changesets sent or received via "hg push"
84 "push" changesets sent or received via "hg push"
85 "bundle" changesets sent via "hg unbundle"
85 "bundle" changesets sent via "hg unbundle"
86
86
87 Default: serve.
87 Default: serve.
88
88
89 notify.strip
89 notify.strip
90 Number of leading slashes to strip from url paths. By default, notifications
90 Number of leading slashes to strip from url paths. By default, notifications
91 reference repositories with their absolute path. "notify.strip" lets you
91 reference repositories with their absolute path. "notify.strip" lets you
92 turn them into relative paths. For example, "notify.strip=3" will change
92 turn them into relative paths. For example, "notify.strip=3" will change
93 "/long/path/repository" into "repository". Default: 0.
93 "/long/path/repository" into "repository". Default: 0.
94
94
95 notify.domain
95 notify.domain
96 Default email domain for sender or recipients with no explicit domain.
96 Default email domain for sender or recipients with no explicit domain.
97
97
98 notify.style
98 notify.style
99 Style file to use when formatting emails.
99 Style file to use when formatting emails.
100
100
101 notify.template
101 notify.template
102 Template to use when formatting emails.
102 Template to use when formatting emails.
103
103
104 notify.incoming
104 notify.incoming
105 Template to use when run as an incoming hook, overriding "notify.template".
105 Template to use when run as an incoming hook, overriding "notify.template".
106
106
107 notify.outgoing
107 notify.outgoing
108 Template to use when run as an outgoing hook, overriding "notify.template".
108 Template to use when run as an outgoing hook, overriding "notify.template".
109
109
110 notify.changegroup
110 notify.changegroup
111 Template to use when running as a changegroup hook, overriding
111 Template to use when running as a changegroup hook, overriding
112 "notify.template".
112 "notify.template".
113
113
114 notify.maxdiff
114 notify.maxdiff
115 Maximum number of diff lines to include in notification email. Set to 0 to
115 Maximum number of diff lines to include in notification email. Set to 0 to
116 disable the diff, or -1 to include all of it. Default: 300.
116 disable the diff, or -1 to include all of it. Default: 300.
117
117
118 notify.maxsubject
118 notify.maxsubject
119 Maximum number of characters in email's subject line. Default: 67.
119 Maximum number of characters in email's subject line. Default: 67.
120
120
121 notify.diffstat
121 notify.diffstat
122 Set to True to include a diffstat before diff content. Default: True.
122 Set to True to include a diffstat before diff content. Default: True.
123
123
124 notify.merge
124 notify.merge
125 If True, send notifications for merge changesets. Default: True.
125 If True, send notifications for merge changesets. Default: True.
126
126
127 notify.mbox
127 notify.mbox
128 If set, append mails to this mbox file instead of sending. Default: None.
128 If set, append mails to this mbox file instead of sending. Default: None.
129
129
130 notify.fromauthor
130 notify.fromauthor
131 If set, use the committer of the first changeset in a changegroup for the
131 If set, use the committer of the first changeset in a changegroup for the
132 "From" field of the notification mail. If not set, take the user from the
132 "From" field of the notification mail. If not set, take the user from the
133 pushing repo. Default: False.
133 pushing repo. Default: False.
134
134
135 If set, the following entries will also be used to customize the
135 If set, the following entries will also be used to customize the
136 notifications:
136 notifications:
137
137
138 email.from
138 email.from
139 Email "From" address to use if none can be found in the generated email
139 Email "From" address to use if none can be found in the generated email
140 content.
140 content.
141
141
142 web.baseurl
142 web.baseurl
143 Root repository URL to combine with repository paths when making references.
143 Root repository URL to combine with repository paths when making references.
144 See also "notify.strip".
144 See also "notify.strip".
145
145
146 no commands defined
146 no commands defined
147 $ hg init a
147 $ hg init a
148 $ echo a > a/a
148 $ echo a > a/a
149
149
150 commit
150 commit
151
151
152 $ hg --cwd a commit -Ama -d '0 0'
152 $ hg --cwd a commit -Ama -d '0 0'
153 adding a
153 adding a
154
154
155
155
156 clone
156 clone
157
157
158 $ hg --traceback clone a b
158 $ hg --traceback clone a b
159 updating to branch default
159 updating to branch default
160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
161 $ echo a >> a/a
161 $ echo a >> a/a
162
162
163 commit
163 commit
164
164
165 $ hg --traceback --cwd a commit -Amb -d '1 0'
165 $ hg --traceback --cwd a commit -Amb -d '1 0'
166
166
167 on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
167 on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
168
168
169 $ cat <<EOF >> $HGRCPATH
169 $ cat <<EOF >> $HGRCPATH
170 > [notify]
170 > [notify]
171 > maxsubject = 200
171 > maxsubject = 200
172 > EOF
172 > EOF
173
173
174 the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
174 the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
175 of the very long subject line
175 of the very long subject line
176 pull (minimal config)
176 pull (minimal config)
177
177
178 $ hg --traceback --cwd b pull ../a | \
178 $ hg --traceback --cwd b pull ../a | \
179 > $PYTHON -c 'import sys,re; print re.sub("\n[\t ]", " ", sys.stdin.read()),'
179 > $PYTHON -c 'import sys,re; print re.sub("\n[\t ]", " ", sys.stdin.read()),'
180 pulling from ../a
180 pulling from ../a
181 searching for changes
181 searching for changes
182 adding changesets
182 adding changesets
183 adding manifests
183 adding manifests
184 adding file changes
184 adding file changes
185 added 1 changesets with 1 changes to 1 files
185 added 1 changesets with 1 changes to 1 files
186 Content-Type: text/plain; charset="us-ascii"
186 Content-Type: text/plain; charset="us-ascii"
187 MIME-Version: 1.0
187 MIME-Version: 1.0
188 Content-Transfer-Encoding: 7bit
188 Content-Transfer-Encoding: 7bit
189 Date: * (glob)
189 Date: * (glob)
190 Subject: changeset in $TESTTMP/b: b
190 Subject: changeset in $TESTTMP/b: b
191 From: test
191 From: test
192 X-Hg-Notification: changeset 0647d048b600
192 X-Hg-Notification: changeset 0647d048b600
193 Message-Id: <*> (glob)
193 Message-Id: <*> (glob)
194 To: baz, foo@bar
194 To: baz, foo@bar
195
195
196 changeset 0647d048b600 in $TESTTMP/b (glob)
196 changeset 0647d048b600 in $TESTTMP/b (glob)
197 details: $TESTTMP/b?cmd=changeset;node=0647d048b600
197 details: $TESTTMP/b?cmd=changeset;node=0647d048b600
198 description: b
198 description: b
199
199
200 diffs (6 lines):
200 diffs (6 lines):
201
201
202 diff -r cb9a9f314b8b -r 0647d048b600 a
202 diff -r cb9a9f314b8b -r 0647d048b600 a
203 --- a/a Thu Jan 01 00:00:00 1970 +0000
203 --- a/a Thu Jan 01 00:00:00 1970 +0000
204 +++ b/a Thu Jan 01 00:00:01 1970 +0000
204 +++ b/a Thu Jan 01 00:00:01 1970 +0000
205 @@ -1,1 +1,2 @@ a
205 @@ -1,1 +1,2 @@ a
206 +a
206 +a
207 (run 'hg update' to get a working copy)
207 (run 'hg update' to get a working copy)
208 $ cat <<EOF >> $HGRCPATH
208 $ cat <<EOF >> $HGRCPATH
209 > [notify]
209 > [notify]
210 > config = `pwd`/.notify.conf
210 > config = `pwd`/.notify.conf
211 > domain = test.com
211 > domain = test.com
212 > strip = 42
212 > strip = 42
213 > template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
213 > template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
214 >
214 >
215 > [web]
215 > [web]
216 > baseurl = http://test/
216 > baseurl = http://test/
217 > EOF
217 > EOF
218
218
219 fail for config file is missing
219 fail for config file is missing
220
220
221 $ hg --cwd b rollback
221 $ hg --cwd b rollback
222 repository tip rolled back to revision 0 (undo pull)
222 repository tip rolled back to revision 0 (undo pull)
223 $ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed
223 $ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed
224 pull failed
224 pull failed
225 $ touch ".notify.conf"
225 $ touch ".notify.conf"
226
226
227 pull
227 pull
228
228
229 $ hg --cwd b rollback
229 $ hg --cwd b rollback
230 repository tip rolled back to revision 0 (undo pull)
230 repository tip rolled back to revision 0 (undo pull)
231 $ hg --traceback --cwd b pull ../a | \
231 $ hg --traceback --cwd b pull ../a | \
232 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
232 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
233 pulling from ../a
233 pulling from ../a
234 searching for changes
234 searching for changes
235 adding changesets
235 adding changesets
236 adding manifests
236 adding manifests
237 adding file changes
237 adding file changes
238 added 1 changesets with 1 changes to 1 files
238 added 1 changesets with 1 changes to 1 files
239 Content-Type: text/plain; charset="us-ascii"
239 Content-Type: text/plain; charset="us-ascii"
240 MIME-Version: 1.0
240 MIME-Version: 1.0
241 Content-Transfer-Encoding: 7bit
241 Content-Transfer-Encoding: 7bit
242 X-Test: foo
242 X-Test: foo
243 Date: * (glob)
243 Date: * (glob)
244 Subject: b
244 Subject: b
245 From: test@test.com
245 From: test@test.com
246 X-Hg-Notification: changeset 0647d048b600
246 X-Hg-Notification: changeset 0647d048b600
247 Message-Id: <*> (glob)
247 Message-Id: <*> (glob)
248 To: baz@test.com, foo@bar
248 To: baz@test.com, foo@bar
249
249
250 changeset 0647d048b600 in b
250 changeset 0647d048b600 in b
251 description: b
251 description: b
252 diffs (6 lines):
252 diffs (6 lines):
253
253
254 diff -r cb9a9f314b8b -r 0647d048b600 a
254 diff -r cb9a9f314b8b -r 0647d048b600 a
255 --- a/a Thu Jan 01 00:00:00 1970 +0000
255 --- a/a Thu Jan 01 00:00:00 1970 +0000
256 +++ b/a Thu Jan 01 00:00:01 1970 +0000
256 +++ b/a Thu Jan 01 00:00:01 1970 +0000
257 @@ -1,1 +1,2 @@
257 @@ -1,1 +1,2 @@
258 a
258 a
259 +a
259 +a
260 (run 'hg update' to get a working copy)
260 (run 'hg update' to get a working copy)
261
261
262 $ cat << EOF >> $HGRCPATH
262 $ cat << EOF >> $HGRCPATH
263 > [hooks]
263 > [hooks]
264 > incoming.notify = python:hgext.notify.hook
264 > incoming.notify = python:hgext.notify.hook
265 >
265 >
266 > [notify]
266 > [notify]
267 > sources = pull
267 > sources = pull
268 > diffstat = True
268 > diffstat = True
269 > EOF
269 > EOF
270
270
271 pull
271 pull
272
272
273 $ hg --cwd b rollback
273 $ hg --cwd b rollback
274 repository tip rolled back to revision 0 (undo pull)
274 repository tip rolled back to revision 0 (undo pull)
275 $ hg --traceback --cwd b pull ../a | \
275 $ hg --traceback --cwd b pull ../a | \
276 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
276 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
277 pulling from ../a
277 pulling from ../a
278 searching for changes
278 searching for changes
279 adding changesets
279 adding changesets
280 adding manifests
280 adding manifests
281 adding file changes
281 adding file changes
282 added 1 changesets with 1 changes to 1 files
282 added 1 changesets with 1 changes to 1 files
283 Content-Type: text/plain; charset="us-ascii"
283 Content-Type: text/plain; charset="us-ascii"
284 MIME-Version: 1.0
284 MIME-Version: 1.0
285 Content-Transfer-Encoding: 7bit
285 Content-Transfer-Encoding: 7bit
286 X-Test: foo
286 X-Test: foo
287 Date: * (glob)
287 Date: * (glob)
288 Subject: b
288 Subject: b
289 From: test@test.com
289 From: test@test.com
290 X-Hg-Notification: changeset 0647d048b600
290 X-Hg-Notification: changeset 0647d048b600
291 Message-Id: <*> (glob)
291 Message-Id: <*> (glob)
292 To: baz@test.com, foo@bar
292 To: baz@test.com, foo@bar
293
293
294 changeset 0647d048b600 in b
294 changeset 0647d048b600 in b
295 description: b
295 description: b
296 diffstat:
296 diffstat:
297
297
298 a | 1 +
298 a | 1 +
299 1 files changed, 1 insertions(+), 0 deletions(-)
299 1 files changed, 1 insertions(+), 0 deletions(-)
300
300
301 diffs (6 lines):
301 diffs (6 lines):
302
302
303 diff -r cb9a9f314b8b -r 0647d048b600 a
303 diff -r cb9a9f314b8b -r 0647d048b600 a
304 --- a/a Thu Jan 01 00:00:00 1970 +0000
304 --- a/a Thu Jan 01 00:00:00 1970 +0000
305 +++ b/a Thu Jan 01 00:00:01 1970 +0000
305 +++ b/a Thu Jan 01 00:00:01 1970 +0000
306 @@ -1,1 +1,2 @@
306 @@ -1,1 +1,2 @@
307 a
307 a
308 +a
308 +a
309 (run 'hg update' to get a working copy)
309 (run 'hg update' to get a working copy)
310
310
311 test merge
311 test merge
312
312
313 $ cd a
313 $ cd a
314 $ hg up -C 0
314 $ hg up -C 0
315 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
315 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
316 $ echo a >> a
316 $ echo a >> a
317 $ hg ci -Am adda2 -d '2 0'
317 $ hg ci -Am adda2 -d '2 0'
318 created new head
318 created new head
319 $ hg merge
319 $ hg merge
320 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
321 (branch merge, don't forget to commit)
321 (branch merge, don't forget to commit)
322 $ hg ci -m merge -d '3 0'
322 $ hg ci -m merge -d '3 0'
323 $ cd ..
323 $ cd ..
324 $ hg --traceback --cwd b pull ../a | \
324 $ hg --traceback --cwd b pull ../a | \
325 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
325 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
326 pulling from ../a
326 pulling from ../a
327 searching for changes
327 searching for changes
328 adding changesets
328 adding changesets
329 adding manifests
329 adding manifests
330 adding file changes
330 adding file changes
331 added 2 changesets with 0 changes to 0 files
331 added 2 changesets with 0 changes to 0 files
332 Content-Type: text/plain; charset="us-ascii"
332 Content-Type: text/plain; charset="us-ascii"
333 MIME-Version: 1.0
333 MIME-Version: 1.0
334 Content-Transfer-Encoding: 7bit
334 Content-Transfer-Encoding: 7bit
335 X-Test: foo
335 X-Test: foo
336 Date: * (glob)
336 Date: * (glob)
337 Subject: adda2
337 Subject: adda2
338 From: test@test.com
338 From: test@test.com
339 X-Hg-Notification: changeset 0a184ce6067f
339 X-Hg-Notification: changeset 0a184ce6067f
340 Message-Id: <*> (glob)
340 Message-Id: <*> (glob)
341 To: baz@test.com, foo@bar
341 To: baz@test.com, foo@bar
342
342
343 changeset 0a184ce6067f in b
343 changeset 0a184ce6067f in b
344 description: adda2
344 description: adda2
345 diffstat:
345 diffstat:
346
346
347 a | 1 +
347 a | 1 +
348 1 files changed, 1 insertions(+), 0 deletions(-)
348 1 files changed, 1 insertions(+), 0 deletions(-)
349
349
350 diffs (6 lines):
350 diffs (6 lines):
351
351
352 diff -r cb9a9f314b8b -r 0a184ce6067f a
352 diff -r cb9a9f314b8b -r 0a184ce6067f a
353 --- a/a Thu Jan 01 00:00:00 1970 +0000
353 --- a/a Thu Jan 01 00:00:00 1970 +0000
354 +++ b/a Thu Jan 01 00:00:02 1970 +0000
354 +++ b/a Thu Jan 01 00:00:02 1970 +0000
355 @@ -1,1 +1,2 @@
355 @@ -1,1 +1,2 @@
356 a
356 a
357 +a
357 +a
358 Content-Type: text/plain; charset="us-ascii"
358 Content-Type: text/plain; charset="us-ascii"
359 MIME-Version: 1.0
359 MIME-Version: 1.0
360 Content-Transfer-Encoding: 7bit
360 Content-Transfer-Encoding: 7bit
361 X-Test: foo
361 X-Test: foo
362 Date: * (glob)
362 Date: * (glob)
363 Subject: merge
363 Subject: merge
364 From: test@test.com
364 From: test@test.com
365 X-Hg-Notification: changeset 6a0cf76b2701
365 X-Hg-Notification: changeset 6a0cf76b2701
366 Message-Id: <*> (glob)
366 Message-Id: <*> (glob)
367 To: baz@test.com, foo@bar
367 To: baz@test.com, foo@bar
368
368
369 changeset 6a0cf76b2701 in b
369 changeset 6a0cf76b2701 in b
370 description: merge
370 description: merge
371 (run 'hg update' to get a working copy)
371 (run 'hg update' to get a working copy)
372
372
373 non-ascii content and truncation of multi-byte subject
373 non-ascii content and truncation of multi-byte subject
374
374
375 $ cat <<EOF >> $HGRCPATH
375 $ cat <<EOF >> $HGRCPATH
376 > [notify]
376 > [notify]
377 > maxsubject = 4
377 > maxsubject = 4
378 > EOF
378 > EOF
379 $ echo a >> a/a
379 $ echo a >> a/a
380 $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
380 $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
381 > -m `$PYTHON -c 'print "\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4"'`
381 > -m `$PYTHON -c 'print "\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4"'`
382 $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
382 $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
383 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
383 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
384 pulling from ../a
384 pulling from ../a
385 searching for changes
385 searching for changes
386 adding changesets
386 adding changesets
387 adding manifests
387 adding manifests
388 adding file changes
388 adding file changes
389 added 1 changesets with 1 changes to 1 files
389 added 1 changesets with 1 changes to 1 files
390 Content-Type: text/plain; charset="us-ascii"
390 Content-Type: text/plain; charset="us-ascii"
391 MIME-Version: 1.0
391 MIME-Version: 1.0
392 Content-Transfer-Encoding: 8bit
392 Content-Transfer-Encoding: 8bit
393 X-Test: foo
393 X-Test: foo
394 Date: * (glob)
394 Date: * (glob)
395 Subject: \xc3\xa0... (esc)
395 Subject: \xc3\xa0... (esc)
396 From: test@test.com
396 From: test@test.com
397 X-Hg-Notification: changeset 7ea05ad269dc
397 X-Hg-Notification: changeset 7ea05ad269dc
398 Message-Id: <*> (glob)
398 Message-Id: <*> (glob)
399 To: baz@test.com, foo@bar
399 To: baz@test.com, foo@bar
400
400
401 changeset 7ea05ad269dc in b
401 changeset 7ea05ad269dc in b
402 description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc)
402 description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc)
403 diffstat:
403 diffstat:
404
404
405 a | 1 +
405 a | 1 +
406 1 files changed, 1 insertions(+), 0 deletions(-)
406 1 files changed, 1 insertions(+), 0 deletions(-)
407
407
408 diffs (7 lines):
408 diffs (7 lines):
409
409
410 diff -r 6a0cf76b2701 -r 7ea05ad269dc a
410 diff -r 6a0cf76b2701 -r 7ea05ad269dc a
411 --- a/a Thu Jan 01 00:00:03 1970 +0000
411 --- a/a Thu Jan 01 00:00:03 1970 +0000
412 +++ b/a Thu Jan 01 00:00:00 1970 +0000
412 +++ b/a Thu Jan 01 00:00:00 1970 +0000
413 @@ -1,2 +1,3 @@
413 @@ -1,2 +1,3 @@
414 a
414 a
415 a
415 a
416 +a
416 +a
417 (run 'hg update' to get a working copy)
417 (run 'hg update' to get a working copy)
418
418
419 long lines
419 long lines
420
420
421 $ cat <<EOF >> $HGRCPATH
421 $ cat <<EOF >> $HGRCPATH
422 > [notify]
422 > [notify]
423 > maxsubject = 67
423 > maxsubject = 67
424 > test = False
424 > test = False
425 > mbox = mbox
425 > mbox = mbox
426 > EOF
426 > EOF
427 $ $PYTHON -c 'file("a/a", "ab").write("no" * 500 + "\n")'
427 $ $PYTHON -c 'file("a/a", "ab").write("no" * 500 + "\n")'
428 $ hg --cwd a commit -A -m "long line"
428 $ hg --cwd a commit -A -m "long line"
429 $ hg --traceback --cwd b pull ../a
429 $ hg --traceback --cwd b pull ../a
430 pulling from ../a
430 pulling from ../a
431 searching for changes
431 searching for changes
432 adding changesets
432 adding changesets
433 adding manifests
433 adding manifests
434 adding file changes
434 adding file changes
435 added 1 changesets with 1 changes to 1 files
435 added 1 changesets with 1 changes to 1 files
436 notify: sending 2 subscribers 1 changes
436 notify: sending 2 subscribers 1 changes
437 (run 'hg update' to get a working copy)
437 (run 'hg update' to get a working copy)
438 $ $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", file("b/mbox").read()),'
438 $ $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", file("b/mbox").read()),'
439 From test@test.com ... ... .. ..:..:.. .... (re)
439 From test@test.com ... ... .. ..:..:.. .... (re)
440 Content-Type: text/plain; charset="us-ascii"
440 Content-Type: text/plain; charset="us-ascii"
441 MIME-Version: 1.0
441 MIME-Version: 1.0
442 Content-Transfer-Encoding: quoted-printable
442 Content-Transfer-Encoding: quoted-printable
443 X-Test: foo
443 X-Test: foo
444 Date: * (glob)
444 Date: * (glob)
445 Subject: long line
445 Subject: long line
446 From: test@test.com
446 From: test@test.com
447 X-Hg-Notification: changeset e0be44cf638b
447 X-Hg-Notification: changeset e0be44cf638b
448 Message-Id: <hg.e0be44cf638b.*.*@*> (glob)
448 Message-Id: <hg.e0be44cf638b.*.*@*> (glob)
449 To: baz@test.com, foo@bar
449 To: baz@test.com, foo@bar
450
450
451 changeset e0be44cf638b in b
451 changeset e0be44cf638b in b
452 description: long line
452 description: long line
453 diffstat:
453 diffstat:
454
454
455 a | 1 +
455 a | 1 +
456 1 files changed, 1 insertions(+), 0 deletions(-)
456 1 files changed, 1 insertions(+), 0 deletions(-)
457
457
458 diffs (8 lines):
458 diffs (8 lines):
459
459
460 diff -r 7ea05ad269dc -r e0be44cf638b a
460 diff -r 7ea05ad269dc -r e0be44cf638b a
461 --- a/a Thu Jan 01 00:00:00 1970 +0000
461 --- a/a Thu Jan 01 00:00:00 1970 +0000
462 +++ b/a Thu Jan 01 00:00:00 1970 +0000
462 +++ b/a Thu Jan 01 00:00:00 1970 +0000
463 @@ -1,3 +1,4 @@
463 @@ -1,3 +1,4 @@
464 a
464 a
465 a
465 a
466 a
466 a
467 +nonononononononononononononononononononononononononononononononononononono=
467 +nonononononononononononononononononononononononononononononononononononono=
468 nononononononononononononononononononononononononononononononononononononon=
468 nononononononononononononononononononononononononononononononononononononon=
469 ononononononononononononononononononononononononononononononononononononono=
469 ononononononononononononononononononononononononononononononononononononono=
470 nononononononononononononononononononononononononononononononononononononon=
470 nononononononononononononononononononononononononononononononononononononon=
471 ononononononononononononononononononononononononononononononononononononono=
471 ononononononononononononononononononononononononononononononononononononono=
472 nononononononononononononononononononononononononononononononononononononon=
472 nononononononononononononononononononononononononononononononononononononon=
473 ononononononononononononononononononononononononononononononononononononono=
473 ononononononononononononononononononononononononononononononononononononono=
474 nononononononononononononononononononononononononononononononononononononon=
474 nononononononononononononononononononononononononononononononononononononon=
475 ononononononononononononononononononononononononononononononononononononono=
475 ononononononononononononononononononononononononononononononononononononono=
476 nononononononononononononononononononononononononononononononononononononon=
476 nononononononononononononononononononononononononononononononononononononon=
477 ononononononononononononononononononononononononononononononononononononono=
477 ononononononononononononononononononononononononononononononononononononono=
478 nononononononononononononononononononononononononononononononononononononon=
478 nononononononononononononononononononononononononononononononononononononon=
479 ononononononononononononononononononononononononononononononononononononono=
479 ononononononononononononononononononononononononononononononononononononono=
480 nonononononononononononono
480 nonononononononononononono
481
481
482 revset selection: send to address that matches branch and repo
482 revset selection: send to address that matches branch and repo
483
483
484 $ cat << EOF >> $HGRCPATH
484 $ cat << EOF >> $HGRCPATH
485 > [hooks]
485 > [hooks]
486 > incoming.notify = python:hgext.notify.hook
486 > incoming.notify = python:hgext.notify.hook
487 >
487 >
488 > [notify]
488 > [notify]
489 > sources = pull
489 > sources = pull
490 > test = True
490 > test = True
491 > diffstat = False
491 > diffstat = False
492 > maxdiff = 0
492 > maxdiff = 0
493 >
493 >
494 > [reposubs]
494 > [reposubs]
495 > */a#branch(test) = will_no_be_send@example.com
495 > */a#branch(test) = will_no_be_send@example.com
496 > */b#branch(test) = notify@example.com
496 > */b#branch(test) = notify@example.com
497 > EOF
497 > EOF
498 $ hg --cwd a branch test
498 $ hg --cwd a branch test
499 marked working directory as branch test
499 marked working directory as branch test
500 (branches are permanent and global, did you want a bookmark?)
500 (branches are permanent and global, did you want a bookmark?)
501 $ echo a >> a/a
501 $ echo a >> a/a
502 $ hg --cwd a ci -m test -d '1 0'
502 $ hg --cwd a ci -m test -d '1 0'
503 $ hg --traceback --cwd b pull ../a | \
503 $ hg --traceback --cwd b pull ../a | \
504 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
504 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
505 pulling from ../a
505 pulling from ../a
506 searching for changes
506 searching for changes
507 adding changesets
507 adding changesets
508 adding manifests
508 adding manifests
509 adding file changes
509 adding file changes
510 added 1 changesets with 1 changes to 1 files
510 added 1 changesets with 1 changes to 1 files
511 Content-Type: text/plain; charset="us-ascii"
511 Content-Type: text/plain; charset="us-ascii"
512 MIME-Version: 1.0
512 MIME-Version: 1.0
513 Content-Transfer-Encoding: 7bit
513 Content-Transfer-Encoding: 7bit
514 X-Test: foo
514 X-Test: foo
515 Date: * (glob)
515 Date: * (glob)
516 Subject: test
516 Subject: test
517 From: test@test.com
517 From: test@test.com
518 X-Hg-Notification: changeset fbbcbc516f2f
518 X-Hg-Notification: changeset fbbcbc516f2f
519 Message-Id: <hg.fbbcbc516f2f.*.*@*> (glob)
519 Message-Id: <hg.fbbcbc516f2f.*.*@*> (glob)
520 To: baz@test.com, foo@bar, notify@example.com
520 To: baz@test.com, foo@bar, notify@example.com
521
521
522 changeset fbbcbc516f2f in b
522 changeset fbbcbc516f2f in b
523 description: test
523 description: test
524 (run 'hg update' to get a working copy)
524 (run 'hg update' to get a working copy)
525
525
526 revset selection: don't send to address that waits for mails
526 revset selection: don't send to address that waits for mails
527 from different branch
527 from different branch
528
528
529 $ hg --cwd a update default
529 $ hg --cwd a update default
530 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
530 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 $ echo a >> a/a
531 $ echo a >> a/a
532 $ hg --cwd a ci -m test -d '1 0'
532 $ hg --cwd a ci -m test -d '1 0'
533 $ hg --traceback --cwd b pull ../a | \
533 $ hg --traceback --cwd b pull ../a | \
534 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
534 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
535 pulling from ../a
535 pulling from ../a
536 searching for changes
536 searching for changes
537 adding changesets
537 adding changesets
538 adding manifests
538 adding manifests
539 adding file changes
539 adding file changes
540 added 1 changesets with 0 changes to 0 files (+1 heads)
540 added 1 changesets with 0 changes to 0 files (+1 heads)
541 Content-Type: text/plain; charset="us-ascii"
541 Content-Type: text/plain; charset="us-ascii"
542 MIME-Version: 1.0
542 MIME-Version: 1.0
543 Content-Transfer-Encoding: 7bit
543 Content-Transfer-Encoding: 7bit
544 X-Test: foo
544 X-Test: foo
545 Date: * (glob)
545 Date: * (glob)
546 Subject: test
546 Subject: test
547 From: test@test.com
547 From: test@test.com
548 X-Hg-Notification: changeset 38b42fa092de
548 X-Hg-Notification: changeset 38b42fa092de
549 Message-Id: <hg.38b42fa092de.*.*@*> (glob)
549 Message-Id: <hg.38b42fa092de.*.*@*> (glob)
550 To: baz@test.com, foo@bar
550 To: baz@test.com, foo@bar
551
551
552 changeset 38b42fa092de in b
552 changeset 38b42fa092de in b
553 description: test
553 description: test
554 (run 'hg heads' to see heads)
554 (run 'hg heads' to see heads)
555
555
@@ -1,409 +1,409 b''
1 Create configuration
1 Create configuration
2
2
3 $ echo "[ui]" >> $HGRCPATH
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
5
5
6 help record (no record)
6 help record (no record)
7
7
8 $ hg help record
8 $ hg help record
9 record extension - commands to interactively select changes for
9 record extension - commands to interactively select changes for
10 commit/qrefresh
10 commit/qrefresh
11
11
12 (use "hg help extensions" for information on enabling extensions)
12 (use "hg help extensions" for information on enabling extensions)
13
13
14 help qrecord (no record)
14 help qrecord (no record)
15
15
16 $ hg help qrecord
16 $ hg help qrecord
17 'qrecord' is provided by the following extension:
17 'qrecord' is provided by the following extension:
18
18
19 record commands to interactively select changes for commit/qrefresh
19 record commands to interactively select changes for commit/qrefresh
20
20
21 (use "hg help extensions" for information on enabling extensions)
21 (use "hg help extensions" for information on enabling extensions)
22
22
23 $ echo "[extensions]" >> $HGRCPATH
23 $ echo "[extensions]" >> $HGRCPATH
24 $ echo "record=" >> $HGRCPATH
24 $ echo "record=" >> $HGRCPATH
25
25
26 help record (record)
26 help record (record)
27
27
28 $ hg help record
28 $ hg help record
29 hg record [OPTION]... [FILE]...
29 hg record [OPTION]... [FILE]...
30
30
31 interactively select changes to commit
31 interactively select changes to commit
32
32
33 If a list of files is omitted, all changes reported by "hg status" will be
33 If a list of files is omitted, all changes reported by 'hg status' will be
34 candidates for recording.
34 candidates for recording.
35
35
36 See "hg help dates" for a list of formats valid for -d/--date.
36 See 'hg help dates' for a list of formats valid for -d/--date.
37
37
38 You will be prompted for whether to record changes to each modified file,
38 You will be prompted for whether to record changes to each modified file,
39 and for files with multiple changes, for each change to use. For each
39 and for files with multiple changes, for each change to use. For each
40 query, the following responses are possible:
40 query, the following responses are possible:
41
41
42 y - record this change
42 y - record this change
43 n - skip this change
43 n - skip this change
44 e - edit this change manually
44 e - edit this change manually
45
45
46 s - skip remaining changes to this file
46 s - skip remaining changes to this file
47 f - record remaining changes to this file
47 f - record remaining changes to this file
48
48
49 d - done, skip remaining changes and files
49 d - done, skip remaining changes and files
50 a - record all changes to all remaining files
50 a - record all changes to all remaining files
51 q - quit, recording no changes
51 q - quit, recording no changes
52
52
53 ? - display help
53 ? - display help
54
54
55 This command is not available when committing a merge.
55 This command is not available when committing a merge.
56
56
57 options ([+] can be repeated):
57 options ([+] can be repeated):
58
58
59 -A --addremove mark new/missing files as added/removed before
59 -A --addremove mark new/missing files as added/removed before
60 committing
60 committing
61 --close-branch mark a branch head as closed
61 --close-branch mark a branch head as closed
62 --amend amend the parent of the working directory
62 --amend amend the parent of the working directory
63 -s --secret use the secret phase for committing
63 -s --secret use the secret phase for committing
64 -e --edit invoke editor on commit messages
64 -e --edit invoke editor on commit messages
65 -I --include PATTERN [+] include names matching the given patterns
65 -I --include PATTERN [+] include names matching the given patterns
66 -X --exclude PATTERN [+] exclude names matching the given patterns
66 -X --exclude PATTERN [+] exclude names matching the given patterns
67 -m --message TEXT use text as commit message
67 -m --message TEXT use text as commit message
68 -l --logfile FILE read commit message from file
68 -l --logfile FILE read commit message from file
69 -d --date DATE record the specified date as commit date
69 -d --date DATE record the specified date as commit date
70 -u --user USER record the specified user as committer
70 -u --user USER record the specified user as committer
71 -S --subrepos recurse into subrepositories
71 -S --subrepos recurse into subrepositories
72 -w --ignore-all-space ignore white space when comparing lines
72 -w --ignore-all-space ignore white space when comparing lines
73 -b --ignore-space-change ignore changes in the amount of white space
73 -b --ignore-space-change ignore changes in the amount of white space
74 -B --ignore-blank-lines ignore changes whose lines are all blank
74 -B --ignore-blank-lines ignore changes whose lines are all blank
75
75
76 (some details hidden, use --verbose to show complete help)
76 (some details hidden, use --verbose to show complete help)
77
77
78 help (no mq, so no qrecord)
78 help (no mq, so no qrecord)
79
79
80 $ hg help qrecord
80 $ hg help qrecord
81 hg qrecord [OPTION]... PATCH [FILE]...
81 hg qrecord [OPTION]... PATCH [FILE]...
82
82
83 interactively record a new patch
83 interactively record a new patch
84
84
85 See "hg help qnew" & "hg help record" for more information and usage.
85 See 'hg help qnew' & 'hg help record' for more information and usage.
86
86
87 (some details hidden, use --verbose to show complete help)
87 (some details hidden, use --verbose to show complete help)
88
88
89 $ hg init a
89 $ hg init a
90
90
91 qrecord (mq not present)
91 qrecord (mq not present)
92
92
93 $ hg -R a qrecord
93 $ hg -R a qrecord
94 hg qrecord: invalid arguments
94 hg qrecord: invalid arguments
95 hg qrecord [OPTION]... PATCH [FILE]...
95 hg qrecord [OPTION]... PATCH [FILE]...
96
96
97 interactively record a new patch
97 interactively record a new patch
98
98
99 (use "hg qrecord -h" to show more help)
99 (use "hg qrecord -h" to show more help)
100 [255]
100 [255]
101
101
102 qrecord patch (mq not present)
102 qrecord patch (mq not present)
103
103
104 $ hg -R a qrecord patch
104 $ hg -R a qrecord patch
105 abort: 'mq' extension not loaded
105 abort: 'mq' extension not loaded
106 [255]
106 [255]
107
107
108 help (bad mq)
108 help (bad mq)
109
109
110 $ echo "mq=nonexistent" >> $HGRCPATH
110 $ echo "mq=nonexistent" >> $HGRCPATH
111 $ hg help qrecord
111 $ hg help qrecord
112 *** failed to import extension mq from nonexistent: [Errno *] * (glob)
112 *** failed to import extension mq from nonexistent: [Errno *] * (glob)
113 hg qrecord [OPTION]... PATCH [FILE]...
113 hg qrecord [OPTION]... PATCH [FILE]...
114
114
115 interactively record a new patch
115 interactively record a new patch
116
116
117 See "hg help qnew" & "hg help record" for more information and usage.
117 See 'hg help qnew' & 'hg help record' for more information and usage.
118
118
119 (some details hidden, use --verbose to show complete help)
119 (some details hidden, use --verbose to show complete help)
120
120
121 help (mq present)
121 help (mq present)
122
122
123 $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp
123 $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp
124 $ mv hgrc.tmp $HGRCPATH
124 $ mv hgrc.tmp $HGRCPATH
125
125
126 $ hg help qrecord
126 $ hg help qrecord
127 hg qrecord [OPTION]... PATCH [FILE]...
127 hg qrecord [OPTION]... PATCH [FILE]...
128
128
129 interactively record a new patch
129 interactively record a new patch
130
130
131 See "hg help qnew" & "hg help record" for more information and usage.
131 See 'hg help qnew' & 'hg help record' for more information and usage.
132
132
133 options ([+] can be repeated):
133 options ([+] can be repeated):
134
134
135 -e --edit invoke editor on commit messages
135 -e --edit invoke editor on commit messages
136 -g --git use git extended diff format
136 -g --git use git extended diff format
137 -U --currentuser add "From: <current user>" to patch
137 -U --currentuser add "From: <current user>" to patch
138 -u --user USER add "From: <USER>" to patch
138 -u --user USER add "From: <USER>" to patch
139 -D --currentdate add "Date: <current date>" to patch
139 -D --currentdate add "Date: <current date>" to patch
140 -d --date DATE add "Date: <DATE>" to patch
140 -d --date DATE add "Date: <DATE>" to patch
141 -I --include PATTERN [+] include names matching the given patterns
141 -I --include PATTERN [+] include names matching the given patterns
142 -X --exclude PATTERN [+] exclude names matching the given patterns
142 -X --exclude PATTERN [+] exclude names matching the given patterns
143 -m --message TEXT use text as commit message
143 -m --message TEXT use text as commit message
144 -l --logfile FILE read commit message from file
144 -l --logfile FILE read commit message from file
145 -w --ignore-all-space ignore white space when comparing lines
145 -w --ignore-all-space ignore white space when comparing lines
146 -b --ignore-space-change ignore changes in the amount of white space
146 -b --ignore-space-change ignore changes in the amount of white space
147 -B --ignore-blank-lines ignore changes whose lines are all blank
147 -B --ignore-blank-lines ignore changes whose lines are all blank
148 --mq operate on patch repository
148 --mq operate on patch repository
149
149
150 (some details hidden, use --verbose to show complete help)
150 (some details hidden, use --verbose to show complete help)
151
151
152 $ cd a
152 $ cd a
153
153
154 Base commit
154 Base commit
155
155
156 $ cat > 1.txt <<EOF
156 $ cat > 1.txt <<EOF
157 > 1
157 > 1
158 > 2
158 > 2
159 > 3
159 > 3
160 > 4
160 > 4
161 > 5
161 > 5
162 > EOF
162 > EOF
163 $ cat > 2.txt <<EOF
163 $ cat > 2.txt <<EOF
164 > a
164 > a
165 > b
165 > b
166 > c
166 > c
167 > d
167 > d
168 > e
168 > e
169 > f
169 > f
170 > EOF
170 > EOF
171
171
172 $ mkdir dir
172 $ mkdir dir
173 $ cat > dir/a.txt <<EOF
173 $ cat > dir/a.txt <<EOF
174 > hello world
174 > hello world
175 >
175 >
176 > someone
176 > someone
177 > up
177 > up
178 > there
178 > there
179 > loves
179 > loves
180 > me
180 > me
181 > EOF
181 > EOF
182
182
183 $ hg add 1.txt 2.txt dir/a.txt
183 $ hg add 1.txt 2.txt dir/a.txt
184 $ hg commit -m 'initial checkin'
184 $ hg commit -m 'initial checkin'
185
185
186 Changing files
186 Changing files
187
187
188 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
188 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
189 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
189 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
190 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
190 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
191
191
192 $ mv -f 1.txt.new 1.txt
192 $ mv -f 1.txt.new 1.txt
193 $ mv -f 2.txt.new 2.txt
193 $ mv -f 2.txt.new 2.txt
194 $ mv -f dir/a.txt.new dir/a.txt
194 $ mv -f dir/a.txt.new dir/a.txt
195
195
196 Whole diff
196 Whole diff
197
197
198 $ hg diff --nodates
198 $ hg diff --nodates
199 diff -r 1057167b20ef 1.txt
199 diff -r 1057167b20ef 1.txt
200 --- a/1.txt
200 --- a/1.txt
201 +++ b/1.txt
201 +++ b/1.txt
202 @@ -1,5 +1,5 @@
202 @@ -1,5 +1,5 @@
203 1
203 1
204 -2
204 -2
205 +2 2
205 +2 2
206 3
206 3
207 -4
207 -4
208 +4 4
208 +4 4
209 5
209 5
210 diff -r 1057167b20ef 2.txt
210 diff -r 1057167b20ef 2.txt
211 --- a/2.txt
211 --- a/2.txt
212 +++ b/2.txt
212 +++ b/2.txt
213 @@ -1,5 +1,5 @@
213 @@ -1,5 +1,5 @@
214 a
214 a
215 -b
215 -b
216 +b b
216 +b b
217 c
217 c
218 d
218 d
219 e
219 e
220 diff -r 1057167b20ef dir/a.txt
220 diff -r 1057167b20ef dir/a.txt
221 --- a/dir/a.txt
221 --- a/dir/a.txt
222 +++ b/dir/a.txt
222 +++ b/dir/a.txt
223 @@ -1,4 +1,4 @@
223 @@ -1,4 +1,4 @@
224 -hello world
224 -hello world
225 +hello world!
225 +hello world!
226
226
227 someone
227 someone
228 up
228 up
229
229
230 qrecord with bad patch name, should abort before prompting
230 qrecord with bad patch name, should abort before prompting
231
231
232 $ hg qrecord .hg
232 $ hg qrecord .hg
233 abort: patch name cannot begin with ".hg"
233 abort: patch name cannot begin with ".hg"
234 [255]
234 [255]
235
235
236 qrecord a.patch
236 qrecord a.patch
237
237
238 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
238 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
239 > y
239 > y
240 > y
240 > y
241 > n
241 > n
242 > y
242 > y
243 > y
243 > y
244 > n
244 > n
245 > EOF
245 > EOF
246 diff --git a/1.txt b/1.txt
246 diff --git a/1.txt b/1.txt
247 2 hunks, 2 lines changed
247 2 hunks, 2 lines changed
248 examine changes to '1.txt'? [Ynesfdaq?] y
248 examine changes to '1.txt'? [Ynesfdaq?] y
249
249
250 @@ -1,3 +1,3 @@
250 @@ -1,3 +1,3 @@
251 1
251 1
252 -2
252 -2
253 +2 2
253 +2 2
254 3
254 3
255 record change 1/4 to '1.txt'? [Ynesfdaq?] y
255 record change 1/4 to '1.txt'? [Ynesfdaq?] y
256
256
257 @@ -3,3 +3,3 @@
257 @@ -3,3 +3,3 @@
258 3
258 3
259 -4
259 -4
260 +4 4
260 +4 4
261 5
261 5
262 record change 2/4 to '1.txt'? [Ynesfdaq?] n
262 record change 2/4 to '1.txt'? [Ynesfdaq?] n
263
263
264 diff --git a/2.txt b/2.txt
264 diff --git a/2.txt b/2.txt
265 1 hunks, 1 lines changed
265 1 hunks, 1 lines changed
266 examine changes to '2.txt'? [Ynesfdaq?] y
266 examine changes to '2.txt'? [Ynesfdaq?] y
267
267
268 @@ -1,5 +1,5 @@
268 @@ -1,5 +1,5 @@
269 a
269 a
270 -b
270 -b
271 +b b
271 +b b
272 c
272 c
273 d
273 d
274 e
274 e
275 record change 3/4 to '2.txt'? [Ynesfdaq?] y
275 record change 3/4 to '2.txt'? [Ynesfdaq?] y
276
276
277 diff --git a/dir/a.txt b/dir/a.txt
277 diff --git a/dir/a.txt b/dir/a.txt
278 1 hunks, 1 lines changed
278 1 hunks, 1 lines changed
279 examine changes to 'dir/a.txt'? [Ynesfdaq?] n
279 examine changes to 'dir/a.txt'? [Ynesfdaq?] n
280
280
281
281
282 After qrecord a.patch 'tip'"
282 After qrecord a.patch 'tip'"
283
283
284 $ hg tip -p
284 $ hg tip -p
285 changeset: 1:5d1ca63427ee
285 changeset: 1:5d1ca63427ee
286 tag: a.patch
286 tag: a.patch
287 tag: qbase
287 tag: qbase
288 tag: qtip
288 tag: qtip
289 tag: tip
289 tag: tip
290 user: test
290 user: test
291 date: Thu Jan 01 00:00:00 1970 +0000
291 date: Thu Jan 01 00:00:00 1970 +0000
292 summary: aaa
292 summary: aaa
293
293
294 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
294 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
295 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
295 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
296 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
296 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
297 @@ -1,5 +1,5 @@
297 @@ -1,5 +1,5 @@
298 1
298 1
299 -2
299 -2
300 +2 2
300 +2 2
301 3
301 3
302 4
302 4
303 5
303 5
304 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
304 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
305 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
305 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
306 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
306 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
307 @@ -1,5 +1,5 @@
307 @@ -1,5 +1,5 @@
308 a
308 a
309 -b
309 -b
310 +b b
310 +b b
311 c
311 c
312 d
312 d
313 e
313 e
314
314
315
315
316 After qrecord a.patch 'diff'"
316 After qrecord a.patch 'diff'"
317
317
318 $ hg diff --nodates
318 $ hg diff --nodates
319 diff -r 5d1ca63427ee 1.txt
319 diff -r 5d1ca63427ee 1.txt
320 --- a/1.txt
320 --- a/1.txt
321 +++ b/1.txt
321 +++ b/1.txt
322 @@ -1,5 +1,5 @@
322 @@ -1,5 +1,5 @@
323 1
323 1
324 2 2
324 2 2
325 3
325 3
326 -4
326 -4
327 +4 4
327 +4 4
328 5
328 5
329 diff -r 5d1ca63427ee dir/a.txt
329 diff -r 5d1ca63427ee dir/a.txt
330 --- a/dir/a.txt
330 --- a/dir/a.txt
331 +++ b/dir/a.txt
331 +++ b/dir/a.txt
332 @@ -1,4 +1,4 @@
332 @@ -1,4 +1,4 @@
333 -hello world
333 -hello world
334 +hello world!
334 +hello world!
335
335
336 someone
336 someone
337 up
337 up
338
338
339 qrecord b.patch
339 qrecord b.patch
340
340
341 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
341 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
342 > y
342 > y
343 > y
343 > y
344 > y
344 > y
345 > y
345 > y
346 > EOF
346 > EOF
347 diff --git a/1.txt b/1.txt
347 diff --git a/1.txt b/1.txt
348 1 hunks, 1 lines changed
348 1 hunks, 1 lines changed
349 examine changes to '1.txt'? [Ynesfdaq?] y
349 examine changes to '1.txt'? [Ynesfdaq?] y
350
350
351 @@ -1,5 +1,5 @@
351 @@ -1,5 +1,5 @@
352 1
352 1
353 2 2
353 2 2
354 3
354 3
355 -4
355 -4
356 +4 4
356 +4 4
357 5
357 5
358 record change 1/2 to '1.txt'? [Ynesfdaq?] y
358 record change 1/2 to '1.txt'? [Ynesfdaq?] y
359
359
360 diff --git a/dir/a.txt b/dir/a.txt
360 diff --git a/dir/a.txt b/dir/a.txt
361 1 hunks, 1 lines changed
361 1 hunks, 1 lines changed
362 examine changes to 'dir/a.txt'? [Ynesfdaq?] y
362 examine changes to 'dir/a.txt'? [Ynesfdaq?] y
363
363
364 @@ -1,4 +1,4 @@
364 @@ -1,4 +1,4 @@
365 -hello world
365 -hello world
366 +hello world!
366 +hello world!
367
367
368 someone
368 someone
369 up
369 up
370 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?] y
370 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?] y
371
371
372
372
373 After qrecord b.patch 'tip'
373 After qrecord b.patch 'tip'
374
374
375 $ hg tip -p
375 $ hg tip -p
376 changeset: 2:b056198bf878
376 changeset: 2:b056198bf878
377 tag: b.patch
377 tag: b.patch
378 tag: qtip
378 tag: qtip
379 tag: tip
379 tag: tip
380 user: test
380 user: test
381 date: Thu Jan 01 00:00:00 1970 +0000
381 date: Thu Jan 01 00:00:00 1970 +0000
382 summary: bbb
382 summary: bbb
383
383
384 diff -r 5d1ca63427ee -r b056198bf878 1.txt
384 diff -r 5d1ca63427ee -r b056198bf878 1.txt
385 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
385 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
386 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
386 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
387 @@ -1,5 +1,5 @@
387 @@ -1,5 +1,5 @@
388 1
388 1
389 2 2
389 2 2
390 3
390 3
391 -4
391 -4
392 +4 4
392 +4 4
393 5
393 5
394 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
394 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
395 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
395 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
396 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
396 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
397 @@ -1,4 +1,4 @@
397 @@ -1,4 +1,4 @@
398 -hello world
398 -hello world
399 +hello world!
399 +hello world!
400
400
401 someone
401 someone
402 up
402 up
403
403
404
404
405 After qrecord b.patch 'diff'
405 After qrecord b.patch 'diff'
406
406
407 $ hg diff --nodates
407 $ hg diff --nodates
408
408
409 $ cd ..
409 $ cd ..
@@ -1,87 +1,87 b''
1 Set up a repo
1 Set up a repo
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [ui]
4 > [ui]
5 > interactive = true
5 > interactive = true
6 > [extensions]
6 > [extensions]
7 > record =
7 > record =
8 > EOF
8 > EOF
9
9
10 $ hg init a
10 $ hg init a
11 $ cd a
11 $ cd a
12
12
13 Record help
13 Record help
14
14
15 $ hg record -h
15 $ hg record -h
16 hg record [OPTION]... [FILE]...
16 hg record [OPTION]... [FILE]...
17
17
18 interactively select changes to commit
18 interactively select changes to commit
19
19
20 If a list of files is omitted, all changes reported by "hg status" will be
20 If a list of files is omitted, all changes reported by 'hg status' will be
21 candidates for recording.
21 candidates for recording.
22
22
23 See "hg help dates" for a list of formats valid for -d/--date.
23 See 'hg help dates' for a list of formats valid for -d/--date.
24
24
25 You will be prompted for whether to record changes to each modified file,
25 You will be prompted for whether to record changes to each modified file,
26 and for files with multiple changes, for each change to use. For each
26 and for files with multiple changes, for each change to use. For each
27 query, the following responses are possible:
27 query, the following responses are possible:
28
28
29 y - record this change
29 y - record this change
30 n - skip this change
30 n - skip this change
31 e - edit this change manually
31 e - edit this change manually
32
32
33 s - skip remaining changes to this file
33 s - skip remaining changes to this file
34 f - record remaining changes to this file
34 f - record remaining changes to this file
35
35
36 d - done, skip remaining changes and files
36 d - done, skip remaining changes and files
37 a - record all changes to all remaining files
37 a - record all changes to all remaining files
38 q - quit, recording no changes
38 q - quit, recording no changes
39
39
40 ? - display help
40 ? - display help
41
41
42 This command is not available when committing a merge.
42 This command is not available when committing a merge.
43
43
44 options ([+] can be repeated):
44 options ([+] can be repeated):
45
45
46 -A --addremove mark new/missing files as added/removed before
46 -A --addremove mark new/missing files as added/removed before
47 committing
47 committing
48 --close-branch mark a branch head as closed
48 --close-branch mark a branch head as closed
49 --amend amend the parent of the working directory
49 --amend amend the parent of the working directory
50 -s --secret use the secret phase for committing
50 -s --secret use the secret phase for committing
51 -e --edit invoke editor on commit messages
51 -e --edit invoke editor on commit messages
52 -I --include PATTERN [+] include names matching the given patterns
52 -I --include PATTERN [+] include names matching the given patterns
53 -X --exclude PATTERN [+] exclude names matching the given patterns
53 -X --exclude PATTERN [+] exclude names matching the given patterns
54 -m --message TEXT use text as commit message
54 -m --message TEXT use text as commit message
55 -l --logfile FILE read commit message from file
55 -l --logfile FILE read commit message from file
56 -d --date DATE record the specified date as commit date
56 -d --date DATE record the specified date as commit date
57 -u --user USER record the specified user as committer
57 -u --user USER record the specified user as committer
58 -S --subrepos recurse into subrepositories
58 -S --subrepos recurse into subrepositories
59 -w --ignore-all-space ignore white space when comparing lines
59 -w --ignore-all-space ignore white space when comparing lines
60 -b --ignore-space-change ignore changes in the amount of white space
60 -b --ignore-space-change ignore changes in the amount of white space
61 -B --ignore-blank-lines ignore changes whose lines are all blank
61 -B --ignore-blank-lines ignore changes whose lines are all blank
62
62
63 (some details hidden, use --verbose to show complete help)
63 (some details hidden, use --verbose to show complete help)
64
64
65 Select no files
65 Select no files
66
66
67 $ touch empty-rw
67 $ touch empty-rw
68 $ hg add empty-rw
68 $ hg add empty-rw
69
69
70 $ hg record empty-rw<<EOF
70 $ hg record empty-rw<<EOF
71 > n
71 > n
72 > EOF
72 > EOF
73 diff --git a/empty-rw b/empty-rw
73 diff --git a/empty-rw b/empty-rw
74 new file mode 100644
74 new file mode 100644
75 examine changes to 'empty-rw'? [Ynesfdaq?] n
75 examine changes to 'empty-rw'? [Ynesfdaq?] n
76
76
77 no changes to record
77 no changes to record
78
78
79 $ hg tip -p
79 $ hg tip -p
80 changeset: -1:000000000000
80 changeset: -1:000000000000
81 tag: tip
81 tag: tip
82 user:
82 user:
83 date: Thu Jan 01 00:00:00 1970 +0000
83 date: Thu Jan 01 00:00:00 1970 +0000
84
84
85
85
86
86
87
87
General Comments 0
You need to be logged in to leave comments. Login now