Show More
@@ -1,795 +1,816 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 https://mercurial-scm.org/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 | # indentation. |
|
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 | lastparents = [] | |
|
665 | synthetic = [] | |
|
666 | collapse = True | |
|
664 | 667 | while i < len(sections): |
|
665 | 668 | name, nest, b = sections[i] |
|
666 | 669 | del parents[nest:] |
|
667 |
parents.append( |
|
|
670 | parents.append(i) | |
|
668 | 671 | if name == section: |
|
669 |
|
|
|
672 | if lastparents != parents: | |
|
673 | llen = len(lastparents) | |
|
674 | plen = len(parents) | |
|
675 | if llen and llen != plen: | |
|
676 | collapse = False | |
|
677 | s = [] | |
|
678 | for j in xrange(3, plen - 1): | |
|
679 | parent = parents[j] | |
|
680 | if (j >= llen or | |
|
681 | lastparents[j] != parent): | |
|
682 | s.append(len(blocks)) | |
|
683 | sec = sections[parent][2] | |
|
684 | blocks.append(sec[0]) | |
|
685 | blocks.append(sec[-1]) | |
|
686 | if s: | |
|
687 | synthetic.append(s) | |
|
688 | ||
|
689 | lastparents = parents[:] | |
|
670 | 690 | blocks.extend(b) |
|
671 | 691 | |
|
672 | 692 | ## Also show all subnested sections |
|
673 | 693 | while i + 1 < len(sections) and sections[i + 1][1] > nest: |
|
674 | 694 | i += 1 |
|
675 | 695 | blocks.extend(sections[i][2]) |
|
676 | 696 | i += 1 |
|
697 | if collapse: | |
|
698 | synthetic.reverse() | |
|
699 | for s in synthetic: | |
|
700 | path = [blocks[i]['lines'][0] for i in s] | |
|
701 | real = s[-1] + 2 | |
|
702 | realline = blocks[real]['lines'] | |
|
703 | realline[0] = ('"%s"' % | |
|
704 | '.'.join(path + [realline[0]]).replace('"', '')) | |
|
705 | del blocks[s[0]:real] | |
|
677 | 706 | |
|
678 | 707 | if style == 'html': |
|
679 | 708 | text = formathtml(blocks) |
|
680 | 709 | else: |
|
681 | if len([b for b in blocks if b['type'] == 'definition']) > 1: | |
|
682 | i = 0 | |
|
683 | while i < len(blocks): | |
|
684 | if blocks[i]['type'] == 'definition': | |
|
685 | if 'path' in blocks[i]: | |
|
686 | blocks[i]['lines'][0] = '"%s"' % '.'.join( | |
|
687 | blocks[i]['path']) | |
|
688 | i += 1 | |
|
689 | 710 | text = ''.join(formatblock(b, width) for b in blocks) |
|
690 | 711 | if keep is None: |
|
691 | 712 | return text |
|
692 | 713 | else: |
|
693 | 714 | return text, pruned |
|
694 | 715 | |
|
695 | 716 | def getsections(blocks): |
|
696 | 717 | '''return a list of (section name, nesting level, blocks) tuples''' |
|
697 | 718 | nest = "" |
|
698 | 719 | level = 0 |
|
699 | 720 | secs = [] |
|
700 | 721 | |
|
701 | 722 | def getname(b): |
|
702 | 723 | if b['type'] == 'field': |
|
703 | 724 | x = b['key'] |
|
704 | 725 | else: |
|
705 | 726 | x = b['lines'][0] |
|
706 | 727 | x = x.lower().strip('"') |
|
707 | 728 | if '(' in x: |
|
708 | 729 | x = x.split('(')[0] |
|
709 | 730 | return x |
|
710 | 731 | |
|
711 | 732 | for b in blocks: |
|
712 | 733 | if b['type'] == 'section': |
|
713 | 734 | i = b['underline'] |
|
714 | 735 | if i not in nest: |
|
715 | 736 | nest += i |
|
716 | 737 | level = nest.index(i) + 1 |
|
717 | 738 | nest = nest[:level] |
|
718 | 739 | secs.append((getname(b), level, [b])) |
|
719 | 740 | elif b['type'] in ('definition', 'field'): |
|
720 | 741 | i = ' ' |
|
721 | 742 | if i not in nest: |
|
722 | 743 | nest += i |
|
723 | 744 | level = nest.index(i) + 1 |
|
724 | 745 | nest = nest[:level] |
|
725 | 746 | for i in range(1, len(secs) + 1): |
|
726 | 747 | sec = secs[-i] |
|
727 | 748 | if sec[1] < level: |
|
728 | 749 | break |
|
729 | 750 | siblings = [a for a in sec[2] if a['type'] == 'definition'] |
|
730 | 751 | if siblings: |
|
731 | 752 | siblingindent = siblings[-1]['indent'] |
|
732 | 753 | indent = b['indent'] |
|
733 | 754 | if siblingindent < indent: |
|
734 | 755 | level += 1 |
|
735 | 756 | break |
|
736 | 757 | elif siblingindent == indent: |
|
737 | 758 | level = sec[1] |
|
738 | 759 | break |
|
739 | 760 | secs.append((getname(b), level, [b])) |
|
740 | 761 | else: |
|
741 | 762 | if not secs: |
|
742 | 763 | # add an initial empty section |
|
743 | 764 | secs = [('', 0, [])] |
|
744 | 765 | if b['type'] != 'margin': |
|
745 | 766 | pointer = 1 |
|
746 | 767 | bindent = b['indent'] |
|
747 | 768 | while pointer < len(secs): |
|
748 | 769 | section = secs[-pointer][2][0] |
|
749 | 770 | if section['type'] != 'margin': |
|
750 | 771 | sindent = section['indent'] |
|
751 | 772 | if len(section['lines']) > 1: |
|
752 | 773 | sindent += len(section['lines'][1]) - \ |
|
753 | 774 | len(section['lines'][1].lstrip(' ')) |
|
754 | 775 | if bindent >= sindent: |
|
755 | 776 | break |
|
756 | 777 | pointer += 1 |
|
757 | 778 | if pointer > 1: |
|
758 | 779 | blevel = secs[-pointer][1] |
|
759 | 780 | if section['type'] != b['type']: |
|
760 | 781 | blevel += 1 |
|
761 | 782 | secs.append(('', blevel, [])) |
|
762 | 783 | secs[-1][2].append(b) |
|
763 | 784 | return secs |
|
764 | 785 | |
|
765 | 786 | def decorateblocks(blocks, width): |
|
766 | 787 | '''generate a list of (section name, line text) pairs for search''' |
|
767 | 788 | lines = [] |
|
768 | 789 | for s in getsections(blocks): |
|
769 | 790 | section = s[0] |
|
770 | 791 | text = formatblocks(s[2], width) |
|
771 | 792 | lines.append([(section, l) for l in text.splitlines(True)]) |
|
772 | 793 | return lines |
|
773 | 794 | |
|
774 | 795 | def maketable(data, indent=0, header=False): |
|
775 | 796 | '''Generate an RST table for the given table data as a list of lines''' |
|
776 | 797 | |
|
777 | 798 | widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)] |
|
778 | 799 | indent = ' ' * indent |
|
779 | 800 | div = indent + ' '.join('=' * w for w in widths) + '\n' |
|
780 | 801 | |
|
781 | 802 | out = [div] |
|
782 | 803 | for row in data: |
|
783 | 804 | l = [] |
|
784 | 805 | for w, v in zip(widths, row): |
|
785 | 806 | if '\n' in v: |
|
786 | 807 | # only remove line breaks and indentation, long lines are |
|
787 | 808 | # handled by the next tool |
|
788 | 809 | v = ' '.join(e.lstrip() for e in v.split('\n')) |
|
789 | 810 | pad = ' ' * (w - encoding.colwidth(v)) |
|
790 | 811 | l.append(v + pad) |
|
791 | 812 | out.append(indent + ' '.join(l) + "\n") |
|
792 | 813 | if header and len(data) > 1: |
|
793 | 814 | out.insert(2, div) |
|
794 | 815 | out.append(div) |
|
795 | 816 | return out |
@@ -1,2952 +1,2977 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 | internals Technical implementation topics |
|
115 | 115 | merge-tools Merge Tools |
|
116 | 116 | multirevs Specifying Multiple Revisions |
|
117 | 117 | patterns File Name Patterns |
|
118 | 118 | phases Working with Phases |
|
119 | 119 | revisions Specifying Single Revisions |
|
120 | 120 | revsets Specifying Revision Sets |
|
121 | 121 | scripting Using Mercurial from scripts and automation |
|
122 | 122 | subrepos Subrepositories |
|
123 | 123 | templating Template Usage |
|
124 | 124 | urls URL Paths |
|
125 | 125 | |
|
126 | 126 | (use "hg help -v" to show built-in aliases and global options) |
|
127 | 127 | |
|
128 | 128 | $ hg -q help |
|
129 | 129 | add add the specified files on the next commit |
|
130 | 130 | addremove add all new files, delete all missing files |
|
131 | 131 | annotate show changeset information by line for each file |
|
132 | 132 | archive create an unversioned archive of a repository revision |
|
133 | 133 | backout reverse effect of earlier changeset |
|
134 | 134 | bisect subdivision search of changesets |
|
135 | 135 | bookmarks create a new bookmark or list existing bookmarks |
|
136 | 136 | branch set or show the current branch name |
|
137 | 137 | branches list repository named branches |
|
138 | 138 | bundle create a changegroup file |
|
139 | 139 | cat output the current or given revision of files |
|
140 | 140 | clone make a copy of an existing repository |
|
141 | 141 | commit commit the specified files or all outstanding changes |
|
142 | 142 | config show combined config settings from all hgrc files |
|
143 | 143 | copy mark files as copied for the next commit |
|
144 | 144 | diff diff repository (or selected files) |
|
145 | 145 | export dump the header and diffs for one or more changesets |
|
146 | 146 | files list tracked files |
|
147 | 147 | forget forget the specified files on the next commit |
|
148 | 148 | graft copy changes from other branches onto the current branch |
|
149 | 149 | grep search for a pattern in specified files and revisions |
|
150 | 150 | heads show branch heads |
|
151 | 151 | help show help for a given topic or a help overview |
|
152 | 152 | identify identify the working directory or specified revision |
|
153 | 153 | import import an ordered set of patches |
|
154 | 154 | incoming show new changesets found in source |
|
155 | 155 | init create a new repository in the given directory |
|
156 | 156 | log show revision history of entire repository or files |
|
157 | 157 | manifest output the current or given revision of the project manifest |
|
158 | 158 | merge merge another revision into working directory |
|
159 | 159 | outgoing show changesets not found in the destination |
|
160 | 160 | paths show aliases for remote repositories |
|
161 | 161 | phase set or show the current phase name |
|
162 | 162 | pull pull changes from the specified source |
|
163 | 163 | push push changes to the specified destination |
|
164 | 164 | recover roll back an interrupted transaction |
|
165 | 165 | remove remove the specified files on the next commit |
|
166 | 166 | rename rename files; equivalent of copy + remove |
|
167 | 167 | resolve redo merges or set/view the merge status of files |
|
168 | 168 | revert restore files to their checkout state |
|
169 | 169 | root print the root (top) of the current working directory |
|
170 | 170 | serve start stand-alone webserver |
|
171 | 171 | status show changed files in the working directory |
|
172 | 172 | summary summarize working directory state |
|
173 | 173 | tag add one or more tags for the current or given revision |
|
174 | 174 | tags list repository tags |
|
175 | 175 | unbundle apply one or more changegroup files |
|
176 | 176 | update update working directory (or switch revisions) |
|
177 | 177 | verify verify the integrity of the repository |
|
178 | 178 | version output version and copyright information |
|
179 | 179 | |
|
180 | 180 | additional help topics: |
|
181 | 181 | |
|
182 | 182 | config Configuration Files |
|
183 | 183 | dates Date Formats |
|
184 | 184 | diffs Diff Formats |
|
185 | 185 | environment Environment Variables |
|
186 | 186 | extensions Using Additional Features |
|
187 | 187 | filesets Specifying File Sets |
|
188 | 188 | glossary Glossary |
|
189 | 189 | hgignore Syntax for Mercurial Ignore Files |
|
190 | 190 | hgweb Configuring hgweb |
|
191 | 191 | internals Technical implementation topics |
|
192 | 192 | merge-tools Merge Tools |
|
193 | 193 | multirevs Specifying Multiple Revisions |
|
194 | 194 | patterns File Name Patterns |
|
195 | 195 | phases Working with Phases |
|
196 | 196 | revisions Specifying Single Revisions |
|
197 | 197 | revsets Specifying Revision Sets |
|
198 | 198 | scripting Using Mercurial from scripts and automation |
|
199 | 199 | subrepos Subrepositories |
|
200 | 200 | templating Template Usage |
|
201 | 201 | urls URL Paths |
|
202 | 202 | |
|
203 | 203 | Test extension help: |
|
204 | 204 | $ hg help extensions --config extensions.rebase= --config extensions.children= |
|
205 | 205 | Using Additional Features |
|
206 | 206 | """"""""""""""""""""""""" |
|
207 | 207 | |
|
208 | 208 | Mercurial has the ability to add new features through the use of |
|
209 | 209 | extensions. Extensions may add new commands, add options to existing |
|
210 | 210 | commands, change the default behavior of commands, or implement hooks. |
|
211 | 211 | |
|
212 | 212 | To enable the "foo" extension, either shipped with Mercurial or in the |
|
213 | 213 | Python search path, create an entry for it in your configuration file, |
|
214 | 214 | like this: |
|
215 | 215 | |
|
216 | 216 | [extensions] |
|
217 | 217 | foo = |
|
218 | 218 | |
|
219 | 219 | You may also specify the full path to an extension: |
|
220 | 220 | |
|
221 | 221 | [extensions] |
|
222 | 222 | myfeature = ~/.hgext/myfeature.py |
|
223 | 223 | |
|
224 | 224 | See "hg help config" for more information on configuration files. |
|
225 | 225 | |
|
226 | 226 | Extensions are not loaded by default for a variety of reasons: they can |
|
227 | 227 | increase startup overhead; they may be meant for advanced usage only; they |
|
228 | 228 | may provide potentially dangerous abilities (such as letting you destroy |
|
229 | 229 | or modify history); they might not be ready for prime time; or they may |
|
230 | 230 | alter some usual behaviors of stock Mercurial. It is thus up to the user |
|
231 | 231 | to activate extensions as needed. |
|
232 | 232 | |
|
233 | 233 | To explicitly disable an extension enabled in a configuration file of |
|
234 | 234 | broader scope, prepend its path with !: |
|
235 | 235 | |
|
236 | 236 | [extensions] |
|
237 | 237 | # disabling extension bar residing in /path/to/extension/bar.py |
|
238 | 238 | bar = !/path/to/extension/bar.py |
|
239 | 239 | # ditto, but no path was supplied for extension baz |
|
240 | 240 | baz = ! |
|
241 | 241 | |
|
242 | 242 | enabled extensions: |
|
243 | 243 | |
|
244 | 244 | children command to display child changesets (DEPRECATED) |
|
245 | 245 | rebase command to move sets of revisions to a different ancestor |
|
246 | 246 | |
|
247 | 247 | disabled extensions: |
|
248 | 248 | |
|
249 | 249 | acl hooks for controlling repository access |
|
250 | 250 | blackbox log repository events to a blackbox for debugging |
|
251 | 251 | bugzilla hooks for integrating with the Bugzilla bug tracker |
|
252 | 252 | censor erase file content at a given revision |
|
253 | 253 | churn command to display statistics about repository history |
|
254 | 254 | clonebundles advertise pre-generated bundles to seed clones |
|
255 | 255 | (experimental) |
|
256 | 256 | color colorize output from some commands |
|
257 | 257 | convert import revisions from foreign VCS repositories into |
|
258 | 258 | Mercurial |
|
259 | 259 | eol automatically manage newlines in repository files |
|
260 | 260 | extdiff command to allow external programs to compare revisions |
|
261 | 261 | factotum http authentication with factotum |
|
262 | 262 | gpg commands to sign and verify changesets |
|
263 | 263 | hgcia hooks for integrating with the CIA.vc notification service |
|
264 | 264 | hgk browse the repository in a graphical way |
|
265 | 265 | highlight syntax highlighting for hgweb (requires Pygments) |
|
266 | 266 | histedit interactive history editing |
|
267 | 267 | keyword expand keywords in tracked files |
|
268 | 268 | largefiles track large binary files |
|
269 | 269 | mq manage a stack of patches |
|
270 | 270 | notify hooks for sending email push notifications |
|
271 | 271 | pager browse command output with an external pager |
|
272 | 272 | patchbomb command to send changesets as (a series of) patch emails |
|
273 | 273 | purge command to delete untracked files from the working |
|
274 | 274 | directory |
|
275 | 275 | record commands to interactively select changes for |
|
276 | 276 | commit/qrefresh |
|
277 | 277 | relink recreates hardlinks between repository clones |
|
278 | 278 | schemes extend schemes with shortcuts to repository swarms |
|
279 | 279 | share share a common history between several working directories |
|
280 | 280 | shelve save and restore changes to the working directory |
|
281 | 281 | strip strip changesets and their descendants from history |
|
282 | 282 | transplant command to transplant changesets from another branch |
|
283 | 283 | win32mbcs allow the use of MBCS paths with problematic encodings |
|
284 | 284 | zeroconf discover and advertise repositories on the local network |
|
285 | 285 | |
|
286 | 286 | Verify that extension keywords appear in help templates |
|
287 | 287 | |
|
288 | 288 | $ hg help --config extensions.transplant= templating|grep transplant > /dev/null |
|
289 | 289 | |
|
290 | 290 | Test short command list with verbose option |
|
291 | 291 | |
|
292 | 292 | $ hg -v help shortlist |
|
293 | 293 | Mercurial Distributed SCM |
|
294 | 294 | |
|
295 | 295 | basic commands: |
|
296 | 296 | |
|
297 | 297 | add add the specified files on the next commit |
|
298 | 298 | annotate, blame |
|
299 | 299 | show changeset information by line for each file |
|
300 | 300 | clone make a copy of an existing repository |
|
301 | 301 | commit, ci commit the specified files or all outstanding changes |
|
302 | 302 | diff diff repository (or selected files) |
|
303 | 303 | export dump the header and diffs for one or more changesets |
|
304 | 304 | forget forget the specified files on the next commit |
|
305 | 305 | init create a new repository in the given directory |
|
306 | 306 | log, history show revision history of entire repository or files |
|
307 | 307 | merge merge another revision into working directory |
|
308 | 308 | pull pull changes from the specified source |
|
309 | 309 | push push changes to the specified destination |
|
310 | 310 | remove, rm remove the specified files on the next commit |
|
311 | 311 | serve start stand-alone webserver |
|
312 | 312 | status, st show changed files in the working directory |
|
313 | 313 | summary, sum summarize working directory state |
|
314 | 314 | update, up, checkout, co |
|
315 | 315 | update working directory (or switch revisions) |
|
316 | 316 | |
|
317 | 317 | global options ([+] can be repeated): |
|
318 | 318 | |
|
319 | 319 | -R --repository REPO repository root directory or name of overlay bundle |
|
320 | 320 | file |
|
321 | 321 | --cwd DIR change working directory |
|
322 | 322 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
323 | 323 | all prompts |
|
324 | 324 | -q --quiet suppress output |
|
325 | 325 | -v --verbose enable additional output |
|
326 | 326 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
327 | 327 | --debug enable debugging output |
|
328 | 328 | --debugger start debugger |
|
329 | 329 | --encoding ENCODE set the charset encoding (default: ascii) |
|
330 | 330 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
331 | 331 | --traceback always print a traceback on exception |
|
332 | 332 | --time time how long the command takes |
|
333 | 333 | --profile print command execution profile |
|
334 | 334 | --version output version information and exit |
|
335 | 335 | -h --help display help and exit |
|
336 | 336 | --hidden consider hidden changesets |
|
337 | 337 | |
|
338 | 338 | (use "hg help" for the full list of commands) |
|
339 | 339 | |
|
340 | 340 | $ hg add -h |
|
341 | 341 | hg add [OPTION]... [FILE]... |
|
342 | 342 | |
|
343 | 343 | add the specified files on the next commit |
|
344 | 344 | |
|
345 | 345 | Schedule files to be version controlled and added to the repository. |
|
346 | 346 | |
|
347 | 347 | The files will be added to the repository at the next commit. To undo an |
|
348 | 348 | add before that, see "hg forget". |
|
349 | 349 | |
|
350 | 350 | If no names are given, add all files to the repository (except files |
|
351 | 351 | matching ".hgignore"). |
|
352 | 352 | |
|
353 | 353 | Returns 0 if all files are successfully added. |
|
354 | 354 | |
|
355 | 355 | options ([+] can be repeated): |
|
356 | 356 | |
|
357 | 357 | -I --include PATTERN [+] include names matching the given patterns |
|
358 | 358 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
359 | 359 | -S --subrepos recurse into subrepositories |
|
360 | 360 | -n --dry-run do not perform actions, just print output |
|
361 | 361 | |
|
362 | 362 | (some details hidden, use --verbose to show complete help) |
|
363 | 363 | |
|
364 | 364 | Verbose help for add |
|
365 | 365 | |
|
366 | 366 | $ hg add -hv |
|
367 | 367 | hg add [OPTION]... [FILE]... |
|
368 | 368 | |
|
369 | 369 | add the specified files on the next commit |
|
370 | 370 | |
|
371 | 371 | Schedule files to be version controlled and added to the repository. |
|
372 | 372 | |
|
373 | 373 | The files will be added to the repository at the next commit. To undo an |
|
374 | 374 | add before that, see "hg forget". |
|
375 | 375 | |
|
376 | 376 | If no names are given, add all files to the repository (except files |
|
377 | 377 | matching ".hgignore"). |
|
378 | 378 | |
|
379 | 379 | Examples: |
|
380 | 380 | |
|
381 | 381 | - New (unknown) files are added automatically by "hg add": |
|
382 | 382 | |
|
383 | 383 | $ ls |
|
384 | 384 | foo.c |
|
385 | 385 | $ hg status |
|
386 | 386 | ? foo.c |
|
387 | 387 | $ hg add |
|
388 | 388 | adding foo.c |
|
389 | 389 | $ hg status |
|
390 | 390 | A foo.c |
|
391 | 391 | |
|
392 | 392 | - Specific files to be added can be specified: |
|
393 | 393 | |
|
394 | 394 | $ ls |
|
395 | 395 | bar.c foo.c |
|
396 | 396 | $ hg status |
|
397 | 397 | ? bar.c |
|
398 | 398 | ? foo.c |
|
399 | 399 | $ hg add bar.c |
|
400 | 400 | $ hg status |
|
401 | 401 | A bar.c |
|
402 | 402 | ? foo.c |
|
403 | 403 | |
|
404 | 404 | Returns 0 if all files are successfully added. |
|
405 | 405 | |
|
406 | 406 | options ([+] can be repeated): |
|
407 | 407 | |
|
408 | 408 | -I --include PATTERN [+] include names matching the given patterns |
|
409 | 409 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
410 | 410 | -S --subrepos recurse into subrepositories |
|
411 | 411 | -n --dry-run do not perform actions, just print output |
|
412 | 412 | |
|
413 | 413 | global options ([+] can be repeated): |
|
414 | 414 | |
|
415 | 415 | -R --repository REPO repository root directory or name of overlay bundle |
|
416 | 416 | file |
|
417 | 417 | --cwd DIR change working directory |
|
418 | 418 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
419 | 419 | all prompts |
|
420 | 420 | -q --quiet suppress output |
|
421 | 421 | -v --verbose enable additional output |
|
422 | 422 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
423 | 423 | --debug enable debugging output |
|
424 | 424 | --debugger start debugger |
|
425 | 425 | --encoding ENCODE set the charset encoding (default: ascii) |
|
426 | 426 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
427 | 427 | --traceback always print a traceback on exception |
|
428 | 428 | --time time how long the command takes |
|
429 | 429 | --profile print command execution profile |
|
430 | 430 | --version output version information and exit |
|
431 | 431 | -h --help display help and exit |
|
432 | 432 | --hidden consider hidden changesets |
|
433 | 433 | |
|
434 | 434 | Test help option with version option |
|
435 | 435 | |
|
436 | 436 | $ hg add -h --version |
|
437 | 437 | Mercurial Distributed SCM (version *) (glob) |
|
438 | 438 | (see https://mercurial-scm.org for more information) |
|
439 | 439 | |
|
440 | 440 | Copyright (C) 2005-2015 Matt Mackall and others |
|
441 | 441 | This is free software; see the source for copying conditions. There is NO |
|
442 | 442 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
443 | 443 | |
|
444 | 444 | $ hg add --skjdfks |
|
445 | 445 | hg add: option --skjdfks not recognized |
|
446 | 446 | hg add [OPTION]... [FILE]... |
|
447 | 447 | |
|
448 | 448 | add the specified files on the next commit |
|
449 | 449 | |
|
450 | 450 | options ([+] can be repeated): |
|
451 | 451 | |
|
452 | 452 | -I --include PATTERN [+] include names matching the given patterns |
|
453 | 453 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
454 | 454 | -S --subrepos recurse into subrepositories |
|
455 | 455 | -n --dry-run do not perform actions, just print output |
|
456 | 456 | |
|
457 | 457 | (use "hg add -h" to show more help) |
|
458 | 458 | [255] |
|
459 | 459 | |
|
460 | 460 | Test ambiguous command help |
|
461 | 461 | |
|
462 | 462 | $ hg help ad |
|
463 | 463 | list of commands: |
|
464 | 464 | |
|
465 | 465 | add add the specified files on the next commit |
|
466 | 466 | addremove add all new files, delete all missing files |
|
467 | 467 | |
|
468 | 468 | (use "hg help -v ad" to show built-in aliases and global options) |
|
469 | 469 | |
|
470 | 470 | Test command without options |
|
471 | 471 | |
|
472 | 472 | $ hg help verify |
|
473 | 473 | hg verify |
|
474 | 474 | |
|
475 | 475 | verify the integrity of the repository |
|
476 | 476 | |
|
477 | 477 | Verify the integrity of the current repository. |
|
478 | 478 | |
|
479 | 479 | This will perform an extensive check of the repository's integrity, |
|
480 | 480 | validating the hashes and checksums of each entry in the changelog, |
|
481 | 481 | manifest, and tracked files, as well as the integrity of their crosslinks |
|
482 | 482 | and indices. |
|
483 | 483 | |
|
484 | 484 | Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more |
|
485 | 485 | information about recovery from corruption of the repository. |
|
486 | 486 | |
|
487 | 487 | Returns 0 on success, 1 if errors are encountered. |
|
488 | 488 | |
|
489 | 489 | (some details hidden, use --verbose to show complete help) |
|
490 | 490 | |
|
491 | 491 | $ hg help diff |
|
492 | 492 | hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]... |
|
493 | 493 | |
|
494 | 494 | diff repository (or selected files) |
|
495 | 495 | |
|
496 | 496 | Show differences between revisions for the specified files. |
|
497 | 497 | |
|
498 | 498 | Differences between files are shown using the unified diff format. |
|
499 | 499 | |
|
500 | 500 | Note: |
|
501 | 501 | "hg diff" may generate unexpected results for merges, as it will |
|
502 | 502 | default to comparing against the working directory's first parent |
|
503 | 503 | changeset if no revisions are specified. |
|
504 | 504 | |
|
505 | 505 | When two revision arguments are given, then changes are shown between |
|
506 | 506 | those revisions. If only one revision is specified then that revision is |
|
507 | 507 | compared to the working directory, and, when no revisions are specified, |
|
508 | 508 | the working directory files are compared to its first parent. |
|
509 | 509 | |
|
510 | 510 | Alternatively you can specify -c/--change with a revision to see the |
|
511 | 511 | changes in that changeset relative to its first parent. |
|
512 | 512 | |
|
513 | 513 | Without the -a/--text option, diff will avoid generating diffs of files it |
|
514 | 514 | detects as binary. With -a, diff will generate a diff anyway, probably |
|
515 | 515 | with undesirable results. |
|
516 | 516 | |
|
517 | 517 | Use the -g/--git option to generate diffs in the git extended diff format. |
|
518 | 518 | For more information, read "hg help diffs". |
|
519 | 519 | |
|
520 | 520 | Returns 0 on success. |
|
521 | 521 | |
|
522 | 522 | options ([+] can be repeated): |
|
523 | 523 | |
|
524 | 524 | -r --rev REV [+] revision |
|
525 | 525 | -c --change REV change made by revision |
|
526 | 526 | -a --text treat all files as text |
|
527 | 527 | -g --git use git extended diff format |
|
528 | 528 | --nodates omit dates from diff headers |
|
529 | 529 | --noprefix omit a/ and b/ prefixes from filenames |
|
530 | 530 | -p --show-function show which function each change is in |
|
531 | 531 | --reverse produce a diff that undoes the changes |
|
532 | 532 | -w --ignore-all-space ignore white space when comparing lines |
|
533 | 533 | -b --ignore-space-change ignore changes in the amount of white space |
|
534 | 534 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
535 | 535 | -U --unified NUM number of lines of context to show |
|
536 | 536 | --stat output diffstat-style summary of changes |
|
537 | 537 | --root DIR produce diffs relative to subdirectory |
|
538 | 538 | -I --include PATTERN [+] include names matching the given patterns |
|
539 | 539 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
540 | 540 | -S --subrepos recurse into subrepositories |
|
541 | 541 | |
|
542 | 542 | (some details hidden, use --verbose to show complete help) |
|
543 | 543 | |
|
544 | 544 | $ hg help status |
|
545 | 545 | hg status [OPTION]... [FILE]... |
|
546 | 546 | |
|
547 | 547 | aliases: st |
|
548 | 548 | |
|
549 | 549 | show changed files in the working directory |
|
550 | 550 | |
|
551 | 551 | Show status of files in the repository. If names are given, only files |
|
552 | 552 | that match are shown. Files that are clean or ignored or the source of a |
|
553 | 553 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
554 | 554 | -C/--copies or -A/--all are given. Unless options described with "show |
|
555 | 555 | only ..." are given, the options -mardu are used. |
|
556 | 556 | |
|
557 | 557 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
558 | 558 | explicitly requested with -u/--unknown or -i/--ignored. |
|
559 | 559 | |
|
560 | 560 | Note: |
|
561 | 561 | "hg status" may appear to disagree with diff if permissions have |
|
562 | 562 | changed or a merge has occurred. The standard diff format does not |
|
563 | 563 | report permission changes and diff only reports changes relative to one |
|
564 | 564 | merge parent. |
|
565 | 565 | |
|
566 | 566 | If one revision is given, it is used as the base revision. If two |
|
567 | 567 | revisions are given, the differences between them are shown. The --change |
|
568 | 568 | option can also be used as a shortcut to list the changed files of a |
|
569 | 569 | revision from its first parent. |
|
570 | 570 | |
|
571 | 571 | The codes used to show the status of files are: |
|
572 | 572 | |
|
573 | 573 | M = modified |
|
574 | 574 | A = added |
|
575 | 575 | R = removed |
|
576 | 576 | C = clean |
|
577 | 577 | ! = missing (deleted by non-hg command, but still tracked) |
|
578 | 578 | ? = not tracked |
|
579 | 579 | I = ignored |
|
580 | 580 | = origin of the previous file (with --copies) |
|
581 | 581 | |
|
582 | 582 | Returns 0 on success. |
|
583 | 583 | |
|
584 | 584 | options ([+] can be repeated): |
|
585 | 585 | |
|
586 | 586 | -A --all show status of all files |
|
587 | 587 | -m --modified show only modified files |
|
588 | 588 | -a --added show only added files |
|
589 | 589 | -r --removed show only removed files |
|
590 | 590 | -d --deleted show only deleted (but tracked) files |
|
591 | 591 | -c --clean show only files without changes |
|
592 | 592 | -u --unknown show only unknown (not tracked) files |
|
593 | 593 | -i --ignored show only ignored files |
|
594 | 594 | -n --no-status hide status prefix |
|
595 | 595 | -C --copies show source of copied files |
|
596 | 596 | -0 --print0 end filenames with NUL, for use with xargs |
|
597 | 597 | --rev REV [+] show difference from revision |
|
598 | 598 | --change REV list the changed files of a revision |
|
599 | 599 | -I --include PATTERN [+] include names matching the given patterns |
|
600 | 600 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
601 | 601 | -S --subrepos recurse into subrepositories |
|
602 | 602 | |
|
603 | 603 | (some details hidden, use --verbose to show complete help) |
|
604 | 604 | |
|
605 | 605 | $ hg -q help status |
|
606 | 606 | hg status [OPTION]... [FILE]... |
|
607 | 607 | |
|
608 | 608 | show changed files in the working directory |
|
609 | 609 | |
|
610 | 610 | $ hg help foo |
|
611 | 611 | abort: no such help topic: foo |
|
612 | 612 | (try "hg help --keyword foo") |
|
613 | 613 | [255] |
|
614 | 614 | |
|
615 | 615 | $ hg skjdfks |
|
616 | 616 | hg: unknown command 'skjdfks' |
|
617 | 617 | Mercurial Distributed SCM |
|
618 | 618 | |
|
619 | 619 | basic commands: |
|
620 | 620 | |
|
621 | 621 | add add the specified files on the next commit |
|
622 | 622 | annotate show changeset information by line for each file |
|
623 | 623 | clone make a copy of an existing repository |
|
624 | 624 | commit commit the specified files or all outstanding changes |
|
625 | 625 | diff diff repository (or selected files) |
|
626 | 626 | export dump the header and diffs for one or more changesets |
|
627 | 627 | forget forget the specified files on the next commit |
|
628 | 628 | init create a new repository in the given directory |
|
629 | 629 | log show revision history of entire repository or files |
|
630 | 630 | merge merge another revision into working directory |
|
631 | 631 | pull pull changes from the specified source |
|
632 | 632 | push push changes to the specified destination |
|
633 | 633 | remove remove the specified files on the next commit |
|
634 | 634 | serve start stand-alone webserver |
|
635 | 635 | status show changed files in the working directory |
|
636 | 636 | summary summarize working directory state |
|
637 | 637 | update update working directory (or switch revisions) |
|
638 | 638 | |
|
639 | 639 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
640 | 640 | [255] |
|
641 | 641 | |
|
642 | 642 | |
|
643 | 643 | Make sure that we don't run afoul of the help system thinking that |
|
644 | 644 | this is a section and erroring out weirdly. |
|
645 | 645 | |
|
646 | 646 | $ hg .log |
|
647 | 647 | hg: unknown command '.log' |
|
648 | 648 | (did you mean one of log?) |
|
649 | 649 | [255] |
|
650 | 650 | |
|
651 | 651 | $ hg log. |
|
652 | 652 | hg: unknown command 'log.' |
|
653 | 653 | (did you mean one of log?) |
|
654 | 654 | [255] |
|
655 | 655 | $ hg pu.lh |
|
656 | 656 | hg: unknown command 'pu.lh' |
|
657 | 657 | (did you mean one of pull, push?) |
|
658 | 658 | [255] |
|
659 | 659 | |
|
660 | 660 | $ cat > helpext.py <<EOF |
|
661 | 661 | > import os |
|
662 | 662 | > from mercurial import cmdutil, commands |
|
663 | 663 | > |
|
664 | 664 | > cmdtable = {} |
|
665 | 665 | > command = cmdutil.command(cmdtable) |
|
666 | 666 | > |
|
667 | 667 | > @command('nohelp', |
|
668 | 668 | > [('', 'longdesc', 3, 'x'*90), |
|
669 | 669 | > ('n', '', None, 'normal desc'), |
|
670 | 670 | > ('', 'newline', '', 'line1\nline2')], |
|
671 | 671 | > 'hg nohelp', |
|
672 | 672 | > norepo=True) |
|
673 | 673 | > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')]) |
|
674 | 674 | > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')]) |
|
675 | 675 | > def nohelp(ui, *args, **kwargs): |
|
676 | 676 | > pass |
|
677 | 677 | > |
|
678 | 678 | > EOF |
|
679 | 679 | $ echo '[extensions]' >> $HGRCPATH |
|
680 | 680 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH |
|
681 | 681 | |
|
682 | 682 | Test command with no help text |
|
683 | 683 | |
|
684 | 684 | $ hg help nohelp |
|
685 | 685 | hg nohelp |
|
686 | 686 | |
|
687 | 687 | (no help text available) |
|
688 | 688 | |
|
689 | 689 | options: |
|
690 | 690 | |
|
691 | 691 | --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
692 | 692 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) |
|
693 | 693 | -n -- normal desc |
|
694 | 694 | --newline VALUE line1 line2 |
|
695 | 695 | |
|
696 | 696 | (some details hidden, use --verbose to show complete help) |
|
697 | 697 | |
|
698 | 698 | $ hg help -k nohelp |
|
699 | 699 | Commands: |
|
700 | 700 | |
|
701 | 701 | nohelp hg nohelp |
|
702 | 702 | |
|
703 | 703 | Extension Commands: |
|
704 | 704 | |
|
705 | 705 | nohelp (no help text available) |
|
706 | 706 | |
|
707 | 707 | Test that default list of commands omits extension commands |
|
708 | 708 | |
|
709 | 709 | $ hg help |
|
710 | 710 | Mercurial Distributed SCM |
|
711 | 711 | |
|
712 | 712 | list of commands: |
|
713 | 713 | |
|
714 | 714 | add add the specified files on the next commit |
|
715 | 715 | addremove add all new files, delete all missing files |
|
716 | 716 | annotate show changeset information by line for each file |
|
717 | 717 | archive create an unversioned archive of a repository revision |
|
718 | 718 | backout reverse effect of earlier changeset |
|
719 | 719 | bisect subdivision search of changesets |
|
720 | 720 | bookmarks create a new bookmark or list existing bookmarks |
|
721 | 721 | branch set or show the current branch name |
|
722 | 722 | branches list repository named branches |
|
723 | 723 | bundle create a changegroup file |
|
724 | 724 | cat output the current or given revision of files |
|
725 | 725 | clone make a copy of an existing repository |
|
726 | 726 | commit commit the specified files or all outstanding changes |
|
727 | 727 | config show combined config settings from all hgrc files |
|
728 | 728 | copy mark files as copied for the next commit |
|
729 | 729 | diff diff repository (or selected files) |
|
730 | 730 | export dump the header and diffs for one or more changesets |
|
731 | 731 | files list tracked files |
|
732 | 732 | forget forget the specified files on the next commit |
|
733 | 733 | graft copy changes from other branches onto the current branch |
|
734 | 734 | grep search for a pattern in specified files and revisions |
|
735 | 735 | heads show branch heads |
|
736 | 736 | help show help for a given topic or a help overview |
|
737 | 737 | identify identify the working directory or specified revision |
|
738 | 738 | import import an ordered set of patches |
|
739 | 739 | incoming show new changesets found in source |
|
740 | 740 | init create a new repository in the given directory |
|
741 | 741 | log show revision history of entire repository or files |
|
742 | 742 | manifest output the current or given revision of the project manifest |
|
743 | 743 | merge merge another revision into working directory |
|
744 | 744 | outgoing show changesets not found in the destination |
|
745 | 745 | paths show aliases for remote repositories |
|
746 | 746 | phase set or show the current phase name |
|
747 | 747 | pull pull changes from the specified source |
|
748 | 748 | push push changes to the specified destination |
|
749 | 749 | recover roll back an interrupted transaction |
|
750 | 750 | remove remove the specified files on the next commit |
|
751 | 751 | rename rename files; equivalent of copy + remove |
|
752 | 752 | resolve redo merges or set/view the merge status of files |
|
753 | 753 | revert restore files to their checkout state |
|
754 | 754 | root print the root (top) of the current working directory |
|
755 | 755 | serve start stand-alone webserver |
|
756 | 756 | status show changed files in the working directory |
|
757 | 757 | summary summarize working directory state |
|
758 | 758 | tag add one or more tags for the current or given revision |
|
759 | 759 | tags list repository tags |
|
760 | 760 | unbundle apply one or more changegroup files |
|
761 | 761 | update update working directory (or switch revisions) |
|
762 | 762 | verify verify the integrity of the repository |
|
763 | 763 | version output version and copyright information |
|
764 | 764 | |
|
765 | 765 | enabled extensions: |
|
766 | 766 | |
|
767 | 767 | helpext (no help text available) |
|
768 | 768 | |
|
769 | 769 | additional help topics: |
|
770 | 770 | |
|
771 | 771 | config Configuration Files |
|
772 | 772 | dates Date Formats |
|
773 | 773 | diffs Diff Formats |
|
774 | 774 | environment Environment Variables |
|
775 | 775 | extensions Using Additional Features |
|
776 | 776 | filesets Specifying File Sets |
|
777 | 777 | glossary Glossary |
|
778 | 778 | hgignore Syntax for Mercurial Ignore Files |
|
779 | 779 | hgweb Configuring hgweb |
|
780 | 780 | internals Technical implementation topics |
|
781 | 781 | merge-tools Merge Tools |
|
782 | 782 | multirevs Specifying Multiple Revisions |
|
783 | 783 | patterns File Name Patterns |
|
784 | 784 | phases Working with Phases |
|
785 | 785 | revisions Specifying Single Revisions |
|
786 | 786 | revsets Specifying Revision Sets |
|
787 | 787 | scripting Using Mercurial from scripts and automation |
|
788 | 788 | subrepos Subrepositories |
|
789 | 789 | templating Template Usage |
|
790 | 790 | urls URL Paths |
|
791 | 791 | |
|
792 | 792 | (use "hg help -v" to show built-in aliases and global options) |
|
793 | 793 | |
|
794 | 794 | |
|
795 | 795 | Test list of internal help commands |
|
796 | 796 | |
|
797 | 797 | $ hg help debug |
|
798 | 798 | debug commands (internal and unsupported): |
|
799 | 799 | |
|
800 | 800 | debugancestor |
|
801 | 801 | find the ancestor revision of two revisions in a given index |
|
802 | 802 | debugapplystreamclonebundle |
|
803 | 803 | apply a stream clone bundle file |
|
804 | 804 | debugbuilddag |
|
805 | 805 | builds a repo with a given DAG from scratch in the current |
|
806 | 806 | empty repo |
|
807 | 807 | debugbundle lists the contents of a bundle |
|
808 | 808 | debugcheckstate |
|
809 | 809 | validate the correctness of the current dirstate |
|
810 | 810 | debugcommands |
|
811 | 811 | list all available commands and options |
|
812 | 812 | debugcomplete |
|
813 | 813 | returns the completion list associated with the given command |
|
814 | 814 | debugcreatestreamclonebundle |
|
815 | 815 | create a stream clone bundle file |
|
816 | 816 | debugdag format the changelog or an index DAG as a concise textual |
|
817 | 817 | description |
|
818 | 818 | debugdata dump the contents of a data file revision |
|
819 | 819 | debugdate parse and display a date |
|
820 | 820 | debugdeltachain |
|
821 | 821 | dump information about delta chains in a revlog |
|
822 | 822 | debugdirstate |
|
823 | 823 | show the contents of the current dirstate |
|
824 | 824 | debugdiscovery |
|
825 | 825 | runs the changeset discovery protocol in isolation |
|
826 | 826 | debugextensions |
|
827 | 827 | show information about active extensions |
|
828 | 828 | debugfileset parse and apply a fileset specification |
|
829 | 829 | debugfsinfo show information detected about current filesystem |
|
830 | 830 | debuggetbundle |
|
831 | 831 | retrieves a bundle from a repo |
|
832 | 832 | debugignore display the combined ignore pattern |
|
833 | 833 | debugindex dump the contents of an index file |
|
834 | 834 | debugindexdot |
|
835 | 835 | dump an index DAG as a graphviz dot file |
|
836 | 836 | debuginstall test Mercurial installation |
|
837 | 837 | debugknown test whether node ids are known to a repo |
|
838 | 838 | debuglocks show or modify state of locks |
|
839 | 839 | debugmergestate |
|
840 | 840 | print merge state |
|
841 | 841 | debugnamecomplete |
|
842 | 842 | complete "names" - tags, open branch names, bookmark names |
|
843 | 843 | debugobsolete |
|
844 | 844 | create arbitrary obsolete marker |
|
845 | 845 | debugoptDEP (no help text available) |
|
846 | 846 | debugoptEXP (no help text available) |
|
847 | 847 | debugpathcomplete |
|
848 | 848 | complete part or all of a tracked path |
|
849 | 849 | debugpushkey access the pushkey key/value protocol |
|
850 | 850 | debugpvec (no help text available) |
|
851 | 851 | debugrebuilddirstate |
|
852 | 852 | rebuild the dirstate as it would look like for the given |
|
853 | 853 | revision |
|
854 | 854 | debugrebuildfncache |
|
855 | 855 | rebuild the fncache file |
|
856 | 856 | debugrename dump rename information |
|
857 | 857 | debugrevlog show data and statistics about a revlog |
|
858 | 858 | debugrevspec parse and apply a revision specification |
|
859 | 859 | debugsetparents |
|
860 | 860 | manually set the parents of the current working directory |
|
861 | 861 | debugsub (no help text available) |
|
862 | 862 | debugsuccessorssets |
|
863 | 863 | show set of successors for revision |
|
864 | 864 | debugwalk show how files match on given patterns |
|
865 | 865 | debugwireargs |
|
866 | 866 | (no help text available) |
|
867 | 867 | |
|
868 | 868 | (use "hg help -v debug" to show built-in aliases and global options) |
|
869 | 869 | |
|
870 | 870 | internals topic renders index of available sub-topics |
|
871 | 871 | |
|
872 | 872 | $ hg help internals |
|
873 | 873 | Technical implementation topics |
|
874 | 874 | """"""""""""""""""""""""""""""" |
|
875 | 875 | |
|
876 | 876 | bundles container for exchange of repository data |
|
877 | 877 | changegroups representation of revlog data |
|
878 | 878 | |
|
879 | 879 | sub-topics can be accessed |
|
880 | 880 | |
|
881 | 881 | $ hg help internals.changegroups |
|
882 | 882 | Changegroups |
|
883 | 883 | ============ |
|
884 | 884 | |
|
885 | 885 | Changegroups are representations of repository revlog data, specifically |
|
886 | 886 | the changelog, manifest, and filelogs. |
|
887 | 887 | |
|
888 | 888 | There are 3 versions of changegroups: "1", "2", and "3". From a high- |
|
889 | 889 | level, versions "1" and "2" are almost exactly the same, with the only |
|
890 | 890 | difference being a header on entries in the changeset segment. Version "3" |
|
891 | 891 | adds support for exchanging treemanifests and includes revlog flags in the |
|
892 | 892 | delta header. |
|
893 | 893 | |
|
894 | 894 | Changegroups consists of 3 logical segments: |
|
895 | 895 | |
|
896 | 896 | +---------------------------------+ |
|
897 | 897 | | | | | |
|
898 | 898 | | changeset | manifest | filelogs | |
|
899 | 899 | | | | | |
|
900 | 900 | +---------------------------------+ |
|
901 | 901 | |
|
902 | 902 | The principle building block of each segment is a *chunk*. A *chunk* is a |
|
903 | 903 | framed piece of data: |
|
904 | 904 | |
|
905 | 905 | +---------------------------------------+ |
|
906 | 906 | | | | |
|
907 | 907 | | length | data | |
|
908 | 908 | | (32 bits) | <length> bytes | |
|
909 | 909 | | | | |
|
910 | 910 | +---------------------------------------+ |
|
911 | 911 | |
|
912 | 912 | Each chunk starts with a 32-bit big-endian signed integer indicating the |
|
913 | 913 | length of the raw data that follows. |
|
914 | 914 | |
|
915 | 915 | There is a special case chunk that has 0 length ("0x00000000"). We call |
|
916 | 916 | this an *empty chunk*. |
|
917 | 917 | |
|
918 | 918 | Delta Groups |
|
919 | 919 | ------------ |
|
920 | 920 | |
|
921 | 921 | A *delta group* expresses the content of a revlog as a series of deltas, |
|
922 | 922 | or patches against previous revisions. |
|
923 | 923 | |
|
924 | 924 | Delta groups consist of 0 or more *chunks* followed by the *empty chunk* |
|
925 | 925 | to signal the end of the delta group: |
|
926 | 926 | |
|
927 | 927 | +------------------------------------------------------------------------+ |
|
928 | 928 | | | | | | | |
|
929 | 929 | | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 | |
|
930 | 930 | | (32 bits) | (various) | (32 bits) | (various) | (32 bits) | |
|
931 | 931 | | | | | | | |
|
932 | 932 | +------------------------------------------------------------+-----------+ |
|
933 | 933 | |
|
934 | 934 | Each *chunk*'s data consists of the following: |
|
935 | 935 | |
|
936 | 936 | +-----------------------------------------+ |
|
937 | 937 | | | | | |
|
938 | 938 | | delta header | mdiff header | delta | |
|
939 | 939 | | (various) | (12 bytes) | (various) | |
|
940 | 940 | | | | | |
|
941 | 941 | +-----------------------------------------+ |
|
942 | 942 | |
|
943 | 943 | The *length* field is the byte length of the remaining 3 logical pieces of |
|
944 | 944 | data. The *delta* is a diff from an existing entry in the changelog. |
|
945 | 945 | |
|
946 | 946 | The *delta header* is different between versions "1", "2", and "3" of the |
|
947 | 947 | changegroup format. |
|
948 | 948 | |
|
949 | 949 | Version 1: |
|
950 | 950 | |
|
951 | 951 | +------------------------------------------------------+ |
|
952 | 952 | | | | | | |
|
953 | 953 | | node | p1 node | p2 node | link node | |
|
954 | 954 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
955 | 955 | | | | | | |
|
956 | 956 | +------------------------------------------------------+ |
|
957 | 957 | |
|
958 | 958 | Version 2: |
|
959 | 959 | |
|
960 | 960 | +------------------------------------------------------------------+ |
|
961 | 961 | | | | | | | |
|
962 | 962 | | node | p1 node | p2 node | base node | link node | |
|
963 | 963 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
964 | 964 | | | | | | | |
|
965 | 965 | +------------------------------------------------------------------+ |
|
966 | 966 | |
|
967 | 967 | Version 3: |
|
968 | 968 | |
|
969 | 969 | +------------------------------------------------------------------------------+ |
|
970 | 970 | | | | | | | | |
|
971 | 971 | | node | p1 node | p2 node | base node | link node | flags | |
|
972 | 972 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | |
|
973 | 973 | | | | | | | | |
|
974 | 974 | +------------------------------------------------------------------------------+ |
|
975 | 975 | |
|
976 | 976 | The *mdiff header* consists of 3 32-bit big-endian signed integers |
|
977 | 977 | describing offsets at which to apply the following delta content: |
|
978 | 978 | |
|
979 | 979 | +-------------------------------------+ |
|
980 | 980 | | | | | |
|
981 | 981 | | offset | old length | new length | |
|
982 | 982 | | (32 bits) | (32 bits) | (32 bits) | |
|
983 | 983 | | | | | |
|
984 | 984 | +-------------------------------------+ |
|
985 | 985 | |
|
986 | 986 | In version 1, the delta is always applied against the previous node from |
|
987 | 987 | the changegroup or the first parent if this is the first entry in the |
|
988 | 988 | changegroup. |
|
989 | 989 | |
|
990 | 990 | In version 2, the delta base node is encoded in the entry in the |
|
991 | 991 | changegroup. This allows the delta to be expressed against any parent, |
|
992 | 992 | which can result in smaller deltas and more efficient encoding of data. |
|
993 | 993 | |
|
994 | 994 | Changeset Segment |
|
995 | 995 | ----------------- |
|
996 | 996 | |
|
997 | 997 | The *changeset segment* consists of a single *delta group* holding |
|
998 | 998 | changelog data. It is followed by an *empty chunk* to denote the boundary |
|
999 | 999 | to the *manifests segment*. |
|
1000 | 1000 | |
|
1001 | 1001 | Manifest Segment |
|
1002 | 1002 | ---------------- |
|
1003 | 1003 | |
|
1004 | 1004 | The *manifest segment* consists of a single *delta group* holding manifest |
|
1005 | 1005 | data. It is followed by an *empty chunk* to denote the boundary to the |
|
1006 | 1006 | *filelogs segment*. |
|
1007 | 1007 | |
|
1008 | 1008 | Filelogs Segment |
|
1009 | 1009 | ---------------- |
|
1010 | 1010 | |
|
1011 | 1011 | The *filelogs* segment consists of multiple sub-segments, each |
|
1012 | 1012 | corresponding to an individual file whose data is being described: |
|
1013 | 1013 | |
|
1014 | 1014 | +--------------------------------------+ |
|
1015 | 1015 | | | | | | |
|
1016 | 1016 | | filelog0 | filelog1 | filelog2 | ... | |
|
1017 | 1017 | | | | | | |
|
1018 | 1018 | +--------------------------------------+ |
|
1019 | 1019 | |
|
1020 | 1020 | In version "3" of the changegroup format, filelogs may include directory |
|
1021 | 1021 | logs when treemanifests are in use. directory logs are identified by |
|
1022 | 1022 | having a trailing '/' on their filename (see below). |
|
1023 | 1023 | |
|
1024 | 1024 | The final filelog sub-segment is followed by an *empty chunk* to denote |
|
1025 | 1025 | the end of the segment and the overall changegroup. |
|
1026 | 1026 | |
|
1027 | 1027 | Each filelog sub-segment consists of the following: |
|
1028 | 1028 | |
|
1029 | 1029 | +------------------------------------------+ |
|
1030 | 1030 | | | | | |
|
1031 | 1031 | | filename size | filename | delta group | |
|
1032 | 1032 | | (32 bits) | (various) | (various) | |
|
1033 | 1033 | | | | | |
|
1034 | 1034 | +------------------------------------------+ |
|
1035 | 1035 | |
|
1036 | 1036 | That is, a *chunk* consisting of the filename (not terminated or padded) |
|
1037 | 1037 | followed by N chunks constituting the *delta group* for this file. |
|
1038 | 1038 | |
|
1039 | 1039 | Test list of commands with command with no help text |
|
1040 | 1040 | |
|
1041 | 1041 | $ hg help helpext |
|
1042 | 1042 | helpext extension - no help text available |
|
1043 | 1043 | |
|
1044 | 1044 | list of commands: |
|
1045 | 1045 | |
|
1046 | 1046 | nohelp (no help text available) |
|
1047 | 1047 | |
|
1048 | 1048 | (use "hg help -v helpext" to show built-in aliases and global options) |
|
1049 | 1049 | |
|
1050 | 1050 | |
|
1051 | 1051 | test deprecated and experimental options are hidden in command help |
|
1052 | 1052 | $ hg help debugoptDEP |
|
1053 | 1053 | hg debugoptDEP |
|
1054 | 1054 | |
|
1055 | 1055 | (no help text available) |
|
1056 | 1056 | |
|
1057 | 1057 | options: |
|
1058 | 1058 | |
|
1059 | 1059 | (some details hidden, use --verbose to show complete help) |
|
1060 | 1060 | |
|
1061 | 1061 | $ hg help debugoptEXP |
|
1062 | 1062 | hg debugoptEXP |
|
1063 | 1063 | |
|
1064 | 1064 | (no help text available) |
|
1065 | 1065 | |
|
1066 | 1066 | options: |
|
1067 | 1067 | |
|
1068 | 1068 | (some details hidden, use --verbose to show complete help) |
|
1069 | 1069 | |
|
1070 | 1070 | test deprecated and experimental options is shown with -v |
|
1071 | 1071 | $ hg help -v debugoptDEP | grep dopt |
|
1072 | 1072 | --dopt option is (DEPRECATED) |
|
1073 | 1073 | $ hg help -v debugoptEXP | grep eopt |
|
1074 | 1074 | --eopt option is (EXPERIMENTAL) |
|
1075 | 1075 | |
|
1076 | 1076 | #if gettext |
|
1077 | 1077 | test deprecated option is hidden with translation with untranslated description |
|
1078 | 1078 | (use many globy for not failing on changed transaction) |
|
1079 | 1079 | $ LANGUAGE=sv hg help debugoptDEP |
|
1080 | 1080 | hg debugoptDEP |
|
1081 | 1081 | |
|
1082 | 1082 | (*) (glob) |
|
1083 | 1083 | |
|
1084 | 1084 | options: |
|
1085 | 1085 | |
|
1086 | 1086 | (some details hidden, use --verbose to show complete help) |
|
1087 | 1087 | #endif |
|
1088 | 1088 | |
|
1089 | 1089 | Test commands that collide with topics (issue4240) |
|
1090 | 1090 | |
|
1091 | 1091 | $ hg config -hq |
|
1092 | 1092 | hg config [-u] [NAME]... |
|
1093 | 1093 | |
|
1094 | 1094 | show combined config settings from all hgrc files |
|
1095 | 1095 | $ hg showconfig -hq |
|
1096 | 1096 | hg config [-u] [NAME]... |
|
1097 | 1097 | |
|
1098 | 1098 | show combined config settings from all hgrc files |
|
1099 | 1099 | |
|
1100 | 1100 | Test a help topic |
|
1101 | 1101 | |
|
1102 | 1102 | $ hg help revs |
|
1103 | 1103 | Specifying Single Revisions |
|
1104 | 1104 | """"""""""""""""""""""""""" |
|
1105 | 1105 | |
|
1106 | 1106 | Mercurial supports several ways to specify individual revisions. |
|
1107 | 1107 | |
|
1108 | 1108 | A plain integer is treated as a revision number. Negative integers are |
|
1109 | 1109 | treated as sequential offsets from the tip, with -1 denoting the tip, -2 |
|
1110 | 1110 | denoting the revision prior to the tip, and so forth. |
|
1111 | 1111 | |
|
1112 | 1112 | A 40-digit hexadecimal string is treated as a unique revision identifier. |
|
1113 | 1113 | |
|
1114 | 1114 | A hexadecimal string less than 40 characters long is treated as a unique |
|
1115 | 1115 | revision identifier and is referred to as a short-form identifier. A |
|
1116 | 1116 | short-form identifier is only valid if it is the prefix of exactly one |
|
1117 | 1117 | full-length identifier. |
|
1118 | 1118 | |
|
1119 | 1119 | Any other string is treated as a bookmark, tag, or branch name. A bookmark |
|
1120 | 1120 | is a movable pointer to a revision. A tag is a permanent name associated |
|
1121 | 1121 | with a revision. A branch name denotes the tipmost open branch head of |
|
1122 | 1122 | that branch - or if they are all closed, the tipmost closed head of the |
|
1123 | 1123 | branch. Bookmark, tag, and branch names must not contain the ":" |
|
1124 | 1124 | character. |
|
1125 | 1125 | |
|
1126 | 1126 | The reserved name "tip" always identifies the most recent revision. |
|
1127 | 1127 | |
|
1128 | 1128 | The reserved name "null" indicates the null revision. This is the revision |
|
1129 | 1129 | of an empty repository, and the parent of revision 0. |
|
1130 | 1130 | |
|
1131 | 1131 | The reserved name "." indicates the working directory parent. If no |
|
1132 | 1132 | working directory is checked out, it is equivalent to null. If an |
|
1133 | 1133 | uncommitted merge is in progress, "." is the revision of the first parent. |
|
1134 | 1134 | |
|
1135 | 1135 | Test repeated config section name |
|
1136 | 1136 | |
|
1137 | 1137 | $ hg help config.host |
|
1138 | 1138 | "http_proxy.host" |
|
1139 | 1139 | Host name and (optional) port of the proxy server, for example |
|
1140 | 1140 | "myproxy:8000". |
|
1141 | 1141 | |
|
1142 | 1142 | "smtp.host" |
|
1143 | 1143 | Host name of mail server, e.g. "mail.example.com". |
|
1144 | 1144 | |
|
1145 | 1145 | Unrelated trailing paragraphs shouldn't be included |
|
1146 | 1146 | |
|
1147 | 1147 | $ hg help config.extramsg | grep '^$' |
|
1148 | 1148 | |
|
1149 | 1149 | |
|
1150 | 1150 | Test capitalized section name |
|
1151 | 1151 | |
|
1152 | 1152 | $ hg help scripting.HGPLAIN > /dev/null |
|
1153 | 1153 | |
|
1154 | 1154 | Help subsection: |
|
1155 | 1155 | |
|
1156 | 1156 | $ hg help config.charsets |grep "Email example:" > /dev/null |
|
1157 | 1157 | [1] |
|
1158 | 1158 | |
|
1159 | 1159 | Show nested definitions |
|
1160 | 1160 | ("profiling.type"[break]"ls"[break]"stat"[break]) |
|
1161 | 1161 | |
|
1162 | 1162 | $ hg help config.type | egrep '^$'|wc -l |
|
1163 | 1163 | \s*3 (re) |
|
1164 | 1164 | |
|
1165 | Separate sections from subsections | |
|
1166 | ||
|
1167 | $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq | |
|
1168 | "format" | |
|
1169 | -------- | |
|
1170 | ||
|
1171 | "usegeneraldelta" | |
|
1172 | ||
|
1173 | "dotencode" | |
|
1174 | ||
|
1175 | "usefncache" | |
|
1176 | ||
|
1177 | "usestore" | |
|
1178 | ||
|
1179 | "profiling" | |
|
1180 | ----------- | |
|
1181 | ||
|
1182 | "format" | |
|
1183 | ||
|
1184 | "progress" | |
|
1185 | ---------- | |
|
1186 | ||
|
1187 | "format" | |
|
1188 | ||
|
1189 | ||
|
1165 | 1190 | Last item in help config.*: |
|
1166 | 1191 | |
|
1167 | 1192 |
$ hg help config.`hg help config|grep ' |
|
1168 | 1193 | > tail -1|sed 's![ "]*!!g'`| \ |
|
1169 | 1194 | > grep "hg help -c config" > /dev/null |
|
1170 | 1195 | [1] |
|
1171 | 1196 | |
|
1172 | 1197 | note to use help -c for general hg help config: |
|
1173 | 1198 | |
|
1174 | 1199 | $ hg help config |grep "hg help -c config" > /dev/null |
|
1175 | 1200 | |
|
1176 | 1201 | Test templating help |
|
1177 | 1202 | |
|
1178 | 1203 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' |
|
1179 | 1204 | desc String. The text of the changeset description. |
|
1180 | 1205 | diffstat String. Statistics of changes with the following format: |
|
1181 | 1206 | firstline Any text. Returns the first line of text. |
|
1182 | 1207 | nonempty Any text. Returns '(none)' if the string is empty. |
|
1183 | 1208 | |
|
1184 | 1209 | Test deprecated items |
|
1185 | 1210 | |
|
1186 | 1211 | $ hg help -v templating | grep currentbookmark |
|
1187 | 1212 | currentbookmark |
|
1188 | 1213 | $ hg help templating | (grep currentbookmark || true) |
|
1189 | 1214 | |
|
1190 | 1215 | Test help hooks |
|
1191 | 1216 | |
|
1192 | 1217 | $ cat > helphook1.py <<EOF |
|
1193 | 1218 | > from mercurial import help |
|
1194 | 1219 | > |
|
1195 | 1220 | > def rewrite(ui, topic, doc): |
|
1196 | 1221 | > return doc + '\nhelphook1\n' |
|
1197 | 1222 | > |
|
1198 | 1223 | > def extsetup(ui): |
|
1199 | 1224 | > help.addtopichook('revsets', rewrite) |
|
1200 | 1225 | > EOF |
|
1201 | 1226 | $ cat > helphook2.py <<EOF |
|
1202 | 1227 | > from mercurial import help |
|
1203 | 1228 | > |
|
1204 | 1229 | > def rewrite(ui, topic, doc): |
|
1205 | 1230 | > return doc + '\nhelphook2\n' |
|
1206 | 1231 | > |
|
1207 | 1232 | > def extsetup(ui): |
|
1208 | 1233 | > help.addtopichook('revsets', rewrite) |
|
1209 | 1234 | > EOF |
|
1210 | 1235 | $ echo '[extensions]' >> $HGRCPATH |
|
1211 | 1236 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH |
|
1212 | 1237 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH |
|
1213 | 1238 | $ hg help revsets | grep helphook |
|
1214 | 1239 | helphook1 |
|
1215 | 1240 | helphook2 |
|
1216 | 1241 | |
|
1217 | 1242 | help -c should only show debug --debug |
|
1218 | 1243 | |
|
1219 | 1244 | $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$' |
|
1220 | 1245 | [1] |
|
1221 | 1246 | |
|
1222 | 1247 | help -c should only show deprecated for -v |
|
1223 | 1248 | |
|
1224 | 1249 | $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$' |
|
1225 | 1250 | [1] |
|
1226 | 1251 | |
|
1227 | 1252 | Test -e / -c / -k combinations |
|
1228 | 1253 | |
|
1229 | 1254 | $ hg help -c|egrep '^[A-Z].*:|^ debug' |
|
1230 | 1255 | Commands: |
|
1231 | 1256 | $ hg help -e|egrep '^[A-Z].*:|^ debug' |
|
1232 | 1257 | Extensions: |
|
1233 | 1258 | $ hg help -k|egrep '^[A-Z].*:|^ debug' |
|
1234 | 1259 | Topics: |
|
1235 | 1260 | Commands: |
|
1236 | 1261 | Extensions: |
|
1237 | 1262 | Extension Commands: |
|
1238 | 1263 | $ hg help -c schemes |
|
1239 | 1264 | abort: no such help topic: schemes |
|
1240 | 1265 | (try "hg help --keyword schemes") |
|
1241 | 1266 | [255] |
|
1242 | 1267 | $ hg help -e schemes |head -1 |
|
1243 | 1268 | schemes extension - extend schemes with shortcuts to repository swarms |
|
1244 | 1269 | $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):' |
|
1245 | 1270 | Commands: |
|
1246 | 1271 | $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):' |
|
1247 | 1272 | Extensions: |
|
1248 | 1273 | $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):' |
|
1249 | 1274 | Extensions: |
|
1250 | 1275 | Commands: |
|
1251 | 1276 | $ hg help -c commit > /dev/null |
|
1252 | 1277 | $ hg help -e -c commit > /dev/null |
|
1253 | 1278 | $ hg help -e commit > /dev/null |
|
1254 | 1279 | abort: no such help topic: commit |
|
1255 | 1280 | (try "hg help --keyword commit") |
|
1256 | 1281 | [255] |
|
1257 | 1282 | |
|
1258 | 1283 | Test keyword search help |
|
1259 | 1284 | |
|
1260 | 1285 | $ cat > prefixedname.py <<EOF |
|
1261 | 1286 | > '''matched against word "clone" |
|
1262 | 1287 | > ''' |
|
1263 | 1288 | > EOF |
|
1264 | 1289 | $ echo '[extensions]' >> $HGRCPATH |
|
1265 | 1290 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH |
|
1266 | 1291 | $ hg help -k clone |
|
1267 | 1292 | Topics: |
|
1268 | 1293 | |
|
1269 | 1294 | config Configuration Files |
|
1270 | 1295 | extensions Using Additional Features |
|
1271 | 1296 | glossary Glossary |
|
1272 | 1297 | phases Working with Phases |
|
1273 | 1298 | subrepos Subrepositories |
|
1274 | 1299 | urls URL Paths |
|
1275 | 1300 | |
|
1276 | 1301 | Commands: |
|
1277 | 1302 | |
|
1278 | 1303 | bookmarks create a new bookmark or list existing bookmarks |
|
1279 | 1304 | clone make a copy of an existing repository |
|
1280 | 1305 | paths show aliases for remote repositories |
|
1281 | 1306 | update update working directory (or switch revisions) |
|
1282 | 1307 | |
|
1283 | 1308 | Extensions: |
|
1284 | 1309 | |
|
1285 | 1310 | clonebundles advertise pre-generated bundles to seed clones (experimental) |
|
1286 | 1311 | prefixedname matched against word "clone" |
|
1287 | 1312 | relink recreates hardlinks between repository clones |
|
1288 | 1313 | |
|
1289 | 1314 | Extension Commands: |
|
1290 | 1315 | |
|
1291 | 1316 | qclone clone main and patch repository at same time |
|
1292 | 1317 | |
|
1293 | 1318 | Test unfound topic |
|
1294 | 1319 | |
|
1295 | 1320 | $ hg help nonexistingtopicthatwillneverexisteverever |
|
1296 | 1321 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever |
|
1297 | 1322 | (try "hg help --keyword nonexistingtopicthatwillneverexisteverever") |
|
1298 | 1323 | [255] |
|
1299 | 1324 | |
|
1300 | 1325 | Test unfound keyword |
|
1301 | 1326 | |
|
1302 | 1327 | $ hg help --keyword nonexistingwordthatwillneverexisteverever |
|
1303 | 1328 | abort: no matches |
|
1304 | 1329 | (try "hg help" for a list of topics) |
|
1305 | 1330 | [255] |
|
1306 | 1331 | |
|
1307 | 1332 | Test omit indicating for help |
|
1308 | 1333 | |
|
1309 | 1334 | $ cat > addverboseitems.py <<EOF |
|
1310 | 1335 | > '''extension to test omit indicating. |
|
1311 | 1336 | > |
|
1312 | 1337 | > This paragraph is never omitted (for extension) |
|
1313 | 1338 | > |
|
1314 | 1339 | > .. container:: verbose |
|
1315 | 1340 | > |
|
1316 | 1341 | > This paragraph is omitted, |
|
1317 | 1342 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension) |
|
1318 | 1343 | > |
|
1319 | 1344 | > This paragraph is never omitted, too (for extension) |
|
1320 | 1345 | > ''' |
|
1321 | 1346 | > |
|
1322 | 1347 | > from mercurial import help, commands |
|
1323 | 1348 | > testtopic = """This paragraph is never omitted (for topic). |
|
1324 | 1349 | > |
|
1325 | 1350 | > .. container:: verbose |
|
1326 | 1351 | > |
|
1327 | 1352 | > This paragraph is omitted, |
|
1328 | 1353 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic) |
|
1329 | 1354 | > |
|
1330 | 1355 | > This paragraph is never omitted, too (for topic) |
|
1331 | 1356 | > """ |
|
1332 | 1357 | > def extsetup(ui): |
|
1333 | 1358 | > help.helptable.append((["topic-containing-verbose"], |
|
1334 | 1359 | > "This is the topic to test omit indicating.", |
|
1335 | 1360 | > lambda ui: testtopic)) |
|
1336 | 1361 | > EOF |
|
1337 | 1362 | $ echo '[extensions]' >> $HGRCPATH |
|
1338 | 1363 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH |
|
1339 | 1364 | $ hg help addverboseitems |
|
1340 | 1365 | addverboseitems extension - extension to test omit indicating. |
|
1341 | 1366 | |
|
1342 | 1367 | This paragraph is never omitted (for extension) |
|
1343 | 1368 | |
|
1344 | 1369 | This paragraph is never omitted, too (for extension) |
|
1345 | 1370 | |
|
1346 | 1371 | (some details hidden, use --verbose to show complete help) |
|
1347 | 1372 | |
|
1348 | 1373 | no commands defined |
|
1349 | 1374 | $ hg help -v addverboseitems |
|
1350 | 1375 | addverboseitems extension - extension to test omit indicating. |
|
1351 | 1376 | |
|
1352 | 1377 | This paragraph is never omitted (for extension) |
|
1353 | 1378 | |
|
1354 | 1379 | This paragraph is omitted, if "hg help" is invoked without "-v" (for |
|
1355 | 1380 | extension) |
|
1356 | 1381 | |
|
1357 | 1382 | This paragraph is never omitted, too (for extension) |
|
1358 | 1383 | |
|
1359 | 1384 | no commands defined |
|
1360 | 1385 | $ hg help topic-containing-verbose |
|
1361 | 1386 | This is the topic to test omit indicating. |
|
1362 | 1387 | """""""""""""""""""""""""""""""""""""""""" |
|
1363 | 1388 | |
|
1364 | 1389 | This paragraph is never omitted (for topic). |
|
1365 | 1390 | |
|
1366 | 1391 | This paragraph is never omitted, too (for topic) |
|
1367 | 1392 | |
|
1368 | 1393 | (some details hidden, use --verbose to show complete help) |
|
1369 | 1394 | $ hg help -v topic-containing-verbose |
|
1370 | 1395 | This is the topic to test omit indicating. |
|
1371 | 1396 | """""""""""""""""""""""""""""""""""""""""" |
|
1372 | 1397 | |
|
1373 | 1398 | This paragraph is never omitted (for topic). |
|
1374 | 1399 | |
|
1375 | 1400 | This paragraph is omitted, if "hg help" is invoked without "-v" (for |
|
1376 | 1401 | topic) |
|
1377 | 1402 | |
|
1378 | 1403 | This paragraph is never omitted, too (for topic) |
|
1379 | 1404 | |
|
1380 | 1405 | Test section lookup |
|
1381 | 1406 | |
|
1382 | 1407 | $ hg help revset.merge |
|
1383 | 1408 | "merge()" |
|
1384 | 1409 | Changeset is a merge changeset. |
|
1385 | 1410 | |
|
1386 | 1411 | $ hg help glossary.dag |
|
1387 | 1412 | DAG |
|
1388 | 1413 | The repository of changesets of a distributed version control system |
|
1389 | 1414 | (DVCS) can be described as a directed acyclic graph (DAG), consisting |
|
1390 | 1415 | of nodes and edges, where nodes correspond to changesets and edges |
|
1391 | 1416 | imply a parent -> child relation. This graph can be visualized by |
|
1392 | 1417 | graphical tools such as "hg log --graph". In Mercurial, the DAG is |
|
1393 | 1418 | limited by the requirement for children to have at most two parents. |
|
1394 | 1419 | |
|
1395 | 1420 | |
|
1396 | 1421 | $ hg help hgrc.paths |
|
1397 | 1422 | "paths" |
|
1398 | 1423 | ------- |
|
1399 | 1424 | |
|
1400 | 1425 | Assigns symbolic names and behavior to repositories. |
|
1401 | 1426 | |
|
1402 | 1427 | Options are symbolic names defining the URL or directory that is the |
|
1403 | 1428 | location of the repository. Example: |
|
1404 | 1429 | |
|
1405 | 1430 | [paths] |
|
1406 | 1431 | my_server = https://example.com/my_repo |
|
1407 | 1432 | local_path = /home/me/repo |
|
1408 | 1433 | |
|
1409 | 1434 | These symbolic names can be used from the command line. To pull from |
|
1410 | 1435 | "my_server": "hg pull my_server". To push to "local_path": "hg push |
|
1411 | 1436 | local_path". |
|
1412 | 1437 | |
|
1413 | 1438 | Options containing colons (":") denote sub-options that can influence |
|
1414 | 1439 | behavior for that specific path. Example: |
|
1415 | 1440 | |
|
1416 | 1441 | [paths] |
|
1417 | 1442 | my_server = https://example.com/my_path |
|
1418 | 1443 | my_server:pushurl = ssh://example.com/my_path |
|
1419 | 1444 | |
|
1420 | 1445 | The following sub-options can be defined: |
|
1421 | 1446 | |
|
1422 | 1447 | "pushurl" |
|
1423 | 1448 | The URL to use for push operations. If not defined, the location |
|
1424 | 1449 | defined by the path's main entry is used. |
|
1425 | 1450 |
|
|
1426 | 1451 | The following special named paths exist: |
|
1427 | 1452 |
|
|
1428 | 1453 | "default" |
|
1429 | 1454 | The URL or directory to use when no source or remote is specified. |
|
1430 | 1455 |
|
|
1431 | 1456 | "hg clone" will automatically define this path to the location the |
|
1432 | 1457 | repository was cloned from. |
|
1433 | 1458 |
|
|
1434 | 1459 | "default-push" |
|
1435 | 1460 | (deprecated) The URL or directory for the default "hg push" location. |
|
1436 | 1461 | "default:pushurl" should be used instead. |
|
1437 | 1462 |
|
|
1438 | 1463 | $ hg help glossary.mcguffin |
|
1439 | 1464 | abort: help section not found |
|
1440 | 1465 | [255] |
|
1441 | 1466 | |
|
1442 | 1467 | $ hg help glossary.mc.guffin |
|
1443 | 1468 | abort: help section not found |
|
1444 | 1469 | [255] |
|
1445 | 1470 | |
|
1446 | 1471 | $ hg help template.files |
|
1447 | 1472 | files List of strings. All files modified, added, or removed by |
|
1448 | 1473 | this changeset. |
|
1449 | 1474 | |
|
1450 | 1475 | Test dynamic list of merge tools only shows up once |
|
1451 | 1476 | $ hg help merge-tools |
|
1452 | 1477 | Merge Tools |
|
1453 | 1478 | """"""""""" |
|
1454 | 1479 |
|
|
1455 | 1480 | To merge files Mercurial uses merge tools. |
|
1456 | 1481 |
|
|
1457 | 1482 | A merge tool combines two different versions of a file into a merged file. |
|
1458 | 1483 | Merge tools are given the two files and the greatest common ancestor of |
|
1459 | 1484 | the two file versions, so they can determine the changes made on both |
|
1460 | 1485 | branches. |
|
1461 | 1486 |
|
|
1462 | 1487 | Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg |
|
1463 | 1488 | backout" and in several extensions. |
|
1464 | 1489 |
|
|
1465 | 1490 | Usually, the merge tool tries to automatically reconcile the files by |
|
1466 | 1491 | combining all non-overlapping changes that occurred separately in the two |
|
1467 | 1492 | different evolutions of the same initial base file. Furthermore, some |
|
1468 | 1493 | interactive merge programs make it easier to manually resolve conflicting |
|
1469 | 1494 | merges, either in a graphical way, or by inserting some conflict markers. |
|
1470 | 1495 | Mercurial does not include any interactive merge programs but relies on |
|
1471 | 1496 | external tools for that. |
|
1472 | 1497 |
|
|
1473 | 1498 | Available merge tools |
|
1474 | 1499 | ===================== |
|
1475 | 1500 |
|
|
1476 | 1501 | External merge tools and their properties are configured in the merge- |
|
1477 | 1502 | tools configuration section - see hgrc(5) - but they can often just be |
|
1478 | 1503 | named by their executable. |
|
1479 | 1504 |
|
|
1480 | 1505 | A merge tool is generally usable if its executable can be found on the |
|
1481 | 1506 | system and if it can handle the merge. The executable is found if it is an |
|
1482 | 1507 | absolute or relative executable path or the name of an application in the |
|
1483 | 1508 | executable search path. The tool is assumed to be able to handle the merge |
|
1484 | 1509 | if it can handle symlinks if the file is a symlink, if it can handle |
|
1485 | 1510 | binary files if the file is binary, and if a GUI is available if the tool |
|
1486 | 1511 | requires a GUI. |
|
1487 | 1512 |
|
|
1488 | 1513 | There are some internal merge tools which can be used. The internal merge |
|
1489 | 1514 | tools are: |
|
1490 | 1515 |
|
|
1491 | 1516 | ":dump" |
|
1492 | 1517 | Creates three versions of the files to merge, containing the contents of |
|
1493 | 1518 | local, other and base. These files can then be used to perform a merge |
|
1494 | 1519 | manually. If the file to be merged is named "a.txt", these files will |
|
1495 | 1520 | accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and |
|
1496 | 1521 | they will be placed in the same directory as "a.txt". |
|
1497 | 1522 |
|
|
1498 | 1523 | ":fail" |
|
1499 | 1524 | Rather than attempting to merge files that were modified on both |
|
1500 | 1525 | branches, it marks them as unresolved. The resolve command must be used |
|
1501 | 1526 | to resolve these conflicts. |
|
1502 | 1527 |
|
|
1503 | 1528 | ":local" |
|
1504 | 1529 | Uses the local version of files as the merged version. |
|
1505 | 1530 |
|
|
1506 | 1531 | ":merge" |
|
1507 | 1532 | Uses the internal non-interactive simple merge algorithm for merging |
|
1508 | 1533 | files. It will fail if there are any conflicts and leave markers in the |
|
1509 | 1534 | partially merged file. Markers will have two sections, one for each side |
|
1510 | 1535 | of merge. |
|
1511 | 1536 |
|
|
1512 | 1537 | ":merge-local" |
|
1513 | 1538 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
1514 | 1539 | local changes. |
|
1515 | 1540 |
|
|
1516 | 1541 | ":merge-other" |
|
1517 | 1542 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
1518 | 1543 | other changes. |
|
1519 | 1544 |
|
|
1520 | 1545 | ":merge3" |
|
1521 | 1546 | Uses the internal non-interactive simple merge algorithm for merging |
|
1522 | 1547 | files. It will fail if there are any conflicts and leave markers in the |
|
1523 | 1548 | partially merged file. Marker will have three sections, one from each |
|
1524 | 1549 | side of the merge and one for the base content. |
|
1525 | 1550 |
|
|
1526 | 1551 | ":other" |
|
1527 | 1552 | Uses the other version of files as the merged version. |
|
1528 | 1553 |
|
|
1529 | 1554 | ":prompt" |
|
1530 | 1555 | Asks the user which of the local or the other version to keep as the |
|
1531 | 1556 | merged version. |
|
1532 | 1557 |
|
|
1533 | 1558 | ":tagmerge" |
|
1534 | 1559 | Uses the internal tag merge algorithm (experimental). |
|
1535 | 1560 |
|
|
1536 | 1561 | ":union" |
|
1537 | 1562 | Uses the internal non-interactive simple merge algorithm for merging |
|
1538 | 1563 | files. It will use both left and right sides for conflict regions. No |
|
1539 | 1564 | markers are inserted. |
|
1540 | 1565 |
|
|
1541 | 1566 | Internal tools are always available and do not require a GUI but will by |
|
1542 | 1567 | default not handle symlinks or binary files. |
|
1543 | 1568 |
|
|
1544 | 1569 | Choosing a merge tool |
|
1545 | 1570 | ===================== |
|
1546 | 1571 |
|
|
1547 | 1572 | Mercurial uses these rules when deciding which merge tool to use: |
|
1548 | 1573 |
|
|
1549 | 1574 | 1. If a tool has been specified with the --tool option to merge or |
|
1550 | 1575 | resolve, it is used. If it is the name of a tool in the merge-tools |
|
1551 | 1576 | configuration, its configuration is used. Otherwise the specified tool |
|
1552 | 1577 | must be executable by the shell. |
|
1553 | 1578 | 2. If the "HGMERGE" environment variable is present, its value is used and |
|
1554 | 1579 | must be executable by the shell. |
|
1555 | 1580 | 3. If the filename of the file to be merged matches any of the patterns in |
|
1556 | 1581 | the merge-patterns configuration section, the first usable merge tool |
|
1557 | 1582 | corresponding to a matching pattern is used. Here, binary capabilities |
|
1558 | 1583 | of the merge tool are not considered. |
|
1559 | 1584 | 4. If ui.merge is set it will be considered next. If the value is not the |
|
1560 | 1585 | name of a configured tool, the specified value is used and must be |
|
1561 | 1586 | executable by the shell. Otherwise the named tool is used if it is |
|
1562 | 1587 | usable. |
|
1563 | 1588 | 5. If any usable merge tools are present in the merge-tools configuration |
|
1564 | 1589 | section, the one with the highest priority is used. |
|
1565 | 1590 | 6. If a program named "hgmerge" can be found on the system, it is used - |
|
1566 | 1591 | but it will by default not be used for symlinks and binary files. |
|
1567 | 1592 | 7. If the file to be merged is not binary and is not a symlink, then |
|
1568 | 1593 | internal ":merge" is used. |
|
1569 | 1594 | 8. The merge of the file fails and must be resolved before commit. |
|
1570 | 1595 |
|
|
1571 | 1596 | Note: |
|
1572 | 1597 | After selecting a merge program, Mercurial will by default attempt to |
|
1573 | 1598 | merge the files using a simple merge algorithm first. Only if it |
|
1574 | 1599 |
|
|
1575 | 1600 | execute the merge program. Whether to use the simple merge algorithm |
|
1576 | 1601 | first can be controlled by the premerge setting of the merge tool. |
|
1577 | 1602 | Premerge is enabled by default unless the file is binary or a symlink. |
|
1578 | 1603 | |
|
1579 | 1604 | See the merge-tools and ui sections of hgrc(5) for details on the |
|
1580 | 1605 | configuration of merge tools. |
|
1581 | 1606 | |
|
1582 | 1607 | Test usage of section marks in help documents |
|
1583 | 1608 | |
|
1584 | 1609 | $ cd "$TESTDIR"/../doc |
|
1585 | 1610 | $ python check-seclevel.py |
|
1586 | 1611 | $ cd $TESTTMP |
|
1587 | 1612 | |
|
1588 | 1613 | #if serve |
|
1589 | 1614 | |
|
1590 | 1615 | Test the help pages in hgweb. |
|
1591 | 1616 | |
|
1592 | 1617 | Dish up an empty repo; serve it cold. |
|
1593 | 1618 | |
|
1594 | 1619 | $ hg init "$TESTTMP/test" |
|
1595 | 1620 | $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid |
|
1596 | 1621 | $ cat hg.pid >> $DAEMON_PIDS |
|
1597 | 1622 | |
|
1598 | 1623 | $ get-with-headers.py 127.0.0.1:$HGPORT "help" |
|
1599 | 1624 | 200 Script output follows |
|
1600 | 1625 | |
|
1601 | 1626 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1602 | 1627 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1603 | 1628 | <head> |
|
1604 | 1629 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1605 | 1630 | <meta name="robots" content="index, nofollow" /> |
|
1606 | 1631 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1607 | 1632 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1608 | 1633 | |
|
1609 | 1634 | <title>Help: Index</title> |
|
1610 | 1635 | </head> |
|
1611 | 1636 | <body> |
|
1612 | 1637 | |
|
1613 | 1638 | <div class="container"> |
|
1614 | 1639 | <div class="menu"> |
|
1615 | 1640 | <div class="logo"> |
|
1616 | 1641 | <a href="https://mercurial-scm.org/"> |
|
1617 | 1642 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1618 | 1643 | </div> |
|
1619 | 1644 | <ul> |
|
1620 | 1645 | <li><a href="/shortlog">log</a></li> |
|
1621 | 1646 | <li><a href="/graph">graph</a></li> |
|
1622 | 1647 | <li><a href="/tags">tags</a></li> |
|
1623 | 1648 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1624 | 1649 | <li><a href="/branches">branches</a></li> |
|
1625 | 1650 | </ul> |
|
1626 | 1651 | <ul> |
|
1627 | 1652 | <li class="active">help</li> |
|
1628 | 1653 | </ul> |
|
1629 | 1654 | </div> |
|
1630 | 1655 | |
|
1631 | 1656 | <div class="main"> |
|
1632 | 1657 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1633 | 1658 | <form class="search" action="/log"> |
|
1634 | 1659 | |
|
1635 | 1660 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1636 | 1661 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1637 | 1662 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1638 | 1663 | </form> |
|
1639 | 1664 | <table class="bigtable"> |
|
1640 | 1665 | <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr> |
|
1641 | 1666 | |
|
1642 | 1667 | <tr><td> |
|
1643 | 1668 | <a href="/help/config"> |
|
1644 | 1669 | config |
|
1645 | 1670 | </a> |
|
1646 | 1671 | </td><td> |
|
1647 | 1672 | Configuration Files |
|
1648 | 1673 | </td></tr> |
|
1649 | 1674 | <tr><td> |
|
1650 | 1675 | <a href="/help/dates"> |
|
1651 | 1676 | dates |
|
1652 | 1677 | </a> |
|
1653 | 1678 | </td><td> |
|
1654 | 1679 | Date Formats |
|
1655 | 1680 | </td></tr> |
|
1656 | 1681 | <tr><td> |
|
1657 | 1682 | <a href="/help/diffs"> |
|
1658 | 1683 | diffs |
|
1659 | 1684 | </a> |
|
1660 | 1685 | </td><td> |
|
1661 | 1686 | Diff Formats |
|
1662 | 1687 | </td></tr> |
|
1663 | 1688 | <tr><td> |
|
1664 | 1689 | <a href="/help/environment"> |
|
1665 | 1690 | environment |
|
1666 | 1691 | </a> |
|
1667 | 1692 | </td><td> |
|
1668 | 1693 | Environment Variables |
|
1669 | 1694 | </td></tr> |
|
1670 | 1695 | <tr><td> |
|
1671 | 1696 | <a href="/help/extensions"> |
|
1672 | 1697 | extensions |
|
1673 | 1698 | </a> |
|
1674 | 1699 | </td><td> |
|
1675 | 1700 | Using Additional Features |
|
1676 | 1701 | </td></tr> |
|
1677 | 1702 | <tr><td> |
|
1678 | 1703 | <a href="/help/filesets"> |
|
1679 | 1704 | filesets |
|
1680 | 1705 | </a> |
|
1681 | 1706 | </td><td> |
|
1682 | 1707 | Specifying File Sets |
|
1683 | 1708 | </td></tr> |
|
1684 | 1709 | <tr><td> |
|
1685 | 1710 | <a href="/help/glossary"> |
|
1686 | 1711 | glossary |
|
1687 | 1712 | </a> |
|
1688 | 1713 | </td><td> |
|
1689 | 1714 | Glossary |
|
1690 | 1715 | </td></tr> |
|
1691 | 1716 | <tr><td> |
|
1692 | 1717 | <a href="/help/hgignore"> |
|
1693 | 1718 | hgignore |
|
1694 | 1719 | </a> |
|
1695 | 1720 | </td><td> |
|
1696 | 1721 | Syntax for Mercurial Ignore Files |
|
1697 | 1722 | </td></tr> |
|
1698 | 1723 | <tr><td> |
|
1699 | 1724 | <a href="/help/hgweb"> |
|
1700 | 1725 | hgweb |
|
1701 | 1726 | </a> |
|
1702 | 1727 | </td><td> |
|
1703 | 1728 | Configuring hgweb |
|
1704 | 1729 | </td></tr> |
|
1705 | 1730 | <tr><td> |
|
1706 | 1731 | <a href="/help/internals"> |
|
1707 | 1732 | internals |
|
1708 | 1733 | </a> |
|
1709 | 1734 | </td><td> |
|
1710 | 1735 | Technical implementation topics |
|
1711 | 1736 | </td></tr> |
|
1712 | 1737 | <tr><td> |
|
1713 | 1738 | <a href="/help/merge-tools"> |
|
1714 | 1739 | merge-tools |
|
1715 | 1740 | </a> |
|
1716 | 1741 | </td><td> |
|
1717 | 1742 | Merge Tools |
|
1718 | 1743 | </td></tr> |
|
1719 | 1744 | <tr><td> |
|
1720 | 1745 | <a href="/help/multirevs"> |
|
1721 | 1746 | multirevs |
|
1722 | 1747 | </a> |
|
1723 | 1748 | </td><td> |
|
1724 | 1749 | Specifying Multiple Revisions |
|
1725 | 1750 | </td></tr> |
|
1726 | 1751 | <tr><td> |
|
1727 | 1752 | <a href="/help/patterns"> |
|
1728 | 1753 | patterns |
|
1729 | 1754 | </a> |
|
1730 | 1755 | </td><td> |
|
1731 | 1756 | File Name Patterns |
|
1732 | 1757 | </td></tr> |
|
1733 | 1758 | <tr><td> |
|
1734 | 1759 | <a href="/help/phases"> |
|
1735 | 1760 | phases |
|
1736 | 1761 | </a> |
|
1737 | 1762 | </td><td> |
|
1738 | 1763 | Working with Phases |
|
1739 | 1764 | </td></tr> |
|
1740 | 1765 | <tr><td> |
|
1741 | 1766 | <a href="/help/revisions"> |
|
1742 | 1767 | revisions |
|
1743 | 1768 | </a> |
|
1744 | 1769 | </td><td> |
|
1745 | 1770 | Specifying Single Revisions |
|
1746 | 1771 | </td></tr> |
|
1747 | 1772 | <tr><td> |
|
1748 | 1773 | <a href="/help/revsets"> |
|
1749 | 1774 | revsets |
|
1750 | 1775 | </a> |
|
1751 | 1776 | </td><td> |
|
1752 | 1777 | Specifying Revision Sets |
|
1753 | 1778 | </td></tr> |
|
1754 | 1779 | <tr><td> |
|
1755 | 1780 | <a href="/help/scripting"> |
|
1756 | 1781 | scripting |
|
1757 | 1782 | </a> |
|
1758 | 1783 | </td><td> |
|
1759 | 1784 | Using Mercurial from scripts and automation |
|
1760 | 1785 | </td></tr> |
|
1761 | 1786 | <tr><td> |
|
1762 | 1787 | <a href="/help/subrepos"> |
|
1763 | 1788 | subrepos |
|
1764 | 1789 | </a> |
|
1765 | 1790 | </td><td> |
|
1766 | 1791 | Subrepositories |
|
1767 | 1792 | </td></tr> |
|
1768 | 1793 | <tr><td> |
|
1769 | 1794 | <a href="/help/templating"> |
|
1770 | 1795 | templating |
|
1771 | 1796 | </a> |
|
1772 | 1797 | </td><td> |
|
1773 | 1798 | Template Usage |
|
1774 | 1799 | </td></tr> |
|
1775 | 1800 | <tr><td> |
|
1776 | 1801 | <a href="/help/urls"> |
|
1777 | 1802 | urls |
|
1778 | 1803 | </a> |
|
1779 | 1804 | </td><td> |
|
1780 | 1805 | URL Paths |
|
1781 | 1806 | </td></tr> |
|
1782 | 1807 | <tr><td> |
|
1783 | 1808 | <a href="/help/topic-containing-verbose"> |
|
1784 | 1809 | topic-containing-verbose |
|
1785 | 1810 | </a> |
|
1786 | 1811 | </td><td> |
|
1787 | 1812 | This is the topic to test omit indicating. |
|
1788 | 1813 | </td></tr> |
|
1789 | 1814 | |
|
1790 | 1815 | |
|
1791 | 1816 | <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr> |
|
1792 | 1817 | |
|
1793 | 1818 | <tr><td> |
|
1794 | 1819 | <a href="/help/add"> |
|
1795 | 1820 | add |
|
1796 | 1821 | </a> |
|
1797 | 1822 | </td><td> |
|
1798 | 1823 | add the specified files on the next commit |
|
1799 | 1824 | </td></tr> |
|
1800 | 1825 | <tr><td> |
|
1801 | 1826 | <a href="/help/annotate"> |
|
1802 | 1827 | annotate |
|
1803 | 1828 | </a> |
|
1804 | 1829 | </td><td> |
|
1805 | 1830 | show changeset information by line for each file |
|
1806 | 1831 | </td></tr> |
|
1807 | 1832 | <tr><td> |
|
1808 | 1833 | <a href="/help/clone"> |
|
1809 | 1834 | clone |
|
1810 | 1835 | </a> |
|
1811 | 1836 | </td><td> |
|
1812 | 1837 | make a copy of an existing repository |
|
1813 | 1838 | </td></tr> |
|
1814 | 1839 | <tr><td> |
|
1815 | 1840 | <a href="/help/commit"> |
|
1816 | 1841 | commit |
|
1817 | 1842 | </a> |
|
1818 | 1843 | </td><td> |
|
1819 | 1844 | commit the specified files or all outstanding changes |
|
1820 | 1845 | </td></tr> |
|
1821 | 1846 | <tr><td> |
|
1822 | 1847 | <a href="/help/diff"> |
|
1823 | 1848 | diff |
|
1824 | 1849 | </a> |
|
1825 | 1850 | </td><td> |
|
1826 | 1851 | diff repository (or selected files) |
|
1827 | 1852 | </td></tr> |
|
1828 | 1853 | <tr><td> |
|
1829 | 1854 | <a href="/help/export"> |
|
1830 | 1855 | export |
|
1831 | 1856 | </a> |
|
1832 | 1857 | </td><td> |
|
1833 | 1858 | dump the header and diffs for one or more changesets |
|
1834 | 1859 | </td></tr> |
|
1835 | 1860 | <tr><td> |
|
1836 | 1861 | <a href="/help/forget"> |
|
1837 | 1862 | forget |
|
1838 | 1863 | </a> |
|
1839 | 1864 | </td><td> |
|
1840 | 1865 | forget the specified files on the next commit |
|
1841 | 1866 | </td></tr> |
|
1842 | 1867 | <tr><td> |
|
1843 | 1868 | <a href="/help/init"> |
|
1844 | 1869 | init |
|
1845 | 1870 | </a> |
|
1846 | 1871 | </td><td> |
|
1847 | 1872 | create a new repository in the given directory |
|
1848 | 1873 | </td></tr> |
|
1849 | 1874 | <tr><td> |
|
1850 | 1875 | <a href="/help/log"> |
|
1851 | 1876 | log |
|
1852 | 1877 | </a> |
|
1853 | 1878 | </td><td> |
|
1854 | 1879 | show revision history of entire repository or files |
|
1855 | 1880 | </td></tr> |
|
1856 | 1881 | <tr><td> |
|
1857 | 1882 | <a href="/help/merge"> |
|
1858 | 1883 | merge |
|
1859 | 1884 | </a> |
|
1860 | 1885 | </td><td> |
|
1861 | 1886 | merge another revision into working directory |
|
1862 | 1887 | </td></tr> |
|
1863 | 1888 | <tr><td> |
|
1864 | 1889 | <a href="/help/pull"> |
|
1865 | 1890 | pull |
|
1866 | 1891 | </a> |
|
1867 | 1892 | </td><td> |
|
1868 | 1893 | pull changes from the specified source |
|
1869 | 1894 | </td></tr> |
|
1870 | 1895 | <tr><td> |
|
1871 | 1896 | <a href="/help/push"> |
|
1872 | 1897 | push |
|
1873 | 1898 | </a> |
|
1874 | 1899 | </td><td> |
|
1875 | 1900 | push changes to the specified destination |
|
1876 | 1901 | </td></tr> |
|
1877 | 1902 | <tr><td> |
|
1878 | 1903 | <a href="/help/remove"> |
|
1879 | 1904 | remove |
|
1880 | 1905 | </a> |
|
1881 | 1906 | </td><td> |
|
1882 | 1907 | remove the specified files on the next commit |
|
1883 | 1908 | </td></tr> |
|
1884 | 1909 | <tr><td> |
|
1885 | 1910 | <a href="/help/serve"> |
|
1886 | 1911 | serve |
|
1887 | 1912 | </a> |
|
1888 | 1913 | </td><td> |
|
1889 | 1914 | start stand-alone webserver |
|
1890 | 1915 | </td></tr> |
|
1891 | 1916 | <tr><td> |
|
1892 | 1917 | <a href="/help/status"> |
|
1893 | 1918 | status |
|
1894 | 1919 | </a> |
|
1895 | 1920 | </td><td> |
|
1896 | 1921 | show changed files in the working directory |
|
1897 | 1922 | </td></tr> |
|
1898 | 1923 | <tr><td> |
|
1899 | 1924 | <a href="/help/summary"> |
|
1900 | 1925 | summary |
|
1901 | 1926 | </a> |
|
1902 | 1927 | </td><td> |
|
1903 | 1928 | summarize working directory state |
|
1904 | 1929 | </td></tr> |
|
1905 | 1930 | <tr><td> |
|
1906 | 1931 | <a href="/help/update"> |
|
1907 | 1932 | update |
|
1908 | 1933 | </a> |
|
1909 | 1934 | </td><td> |
|
1910 | 1935 | update working directory (or switch revisions) |
|
1911 | 1936 | </td></tr> |
|
1912 | 1937 | |
|
1913 | 1938 | |
|
1914 | 1939 | |
|
1915 | 1940 | <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr> |
|
1916 | 1941 | |
|
1917 | 1942 | <tr><td> |
|
1918 | 1943 | <a href="/help/addremove"> |
|
1919 | 1944 | addremove |
|
1920 | 1945 | </a> |
|
1921 | 1946 | </td><td> |
|
1922 | 1947 | add all new files, delete all missing files |
|
1923 | 1948 | </td></tr> |
|
1924 | 1949 | <tr><td> |
|
1925 | 1950 | <a href="/help/archive"> |
|
1926 | 1951 | archive |
|
1927 | 1952 | </a> |
|
1928 | 1953 | </td><td> |
|
1929 | 1954 | create an unversioned archive of a repository revision |
|
1930 | 1955 | </td></tr> |
|
1931 | 1956 | <tr><td> |
|
1932 | 1957 | <a href="/help/backout"> |
|
1933 | 1958 | backout |
|
1934 | 1959 | </a> |
|
1935 | 1960 | </td><td> |
|
1936 | 1961 | reverse effect of earlier changeset |
|
1937 | 1962 | </td></tr> |
|
1938 | 1963 | <tr><td> |
|
1939 | 1964 | <a href="/help/bisect"> |
|
1940 | 1965 | bisect |
|
1941 | 1966 | </a> |
|
1942 | 1967 | </td><td> |
|
1943 | 1968 | subdivision search of changesets |
|
1944 | 1969 | </td></tr> |
|
1945 | 1970 | <tr><td> |
|
1946 | 1971 | <a href="/help/bookmarks"> |
|
1947 | 1972 | bookmarks |
|
1948 | 1973 | </a> |
|
1949 | 1974 | </td><td> |
|
1950 | 1975 | create a new bookmark or list existing bookmarks |
|
1951 | 1976 | </td></tr> |
|
1952 | 1977 | <tr><td> |
|
1953 | 1978 | <a href="/help/branch"> |
|
1954 | 1979 | branch |
|
1955 | 1980 | </a> |
|
1956 | 1981 | </td><td> |
|
1957 | 1982 | set or show the current branch name |
|
1958 | 1983 | </td></tr> |
|
1959 | 1984 | <tr><td> |
|
1960 | 1985 | <a href="/help/branches"> |
|
1961 | 1986 | branches |
|
1962 | 1987 | </a> |
|
1963 | 1988 | </td><td> |
|
1964 | 1989 | list repository named branches |
|
1965 | 1990 | </td></tr> |
|
1966 | 1991 | <tr><td> |
|
1967 | 1992 | <a href="/help/bundle"> |
|
1968 | 1993 | bundle |
|
1969 | 1994 | </a> |
|
1970 | 1995 | </td><td> |
|
1971 | 1996 | create a changegroup file |
|
1972 | 1997 | </td></tr> |
|
1973 | 1998 | <tr><td> |
|
1974 | 1999 | <a href="/help/cat"> |
|
1975 | 2000 | cat |
|
1976 | 2001 | </a> |
|
1977 | 2002 | </td><td> |
|
1978 | 2003 | output the current or given revision of files |
|
1979 | 2004 | </td></tr> |
|
1980 | 2005 | <tr><td> |
|
1981 | 2006 | <a href="/help/config"> |
|
1982 | 2007 | config |
|
1983 | 2008 | </a> |
|
1984 | 2009 | </td><td> |
|
1985 | 2010 | show combined config settings from all hgrc files |
|
1986 | 2011 | </td></tr> |
|
1987 | 2012 | <tr><td> |
|
1988 | 2013 | <a href="/help/copy"> |
|
1989 | 2014 | copy |
|
1990 | 2015 | </a> |
|
1991 | 2016 | </td><td> |
|
1992 | 2017 | mark files as copied for the next commit |
|
1993 | 2018 | </td></tr> |
|
1994 | 2019 | <tr><td> |
|
1995 | 2020 | <a href="/help/files"> |
|
1996 | 2021 | files |
|
1997 | 2022 | </a> |
|
1998 | 2023 | </td><td> |
|
1999 | 2024 | list tracked files |
|
2000 | 2025 | </td></tr> |
|
2001 | 2026 | <tr><td> |
|
2002 | 2027 | <a href="/help/graft"> |
|
2003 | 2028 | graft |
|
2004 | 2029 | </a> |
|
2005 | 2030 | </td><td> |
|
2006 | 2031 | copy changes from other branches onto the current branch |
|
2007 | 2032 | </td></tr> |
|
2008 | 2033 | <tr><td> |
|
2009 | 2034 | <a href="/help/grep"> |
|
2010 | 2035 | grep |
|
2011 | 2036 | </a> |
|
2012 | 2037 | </td><td> |
|
2013 | 2038 | search for a pattern in specified files and revisions |
|
2014 | 2039 | </td></tr> |
|
2015 | 2040 | <tr><td> |
|
2016 | 2041 | <a href="/help/heads"> |
|
2017 | 2042 | heads |
|
2018 | 2043 | </a> |
|
2019 | 2044 | </td><td> |
|
2020 | 2045 | show branch heads |
|
2021 | 2046 | </td></tr> |
|
2022 | 2047 | <tr><td> |
|
2023 | 2048 | <a href="/help/help"> |
|
2024 | 2049 | help |
|
2025 | 2050 | </a> |
|
2026 | 2051 | </td><td> |
|
2027 | 2052 | show help for a given topic or a help overview |
|
2028 | 2053 | </td></tr> |
|
2029 | 2054 | <tr><td> |
|
2030 | 2055 | <a href="/help/identify"> |
|
2031 | 2056 | identify |
|
2032 | 2057 | </a> |
|
2033 | 2058 | </td><td> |
|
2034 | 2059 | identify the working directory or specified revision |
|
2035 | 2060 | </td></tr> |
|
2036 | 2061 | <tr><td> |
|
2037 | 2062 | <a href="/help/import"> |
|
2038 | 2063 | import |
|
2039 | 2064 | </a> |
|
2040 | 2065 | </td><td> |
|
2041 | 2066 | import an ordered set of patches |
|
2042 | 2067 | </td></tr> |
|
2043 | 2068 | <tr><td> |
|
2044 | 2069 | <a href="/help/incoming"> |
|
2045 | 2070 | incoming |
|
2046 | 2071 | </a> |
|
2047 | 2072 | </td><td> |
|
2048 | 2073 | show new changesets found in source |
|
2049 | 2074 | </td></tr> |
|
2050 | 2075 | <tr><td> |
|
2051 | 2076 | <a href="/help/manifest"> |
|
2052 | 2077 | manifest |
|
2053 | 2078 | </a> |
|
2054 | 2079 | </td><td> |
|
2055 | 2080 | output the current or given revision of the project manifest |
|
2056 | 2081 | </td></tr> |
|
2057 | 2082 | <tr><td> |
|
2058 | 2083 | <a href="/help/nohelp"> |
|
2059 | 2084 | nohelp |
|
2060 | 2085 | </a> |
|
2061 | 2086 | </td><td> |
|
2062 | 2087 | (no help text available) |
|
2063 | 2088 | </td></tr> |
|
2064 | 2089 | <tr><td> |
|
2065 | 2090 | <a href="/help/outgoing"> |
|
2066 | 2091 | outgoing |
|
2067 | 2092 | </a> |
|
2068 | 2093 | </td><td> |
|
2069 | 2094 | show changesets not found in the destination |
|
2070 | 2095 | </td></tr> |
|
2071 | 2096 | <tr><td> |
|
2072 | 2097 | <a href="/help/paths"> |
|
2073 | 2098 | paths |
|
2074 | 2099 | </a> |
|
2075 | 2100 | </td><td> |
|
2076 | 2101 | show aliases for remote repositories |
|
2077 | 2102 | </td></tr> |
|
2078 | 2103 | <tr><td> |
|
2079 | 2104 | <a href="/help/phase"> |
|
2080 | 2105 | phase |
|
2081 | 2106 | </a> |
|
2082 | 2107 | </td><td> |
|
2083 | 2108 | set or show the current phase name |
|
2084 | 2109 | </td></tr> |
|
2085 | 2110 | <tr><td> |
|
2086 | 2111 | <a href="/help/recover"> |
|
2087 | 2112 | recover |
|
2088 | 2113 | </a> |
|
2089 | 2114 | </td><td> |
|
2090 | 2115 | roll back an interrupted transaction |
|
2091 | 2116 | </td></tr> |
|
2092 | 2117 | <tr><td> |
|
2093 | 2118 | <a href="/help/rename"> |
|
2094 | 2119 | rename |
|
2095 | 2120 | </a> |
|
2096 | 2121 | </td><td> |
|
2097 | 2122 | rename files; equivalent of copy + remove |
|
2098 | 2123 | </td></tr> |
|
2099 | 2124 | <tr><td> |
|
2100 | 2125 | <a href="/help/resolve"> |
|
2101 | 2126 | resolve |
|
2102 | 2127 | </a> |
|
2103 | 2128 | </td><td> |
|
2104 | 2129 | redo merges or set/view the merge status of files |
|
2105 | 2130 | </td></tr> |
|
2106 | 2131 | <tr><td> |
|
2107 | 2132 | <a href="/help/revert"> |
|
2108 | 2133 | revert |
|
2109 | 2134 | </a> |
|
2110 | 2135 | </td><td> |
|
2111 | 2136 | restore files to their checkout state |
|
2112 | 2137 | </td></tr> |
|
2113 | 2138 | <tr><td> |
|
2114 | 2139 | <a href="/help/root"> |
|
2115 | 2140 | root |
|
2116 | 2141 | </a> |
|
2117 | 2142 | </td><td> |
|
2118 | 2143 | print the root (top) of the current working directory |
|
2119 | 2144 | </td></tr> |
|
2120 | 2145 | <tr><td> |
|
2121 | 2146 | <a href="/help/tag"> |
|
2122 | 2147 | tag |
|
2123 | 2148 | </a> |
|
2124 | 2149 | </td><td> |
|
2125 | 2150 | add one or more tags for the current or given revision |
|
2126 | 2151 | </td></tr> |
|
2127 | 2152 | <tr><td> |
|
2128 | 2153 | <a href="/help/tags"> |
|
2129 | 2154 | tags |
|
2130 | 2155 | </a> |
|
2131 | 2156 | </td><td> |
|
2132 | 2157 | list repository tags |
|
2133 | 2158 | </td></tr> |
|
2134 | 2159 | <tr><td> |
|
2135 | 2160 | <a href="/help/unbundle"> |
|
2136 | 2161 | unbundle |
|
2137 | 2162 | </a> |
|
2138 | 2163 | </td><td> |
|
2139 | 2164 | apply one or more changegroup files |
|
2140 | 2165 | </td></tr> |
|
2141 | 2166 | <tr><td> |
|
2142 | 2167 | <a href="/help/verify"> |
|
2143 | 2168 | verify |
|
2144 | 2169 | </a> |
|
2145 | 2170 | </td><td> |
|
2146 | 2171 | verify the integrity of the repository |
|
2147 | 2172 | </td></tr> |
|
2148 | 2173 | <tr><td> |
|
2149 | 2174 | <a href="/help/version"> |
|
2150 | 2175 | version |
|
2151 | 2176 | </a> |
|
2152 | 2177 | </td><td> |
|
2153 | 2178 | output version and copyright information |
|
2154 | 2179 | </td></tr> |
|
2155 | 2180 | |
|
2156 | 2181 | |
|
2157 | 2182 | </table> |
|
2158 | 2183 | </div> |
|
2159 | 2184 | </div> |
|
2160 | 2185 | |
|
2161 | 2186 | <script type="text/javascript">process_dates()</script> |
|
2162 | 2187 | |
|
2163 | 2188 | |
|
2164 | 2189 | </body> |
|
2165 | 2190 | </html> |
|
2166 | 2191 | |
|
2167 | 2192 | |
|
2168 | 2193 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/add" |
|
2169 | 2194 | 200 Script output follows |
|
2170 | 2195 | |
|
2171 | 2196 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2172 | 2197 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2173 | 2198 | <head> |
|
2174 | 2199 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2175 | 2200 | <meta name="robots" content="index, nofollow" /> |
|
2176 | 2201 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2177 | 2202 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2178 | 2203 | |
|
2179 | 2204 | <title>Help: add</title> |
|
2180 | 2205 | </head> |
|
2181 | 2206 | <body> |
|
2182 | 2207 | |
|
2183 | 2208 | <div class="container"> |
|
2184 | 2209 | <div class="menu"> |
|
2185 | 2210 | <div class="logo"> |
|
2186 | 2211 | <a href="https://mercurial-scm.org/"> |
|
2187 | 2212 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2188 | 2213 | </div> |
|
2189 | 2214 | <ul> |
|
2190 | 2215 | <li><a href="/shortlog">log</a></li> |
|
2191 | 2216 | <li><a href="/graph">graph</a></li> |
|
2192 | 2217 | <li><a href="/tags">tags</a></li> |
|
2193 | 2218 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2194 | 2219 | <li><a href="/branches">branches</a></li> |
|
2195 | 2220 | </ul> |
|
2196 | 2221 | <ul> |
|
2197 | 2222 | <li class="active"><a href="/help">help</a></li> |
|
2198 | 2223 | </ul> |
|
2199 | 2224 | </div> |
|
2200 | 2225 | |
|
2201 | 2226 | <div class="main"> |
|
2202 | 2227 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2203 | 2228 | <h3>Help: add</h3> |
|
2204 | 2229 | |
|
2205 | 2230 | <form class="search" action="/log"> |
|
2206 | 2231 | |
|
2207 | 2232 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2208 | 2233 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2209 | 2234 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2210 | 2235 | </form> |
|
2211 | 2236 | <div id="doc"> |
|
2212 | 2237 | <p> |
|
2213 | 2238 | hg add [OPTION]... [FILE]... |
|
2214 | 2239 | </p> |
|
2215 | 2240 | <p> |
|
2216 | 2241 | add the specified files on the next commit |
|
2217 | 2242 | </p> |
|
2218 | 2243 | <p> |
|
2219 | 2244 | Schedule files to be version controlled and added to the |
|
2220 | 2245 | repository. |
|
2221 | 2246 | </p> |
|
2222 | 2247 | <p> |
|
2223 | 2248 | The files will be added to the repository at the next commit. To |
|
2224 | 2249 | undo an add before that, see "hg forget". |
|
2225 | 2250 | </p> |
|
2226 | 2251 | <p> |
|
2227 | 2252 | If no names are given, add all files to the repository (except |
|
2228 | 2253 | files matching ".hgignore"). |
|
2229 | 2254 | </p> |
|
2230 | 2255 | <p> |
|
2231 | 2256 | Examples: |
|
2232 | 2257 | </p> |
|
2233 | 2258 | <ul> |
|
2234 | 2259 | <li> New (unknown) files are added automatically by "hg add": |
|
2235 | 2260 | <pre> |
|
2236 | 2261 | \$ ls (re) |
|
2237 | 2262 | foo.c |
|
2238 | 2263 | \$ hg status (re) |
|
2239 | 2264 | ? foo.c |
|
2240 | 2265 | \$ hg add (re) |
|
2241 | 2266 | adding foo.c |
|
2242 | 2267 | \$ hg status (re) |
|
2243 | 2268 | A foo.c |
|
2244 | 2269 | </pre> |
|
2245 | 2270 | <li> Specific files to be added can be specified: |
|
2246 | 2271 | <pre> |
|
2247 | 2272 | \$ ls (re) |
|
2248 | 2273 | bar.c foo.c |
|
2249 | 2274 | \$ hg status (re) |
|
2250 | 2275 | ? bar.c |
|
2251 | 2276 | ? foo.c |
|
2252 | 2277 | \$ hg add bar.c (re) |
|
2253 | 2278 | \$ hg status (re) |
|
2254 | 2279 | A bar.c |
|
2255 | 2280 | ? foo.c |
|
2256 | 2281 | </pre> |
|
2257 | 2282 | </ul> |
|
2258 | 2283 | <p> |
|
2259 | 2284 | Returns 0 if all files are successfully added. |
|
2260 | 2285 | </p> |
|
2261 | 2286 | <p> |
|
2262 | 2287 | options ([+] can be repeated): |
|
2263 | 2288 | </p> |
|
2264 | 2289 | <table> |
|
2265 | 2290 | <tr><td>-I</td> |
|
2266 | 2291 | <td>--include PATTERN [+]</td> |
|
2267 | 2292 | <td>include names matching the given patterns</td></tr> |
|
2268 | 2293 | <tr><td>-X</td> |
|
2269 | 2294 | <td>--exclude PATTERN [+]</td> |
|
2270 | 2295 | <td>exclude names matching the given patterns</td></tr> |
|
2271 | 2296 | <tr><td>-S</td> |
|
2272 | 2297 | <td>--subrepos</td> |
|
2273 | 2298 | <td>recurse into subrepositories</td></tr> |
|
2274 | 2299 | <tr><td>-n</td> |
|
2275 | 2300 | <td>--dry-run</td> |
|
2276 | 2301 | <td>do not perform actions, just print output</td></tr> |
|
2277 | 2302 | </table> |
|
2278 | 2303 | <p> |
|
2279 | 2304 | global options ([+] can be repeated): |
|
2280 | 2305 | </p> |
|
2281 | 2306 | <table> |
|
2282 | 2307 | <tr><td>-R</td> |
|
2283 | 2308 | <td>--repository REPO</td> |
|
2284 | 2309 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
2285 | 2310 | <tr><td></td> |
|
2286 | 2311 | <td>--cwd DIR</td> |
|
2287 | 2312 | <td>change working directory</td></tr> |
|
2288 | 2313 | <tr><td>-y</td> |
|
2289 | 2314 | <td>--noninteractive</td> |
|
2290 | 2315 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
2291 | 2316 | <tr><td>-q</td> |
|
2292 | 2317 | <td>--quiet</td> |
|
2293 | 2318 | <td>suppress output</td></tr> |
|
2294 | 2319 | <tr><td>-v</td> |
|
2295 | 2320 | <td>--verbose</td> |
|
2296 | 2321 | <td>enable additional output</td></tr> |
|
2297 | 2322 | <tr><td></td> |
|
2298 | 2323 | <td>--config CONFIG [+]</td> |
|
2299 | 2324 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
2300 | 2325 | <tr><td></td> |
|
2301 | 2326 | <td>--debug</td> |
|
2302 | 2327 | <td>enable debugging output</td></tr> |
|
2303 | 2328 | <tr><td></td> |
|
2304 | 2329 | <td>--debugger</td> |
|
2305 | 2330 | <td>start debugger</td></tr> |
|
2306 | 2331 | <tr><td></td> |
|
2307 | 2332 | <td>--encoding ENCODE</td> |
|
2308 | 2333 | <td>set the charset encoding (default: ascii)</td></tr> |
|
2309 | 2334 | <tr><td></td> |
|
2310 | 2335 | <td>--encodingmode MODE</td> |
|
2311 | 2336 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
2312 | 2337 | <tr><td></td> |
|
2313 | 2338 | <td>--traceback</td> |
|
2314 | 2339 | <td>always print a traceback on exception</td></tr> |
|
2315 | 2340 | <tr><td></td> |
|
2316 | 2341 | <td>--time</td> |
|
2317 | 2342 | <td>time how long the command takes</td></tr> |
|
2318 | 2343 | <tr><td></td> |
|
2319 | 2344 | <td>--profile</td> |
|
2320 | 2345 | <td>print command execution profile</td></tr> |
|
2321 | 2346 | <tr><td></td> |
|
2322 | 2347 | <td>--version</td> |
|
2323 | 2348 | <td>output version information and exit</td></tr> |
|
2324 | 2349 | <tr><td>-h</td> |
|
2325 | 2350 | <td>--help</td> |
|
2326 | 2351 | <td>display help and exit</td></tr> |
|
2327 | 2352 | <tr><td></td> |
|
2328 | 2353 | <td>--hidden</td> |
|
2329 | 2354 | <td>consider hidden changesets</td></tr> |
|
2330 | 2355 | </table> |
|
2331 | 2356 | |
|
2332 | 2357 | </div> |
|
2333 | 2358 | </div> |
|
2334 | 2359 | </div> |
|
2335 | 2360 | |
|
2336 | 2361 | <script type="text/javascript">process_dates()</script> |
|
2337 | 2362 | |
|
2338 | 2363 | |
|
2339 | 2364 | </body> |
|
2340 | 2365 | </html> |
|
2341 | 2366 | |
|
2342 | 2367 | |
|
2343 | 2368 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove" |
|
2344 | 2369 | 200 Script output follows |
|
2345 | 2370 | |
|
2346 | 2371 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2347 | 2372 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2348 | 2373 | <head> |
|
2349 | 2374 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2350 | 2375 | <meta name="robots" content="index, nofollow" /> |
|
2351 | 2376 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2352 | 2377 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2353 | 2378 | |
|
2354 | 2379 | <title>Help: remove</title> |
|
2355 | 2380 | </head> |
|
2356 | 2381 | <body> |
|
2357 | 2382 | |
|
2358 | 2383 | <div class="container"> |
|
2359 | 2384 | <div class="menu"> |
|
2360 | 2385 | <div class="logo"> |
|
2361 | 2386 | <a href="https://mercurial-scm.org/"> |
|
2362 | 2387 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2363 | 2388 | </div> |
|
2364 | 2389 | <ul> |
|
2365 | 2390 | <li><a href="/shortlog">log</a></li> |
|
2366 | 2391 | <li><a href="/graph">graph</a></li> |
|
2367 | 2392 | <li><a href="/tags">tags</a></li> |
|
2368 | 2393 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2369 | 2394 | <li><a href="/branches">branches</a></li> |
|
2370 | 2395 | </ul> |
|
2371 | 2396 | <ul> |
|
2372 | 2397 | <li class="active"><a href="/help">help</a></li> |
|
2373 | 2398 | </ul> |
|
2374 | 2399 | </div> |
|
2375 | 2400 | |
|
2376 | 2401 | <div class="main"> |
|
2377 | 2402 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2378 | 2403 | <h3>Help: remove</h3> |
|
2379 | 2404 | |
|
2380 | 2405 | <form class="search" action="/log"> |
|
2381 | 2406 | |
|
2382 | 2407 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2383 | 2408 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2384 | 2409 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2385 | 2410 | </form> |
|
2386 | 2411 | <div id="doc"> |
|
2387 | 2412 | <p> |
|
2388 | 2413 | hg remove [OPTION]... FILE... |
|
2389 | 2414 | </p> |
|
2390 | 2415 | <p> |
|
2391 | 2416 | aliases: rm |
|
2392 | 2417 | </p> |
|
2393 | 2418 | <p> |
|
2394 | 2419 | remove the specified files on the next commit |
|
2395 | 2420 | </p> |
|
2396 | 2421 | <p> |
|
2397 | 2422 | Schedule the indicated files for removal from the current branch. |
|
2398 | 2423 | </p> |
|
2399 | 2424 | <p> |
|
2400 | 2425 | This command schedules the files to be removed at the next commit. |
|
2401 | 2426 | To undo a remove before that, see "hg revert". To undo added |
|
2402 | 2427 | files, see "hg forget". |
|
2403 | 2428 | </p> |
|
2404 | 2429 | <p> |
|
2405 | 2430 | -A/--after can be used to remove only files that have already |
|
2406 | 2431 | been deleted, -f/--force can be used to force deletion, and -Af |
|
2407 | 2432 | can be used to remove files from the next revision without |
|
2408 | 2433 | deleting them from the working directory. |
|
2409 | 2434 | </p> |
|
2410 | 2435 | <p> |
|
2411 | 2436 | The following table details the behavior of remove for different |
|
2412 | 2437 | file states (columns) and option combinations (rows). The file |
|
2413 | 2438 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
2414 | 2439 | (as reported by "hg status"). The actions are Warn, Remove |
|
2415 | 2440 | (from branch) and Delete (from disk): |
|
2416 | 2441 | </p> |
|
2417 | 2442 | <table> |
|
2418 | 2443 | <tr><td>opt/state</td> |
|
2419 | 2444 | <td>A</td> |
|
2420 | 2445 | <td>C</td> |
|
2421 | 2446 | <td>M</td> |
|
2422 | 2447 | <td>!</td></tr> |
|
2423 | 2448 | <tr><td>none</td> |
|
2424 | 2449 | <td>W</td> |
|
2425 | 2450 | <td>RD</td> |
|
2426 | 2451 | <td>W</td> |
|
2427 | 2452 | <td>R</td></tr> |
|
2428 | 2453 | <tr><td>-f</td> |
|
2429 | 2454 | <td>R</td> |
|
2430 | 2455 | <td>RD</td> |
|
2431 | 2456 | <td>RD</td> |
|
2432 | 2457 | <td>R</td></tr> |
|
2433 | 2458 | <tr><td>-A</td> |
|
2434 | 2459 | <td>W</td> |
|
2435 | 2460 | <td>W</td> |
|
2436 | 2461 | <td>W</td> |
|
2437 | 2462 | <td>R</td></tr> |
|
2438 | 2463 | <tr><td>-Af</td> |
|
2439 | 2464 | <td>R</td> |
|
2440 | 2465 | <td>R</td> |
|
2441 | 2466 | <td>R</td> |
|
2442 | 2467 | <td>R</td></tr> |
|
2443 | 2468 | </table> |
|
2444 | 2469 | <p> |
|
2445 | 2470 | <b>Note:</b> |
|
2446 | 2471 | </p> |
|
2447 | 2472 | <p> |
|
2448 | 2473 | "hg remove" never deletes files in Added [A] state from the |
|
2449 | 2474 | working directory, not even if "--force" is specified. |
|
2450 | 2475 | </p> |
|
2451 | 2476 | <p> |
|
2452 | 2477 | Returns 0 on success, 1 if any warnings encountered. |
|
2453 | 2478 | </p> |
|
2454 | 2479 | <p> |
|
2455 | 2480 | options ([+] can be repeated): |
|
2456 | 2481 | </p> |
|
2457 | 2482 | <table> |
|
2458 | 2483 | <tr><td>-A</td> |
|
2459 | 2484 | <td>--after</td> |
|
2460 | 2485 | <td>record delete for missing files</td></tr> |
|
2461 | 2486 | <tr><td>-f</td> |
|
2462 | 2487 | <td>--force</td> |
|
2463 | 2488 | <td>remove (and delete) file even if added or modified</td></tr> |
|
2464 | 2489 | <tr><td>-S</td> |
|
2465 | 2490 | <td>--subrepos</td> |
|
2466 | 2491 | <td>recurse into subrepositories</td></tr> |
|
2467 | 2492 | <tr><td>-I</td> |
|
2468 | 2493 | <td>--include PATTERN [+]</td> |
|
2469 | 2494 | <td>include names matching the given patterns</td></tr> |
|
2470 | 2495 | <tr><td>-X</td> |
|
2471 | 2496 | <td>--exclude PATTERN [+]</td> |
|
2472 | 2497 | <td>exclude names matching the given patterns</td></tr> |
|
2473 | 2498 | </table> |
|
2474 | 2499 | <p> |
|
2475 | 2500 | global options ([+] can be repeated): |
|
2476 | 2501 | </p> |
|
2477 | 2502 | <table> |
|
2478 | 2503 | <tr><td>-R</td> |
|
2479 | 2504 | <td>--repository REPO</td> |
|
2480 | 2505 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
2481 | 2506 | <tr><td></td> |
|
2482 | 2507 | <td>--cwd DIR</td> |
|
2483 | 2508 | <td>change working directory</td></tr> |
|
2484 | 2509 | <tr><td>-y</td> |
|
2485 | 2510 | <td>--noninteractive</td> |
|
2486 | 2511 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
2487 | 2512 | <tr><td>-q</td> |
|
2488 | 2513 | <td>--quiet</td> |
|
2489 | 2514 | <td>suppress output</td></tr> |
|
2490 | 2515 | <tr><td>-v</td> |
|
2491 | 2516 | <td>--verbose</td> |
|
2492 | 2517 | <td>enable additional output</td></tr> |
|
2493 | 2518 | <tr><td></td> |
|
2494 | 2519 | <td>--config CONFIG [+]</td> |
|
2495 | 2520 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
2496 | 2521 | <tr><td></td> |
|
2497 | 2522 | <td>--debug</td> |
|
2498 | 2523 | <td>enable debugging output</td></tr> |
|
2499 | 2524 | <tr><td></td> |
|
2500 | 2525 | <td>--debugger</td> |
|
2501 | 2526 | <td>start debugger</td></tr> |
|
2502 | 2527 | <tr><td></td> |
|
2503 | 2528 | <td>--encoding ENCODE</td> |
|
2504 | 2529 | <td>set the charset encoding (default: ascii)</td></tr> |
|
2505 | 2530 | <tr><td></td> |
|
2506 | 2531 | <td>--encodingmode MODE</td> |
|
2507 | 2532 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
2508 | 2533 | <tr><td></td> |
|
2509 | 2534 | <td>--traceback</td> |
|
2510 | 2535 | <td>always print a traceback on exception</td></tr> |
|
2511 | 2536 | <tr><td></td> |
|
2512 | 2537 | <td>--time</td> |
|
2513 | 2538 | <td>time how long the command takes</td></tr> |
|
2514 | 2539 | <tr><td></td> |
|
2515 | 2540 | <td>--profile</td> |
|
2516 | 2541 | <td>print command execution profile</td></tr> |
|
2517 | 2542 | <tr><td></td> |
|
2518 | 2543 | <td>--version</td> |
|
2519 | 2544 | <td>output version information and exit</td></tr> |
|
2520 | 2545 | <tr><td>-h</td> |
|
2521 | 2546 | <td>--help</td> |
|
2522 | 2547 | <td>display help and exit</td></tr> |
|
2523 | 2548 | <tr><td></td> |
|
2524 | 2549 | <td>--hidden</td> |
|
2525 | 2550 | <td>consider hidden changesets</td></tr> |
|
2526 | 2551 | </table> |
|
2527 | 2552 | |
|
2528 | 2553 | </div> |
|
2529 | 2554 | </div> |
|
2530 | 2555 | </div> |
|
2531 | 2556 | |
|
2532 | 2557 | <script type="text/javascript">process_dates()</script> |
|
2533 | 2558 | |
|
2534 | 2559 | |
|
2535 | 2560 | </body> |
|
2536 | 2561 | </html> |
|
2537 | 2562 | |
|
2538 | 2563 | |
|
2539 | 2564 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions" |
|
2540 | 2565 | 200 Script output follows |
|
2541 | 2566 | |
|
2542 | 2567 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2543 | 2568 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2544 | 2569 | <head> |
|
2545 | 2570 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2546 | 2571 | <meta name="robots" content="index, nofollow" /> |
|
2547 | 2572 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2548 | 2573 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2549 | 2574 | |
|
2550 | 2575 | <title>Help: revisions</title> |
|
2551 | 2576 | </head> |
|
2552 | 2577 | <body> |
|
2553 | 2578 | |
|
2554 | 2579 | <div class="container"> |
|
2555 | 2580 | <div class="menu"> |
|
2556 | 2581 | <div class="logo"> |
|
2557 | 2582 | <a href="https://mercurial-scm.org/"> |
|
2558 | 2583 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2559 | 2584 | </div> |
|
2560 | 2585 | <ul> |
|
2561 | 2586 | <li><a href="/shortlog">log</a></li> |
|
2562 | 2587 | <li><a href="/graph">graph</a></li> |
|
2563 | 2588 | <li><a href="/tags">tags</a></li> |
|
2564 | 2589 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2565 | 2590 | <li><a href="/branches">branches</a></li> |
|
2566 | 2591 | </ul> |
|
2567 | 2592 | <ul> |
|
2568 | 2593 | <li class="active"><a href="/help">help</a></li> |
|
2569 | 2594 | </ul> |
|
2570 | 2595 | </div> |
|
2571 | 2596 | |
|
2572 | 2597 | <div class="main"> |
|
2573 | 2598 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2574 | 2599 | <h3>Help: revisions</h3> |
|
2575 | 2600 | |
|
2576 | 2601 | <form class="search" action="/log"> |
|
2577 | 2602 | |
|
2578 | 2603 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2579 | 2604 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2580 | 2605 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2581 | 2606 | </form> |
|
2582 | 2607 | <div id="doc"> |
|
2583 | 2608 | <h1>Specifying Single Revisions</h1> |
|
2584 | 2609 | <p> |
|
2585 | 2610 | Mercurial supports several ways to specify individual revisions. |
|
2586 | 2611 | </p> |
|
2587 | 2612 | <p> |
|
2588 | 2613 | A plain integer is treated as a revision number. Negative integers are |
|
2589 | 2614 | treated as sequential offsets from the tip, with -1 denoting the tip, |
|
2590 | 2615 | -2 denoting the revision prior to the tip, and so forth. |
|
2591 | 2616 | </p> |
|
2592 | 2617 | <p> |
|
2593 | 2618 | A 40-digit hexadecimal string is treated as a unique revision |
|
2594 | 2619 | identifier. |
|
2595 | 2620 | </p> |
|
2596 | 2621 | <p> |
|
2597 | 2622 | A hexadecimal string less than 40 characters long is treated as a |
|
2598 | 2623 | unique revision identifier and is referred to as a short-form |
|
2599 | 2624 | identifier. A short-form identifier is only valid if it is the prefix |
|
2600 | 2625 | of exactly one full-length identifier. |
|
2601 | 2626 | </p> |
|
2602 | 2627 | <p> |
|
2603 | 2628 | Any other string is treated as a bookmark, tag, or branch name. A |
|
2604 | 2629 | bookmark is a movable pointer to a revision. A tag is a permanent name |
|
2605 | 2630 | associated with a revision. A branch name denotes the tipmost open branch head |
|
2606 | 2631 | of that branch - or if they are all closed, the tipmost closed head of the |
|
2607 | 2632 | branch. Bookmark, tag, and branch names must not contain the ":" character. |
|
2608 | 2633 | </p> |
|
2609 | 2634 | <p> |
|
2610 | 2635 | The reserved name "tip" always identifies the most recent revision. |
|
2611 | 2636 | </p> |
|
2612 | 2637 | <p> |
|
2613 | 2638 | The reserved name "null" indicates the null revision. This is the |
|
2614 | 2639 | revision of an empty repository, and the parent of revision 0. |
|
2615 | 2640 | </p> |
|
2616 | 2641 | <p> |
|
2617 | 2642 | The reserved name "." indicates the working directory parent. If no |
|
2618 | 2643 | working directory is checked out, it is equivalent to null. If an |
|
2619 | 2644 | uncommitted merge is in progress, "." is the revision of the first |
|
2620 | 2645 | parent. |
|
2621 | 2646 | </p> |
|
2622 | 2647 | |
|
2623 | 2648 | </div> |
|
2624 | 2649 | </div> |
|
2625 | 2650 | </div> |
|
2626 | 2651 | |
|
2627 | 2652 | <script type="text/javascript">process_dates()</script> |
|
2628 | 2653 | |
|
2629 | 2654 | |
|
2630 | 2655 | </body> |
|
2631 | 2656 | </html> |
|
2632 | 2657 | |
|
2633 | 2658 | |
|
2634 | 2659 | Sub-topic indexes rendered properly |
|
2635 | 2660 | |
|
2636 | 2661 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals" |
|
2637 | 2662 | 200 Script output follows |
|
2638 | 2663 | |
|
2639 | 2664 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2640 | 2665 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2641 | 2666 | <head> |
|
2642 | 2667 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2643 | 2668 | <meta name="robots" content="index, nofollow" /> |
|
2644 | 2669 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2645 | 2670 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2646 | 2671 | |
|
2647 | 2672 | <title>Help: internals</title> |
|
2648 | 2673 | </head> |
|
2649 | 2674 | <body> |
|
2650 | 2675 | |
|
2651 | 2676 | <div class="container"> |
|
2652 | 2677 | <div class="menu"> |
|
2653 | 2678 | <div class="logo"> |
|
2654 | 2679 | <a href="https://mercurial-scm.org/"> |
|
2655 | 2680 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2656 | 2681 | </div> |
|
2657 | 2682 | <ul> |
|
2658 | 2683 | <li><a href="/shortlog">log</a></li> |
|
2659 | 2684 | <li><a href="/graph">graph</a></li> |
|
2660 | 2685 | <li><a href="/tags">tags</a></li> |
|
2661 | 2686 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2662 | 2687 | <li><a href="/branches">branches</a></li> |
|
2663 | 2688 | </ul> |
|
2664 | 2689 | <ul> |
|
2665 | 2690 | <li><a href="/help">help</a></li> |
|
2666 | 2691 | </ul> |
|
2667 | 2692 | </div> |
|
2668 | 2693 | |
|
2669 | 2694 | <div class="main"> |
|
2670 | 2695 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2671 | 2696 | <form class="search" action="/log"> |
|
2672 | 2697 | |
|
2673 | 2698 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2674 | 2699 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2675 | 2700 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2676 | 2701 | </form> |
|
2677 | 2702 | <table class="bigtable"> |
|
2678 | 2703 | <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr> |
|
2679 | 2704 | |
|
2680 | 2705 | <tr><td> |
|
2681 | 2706 | <a href="/help/internals.bundles"> |
|
2682 | 2707 | bundles |
|
2683 | 2708 | </a> |
|
2684 | 2709 | </td><td> |
|
2685 | 2710 | container for exchange of repository data |
|
2686 | 2711 | </td></tr> |
|
2687 | 2712 | <tr><td> |
|
2688 | 2713 | <a href="/help/internals.changegroups"> |
|
2689 | 2714 | changegroups |
|
2690 | 2715 | </a> |
|
2691 | 2716 | </td><td> |
|
2692 | 2717 | representation of revlog data |
|
2693 | 2718 | </td></tr> |
|
2694 | 2719 | |
|
2695 | 2720 | |
|
2696 | 2721 | |
|
2697 | 2722 | |
|
2698 | 2723 | |
|
2699 | 2724 | </table> |
|
2700 | 2725 | </div> |
|
2701 | 2726 | </div> |
|
2702 | 2727 | |
|
2703 | 2728 | <script type="text/javascript">process_dates()</script> |
|
2704 | 2729 | |
|
2705 | 2730 | |
|
2706 | 2731 | </body> |
|
2707 | 2732 | </html> |
|
2708 | 2733 | |
|
2709 | 2734 | |
|
2710 | 2735 | Sub-topic topics rendered properly |
|
2711 | 2736 | |
|
2712 | 2737 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups" |
|
2713 | 2738 | 200 Script output follows |
|
2714 | 2739 | |
|
2715 | 2740 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2716 | 2741 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2717 | 2742 | <head> |
|
2718 | 2743 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2719 | 2744 | <meta name="robots" content="index, nofollow" /> |
|
2720 | 2745 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2721 | 2746 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2722 | 2747 | |
|
2723 | 2748 | <title>Help: internals.changegroups</title> |
|
2724 | 2749 | </head> |
|
2725 | 2750 | <body> |
|
2726 | 2751 | |
|
2727 | 2752 | <div class="container"> |
|
2728 | 2753 | <div class="menu"> |
|
2729 | 2754 | <div class="logo"> |
|
2730 | 2755 | <a href="https://mercurial-scm.org/"> |
|
2731 | 2756 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2732 | 2757 | </div> |
|
2733 | 2758 | <ul> |
|
2734 | 2759 | <li><a href="/shortlog">log</a></li> |
|
2735 | 2760 | <li><a href="/graph">graph</a></li> |
|
2736 | 2761 | <li><a href="/tags">tags</a></li> |
|
2737 | 2762 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2738 | 2763 | <li><a href="/branches">branches</a></li> |
|
2739 | 2764 | </ul> |
|
2740 | 2765 | <ul> |
|
2741 | 2766 | <li class="active"><a href="/help">help</a></li> |
|
2742 | 2767 | </ul> |
|
2743 | 2768 | </div> |
|
2744 | 2769 | |
|
2745 | 2770 | <div class="main"> |
|
2746 | 2771 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2747 | 2772 | <h3>Help: internals.changegroups</h3> |
|
2748 | 2773 | |
|
2749 | 2774 | <form class="search" action="/log"> |
|
2750 | 2775 | |
|
2751 | 2776 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2752 | 2777 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2753 | 2778 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2754 | 2779 | </form> |
|
2755 | 2780 | <div id="doc"> |
|
2756 | 2781 | <h1>representation of revlog data</h1> |
|
2757 | 2782 | <h2>Changegroups</h2> |
|
2758 | 2783 | <p> |
|
2759 | 2784 | Changegroups are representations of repository revlog data, specifically |
|
2760 | 2785 | the changelog, manifest, and filelogs. |
|
2761 | 2786 | </p> |
|
2762 | 2787 | <p> |
|
2763 | 2788 | There are 3 versions of changegroups: "1", "2", and "3". From a |
|
2764 | 2789 | high-level, versions "1" and "2" are almost exactly the same, with |
|
2765 | 2790 | the only difference being a header on entries in the changeset |
|
2766 | 2791 | segment. Version "3" adds support for exchanging treemanifests and |
|
2767 | 2792 | includes revlog flags in the delta header. |
|
2768 | 2793 | </p> |
|
2769 | 2794 | <p> |
|
2770 | 2795 | Changegroups consists of 3 logical segments: |
|
2771 | 2796 | </p> |
|
2772 | 2797 | <pre> |
|
2773 | 2798 | +---------------------------------+ |
|
2774 | 2799 | | | | | |
|
2775 | 2800 | | changeset | manifest | filelogs | |
|
2776 | 2801 | | | | | |
|
2777 | 2802 | +---------------------------------+ |
|
2778 | 2803 | </pre> |
|
2779 | 2804 | <p> |
|
2780 | 2805 | The principle building block of each segment is a *chunk*. A *chunk* |
|
2781 | 2806 | is a framed piece of data: |
|
2782 | 2807 | </p> |
|
2783 | 2808 | <pre> |
|
2784 | 2809 | +---------------------------------------+ |
|
2785 | 2810 | | | | |
|
2786 | 2811 | | length | data | |
|
2787 | 2812 | | (32 bits) | <length> bytes | |
|
2788 | 2813 | | | | |
|
2789 | 2814 | +---------------------------------------+ |
|
2790 | 2815 | </pre> |
|
2791 | 2816 | <p> |
|
2792 | 2817 | Each chunk starts with a 32-bit big-endian signed integer indicating |
|
2793 | 2818 | the length of the raw data that follows. |
|
2794 | 2819 | </p> |
|
2795 | 2820 | <p> |
|
2796 | 2821 | There is a special case chunk that has 0 length ("0x00000000"). We |
|
2797 | 2822 | call this an *empty chunk*. |
|
2798 | 2823 | </p> |
|
2799 | 2824 | <h3>Delta Groups</h3> |
|
2800 | 2825 | <p> |
|
2801 | 2826 | A *delta group* expresses the content of a revlog as a series of deltas, |
|
2802 | 2827 | or patches against previous revisions. |
|
2803 | 2828 | </p> |
|
2804 | 2829 | <p> |
|
2805 | 2830 | Delta groups consist of 0 or more *chunks* followed by the *empty chunk* |
|
2806 | 2831 | to signal the end of the delta group: |
|
2807 | 2832 | </p> |
|
2808 | 2833 | <pre> |
|
2809 | 2834 | +------------------------------------------------------------------------+ |
|
2810 | 2835 | | | | | | | |
|
2811 | 2836 | | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 | |
|
2812 | 2837 | | (32 bits) | (various) | (32 bits) | (various) | (32 bits) | |
|
2813 | 2838 | | | | | | | |
|
2814 | 2839 | +------------------------------------------------------------+-----------+ |
|
2815 | 2840 | </pre> |
|
2816 | 2841 | <p> |
|
2817 | 2842 | Each *chunk*'s data consists of the following: |
|
2818 | 2843 |
|
|
2819 | 2844 |
|
|
2820 | 2845 | +-----------------------------------------+ |
|
2821 | 2846 | | | | | |
|
2822 | 2847 | | delta header | mdiff header | delta | |
|
2823 | 2848 | | (various) | (12 bytes) | (various) | |
|
2824 | 2849 | | | | | |
|
2825 | 2850 | +-----------------------------------------+ |
|
2826 | 2851 |
|
|
2827 | 2852 |
|
|
2828 | 2853 | The *length* field is the byte length of the remaining 3 logical pieces |
|
2829 | 2854 | of data. The *delta* is a diff from an existing entry in the changelog. |
|
2830 | 2855 |
|
|
2831 | 2856 |
|
|
2832 | 2857 | The *delta header* is different between versions "1", "2", and |
|
2833 | 2858 |
|
|
2834 | 2859 |
|
|
2835 | 2860 |
|
|
2836 | 2861 | Version 1: |
|
2837 | 2862 |
|
|
2838 | 2863 |
|
|
2839 | 2864 | +------------------------------------------------------+ |
|
2840 | 2865 | | | | | | |
|
2841 | 2866 | | node | p1 node | p2 node | link node | |
|
2842 | 2867 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
2843 | 2868 | | | | | | |
|
2844 | 2869 | +------------------------------------------------------+ |
|
2845 | 2870 |
|
|
2846 | 2871 |
|
|
2847 | 2872 | Version 2: |
|
2848 | 2873 |
|
|
2849 | 2874 |
|
|
2850 | 2875 | +------------------------------------------------------------------+ |
|
2851 | 2876 | | | | | | | |
|
2852 | 2877 | | node | p1 node | p2 node | base node | link node | |
|
2853 | 2878 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
2854 | 2879 | | | | | | | |
|
2855 | 2880 | +------------------------------------------------------------------+ |
|
2856 | 2881 |
|
|
2857 | 2882 |
|
|
2858 | 2883 | Version 3: |
|
2859 | 2884 |
|
|
2860 | 2885 |
|
|
2861 | 2886 | +------------------------------------------------------------------------------+ |
|
2862 | 2887 | | | | | | | | |
|
2863 | 2888 | | node | p1 node | p2 node | base node | link node | flags | |
|
2864 | 2889 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | |
|
2865 | 2890 | | | | | | | | |
|
2866 | 2891 | +------------------------------------------------------------------------------+ |
|
2867 | 2892 |
|
|
2868 | 2893 |
|
|
2869 | 2894 | The *mdiff header* consists of 3 32-bit big-endian signed integers |
|
2870 | 2895 | describing offsets at which to apply the following delta content: |
|
2871 | 2896 |
|
|
2872 | 2897 |
|
|
2873 | 2898 | +-------------------------------------+ |
|
2874 | 2899 | | | | | |
|
2875 | 2900 | | offset | old length | new length | |
|
2876 | 2901 | | (32 bits) | (32 bits) | (32 bits) | |
|
2877 | 2902 | | | | | |
|
2878 | 2903 | +-------------------------------------+ |
|
2879 | 2904 |
|
|
2880 | 2905 |
|
|
2881 | 2906 | In version 1, the delta is always applied against the previous node from |
|
2882 | 2907 | the changegroup or the first parent if this is the first entry in the |
|
2883 | 2908 | changegroup. |
|
2884 | 2909 |
|
|
2885 | 2910 |
|
|
2886 | 2911 | In version 2, the delta base node is encoded in the entry in the |
|
2887 | 2912 | changegroup. This allows the delta to be expressed against any parent, |
|
2888 | 2913 | which can result in smaller deltas and more efficient encoding of data. |
|
2889 | 2914 |
|
|
2890 | 2915 |
|
|
2891 | 2916 |
|
|
2892 | 2917 | The *changeset segment* consists of a single *delta group* holding |
|
2893 | 2918 | changelog data. It is followed by an *empty chunk* to denote the |
|
2894 | 2919 | boundary to the *manifests segment*. |
|
2895 | 2920 |
|
|
2896 | 2921 |
|
|
2897 | 2922 |
|
|
2898 | 2923 | The *manifest segment* consists of a single *delta group* holding |
|
2899 | 2924 | manifest data. It is followed by an *empty chunk* to denote the boundary |
|
2900 | 2925 | to the *filelogs segment*. |
|
2901 | 2926 |
|
|
2902 | 2927 |
|
|
2903 | 2928 |
|
|
2904 | 2929 | The *filelogs* segment consists of multiple sub-segments, each |
|
2905 | 2930 | corresponding to an individual file whose data is being described: |
|
2906 | 2931 |
|
|
2907 | 2932 |
|
|
2908 | 2933 | +--------------------------------------+ |
|
2909 | 2934 | | | | | | |
|
2910 | 2935 | | filelog0 | filelog1 | filelog2 | ... | |
|
2911 | 2936 | | | | | | |
|
2912 | 2937 | +--------------------------------------+ |
|
2913 | 2938 |
|
|
2914 | 2939 |
|
|
2915 | 2940 | In version "3" of the changegroup format, filelogs may include |
|
2916 | 2941 | directory logs when treemanifests are in use. directory logs are |
|
2917 | 2942 | identified by having a trailing '/' on their filename (see below). |
|
2918 | 2943 |
|
|
2919 | 2944 |
|
|
2920 | 2945 | The final filelog sub-segment is followed by an *empty chunk* to denote |
|
2921 | 2946 | the end of the segment and the overall changegroup. |
|
2922 | 2947 |
|
|
2923 | 2948 |
|
|
2924 | 2949 | Each filelog sub-segment consists of the following: |
|
2925 | 2950 |
|
|
2926 | 2951 |
|
|
2927 | 2952 | +------------------------------------------+ |
|
2928 | 2953 | | | | | |
|
2929 | 2954 | | filename size | filename | delta group | |
|
2930 | 2955 | | (32 bits) | (various) | (various) | |
|
2931 | 2956 | | | | | |
|
2932 | 2957 | +------------------------------------------+ |
|
2933 | 2958 |
|
|
2934 | 2959 |
|
|
2935 | 2960 | That is, a *chunk* consisting of the filename (not terminated or padded) |
|
2936 | 2961 | followed by N chunks constituting the *delta group* for this file. |
|
2937 | 2962 |
|
|
2938 | 2963 |
|
|
2939 | 2964 |
|
|
2940 | 2965 |
|
|
2941 | 2966 |
|
|
2942 | 2967 |
|
|
2943 | 2968 |
|
|
2944 | 2969 |
|
|
2945 | 2970 |
|
|
2946 | 2971 |
|
|
2947 | 2972 |
|
|
2948 | 2973 |
|
|
2949 | 2974 | |
|
2950 | 2975 | $ killdaemons.py |
|
2951 | 2976 | |
|
2952 | 2977 |
|
General Comments 0
You need to be logged in to leave comments.
Login now