Show More
@@ -1,781 +1,795 b'' | |||
|
1 | 1 | # minirst.py - minimal reStructuredText parser |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2009, 2010 Matt Mackall <mpm@selenic.com> and others |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | """simplified reStructuredText parser. |
|
9 | 9 | |
|
10 | 10 | This parser knows just enough about reStructuredText to parse the |
|
11 | 11 | Mercurial docstrings. |
|
12 | 12 | |
|
13 | 13 | It cheats in a major way: nested blocks are not really nested. They |
|
14 | 14 | are just indented blocks that look like they are nested. This relies |
|
15 | 15 | on the user to keep the right indentation for the blocks. |
|
16 | 16 | |
|
17 | 17 | Remember to update http://mercurial.selenic.com/wiki/HelpStyleGuide |
|
18 | 18 | when adding support for new constructs. |
|
19 | 19 | """ |
|
20 | 20 | |
|
21 | 21 | from __future__ import absolute_import |
|
22 | 22 | |
|
23 | 23 | import cgi |
|
24 | 24 | import re |
|
25 | 25 | |
|
26 | 26 | from .i18n import _ |
|
27 | 27 | from . import ( |
|
28 | 28 | encoding, |
|
29 | 29 | util, |
|
30 | 30 | ) |
|
31 | 31 | |
|
32 | 32 | def section(s): |
|
33 | 33 | return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s)) |
|
34 | 34 | |
|
35 | 35 | def subsection(s): |
|
36 | 36 | return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s)) |
|
37 | 37 | |
|
38 | 38 | def subsubsection(s): |
|
39 | 39 | return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)) |
|
40 | 40 | |
|
41 | 41 | def subsubsubsection(s): |
|
42 | 42 | return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s)) |
|
43 | 43 | |
|
44 | 44 | def replace(text, substs): |
|
45 | 45 | ''' |
|
46 | 46 | Apply a list of (find, replace) pairs to a text. |
|
47 | 47 | |
|
48 | 48 | >>> replace("foo bar", [('f', 'F'), ('b', 'B')]) |
|
49 | 49 | 'Foo Bar' |
|
50 | 50 | >>> encoding.encoding = 'latin1' |
|
51 | 51 | >>> replace('\\x81\\\\', [('\\\\', '/')]) |
|
52 | 52 | '\\x81/' |
|
53 | 53 | >>> encoding.encoding = 'shiftjis' |
|
54 | 54 | >>> replace('\\x81\\\\', [('\\\\', '/')]) |
|
55 | 55 | '\\x81\\\\' |
|
56 | 56 | ''' |
|
57 | 57 | |
|
58 | 58 | # some character encodings (cp932 for Japanese, at least) use |
|
59 | 59 | # ASCII characters other than control/alphabet/digit as a part of |
|
60 | 60 | # multi-bytes characters, so direct replacing with such characters |
|
61 | 61 | # on strings in local encoding causes invalid byte sequences. |
|
62 | 62 | utext = text.decode(encoding.encoding) |
|
63 | 63 | for f, t in substs: |
|
64 | 64 | utext = utext.replace(f.decode("ascii"), t.decode("ascii")) |
|
65 | 65 | return utext.encode(encoding.encoding) |
|
66 | 66 | |
|
67 | 67 | _blockre = re.compile(r"\n(?:\s*\n)+") |
|
68 | 68 | |
|
69 | 69 | def findblocks(text): |
|
70 | 70 | """Find continuous blocks of lines in text. |
|
71 | 71 | |
|
72 | 72 | Returns a list of dictionaries representing the blocks. Each block |
|
73 | 73 | has an 'indent' field and a 'lines' field. |
|
74 | 74 | """ |
|
75 | 75 | blocks = [] |
|
76 | 76 | for b in _blockre.split(text.lstrip('\n').rstrip()): |
|
77 | 77 | lines = b.splitlines() |
|
78 | 78 | if lines: |
|
79 | 79 | indent = min((len(l) - len(l.lstrip())) for l in lines) |
|
80 | 80 | lines = [l[indent:] for l in lines] |
|
81 | 81 | blocks.append({'indent': indent, 'lines': lines}) |
|
82 | 82 | return blocks |
|
83 | 83 | |
|
84 | 84 | def findliteralblocks(blocks): |
|
85 | 85 | """Finds literal blocks and adds a 'type' field to the blocks. |
|
86 | 86 | |
|
87 | 87 | Literal blocks are given the type 'literal', all other blocks are |
|
88 | 88 | given type the 'paragraph'. |
|
89 | 89 | """ |
|
90 | 90 | i = 0 |
|
91 | 91 | while i < len(blocks): |
|
92 | 92 | # Searching for a block that looks like this: |
|
93 | 93 | # |
|
94 | 94 | # +------------------------------+ |
|
95 | 95 | # | paragraph | |
|
96 | 96 | # | (ends with "::") | |
|
97 | 97 | # +------------------------------+ |
|
98 | 98 | # +---------------------------+ |
|
99 | 99 | # | indented literal block | |
|
100 | 100 | # +---------------------------+ |
|
101 | 101 | blocks[i]['type'] = 'paragraph' |
|
102 | 102 | if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks): |
|
103 | 103 | indent = blocks[i]['indent'] |
|
104 | 104 | adjustment = blocks[i + 1]['indent'] - indent |
|
105 | 105 | |
|
106 | 106 | if blocks[i]['lines'] == ['::']: |
|
107 | 107 | # Expanded form: remove block |
|
108 | 108 | del blocks[i] |
|
109 | 109 | i -= 1 |
|
110 | 110 | elif blocks[i]['lines'][-1].endswith(' ::'): |
|
111 | 111 | # Partially minimized form: remove space and both |
|
112 | 112 | # colons. |
|
113 | 113 | blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3] |
|
114 | 114 | elif len(blocks[i]['lines']) == 1 and \ |
|
115 | 115 | blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \ |
|
116 | 116 | blocks[i]['lines'][0].find(' ', 3) == -1: |
|
117 | 117 | # directive on its own line, not a literal block |
|
118 | 118 | i += 1 |
|
119 | 119 | continue |
|
120 | 120 | else: |
|
121 | 121 | # Fully minimized form: remove just one colon. |
|
122 | 122 | blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1] |
|
123 | 123 | |
|
124 | 124 | # List items are formatted with a hanging indent. We must |
|
125 | 125 | # correct for this here while we still have the original |
|
126 | 126 | # information on the indentation of the subsequent literal |
|
127 | 127 | # blocks available. |
|
128 | 128 | m = _bulletre.match(blocks[i]['lines'][0]) |
|
129 | 129 | if m: |
|
130 | 130 | indent += m.end() |
|
131 | 131 | adjustment -= m.end() |
|
132 | 132 | |
|
133 | 133 | # Mark the following indented blocks. |
|
134 | 134 | while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent: |
|
135 | 135 | blocks[i + 1]['type'] = 'literal' |
|
136 | 136 | blocks[i + 1]['indent'] -= adjustment |
|
137 | 137 | i += 1 |
|
138 | 138 | i += 1 |
|
139 | 139 | return blocks |
|
140 | 140 | |
|
141 | 141 | _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ') |
|
142 | 142 | _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)' |
|
143 | 143 | r'((.*) +)(.*)$') |
|
144 | 144 | _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)') |
|
145 | 145 | _definitionre = re.compile(r'[^ ]') |
|
146 | 146 | _tablere = re.compile(r'(=+\s+)*=+') |
|
147 | 147 | |
|
148 | 148 | def splitparagraphs(blocks): |
|
149 | 149 | """Split paragraphs into lists.""" |
|
150 | 150 | # Tuples with (list type, item regexp, single line items?). Order |
|
151 | 151 | # matters: definition lists has the least specific regexp and must |
|
152 | 152 | # come last. |
|
153 | 153 | listtypes = [('bullet', _bulletre, True), |
|
154 | 154 | ('option', _optionre, True), |
|
155 | 155 | ('field', _fieldre, True), |
|
156 | 156 | ('definition', _definitionre, False)] |
|
157 | 157 | |
|
158 | 158 | def match(lines, i, itemre, singleline): |
|
159 | 159 | """Does itemre match an item at line i? |
|
160 | 160 | |
|
161 | 161 | A list item can be followed by an indented line or another list |
|
162 | 162 | item (but only if singleline is True). |
|
163 | 163 | """ |
|
164 | 164 | line1 = lines[i] |
|
165 | 165 | line2 = i + 1 < len(lines) and lines[i + 1] or '' |
|
166 | 166 | if not itemre.match(line1): |
|
167 | 167 | return False |
|
168 | 168 | if singleline: |
|
169 | 169 | return line2 == '' or line2[0] == ' ' or itemre.match(line2) |
|
170 | 170 | else: |
|
171 | 171 | return line2.startswith(' ') |
|
172 | 172 | |
|
173 | 173 | i = 0 |
|
174 | 174 | while i < len(blocks): |
|
175 | 175 | if blocks[i]['type'] == 'paragraph': |
|
176 | 176 | lines = blocks[i]['lines'] |
|
177 | 177 | for type, itemre, singleline in listtypes: |
|
178 | 178 | if match(lines, 0, itemre, singleline): |
|
179 | 179 | items = [] |
|
180 | 180 | for j, line in enumerate(lines): |
|
181 | 181 | if match(lines, j, itemre, singleline): |
|
182 | 182 | items.append({'type': type, 'lines': [], |
|
183 | 183 | 'indent': blocks[i]['indent']}) |
|
184 | 184 | items[-1]['lines'].append(line) |
|
185 | 185 | blocks[i:i + 1] = items |
|
186 | 186 | break |
|
187 | 187 | i += 1 |
|
188 | 188 | return blocks |
|
189 | 189 | |
|
190 | 190 | _fieldwidth = 14 |
|
191 | 191 | |
|
192 | 192 | def updatefieldlists(blocks): |
|
193 | 193 | """Find key for field lists.""" |
|
194 | 194 | i = 0 |
|
195 | 195 | while i < len(blocks): |
|
196 | 196 | if blocks[i]['type'] != 'field': |
|
197 | 197 | i += 1 |
|
198 | 198 | continue |
|
199 | 199 | |
|
200 | 200 | j = i |
|
201 | 201 | while j < len(blocks) and blocks[j]['type'] == 'field': |
|
202 | 202 | m = _fieldre.match(blocks[j]['lines'][0]) |
|
203 | 203 | key, rest = m.groups() |
|
204 | 204 | blocks[j]['lines'][0] = rest |
|
205 | 205 | blocks[j]['key'] = key |
|
206 | 206 | j += 1 |
|
207 | 207 | |
|
208 | 208 | i = j + 1 |
|
209 | 209 | |
|
210 | 210 | return blocks |
|
211 | 211 | |
|
212 | 212 | def updateoptionlists(blocks): |
|
213 | 213 | i = 0 |
|
214 | 214 | while i < len(blocks): |
|
215 | 215 | if blocks[i]['type'] != 'option': |
|
216 | 216 | i += 1 |
|
217 | 217 | continue |
|
218 | 218 | |
|
219 | 219 | optstrwidth = 0 |
|
220 | 220 | j = i |
|
221 | 221 | while j < len(blocks) and blocks[j]['type'] == 'option': |
|
222 | 222 | m = _optionre.match(blocks[j]['lines'][0]) |
|
223 | 223 | |
|
224 | 224 | shortoption = m.group(2) |
|
225 | 225 | group3 = m.group(3) |
|
226 | 226 | longoption = group3[2:].strip() |
|
227 | 227 | desc = m.group(6).strip() |
|
228 | 228 | longoptionarg = m.group(5).strip() |
|
229 | 229 | blocks[j]['lines'][0] = desc |
|
230 | 230 | |
|
231 | 231 | noshortop = '' |
|
232 | 232 | if not shortoption: |
|
233 | 233 | noshortop = ' ' |
|
234 | 234 | |
|
235 | 235 | opt = "%s%s" % (shortoption and "-%s " % shortoption or '', |
|
236 | 236 | ("%s--%s %s") % (noshortop, longoption, |
|
237 | 237 | longoptionarg)) |
|
238 | 238 | opt = opt.rstrip() |
|
239 | 239 | blocks[j]['optstr'] = opt |
|
240 | 240 | optstrwidth = max(optstrwidth, encoding.colwidth(opt)) |
|
241 | 241 | j += 1 |
|
242 | 242 | |
|
243 | 243 | for block in blocks[i:j]: |
|
244 | 244 | block['optstrwidth'] = optstrwidth |
|
245 | 245 | i = j + 1 |
|
246 | 246 | return blocks |
|
247 | 247 | |
|
248 | 248 | def prunecontainers(blocks, keep): |
|
249 | 249 | """Prune unwanted containers. |
|
250 | 250 | |
|
251 | 251 | The blocks must have a 'type' field, i.e., they should have been |
|
252 | 252 | run through findliteralblocks first. |
|
253 | 253 | """ |
|
254 | 254 | pruned = [] |
|
255 | 255 | i = 0 |
|
256 | 256 | while i + 1 < len(blocks): |
|
257 | 257 | # Searching for a block that looks like this: |
|
258 | 258 | # |
|
259 | 259 | # +-------+---------------------------+ |
|
260 | 260 | # | ".. container ::" type | |
|
261 | 261 | # +---+ | |
|
262 | 262 | # | blocks | |
|
263 | 263 | # +-------------------------------+ |
|
264 | 264 | if (blocks[i]['type'] == 'paragraph' and |
|
265 | 265 | blocks[i]['lines'][0].startswith('.. container::')): |
|
266 | 266 | indent = blocks[i]['indent'] |
|
267 | 267 | adjustment = blocks[i + 1]['indent'] - indent |
|
268 | 268 | containertype = blocks[i]['lines'][0][15:] |
|
269 | 269 | prune = True |
|
270 | 270 | for c in keep: |
|
271 | 271 | if c in containertype.split('.'): |
|
272 | 272 | prune = False |
|
273 | 273 | if prune: |
|
274 | 274 | pruned.append(containertype) |
|
275 | 275 | |
|
276 | 276 | # Always delete "..container:: type" block |
|
277 | 277 | del blocks[i] |
|
278 | 278 | j = i |
|
279 | 279 | i -= 1 |
|
280 | 280 | while j < len(blocks) and blocks[j]['indent'] > indent: |
|
281 | 281 | if prune: |
|
282 | 282 | del blocks[j] |
|
283 | 283 | else: |
|
284 | 284 | blocks[j]['indent'] -= adjustment |
|
285 | 285 | j += 1 |
|
286 | 286 | i += 1 |
|
287 | 287 | return blocks, pruned |
|
288 | 288 | |
|
289 | 289 | _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""") |
|
290 | 290 | |
|
291 | 291 | def findtables(blocks): |
|
292 | 292 | '''Find simple tables |
|
293 | 293 | |
|
294 | 294 | Only simple one-line table elements are supported |
|
295 | 295 | ''' |
|
296 | 296 | |
|
297 | 297 | for block in blocks: |
|
298 | 298 | # Searching for a block that looks like this: |
|
299 | 299 | # |
|
300 | 300 | # === ==== === |
|
301 | 301 | # A B C |
|
302 | 302 | # === ==== === <- optional |
|
303 | 303 | # 1 2 3 |
|
304 | 304 | # x y z |
|
305 | 305 | # === ==== === |
|
306 | 306 | if (block['type'] == 'paragraph' and |
|
307 | 307 | len(block['lines']) > 2 and |
|
308 | 308 | _tablere.match(block['lines'][0]) and |
|
309 | 309 | block['lines'][0] == block['lines'][-1]): |
|
310 | 310 | block['type'] = 'table' |
|
311 | 311 | block['header'] = False |
|
312 | 312 | div = block['lines'][0] |
|
313 | 313 | |
|
314 | 314 | # column markers are ASCII so we can calculate column |
|
315 | 315 | # position in bytes |
|
316 | 316 | columns = [x for x in xrange(len(div)) |
|
317 | 317 | if div[x] == '=' and (x == 0 or div[x - 1] == ' ')] |
|
318 | 318 | rows = [] |
|
319 | 319 | for l in block['lines'][1:-1]: |
|
320 | 320 | if l == div: |
|
321 | 321 | block['header'] = True |
|
322 | 322 | continue |
|
323 | 323 | row = [] |
|
324 | 324 | # we measure columns not in bytes or characters but in |
|
325 | 325 | # colwidth which makes things tricky |
|
326 | 326 | pos = columns[0] # leading whitespace is bytes |
|
327 | 327 | for n, start in enumerate(columns): |
|
328 | 328 | if n + 1 < len(columns): |
|
329 | 329 | width = columns[n + 1] - start |
|
330 | 330 | v = encoding.getcols(l, pos, width) # gather columns |
|
331 | 331 | pos += len(v) # calculate byte position of end |
|
332 | 332 | row.append(v.strip()) |
|
333 | 333 | else: |
|
334 | 334 | row.append(l[pos:].strip()) |
|
335 | 335 | rows.append(row) |
|
336 | 336 | |
|
337 | 337 | block['table'] = rows |
|
338 | 338 | |
|
339 | 339 | return blocks |
|
340 | 340 | |
|
341 | 341 | def findsections(blocks): |
|
342 | 342 | """Finds sections. |
|
343 | 343 | |
|
344 | 344 | The blocks must have a 'type' field, i.e., they should have been |
|
345 | 345 | run through findliteralblocks first. |
|
346 | 346 | """ |
|
347 | 347 | for block in blocks: |
|
348 | 348 | # Searching for a block that looks like this: |
|
349 | 349 | # |
|
350 | 350 | # +------------------------------+ |
|
351 | 351 | # | Section title | |
|
352 | 352 | # | ------------- | |
|
353 | 353 | # +------------------------------+ |
|
354 | 354 | if (block['type'] == 'paragraph' and |
|
355 | 355 | len(block['lines']) == 2 and |
|
356 | 356 | encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and |
|
357 | 357 | _sectionre.match(block['lines'][1])): |
|
358 | 358 | block['underline'] = block['lines'][1][0] |
|
359 | 359 | block['type'] = 'section' |
|
360 | 360 | del block['lines'][1] |
|
361 | 361 | return blocks |
|
362 | 362 | |
|
363 | 363 | def inlineliterals(blocks): |
|
364 | 364 | substs = [('``', '"')] |
|
365 | 365 | for b in blocks: |
|
366 | 366 | if b['type'] in ('paragraph', 'section'): |
|
367 | 367 | b['lines'] = [replace(l, substs) for l in b['lines']] |
|
368 | 368 | return blocks |
|
369 | 369 | |
|
370 | 370 | def hgrole(blocks): |
|
371 | 371 | substs = [(':hg:`', '"hg '), ('`', '"')] |
|
372 | 372 | for b in blocks: |
|
373 | 373 | if b['type'] in ('paragraph', 'section'): |
|
374 | 374 | # Turn :hg:`command` into "hg command". This also works |
|
375 | 375 | # when there is a line break in the command and relies on |
|
376 | 376 | # the fact that we have no stray back-quotes in the input |
|
377 | 377 | # (run the blocks through inlineliterals first). |
|
378 | 378 | b['lines'] = [replace(l, substs) for l in b['lines']] |
|
379 | 379 | return blocks |
|
380 | 380 | |
|
381 | 381 | def addmargins(blocks): |
|
382 | 382 | """Adds empty blocks for vertical spacing. |
|
383 | 383 | |
|
384 | 384 | This groups bullets, options, and definitions together with no vertical |
|
385 | 385 | space between them, and adds an empty block between all other blocks. |
|
386 | 386 | """ |
|
387 | 387 | i = 1 |
|
388 | 388 | while i < len(blocks): |
|
389 | 389 | if (blocks[i]['type'] == blocks[i - 1]['type'] and |
|
390 | 390 | blocks[i]['type'] in ('bullet', 'option', 'field')): |
|
391 | 391 | i += 1 |
|
392 | 392 | elif not blocks[i - 1]['lines']: |
|
393 | 393 | # no lines in previous block, do not separate |
|
394 | 394 | i += 1 |
|
395 | 395 | else: |
|
396 | 396 | blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'}) |
|
397 | 397 | i += 2 |
|
398 | 398 | return blocks |
|
399 | 399 | |
|
400 | 400 | def prunecomments(blocks): |
|
401 | 401 | """Remove comments.""" |
|
402 | 402 | i = 0 |
|
403 | 403 | while i < len(blocks): |
|
404 | 404 | b = blocks[i] |
|
405 | 405 | if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or |
|
406 | 406 | b['lines'] == ['..']): |
|
407 | 407 | del blocks[i] |
|
408 | 408 | if i < len(blocks) and blocks[i]['type'] == 'margin': |
|
409 | 409 | del blocks[i] |
|
410 | 410 | else: |
|
411 | 411 | i += 1 |
|
412 | 412 | return blocks |
|
413 | 413 | |
|
414 | 414 | _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|" |
|
415 | 415 | r"error|hint|important|note|tip|warning)::", |
|
416 | 416 | flags=re.IGNORECASE) |
|
417 | 417 | |
|
418 | 418 | def findadmonitions(blocks): |
|
419 | 419 | """ |
|
420 | 420 | Makes the type of the block an admonition block if |
|
421 | 421 | the first line is an admonition directive |
|
422 | 422 | """ |
|
423 | 423 | i = 0 |
|
424 | 424 | while i < len(blocks): |
|
425 | 425 | m = _admonitionre.match(blocks[i]['lines'][0]) |
|
426 | 426 | if m: |
|
427 | 427 | blocks[i]['type'] = 'admonition' |
|
428 | 428 | admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower() |
|
429 | 429 | |
|
430 | 430 | firstline = blocks[i]['lines'][0][m.end() + 1:] |
|
431 | 431 | if firstline: |
|
432 | 432 | blocks[i]['lines'].insert(1, ' ' + firstline) |
|
433 | 433 | |
|
434 | 434 | blocks[i]['admonitiontitle'] = admonitiontitle |
|
435 | 435 | del blocks[i]['lines'][0] |
|
436 | 436 | i = i + 1 |
|
437 | 437 | return blocks |
|
438 | 438 | |
|
439 | 439 | _admonitiontitles = {'attention': _('Attention:'), |
|
440 | 440 | 'caution': _('Caution:'), |
|
441 | 441 | 'danger': _('!Danger!') , |
|
442 | 442 | 'error': _('Error:'), |
|
443 | 443 | 'hint': _('Hint:'), |
|
444 | 444 | 'important': _('Important:'), |
|
445 | 445 | 'note': _('Note:'), |
|
446 | 446 | 'tip': _('Tip:'), |
|
447 | 447 | 'warning': _('Warning!')} |
|
448 | 448 | |
|
449 | 449 | def formatoption(block, width): |
|
450 | 450 | desc = ' '.join(map(str.strip, block['lines'])) |
|
451 | 451 | colwidth = encoding.colwidth(block['optstr']) |
|
452 | 452 | usablewidth = width - 1 |
|
453 | 453 | hanging = block['optstrwidth'] |
|
454 | 454 | initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth))) |
|
455 | 455 | hangindent = ' ' * (encoding.colwidth(initindent) + 1) |
|
456 | 456 | return ' %s\n' % (util.wrap(desc, usablewidth, |
|
457 | 457 | initindent=initindent, |
|
458 | 458 | hangindent=hangindent)) |
|
459 | 459 | |
|
460 | 460 | def formatblock(block, width): |
|
461 | 461 | """Format a block according to width.""" |
|
462 | 462 | if width <= 0: |
|
463 | 463 | width = 78 |
|
464 | 464 | indent = ' ' * block['indent'] |
|
465 | 465 | if block['type'] == 'admonition': |
|
466 | 466 | admonition = _admonitiontitles[block['admonitiontitle']] |
|
467 | 467 | if not block['lines']: |
|
468 | 468 | return indent + admonition + '\n' |
|
469 | 469 | hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) |
|
470 | 470 | |
|
471 | 471 | defindent = indent + hang * ' ' |
|
472 | 472 | text = ' '.join(map(str.strip, block['lines'])) |
|
473 | 473 | return '%s\n%s\n' % (indent + admonition, |
|
474 | 474 | util.wrap(text, width=width, |
|
475 | 475 | initindent=defindent, |
|
476 | 476 | hangindent=defindent)) |
|
477 | 477 | if block['type'] == 'margin': |
|
478 | 478 | return '\n' |
|
479 | 479 | if block['type'] == 'literal': |
|
480 | 480 | indent += ' ' |
|
481 | 481 | return indent + ('\n' + indent).join(block['lines']) + '\n' |
|
482 | 482 | if block['type'] == 'section': |
|
483 | 483 | underline = encoding.colwidth(block['lines'][0]) * block['underline'] |
|
484 | 484 | return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline) |
|
485 | 485 | if block['type'] == 'table': |
|
486 | 486 | table = block['table'] |
|
487 | 487 | # compute column widths |
|
488 | 488 | widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)] |
|
489 | 489 | text = '' |
|
490 | 490 | span = sum(widths) + len(widths) - 1 |
|
491 | 491 | indent = ' ' * block['indent'] |
|
492 | 492 | hang = ' ' * (len(indent) + span - widths[-1]) |
|
493 | 493 | |
|
494 | 494 | for row in table: |
|
495 | 495 | l = [] |
|
496 | 496 | for w, v in zip(widths, row): |
|
497 | 497 | pad = ' ' * (w - encoding.colwidth(v)) |
|
498 | 498 | l.append(v + pad) |
|
499 | 499 | l = ' '.join(l) |
|
500 | 500 | l = util.wrap(l, width=width, initindent=indent, hangindent=hang) |
|
501 | 501 | if not text and block['header']: |
|
502 | 502 | text = l + '\n' + indent + '-' * (min(width, span)) + '\n' |
|
503 | 503 | else: |
|
504 | 504 | text += l + "\n" |
|
505 | 505 | return text |
|
506 | 506 | if block['type'] == 'definition': |
|
507 | 507 | term = indent + block['lines'][0] |
|
508 | 508 | hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) |
|
509 | 509 | defindent = indent + hang * ' ' |
|
510 | 510 | text = ' '.join(map(str.strip, block['lines'][1:])) |
|
511 | 511 | return '%s\n%s\n' % (term, util.wrap(text, width=width, |
|
512 | 512 | initindent=defindent, |
|
513 | 513 | hangindent=defindent)) |
|
514 | 514 | subindent = indent |
|
515 | 515 | if block['type'] == 'bullet': |
|
516 | 516 | if block['lines'][0].startswith('| '): |
|
517 | 517 | # Remove bullet for line blocks and add no extra |
|
518 | 518 | # indention. |
|
519 | 519 | block['lines'][0] = block['lines'][0][2:] |
|
520 | 520 | else: |
|
521 | 521 | m = _bulletre.match(block['lines'][0]) |
|
522 | 522 | subindent = indent + m.end() * ' ' |
|
523 | 523 | elif block['type'] == 'field': |
|
524 | 524 | key = block['key'] |
|
525 | 525 | subindent = indent + _fieldwidth * ' ' |
|
526 | 526 | if len(key) + 2 > _fieldwidth: |
|
527 | 527 | # key too large, use full line width |
|
528 | 528 | key = key.ljust(width) |
|
529 | 529 | else: |
|
530 | 530 | # key fits within field width |
|
531 | 531 | key = key.ljust(_fieldwidth) |
|
532 | 532 | block['lines'][0] = key + block['lines'][0] |
|
533 | 533 | elif block['type'] == 'option': |
|
534 | 534 | return formatoption(block, width) |
|
535 | 535 | |
|
536 | 536 | text = ' '.join(map(str.strip, block['lines'])) |
|
537 | 537 | return util.wrap(text, width=width, |
|
538 | 538 | initindent=indent, |
|
539 | 539 | hangindent=subindent) + '\n' |
|
540 | 540 | |
|
541 | 541 | def formathtml(blocks): |
|
542 | 542 | """Format RST blocks as HTML""" |
|
543 | 543 | |
|
544 | 544 | out = [] |
|
545 | 545 | headernest = '' |
|
546 | 546 | listnest = [] |
|
547 | 547 | |
|
548 | 548 | def escape(s): |
|
549 | 549 | return cgi.escape(s, True) |
|
550 | 550 | |
|
551 | 551 | def openlist(start, level): |
|
552 | 552 | if not listnest or listnest[-1][0] != start: |
|
553 | 553 | listnest.append((start, level)) |
|
554 | 554 | out.append('<%s>\n' % start) |
|
555 | 555 | |
|
556 | 556 | blocks = [b for b in blocks if b['type'] != 'margin'] |
|
557 | 557 | |
|
558 | 558 | for pos, b in enumerate(blocks): |
|
559 | 559 | btype = b['type'] |
|
560 | 560 | level = b['indent'] |
|
561 | 561 | lines = b['lines'] |
|
562 | 562 | |
|
563 | 563 | if btype == 'admonition': |
|
564 | 564 | admonition = escape(_admonitiontitles[b['admonitiontitle']]) |
|
565 | 565 | text = escape(' '.join(map(str.strip, lines))) |
|
566 | 566 | out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text)) |
|
567 | 567 | elif btype == 'paragraph': |
|
568 | 568 | out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines))) |
|
569 | 569 | elif btype == 'margin': |
|
570 | 570 | pass |
|
571 | 571 | elif btype == 'literal': |
|
572 | 572 | out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines))) |
|
573 | 573 | elif btype == 'section': |
|
574 | 574 | i = b['underline'] |
|
575 | 575 | if i not in headernest: |
|
576 | 576 | headernest += i |
|
577 | 577 | level = headernest.index(i) + 1 |
|
578 | 578 | out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level)) |
|
579 | 579 | elif btype == 'table': |
|
580 | 580 | table = b['table'] |
|
581 | 581 | out.append('<table>\n') |
|
582 | 582 | for row in table: |
|
583 | 583 | out.append('<tr>') |
|
584 | 584 | for v in row: |
|
585 | 585 | out.append('<td>') |
|
586 | 586 | out.append(escape(v)) |
|
587 | 587 | out.append('</td>') |
|
588 | 588 | out.append('\n') |
|
589 | 589 | out.pop() |
|
590 | 590 | out.append('</tr>\n') |
|
591 | 591 | out.append('</table>\n') |
|
592 | 592 | elif btype == 'definition': |
|
593 | 593 | openlist('dl', level) |
|
594 | 594 | term = escape(lines[0]) |
|
595 | 595 | text = escape(' '.join(map(str.strip, lines[1:]))) |
|
596 | 596 | out.append(' <dt>%s\n <dd>%s\n' % (term, text)) |
|
597 | 597 | elif btype == 'bullet': |
|
598 | 598 | bullet, head = lines[0].split(' ', 1) |
|
599 | 599 | if bullet == '-': |
|
600 | 600 | openlist('ul', level) |
|
601 | 601 | else: |
|
602 | 602 | openlist('ol', level) |
|
603 | 603 | out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:]))) |
|
604 | 604 | elif btype == 'field': |
|
605 | 605 | openlist('dl', level) |
|
606 | 606 | key = escape(b['key']) |
|
607 | 607 | text = escape(' '.join(map(str.strip, lines))) |
|
608 | 608 | out.append(' <dt>%s\n <dd>%s\n' % (key, text)) |
|
609 | 609 | elif btype == 'option': |
|
610 | 610 | openlist('dl', level) |
|
611 | 611 | opt = escape(b['optstr']) |
|
612 | 612 | desc = escape(' '.join(map(str.strip, lines))) |
|
613 | 613 | out.append(' <dt>%s\n <dd>%s\n' % (opt, desc)) |
|
614 | 614 | |
|
615 | 615 | # close lists if indent level of next block is lower |
|
616 | 616 | if listnest: |
|
617 | 617 | start, level = listnest[-1] |
|
618 | 618 | if pos == len(blocks) - 1: |
|
619 | 619 | out.append('</%s>\n' % start) |
|
620 | 620 | listnest.pop() |
|
621 | 621 | else: |
|
622 | 622 | nb = blocks[pos + 1] |
|
623 | 623 | ni = nb['indent'] |
|
624 | 624 | if (ni < level or |
|
625 | 625 | (ni == level and |
|
626 | 626 | nb['type'] not in 'definition bullet field option')): |
|
627 | 627 | out.append('</%s>\n' % start) |
|
628 | 628 | listnest.pop() |
|
629 | 629 | |
|
630 | 630 | return ''.join(out) |
|
631 | 631 | |
|
632 | 632 | def parse(text, indent=0, keep=None): |
|
633 | 633 | """Parse text into a list of blocks""" |
|
634 | 634 | pruned = [] |
|
635 | 635 | blocks = findblocks(text) |
|
636 | 636 | for b in blocks: |
|
637 | 637 | b['indent'] += indent |
|
638 | 638 | blocks = findliteralblocks(blocks) |
|
639 | 639 | blocks = findtables(blocks) |
|
640 | 640 | blocks, pruned = prunecontainers(blocks, keep or []) |
|
641 | 641 | blocks = findsections(blocks) |
|
642 | 642 | blocks = inlineliterals(blocks) |
|
643 | 643 | blocks = hgrole(blocks) |
|
644 | 644 | blocks = splitparagraphs(blocks) |
|
645 | 645 | blocks = updatefieldlists(blocks) |
|
646 | 646 | blocks = updateoptionlists(blocks) |
|
647 | 647 | blocks = findadmonitions(blocks) |
|
648 | 648 | blocks = addmargins(blocks) |
|
649 | 649 | blocks = prunecomments(blocks) |
|
650 | 650 | return blocks, pruned |
|
651 | 651 | |
|
652 | 652 | def formatblocks(blocks, width): |
|
653 | 653 | text = ''.join(formatblock(b, width) for b in blocks) |
|
654 | 654 | return text |
|
655 | 655 | |
|
656 | 656 | def format(text, width=80, indent=0, keep=None, style='plain', section=None): |
|
657 | 657 | """Parse and format the text according to width.""" |
|
658 | 658 | blocks, pruned = parse(text, indent, keep or []) |
|
659 | 659 | parents = [] |
|
660 | 660 | if section: |
|
661 | 661 | sections = getsections(blocks) |
|
662 | 662 | blocks = [] |
|
663 | 663 | i = 0 |
|
664 | 664 | while i < len(sections): |
|
665 | 665 | name, nest, b = sections[i] |
|
666 | 666 | del parents[nest:] |
|
667 | 667 | parents.append(name) |
|
668 | 668 | if name == section: |
|
669 | 669 | b[0]['path'] = parents[3:] |
|
670 | 670 | blocks.extend(b) |
|
671 | 671 | |
|
672 | 672 | ## Also show all subnested sections |
|
673 | 673 | while i + 1 < len(sections) and sections[i + 1][1] > nest: |
|
674 | 674 | i += 1 |
|
675 | 675 | blocks.extend(sections[i][2]) |
|
676 | 676 | i += 1 |
|
677 | 677 | |
|
678 | 678 | if style == 'html': |
|
679 | 679 | text = formathtml(blocks) |
|
680 | 680 | else: |
|
681 | 681 | if len([b for b in blocks if b['type'] == 'definition']) > 1: |
|
682 | 682 | i = 0 |
|
683 | 683 | while i < len(blocks): |
|
684 | 684 | if blocks[i]['type'] == 'definition': |
|
685 | 685 | if 'path' in blocks[i]: |
|
686 | 686 | blocks[i]['lines'][0] = '"%s"' % '.'.join( |
|
687 | 687 | blocks[i]['path']) |
|
688 | 688 | i += 1 |
|
689 | 689 | text = ''.join(formatblock(b, width) for b in blocks) |
|
690 | 690 | if keep is None: |
|
691 | 691 | return text |
|
692 | 692 | else: |
|
693 | 693 | return text, pruned |
|
694 | 694 | |
|
695 | 695 | def getsections(blocks): |
|
696 | 696 | '''return a list of (section name, nesting level, blocks) tuples''' |
|
697 | 697 | nest = "" |
|
698 | 698 | level = 0 |
|
699 | 699 | secs = [] |
|
700 | 700 | |
|
701 | 701 | def getname(b): |
|
702 | 702 | if b['type'] == 'field': |
|
703 | 703 | x = b['key'] |
|
704 | 704 | else: |
|
705 | 705 | x = b['lines'][0] |
|
706 | 706 | x = x.lower().strip('"') |
|
707 | 707 | if '(' in x: |
|
708 | 708 | x = x.split('(')[0] |
|
709 | 709 | return x |
|
710 | 710 | |
|
711 | 711 | for b in blocks: |
|
712 | 712 | if b['type'] == 'section': |
|
713 | 713 | i = b['underline'] |
|
714 | 714 | if i not in nest: |
|
715 | 715 | nest += i |
|
716 | 716 | level = nest.index(i) + 1 |
|
717 | 717 | nest = nest[:level] |
|
718 | 718 | secs.append((getname(b), level, [b])) |
|
719 | 719 | elif b['type'] in ('definition', 'field'): |
|
720 | 720 | i = ' ' |
|
721 | 721 | if i not in nest: |
|
722 | 722 | nest += i |
|
723 | 723 | level = nest.index(i) + 1 |
|
724 | 724 | nest = nest[:level] |
|
725 | for i in range(1, len(secs) + 1): | |
|
726 | sec = secs[-i] | |
|
727 | if sec[1] < level: | |
|
728 | break | |
|
729 | siblings = [a for a in sec[2] if a['type'] == 'definition'] | |
|
730 | if siblings: | |
|
731 | siblingindent = siblings[-1]['indent'] | |
|
732 | indent = b['indent'] | |
|
733 | if siblingindent < indent: | |
|
734 | level += 1 | |
|
735 | break | |
|
736 | elif siblingindent == indent: | |
|
737 | level = sec[1] | |
|
738 | break | |
|
725 | 739 | secs.append((getname(b), level, [b])) |
|
726 | 740 | else: |
|
727 | 741 | if not secs: |
|
728 | 742 | # add an initial empty section |
|
729 | 743 | secs = [('', 0, [])] |
|
730 | 744 | if b['type'] != 'margin': |
|
731 | 745 | pointer = 1 |
|
732 | 746 | bindent = b['indent'] |
|
733 | 747 | while pointer < len(secs): |
|
734 | 748 | section = secs[-pointer][2][0] |
|
735 | 749 | if section['type'] != 'margin': |
|
736 | 750 | sindent = section['indent'] |
|
737 | 751 | if len(section['lines']) > 1: |
|
738 | 752 | sindent += len(section['lines'][1]) - \ |
|
739 | 753 | len(section['lines'][1].lstrip(' ')) |
|
740 | 754 | if bindent >= sindent: |
|
741 | 755 | break |
|
742 | 756 | pointer += 1 |
|
743 | 757 | if pointer > 1: |
|
744 | 758 | blevel = secs[-pointer][1] |
|
745 | 759 | if section['type'] != b['type']: |
|
746 | 760 | blevel += 1 |
|
747 | 761 | secs.append(('', blevel, [])) |
|
748 | 762 | secs[-1][2].append(b) |
|
749 | 763 | return secs |
|
750 | 764 | |
|
751 | 765 | def decorateblocks(blocks, width): |
|
752 | 766 | '''generate a list of (section name, line text) pairs for search''' |
|
753 | 767 | lines = [] |
|
754 | 768 | for s in getsections(blocks): |
|
755 | 769 | section = s[0] |
|
756 | 770 | text = formatblocks(s[2], width) |
|
757 | 771 | lines.append([(section, l) for l in text.splitlines(True)]) |
|
758 | 772 | return lines |
|
759 | 773 | |
|
760 | 774 | def maketable(data, indent=0, header=False): |
|
761 | 775 | '''Generate an RST table for the given table data as a list of lines''' |
|
762 | 776 | |
|
763 | 777 | widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)] |
|
764 | 778 | indent = ' ' * indent |
|
765 | 779 | div = indent + ' '.join('=' * w for w in widths) + '\n' |
|
766 | 780 | |
|
767 | 781 | out = [div] |
|
768 | 782 | for row in data: |
|
769 | 783 | l = [] |
|
770 | 784 | for w, v in zip(widths, row): |
|
771 | 785 | if '\n' in v: |
|
772 | 786 | # only remove line breaks and indentation, long lines are |
|
773 | 787 | # handled by the next tool |
|
774 | 788 | v = ' '.join(e.lstrip() for e in v.split('\n')) |
|
775 | 789 | pad = ' ' * (w - encoding.colwidth(v)) |
|
776 | 790 | l.append(v + pad) |
|
777 | 791 | out.append(indent + ' '.join(l) + "\n") |
|
778 | 792 | if header and len(data) > 1: |
|
779 | 793 | out.insert(2, div) |
|
780 | 794 | out.append(div) |
|
781 | 795 | return out |
@@ -1,2317 +1,2323 b'' | |||
|
1 | 1 | Short help: |
|
2 | 2 | |
|
3 | 3 | $ hg |
|
4 | 4 | Mercurial Distributed SCM |
|
5 | 5 | |
|
6 | 6 | basic commands: |
|
7 | 7 | |
|
8 | 8 | add add the specified files on the next commit |
|
9 | 9 | annotate show changeset information by line for each file |
|
10 | 10 | clone make a copy of an existing repository |
|
11 | 11 | commit commit the specified files or all outstanding changes |
|
12 | 12 | diff diff repository (or selected files) |
|
13 | 13 | export dump the header and diffs for one or more changesets |
|
14 | 14 | forget forget the specified files on the next commit |
|
15 | 15 | init create a new repository in the given directory |
|
16 | 16 | log show revision history of entire repository or files |
|
17 | 17 | merge merge another revision into working directory |
|
18 | 18 | pull pull changes from the specified source |
|
19 | 19 | push push changes to the specified destination |
|
20 | 20 | remove remove the specified files on the next commit |
|
21 | 21 | serve start stand-alone webserver |
|
22 | 22 | status show changed files in the working directory |
|
23 | 23 | summary summarize working directory state |
|
24 | 24 | update update working directory (or switch revisions) |
|
25 | 25 | |
|
26 | 26 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
27 | 27 | |
|
28 | 28 | $ hg -q |
|
29 | 29 | add add the specified files on the next commit |
|
30 | 30 | annotate show changeset information by line for each file |
|
31 | 31 | clone make a copy of an existing repository |
|
32 | 32 | commit commit the specified files or all outstanding changes |
|
33 | 33 | diff diff repository (or selected files) |
|
34 | 34 | export dump the header and diffs for one or more changesets |
|
35 | 35 | forget forget the specified files on the next commit |
|
36 | 36 | init create a new repository in the given directory |
|
37 | 37 | log show revision history of entire repository or files |
|
38 | 38 | merge merge another revision into working directory |
|
39 | 39 | pull pull changes from the specified source |
|
40 | 40 | push push changes to the specified destination |
|
41 | 41 | remove remove the specified files on the next commit |
|
42 | 42 | serve start stand-alone webserver |
|
43 | 43 | status show changed files in the working directory |
|
44 | 44 | summary summarize working directory state |
|
45 | 45 | update update working directory (or switch revisions) |
|
46 | 46 | |
|
47 | 47 | $ hg help |
|
48 | 48 | Mercurial Distributed SCM |
|
49 | 49 | |
|
50 | 50 | list of commands: |
|
51 | 51 | |
|
52 | 52 | add add the specified files on the next commit |
|
53 | 53 | addremove add all new files, delete all missing files |
|
54 | 54 | annotate show changeset information by line for each file |
|
55 | 55 | archive create an unversioned archive of a repository revision |
|
56 | 56 | backout reverse effect of earlier changeset |
|
57 | 57 | bisect subdivision search of changesets |
|
58 | 58 | bookmarks create a new bookmark or list existing bookmarks |
|
59 | 59 | branch set or show the current branch name |
|
60 | 60 | branches list repository named branches |
|
61 | 61 | bundle create a changegroup file |
|
62 | 62 | cat output the current or given revision of files |
|
63 | 63 | clone make a copy of an existing repository |
|
64 | 64 | commit commit the specified files or all outstanding changes |
|
65 | 65 | config show combined config settings from all hgrc files |
|
66 | 66 | copy mark files as copied for the next commit |
|
67 | 67 | diff diff repository (or selected files) |
|
68 | 68 | export dump the header and diffs for one or more changesets |
|
69 | 69 | files list tracked files |
|
70 | 70 | forget forget the specified files on the next commit |
|
71 | 71 | graft copy changes from other branches onto the current branch |
|
72 | 72 | grep search for a pattern in specified files and revisions |
|
73 | 73 | heads show branch heads |
|
74 | 74 | help show help for a given topic or a help overview |
|
75 | 75 | identify identify the working directory or specified revision |
|
76 | 76 | import import an ordered set of patches |
|
77 | 77 | incoming show new changesets found in source |
|
78 | 78 | init create a new repository in the given directory |
|
79 | 79 | log show revision history of entire repository or files |
|
80 | 80 | manifest output the current or given revision of the project manifest |
|
81 | 81 | merge merge another revision into working directory |
|
82 | 82 | outgoing show changesets not found in the destination |
|
83 | 83 | paths show aliases for remote repositories |
|
84 | 84 | phase set or show the current phase name |
|
85 | 85 | pull pull changes from the specified source |
|
86 | 86 | push push changes to the specified destination |
|
87 | 87 | recover roll back an interrupted transaction |
|
88 | 88 | remove remove the specified files on the next commit |
|
89 | 89 | rename rename files; equivalent of copy + remove |
|
90 | 90 | resolve redo merges or set/view the merge status of files |
|
91 | 91 | revert restore files to their checkout state |
|
92 | 92 | root print the root (top) of the current working directory |
|
93 | 93 | serve start stand-alone webserver |
|
94 | 94 | status show changed files in the working directory |
|
95 | 95 | summary summarize working directory state |
|
96 | 96 | tag add one or more tags for the current or given revision |
|
97 | 97 | tags list repository tags |
|
98 | 98 | unbundle apply one or more changegroup files |
|
99 | 99 | update update working directory (or switch revisions) |
|
100 | 100 | verify verify the integrity of the repository |
|
101 | 101 | version output version and copyright information |
|
102 | 102 | |
|
103 | 103 | additional help topics: |
|
104 | 104 | |
|
105 | 105 | config Configuration Files |
|
106 | 106 | dates Date Formats |
|
107 | 107 | diffs Diff Formats |
|
108 | 108 | environment Environment Variables |
|
109 | 109 | extensions Using Additional Features |
|
110 | 110 | filesets Specifying File Sets |
|
111 | 111 | glossary Glossary |
|
112 | 112 | hgignore Syntax for Mercurial Ignore Files |
|
113 | 113 | hgweb Configuring hgweb |
|
114 | 114 | merge-tools Merge Tools |
|
115 | 115 | multirevs Specifying Multiple Revisions |
|
116 | 116 | patterns File Name Patterns |
|
117 | 117 | phases Working with Phases |
|
118 | 118 | revisions Specifying Single Revisions |
|
119 | 119 | revsets Specifying Revision Sets |
|
120 | 120 | scripting Using Mercurial from scripts and automation |
|
121 | 121 | subrepos Subrepositories |
|
122 | 122 | templating Template Usage |
|
123 | 123 | urls URL Paths |
|
124 | 124 | |
|
125 | 125 | (use "hg help -v" to show built-in aliases and global options) |
|
126 | 126 | |
|
127 | 127 | $ hg -q help |
|
128 | 128 | add add the specified files on the next commit |
|
129 | 129 | addremove add all new files, delete all missing files |
|
130 | 130 | annotate show changeset information by line for each file |
|
131 | 131 | archive create an unversioned archive of a repository revision |
|
132 | 132 | backout reverse effect of earlier changeset |
|
133 | 133 | bisect subdivision search of changesets |
|
134 | 134 | bookmarks create a new bookmark or list existing bookmarks |
|
135 | 135 | branch set or show the current branch name |
|
136 | 136 | branches list repository named branches |
|
137 | 137 | bundle create a changegroup file |
|
138 | 138 | cat output the current or given revision of files |
|
139 | 139 | clone make a copy of an existing repository |
|
140 | 140 | commit commit the specified files or all outstanding changes |
|
141 | 141 | config show combined config settings from all hgrc files |
|
142 | 142 | copy mark files as copied for the next commit |
|
143 | 143 | diff diff repository (or selected files) |
|
144 | 144 | export dump the header and diffs for one or more changesets |
|
145 | 145 | files list tracked files |
|
146 | 146 | forget forget the specified files on the next commit |
|
147 | 147 | graft copy changes from other branches onto the current branch |
|
148 | 148 | grep search for a pattern in specified files and revisions |
|
149 | 149 | heads show branch heads |
|
150 | 150 | help show help for a given topic or a help overview |
|
151 | 151 | identify identify the working directory or specified revision |
|
152 | 152 | import import an ordered set of patches |
|
153 | 153 | incoming show new changesets found in source |
|
154 | 154 | init create a new repository in the given directory |
|
155 | 155 | log show revision history of entire repository or files |
|
156 | 156 | manifest output the current or given revision of the project manifest |
|
157 | 157 | merge merge another revision into working directory |
|
158 | 158 | outgoing show changesets not found in the destination |
|
159 | 159 | paths show aliases for remote repositories |
|
160 | 160 | phase set or show the current phase name |
|
161 | 161 | pull pull changes from the specified source |
|
162 | 162 | push push changes to the specified destination |
|
163 | 163 | recover roll back an interrupted transaction |
|
164 | 164 | remove remove the specified files on the next commit |
|
165 | 165 | rename rename files; equivalent of copy + remove |
|
166 | 166 | resolve redo merges or set/view the merge status of files |
|
167 | 167 | revert restore files to their checkout state |
|
168 | 168 | root print the root (top) of the current working directory |
|
169 | 169 | serve start stand-alone webserver |
|
170 | 170 | status show changed files in the working directory |
|
171 | 171 | summary summarize working directory state |
|
172 | 172 | tag add one or more tags for the current or given revision |
|
173 | 173 | tags list repository tags |
|
174 | 174 | unbundle apply one or more changegroup files |
|
175 | 175 | update update working directory (or switch revisions) |
|
176 | 176 | verify verify the integrity of the repository |
|
177 | 177 | version output version and copyright information |
|
178 | 178 | |
|
179 | 179 | additional help topics: |
|
180 | 180 | |
|
181 | 181 | config Configuration Files |
|
182 | 182 | dates Date Formats |
|
183 | 183 | diffs Diff Formats |
|
184 | 184 | environment Environment Variables |
|
185 | 185 | extensions Using Additional Features |
|
186 | 186 | filesets Specifying File Sets |
|
187 | 187 | glossary Glossary |
|
188 | 188 | hgignore Syntax for Mercurial Ignore Files |
|
189 | 189 | hgweb Configuring hgweb |
|
190 | 190 | merge-tools Merge Tools |
|
191 | 191 | multirevs Specifying Multiple Revisions |
|
192 | 192 | patterns File Name Patterns |
|
193 | 193 | phases Working with Phases |
|
194 | 194 | revisions Specifying Single Revisions |
|
195 | 195 | revsets Specifying Revision Sets |
|
196 | 196 | scripting Using Mercurial from scripts and automation |
|
197 | 197 | subrepos Subrepositories |
|
198 | 198 | templating Template Usage |
|
199 | 199 | urls URL Paths |
|
200 | 200 | |
|
201 | 201 | Test extension help: |
|
202 | 202 | $ hg help extensions --config extensions.rebase= --config extensions.children= |
|
203 | 203 | Using Additional Features |
|
204 | 204 | """"""""""""""""""""""""" |
|
205 | 205 | |
|
206 | 206 | Mercurial has the ability to add new features through the use of |
|
207 | 207 | extensions. Extensions may add new commands, add options to existing |
|
208 | 208 | commands, change the default behavior of commands, or implement hooks. |
|
209 | 209 | |
|
210 | 210 | To enable the "foo" extension, either shipped with Mercurial or in the |
|
211 | 211 | Python search path, create an entry for it in your configuration file, |
|
212 | 212 | like this: |
|
213 | 213 | |
|
214 | 214 | [extensions] |
|
215 | 215 | foo = |
|
216 | 216 | |
|
217 | 217 | You may also specify the full path to an extension: |
|
218 | 218 | |
|
219 | 219 | [extensions] |
|
220 | 220 | myfeature = ~/.hgext/myfeature.py |
|
221 | 221 | |
|
222 | 222 | See "hg help config" for more information on configuration files. |
|
223 | 223 | |
|
224 | 224 | Extensions are not loaded by default for a variety of reasons: they can |
|
225 | 225 | increase startup overhead; they may be meant for advanced usage only; they |
|
226 | 226 | may provide potentially dangerous abilities (such as letting you destroy |
|
227 | 227 | or modify history); they might not be ready for prime time; or they may |
|
228 | 228 | alter some usual behaviors of stock Mercurial. It is thus up to the user |
|
229 | 229 | to activate extensions as needed. |
|
230 | 230 | |
|
231 | 231 | To explicitly disable an extension enabled in a configuration file of |
|
232 | 232 | broader scope, prepend its path with !: |
|
233 | 233 | |
|
234 | 234 | [extensions] |
|
235 | 235 | # disabling extension bar residing in /path/to/extension/bar.py |
|
236 | 236 | bar = !/path/to/extension/bar.py |
|
237 | 237 | # ditto, but no path was supplied for extension baz |
|
238 | 238 | baz = ! |
|
239 | 239 | |
|
240 | 240 | enabled extensions: |
|
241 | 241 | |
|
242 | 242 | children command to display child changesets (DEPRECATED) |
|
243 | 243 | rebase command to move sets of revisions to a different ancestor |
|
244 | 244 | |
|
245 | 245 | disabled extensions: |
|
246 | 246 | |
|
247 | 247 | acl hooks for controlling repository access |
|
248 | 248 | blackbox log repository events to a blackbox for debugging |
|
249 | 249 | bugzilla hooks for integrating with the Bugzilla bug tracker |
|
250 | 250 | censor erase file content at a given revision |
|
251 | 251 | churn command to display statistics about repository history |
|
252 | 252 | color colorize output from some commands |
|
253 | 253 | convert import revisions from foreign VCS repositories into |
|
254 | 254 | Mercurial |
|
255 | 255 | eol automatically manage newlines in repository files |
|
256 | 256 | extdiff command to allow external programs to compare revisions |
|
257 | 257 | factotum http authentication with factotum |
|
258 | 258 | gpg commands to sign and verify changesets |
|
259 | 259 | hgcia hooks for integrating with the CIA.vc notification service |
|
260 | 260 | hgk browse the repository in a graphical way |
|
261 | 261 | highlight syntax highlighting for hgweb (requires Pygments) |
|
262 | 262 | histedit interactive history editing |
|
263 | 263 | keyword expand keywords in tracked files |
|
264 | 264 | largefiles track large binary files |
|
265 | 265 | mq manage a stack of patches |
|
266 | 266 | notify hooks for sending email push notifications |
|
267 | 267 | pager browse command output with an external pager |
|
268 | 268 | patchbomb command to send changesets as (a series of) patch emails |
|
269 | 269 | purge command to delete untracked files from the working |
|
270 | 270 | directory |
|
271 | 271 | record commands to interactively select changes for |
|
272 | 272 | commit/qrefresh |
|
273 | 273 | relink recreates hardlinks between repository clones |
|
274 | 274 | schemes extend schemes with shortcuts to repository swarms |
|
275 | 275 | share share a common history between several working directories |
|
276 | 276 | shelve save and restore changes to the working directory |
|
277 | 277 | strip strip changesets and their descendants from history |
|
278 | 278 | transplant command to transplant changesets from another branch |
|
279 | 279 | win32mbcs allow the use of MBCS paths with problematic encodings |
|
280 | 280 | zeroconf discover and advertise repositories on the local network |
|
281 | 281 | Test short command list with verbose option |
|
282 | 282 | |
|
283 | 283 | $ hg -v help shortlist |
|
284 | 284 | Mercurial Distributed SCM |
|
285 | 285 | |
|
286 | 286 | basic commands: |
|
287 | 287 | |
|
288 | 288 | add add the specified files on the next commit |
|
289 | 289 | annotate, blame |
|
290 | 290 | show changeset information by line for each file |
|
291 | 291 | clone make a copy of an existing repository |
|
292 | 292 | commit, ci commit the specified files or all outstanding changes |
|
293 | 293 | diff diff repository (or selected files) |
|
294 | 294 | export dump the header and diffs for one or more changesets |
|
295 | 295 | forget forget the specified files on the next commit |
|
296 | 296 | init create a new repository in the given directory |
|
297 | 297 | log, history show revision history of entire repository or files |
|
298 | 298 | merge merge another revision into working directory |
|
299 | 299 | pull pull changes from the specified source |
|
300 | 300 | push push changes to the specified destination |
|
301 | 301 | remove, rm remove the specified files on the next commit |
|
302 | 302 | serve start stand-alone webserver |
|
303 | 303 | status, st show changed files in the working directory |
|
304 | 304 | summary, sum summarize working directory state |
|
305 | 305 | update, up, checkout, co |
|
306 | 306 | update working directory (or switch revisions) |
|
307 | 307 | |
|
308 | 308 | global options ([+] can be repeated): |
|
309 | 309 | |
|
310 | 310 | -R --repository REPO repository root directory or name of overlay bundle |
|
311 | 311 | file |
|
312 | 312 | --cwd DIR change working directory |
|
313 | 313 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
314 | 314 | all prompts |
|
315 | 315 | -q --quiet suppress output |
|
316 | 316 | -v --verbose enable additional output |
|
317 | 317 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
318 | 318 | --debug enable debugging output |
|
319 | 319 | --debugger start debugger |
|
320 | 320 | --encoding ENCODE set the charset encoding (default: ascii) |
|
321 | 321 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
322 | 322 | --traceback always print a traceback on exception |
|
323 | 323 | --time time how long the command takes |
|
324 | 324 | --profile print command execution profile |
|
325 | 325 | --version output version information and exit |
|
326 | 326 | -h --help display help and exit |
|
327 | 327 | --hidden consider hidden changesets |
|
328 | 328 | |
|
329 | 329 | (use "hg help" for the full list of commands) |
|
330 | 330 | |
|
331 | 331 | $ hg add -h |
|
332 | 332 | hg add [OPTION]... [FILE]... |
|
333 | 333 | |
|
334 | 334 | add the specified files on the next commit |
|
335 | 335 | |
|
336 | 336 | Schedule files to be version controlled and added to the repository. |
|
337 | 337 | |
|
338 | 338 | The files will be added to the repository at the next commit. To undo an |
|
339 | 339 | add before that, see "hg forget". |
|
340 | 340 | |
|
341 | 341 | If no names are given, add all files to the repository. |
|
342 | 342 | |
|
343 | 343 | Returns 0 if all files are successfully added. |
|
344 | 344 | |
|
345 | 345 | options ([+] can be repeated): |
|
346 | 346 | |
|
347 | 347 | -I --include PATTERN [+] include names matching the given patterns |
|
348 | 348 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
349 | 349 | -S --subrepos recurse into subrepositories |
|
350 | 350 | -n --dry-run do not perform actions, just print output |
|
351 | 351 | |
|
352 | 352 | (some details hidden, use --verbose to show complete help) |
|
353 | 353 | |
|
354 | 354 | Verbose help for add |
|
355 | 355 | |
|
356 | 356 | $ hg add -hv |
|
357 | 357 | hg add [OPTION]... [FILE]... |
|
358 | 358 | |
|
359 | 359 | add the specified files on the next commit |
|
360 | 360 | |
|
361 | 361 | Schedule files to be version controlled and added to the repository. |
|
362 | 362 | |
|
363 | 363 | The files will be added to the repository at the next commit. To undo an |
|
364 | 364 | add before that, see "hg forget". |
|
365 | 365 | |
|
366 | 366 | If no names are given, add all files to the repository. |
|
367 | 367 | |
|
368 | 368 | An example showing how new (unknown) files are added automatically by "hg |
|
369 | 369 | add": |
|
370 | 370 | |
|
371 | 371 | $ ls |
|
372 | 372 | foo.c |
|
373 | 373 | $ hg status |
|
374 | 374 | ? foo.c |
|
375 | 375 | $ hg add |
|
376 | 376 | adding foo.c |
|
377 | 377 | $ hg status |
|
378 | 378 | A foo.c |
|
379 | 379 | |
|
380 | 380 | Returns 0 if all files are successfully added. |
|
381 | 381 | |
|
382 | 382 | options ([+] can be repeated): |
|
383 | 383 | |
|
384 | 384 | -I --include PATTERN [+] include names matching the given patterns |
|
385 | 385 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
386 | 386 | -S --subrepos recurse into subrepositories |
|
387 | 387 | -n --dry-run do not perform actions, just print output |
|
388 | 388 | |
|
389 | 389 | global options ([+] can be repeated): |
|
390 | 390 | |
|
391 | 391 | -R --repository REPO repository root directory or name of overlay bundle |
|
392 | 392 | file |
|
393 | 393 | --cwd DIR change working directory |
|
394 | 394 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
395 | 395 | all prompts |
|
396 | 396 | -q --quiet suppress output |
|
397 | 397 | -v --verbose enable additional output |
|
398 | 398 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
399 | 399 | --debug enable debugging output |
|
400 | 400 | --debugger start debugger |
|
401 | 401 | --encoding ENCODE set the charset encoding (default: ascii) |
|
402 | 402 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
403 | 403 | --traceback always print a traceback on exception |
|
404 | 404 | --time time how long the command takes |
|
405 | 405 | --profile print command execution profile |
|
406 | 406 | --version output version information and exit |
|
407 | 407 | -h --help display help and exit |
|
408 | 408 | --hidden consider hidden changesets |
|
409 | 409 | |
|
410 | 410 | Test help option with version option |
|
411 | 411 | |
|
412 | 412 | $ hg add -h --version |
|
413 | 413 | Mercurial Distributed SCM (version *) (glob) |
|
414 | 414 | (see http://mercurial.selenic.com for more information) |
|
415 | 415 | |
|
416 | 416 | Copyright (C) 2005-2015 Matt Mackall and others |
|
417 | 417 | This is free software; see the source for copying conditions. There is NO |
|
418 | 418 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
419 | 419 | |
|
420 | 420 | $ hg add --skjdfks |
|
421 | 421 | hg add: option --skjdfks not recognized |
|
422 | 422 | hg add [OPTION]... [FILE]... |
|
423 | 423 | |
|
424 | 424 | add the specified files on the next commit |
|
425 | 425 | |
|
426 | 426 | options ([+] can be repeated): |
|
427 | 427 | |
|
428 | 428 | -I --include PATTERN [+] include names matching the given patterns |
|
429 | 429 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
430 | 430 | -S --subrepos recurse into subrepositories |
|
431 | 431 | -n --dry-run do not perform actions, just print output |
|
432 | 432 | |
|
433 | 433 | (use "hg add -h" to show more help) |
|
434 | 434 | [255] |
|
435 | 435 | |
|
436 | 436 | Test ambiguous command help |
|
437 | 437 | |
|
438 | 438 | $ hg help ad |
|
439 | 439 | list of commands: |
|
440 | 440 | |
|
441 | 441 | add add the specified files on the next commit |
|
442 | 442 | addremove add all new files, delete all missing files |
|
443 | 443 | |
|
444 | 444 | (use "hg help -v ad" to show built-in aliases and global options) |
|
445 | 445 | |
|
446 | 446 | Test command without options |
|
447 | 447 | |
|
448 | 448 | $ hg help verify |
|
449 | 449 | hg verify |
|
450 | 450 | |
|
451 | 451 | verify the integrity of the repository |
|
452 | 452 | |
|
453 | 453 | Verify the integrity of the current repository. |
|
454 | 454 | |
|
455 | 455 | This will perform an extensive check of the repository's integrity, |
|
456 | 456 | validating the hashes and checksums of each entry in the changelog, |
|
457 | 457 | manifest, and tracked files, as well as the integrity of their crosslinks |
|
458 | 458 | and indices. |
|
459 | 459 | |
|
460 | 460 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more |
|
461 | 461 | information about recovery from corruption of the repository. |
|
462 | 462 | |
|
463 | 463 | Returns 0 on success, 1 if errors are encountered. |
|
464 | 464 | |
|
465 | 465 | (some details hidden, use --verbose to show complete help) |
|
466 | 466 | |
|
467 | 467 | $ hg help diff |
|
468 | 468 | hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]... |
|
469 | 469 | |
|
470 | 470 | diff repository (or selected files) |
|
471 | 471 | |
|
472 | 472 | Show differences between revisions for the specified files. |
|
473 | 473 | |
|
474 | 474 | Differences between files are shown using the unified diff format. |
|
475 | 475 | |
|
476 | 476 | Note: |
|
477 | 477 | diff may generate unexpected results for merges, as it will default to |
|
478 | 478 | comparing against the working directory's first parent changeset if no |
|
479 | 479 | revisions are specified. |
|
480 | 480 | |
|
481 | 481 | When two revision arguments are given, then changes are shown between |
|
482 | 482 | those revisions. If only one revision is specified then that revision is |
|
483 | 483 | compared to the working directory, and, when no revisions are specified, |
|
484 | 484 | the working directory files are compared to its parent. |
|
485 | 485 | |
|
486 | 486 | Alternatively you can specify -c/--change with a revision to see the |
|
487 | 487 | changes in that changeset relative to its first parent. |
|
488 | 488 | |
|
489 | 489 | Without the -a/--text option, diff will avoid generating diffs of files it |
|
490 | 490 | detects as binary. With -a, diff will generate a diff anyway, probably |
|
491 | 491 | with undesirable results. |
|
492 | 492 | |
|
493 | 493 | Use the -g/--git option to generate diffs in the git extended diff format. |
|
494 | 494 | For more information, read "hg help diffs". |
|
495 | 495 | |
|
496 | 496 | Returns 0 on success. |
|
497 | 497 | |
|
498 | 498 | options ([+] can be repeated): |
|
499 | 499 | |
|
500 | 500 | -r --rev REV [+] revision |
|
501 | 501 | -c --change REV change made by revision |
|
502 | 502 | -a --text treat all files as text |
|
503 | 503 | -g --git use git extended diff format |
|
504 | 504 | --nodates omit dates from diff headers |
|
505 | 505 | --noprefix omit a/ and b/ prefixes from filenames |
|
506 | 506 | -p --show-function show which function each change is in |
|
507 | 507 | --reverse produce a diff that undoes the changes |
|
508 | 508 | -w --ignore-all-space ignore white space when comparing lines |
|
509 | 509 | -b --ignore-space-change ignore changes in the amount of white space |
|
510 | 510 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
511 | 511 | -U --unified NUM number of lines of context to show |
|
512 | 512 | --stat output diffstat-style summary of changes |
|
513 | 513 | --root DIR produce diffs relative to subdirectory |
|
514 | 514 | -I --include PATTERN [+] include names matching the given patterns |
|
515 | 515 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
516 | 516 | -S --subrepos recurse into subrepositories |
|
517 | 517 | |
|
518 | 518 | (some details hidden, use --verbose to show complete help) |
|
519 | 519 | |
|
520 | 520 | $ hg help status |
|
521 | 521 | hg status [OPTION]... [FILE]... |
|
522 | 522 | |
|
523 | 523 | aliases: st |
|
524 | 524 | |
|
525 | 525 | show changed files in the working directory |
|
526 | 526 | |
|
527 | 527 | Show status of files in the repository. If names are given, only files |
|
528 | 528 | that match are shown. Files that are clean or ignored or the source of a |
|
529 | 529 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
530 | 530 | -C/--copies or -A/--all are given. Unless options described with "show |
|
531 | 531 | only ..." are given, the options -mardu are used. |
|
532 | 532 | |
|
533 | 533 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
534 | 534 | explicitly requested with -u/--unknown or -i/--ignored. |
|
535 | 535 | |
|
536 | 536 | Note: |
|
537 | 537 | status may appear to disagree with diff if permissions have changed or |
|
538 | 538 | a merge has occurred. The standard diff format does not report |
|
539 | 539 | permission changes and diff only reports changes relative to one merge |
|
540 | 540 | parent. |
|
541 | 541 | |
|
542 | 542 | If one revision is given, it is used as the base revision. If two |
|
543 | 543 | revisions are given, the differences between them are shown. The --change |
|
544 | 544 | option can also be used as a shortcut to list the changed files of a |
|
545 | 545 | revision from its first parent. |
|
546 | 546 | |
|
547 | 547 | The codes used to show the status of files are: |
|
548 | 548 | |
|
549 | 549 | M = modified |
|
550 | 550 | A = added |
|
551 | 551 | R = removed |
|
552 | 552 | C = clean |
|
553 | 553 | ! = missing (deleted by non-hg command, but still tracked) |
|
554 | 554 | ? = not tracked |
|
555 | 555 | I = ignored |
|
556 | 556 | = origin of the previous file (with --copies) |
|
557 | 557 | |
|
558 | 558 | Returns 0 on success. |
|
559 | 559 | |
|
560 | 560 | options ([+] can be repeated): |
|
561 | 561 | |
|
562 | 562 | -A --all show status of all files |
|
563 | 563 | -m --modified show only modified files |
|
564 | 564 | -a --added show only added files |
|
565 | 565 | -r --removed show only removed files |
|
566 | 566 | -d --deleted show only deleted (but tracked) files |
|
567 | 567 | -c --clean show only files without changes |
|
568 | 568 | -u --unknown show only unknown (not tracked) files |
|
569 | 569 | -i --ignored show only ignored files |
|
570 | 570 | -n --no-status hide status prefix |
|
571 | 571 | -C --copies show source of copied files |
|
572 | 572 | -0 --print0 end filenames with NUL, for use with xargs |
|
573 | 573 | --rev REV [+] show difference from revision |
|
574 | 574 | --change REV list the changed files of a revision |
|
575 | 575 | -I --include PATTERN [+] include names matching the given patterns |
|
576 | 576 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
577 | 577 | -S --subrepos recurse into subrepositories |
|
578 | 578 | |
|
579 | 579 | (some details hidden, use --verbose to show complete help) |
|
580 | 580 | |
|
581 | 581 | $ hg -q help status |
|
582 | 582 | hg status [OPTION]... [FILE]... |
|
583 | 583 | |
|
584 | 584 | show changed files in the working directory |
|
585 | 585 | |
|
586 | 586 | $ hg help foo |
|
587 | 587 | abort: no such help topic: foo |
|
588 | 588 | (try "hg help --keyword foo") |
|
589 | 589 | [255] |
|
590 | 590 | |
|
591 | 591 | $ hg skjdfks |
|
592 | 592 | hg: unknown command 'skjdfks' |
|
593 | 593 | Mercurial Distributed SCM |
|
594 | 594 | |
|
595 | 595 | basic commands: |
|
596 | 596 | |
|
597 | 597 | add add the specified files on the next commit |
|
598 | 598 | annotate show changeset information by line for each file |
|
599 | 599 | clone make a copy of an existing repository |
|
600 | 600 | commit commit the specified files or all outstanding changes |
|
601 | 601 | diff diff repository (or selected files) |
|
602 | 602 | export dump the header and diffs for one or more changesets |
|
603 | 603 | forget forget the specified files on the next commit |
|
604 | 604 | init create a new repository in the given directory |
|
605 | 605 | log show revision history of entire repository or files |
|
606 | 606 | merge merge another revision into working directory |
|
607 | 607 | pull pull changes from the specified source |
|
608 | 608 | push push changes to the specified destination |
|
609 | 609 | remove remove the specified files on the next commit |
|
610 | 610 | serve start stand-alone webserver |
|
611 | 611 | status show changed files in the working directory |
|
612 | 612 | summary summarize working directory state |
|
613 | 613 | update update working directory (or switch revisions) |
|
614 | 614 | |
|
615 | 615 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
616 | 616 | [255] |
|
617 | 617 | |
|
618 | 618 | |
|
619 | 619 | $ cat > helpext.py <<EOF |
|
620 | 620 | > import os |
|
621 | 621 | > from mercurial import cmdutil, commands |
|
622 | 622 | > |
|
623 | 623 | > cmdtable = {} |
|
624 | 624 | > command = cmdutil.command(cmdtable) |
|
625 | 625 | > |
|
626 | 626 | > @command('nohelp', |
|
627 | 627 | > [('', 'longdesc', 3, 'x'*90), |
|
628 | 628 | > ('n', '', None, 'normal desc'), |
|
629 | 629 | > ('', 'newline', '', 'line1\nline2')], |
|
630 | 630 | > 'hg nohelp', |
|
631 | 631 | > norepo=True) |
|
632 | 632 | > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')]) |
|
633 | 633 | > @command('debugoptEXP', [('', 'eopt', None, 'option is EXPERIMENTAL')]) |
|
634 | 634 | > def nohelp(ui, *args, **kwargs): |
|
635 | 635 | > pass |
|
636 | 636 | > |
|
637 | 637 | > EOF |
|
638 | 638 | $ echo '[extensions]' >> $HGRCPATH |
|
639 | 639 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH |
|
640 | 640 | |
|
641 | 641 | Test command with no help text |
|
642 | 642 | |
|
643 | 643 | $ hg help nohelp |
|
644 | 644 | hg nohelp |
|
645 | 645 | |
|
646 | 646 | (no help text available) |
|
647 | 647 | |
|
648 | 648 | options: |
|
649 | 649 | |
|
650 | 650 | --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
651 | 651 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) |
|
652 | 652 | -n -- normal desc |
|
653 | 653 | --newline VALUE line1 line2 |
|
654 | 654 | |
|
655 | 655 | (some details hidden, use --verbose to show complete help) |
|
656 | 656 | |
|
657 | 657 | $ hg help -k nohelp |
|
658 | 658 | Commands: |
|
659 | 659 | |
|
660 | 660 | nohelp hg nohelp |
|
661 | 661 | |
|
662 | 662 | Extension Commands: |
|
663 | 663 | |
|
664 | 664 | nohelp (no help text available) |
|
665 | 665 | |
|
666 | 666 | Test that default list of commands omits extension commands |
|
667 | 667 | |
|
668 | 668 | $ hg help |
|
669 | 669 | Mercurial Distributed SCM |
|
670 | 670 | |
|
671 | 671 | list of commands: |
|
672 | 672 | |
|
673 | 673 | add add the specified files on the next commit |
|
674 | 674 | addremove add all new files, delete all missing files |
|
675 | 675 | annotate show changeset information by line for each file |
|
676 | 676 | archive create an unversioned archive of a repository revision |
|
677 | 677 | backout reverse effect of earlier changeset |
|
678 | 678 | bisect subdivision search of changesets |
|
679 | 679 | bookmarks create a new bookmark or list existing bookmarks |
|
680 | 680 | branch set or show the current branch name |
|
681 | 681 | branches list repository named branches |
|
682 | 682 | bundle create a changegroup file |
|
683 | 683 | cat output the current or given revision of files |
|
684 | 684 | clone make a copy of an existing repository |
|
685 | 685 | commit commit the specified files or all outstanding changes |
|
686 | 686 | config show combined config settings from all hgrc files |
|
687 | 687 | copy mark files as copied for the next commit |
|
688 | 688 | diff diff repository (or selected files) |
|
689 | 689 | export dump the header and diffs for one or more changesets |
|
690 | 690 | files list tracked files |
|
691 | 691 | forget forget the specified files on the next commit |
|
692 | 692 | graft copy changes from other branches onto the current branch |
|
693 | 693 | grep search for a pattern in specified files and revisions |
|
694 | 694 | heads show branch heads |
|
695 | 695 | help show help for a given topic or a help overview |
|
696 | 696 | identify identify the working directory or specified revision |
|
697 | 697 | import import an ordered set of patches |
|
698 | 698 | incoming show new changesets found in source |
|
699 | 699 | init create a new repository in the given directory |
|
700 | 700 | log show revision history of entire repository or files |
|
701 | 701 | manifest output the current or given revision of the project manifest |
|
702 | 702 | merge merge another revision into working directory |
|
703 | 703 | outgoing show changesets not found in the destination |
|
704 | 704 | paths show aliases for remote repositories |
|
705 | 705 | phase set or show the current phase name |
|
706 | 706 | pull pull changes from the specified source |
|
707 | 707 | push push changes to the specified destination |
|
708 | 708 | recover roll back an interrupted transaction |
|
709 | 709 | remove remove the specified files on the next commit |
|
710 | 710 | rename rename files; equivalent of copy + remove |
|
711 | 711 | resolve redo merges or set/view the merge status of files |
|
712 | 712 | revert restore files to their checkout state |
|
713 | 713 | root print the root (top) of the current working directory |
|
714 | 714 | serve start stand-alone webserver |
|
715 | 715 | status show changed files in the working directory |
|
716 | 716 | summary summarize working directory state |
|
717 | 717 | tag add one or more tags for the current or given revision |
|
718 | 718 | tags list repository tags |
|
719 | 719 | unbundle apply one or more changegroup files |
|
720 | 720 | update update working directory (or switch revisions) |
|
721 | 721 | verify verify the integrity of the repository |
|
722 | 722 | version output version and copyright information |
|
723 | 723 | |
|
724 | 724 | enabled extensions: |
|
725 | 725 | |
|
726 | 726 | helpext (no help text available) |
|
727 | 727 | |
|
728 | 728 | additional help topics: |
|
729 | 729 | |
|
730 | 730 | config Configuration Files |
|
731 | 731 | dates Date Formats |
|
732 | 732 | diffs Diff Formats |
|
733 | 733 | environment Environment Variables |
|
734 | 734 | extensions Using Additional Features |
|
735 | 735 | filesets Specifying File Sets |
|
736 | 736 | glossary Glossary |
|
737 | 737 | hgignore Syntax for Mercurial Ignore Files |
|
738 | 738 | hgweb Configuring hgweb |
|
739 | 739 | merge-tools Merge Tools |
|
740 | 740 | multirevs Specifying Multiple Revisions |
|
741 | 741 | patterns File Name Patterns |
|
742 | 742 | phases Working with Phases |
|
743 | 743 | revisions Specifying Single Revisions |
|
744 | 744 | revsets Specifying Revision Sets |
|
745 | 745 | scripting Using Mercurial from scripts and automation |
|
746 | 746 | subrepos Subrepositories |
|
747 | 747 | templating Template Usage |
|
748 | 748 | urls URL Paths |
|
749 | 749 | |
|
750 | 750 | (use "hg help -v" to show built-in aliases and global options) |
|
751 | 751 | |
|
752 | 752 | |
|
753 | 753 | Test list of internal help commands |
|
754 | 754 | |
|
755 | 755 | $ hg help debug |
|
756 | 756 | debug commands (internal and unsupported): |
|
757 | 757 | |
|
758 | 758 | debugancestor |
|
759 | 759 | find the ancestor revision of two revisions in a given index |
|
760 | 760 | debugbuilddag |
|
761 | 761 | builds a repo with a given DAG from scratch in the current |
|
762 | 762 | empty repo |
|
763 | 763 | debugbundle lists the contents of a bundle |
|
764 | 764 | debugcheckstate |
|
765 | 765 | validate the correctness of the current dirstate |
|
766 | 766 | debugcommands |
|
767 | 767 | list all available commands and options |
|
768 | 768 | debugcomplete |
|
769 | 769 | returns the completion list associated with the given command |
|
770 | 770 | debugdag format the changelog or an index DAG as a concise textual |
|
771 | 771 | description |
|
772 | 772 | debugdata dump the contents of a data file revision |
|
773 | 773 | debugdate parse and display a date |
|
774 | 774 | debugdirstate |
|
775 | 775 | show the contents of the current dirstate |
|
776 | 776 | debugdiscovery |
|
777 | 777 | runs the changeset discovery protocol in isolation |
|
778 | 778 | debugfileset parse and apply a fileset specification |
|
779 | 779 | debugfsinfo show information detected about current filesystem |
|
780 | 780 | debuggetbundle |
|
781 | 781 | retrieves a bundle from a repo |
|
782 | 782 | debugignore display the combined ignore pattern |
|
783 | 783 | debugindex dump the contents of an index file |
|
784 | 784 | debugindexdot |
|
785 | 785 | dump an index DAG as a graphviz dot file |
|
786 | 786 | debuginstall test Mercurial installation |
|
787 | 787 | debugknown test whether node ids are known to a repo |
|
788 | 788 | debuglocks show or modify state of locks |
|
789 | 789 | debugnamecomplete |
|
790 | 790 | complete "names" - tags, open branch names, bookmark names |
|
791 | 791 | debugobsolete |
|
792 | 792 | create arbitrary obsolete marker |
|
793 | 793 | debugoptDEP (no help text available) |
|
794 | 794 | debugoptEXP (no help text available) |
|
795 | 795 | debugpathcomplete |
|
796 | 796 | complete part or all of a tracked path |
|
797 | 797 | debugpushkey access the pushkey key/value protocol |
|
798 | 798 | debugpvec (no help text available) |
|
799 | 799 | debugrebuilddirstate |
|
800 | 800 | rebuild the dirstate as it would look like for the given |
|
801 | 801 | revision |
|
802 | 802 | debugrebuildfncache |
|
803 | 803 | rebuild the fncache file |
|
804 | 804 | debugrename dump rename information |
|
805 | 805 | debugrevlog show data and statistics about a revlog |
|
806 | 806 | debugrevspec parse and apply a revision specification |
|
807 | 807 | debugsetparents |
|
808 | 808 | manually set the parents of the current working directory |
|
809 | 809 | debugsub (no help text available) |
|
810 | 810 | debugsuccessorssets |
|
811 | 811 | show set of successors for revision |
|
812 | 812 | debugwalk show how files match on given patterns |
|
813 | 813 | debugwireargs |
|
814 | 814 | (no help text available) |
|
815 | 815 | |
|
816 | 816 | (use "hg help -v debug" to show built-in aliases and global options) |
|
817 | 817 | |
|
818 | 818 | |
|
819 | 819 | Test list of commands with command with no help text |
|
820 | 820 | |
|
821 | 821 | $ hg help helpext |
|
822 | 822 | helpext extension - no help text available |
|
823 | 823 | |
|
824 | 824 | list of commands: |
|
825 | 825 | |
|
826 | 826 | nohelp (no help text available) |
|
827 | 827 | |
|
828 | 828 | (use "hg help -v helpext" to show built-in aliases and global options) |
|
829 | 829 | |
|
830 | 830 | |
|
831 | 831 | test deprecated and experimental options are hidden in command help |
|
832 | 832 | $ hg help debugoptDEP |
|
833 | 833 | hg debugoptDEP |
|
834 | 834 | |
|
835 | 835 | (no help text available) |
|
836 | 836 | |
|
837 | 837 | options: |
|
838 | 838 | |
|
839 | 839 | (some details hidden, use --verbose to show complete help) |
|
840 | 840 | |
|
841 | 841 | $ hg help debugoptEXP |
|
842 | 842 | hg debugoptEXP |
|
843 | 843 | |
|
844 | 844 | (no help text available) |
|
845 | 845 | |
|
846 | 846 | options: |
|
847 | 847 | |
|
848 | 848 | (some details hidden, use --verbose to show complete help) |
|
849 | 849 | |
|
850 | 850 | test deprecated and experimental options is shown with -v |
|
851 | 851 | $ hg help -v debugoptDEP | grep dopt |
|
852 | 852 | --dopt option is DEPRECATED |
|
853 | 853 | $ hg help -v debugoptEXP | grep eopt |
|
854 | 854 | --eopt option is EXPERIMENTAL |
|
855 | 855 | |
|
856 | 856 | #if gettext |
|
857 | 857 | test deprecated option is hidden with translation with untranslated description |
|
858 | 858 | (use many globy for not failing on changed transaction) |
|
859 | 859 | $ LANGUAGE=sv hg help debugoptDEP |
|
860 | 860 | hg debugoptDEP |
|
861 | 861 | |
|
862 | 862 | (*) (glob) |
|
863 | 863 | |
|
864 | 864 | options: |
|
865 | 865 | |
|
866 | 866 | (some details hidden, use --verbose to show complete help) |
|
867 | 867 | #endif |
|
868 | 868 | |
|
869 | 869 | Test commands that collide with topics (issue4240) |
|
870 | 870 | |
|
871 | 871 | $ hg config -hq |
|
872 | 872 | hg config [-u] [NAME]... |
|
873 | 873 | |
|
874 | 874 | show combined config settings from all hgrc files |
|
875 | 875 | $ hg showconfig -hq |
|
876 | 876 | hg config [-u] [NAME]... |
|
877 | 877 | |
|
878 | 878 | show combined config settings from all hgrc files |
|
879 | 879 | |
|
880 | 880 | Test a help topic |
|
881 | 881 | |
|
882 | 882 | $ hg help revs |
|
883 | 883 | Specifying Single Revisions |
|
884 | 884 | """"""""""""""""""""""""""" |
|
885 | 885 | |
|
886 | 886 | Mercurial supports several ways to specify individual revisions. |
|
887 | 887 | |
|
888 | 888 | A plain integer is treated as a revision number. Negative integers are |
|
889 | 889 | treated as sequential offsets from the tip, with -1 denoting the tip, -2 |
|
890 | 890 | denoting the revision prior to the tip, and so forth. |
|
891 | 891 | |
|
892 | 892 | A 40-digit hexadecimal string is treated as a unique revision identifier. |
|
893 | 893 | |
|
894 | 894 | A hexadecimal string less than 40 characters long is treated as a unique |
|
895 | 895 | revision identifier and is referred to as a short-form identifier. A |
|
896 | 896 | short-form identifier is only valid if it is the prefix of exactly one |
|
897 | 897 | full-length identifier. |
|
898 | 898 | |
|
899 | 899 | Any other string is treated as a bookmark, tag, or branch name. A bookmark |
|
900 | 900 | is a movable pointer to a revision. A tag is a permanent name associated |
|
901 | 901 | with a revision. A branch name denotes the tipmost open branch head of |
|
902 | 902 | that branch - or if they are all closed, the tipmost closed head of the |
|
903 | 903 | branch. Bookmark, tag, and branch names must not contain the ":" |
|
904 | 904 | character. |
|
905 | 905 | |
|
906 | 906 | The reserved name "tip" always identifies the most recent revision. |
|
907 | 907 | |
|
908 | 908 | The reserved name "null" indicates the null revision. This is the revision |
|
909 | 909 | of an empty repository, and the parent of revision 0. |
|
910 | 910 | |
|
911 | 911 | The reserved name "." indicates the working directory parent. If no |
|
912 | 912 | working directory is checked out, it is equivalent to null. If an |
|
913 | 913 | uncommitted merge is in progress, "." is the revision of the first parent. |
|
914 | 914 | |
|
915 | 915 | Test repeated config section name |
|
916 | 916 | |
|
917 | 917 | $ hg help config.host |
|
918 | 918 | "http_proxy.host" |
|
919 | 919 | Host name and (optional) port of the proxy server, for example |
|
920 | 920 | "myproxy:8000". |
|
921 | 921 | |
|
922 | 922 | "smtp.host" |
|
923 | 923 | Host name of mail server, e.g. "mail.example.com". |
|
924 | 924 | |
|
925 | 925 | Unrelated trailing paragraphs shouldn't be included |
|
926 | 926 | |
|
927 | 927 | $ hg help config.extramsg | grep '^$' |
|
928 | 928 | |
|
929 | 929 | |
|
930 | 930 | Test capitalized section name |
|
931 | 931 | |
|
932 | 932 | $ hg help scripting.HGPLAIN > /dev/null |
|
933 | 933 | |
|
934 | 934 | Help subsection: |
|
935 | 935 | |
|
936 | 936 | $ hg help config.charsets |grep "Email example:" > /dev/null |
|
937 | 937 | [1] |
|
938 | 938 | |
|
939 | Show nested definitions | |
|
940 | ("profiling.type"[break]"ls"[break]"stat"[break]) | |
|
941 | ||
|
942 | $ hg help config.type | egrep '^$'|wc -l | |
|
943 | \s*3 (re) | |
|
944 | ||
|
939 | 945 | Last item in help config.*: |
|
940 | 946 | |
|
941 | 947 | $ hg help config.`hg help config|grep '^ "'| \ |
|
942 | 948 | > tail -1|sed 's![ "]*!!g'`| \ |
|
943 | 949 | > grep "hg help -c config" > /dev/null |
|
944 | 950 | [1] |
|
945 | 951 | |
|
946 | 952 | note to use help -c for general hg help config: |
|
947 | 953 | |
|
948 | 954 | $ hg help config |grep "hg help -c config" > /dev/null |
|
949 | 955 | |
|
950 | 956 | Test templating help |
|
951 | 957 | |
|
952 | 958 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' |
|
953 | 959 | desc String. The text of the changeset description. |
|
954 | 960 | diffstat String. Statistics of changes with the following format: |
|
955 | 961 | firstline Any text. Returns the first line of text. |
|
956 | 962 | nonempty Any text. Returns '(none)' if the string is empty. |
|
957 | 963 | |
|
958 | 964 | Test help hooks |
|
959 | 965 | |
|
960 | 966 | $ cat > helphook1.py <<EOF |
|
961 | 967 | > from mercurial import help |
|
962 | 968 | > |
|
963 | 969 | > def rewrite(topic, doc): |
|
964 | 970 | > return doc + '\nhelphook1\n' |
|
965 | 971 | > |
|
966 | 972 | > def extsetup(ui): |
|
967 | 973 | > help.addtopichook('revsets', rewrite) |
|
968 | 974 | > EOF |
|
969 | 975 | $ cat > helphook2.py <<EOF |
|
970 | 976 | > from mercurial import help |
|
971 | 977 | > |
|
972 | 978 | > def rewrite(topic, doc): |
|
973 | 979 | > return doc + '\nhelphook2\n' |
|
974 | 980 | > |
|
975 | 981 | > def extsetup(ui): |
|
976 | 982 | > help.addtopichook('revsets', rewrite) |
|
977 | 983 | > EOF |
|
978 | 984 | $ echo '[extensions]' >> $HGRCPATH |
|
979 | 985 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH |
|
980 | 986 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH |
|
981 | 987 | $ hg help revsets | grep helphook |
|
982 | 988 | helphook1 |
|
983 | 989 | helphook2 |
|
984 | 990 | |
|
985 | 991 | Test keyword search help |
|
986 | 992 | |
|
987 | 993 | $ cat > prefixedname.py <<EOF |
|
988 | 994 | > '''matched against word "clone" |
|
989 | 995 | > ''' |
|
990 | 996 | > EOF |
|
991 | 997 | $ echo '[extensions]' >> $HGRCPATH |
|
992 | 998 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH |
|
993 | 999 | $ hg help -k clone |
|
994 | 1000 | Topics: |
|
995 | 1001 | |
|
996 | 1002 | config Configuration Files |
|
997 | 1003 | extensions Using Additional Features |
|
998 | 1004 | glossary Glossary |
|
999 | 1005 | phases Working with Phases |
|
1000 | 1006 | subrepos Subrepositories |
|
1001 | 1007 | urls URL Paths |
|
1002 | 1008 | |
|
1003 | 1009 | Commands: |
|
1004 | 1010 | |
|
1005 | 1011 | bookmarks create a new bookmark or list existing bookmarks |
|
1006 | 1012 | clone make a copy of an existing repository |
|
1007 | 1013 | paths show aliases for remote repositories |
|
1008 | 1014 | update update working directory (or switch revisions) |
|
1009 | 1015 | |
|
1010 | 1016 | Extensions: |
|
1011 | 1017 | |
|
1012 | 1018 | prefixedname matched against word "clone" |
|
1013 | 1019 | relink recreates hardlinks between repository clones |
|
1014 | 1020 | |
|
1015 | 1021 | Extension Commands: |
|
1016 | 1022 | |
|
1017 | 1023 | qclone clone main and patch repository at same time |
|
1018 | 1024 | |
|
1019 | 1025 | Test unfound topic |
|
1020 | 1026 | |
|
1021 | 1027 | $ hg help nonexistingtopicthatwillneverexisteverever |
|
1022 | 1028 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever |
|
1023 | 1029 | (try "hg help --keyword nonexistingtopicthatwillneverexisteverever") |
|
1024 | 1030 | [255] |
|
1025 | 1031 | |
|
1026 | 1032 | Test unfound keyword |
|
1027 | 1033 | |
|
1028 | 1034 | $ hg help --keyword nonexistingwordthatwillneverexisteverever |
|
1029 | 1035 | abort: no matches |
|
1030 | 1036 | (try "hg help" for a list of topics) |
|
1031 | 1037 | [255] |
|
1032 | 1038 | |
|
1033 | 1039 | Test omit indicating for help |
|
1034 | 1040 | |
|
1035 | 1041 | $ cat > addverboseitems.py <<EOF |
|
1036 | 1042 | > '''extension to test omit indicating. |
|
1037 | 1043 | > |
|
1038 | 1044 | > This paragraph is never omitted (for extension) |
|
1039 | 1045 | > |
|
1040 | 1046 | > .. container:: verbose |
|
1041 | 1047 | > |
|
1042 | 1048 | > This paragraph is omitted, |
|
1043 | 1049 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension) |
|
1044 | 1050 | > |
|
1045 | 1051 | > This paragraph is never omitted, too (for extension) |
|
1046 | 1052 | > ''' |
|
1047 | 1053 | > |
|
1048 | 1054 | > from mercurial import help, commands |
|
1049 | 1055 | > testtopic = """This paragraph is never omitted (for topic). |
|
1050 | 1056 | > |
|
1051 | 1057 | > .. container:: verbose |
|
1052 | 1058 | > |
|
1053 | 1059 | > This paragraph is omitted, |
|
1054 | 1060 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic) |
|
1055 | 1061 | > |
|
1056 | 1062 | > This paragraph is never omitted, too (for topic) |
|
1057 | 1063 | > """ |
|
1058 | 1064 | > def extsetup(ui): |
|
1059 | 1065 | > help.helptable.append((["topic-containing-verbose"], |
|
1060 | 1066 | > "This is the topic to test omit indicating.", |
|
1061 | 1067 | > lambda : testtopic)) |
|
1062 | 1068 | > EOF |
|
1063 | 1069 | $ echo '[extensions]' >> $HGRCPATH |
|
1064 | 1070 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH |
|
1065 | 1071 | $ hg help addverboseitems |
|
1066 | 1072 | addverboseitems extension - extension to test omit indicating. |
|
1067 | 1073 | |
|
1068 | 1074 | This paragraph is never omitted (for extension) |
|
1069 | 1075 | |
|
1070 | 1076 | This paragraph is never omitted, too (for extension) |
|
1071 | 1077 | |
|
1072 | 1078 | (some details hidden, use --verbose to show complete help) |
|
1073 | 1079 | |
|
1074 | 1080 | no commands defined |
|
1075 | 1081 | $ hg help -v addverboseitems |
|
1076 | 1082 | addverboseitems extension - extension to test omit indicating. |
|
1077 | 1083 | |
|
1078 | 1084 | This paragraph is never omitted (for extension) |
|
1079 | 1085 | |
|
1080 | 1086 | This paragraph is omitted, if "hg help" is invoked without "-v" (for |
|
1081 | 1087 | extension) |
|
1082 | 1088 | |
|
1083 | 1089 | This paragraph is never omitted, too (for extension) |
|
1084 | 1090 | |
|
1085 | 1091 | no commands defined |
|
1086 | 1092 | $ hg help topic-containing-verbose |
|
1087 | 1093 | This is the topic to test omit indicating. |
|
1088 | 1094 | """""""""""""""""""""""""""""""""""""""""" |
|
1089 | 1095 | |
|
1090 | 1096 | This paragraph is never omitted (for topic). |
|
1091 | 1097 | |
|
1092 | 1098 | This paragraph is never omitted, too (for topic) |
|
1093 | 1099 | |
|
1094 | 1100 | (some details hidden, use --verbose to show complete help) |
|
1095 | 1101 | $ hg help -v topic-containing-verbose |
|
1096 | 1102 | This is the topic to test omit indicating. |
|
1097 | 1103 | """""""""""""""""""""""""""""""""""""""""" |
|
1098 | 1104 | |
|
1099 | 1105 | This paragraph is never omitted (for topic). |
|
1100 | 1106 | |
|
1101 | 1107 | This paragraph is omitted, if "hg help" is invoked without "-v" (for |
|
1102 | 1108 | topic) |
|
1103 | 1109 | |
|
1104 | 1110 | This paragraph is never omitted, too (for topic) |
|
1105 | 1111 | |
|
1106 | 1112 | Test section lookup |
|
1107 | 1113 | |
|
1108 | 1114 | $ hg help revset.merge |
|
1109 | 1115 | "merge()" |
|
1110 | 1116 | Changeset is a merge changeset. |
|
1111 | 1117 | |
|
1112 | 1118 | $ hg help glossary.dag |
|
1113 | 1119 | DAG |
|
1114 | 1120 | The repository of changesets of a distributed version control system |
|
1115 | 1121 | (DVCS) can be described as a directed acyclic graph (DAG), consisting |
|
1116 | 1122 | of nodes and edges, where nodes correspond to changesets and edges |
|
1117 | 1123 | imply a parent -> child relation. This graph can be visualized by |
|
1118 | 1124 | graphical tools such as "hg log --graph". In Mercurial, the DAG is |
|
1119 | 1125 | limited by the requirement for children to have at most two parents. |
|
1120 | 1126 | |
|
1121 | 1127 | |
|
1122 | 1128 | $ hg help hgrc.paths |
|
1123 | 1129 | "paths" |
|
1124 | 1130 | ------- |
|
1125 | 1131 | |
|
1126 | 1132 | Assigns symbolic names to repositories. The left side is the symbolic |
|
1127 | 1133 | name, and the right gives the directory or URL that is the location of the |
|
1128 | 1134 | repository. Default paths can be declared by setting the following |
|
1129 | 1135 | entries. |
|
1130 | 1136 | |
|
1131 | 1137 | "default" |
|
1132 | 1138 | Directory or URL to use when pulling if no source is specified. |
|
1133 | 1139 | (default: repository from which the current repository was cloned) |
|
1134 | 1140 | |
|
1135 | 1141 | "default-push" |
|
1136 | 1142 | Optional. Directory or URL to use when pushing if no destination is |
|
1137 | 1143 | specified. |
|
1138 | 1144 | |
|
1139 | 1145 | Custom paths can be defined by assigning the path to a name that later can |
|
1140 | 1146 | be used from the command line. Example: |
|
1141 | 1147 | |
|
1142 | 1148 | [paths] |
|
1143 | 1149 | my_path = http://example.com/path |
|
1144 | 1150 | |
|
1145 | 1151 | To push to the path defined in "my_path" run the command: |
|
1146 | 1152 | |
|
1147 | 1153 | hg push my_path |
|
1148 | 1154 | |
|
1149 | 1155 | $ hg help glossary.mcguffin |
|
1150 | 1156 | abort: help section not found |
|
1151 | 1157 | [255] |
|
1152 | 1158 | |
|
1153 | 1159 | $ hg help glossary.mc.guffin |
|
1154 | 1160 | abort: help section not found |
|
1155 | 1161 | [255] |
|
1156 | 1162 | |
|
1157 | 1163 | $ hg help template.files |
|
1158 | 1164 | files List of strings. All files modified, added, or removed by |
|
1159 | 1165 | this changeset. |
|
1160 | 1166 | |
|
1161 | 1167 | Test dynamic list of merge tools only shows up once |
|
1162 | 1168 | $ hg help merge-tools |
|
1163 | 1169 | Merge Tools |
|
1164 | 1170 | """"""""""" |
|
1165 | 1171 | |
|
1166 | 1172 | To merge files Mercurial uses merge tools. |
|
1167 | 1173 | |
|
1168 | 1174 | A merge tool combines two different versions of a file into a merged file. |
|
1169 | 1175 | Merge tools are given the two files and the greatest common ancestor of |
|
1170 | 1176 | the two file versions, so they can determine the changes made on both |
|
1171 | 1177 | branches. |
|
1172 | 1178 | |
|
1173 | 1179 | Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg |
|
1174 | 1180 | backout" and in several extensions. |
|
1175 | 1181 | |
|
1176 | 1182 | Usually, the merge tool tries to automatically reconcile the files by |
|
1177 | 1183 | combining all non-overlapping changes that occurred separately in the two |
|
1178 | 1184 | different evolutions of the same initial base file. Furthermore, some |
|
1179 | 1185 | interactive merge programs make it easier to manually resolve conflicting |
|
1180 | 1186 | merges, either in a graphical way, or by inserting some conflict markers. |
|
1181 | 1187 | Mercurial does not include any interactive merge programs but relies on |
|
1182 | 1188 | external tools for that. |
|
1183 | 1189 | |
|
1184 | 1190 | Available merge tools |
|
1185 | 1191 | ===================== |
|
1186 | 1192 | |
|
1187 | 1193 | External merge tools and their properties are configured in the merge- |
|
1188 | 1194 | tools configuration section - see hgrc(5) - but they can often just be |
|
1189 | 1195 | named by their executable. |
|
1190 | 1196 | |
|
1191 | 1197 | A merge tool is generally usable if its executable can be found on the |
|
1192 | 1198 | system and if it can handle the merge. The executable is found if it is an |
|
1193 | 1199 | absolute or relative executable path or the name of an application in the |
|
1194 | 1200 | executable search path. The tool is assumed to be able to handle the merge |
|
1195 | 1201 | if it can handle symlinks if the file is a symlink, if it can handle |
|
1196 | 1202 | binary files if the file is binary, and if a GUI is available if the tool |
|
1197 | 1203 | requires a GUI. |
|
1198 | 1204 | |
|
1199 | 1205 | There are some internal merge tools which can be used. The internal merge |
|
1200 | 1206 | tools are: |
|
1201 | 1207 | |
|
1202 | 1208 | ":dump" |
|
1203 | 1209 | Creates three versions of the files to merge, containing the contents of |
|
1204 | 1210 | local, other and base. These files can then be used to perform a merge |
|
1205 | 1211 | manually. If the file to be merged is named "a.txt", these files will |
|
1206 | 1212 | accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and |
|
1207 | 1213 | they will be placed in the same directory as "a.txt". |
|
1208 | 1214 | |
|
1209 | 1215 | ":fail" |
|
1210 | 1216 | Rather than attempting to merge files that were modified on both |
|
1211 | 1217 | branches, it marks them as unresolved. The resolve command must be used |
|
1212 | 1218 | to resolve these conflicts. |
|
1213 | 1219 | |
|
1214 | 1220 | ":local" |
|
1215 | 1221 | Uses the local version of files as the merged version. |
|
1216 | 1222 | |
|
1217 | 1223 | ":merge" |
|
1218 | 1224 | Uses the internal non-interactive simple merge algorithm for merging |
|
1219 | 1225 | files. It will fail if there are any conflicts and leave markers in the |
|
1220 | 1226 | partially merged file. Markers will have two sections, one for each side |
|
1221 | 1227 | of merge. |
|
1222 | 1228 | |
|
1223 | 1229 | ":merge-local" |
|
1224 | 1230 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
1225 | 1231 | local changes. |
|
1226 | 1232 | |
|
1227 | 1233 | ":merge-other" |
|
1228 | 1234 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
1229 | 1235 | other changes. |
|
1230 | 1236 | |
|
1231 | 1237 | ":merge3" |
|
1232 | 1238 | Uses the internal non-interactive simple merge algorithm for merging |
|
1233 | 1239 | files. It will fail if there are any conflicts and leave markers in the |
|
1234 | 1240 | partially merged file. Marker will have three sections, one from each |
|
1235 | 1241 | side of the merge and one for the base content. |
|
1236 | 1242 | |
|
1237 | 1243 | ":other" |
|
1238 | 1244 | Uses the other version of files as the merged version. |
|
1239 | 1245 | |
|
1240 | 1246 | ":prompt" |
|
1241 | 1247 | Asks the user which of the local or the other version to keep as the |
|
1242 | 1248 | merged version. |
|
1243 | 1249 | |
|
1244 | 1250 | ":tagmerge" |
|
1245 | 1251 | Uses the internal tag merge algorithm (experimental). |
|
1246 | 1252 | |
|
1247 | 1253 | ":union" |
|
1248 | 1254 | Uses the internal non-interactive simple merge algorithm for merging |
|
1249 | 1255 | files. It will use both left and right sides for conflict regions. No |
|
1250 | 1256 | markers are inserted. |
|
1251 | 1257 | |
|
1252 | 1258 | Internal tools are always available and do not require a GUI but will by |
|
1253 | 1259 | default not handle symlinks or binary files. |
|
1254 | 1260 | |
|
1255 | 1261 | Choosing a merge tool |
|
1256 | 1262 | ===================== |
|
1257 | 1263 | |
|
1258 | 1264 | Mercurial uses these rules when deciding which merge tool to use: |
|
1259 | 1265 | |
|
1260 | 1266 | 1. If a tool has been specified with the --tool option to merge or |
|
1261 | 1267 | resolve, it is used. If it is the name of a tool in the merge-tools |
|
1262 | 1268 | configuration, its configuration is used. Otherwise the specified tool |
|
1263 | 1269 | must be executable by the shell. |
|
1264 | 1270 | 2. If the "HGMERGE" environment variable is present, its value is used and |
|
1265 | 1271 | must be executable by the shell. |
|
1266 | 1272 | 3. If the filename of the file to be merged matches any of the patterns in |
|
1267 | 1273 | the merge-patterns configuration section, the first usable merge tool |
|
1268 | 1274 | corresponding to a matching pattern is used. Here, binary capabilities |
|
1269 | 1275 | of the merge tool are not considered. |
|
1270 | 1276 | 4. If ui.merge is set it will be considered next. If the value is not the |
|
1271 | 1277 | name of a configured tool, the specified value is used and must be |
|
1272 | 1278 | executable by the shell. Otherwise the named tool is used if it is |
|
1273 | 1279 | usable. |
|
1274 | 1280 | 5. If any usable merge tools are present in the merge-tools configuration |
|
1275 | 1281 | section, the one with the highest priority is used. |
|
1276 | 1282 | 6. If a program named "hgmerge" can be found on the system, it is used - |
|
1277 | 1283 | but it will by default not be used for symlinks and binary files. |
|
1278 | 1284 | 7. If the file to be merged is not binary and is not a symlink, then |
|
1279 | 1285 | internal ":merge" is used. |
|
1280 | 1286 | 8. The merge of the file fails and must be resolved before commit. |
|
1281 | 1287 | |
|
1282 | 1288 | Note: |
|
1283 | 1289 | After selecting a merge program, Mercurial will by default attempt to |
|
1284 | 1290 | merge the files using a simple merge algorithm first. Only if it |
|
1285 | 1291 | doesn't succeed because of conflicting changes Mercurial will actually |
|
1286 | 1292 | execute the merge program. Whether to use the simple merge algorithm |
|
1287 | 1293 | first can be controlled by the premerge setting of the merge tool. |
|
1288 | 1294 | Premerge is enabled by default unless the file is binary or a symlink. |
|
1289 | 1295 | |
|
1290 | 1296 | See the merge-tools and ui sections of hgrc(5) for details on the |
|
1291 | 1297 | configuration of merge tools. |
|
1292 | 1298 | |
|
1293 | 1299 | Test usage of section marks in help documents |
|
1294 | 1300 | |
|
1295 | 1301 | $ cd "$TESTDIR"/../doc |
|
1296 | 1302 | $ python check-seclevel.py |
|
1297 | 1303 | $ cd $TESTTMP |
|
1298 | 1304 | |
|
1299 | 1305 | #if serve |
|
1300 | 1306 | |
|
1301 | 1307 | Test the help pages in hgweb. |
|
1302 | 1308 | |
|
1303 | 1309 | Dish up an empty repo; serve it cold. |
|
1304 | 1310 | |
|
1305 | 1311 | $ hg init "$TESTTMP/test" |
|
1306 | 1312 | $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid |
|
1307 | 1313 | $ cat hg.pid >> $DAEMON_PIDS |
|
1308 | 1314 | |
|
1309 | 1315 | $ get-with-headers.py 127.0.0.1:$HGPORT "help" |
|
1310 | 1316 | 200 Script output follows |
|
1311 | 1317 | |
|
1312 | 1318 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1313 | 1319 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1314 | 1320 | <head> |
|
1315 | 1321 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1316 | 1322 | <meta name="robots" content="index, nofollow" /> |
|
1317 | 1323 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1318 | 1324 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1319 | 1325 | |
|
1320 | 1326 | <title>Help: Index</title> |
|
1321 | 1327 | </head> |
|
1322 | 1328 | <body> |
|
1323 | 1329 | |
|
1324 | 1330 | <div class="container"> |
|
1325 | 1331 | <div class="menu"> |
|
1326 | 1332 | <div class="logo"> |
|
1327 | 1333 | <a href="http://mercurial.selenic.com/"> |
|
1328 | 1334 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1329 | 1335 | </div> |
|
1330 | 1336 | <ul> |
|
1331 | 1337 | <li><a href="/shortlog">log</a></li> |
|
1332 | 1338 | <li><a href="/graph">graph</a></li> |
|
1333 | 1339 | <li><a href="/tags">tags</a></li> |
|
1334 | 1340 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1335 | 1341 | <li><a href="/branches">branches</a></li> |
|
1336 | 1342 | </ul> |
|
1337 | 1343 | <ul> |
|
1338 | 1344 | <li class="active">help</li> |
|
1339 | 1345 | </ul> |
|
1340 | 1346 | </div> |
|
1341 | 1347 | |
|
1342 | 1348 | <div class="main"> |
|
1343 | 1349 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1344 | 1350 | <form class="search" action="/log"> |
|
1345 | 1351 | |
|
1346 | 1352 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1347 | 1353 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1348 | 1354 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1349 | 1355 | </form> |
|
1350 | 1356 | <table class="bigtable"> |
|
1351 | 1357 | <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr> |
|
1352 | 1358 | |
|
1353 | 1359 | <tr><td> |
|
1354 | 1360 | <a href="/help/config"> |
|
1355 | 1361 | config |
|
1356 | 1362 | </a> |
|
1357 | 1363 | </td><td> |
|
1358 | 1364 | Configuration Files |
|
1359 | 1365 | </td></tr> |
|
1360 | 1366 | <tr><td> |
|
1361 | 1367 | <a href="/help/dates"> |
|
1362 | 1368 | dates |
|
1363 | 1369 | </a> |
|
1364 | 1370 | </td><td> |
|
1365 | 1371 | Date Formats |
|
1366 | 1372 | </td></tr> |
|
1367 | 1373 | <tr><td> |
|
1368 | 1374 | <a href="/help/diffs"> |
|
1369 | 1375 | diffs |
|
1370 | 1376 | </a> |
|
1371 | 1377 | </td><td> |
|
1372 | 1378 | Diff Formats |
|
1373 | 1379 | </td></tr> |
|
1374 | 1380 | <tr><td> |
|
1375 | 1381 | <a href="/help/environment"> |
|
1376 | 1382 | environment |
|
1377 | 1383 | </a> |
|
1378 | 1384 | </td><td> |
|
1379 | 1385 | Environment Variables |
|
1380 | 1386 | </td></tr> |
|
1381 | 1387 | <tr><td> |
|
1382 | 1388 | <a href="/help/extensions"> |
|
1383 | 1389 | extensions |
|
1384 | 1390 | </a> |
|
1385 | 1391 | </td><td> |
|
1386 | 1392 | Using Additional Features |
|
1387 | 1393 | </td></tr> |
|
1388 | 1394 | <tr><td> |
|
1389 | 1395 | <a href="/help/filesets"> |
|
1390 | 1396 | filesets |
|
1391 | 1397 | </a> |
|
1392 | 1398 | </td><td> |
|
1393 | 1399 | Specifying File Sets |
|
1394 | 1400 | </td></tr> |
|
1395 | 1401 | <tr><td> |
|
1396 | 1402 | <a href="/help/glossary"> |
|
1397 | 1403 | glossary |
|
1398 | 1404 | </a> |
|
1399 | 1405 | </td><td> |
|
1400 | 1406 | Glossary |
|
1401 | 1407 | </td></tr> |
|
1402 | 1408 | <tr><td> |
|
1403 | 1409 | <a href="/help/hgignore"> |
|
1404 | 1410 | hgignore |
|
1405 | 1411 | </a> |
|
1406 | 1412 | </td><td> |
|
1407 | 1413 | Syntax for Mercurial Ignore Files |
|
1408 | 1414 | </td></tr> |
|
1409 | 1415 | <tr><td> |
|
1410 | 1416 | <a href="/help/hgweb"> |
|
1411 | 1417 | hgweb |
|
1412 | 1418 | </a> |
|
1413 | 1419 | </td><td> |
|
1414 | 1420 | Configuring hgweb |
|
1415 | 1421 | </td></tr> |
|
1416 | 1422 | <tr><td> |
|
1417 | 1423 | <a href="/help/merge-tools"> |
|
1418 | 1424 | merge-tools |
|
1419 | 1425 | </a> |
|
1420 | 1426 | </td><td> |
|
1421 | 1427 | Merge Tools |
|
1422 | 1428 | </td></tr> |
|
1423 | 1429 | <tr><td> |
|
1424 | 1430 | <a href="/help/multirevs"> |
|
1425 | 1431 | multirevs |
|
1426 | 1432 | </a> |
|
1427 | 1433 | </td><td> |
|
1428 | 1434 | Specifying Multiple Revisions |
|
1429 | 1435 | </td></tr> |
|
1430 | 1436 | <tr><td> |
|
1431 | 1437 | <a href="/help/patterns"> |
|
1432 | 1438 | patterns |
|
1433 | 1439 | </a> |
|
1434 | 1440 | </td><td> |
|
1435 | 1441 | File Name Patterns |
|
1436 | 1442 | </td></tr> |
|
1437 | 1443 | <tr><td> |
|
1438 | 1444 | <a href="/help/phases"> |
|
1439 | 1445 | phases |
|
1440 | 1446 | </a> |
|
1441 | 1447 | </td><td> |
|
1442 | 1448 | Working with Phases |
|
1443 | 1449 | </td></tr> |
|
1444 | 1450 | <tr><td> |
|
1445 | 1451 | <a href="/help/revisions"> |
|
1446 | 1452 | revisions |
|
1447 | 1453 | </a> |
|
1448 | 1454 | </td><td> |
|
1449 | 1455 | Specifying Single Revisions |
|
1450 | 1456 | </td></tr> |
|
1451 | 1457 | <tr><td> |
|
1452 | 1458 | <a href="/help/revsets"> |
|
1453 | 1459 | revsets |
|
1454 | 1460 | </a> |
|
1455 | 1461 | </td><td> |
|
1456 | 1462 | Specifying Revision Sets |
|
1457 | 1463 | </td></tr> |
|
1458 | 1464 | <tr><td> |
|
1459 | 1465 | <a href="/help/scripting"> |
|
1460 | 1466 | scripting |
|
1461 | 1467 | </a> |
|
1462 | 1468 | </td><td> |
|
1463 | 1469 | Using Mercurial from scripts and automation |
|
1464 | 1470 | </td></tr> |
|
1465 | 1471 | <tr><td> |
|
1466 | 1472 | <a href="/help/subrepos"> |
|
1467 | 1473 | subrepos |
|
1468 | 1474 | </a> |
|
1469 | 1475 | </td><td> |
|
1470 | 1476 | Subrepositories |
|
1471 | 1477 | </td></tr> |
|
1472 | 1478 | <tr><td> |
|
1473 | 1479 | <a href="/help/templating"> |
|
1474 | 1480 | templating |
|
1475 | 1481 | </a> |
|
1476 | 1482 | </td><td> |
|
1477 | 1483 | Template Usage |
|
1478 | 1484 | </td></tr> |
|
1479 | 1485 | <tr><td> |
|
1480 | 1486 | <a href="/help/urls"> |
|
1481 | 1487 | urls |
|
1482 | 1488 | </a> |
|
1483 | 1489 | </td><td> |
|
1484 | 1490 | URL Paths |
|
1485 | 1491 | </td></tr> |
|
1486 | 1492 | <tr><td> |
|
1487 | 1493 | <a href="/help/topic-containing-verbose"> |
|
1488 | 1494 | topic-containing-verbose |
|
1489 | 1495 | </a> |
|
1490 | 1496 | </td><td> |
|
1491 | 1497 | This is the topic to test omit indicating. |
|
1492 | 1498 | </td></tr> |
|
1493 | 1499 | |
|
1494 | 1500 | <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr> |
|
1495 | 1501 | |
|
1496 | 1502 | <tr><td> |
|
1497 | 1503 | <a href="/help/add"> |
|
1498 | 1504 | add |
|
1499 | 1505 | </a> |
|
1500 | 1506 | </td><td> |
|
1501 | 1507 | add the specified files on the next commit |
|
1502 | 1508 | </td></tr> |
|
1503 | 1509 | <tr><td> |
|
1504 | 1510 | <a href="/help/annotate"> |
|
1505 | 1511 | annotate |
|
1506 | 1512 | </a> |
|
1507 | 1513 | </td><td> |
|
1508 | 1514 | show changeset information by line for each file |
|
1509 | 1515 | </td></tr> |
|
1510 | 1516 | <tr><td> |
|
1511 | 1517 | <a href="/help/clone"> |
|
1512 | 1518 | clone |
|
1513 | 1519 | </a> |
|
1514 | 1520 | </td><td> |
|
1515 | 1521 | make a copy of an existing repository |
|
1516 | 1522 | </td></tr> |
|
1517 | 1523 | <tr><td> |
|
1518 | 1524 | <a href="/help/commit"> |
|
1519 | 1525 | commit |
|
1520 | 1526 | </a> |
|
1521 | 1527 | </td><td> |
|
1522 | 1528 | commit the specified files or all outstanding changes |
|
1523 | 1529 | </td></tr> |
|
1524 | 1530 | <tr><td> |
|
1525 | 1531 | <a href="/help/diff"> |
|
1526 | 1532 | diff |
|
1527 | 1533 | </a> |
|
1528 | 1534 | </td><td> |
|
1529 | 1535 | diff repository (or selected files) |
|
1530 | 1536 | </td></tr> |
|
1531 | 1537 | <tr><td> |
|
1532 | 1538 | <a href="/help/export"> |
|
1533 | 1539 | export |
|
1534 | 1540 | </a> |
|
1535 | 1541 | </td><td> |
|
1536 | 1542 | dump the header and diffs for one or more changesets |
|
1537 | 1543 | </td></tr> |
|
1538 | 1544 | <tr><td> |
|
1539 | 1545 | <a href="/help/forget"> |
|
1540 | 1546 | forget |
|
1541 | 1547 | </a> |
|
1542 | 1548 | </td><td> |
|
1543 | 1549 | forget the specified files on the next commit |
|
1544 | 1550 | </td></tr> |
|
1545 | 1551 | <tr><td> |
|
1546 | 1552 | <a href="/help/init"> |
|
1547 | 1553 | init |
|
1548 | 1554 | </a> |
|
1549 | 1555 | </td><td> |
|
1550 | 1556 | create a new repository in the given directory |
|
1551 | 1557 | </td></tr> |
|
1552 | 1558 | <tr><td> |
|
1553 | 1559 | <a href="/help/log"> |
|
1554 | 1560 | log |
|
1555 | 1561 | </a> |
|
1556 | 1562 | </td><td> |
|
1557 | 1563 | show revision history of entire repository or files |
|
1558 | 1564 | </td></tr> |
|
1559 | 1565 | <tr><td> |
|
1560 | 1566 | <a href="/help/merge"> |
|
1561 | 1567 | merge |
|
1562 | 1568 | </a> |
|
1563 | 1569 | </td><td> |
|
1564 | 1570 | merge another revision into working directory |
|
1565 | 1571 | </td></tr> |
|
1566 | 1572 | <tr><td> |
|
1567 | 1573 | <a href="/help/pull"> |
|
1568 | 1574 | pull |
|
1569 | 1575 | </a> |
|
1570 | 1576 | </td><td> |
|
1571 | 1577 | pull changes from the specified source |
|
1572 | 1578 | </td></tr> |
|
1573 | 1579 | <tr><td> |
|
1574 | 1580 | <a href="/help/push"> |
|
1575 | 1581 | push |
|
1576 | 1582 | </a> |
|
1577 | 1583 | </td><td> |
|
1578 | 1584 | push changes to the specified destination |
|
1579 | 1585 | </td></tr> |
|
1580 | 1586 | <tr><td> |
|
1581 | 1587 | <a href="/help/remove"> |
|
1582 | 1588 | remove |
|
1583 | 1589 | </a> |
|
1584 | 1590 | </td><td> |
|
1585 | 1591 | remove the specified files on the next commit |
|
1586 | 1592 | </td></tr> |
|
1587 | 1593 | <tr><td> |
|
1588 | 1594 | <a href="/help/serve"> |
|
1589 | 1595 | serve |
|
1590 | 1596 | </a> |
|
1591 | 1597 | </td><td> |
|
1592 | 1598 | start stand-alone webserver |
|
1593 | 1599 | </td></tr> |
|
1594 | 1600 | <tr><td> |
|
1595 | 1601 | <a href="/help/status"> |
|
1596 | 1602 | status |
|
1597 | 1603 | </a> |
|
1598 | 1604 | </td><td> |
|
1599 | 1605 | show changed files in the working directory |
|
1600 | 1606 | </td></tr> |
|
1601 | 1607 | <tr><td> |
|
1602 | 1608 | <a href="/help/summary"> |
|
1603 | 1609 | summary |
|
1604 | 1610 | </a> |
|
1605 | 1611 | </td><td> |
|
1606 | 1612 | summarize working directory state |
|
1607 | 1613 | </td></tr> |
|
1608 | 1614 | <tr><td> |
|
1609 | 1615 | <a href="/help/update"> |
|
1610 | 1616 | update |
|
1611 | 1617 | </a> |
|
1612 | 1618 | </td><td> |
|
1613 | 1619 | update working directory (or switch revisions) |
|
1614 | 1620 | </td></tr> |
|
1615 | 1621 | |
|
1616 | 1622 | <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr> |
|
1617 | 1623 | |
|
1618 | 1624 | <tr><td> |
|
1619 | 1625 | <a href="/help/addremove"> |
|
1620 | 1626 | addremove |
|
1621 | 1627 | </a> |
|
1622 | 1628 | </td><td> |
|
1623 | 1629 | add all new files, delete all missing files |
|
1624 | 1630 | </td></tr> |
|
1625 | 1631 | <tr><td> |
|
1626 | 1632 | <a href="/help/archive"> |
|
1627 | 1633 | archive |
|
1628 | 1634 | </a> |
|
1629 | 1635 | </td><td> |
|
1630 | 1636 | create an unversioned archive of a repository revision |
|
1631 | 1637 | </td></tr> |
|
1632 | 1638 | <tr><td> |
|
1633 | 1639 | <a href="/help/backout"> |
|
1634 | 1640 | backout |
|
1635 | 1641 | </a> |
|
1636 | 1642 | </td><td> |
|
1637 | 1643 | reverse effect of earlier changeset |
|
1638 | 1644 | </td></tr> |
|
1639 | 1645 | <tr><td> |
|
1640 | 1646 | <a href="/help/bisect"> |
|
1641 | 1647 | bisect |
|
1642 | 1648 | </a> |
|
1643 | 1649 | </td><td> |
|
1644 | 1650 | subdivision search of changesets |
|
1645 | 1651 | </td></tr> |
|
1646 | 1652 | <tr><td> |
|
1647 | 1653 | <a href="/help/bookmarks"> |
|
1648 | 1654 | bookmarks |
|
1649 | 1655 | </a> |
|
1650 | 1656 | </td><td> |
|
1651 | 1657 | create a new bookmark or list existing bookmarks |
|
1652 | 1658 | </td></tr> |
|
1653 | 1659 | <tr><td> |
|
1654 | 1660 | <a href="/help/branch"> |
|
1655 | 1661 | branch |
|
1656 | 1662 | </a> |
|
1657 | 1663 | </td><td> |
|
1658 | 1664 | set or show the current branch name |
|
1659 | 1665 | </td></tr> |
|
1660 | 1666 | <tr><td> |
|
1661 | 1667 | <a href="/help/branches"> |
|
1662 | 1668 | branches |
|
1663 | 1669 | </a> |
|
1664 | 1670 | </td><td> |
|
1665 | 1671 | list repository named branches |
|
1666 | 1672 | </td></tr> |
|
1667 | 1673 | <tr><td> |
|
1668 | 1674 | <a href="/help/bundle"> |
|
1669 | 1675 | bundle |
|
1670 | 1676 | </a> |
|
1671 | 1677 | </td><td> |
|
1672 | 1678 | create a changegroup file |
|
1673 | 1679 | </td></tr> |
|
1674 | 1680 | <tr><td> |
|
1675 | 1681 | <a href="/help/cat"> |
|
1676 | 1682 | cat |
|
1677 | 1683 | </a> |
|
1678 | 1684 | </td><td> |
|
1679 | 1685 | output the current or given revision of files |
|
1680 | 1686 | </td></tr> |
|
1681 | 1687 | <tr><td> |
|
1682 | 1688 | <a href="/help/config"> |
|
1683 | 1689 | config |
|
1684 | 1690 | </a> |
|
1685 | 1691 | </td><td> |
|
1686 | 1692 | show combined config settings from all hgrc files |
|
1687 | 1693 | </td></tr> |
|
1688 | 1694 | <tr><td> |
|
1689 | 1695 | <a href="/help/copy"> |
|
1690 | 1696 | copy |
|
1691 | 1697 | </a> |
|
1692 | 1698 | </td><td> |
|
1693 | 1699 | mark files as copied for the next commit |
|
1694 | 1700 | </td></tr> |
|
1695 | 1701 | <tr><td> |
|
1696 | 1702 | <a href="/help/files"> |
|
1697 | 1703 | files |
|
1698 | 1704 | </a> |
|
1699 | 1705 | </td><td> |
|
1700 | 1706 | list tracked files |
|
1701 | 1707 | </td></tr> |
|
1702 | 1708 | <tr><td> |
|
1703 | 1709 | <a href="/help/graft"> |
|
1704 | 1710 | graft |
|
1705 | 1711 | </a> |
|
1706 | 1712 | </td><td> |
|
1707 | 1713 | copy changes from other branches onto the current branch |
|
1708 | 1714 | </td></tr> |
|
1709 | 1715 | <tr><td> |
|
1710 | 1716 | <a href="/help/grep"> |
|
1711 | 1717 | grep |
|
1712 | 1718 | </a> |
|
1713 | 1719 | </td><td> |
|
1714 | 1720 | search for a pattern in specified files and revisions |
|
1715 | 1721 | </td></tr> |
|
1716 | 1722 | <tr><td> |
|
1717 | 1723 | <a href="/help/heads"> |
|
1718 | 1724 | heads |
|
1719 | 1725 | </a> |
|
1720 | 1726 | </td><td> |
|
1721 | 1727 | show branch heads |
|
1722 | 1728 | </td></tr> |
|
1723 | 1729 | <tr><td> |
|
1724 | 1730 | <a href="/help/help"> |
|
1725 | 1731 | help |
|
1726 | 1732 | </a> |
|
1727 | 1733 | </td><td> |
|
1728 | 1734 | show help for a given topic or a help overview |
|
1729 | 1735 | </td></tr> |
|
1730 | 1736 | <tr><td> |
|
1731 | 1737 | <a href="/help/identify"> |
|
1732 | 1738 | identify |
|
1733 | 1739 | </a> |
|
1734 | 1740 | </td><td> |
|
1735 | 1741 | identify the working directory or specified revision |
|
1736 | 1742 | </td></tr> |
|
1737 | 1743 | <tr><td> |
|
1738 | 1744 | <a href="/help/import"> |
|
1739 | 1745 | import |
|
1740 | 1746 | </a> |
|
1741 | 1747 | </td><td> |
|
1742 | 1748 | import an ordered set of patches |
|
1743 | 1749 | </td></tr> |
|
1744 | 1750 | <tr><td> |
|
1745 | 1751 | <a href="/help/incoming"> |
|
1746 | 1752 | incoming |
|
1747 | 1753 | </a> |
|
1748 | 1754 | </td><td> |
|
1749 | 1755 | show new changesets found in source |
|
1750 | 1756 | </td></tr> |
|
1751 | 1757 | <tr><td> |
|
1752 | 1758 | <a href="/help/manifest"> |
|
1753 | 1759 | manifest |
|
1754 | 1760 | </a> |
|
1755 | 1761 | </td><td> |
|
1756 | 1762 | output the current or given revision of the project manifest |
|
1757 | 1763 | </td></tr> |
|
1758 | 1764 | <tr><td> |
|
1759 | 1765 | <a href="/help/nohelp"> |
|
1760 | 1766 | nohelp |
|
1761 | 1767 | </a> |
|
1762 | 1768 | </td><td> |
|
1763 | 1769 | (no help text available) |
|
1764 | 1770 | </td></tr> |
|
1765 | 1771 | <tr><td> |
|
1766 | 1772 | <a href="/help/outgoing"> |
|
1767 | 1773 | outgoing |
|
1768 | 1774 | </a> |
|
1769 | 1775 | </td><td> |
|
1770 | 1776 | show changesets not found in the destination |
|
1771 | 1777 | </td></tr> |
|
1772 | 1778 | <tr><td> |
|
1773 | 1779 | <a href="/help/paths"> |
|
1774 | 1780 | paths |
|
1775 | 1781 | </a> |
|
1776 | 1782 | </td><td> |
|
1777 | 1783 | show aliases for remote repositories |
|
1778 | 1784 | </td></tr> |
|
1779 | 1785 | <tr><td> |
|
1780 | 1786 | <a href="/help/phase"> |
|
1781 | 1787 | phase |
|
1782 | 1788 | </a> |
|
1783 | 1789 | </td><td> |
|
1784 | 1790 | set or show the current phase name |
|
1785 | 1791 | </td></tr> |
|
1786 | 1792 | <tr><td> |
|
1787 | 1793 | <a href="/help/recover"> |
|
1788 | 1794 | recover |
|
1789 | 1795 | </a> |
|
1790 | 1796 | </td><td> |
|
1791 | 1797 | roll back an interrupted transaction |
|
1792 | 1798 | </td></tr> |
|
1793 | 1799 | <tr><td> |
|
1794 | 1800 | <a href="/help/rename"> |
|
1795 | 1801 | rename |
|
1796 | 1802 | </a> |
|
1797 | 1803 | </td><td> |
|
1798 | 1804 | rename files; equivalent of copy + remove |
|
1799 | 1805 | </td></tr> |
|
1800 | 1806 | <tr><td> |
|
1801 | 1807 | <a href="/help/resolve"> |
|
1802 | 1808 | resolve |
|
1803 | 1809 | </a> |
|
1804 | 1810 | </td><td> |
|
1805 | 1811 | redo merges or set/view the merge status of files |
|
1806 | 1812 | </td></tr> |
|
1807 | 1813 | <tr><td> |
|
1808 | 1814 | <a href="/help/revert"> |
|
1809 | 1815 | revert |
|
1810 | 1816 | </a> |
|
1811 | 1817 | </td><td> |
|
1812 | 1818 | restore files to their checkout state |
|
1813 | 1819 | </td></tr> |
|
1814 | 1820 | <tr><td> |
|
1815 | 1821 | <a href="/help/root"> |
|
1816 | 1822 | root |
|
1817 | 1823 | </a> |
|
1818 | 1824 | </td><td> |
|
1819 | 1825 | print the root (top) of the current working directory |
|
1820 | 1826 | </td></tr> |
|
1821 | 1827 | <tr><td> |
|
1822 | 1828 | <a href="/help/tag"> |
|
1823 | 1829 | tag |
|
1824 | 1830 | </a> |
|
1825 | 1831 | </td><td> |
|
1826 | 1832 | add one or more tags for the current or given revision |
|
1827 | 1833 | </td></tr> |
|
1828 | 1834 | <tr><td> |
|
1829 | 1835 | <a href="/help/tags"> |
|
1830 | 1836 | tags |
|
1831 | 1837 | </a> |
|
1832 | 1838 | </td><td> |
|
1833 | 1839 | list repository tags |
|
1834 | 1840 | </td></tr> |
|
1835 | 1841 | <tr><td> |
|
1836 | 1842 | <a href="/help/unbundle"> |
|
1837 | 1843 | unbundle |
|
1838 | 1844 | </a> |
|
1839 | 1845 | </td><td> |
|
1840 | 1846 | apply one or more changegroup files |
|
1841 | 1847 | </td></tr> |
|
1842 | 1848 | <tr><td> |
|
1843 | 1849 | <a href="/help/verify"> |
|
1844 | 1850 | verify |
|
1845 | 1851 | </a> |
|
1846 | 1852 | </td><td> |
|
1847 | 1853 | verify the integrity of the repository |
|
1848 | 1854 | </td></tr> |
|
1849 | 1855 | <tr><td> |
|
1850 | 1856 | <a href="/help/version"> |
|
1851 | 1857 | version |
|
1852 | 1858 | </a> |
|
1853 | 1859 | </td><td> |
|
1854 | 1860 | output version and copyright information |
|
1855 | 1861 | </td></tr> |
|
1856 | 1862 | </table> |
|
1857 | 1863 | </div> |
|
1858 | 1864 | </div> |
|
1859 | 1865 | |
|
1860 | 1866 | <script type="text/javascript">process_dates()</script> |
|
1861 | 1867 | |
|
1862 | 1868 | |
|
1863 | 1869 | </body> |
|
1864 | 1870 | </html> |
|
1865 | 1871 | |
|
1866 | 1872 | |
|
1867 | 1873 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/add" |
|
1868 | 1874 | 200 Script output follows |
|
1869 | 1875 | |
|
1870 | 1876 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1871 | 1877 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1872 | 1878 | <head> |
|
1873 | 1879 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1874 | 1880 | <meta name="robots" content="index, nofollow" /> |
|
1875 | 1881 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1876 | 1882 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1877 | 1883 | |
|
1878 | 1884 | <title>Help: add</title> |
|
1879 | 1885 | </head> |
|
1880 | 1886 | <body> |
|
1881 | 1887 | |
|
1882 | 1888 | <div class="container"> |
|
1883 | 1889 | <div class="menu"> |
|
1884 | 1890 | <div class="logo"> |
|
1885 | 1891 | <a href="http://mercurial.selenic.com/"> |
|
1886 | 1892 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1887 | 1893 | </div> |
|
1888 | 1894 | <ul> |
|
1889 | 1895 | <li><a href="/shortlog">log</a></li> |
|
1890 | 1896 | <li><a href="/graph">graph</a></li> |
|
1891 | 1897 | <li><a href="/tags">tags</a></li> |
|
1892 | 1898 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1893 | 1899 | <li><a href="/branches">branches</a></li> |
|
1894 | 1900 | </ul> |
|
1895 | 1901 | <ul> |
|
1896 | 1902 | <li class="active"><a href="/help">help</a></li> |
|
1897 | 1903 | </ul> |
|
1898 | 1904 | </div> |
|
1899 | 1905 | |
|
1900 | 1906 | <div class="main"> |
|
1901 | 1907 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1902 | 1908 | <h3>Help: add</h3> |
|
1903 | 1909 | |
|
1904 | 1910 | <form class="search" action="/log"> |
|
1905 | 1911 | |
|
1906 | 1912 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1907 | 1913 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1908 | 1914 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1909 | 1915 | </form> |
|
1910 | 1916 | <div id="doc"> |
|
1911 | 1917 | <p> |
|
1912 | 1918 | hg add [OPTION]... [FILE]... |
|
1913 | 1919 | </p> |
|
1914 | 1920 | <p> |
|
1915 | 1921 | add the specified files on the next commit |
|
1916 | 1922 | </p> |
|
1917 | 1923 | <p> |
|
1918 | 1924 | Schedule files to be version controlled and added to the |
|
1919 | 1925 | repository. |
|
1920 | 1926 | </p> |
|
1921 | 1927 | <p> |
|
1922 | 1928 | The files will be added to the repository at the next commit. To |
|
1923 | 1929 | undo an add before that, see "hg forget". |
|
1924 | 1930 | </p> |
|
1925 | 1931 | <p> |
|
1926 | 1932 | If no names are given, add all files to the repository. |
|
1927 | 1933 | </p> |
|
1928 | 1934 | <p> |
|
1929 | 1935 | An example showing how new (unknown) files are added |
|
1930 | 1936 | automatically by "hg add": |
|
1931 | 1937 | </p> |
|
1932 | 1938 | <pre> |
|
1933 | 1939 | \$ ls (re) |
|
1934 | 1940 | foo.c |
|
1935 | 1941 | \$ hg status (re) |
|
1936 | 1942 | ? foo.c |
|
1937 | 1943 | \$ hg add (re) |
|
1938 | 1944 | adding foo.c |
|
1939 | 1945 | \$ hg status (re) |
|
1940 | 1946 | A foo.c |
|
1941 | 1947 | </pre> |
|
1942 | 1948 | <p> |
|
1943 | 1949 | Returns 0 if all files are successfully added. |
|
1944 | 1950 | </p> |
|
1945 | 1951 | <p> |
|
1946 | 1952 | options ([+] can be repeated): |
|
1947 | 1953 | </p> |
|
1948 | 1954 | <table> |
|
1949 | 1955 | <tr><td>-I</td> |
|
1950 | 1956 | <td>--include PATTERN [+]</td> |
|
1951 | 1957 | <td>include names matching the given patterns</td></tr> |
|
1952 | 1958 | <tr><td>-X</td> |
|
1953 | 1959 | <td>--exclude PATTERN [+]</td> |
|
1954 | 1960 | <td>exclude names matching the given patterns</td></tr> |
|
1955 | 1961 | <tr><td>-S</td> |
|
1956 | 1962 | <td>--subrepos</td> |
|
1957 | 1963 | <td>recurse into subrepositories</td></tr> |
|
1958 | 1964 | <tr><td>-n</td> |
|
1959 | 1965 | <td>--dry-run</td> |
|
1960 | 1966 | <td>do not perform actions, just print output</td></tr> |
|
1961 | 1967 | </table> |
|
1962 | 1968 | <p> |
|
1963 | 1969 | global options ([+] can be repeated): |
|
1964 | 1970 | </p> |
|
1965 | 1971 | <table> |
|
1966 | 1972 | <tr><td>-R</td> |
|
1967 | 1973 | <td>--repository REPO</td> |
|
1968 | 1974 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
1969 | 1975 | <tr><td></td> |
|
1970 | 1976 | <td>--cwd DIR</td> |
|
1971 | 1977 | <td>change working directory</td></tr> |
|
1972 | 1978 | <tr><td>-y</td> |
|
1973 | 1979 | <td>--noninteractive</td> |
|
1974 | 1980 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
1975 | 1981 | <tr><td>-q</td> |
|
1976 | 1982 | <td>--quiet</td> |
|
1977 | 1983 | <td>suppress output</td></tr> |
|
1978 | 1984 | <tr><td>-v</td> |
|
1979 | 1985 | <td>--verbose</td> |
|
1980 | 1986 | <td>enable additional output</td></tr> |
|
1981 | 1987 | <tr><td></td> |
|
1982 | 1988 | <td>--config CONFIG [+]</td> |
|
1983 | 1989 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
1984 | 1990 | <tr><td></td> |
|
1985 | 1991 | <td>--debug</td> |
|
1986 | 1992 | <td>enable debugging output</td></tr> |
|
1987 | 1993 | <tr><td></td> |
|
1988 | 1994 | <td>--debugger</td> |
|
1989 | 1995 | <td>start debugger</td></tr> |
|
1990 | 1996 | <tr><td></td> |
|
1991 | 1997 | <td>--encoding ENCODE</td> |
|
1992 | 1998 | <td>set the charset encoding (default: ascii)</td></tr> |
|
1993 | 1999 | <tr><td></td> |
|
1994 | 2000 | <td>--encodingmode MODE</td> |
|
1995 | 2001 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
1996 | 2002 | <tr><td></td> |
|
1997 | 2003 | <td>--traceback</td> |
|
1998 | 2004 | <td>always print a traceback on exception</td></tr> |
|
1999 | 2005 | <tr><td></td> |
|
2000 | 2006 | <td>--time</td> |
|
2001 | 2007 | <td>time how long the command takes</td></tr> |
|
2002 | 2008 | <tr><td></td> |
|
2003 | 2009 | <td>--profile</td> |
|
2004 | 2010 | <td>print command execution profile</td></tr> |
|
2005 | 2011 | <tr><td></td> |
|
2006 | 2012 | <td>--version</td> |
|
2007 | 2013 | <td>output version information and exit</td></tr> |
|
2008 | 2014 | <tr><td>-h</td> |
|
2009 | 2015 | <td>--help</td> |
|
2010 | 2016 | <td>display help and exit</td></tr> |
|
2011 | 2017 | <tr><td></td> |
|
2012 | 2018 | <td>--hidden</td> |
|
2013 | 2019 | <td>consider hidden changesets</td></tr> |
|
2014 | 2020 | </table> |
|
2015 | 2021 | |
|
2016 | 2022 | </div> |
|
2017 | 2023 | </div> |
|
2018 | 2024 | </div> |
|
2019 | 2025 | |
|
2020 | 2026 | <script type="text/javascript">process_dates()</script> |
|
2021 | 2027 | |
|
2022 | 2028 | |
|
2023 | 2029 | </body> |
|
2024 | 2030 | </html> |
|
2025 | 2031 | |
|
2026 | 2032 | |
|
2027 | 2033 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove" |
|
2028 | 2034 | 200 Script output follows |
|
2029 | 2035 | |
|
2030 | 2036 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2031 | 2037 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2032 | 2038 | <head> |
|
2033 | 2039 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2034 | 2040 | <meta name="robots" content="index, nofollow" /> |
|
2035 | 2041 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2036 | 2042 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2037 | 2043 | |
|
2038 | 2044 | <title>Help: remove</title> |
|
2039 | 2045 | </head> |
|
2040 | 2046 | <body> |
|
2041 | 2047 | |
|
2042 | 2048 | <div class="container"> |
|
2043 | 2049 | <div class="menu"> |
|
2044 | 2050 | <div class="logo"> |
|
2045 | 2051 | <a href="http://mercurial.selenic.com/"> |
|
2046 | 2052 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2047 | 2053 | </div> |
|
2048 | 2054 | <ul> |
|
2049 | 2055 | <li><a href="/shortlog">log</a></li> |
|
2050 | 2056 | <li><a href="/graph">graph</a></li> |
|
2051 | 2057 | <li><a href="/tags">tags</a></li> |
|
2052 | 2058 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2053 | 2059 | <li><a href="/branches">branches</a></li> |
|
2054 | 2060 | </ul> |
|
2055 | 2061 | <ul> |
|
2056 | 2062 | <li class="active"><a href="/help">help</a></li> |
|
2057 | 2063 | </ul> |
|
2058 | 2064 | </div> |
|
2059 | 2065 | |
|
2060 | 2066 | <div class="main"> |
|
2061 | 2067 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2062 | 2068 | <h3>Help: remove</h3> |
|
2063 | 2069 | |
|
2064 | 2070 | <form class="search" action="/log"> |
|
2065 | 2071 | |
|
2066 | 2072 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2067 | 2073 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2068 | 2074 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2069 | 2075 | </form> |
|
2070 | 2076 | <div id="doc"> |
|
2071 | 2077 | <p> |
|
2072 | 2078 | hg remove [OPTION]... FILE... |
|
2073 | 2079 | </p> |
|
2074 | 2080 | <p> |
|
2075 | 2081 | aliases: rm |
|
2076 | 2082 | </p> |
|
2077 | 2083 | <p> |
|
2078 | 2084 | remove the specified files on the next commit |
|
2079 | 2085 | </p> |
|
2080 | 2086 | <p> |
|
2081 | 2087 | Schedule the indicated files for removal from the current branch. |
|
2082 | 2088 | </p> |
|
2083 | 2089 | <p> |
|
2084 | 2090 | This command schedules the files to be removed at the next commit. |
|
2085 | 2091 | To undo a remove before that, see "hg revert". To undo added |
|
2086 | 2092 | files, see "hg forget". |
|
2087 | 2093 | </p> |
|
2088 | 2094 | <p> |
|
2089 | 2095 | -A/--after can be used to remove only files that have already |
|
2090 | 2096 | been deleted, -f/--force can be used to force deletion, and -Af |
|
2091 | 2097 | can be used to remove files from the next revision without |
|
2092 | 2098 | deleting them from the working directory. |
|
2093 | 2099 | </p> |
|
2094 | 2100 | <p> |
|
2095 | 2101 | The following table details the behavior of remove for different |
|
2096 | 2102 | file states (columns) and option combinations (rows). The file |
|
2097 | 2103 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
2098 | 2104 | (as reported by "hg status"). The actions are Warn, Remove |
|
2099 | 2105 | (from branch) and Delete (from disk): |
|
2100 | 2106 | </p> |
|
2101 | 2107 | <table> |
|
2102 | 2108 | <tr><td>opt/state</td> |
|
2103 | 2109 | <td>A</td> |
|
2104 | 2110 | <td>C</td> |
|
2105 | 2111 | <td>M</td> |
|
2106 | 2112 | <td>!</td></tr> |
|
2107 | 2113 | <tr><td>none</td> |
|
2108 | 2114 | <td>W</td> |
|
2109 | 2115 | <td>RD</td> |
|
2110 | 2116 | <td>W</td> |
|
2111 | 2117 | <td>R</td></tr> |
|
2112 | 2118 | <tr><td>-f</td> |
|
2113 | 2119 | <td>R</td> |
|
2114 | 2120 | <td>RD</td> |
|
2115 | 2121 | <td>RD</td> |
|
2116 | 2122 | <td>R</td></tr> |
|
2117 | 2123 | <tr><td>-A</td> |
|
2118 | 2124 | <td>W</td> |
|
2119 | 2125 | <td>W</td> |
|
2120 | 2126 | <td>W</td> |
|
2121 | 2127 | <td>R</td></tr> |
|
2122 | 2128 | <tr><td>-Af</td> |
|
2123 | 2129 | <td>R</td> |
|
2124 | 2130 | <td>R</td> |
|
2125 | 2131 | <td>R</td> |
|
2126 | 2132 | <td>R</td></tr> |
|
2127 | 2133 | </table> |
|
2128 | 2134 | <p> |
|
2129 | 2135 | Note that remove never deletes files in Added [A] state from the |
|
2130 | 2136 | working directory, not even if option --force is specified. |
|
2131 | 2137 | </p> |
|
2132 | 2138 | <p> |
|
2133 | 2139 | Returns 0 on success, 1 if any warnings encountered. |
|
2134 | 2140 | </p> |
|
2135 | 2141 | <p> |
|
2136 | 2142 | options ([+] can be repeated): |
|
2137 | 2143 | </p> |
|
2138 | 2144 | <table> |
|
2139 | 2145 | <tr><td>-A</td> |
|
2140 | 2146 | <td>--after</td> |
|
2141 | 2147 | <td>record delete for missing files</td></tr> |
|
2142 | 2148 | <tr><td>-f</td> |
|
2143 | 2149 | <td>--force</td> |
|
2144 | 2150 | <td>remove (and delete) file even if added or modified</td></tr> |
|
2145 | 2151 | <tr><td>-S</td> |
|
2146 | 2152 | <td>--subrepos</td> |
|
2147 | 2153 | <td>recurse into subrepositories</td></tr> |
|
2148 | 2154 | <tr><td>-I</td> |
|
2149 | 2155 | <td>--include PATTERN [+]</td> |
|
2150 | 2156 | <td>include names matching the given patterns</td></tr> |
|
2151 | 2157 | <tr><td>-X</td> |
|
2152 | 2158 | <td>--exclude PATTERN [+]</td> |
|
2153 | 2159 | <td>exclude names matching the given patterns</td></tr> |
|
2154 | 2160 | </table> |
|
2155 | 2161 | <p> |
|
2156 | 2162 | global options ([+] can be repeated): |
|
2157 | 2163 | </p> |
|
2158 | 2164 | <table> |
|
2159 | 2165 | <tr><td>-R</td> |
|
2160 | 2166 | <td>--repository REPO</td> |
|
2161 | 2167 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
2162 | 2168 | <tr><td></td> |
|
2163 | 2169 | <td>--cwd DIR</td> |
|
2164 | 2170 | <td>change working directory</td></tr> |
|
2165 | 2171 | <tr><td>-y</td> |
|
2166 | 2172 | <td>--noninteractive</td> |
|
2167 | 2173 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
2168 | 2174 | <tr><td>-q</td> |
|
2169 | 2175 | <td>--quiet</td> |
|
2170 | 2176 | <td>suppress output</td></tr> |
|
2171 | 2177 | <tr><td>-v</td> |
|
2172 | 2178 | <td>--verbose</td> |
|
2173 | 2179 | <td>enable additional output</td></tr> |
|
2174 | 2180 | <tr><td></td> |
|
2175 | 2181 | <td>--config CONFIG [+]</td> |
|
2176 | 2182 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
2177 | 2183 | <tr><td></td> |
|
2178 | 2184 | <td>--debug</td> |
|
2179 | 2185 | <td>enable debugging output</td></tr> |
|
2180 | 2186 | <tr><td></td> |
|
2181 | 2187 | <td>--debugger</td> |
|
2182 | 2188 | <td>start debugger</td></tr> |
|
2183 | 2189 | <tr><td></td> |
|
2184 | 2190 | <td>--encoding ENCODE</td> |
|
2185 | 2191 | <td>set the charset encoding (default: ascii)</td></tr> |
|
2186 | 2192 | <tr><td></td> |
|
2187 | 2193 | <td>--encodingmode MODE</td> |
|
2188 | 2194 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
2189 | 2195 | <tr><td></td> |
|
2190 | 2196 | <td>--traceback</td> |
|
2191 | 2197 | <td>always print a traceback on exception</td></tr> |
|
2192 | 2198 | <tr><td></td> |
|
2193 | 2199 | <td>--time</td> |
|
2194 | 2200 | <td>time how long the command takes</td></tr> |
|
2195 | 2201 | <tr><td></td> |
|
2196 | 2202 | <td>--profile</td> |
|
2197 | 2203 | <td>print command execution profile</td></tr> |
|
2198 | 2204 | <tr><td></td> |
|
2199 | 2205 | <td>--version</td> |
|
2200 | 2206 | <td>output version information and exit</td></tr> |
|
2201 | 2207 | <tr><td>-h</td> |
|
2202 | 2208 | <td>--help</td> |
|
2203 | 2209 | <td>display help and exit</td></tr> |
|
2204 | 2210 | <tr><td></td> |
|
2205 | 2211 | <td>--hidden</td> |
|
2206 | 2212 | <td>consider hidden changesets</td></tr> |
|
2207 | 2213 | </table> |
|
2208 | 2214 | |
|
2209 | 2215 | </div> |
|
2210 | 2216 | </div> |
|
2211 | 2217 | </div> |
|
2212 | 2218 | |
|
2213 | 2219 | <script type="text/javascript">process_dates()</script> |
|
2214 | 2220 | |
|
2215 | 2221 | |
|
2216 | 2222 | </body> |
|
2217 | 2223 | </html> |
|
2218 | 2224 | |
|
2219 | 2225 | |
|
2220 | 2226 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions" |
|
2221 | 2227 | 200 Script output follows |
|
2222 | 2228 | |
|
2223 | 2229 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2224 | 2230 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2225 | 2231 | <head> |
|
2226 | 2232 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2227 | 2233 | <meta name="robots" content="index, nofollow" /> |
|
2228 | 2234 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2229 | 2235 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2230 | 2236 | |
|
2231 | 2237 | <title>Help: revisions</title> |
|
2232 | 2238 | </head> |
|
2233 | 2239 | <body> |
|
2234 | 2240 | |
|
2235 | 2241 | <div class="container"> |
|
2236 | 2242 | <div class="menu"> |
|
2237 | 2243 | <div class="logo"> |
|
2238 | 2244 | <a href="http://mercurial.selenic.com/"> |
|
2239 | 2245 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2240 | 2246 | </div> |
|
2241 | 2247 | <ul> |
|
2242 | 2248 | <li><a href="/shortlog">log</a></li> |
|
2243 | 2249 | <li><a href="/graph">graph</a></li> |
|
2244 | 2250 | <li><a href="/tags">tags</a></li> |
|
2245 | 2251 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2246 | 2252 | <li><a href="/branches">branches</a></li> |
|
2247 | 2253 | </ul> |
|
2248 | 2254 | <ul> |
|
2249 | 2255 | <li class="active"><a href="/help">help</a></li> |
|
2250 | 2256 | </ul> |
|
2251 | 2257 | </div> |
|
2252 | 2258 | |
|
2253 | 2259 | <div class="main"> |
|
2254 | 2260 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2255 | 2261 | <h3>Help: revisions</h3> |
|
2256 | 2262 | |
|
2257 | 2263 | <form class="search" action="/log"> |
|
2258 | 2264 | |
|
2259 | 2265 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2260 | 2266 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2261 | 2267 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2262 | 2268 | </form> |
|
2263 | 2269 | <div id="doc"> |
|
2264 | 2270 | <h1>Specifying Single Revisions</h1> |
|
2265 | 2271 | <p> |
|
2266 | 2272 | Mercurial supports several ways to specify individual revisions. |
|
2267 | 2273 | </p> |
|
2268 | 2274 | <p> |
|
2269 | 2275 | A plain integer is treated as a revision number. Negative integers are |
|
2270 | 2276 | treated as sequential offsets from the tip, with -1 denoting the tip, |
|
2271 | 2277 | -2 denoting the revision prior to the tip, and so forth. |
|
2272 | 2278 | </p> |
|
2273 | 2279 | <p> |
|
2274 | 2280 | A 40-digit hexadecimal string is treated as a unique revision |
|
2275 | 2281 | identifier. |
|
2276 | 2282 | </p> |
|
2277 | 2283 | <p> |
|
2278 | 2284 | A hexadecimal string less than 40 characters long is treated as a |
|
2279 | 2285 | unique revision identifier and is referred to as a short-form |
|
2280 | 2286 | identifier. A short-form identifier is only valid if it is the prefix |
|
2281 | 2287 | of exactly one full-length identifier. |
|
2282 | 2288 | </p> |
|
2283 | 2289 | <p> |
|
2284 | 2290 | Any other string is treated as a bookmark, tag, or branch name. A |
|
2285 | 2291 | bookmark is a movable pointer to a revision. A tag is a permanent name |
|
2286 | 2292 | associated with a revision. A branch name denotes the tipmost open branch head |
|
2287 | 2293 | of that branch - or if they are all closed, the tipmost closed head of the |
|
2288 | 2294 | branch. Bookmark, tag, and branch names must not contain the ":" character. |
|
2289 | 2295 | </p> |
|
2290 | 2296 | <p> |
|
2291 | 2297 | The reserved name "tip" always identifies the most recent revision. |
|
2292 | 2298 | </p> |
|
2293 | 2299 | <p> |
|
2294 | 2300 | The reserved name "null" indicates the null revision. This is the |
|
2295 | 2301 | revision of an empty repository, and the parent of revision 0. |
|
2296 | 2302 | </p> |
|
2297 | 2303 | <p> |
|
2298 | 2304 | The reserved name "." indicates the working directory parent. If no |
|
2299 | 2305 | working directory is checked out, it is equivalent to null. If an |
|
2300 | 2306 | uncommitted merge is in progress, "." is the revision of the first |
|
2301 | 2307 | parent. |
|
2302 | 2308 | </p> |
|
2303 | 2309 | |
|
2304 | 2310 | </div> |
|
2305 | 2311 | </div> |
|
2306 | 2312 | </div> |
|
2307 | 2313 | |
|
2308 | 2314 | <script type="text/javascript">process_dates()</script> |
|
2309 | 2315 | |
|
2310 | 2316 | |
|
2311 | 2317 | </body> |
|
2312 | 2318 | </html> |
|
2313 | 2319 | |
|
2314 | 2320 | |
|
2315 | 2321 | $ killdaemons.py |
|
2316 | 2322 | |
|
2317 | 2323 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now