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