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