##// END OF EJS Templates
help: add topic rewriting hooks...
Patrick Mezard -
r12820:0edc0aa7 stable
parent child Browse files
Show More
@@ -1,104 +1,116 b''
1 1 # help.py - help data for mercurial
2 2 #
3 3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from i18n import gettext, _
9 9 import sys, os
10 10 import extensions
11 11
12 12
13 13 def moduledoc(file):
14 14 '''return the top-level python documentation for the given file
15 15
16 16 Loosely inspired by pydoc.source_synopsis(), but rewritten to
17 17 handle triple quotes and to return the whole text instead of just
18 18 the synopsis'''
19 19 result = []
20 20
21 21 line = file.readline()
22 22 while line[:1] == '#' or not line.strip():
23 23 line = file.readline()
24 24 if not line:
25 25 break
26 26
27 27 start = line[:3]
28 28 if start == '"""' or start == "'''":
29 29 line = line[3:]
30 30 while line:
31 31 if line.rstrip().endswith(start):
32 32 line = line.split(start)[0]
33 33 if line:
34 34 result.append(line)
35 35 break
36 36 elif not line:
37 37 return None # unmatched delimiter
38 38 result.append(line)
39 39 line = file.readline()
40 40 else:
41 41 return None
42 42
43 43 return ''.join(result)
44 44
45 45 def listexts(header, exts, maxlength, indent=1):
46 46 '''return a text listing of the given extensions'''
47 47 if not exts:
48 48 return ''
49 49 result = '\n%s\n\n' % header
50 50 for name, desc in sorted(exts.iteritems()):
51 51 result += '%s%-*s %s\n' % (' ' * indent, maxlength + 2,
52 52 ':%s:' % name, desc)
53 53 return result
54 54
55 55 def extshelp():
56 56 doc = loaddoc('extensions')()
57 57
58 58 exts, maxlength = extensions.enabled()
59 59 doc += listexts(_('enabled extensions:'), exts, maxlength)
60 60
61 61 exts, maxlength = extensions.disabled()
62 62 doc += listexts(_('disabled extensions:'), exts, maxlength)
63 63
64 64 return doc
65 65
66 66 def loaddoc(topic):
67 67 """Return a delayed loader for help/topic.txt."""
68 68
69 69 def loader():
70 70 if hasattr(sys, 'frozen'):
71 71 module = sys.executable
72 72 else:
73 73 module = __file__
74 74 base = os.path.dirname(module)
75 75
76 76 for dir in ('.', '..'):
77 77 docdir = os.path.join(base, dir, 'help')
78 78 if os.path.isdir(docdir):
79 79 break
80 80
81 81 path = os.path.join(docdir, topic + ".txt")
82 return gettext(open(path).read())
82 doc = gettext(open(path).read())
83 for rewriter in helphooks.get(topic, []):
84 doc = rewriter(topic, doc)
85 return doc
86
83 87 return loader
84 88
85 89 helptable = [
86 90 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
87 91 (["dates"], _("Date Formats"), loaddoc('dates')),
88 92 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
89 93 (['environment', 'env'], _('Environment Variables'),
90 94 loaddoc('environment')),
91 95 (['revs', 'revisions'], _('Specifying Single Revisions'),
92 96 loaddoc('revisions')),
93 97 (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'),
94 98 loaddoc('multirevs')),
95 99 (['revset', 'revsets'], _("Specifying Revision Sets"), loaddoc('revsets')),
96 100 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
97 101 (['merge-tools'], _('Merge Tools'), loaddoc('merge-tools')),
98 102 (['templating', 'templates'], _('Template Usage'),
99 103 loaddoc('templates')),
100 104 (['urls'], _('URL Paths'), loaddoc('urls')),
101 105 (["extensions"], _("Using additional features"), extshelp),
102 106 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
103 107 (["glossary"], _("Glossary"), loaddoc('glossary')),
104 108 ]
109
110 # Map topics to lists of callable taking the current topic help and
111 # returning the updated version
112 helphooks = {
113 }
114
115 def addtopichook(topic, rewriter):
116 helphooks.setdefault(topic, []).append(rewriter)
@@ -1,758 +1,785 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 working directory with another revision
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 working directory with another revision
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 branch set or show the current branch name
59 59 branches list repository named branches
60 60 bundle create a changegroup file
61 61 cat output the current or given revision of files
62 62 clone make a copy of an existing repository
63 63 commit commit the specified files or all outstanding changes
64 64 copy mark files as copied for the next commit
65 65 diff diff repository (or selected files)
66 66 export dump the header and diffs for one or more changesets
67 67 forget forget the specified files on the next commit
68 68 grep search for a pattern in specified files and revisions
69 69 heads show current repository heads or show branch heads
70 70 help show help for a given topic or a help overview
71 71 identify identify the working copy or specified revision
72 72 import import an ordered set of patches
73 73 incoming show new changesets found in source
74 74 init create a new repository in the given directory
75 75 locate locate files matching specific patterns
76 76 log show revision history of entire repository or files
77 77 manifest output the current or given revision of the project manifest
78 78 merge merge working directory with another revision
79 79 outgoing show changesets not found in the destination
80 80 parents show the parents of the working directory or revision
81 81 paths show aliases for remote repositories
82 82 pull pull changes from the specified source
83 83 push push changes to the specified destination
84 84 recover roll back an interrupted transaction
85 85 remove remove the specified files on the next commit
86 86 rename rename files; equivalent of copy + remove
87 87 resolve redo merges or set/view the merge status of files
88 88 revert restore individual files or directories to an earlier state
89 89 rollback roll back the last transaction (dangerous)
90 90 root print the root (top) of the current working directory
91 91 serve start stand-alone webserver
92 92 showconfig show combined config settings from all hgrc files
93 93 status show changed files in the working directory
94 94 summary summarize working directory state
95 95 tag add one or more tags for the current or given revision
96 96 tags list repository tags
97 97 tip show the tip revision
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 patterns File Name Patterns
108 108 environment Environment Variables
109 109 revisions Specifying Single Revisions
110 110 multirevs Specifying Multiple Revisions
111 111 revsets Specifying Revision Sets
112 112 diffs Diff Formats
113 113 merge-tools Merge Tools
114 114 templating Template Usage
115 115 urls URL Paths
116 116 extensions Using additional features
117 117 hgweb Configuring hgweb
118 118 glossary Glossary
119 119
120 120 use "hg -v help" to show aliases and global options
121 121
122 122 $ hg -q help
123 123 add add the specified files on the next commit
124 124 addremove add all new files, delete all missing files
125 125 annotate show changeset information by line for each file
126 126 archive create an unversioned archive of a repository revision
127 127 backout reverse effect of earlier changeset
128 128 bisect subdivision search of changesets
129 129 branch set or show the current branch name
130 130 branches list repository named branches
131 131 bundle create a changegroup file
132 132 cat output the current or given revision of files
133 133 clone make a copy of an existing repository
134 134 commit commit the specified files or all outstanding changes
135 135 copy mark files as copied for the next commit
136 136 diff diff repository (or selected files)
137 137 export dump the header and diffs for one or more changesets
138 138 forget forget the specified files on the next commit
139 139 grep search for a pattern in specified files and revisions
140 140 heads show current repository heads or show branch heads
141 141 help show help for a given topic or a help overview
142 142 identify identify the working copy or specified revision
143 143 import import an ordered set of patches
144 144 incoming show new changesets found in source
145 145 init create a new repository in the given directory
146 146 locate locate files matching specific patterns
147 147 log show revision history of entire repository or files
148 148 manifest output the current or given revision of the project manifest
149 149 merge merge working directory with another revision
150 150 outgoing show changesets not found in the destination
151 151 parents show the parents of the working directory or revision
152 152 paths show aliases for remote repositories
153 153 pull pull changes from the specified source
154 154 push push changes to the specified destination
155 155 recover roll back an interrupted transaction
156 156 remove remove the specified files on the next commit
157 157 rename rename files; equivalent of copy + remove
158 158 resolve redo merges or set/view the merge status of files
159 159 revert restore individual files or directories to an earlier state
160 160 rollback roll back the last transaction (dangerous)
161 161 root print the root (top) of the current working directory
162 162 serve start stand-alone webserver
163 163 showconfig show combined config settings from all hgrc files
164 164 status show changed files in the working directory
165 165 summary summarize working directory state
166 166 tag add one or more tags for the current or given revision
167 167 tags list repository tags
168 168 tip show the tip revision
169 169 unbundle apply one or more changegroup files
170 170 update update working directory (or switch revisions)
171 171 verify verify the integrity of the repository
172 172 version output version and copyright information
173 173
174 174 additional help topics:
175 175
176 176 config Configuration Files
177 177 dates Date Formats
178 178 patterns File Name Patterns
179 179 environment Environment Variables
180 180 revisions Specifying Single Revisions
181 181 multirevs Specifying Multiple Revisions
182 182 revsets Specifying Revision Sets
183 183 diffs Diff Formats
184 184 merge-tools Merge Tools
185 185 templating Template Usage
186 186 urls URL Paths
187 187 extensions Using additional features
188 188 hgweb Configuring hgweb
189 189 glossary Glossary
190 190
191 191 Test short command list with verbose option
192 192
193 193 $ hg -v help shortlist
194 194 Mercurial Distributed SCM (version *) (glob)
195 195
196 196 Copyright (C) 2005-2010 Matt Mackall <mpm@selenic.com> and others
197 197 This is free software; see the source for copying conditions. There is NO
198 198 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
199 199
200 200 basic commands:
201 201
202 202 add:
203 203 add the specified files on the next commit
204 204 annotate, blame:
205 205 show changeset information by line for each file
206 206 clone:
207 207 make a copy of an existing repository
208 208 commit, ci:
209 209 commit the specified files or all outstanding changes
210 210 diff:
211 211 diff repository (or selected files)
212 212 export:
213 213 dump the header and diffs for one or more changesets
214 214 forget:
215 215 forget the specified files on the next commit
216 216 init:
217 217 create a new repository in the given directory
218 218 log, history:
219 219 show revision history of entire repository or files
220 220 merge:
221 221 merge working directory with another revision
222 222 pull:
223 223 pull changes from the specified source
224 224 push:
225 225 push changes to the specified destination
226 226 remove, rm:
227 227 remove the specified files on the next commit
228 228 serve:
229 229 start stand-alone webserver
230 230 status, st:
231 231 show changed files in the working directory
232 232 summary, sum:
233 233 summarize working directory state
234 234 update, up, checkout, co:
235 235 update working directory (or switch revisions)
236 236
237 237 global options:
238 238 -R --repository REPO repository root directory or name of overlay bundle
239 239 file
240 240 --cwd DIR change working directory
241 241 -y --noninteractive do not prompt, assume 'yes' for any required answers
242 242 -q --quiet suppress output
243 243 -v --verbose enable additional output
244 244 --config CONFIG [+] set/override config option (use 'section.name=value')
245 245 --debug enable debugging output
246 246 --debugger start debugger
247 247 --encoding ENCODE set the charset encoding (default: ascii)
248 248 --encodingmode MODE set the charset encoding mode (default: strict)
249 249 --traceback always print a traceback on exception
250 250 --time time how long the command takes
251 251 --profile print command execution profile
252 252 --version output version information and exit
253 253 -h --help display help and exit
254 254
255 255 [+] marked option can be specified multiple times
256 256
257 257 use "hg help" for the full list of commands
258 258
259 259 $ hg add -h
260 260 hg add [OPTION]... [FILE]...
261 261
262 262 add the specified files on the next commit
263 263
264 264 Schedule files to be version controlled and added to the repository.
265 265
266 266 The files will be added to the repository at the next commit. To undo an
267 267 add before that, see "hg forget".
268 268
269 269 If no names are given, add all files to the repository.
270 270
271 271 Returns 0 if all files are successfully added.
272 272
273 273 use "hg -v help add" to show verbose help
274 274
275 275 options:
276 276
277 277 -I --include PATTERN [+] include names matching the given patterns
278 278 -X --exclude PATTERN [+] exclude names matching the given patterns
279 279 -S --subrepos recurse into subrepositories
280 280 -n --dry-run do not perform actions, just print output
281 281
282 282 [+] marked option can be specified multiple times
283 283
284 284 use "hg -v help add" to show global options
285 285
286 286 Verbose help for add
287 287
288 288 $ hg add -hv
289 289 hg add [OPTION]... [FILE]...
290 290
291 291 add the specified files on the next commit
292 292
293 293 Schedule files to be version controlled and added to the repository.
294 294
295 295 The files will be added to the repository at the next commit. To undo an
296 296 add before that, see "hg forget".
297 297
298 298 If no names are given, add all files to the repository.
299 299
300 300 An example showing how new (unknown) files are added automatically by "hg
301 301 add":
302 302
303 303 $ ls
304 304 foo.c
305 305 $ hg status
306 306 ? foo.c
307 307 $ hg add
308 308 adding foo.c
309 309 $ hg status
310 310 A foo.c
311 311
312 312 Returns 0 if all files are successfully added.
313 313
314 314 options:
315 315
316 316 -I --include PATTERN [+] include names matching the given patterns
317 317 -X --exclude PATTERN [+] exclude names matching the given patterns
318 318 -S --subrepos recurse into subrepositories
319 319 -n --dry-run do not perform actions, just print output
320 320
321 321 global options:
322 322 -R --repository REPO repository root directory or name of overlay bundle
323 323 file
324 324 --cwd DIR change working directory
325 325 -y --noninteractive do not prompt, assume 'yes' for any required
326 326 answers
327 327 -q --quiet suppress output
328 328 -v --verbose enable additional output
329 329 --config CONFIG [+] set/override config option (use
330 330 'section.name=value')
331 331 --debug enable debugging output
332 332 --debugger start debugger
333 333 --encoding ENCODE set the charset encoding (default: ascii)
334 334 --encodingmode MODE set the charset encoding mode (default: strict)
335 335 --traceback always print a traceback on exception
336 336 --time time how long the command takes
337 337 --profile print command execution profile
338 338 --version output version information and exit
339 339 -h --help display help and exit
340 340
341 341 [+] marked option can be specified multiple times
342 342
343 343 Test help option with version option
344 344
345 345 $ hg add -h --version
346 346 Mercurial Distributed SCM (version *) (glob)
347 347
348 348 Copyright (C) 2005-2010 Matt Mackall <mpm@selenic.com> and others
349 349 This is free software; see the source for copying conditions. There is NO
350 350 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
351 351
352 352 hg add [OPTION]... [FILE]...
353 353
354 354 add the specified files on the next commit
355 355
356 356 Schedule files to be version controlled and added to the repository.
357 357
358 358 The files will be added to the repository at the next commit. To undo an
359 359 add before that, see "hg forget".
360 360
361 361 If no names are given, add all files to the repository.
362 362
363 363 Returns 0 if all files are successfully added.
364 364
365 365 use "hg -v help add" to show verbose help
366 366
367 367 options:
368 368
369 369 -I --include PATTERN [+] include names matching the given patterns
370 370 -X --exclude PATTERN [+] exclude names matching the given patterns
371 371 -S --subrepos recurse into subrepositories
372 372 -n --dry-run do not perform actions, just print output
373 373
374 374 [+] marked option can be specified multiple times
375 375
376 376 use "hg -v help add" to show global options
377 377
378 378 $ hg add --skjdfks
379 379 hg add: option --skjdfks not recognized
380 380 hg add [OPTION]... [FILE]...
381 381
382 382 add the specified files on the next commit
383 383
384 384 Schedule files to be version controlled and added to the repository.
385 385
386 386 The files will be added to the repository at the next commit. To undo an
387 387 add before that, see "hg forget".
388 388
389 389 If no names are given, add all files to the repository.
390 390
391 391 Returns 0 if all files are successfully added.
392 392
393 393 use "hg -v help add" to show verbose help
394 394
395 395 options:
396 396
397 397 -I --include PATTERN [+] include names matching the given patterns
398 398 -X --exclude PATTERN [+] exclude names matching the given patterns
399 399 -S --subrepos recurse into subrepositories
400 400 -n --dry-run do not perform actions, just print output
401 401
402 402 [+] marked option can be specified multiple times
403 403
404 404 use "hg -v help add" to show global options
405 405 [255]
406 406
407 407 Test ambiguous command help
408 408
409 409 $ hg help ad
410 410 list of commands:
411 411
412 412 add add the specified files on the next commit
413 413 addremove add all new files, delete all missing files
414 414
415 415 use "hg -v help ad" to show aliases and global options
416 416
417 417 Test command without options
418 418
419 419 $ hg help verify
420 420 hg verify
421 421
422 422 verify the integrity of the repository
423 423
424 424 Verify the integrity of the current repository.
425 425
426 426 This will perform an extensive check of the repository's integrity,
427 427 validating the hashes and checksums of each entry in the changelog,
428 428 manifest, and tracked files, as well as the integrity of their crosslinks
429 429 and indices.
430 430
431 431 Returns 0 on success, 1 if errors are encountered.
432 432
433 433 use "hg -v help verify" to show global options
434 434
435 435 $ hg help diff
436 436 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
437 437
438 438 diff repository (or selected files)
439 439
440 440 Show differences between revisions for the specified files.
441 441
442 442 Differences between files are shown using the unified diff format.
443 443
444 444 Note:
445 445 diff may generate unexpected results for merges, as it will default to
446 446 comparing against the working directory's first parent changeset if no
447 447 revisions are specified.
448 448
449 449 When two revision arguments are given, then changes are shown between
450 450 those revisions. If only one revision is specified then that revision is
451 451 compared to the working directory, and, when no revisions are specified,
452 452 the working directory files are compared to its parent.
453 453
454 454 Alternatively you can specify -c/--change with a revision to see the
455 455 changes in that changeset relative to its first parent.
456 456
457 457 Without the -a/--text option, diff will avoid generating diffs of files it
458 458 detects as binary. With -a, diff will generate a diff anyway, probably
459 459 with undesirable results.
460 460
461 461 Use the -g/--git option to generate diffs in the git extended diff format.
462 462 For more information, read "hg help diffs".
463 463
464 464 Returns 0 on success.
465 465
466 466 options:
467 467
468 468 -r --rev REV [+] revision
469 469 -c --change REV change made by revision
470 470 -a --text treat all files as text
471 471 -g --git use git extended diff format
472 472 --nodates omit dates from diff headers
473 473 -p --show-function show which function each change is in
474 474 --reverse produce a diff that undoes the changes
475 475 -w --ignore-all-space ignore white space when comparing lines
476 476 -b --ignore-space-change ignore changes in the amount of white space
477 477 -B --ignore-blank-lines ignore changes whose lines are all blank
478 478 -U --unified NUM number of lines of context to show
479 479 --stat output diffstat-style summary of changes
480 480 -I --include PATTERN [+] include names matching the given patterns
481 481 -X --exclude PATTERN [+] exclude names matching the given patterns
482 482 -S --subrepos recurse into subrepositories
483 483
484 484 [+] marked option can be specified multiple times
485 485
486 486 use "hg -v help diff" to show global options
487 487
488 488 $ hg help status
489 489 hg status [OPTION]... [FILE]...
490 490
491 491 aliases: st
492 492
493 493 show changed files in the working directory
494 494
495 495 Show status of files in the repository. If names are given, only files
496 496 that match are shown. Files that are clean or ignored or the source of a
497 497 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
498 498 -C/--copies or -A/--all are given. Unless options described with "show
499 499 only ..." are given, the options -mardu are used.
500 500
501 501 Option -q/--quiet hides untracked (unknown and ignored) files unless
502 502 explicitly requested with -u/--unknown or -i/--ignored.
503 503
504 504 Note:
505 505 status may appear to disagree with diff if permissions have changed or
506 506 a merge has occurred. The standard diff format does not report
507 507 permission changes and diff only reports changes relative to one merge
508 508 parent.
509 509
510 510 If one revision is given, it is used as the base revision. If two
511 511 revisions are given, the differences between them are shown. The --change
512 512 option can also be used as a shortcut to list the changed files of a
513 513 revision from its first parent.
514 514
515 515 The codes used to show the status of files are:
516 516
517 517 M = modified
518 518 A = added
519 519 R = removed
520 520 C = clean
521 521 ! = missing (deleted by non-hg command, but still tracked)
522 522 ? = not tracked
523 523 I = ignored
524 524 = origin of the previous file listed as A (added)
525 525
526 526 Returns 0 on success.
527 527
528 528 options:
529 529
530 530 -A --all show status of all files
531 531 -m --modified show only modified files
532 532 -a --added show only added files
533 533 -r --removed show only removed files
534 534 -d --deleted show only deleted (but tracked) files
535 535 -c --clean show only files without changes
536 536 -u --unknown show only unknown (not tracked) files
537 537 -i --ignored show only ignored files
538 538 -n --no-status hide status prefix
539 539 -C --copies show source of copied files
540 540 -0 --print0 end filenames with NUL, for use with xargs
541 541 --rev REV [+] show difference from revision
542 542 --change REV list the changed files of a revision
543 543 -I --include PATTERN [+] include names matching the given patterns
544 544 -X --exclude PATTERN [+] exclude names matching the given patterns
545 545 -S --subrepos recurse into subrepositories
546 546
547 547 [+] marked option can be specified multiple times
548 548
549 549 use "hg -v help status" to show global options
550 550
551 551 $ hg -q help status
552 552 hg status [OPTION]... [FILE]...
553 553
554 554 show changed files in the working directory
555 555
556 556 $ hg help foo
557 557 hg: unknown command 'foo'
558 558 Mercurial Distributed SCM
559 559
560 560 basic commands:
561 561
562 562 add add the specified files on the next commit
563 563 annotate show changeset information by line for each file
564 564 clone make a copy of an existing repository
565 565 commit commit the specified files or all outstanding changes
566 566 diff diff repository (or selected files)
567 567 export dump the header and diffs for one or more changesets
568 568 forget forget the specified files on the next commit
569 569 init create a new repository in the given directory
570 570 log show revision history of entire repository or files
571 571 merge merge working directory with another revision
572 572 pull pull changes from the specified source
573 573 push push changes to the specified destination
574 574 remove remove the specified files on the next commit
575 575 serve start stand-alone webserver
576 576 status show changed files in the working directory
577 577 summary summarize working directory state
578 578 update update working directory (or switch revisions)
579 579
580 580 use "hg help" for the full list of commands or "hg -v" for details
581 581 [255]
582 582
583 583 $ hg skjdfks
584 584 hg: unknown command 'skjdfks'
585 585 Mercurial Distributed SCM
586 586
587 587 basic commands:
588 588
589 589 add add the specified files on the next commit
590 590 annotate show changeset information by line for each file
591 591 clone make a copy of an existing repository
592 592 commit commit the specified files or all outstanding changes
593 593 diff diff repository (or selected files)
594 594 export dump the header and diffs for one or more changesets
595 595 forget forget the specified files on the next commit
596 596 init create a new repository in the given directory
597 597 log show revision history of entire repository or files
598 598 merge merge working directory with another revision
599 599 pull pull changes from the specified source
600 600 push push changes to the specified destination
601 601 remove remove the specified files on the next commit
602 602 serve start stand-alone webserver
603 603 status show changed files in the working directory
604 604 summary summarize working directory state
605 605 update update working directory (or switch revisions)
606 606
607 607 use "hg help" for the full list of commands or "hg -v" for details
608 608 [255]
609 609
610 610 $ cat > helpext.py <<EOF
611 611 > import os
612 612 > from mercurial import commands
613 613 >
614 614 > def nohelp(ui, *args, **kwargs):
615 615 > pass
616 616 >
617 617 > cmdtable = {
618 618 > "nohelp": (nohelp, [], "hg nohelp"),
619 619 > }
620 620 >
621 621 > commands.norepo += ' nohelp'
622 622 > EOF
623 623 $ echo '[extensions]' >> $HGRCPATH
624 624 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
625 625
626 626 Test command with no help text
627 627
628 628 $ hg help nohelp
629 629 hg nohelp
630 630
631 631 (no help text available)
632 632
633 633 use "hg -v help nohelp" to show global options
634 634
635 635 Test that default list of commands omits extension commands
636 636
637 637 $ hg help
638 638 Mercurial Distributed SCM
639 639
640 640 list of commands:
641 641
642 642 add add the specified files on the next commit
643 643 addremove add all new files, delete all missing files
644 644 annotate show changeset information by line for each file
645 645 archive create an unversioned archive of a repository revision
646 646 backout reverse effect of earlier changeset
647 647 bisect subdivision search of changesets
648 648 branch set or show the current branch name
649 649 branches list repository named branches
650 650 bundle create a changegroup file
651 651 cat output the current or given revision of files
652 652 clone make a copy of an existing repository
653 653 commit commit the specified files or all outstanding changes
654 654 copy mark files as copied for the next commit
655 655 diff diff repository (or selected files)
656 656 export dump the header and diffs for one or more changesets
657 657 forget forget the specified files on the next commit
658 658 grep search for a pattern in specified files and revisions
659 659 heads show current repository heads or show branch heads
660 660 help show help for a given topic or a help overview
661 661 identify identify the working copy or specified revision
662 662 import import an ordered set of patches
663 663 incoming show new changesets found in source
664 664 init create a new repository in the given directory
665 665 locate locate files matching specific patterns
666 666 log show revision history of entire repository or files
667 667 manifest output the current or given revision of the project manifest
668 668 merge merge working directory with another revision
669 669 outgoing show changesets not found in the destination
670 670 parents show the parents of the working directory or revision
671 671 paths show aliases for remote repositories
672 672 pull pull changes from the specified source
673 673 push push changes to the specified destination
674 674 recover roll back an interrupted transaction
675 675 remove remove the specified files on the next commit
676 676 rename rename files; equivalent of copy + remove
677 677 resolve redo merges or set/view the merge status of files
678 678 revert restore individual files or directories to an earlier state
679 679 rollback roll back the last transaction (dangerous)
680 680 root print the root (top) of the current working directory
681 681 serve start stand-alone webserver
682 682 showconfig show combined config settings from all hgrc files
683 683 status show changed files in the working directory
684 684 summary summarize working directory state
685 685 tag add one or more tags for the current or given revision
686 686 tags list repository tags
687 687 tip show the tip revision
688 688 unbundle apply one or more changegroup files
689 689 update update working directory (or switch revisions)
690 690 verify verify the integrity of the repository
691 691 version output version and copyright information
692 692
693 693 enabled extensions:
694 694
695 695 helpext (no help text available)
696 696
697 697 additional help topics:
698 698
699 699 config Configuration Files
700 700 dates Date Formats
701 701 patterns File Name Patterns
702 702 environment Environment Variables
703 703 revisions Specifying Single Revisions
704 704 multirevs Specifying Multiple Revisions
705 705 revsets Specifying Revision Sets
706 706 diffs Diff Formats
707 707 merge-tools Merge Tools
708 708 templating Template Usage
709 709 urls URL Paths
710 710 extensions Using additional features
711 711 hgweb Configuring hgweb
712 712 glossary Glossary
713 713
714 714 use "hg -v help" to show aliases and global options
715 715
716 716 Test list of commands with command with no help text
717 717
718 718 $ hg help helpext
719 719 helpext extension - no help text available
720 720
721 721 list of commands:
722 722
723 723 nohelp (no help text available)
724 724
725 725 use "hg -v help helpext" to show aliases and global options
726 726
727 727 Test a help topic
728 728
729 729 $ hg help revs
730 730 Specifying Single Revisions
731 731
732 732 Mercurial supports several ways to specify individual revisions.
733 733
734 734 A plain integer is treated as a revision number. Negative integers are
735 735 treated as sequential offsets from the tip, with -1 denoting the tip, -2
736 736 denoting the revision prior to the tip, and so forth.
737 737
738 738 A 40-digit hexadecimal string is treated as a unique revision identifier.
739 739
740 740 A hexadecimal string less than 40 characters long is treated as a unique
741 741 revision identifier and is referred to as a short-form identifier. A
742 742 short-form identifier is only valid if it is the prefix of exactly one
743 743 full-length identifier.
744 744
745 745 Any other string is treated as a tag or branch name. A tag name is a
746 746 symbolic name associated with a revision identifier. A branch name denotes
747 747 the tipmost revision of that branch. Tag and branch names must not contain
748 748 the ":" character.
749 749
750 750 The reserved name "tip" is a special tag that always identifies the most
751 751 recent revision.
752 752
753 753 The reserved name "null" indicates the null revision. This is the revision
754 754 of an empty repository, and the parent of revision 0.
755 755
756 756 The reserved name "." indicates the working directory parent. If no
757 757 working directory is checked out, it is equivalent to null. If an
758 758 uncommitted merge is in progress, "." is the revision of the first parent.
759
760 Test help hooks
761
762 $ cat > helphook1.py <<EOF
763 > from mercurial import help
764 >
765 > def rewrite(topic, doc):
766 > return doc + '\nhelphook1\n'
767 >
768 > def extsetup(ui):
769 > help.addtopichook('revsets', rewrite)
770 > EOF
771 $ cat > helphook2.py <<EOF
772 > from mercurial import help
773 >
774 > def rewrite(topic, doc):
775 > return doc + '\nhelphook2\n'
776 >
777 > def extsetup(ui):
778 > help.addtopichook('revsets', rewrite)
779 > EOF
780 $ echo '[extensions]' >> $HGRCPATH
781 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
782 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
783 $ hg help revsets | grep helphook
784 helphook1
785 helphook2
General Comments 0
You need to be logged in to leave comments. Login now