Show More
@@ -1,1077 +1,1084 b'' | |||
|
1 | 1 | # dispatch.py - command dispatching for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import, print_function |
|
9 | 9 | |
|
10 | 10 | import difflib |
|
11 | 11 | import errno |
|
12 | 12 | import getopt |
|
13 | 13 | import os |
|
14 | 14 | import pdb |
|
15 | 15 | import re |
|
16 | 16 | import signal |
|
17 | 17 | import sys |
|
18 | 18 | import time |
|
19 | 19 | import traceback |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | from .i18n import _ |
|
23 | 23 | |
|
24 | 24 | from hgdemandimport import tracing |
|
25 | 25 | |
|
26 | 26 | from . import ( |
|
27 | 27 | cmdutil, |
|
28 | 28 | color, |
|
29 | 29 | commands, |
|
30 | 30 | demandimport, |
|
31 | 31 | encoding, |
|
32 | 32 | error, |
|
33 | 33 | extensions, |
|
34 | 34 | fancyopts, |
|
35 | 35 | help, |
|
36 | 36 | hg, |
|
37 | 37 | hook, |
|
38 | 38 | profiling, |
|
39 | 39 | pycompat, |
|
40 | registrar, | |
|
40 | 41 | scmutil, |
|
41 | 42 | ui as uimod, |
|
42 | 43 | util, |
|
43 | 44 | ) |
|
44 | 45 | |
|
45 | 46 | from .utils import ( |
|
46 | 47 | procutil, |
|
47 | 48 | stringutil, |
|
48 | 49 | ) |
|
49 | 50 | |
|
50 | 51 | class request(object): |
|
51 | 52 | def __init__(self, args, ui=None, repo=None, fin=None, fout=None, |
|
52 | 53 | ferr=None, prereposetups=None): |
|
53 | 54 | self.args = args |
|
54 | 55 | self.ui = ui |
|
55 | 56 | self.repo = repo |
|
56 | 57 | |
|
57 | 58 | # input/output/error streams |
|
58 | 59 | self.fin = fin |
|
59 | 60 | self.fout = fout |
|
60 | 61 | self.ferr = ferr |
|
61 | 62 | |
|
62 | 63 | # remember options pre-parsed by _earlyparseopts() |
|
63 | 64 | self.earlyoptions = {} |
|
64 | 65 | |
|
65 | 66 | # reposetups which run before extensions, useful for chg to pre-fill |
|
66 | 67 | # low-level repo state (for example, changelog) before extensions. |
|
67 | 68 | self.prereposetups = prereposetups or [] |
|
68 | 69 | |
|
69 | 70 | # store the parsed and canonical command |
|
70 | 71 | self.canonical_command = None |
|
71 | 72 | |
|
72 | 73 | def _runexithandlers(self): |
|
73 | 74 | exc = None |
|
74 | 75 | handlers = self.ui._exithandlers |
|
75 | 76 | try: |
|
76 | 77 | while handlers: |
|
77 | 78 | func, args, kwargs = handlers.pop() |
|
78 | 79 | try: |
|
79 | 80 | func(*args, **kwargs) |
|
80 | 81 | except: # re-raises below |
|
81 | 82 | if exc is None: |
|
82 | 83 | exc = sys.exc_info()[1] |
|
83 | 84 | self.ui.warn(('error in exit handlers:\n')) |
|
84 | 85 | self.ui.traceback(force=True) |
|
85 | 86 | finally: |
|
86 | 87 | if exc is not None: |
|
87 | 88 | raise exc |
|
88 | 89 | |
|
89 | 90 | def run(): |
|
90 | 91 | "run the command in sys.argv" |
|
91 | 92 | initstdio() |
|
92 | 93 | with tracing.log('parse args into request'): |
|
93 | 94 | req = request(pycompat.sysargv[1:]) |
|
94 | 95 | err = None |
|
95 | 96 | try: |
|
96 | 97 | status = dispatch(req) |
|
97 | 98 | except error.StdioError as e: |
|
98 | 99 | err = e |
|
99 | 100 | status = -1 |
|
100 | 101 | |
|
101 | 102 | # In all cases we try to flush stdio streams. |
|
102 | 103 | if util.safehasattr(req.ui, 'fout'): |
|
103 | 104 | try: |
|
104 | 105 | req.ui.fout.flush() |
|
105 | 106 | except IOError as e: |
|
106 | 107 | err = e |
|
107 | 108 | status = -1 |
|
108 | 109 | |
|
109 | 110 | if util.safehasattr(req.ui, 'ferr'): |
|
110 | 111 | try: |
|
111 | 112 | if err is not None and err.errno != errno.EPIPE: |
|
112 | 113 | req.ui.ferr.write('abort: %s\n' % |
|
113 | 114 | encoding.strtolocal(err.strerror)) |
|
114 | 115 | req.ui.ferr.flush() |
|
115 | 116 | # There's not much we can do about an I/O error here. So (possibly) |
|
116 | 117 | # change the status code and move on. |
|
117 | 118 | except IOError: |
|
118 | 119 | status = -1 |
|
119 | 120 | |
|
120 | 121 | _silencestdio() |
|
121 | 122 | sys.exit(status & 255) |
|
122 | 123 | |
|
123 | 124 | if pycompat.ispy3: |
|
124 | 125 | def initstdio(): |
|
125 | 126 | pass |
|
126 | 127 | |
|
127 | 128 | def _silencestdio(): |
|
128 | 129 | for fp in (sys.stdout, sys.stderr): |
|
129 | 130 | # Check if the file is okay |
|
130 | 131 | try: |
|
131 | 132 | fp.flush() |
|
132 | 133 | continue |
|
133 | 134 | except IOError: |
|
134 | 135 | pass |
|
135 | 136 | # Otherwise mark it as closed to silence "Exception ignored in" |
|
136 | 137 | # message emitted by the interpreter finalizer. Be careful to |
|
137 | 138 | # not close procutil.stdout, which may be a fdopen-ed file object |
|
138 | 139 | # and its close() actually closes the underlying file descriptor. |
|
139 | 140 | try: |
|
140 | 141 | fp.close() |
|
141 | 142 | except IOError: |
|
142 | 143 | pass |
|
143 | 144 | else: |
|
144 | 145 | def initstdio(): |
|
145 | 146 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
146 | 147 | procutil.setbinary(fp) |
|
147 | 148 | |
|
148 | 149 | def _silencestdio(): |
|
149 | 150 | pass |
|
150 | 151 | |
|
151 | 152 | def _getsimilar(symbols, value): |
|
152 | 153 | sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() |
|
153 | 154 | # The cutoff for similarity here is pretty arbitrary. It should |
|
154 | 155 | # probably be investigated and tweaked. |
|
155 | 156 | return [s for s in symbols if sim(s) > 0.6] |
|
156 | 157 | |
|
157 | 158 | def _reportsimilar(write, similar): |
|
158 | 159 | if len(similar) == 1: |
|
159 | 160 | write(_("(did you mean %s?)\n") % similar[0]) |
|
160 | 161 | elif similar: |
|
161 | 162 | ss = ", ".join(sorted(similar)) |
|
162 | 163 | write(_("(did you mean one of %s?)\n") % ss) |
|
163 | 164 | |
|
164 | 165 | def _formatparse(write, inst): |
|
165 | 166 | similar = [] |
|
166 | 167 | if isinstance(inst, error.UnknownIdentifier): |
|
167 | 168 | # make sure to check fileset first, as revset can invoke fileset |
|
168 | 169 | similar = _getsimilar(inst.symbols, inst.function) |
|
169 | 170 | if len(inst.args) > 1: |
|
170 | 171 | write(_("hg: parse error at %s: %s\n") % |
|
171 | 172 | (pycompat.bytestr(inst.args[1]), inst.args[0])) |
|
172 | 173 | if inst.args[0].startswith(' '): |
|
173 | 174 | write(_("unexpected leading whitespace\n")) |
|
174 | 175 | else: |
|
175 | 176 | write(_("hg: parse error: %s\n") % inst.args[0]) |
|
176 | 177 | _reportsimilar(write, similar) |
|
177 | 178 | if inst.hint: |
|
178 | 179 | write(_("(%s)\n") % inst.hint) |
|
179 | 180 | |
|
180 | 181 | def _formatargs(args): |
|
181 | 182 | return ' '.join(procutil.shellquote(a) for a in args) |
|
182 | 183 | |
|
183 | 184 | def dispatch(req): |
|
184 | 185 | """run the command specified in req.args; returns an integer status code""" |
|
185 | 186 | with tracing.log('dispatch.dispatch'): |
|
186 | 187 | if req.ferr: |
|
187 | 188 | ferr = req.ferr |
|
188 | 189 | elif req.ui: |
|
189 | 190 | ferr = req.ui.ferr |
|
190 | 191 | else: |
|
191 | 192 | ferr = procutil.stderr |
|
192 | 193 | |
|
193 | 194 | try: |
|
194 | 195 | if not req.ui: |
|
195 | 196 | req.ui = uimod.ui.load() |
|
196 | 197 | req.earlyoptions.update(_earlyparseopts(req.ui, req.args)) |
|
197 | 198 | if req.earlyoptions['traceback']: |
|
198 | 199 | req.ui.setconfig('ui', 'traceback', 'on', '--traceback') |
|
199 | 200 | |
|
200 | 201 | # set ui streams from the request |
|
201 | 202 | if req.fin: |
|
202 | 203 | req.ui.fin = req.fin |
|
203 | 204 | if req.fout: |
|
204 | 205 | req.ui.fout = req.fout |
|
205 | 206 | if req.ferr: |
|
206 | 207 | req.ui.ferr = req.ferr |
|
207 | 208 | except error.Abort as inst: |
|
208 | 209 | ferr.write(_("abort: %s\n") % inst) |
|
209 | 210 | if inst.hint: |
|
210 | 211 | ferr.write(_("(%s)\n") % inst.hint) |
|
211 | 212 | return -1 |
|
212 | 213 | except error.ParseError as inst: |
|
213 | 214 | _formatparse(ferr.write, inst) |
|
214 | 215 | return -1 |
|
215 | 216 | |
|
216 | 217 | msg = _formatargs(req.args) |
|
217 | 218 | starttime = util.timer() |
|
218 | 219 | ret = 1 # default of Python exit code on unhandled exception |
|
219 | 220 | try: |
|
220 | 221 | ret = _runcatch(req) or 0 |
|
221 | 222 | except error.ProgrammingError as inst: |
|
222 | 223 | req.ui.error(_('** ProgrammingError: %s\n') % inst) |
|
223 | 224 | if inst.hint: |
|
224 | 225 | req.ui.error(_('** (%s)\n') % inst.hint) |
|
225 | 226 | raise |
|
226 | 227 | except KeyboardInterrupt as inst: |
|
227 | 228 | try: |
|
228 | 229 | if isinstance(inst, error.SignalInterrupt): |
|
229 | 230 | msg = _("killed!\n") |
|
230 | 231 | else: |
|
231 | 232 | msg = _("interrupted!\n") |
|
232 | 233 | req.ui.error(msg) |
|
233 | 234 | except error.SignalInterrupt: |
|
234 | 235 | # maybe pager would quit without consuming all the output, and |
|
235 | 236 | # SIGPIPE was raised. we cannot print anything in this case. |
|
236 | 237 | pass |
|
237 | 238 | except IOError as inst: |
|
238 | 239 | if inst.errno != errno.EPIPE: |
|
239 | 240 | raise |
|
240 | 241 | ret = -1 |
|
241 | 242 | finally: |
|
242 | 243 | duration = util.timer() - starttime |
|
243 | 244 | req.ui.flush() |
|
244 | 245 | if req.ui.logblockedtimes: |
|
245 | 246 | req.ui._blockedtimes['command_duration'] = duration * 1000 |
|
246 | 247 | req.ui.log('uiblocked', 'ui blocked ms', |
|
247 | 248 | **pycompat.strkwargs(req.ui._blockedtimes)) |
|
248 | 249 | req.ui.log("commandfinish", "%s exited %d after %0.2f seconds\n", |
|
249 | 250 | msg, ret & 255, duration, |
|
250 | 251 | canonical_command=req.canonical_command) |
|
251 | 252 | try: |
|
252 | 253 | req._runexithandlers() |
|
253 | 254 | except: # exiting, so no re-raises |
|
254 | 255 | ret = ret or -1 |
|
255 | 256 | return ret |
|
256 | 257 | |
|
257 | 258 | def _runcatch(req): |
|
258 | 259 | with tracing.log('dispatch._runcatch'): |
|
259 | 260 | def catchterm(*args): |
|
260 | 261 | raise error.SignalInterrupt |
|
261 | 262 | |
|
262 | 263 | ui = req.ui |
|
263 | 264 | try: |
|
264 | 265 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
|
265 | 266 | num = getattr(signal, name, None) |
|
266 | 267 | if num: |
|
267 | 268 | signal.signal(num, catchterm) |
|
268 | 269 | except ValueError: |
|
269 | 270 | pass # happens if called in a thread |
|
270 | 271 | |
|
271 | 272 | def _runcatchfunc(): |
|
272 | 273 | realcmd = None |
|
273 | 274 | try: |
|
274 | 275 | cmdargs = fancyopts.fancyopts( |
|
275 | 276 | req.args[:], commands.globalopts, {}) |
|
276 | 277 | cmd = cmdargs[0] |
|
277 | 278 | aliases, entry = cmdutil.findcmd(cmd, commands.table, False) |
|
278 | 279 | realcmd = aliases[0] |
|
279 | 280 | except (error.UnknownCommand, error.AmbiguousCommand, |
|
280 | 281 | IndexError, getopt.GetoptError): |
|
281 | 282 | # Don't handle this here. We know the command is |
|
282 | 283 | # invalid, but all we're worried about for now is that |
|
283 | 284 | # it's not a command that server operators expect to |
|
284 | 285 | # be safe to offer to users in a sandbox. |
|
285 | 286 | pass |
|
286 | 287 | if realcmd == 'serve' and '--stdio' in cmdargs: |
|
287 | 288 | # We want to constrain 'hg serve --stdio' instances pretty |
|
288 | 289 | # closely, as many shared-ssh access tools want to grant |
|
289 | 290 | # access to run *only* 'hg -R $repo serve --stdio'. We |
|
290 | 291 | # restrict to exactly that set of arguments, and prohibit |
|
291 | 292 | # any repo name that starts with '--' to prevent |
|
292 | 293 | # shenanigans wherein a user does something like pass |
|
293 | 294 | # --debugger or --config=ui.debugger=1 as a repo |
|
294 | 295 | # name. This used to actually run the debugger. |
|
295 | 296 | if (len(req.args) != 4 or |
|
296 | 297 | req.args[0] != '-R' or |
|
297 | 298 | req.args[1].startswith('--') or |
|
298 | 299 | req.args[2] != 'serve' or |
|
299 | 300 | req.args[3] != '--stdio'): |
|
300 | 301 | raise error.Abort( |
|
301 | 302 | _('potentially unsafe serve --stdio invocation: %s') % |
|
302 | 303 | (stringutil.pprint(req.args),)) |
|
303 | 304 | |
|
304 | 305 | try: |
|
305 | 306 | debugger = 'pdb' |
|
306 | 307 | debugtrace = { |
|
307 | 308 | 'pdb': pdb.set_trace |
|
308 | 309 | } |
|
309 | 310 | debugmortem = { |
|
310 | 311 | 'pdb': pdb.post_mortem |
|
311 | 312 | } |
|
312 | 313 | |
|
313 | 314 | # read --config before doing anything else |
|
314 | 315 | # (e.g. to change trust settings for reading .hg/hgrc) |
|
315 | 316 | cfgs = _parseconfig(req.ui, req.earlyoptions['config']) |
|
316 | 317 | |
|
317 | 318 | if req.repo: |
|
318 | 319 | # copy configs that were passed on the cmdline (--config) to |
|
319 | 320 | # the repo ui |
|
320 | 321 | for sec, name, val in cfgs: |
|
321 | 322 | req.repo.ui.setconfig(sec, name, val, source='--config') |
|
322 | 323 | |
|
323 | 324 | # developer config: ui.debugger |
|
324 | 325 | debugger = ui.config("ui", "debugger") |
|
325 | 326 | debugmod = pdb |
|
326 | 327 | if not debugger or ui.plain(): |
|
327 | 328 | # if we are in HGPLAIN mode, then disable custom debugging |
|
328 | 329 | debugger = 'pdb' |
|
329 | 330 | elif req.earlyoptions['debugger']: |
|
330 | 331 | # This import can be slow for fancy debuggers, so only |
|
331 | 332 | # do it when absolutely necessary, i.e. when actual |
|
332 | 333 | # debugging has been requested |
|
333 | 334 | with demandimport.deactivated(): |
|
334 | 335 | try: |
|
335 | 336 | debugmod = __import__(debugger) |
|
336 | 337 | except ImportError: |
|
337 | 338 | pass # Leave debugmod = pdb |
|
338 | 339 | |
|
339 | 340 | debugtrace[debugger] = debugmod.set_trace |
|
340 | 341 | debugmortem[debugger] = debugmod.post_mortem |
|
341 | 342 | |
|
342 | 343 | # enter the debugger before command execution |
|
343 | 344 | if req.earlyoptions['debugger']: |
|
344 | 345 | ui.warn(_("entering debugger - " |
|
345 | 346 | "type c to continue starting hg or h for help\n")) |
|
346 | 347 | |
|
347 | 348 | if (debugger != 'pdb' and |
|
348 | 349 | debugtrace[debugger] == debugtrace['pdb']): |
|
349 | 350 | ui.warn(_("%s debugger specified " |
|
350 | 351 | "but its module was not found\n") % debugger) |
|
351 | 352 | with demandimport.deactivated(): |
|
352 | 353 | debugtrace[debugger]() |
|
353 | 354 | try: |
|
354 | 355 | return _dispatch(req) |
|
355 | 356 | finally: |
|
356 | 357 | ui.flush() |
|
357 | 358 | except: # re-raises |
|
358 | 359 | # enter the debugger when we hit an exception |
|
359 | 360 | if req.earlyoptions['debugger']: |
|
360 | 361 | traceback.print_exc() |
|
361 | 362 | debugmortem[debugger](sys.exc_info()[2]) |
|
362 | 363 | raise |
|
363 | 364 | return _callcatch(ui, _runcatchfunc) |
|
364 | 365 | |
|
365 | 366 | def _callcatch(ui, func): |
|
366 | 367 | """like scmutil.callcatch but handles more high-level exceptions about |
|
367 | 368 | config parsing and commands. besides, use handlecommandexception to handle |
|
368 | 369 | uncaught exceptions. |
|
369 | 370 | """ |
|
370 | 371 | try: |
|
371 | 372 | return scmutil.callcatch(ui, func) |
|
372 | 373 | except error.AmbiguousCommand as inst: |
|
373 | 374 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
|
374 | 375 | (inst.args[0], " ".join(inst.args[1]))) |
|
375 | 376 | except error.CommandError as inst: |
|
376 | 377 | if inst.args[0]: |
|
377 | 378 | ui.pager('help') |
|
378 | 379 | msgbytes = pycompat.bytestr(inst.args[1]) |
|
379 | 380 | ui.warn(_("hg %s: %s\n") % (inst.args[0], msgbytes)) |
|
380 | 381 | commands.help_(ui, inst.args[0], full=False, command=True) |
|
381 | 382 | else: |
|
382 | 383 | ui.warn(_("hg: %s\n") % inst.args[1]) |
|
383 | 384 | ui.warn(_("(use 'hg help -v' for a list of global options)\n")) |
|
384 | 385 | except error.ParseError as inst: |
|
385 | 386 | _formatparse(ui.warn, inst) |
|
386 | 387 | return -1 |
|
387 | 388 | except error.UnknownCommand as inst: |
|
388 | 389 | nocmdmsg = _("hg: unknown command '%s'\n") % inst.args[0] |
|
389 | 390 | try: |
|
390 | 391 | # check if the command is in a disabled extension |
|
391 | 392 | # (but don't check for extensions themselves) |
|
392 | 393 | formatted = help.formattedhelp(ui, commands, inst.args[0], |
|
393 | 394 | unknowncmd=True) |
|
394 | 395 | ui.warn(nocmdmsg) |
|
395 | 396 | ui.write(formatted) |
|
396 | 397 | except (error.UnknownCommand, error.Abort): |
|
397 | 398 | suggested = False |
|
398 | 399 | if len(inst.args) == 2: |
|
399 | 400 | sim = _getsimilar(inst.args[1], inst.args[0]) |
|
400 | 401 | if sim: |
|
401 | 402 | ui.warn(nocmdmsg) |
|
402 | 403 | _reportsimilar(ui.warn, sim) |
|
403 | 404 | suggested = True |
|
404 | 405 | if not suggested: |
|
405 | 406 | ui.warn(nocmdmsg) |
|
406 | 407 | ui.warn(_("(use 'hg help' for a list of commands)\n")) |
|
407 | 408 | except IOError: |
|
408 | 409 | raise |
|
409 | 410 | except KeyboardInterrupt: |
|
410 | 411 | raise |
|
411 | 412 | except: # probably re-raises |
|
412 | 413 | if not handlecommandexception(ui): |
|
413 | 414 | raise |
|
414 | 415 | |
|
415 | 416 | return -1 |
|
416 | 417 | |
|
417 | 418 | def aliasargs(fn, givenargs): |
|
418 | 419 | args = [] |
|
419 | 420 | # only care about alias 'args', ignore 'args' set by extensions.wrapfunction |
|
420 | 421 | if not util.safehasattr(fn, '_origfunc'): |
|
421 | 422 | args = getattr(fn, 'args', args) |
|
422 | 423 | if args: |
|
423 | 424 | cmd = ' '.join(map(procutil.shellquote, args)) |
|
424 | 425 | |
|
425 | 426 | nums = [] |
|
426 | 427 | def replacer(m): |
|
427 | 428 | num = int(m.group(1)) - 1 |
|
428 | 429 | nums.append(num) |
|
429 | 430 | if num < len(givenargs): |
|
430 | 431 | return givenargs[num] |
|
431 | 432 | raise error.Abort(_('too few arguments for command alias')) |
|
432 | 433 | cmd = re.sub(br'\$(\d+|\$)', replacer, cmd) |
|
433 | 434 | givenargs = [x for i, x in enumerate(givenargs) |
|
434 | 435 | if i not in nums] |
|
435 | 436 | args = pycompat.shlexsplit(cmd) |
|
436 | 437 | return args + givenargs |
|
437 | 438 | |
|
438 | 439 | def aliasinterpolate(name, args, cmd): |
|
439 | 440 | '''interpolate args into cmd for shell aliases |
|
440 | 441 | |
|
441 | 442 | This also handles $0, $@ and "$@". |
|
442 | 443 | ''' |
|
443 | 444 | # util.interpolate can't deal with "$@" (with quotes) because it's only |
|
444 | 445 | # built to match prefix + patterns. |
|
445 | 446 | replacemap = dict(('$%d' % (i + 1), arg) for i, arg in enumerate(args)) |
|
446 | 447 | replacemap['$0'] = name |
|
447 | 448 | replacemap['$$'] = '$' |
|
448 | 449 | replacemap['$@'] = ' '.join(args) |
|
449 | 450 | # Typical Unix shells interpolate "$@" (with quotes) as all the positional |
|
450 | 451 | # parameters, separated out into words. Emulate the same behavior here by |
|
451 | 452 | # quoting the arguments individually. POSIX shells will then typically |
|
452 | 453 | # tokenize each argument into exactly one word. |
|
453 | 454 | replacemap['"$@"'] = ' '.join(procutil.shellquote(arg) for arg in args) |
|
454 | 455 | # escape '\$' for regex |
|
455 | 456 | regex = '|'.join(replacemap.keys()).replace('$', br'\$') |
|
456 | 457 | r = re.compile(regex) |
|
457 | 458 | return r.sub(lambda x: replacemap[x.group()], cmd) |
|
458 | 459 | |
|
459 | 460 | class cmdalias(object): |
|
460 | 461 | def __init__(self, ui, name, definition, cmdtable, source): |
|
461 | 462 | self.name = self.cmd = name |
|
462 | 463 | self.cmdname = '' |
|
463 | 464 | self.definition = definition |
|
464 | 465 | self.fn = None |
|
465 | 466 | self.givenargs = [] |
|
466 | 467 | self.opts = [] |
|
467 | 468 | self.help = '' |
|
468 | 469 | self.badalias = None |
|
469 | 470 | self.unknowncmd = False |
|
470 | 471 | self.source = source |
|
471 | 472 | |
|
472 | 473 | try: |
|
473 | 474 | aliases, entry = cmdutil.findcmd(self.name, cmdtable) |
|
474 | 475 | for alias, e in cmdtable.iteritems(): |
|
475 | 476 | if e is entry: |
|
476 | 477 | self.cmd = alias |
|
477 | 478 | break |
|
478 | 479 | self.shadows = True |
|
479 | 480 | except error.UnknownCommand: |
|
480 | 481 | self.shadows = False |
|
481 | 482 | |
|
482 | 483 | if not self.definition: |
|
483 | 484 | self.badalias = _("no definition for alias '%s'") % self.name |
|
484 | 485 | return |
|
485 | 486 | |
|
486 | 487 | if self.definition.startswith('!'): |
|
487 | 488 | shdef = self.definition[1:] |
|
488 | 489 | self.shell = True |
|
489 | 490 | def fn(ui, *args): |
|
490 | 491 | env = {'HG_ARGS': ' '.join((self.name,) + args)} |
|
491 | 492 | def _checkvar(m): |
|
492 | 493 | if m.groups()[0] == '$': |
|
493 | 494 | return m.group() |
|
494 | 495 | elif int(m.groups()[0]) <= len(args): |
|
495 | 496 | return m.group() |
|
496 | 497 | else: |
|
497 | 498 | ui.debug("No argument found for substitution " |
|
498 | 499 | "of %i variable in alias '%s' definition.\n" |
|
499 | 500 | % (int(m.groups()[0]), self.name)) |
|
500 | 501 | return '' |
|
501 | 502 | cmd = re.sub(br'\$(\d+|\$)', _checkvar, shdef) |
|
502 | 503 | cmd = aliasinterpolate(self.name, args, cmd) |
|
503 | 504 | return ui.system(cmd, environ=env, |
|
504 | 505 | blockedtag='alias_%s' % self.name) |
|
505 | 506 | self.fn = fn |
|
507 | self.alias = True | |
|
506 | 508 | self._populatehelp(ui, name, shdef, self.fn) |
|
507 | 509 | return |
|
508 | 510 | |
|
509 | 511 | try: |
|
510 | 512 | args = pycompat.shlexsplit(self.definition) |
|
511 | 513 | except ValueError as inst: |
|
512 | 514 | self.badalias = (_("error in definition for alias '%s': %s") |
|
513 | 515 | % (self.name, stringutil.forcebytestr(inst))) |
|
514 | 516 | return |
|
515 | 517 | earlyopts, args = _earlysplitopts(args) |
|
516 | 518 | if earlyopts: |
|
517 | 519 | self.badalias = (_("error in definition for alias '%s': %s may " |
|
518 | 520 | "only be given on the command line") |
|
519 | 521 | % (self.name, '/'.join(pycompat.ziplist(*earlyopts) |
|
520 | 522 | [0]))) |
|
521 | 523 | return |
|
522 | 524 | self.cmdname = cmd = args.pop(0) |
|
523 | 525 | self.givenargs = args |
|
524 | 526 | |
|
525 | 527 | try: |
|
526 | 528 | tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1] |
|
527 | 529 | if len(tableentry) > 2: |
|
528 | 530 | self.fn, self.opts, cmdhelp = tableentry |
|
529 | 531 | else: |
|
530 | 532 | self.fn, self.opts = tableentry |
|
531 | 533 | cmdhelp = None |
|
532 | 534 | |
|
535 | self.alias = True | |
|
533 | 536 | self._populatehelp(ui, name, cmd, self.fn, cmdhelp) |
|
534 | 537 | |
|
535 | 538 | except error.UnknownCommand: |
|
536 | 539 | self.badalias = (_("alias '%s' resolves to unknown command '%s'") |
|
537 | 540 | % (self.name, cmd)) |
|
538 | 541 | self.unknowncmd = True |
|
539 | 542 | except error.AmbiguousCommand: |
|
540 | 543 | self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") |
|
541 | 544 | % (self.name, cmd)) |
|
542 | 545 | |
|
543 | 546 | def _populatehelp(self, ui, name, cmd, fn, defaulthelp=None): |
|
544 | 547 | # confine strings to be passed to i18n.gettext() |
|
545 | 548 | cfg = {} |
|
546 | for k in ('doc', 'help'): | |
|
549 | for k in ('doc', 'help', 'category'): | |
|
547 | 550 | v = ui.config('alias', '%s:%s' % (name, k), None) |
|
548 | 551 | if v is None: |
|
549 | 552 | continue |
|
550 | 553 | if not encoding.isasciistr(v): |
|
551 | 554 | self.badalias = (_("non-ASCII character in alias definition " |
|
552 | 555 | "'%s:%s'") % (name, k)) |
|
553 | 556 | return |
|
554 | 557 | cfg[k] = v |
|
555 | 558 | |
|
556 | 559 | self.help = cfg.get('help', defaulthelp or '') |
|
557 | 560 | if self.help and self.help.startswith("hg " + cmd): |
|
558 | 561 | # drop prefix in old-style help lines so hg shows the alias |
|
559 | 562 | self.help = self.help[4 + len(cmd):] |
|
560 | 563 | |
|
564 | self.owndoc = 'doc' in cfg | |
|
561 | 565 | doc = cfg.get('doc', pycompat.getdoc(fn)) |
|
562 | 566 | if doc is not None: |
|
563 | 567 | doc = pycompat.sysstr(doc) |
|
564 | 568 | self.__doc__ = doc |
|
565 | 569 | |
|
570 | self.helpcategory = cfg.get('category', registrar.command.CATEGORY_NONE) | |
|
571 | ||
|
566 | 572 | @property |
|
567 | 573 | def args(self): |
|
568 | 574 | args = pycompat.maplist(util.expandpath, self.givenargs) |
|
569 | 575 | return aliasargs(self.fn, args) |
|
570 | 576 | |
|
571 | 577 | def __getattr__(self, name): |
|
572 | 578 | adefaults = {r'norepo': True, r'intents': set(), |
|
573 | 579 | r'optionalrepo': False, r'inferrepo': False} |
|
574 | 580 | if name not in adefaults: |
|
575 | 581 | raise AttributeError(name) |
|
576 | 582 | if self.badalias or util.safehasattr(self, 'shell'): |
|
577 | 583 | return adefaults[name] |
|
578 | 584 | return getattr(self.fn, name) |
|
579 | 585 | |
|
580 | 586 | def __call__(self, ui, *args, **opts): |
|
581 | 587 | if self.badalias: |
|
582 | 588 | hint = None |
|
583 | 589 | if self.unknowncmd: |
|
584 | 590 | try: |
|
585 | 591 | # check if the command is in a disabled extension |
|
586 | 592 | cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2] |
|
587 | 593 | hint = _("'%s' is provided by '%s' extension") % (cmd, ext) |
|
588 | 594 | except error.UnknownCommand: |
|
589 | 595 | pass |
|
590 | 596 | raise error.Abort(self.badalias, hint=hint) |
|
591 | 597 | if self.shadows: |
|
592 | 598 | ui.debug("alias '%s' shadows command '%s'\n" % |
|
593 | 599 | (self.name, self.cmdname)) |
|
594 | 600 | |
|
595 | 601 | ui.log('commandalias', "alias '%s' expands to '%s'\n", |
|
596 | 602 | self.name, self.definition) |
|
597 | 603 | if util.safehasattr(self, 'shell'): |
|
598 | 604 | return self.fn(ui, *args, **opts) |
|
599 | 605 | else: |
|
600 | 606 | try: |
|
601 | 607 | return util.checksignature(self.fn)(ui, *args, **opts) |
|
602 | 608 | except error.SignatureError: |
|
603 | 609 | args = ' '.join([self.cmdname] + self.args) |
|
604 | 610 | ui.debug("alias '%s' expands to '%s'\n" % (self.name, args)) |
|
605 | 611 | raise |
|
606 | 612 | |
|
607 | 613 | class lazyaliasentry(object): |
|
608 | 614 | """like a typical command entry (func, opts, help), but is lazy""" |
|
609 | 615 | |
|
610 | 616 | def __init__(self, ui, name, definition, cmdtable, source): |
|
611 | 617 | self.ui = ui |
|
612 | 618 | self.name = name |
|
613 | 619 | self.definition = definition |
|
614 | 620 | self.cmdtable = cmdtable.copy() |
|
615 | 621 | self.source = source |
|
622 | self.alias = True | |
|
616 | 623 | |
|
617 | 624 | @util.propertycache |
|
618 | 625 | def _aliasdef(self): |
|
619 | 626 | return cmdalias(self.ui, self.name, self.definition, self.cmdtable, |
|
620 | 627 | self.source) |
|
621 | 628 | |
|
622 | 629 | def __getitem__(self, n): |
|
623 | 630 | aliasdef = self._aliasdef |
|
624 | 631 | if n == 0: |
|
625 | 632 | return aliasdef |
|
626 | 633 | elif n == 1: |
|
627 | 634 | return aliasdef.opts |
|
628 | 635 | elif n == 2: |
|
629 | 636 | return aliasdef.help |
|
630 | 637 | else: |
|
631 | 638 | raise IndexError |
|
632 | 639 | |
|
633 | 640 | def __iter__(self): |
|
634 | 641 | for i in range(3): |
|
635 | 642 | yield self[i] |
|
636 | 643 | |
|
637 | 644 | def __len__(self): |
|
638 | 645 | return 3 |
|
639 | 646 | |
|
640 | 647 | def addaliases(ui, cmdtable): |
|
641 | 648 | # aliases are processed after extensions have been loaded, so they |
|
642 | 649 | # may use extension commands. Aliases can also use other alias definitions, |
|
643 | 650 | # but only if they have been defined prior to the current definition. |
|
644 | 651 | for alias, definition in ui.configitems('alias', ignoresub=True): |
|
645 | 652 | try: |
|
646 | 653 | if cmdtable[alias].definition == definition: |
|
647 | 654 | continue |
|
648 | 655 | except (KeyError, AttributeError): |
|
649 | 656 | # definition might not exist or it might not be a cmdalias |
|
650 | 657 | pass |
|
651 | 658 | |
|
652 | 659 | source = ui.configsource('alias', alias) |
|
653 | 660 | entry = lazyaliasentry(ui, alias, definition, cmdtable, source) |
|
654 | 661 | cmdtable[alias] = entry |
|
655 | 662 | |
|
656 | 663 | def _parse(ui, args): |
|
657 | 664 | options = {} |
|
658 | 665 | cmdoptions = {} |
|
659 | 666 | |
|
660 | 667 | try: |
|
661 | 668 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
662 | 669 | except getopt.GetoptError as inst: |
|
663 | 670 | raise error.CommandError(None, stringutil.forcebytestr(inst)) |
|
664 | 671 | |
|
665 | 672 | if args: |
|
666 | 673 | cmd, args = args[0], args[1:] |
|
667 | 674 | aliases, entry = cmdutil.findcmd(cmd, commands.table, |
|
668 | 675 | ui.configbool("ui", "strict")) |
|
669 | 676 | cmd = aliases[0] |
|
670 | 677 | args = aliasargs(entry[0], args) |
|
671 | 678 | defaults = ui.config("defaults", cmd) |
|
672 | 679 | if defaults: |
|
673 | 680 | args = pycompat.maplist( |
|
674 | 681 | util.expandpath, pycompat.shlexsplit(defaults)) + args |
|
675 | 682 | c = list(entry[1]) |
|
676 | 683 | else: |
|
677 | 684 | cmd = None |
|
678 | 685 | c = [] |
|
679 | 686 | |
|
680 | 687 | # combine global options into local |
|
681 | 688 | for o in commands.globalopts: |
|
682 | 689 | c.append((o[0], o[1], options[o[1]], o[3])) |
|
683 | 690 | |
|
684 | 691 | try: |
|
685 | 692 | args = fancyopts.fancyopts(args, c, cmdoptions, gnu=True) |
|
686 | 693 | except getopt.GetoptError as inst: |
|
687 | 694 | raise error.CommandError(cmd, stringutil.forcebytestr(inst)) |
|
688 | 695 | |
|
689 | 696 | # separate global options back out |
|
690 | 697 | for o in commands.globalopts: |
|
691 | 698 | n = o[1] |
|
692 | 699 | options[n] = cmdoptions[n] |
|
693 | 700 | del cmdoptions[n] |
|
694 | 701 | |
|
695 | 702 | return (cmd, cmd and entry[0] or None, args, options, cmdoptions) |
|
696 | 703 | |
|
697 | 704 | def _parseconfig(ui, config): |
|
698 | 705 | """parse the --config options from the command line""" |
|
699 | 706 | configs = [] |
|
700 | 707 | |
|
701 | 708 | for cfg in config: |
|
702 | 709 | try: |
|
703 | 710 | name, value = [cfgelem.strip() |
|
704 | 711 | for cfgelem in cfg.split('=', 1)] |
|
705 | 712 | section, name = name.split('.', 1) |
|
706 | 713 | if not section or not name: |
|
707 | 714 | raise IndexError |
|
708 | 715 | ui.setconfig(section, name, value, '--config') |
|
709 | 716 | configs.append((section, name, value)) |
|
710 | 717 | except (IndexError, ValueError): |
|
711 | 718 | raise error.Abort(_('malformed --config option: %r ' |
|
712 | 719 | '(use --config section.name=value)') |
|
713 | 720 | % pycompat.bytestr(cfg)) |
|
714 | 721 | |
|
715 | 722 | return configs |
|
716 | 723 | |
|
717 | 724 | def _earlyparseopts(ui, args): |
|
718 | 725 | options = {} |
|
719 | 726 | fancyopts.fancyopts(args, commands.globalopts, options, |
|
720 | 727 | gnu=not ui.plain('strictflags'), early=True, |
|
721 | 728 | optaliases={'repository': ['repo']}) |
|
722 | 729 | return options |
|
723 | 730 | |
|
724 | 731 | def _earlysplitopts(args): |
|
725 | 732 | """Split args into a list of possible early options and remainder args""" |
|
726 | 733 | shortoptions = 'R:' |
|
727 | 734 | # TODO: perhaps 'debugger' should be included |
|
728 | 735 | longoptions = ['cwd=', 'repository=', 'repo=', 'config='] |
|
729 | 736 | return fancyopts.earlygetopt(args, shortoptions, longoptions, |
|
730 | 737 | gnu=True, keepsep=True) |
|
731 | 738 | |
|
732 | 739 | def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
|
733 | 740 | # run pre-hook, and abort if it fails |
|
734 | 741 | hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
|
735 | 742 | pats=cmdpats, opts=cmdoptions) |
|
736 | 743 | try: |
|
737 | 744 | ret = _runcommand(ui, options, cmd, d) |
|
738 | 745 | # run post-hook, passing command result |
|
739 | 746 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), |
|
740 | 747 | result=ret, pats=cmdpats, opts=cmdoptions) |
|
741 | 748 | except Exception: |
|
742 | 749 | # run failure hook and re-raise |
|
743 | 750 | hook.hook(lui, repo, "fail-%s" % cmd, False, args=" ".join(fullargs), |
|
744 | 751 | pats=cmdpats, opts=cmdoptions) |
|
745 | 752 | raise |
|
746 | 753 | return ret |
|
747 | 754 | |
|
748 | 755 | def _getlocal(ui, rpath, wd=None): |
|
749 | 756 | """Return (path, local ui object) for the given target path. |
|
750 | 757 | |
|
751 | 758 | Takes paths in [cwd]/.hg/hgrc into account." |
|
752 | 759 | """ |
|
753 | 760 | if wd is None: |
|
754 | 761 | try: |
|
755 | 762 | wd = encoding.getcwd() |
|
756 | 763 | except OSError as e: |
|
757 | 764 | raise error.Abort(_("error getting current working directory: %s") % |
|
758 | 765 | encoding.strtolocal(e.strerror)) |
|
759 | 766 | path = cmdutil.findrepo(wd) or "" |
|
760 | 767 | if not path: |
|
761 | 768 | lui = ui |
|
762 | 769 | else: |
|
763 | 770 | lui = ui.copy() |
|
764 | 771 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) |
|
765 | 772 | |
|
766 | 773 | if rpath: |
|
767 | 774 | path = lui.expandpath(rpath) |
|
768 | 775 | lui = ui.copy() |
|
769 | 776 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) |
|
770 | 777 | |
|
771 | 778 | return path, lui |
|
772 | 779 | |
|
773 | 780 | def _checkshellalias(lui, ui, args): |
|
774 | 781 | """Return the function to run the shell alias, if it is required""" |
|
775 | 782 | options = {} |
|
776 | 783 | |
|
777 | 784 | try: |
|
778 | 785 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
779 | 786 | except getopt.GetoptError: |
|
780 | 787 | return |
|
781 | 788 | |
|
782 | 789 | if not args: |
|
783 | 790 | return |
|
784 | 791 | |
|
785 | 792 | cmdtable = commands.table |
|
786 | 793 | |
|
787 | 794 | cmd = args[0] |
|
788 | 795 | try: |
|
789 | 796 | strict = ui.configbool("ui", "strict") |
|
790 | 797 | aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict) |
|
791 | 798 | except (error.AmbiguousCommand, error.UnknownCommand): |
|
792 | 799 | return |
|
793 | 800 | |
|
794 | 801 | cmd = aliases[0] |
|
795 | 802 | fn = entry[0] |
|
796 | 803 | |
|
797 | 804 | if cmd and util.safehasattr(fn, 'shell'): |
|
798 | 805 | # shell alias shouldn't receive early options which are consumed by hg |
|
799 | 806 | _earlyopts, args = _earlysplitopts(args) |
|
800 | 807 | d = lambda: fn(ui, *args[1:]) |
|
801 | 808 | return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, |
|
802 | 809 | [], {}) |
|
803 | 810 | |
|
804 | 811 | def _dispatch(req): |
|
805 | 812 | args = req.args |
|
806 | 813 | ui = req.ui |
|
807 | 814 | |
|
808 | 815 | # check for cwd |
|
809 | 816 | cwd = req.earlyoptions['cwd'] |
|
810 | 817 | if cwd: |
|
811 | 818 | os.chdir(cwd) |
|
812 | 819 | |
|
813 | 820 | rpath = req.earlyoptions['repository'] |
|
814 | 821 | path, lui = _getlocal(ui, rpath) |
|
815 | 822 | |
|
816 | 823 | uis = {ui, lui} |
|
817 | 824 | |
|
818 | 825 | if req.repo: |
|
819 | 826 | uis.add(req.repo.ui) |
|
820 | 827 | |
|
821 | 828 | if (req.earlyoptions['verbose'] or req.earlyoptions['debug'] |
|
822 | 829 | or req.earlyoptions['quiet']): |
|
823 | 830 | for opt in ('verbose', 'debug', 'quiet'): |
|
824 | 831 | val = pycompat.bytestr(bool(req.earlyoptions[opt])) |
|
825 | 832 | for ui_ in uis: |
|
826 | 833 | ui_.setconfig('ui', opt, val, '--' + opt) |
|
827 | 834 | |
|
828 | 835 | if req.earlyoptions['profile']: |
|
829 | 836 | for ui_ in uis: |
|
830 | 837 | ui_.setconfig('profiling', 'enabled', 'true', '--profile') |
|
831 | 838 | |
|
832 | 839 | profile = lui.configbool('profiling', 'enabled') |
|
833 | 840 | with profiling.profile(lui, enabled=profile) as profiler: |
|
834 | 841 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and |
|
835 | 842 | # reposetup |
|
836 | 843 | extensions.loadall(lui) |
|
837 | 844 | # Propagate any changes to lui.__class__ by extensions |
|
838 | 845 | ui.__class__ = lui.__class__ |
|
839 | 846 | |
|
840 | 847 | # (uisetup and extsetup are handled in extensions.loadall) |
|
841 | 848 | |
|
842 | 849 | # (reposetup is handled in hg.repository) |
|
843 | 850 | |
|
844 | 851 | addaliases(lui, commands.table) |
|
845 | 852 | |
|
846 | 853 | # All aliases and commands are completely defined, now. |
|
847 | 854 | # Check abbreviation/ambiguity of shell alias. |
|
848 | 855 | shellaliasfn = _checkshellalias(lui, ui, args) |
|
849 | 856 | if shellaliasfn: |
|
850 | 857 | return shellaliasfn() |
|
851 | 858 | |
|
852 | 859 | # check for fallback encoding |
|
853 | 860 | fallback = lui.config('ui', 'fallbackencoding') |
|
854 | 861 | if fallback: |
|
855 | 862 | encoding.fallbackencoding = fallback |
|
856 | 863 | |
|
857 | 864 | fullargs = args |
|
858 | 865 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
859 | 866 | |
|
860 | 867 | # store the canonical command name in request object for later access |
|
861 | 868 | req.canonical_command = cmd |
|
862 | 869 | |
|
863 | 870 | if options["config"] != req.earlyoptions["config"]: |
|
864 | 871 | raise error.Abort(_("option --config may not be abbreviated!")) |
|
865 | 872 | if options["cwd"] != req.earlyoptions["cwd"]: |
|
866 | 873 | raise error.Abort(_("option --cwd may not be abbreviated!")) |
|
867 | 874 | if options["repository"] != req.earlyoptions["repository"]: |
|
868 | 875 | raise error.Abort(_( |
|
869 | 876 | "option -R has to be separated from other options (e.g. not " |
|
870 | 877 | "-qR) and --repository may only be abbreviated as --repo!")) |
|
871 | 878 | if options["debugger"] != req.earlyoptions["debugger"]: |
|
872 | 879 | raise error.Abort(_("option --debugger may not be abbreviated!")) |
|
873 | 880 | # don't validate --profile/--traceback, which can be enabled from now |
|
874 | 881 | |
|
875 | 882 | if options["encoding"]: |
|
876 | 883 | encoding.encoding = options["encoding"] |
|
877 | 884 | if options["encodingmode"]: |
|
878 | 885 | encoding.encodingmode = options["encodingmode"] |
|
879 | 886 | if options["time"]: |
|
880 | 887 | def get_times(): |
|
881 | 888 | t = os.times() |
|
882 | 889 | if t[4] == 0.0: |
|
883 | 890 | # Windows leaves this as zero, so use time.clock() |
|
884 | 891 | t = (t[0], t[1], t[2], t[3], time.clock()) |
|
885 | 892 | return t |
|
886 | 893 | s = get_times() |
|
887 | 894 | def print_time(): |
|
888 | 895 | t = get_times() |
|
889 | 896 | ui.warn( |
|
890 | 897 | _("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
|
891 | 898 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
|
892 | 899 | ui.atexit(print_time) |
|
893 | 900 | if options["profile"]: |
|
894 | 901 | profiler.start() |
|
895 | 902 | |
|
896 | 903 | # if abbreviated version of this were used, take them in account, now |
|
897 | 904 | if options['verbose'] or options['debug'] or options['quiet']: |
|
898 | 905 | for opt in ('verbose', 'debug', 'quiet'): |
|
899 | 906 | if options[opt] == req.earlyoptions[opt]: |
|
900 | 907 | continue |
|
901 | 908 | val = pycompat.bytestr(bool(options[opt])) |
|
902 | 909 | for ui_ in uis: |
|
903 | 910 | ui_.setconfig('ui', opt, val, '--' + opt) |
|
904 | 911 | |
|
905 | 912 | if options['traceback']: |
|
906 | 913 | for ui_ in uis: |
|
907 | 914 | ui_.setconfig('ui', 'traceback', 'on', '--traceback') |
|
908 | 915 | |
|
909 | 916 | if options['noninteractive']: |
|
910 | 917 | for ui_ in uis: |
|
911 | 918 | ui_.setconfig('ui', 'interactive', 'off', '-y') |
|
912 | 919 | |
|
913 | 920 | if cmdoptions.get('insecure', False): |
|
914 | 921 | for ui_ in uis: |
|
915 | 922 | ui_.insecureconnections = True |
|
916 | 923 | |
|
917 | 924 | # setup color handling before pager, because setting up pager |
|
918 | 925 | # might cause incorrect console information |
|
919 | 926 | coloropt = options['color'] |
|
920 | 927 | for ui_ in uis: |
|
921 | 928 | if coloropt: |
|
922 | 929 | ui_.setconfig('ui', 'color', coloropt, '--color') |
|
923 | 930 | color.setup(ui_) |
|
924 | 931 | |
|
925 | 932 | if stringutil.parsebool(options['pager']): |
|
926 | 933 | # ui.pager() expects 'internal-always-' prefix in this case |
|
927 | 934 | ui.pager('internal-always-' + cmd) |
|
928 | 935 | elif options['pager'] != 'auto': |
|
929 | 936 | for ui_ in uis: |
|
930 | 937 | ui_.disablepager() |
|
931 | 938 | |
|
932 | 939 | if options['version']: |
|
933 | 940 | return commands.version_(ui) |
|
934 | 941 | if options['help']: |
|
935 | 942 | return commands.help_(ui, cmd, command=cmd is not None) |
|
936 | 943 | elif not cmd: |
|
937 | 944 | return commands.help_(ui, 'shortlist') |
|
938 | 945 | |
|
939 | 946 | repo = None |
|
940 | 947 | cmdpats = args[:] |
|
941 | 948 | if not func.norepo: |
|
942 | 949 | # use the repo from the request only if we don't have -R |
|
943 | 950 | if not rpath and not cwd: |
|
944 | 951 | repo = req.repo |
|
945 | 952 | |
|
946 | 953 | if repo: |
|
947 | 954 | # set the descriptors of the repo ui to those of ui |
|
948 | 955 | repo.ui.fin = ui.fin |
|
949 | 956 | repo.ui.fout = ui.fout |
|
950 | 957 | repo.ui.ferr = ui.ferr |
|
951 | 958 | else: |
|
952 | 959 | try: |
|
953 | 960 | repo = hg.repository(ui, path=path, |
|
954 | 961 | presetupfuncs=req.prereposetups, |
|
955 | 962 | intents=func.intents) |
|
956 | 963 | if not repo.local(): |
|
957 | 964 | raise error.Abort(_("repository '%s' is not local") |
|
958 | 965 | % path) |
|
959 | 966 | repo.ui.setconfig("bundle", "mainreporoot", repo.root, |
|
960 | 967 | 'repo') |
|
961 | 968 | except error.RequirementError: |
|
962 | 969 | raise |
|
963 | 970 | except error.RepoError: |
|
964 | 971 | if rpath: # invalid -R path |
|
965 | 972 | raise |
|
966 | 973 | if not func.optionalrepo: |
|
967 | 974 | if func.inferrepo and args and not path: |
|
968 | 975 | # try to infer -R from command args |
|
969 | 976 | repos = pycompat.maplist(cmdutil.findrepo, args) |
|
970 | 977 | guess = repos[0] |
|
971 | 978 | if guess and repos.count(guess) == len(repos): |
|
972 | 979 | req.args = ['--repository', guess] + fullargs |
|
973 | 980 | req.earlyoptions['repository'] = guess |
|
974 | 981 | return _dispatch(req) |
|
975 | 982 | if not path: |
|
976 | 983 | raise error.RepoError(_("no repository found in" |
|
977 | 984 | " '%s' (.hg not found)") |
|
978 | 985 | % encoding.getcwd()) |
|
979 | 986 | raise |
|
980 | 987 | if repo: |
|
981 | 988 | ui = repo.ui |
|
982 | 989 | if options['hidden']: |
|
983 | 990 | repo = repo.unfiltered() |
|
984 | 991 | args.insert(0, repo) |
|
985 | 992 | elif rpath: |
|
986 | 993 | ui.warn(_("warning: --repository ignored\n")) |
|
987 | 994 | |
|
988 | 995 | msg = _formatargs(fullargs) |
|
989 | 996 | ui.log("command", '%s\n', msg) |
|
990 | 997 | strcmdopt = pycompat.strkwargs(cmdoptions) |
|
991 | 998 | d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) |
|
992 | 999 | try: |
|
993 | 1000 | return runcommand(lui, repo, cmd, fullargs, ui, options, d, |
|
994 | 1001 | cmdpats, cmdoptions) |
|
995 | 1002 | finally: |
|
996 | 1003 | if repo and repo != req.repo: |
|
997 | 1004 | repo.close() |
|
998 | 1005 | |
|
999 | 1006 | def _runcommand(ui, options, cmd, cmdfunc): |
|
1000 | 1007 | """Run a command function, possibly with profiling enabled.""" |
|
1001 | 1008 | try: |
|
1002 | 1009 | with tracing.log("Running %s command" % cmd): |
|
1003 | 1010 | return cmdfunc() |
|
1004 | 1011 | except error.SignatureError: |
|
1005 | 1012 | raise error.CommandError(cmd, _('invalid arguments')) |
|
1006 | 1013 | |
|
1007 | 1014 | def _exceptionwarning(ui): |
|
1008 | 1015 | """Produce a warning message for the current active exception""" |
|
1009 | 1016 | |
|
1010 | 1017 | # For compatibility checking, we discard the portion of the hg |
|
1011 | 1018 | # version after the + on the assumption that if a "normal |
|
1012 | 1019 | # user" is running a build with a + in it the packager |
|
1013 | 1020 | # probably built from fairly close to a tag and anyone with a |
|
1014 | 1021 | # 'make local' copy of hg (where the version number can be out |
|
1015 | 1022 | # of date) will be clueful enough to notice the implausible |
|
1016 | 1023 | # version number and try updating. |
|
1017 | 1024 | ct = util.versiontuple(n=2) |
|
1018 | 1025 | worst = None, ct, '' |
|
1019 | 1026 | if ui.config('ui', 'supportcontact') is None: |
|
1020 | 1027 | for name, mod in extensions.extensions(): |
|
1021 | 1028 | # 'testedwith' should be bytes, but not all extensions are ported |
|
1022 | 1029 | # to py3 and we don't want UnicodeException because of that. |
|
1023 | 1030 | testedwith = stringutil.forcebytestr(getattr(mod, 'testedwith', '')) |
|
1024 | 1031 | report = getattr(mod, 'buglink', _('the extension author.')) |
|
1025 | 1032 | if not testedwith.strip(): |
|
1026 | 1033 | # We found an untested extension. It's likely the culprit. |
|
1027 | 1034 | worst = name, 'unknown', report |
|
1028 | 1035 | break |
|
1029 | 1036 | |
|
1030 | 1037 | # Never blame on extensions bundled with Mercurial. |
|
1031 | 1038 | if extensions.ismoduleinternal(mod): |
|
1032 | 1039 | continue |
|
1033 | 1040 | |
|
1034 | 1041 | tested = [util.versiontuple(t, 2) for t in testedwith.split()] |
|
1035 | 1042 | if ct in tested: |
|
1036 | 1043 | continue |
|
1037 | 1044 | |
|
1038 | 1045 | lower = [t for t in tested if t < ct] |
|
1039 | 1046 | nearest = max(lower or tested) |
|
1040 | 1047 | if worst[0] is None or nearest < worst[1]: |
|
1041 | 1048 | worst = name, nearest, report |
|
1042 | 1049 | if worst[0] is not None: |
|
1043 | 1050 | name, testedwith, report = worst |
|
1044 | 1051 | if not isinstance(testedwith, (bytes, str)): |
|
1045 | 1052 | testedwith = '.'.join([stringutil.forcebytestr(c) |
|
1046 | 1053 | for c in testedwith]) |
|
1047 | 1054 | warning = (_('** Unknown exception encountered with ' |
|
1048 | 1055 | 'possibly-broken third-party extension %s\n' |
|
1049 | 1056 | '** which supports versions %s of Mercurial.\n' |
|
1050 | 1057 | '** Please disable %s and try your action again.\n' |
|
1051 | 1058 | '** If that fixes the bug please report it to %s\n') |
|
1052 | 1059 | % (name, testedwith, name, stringutil.forcebytestr(report))) |
|
1053 | 1060 | else: |
|
1054 | 1061 | bugtracker = ui.config('ui', 'supportcontact') |
|
1055 | 1062 | if bugtracker is None: |
|
1056 | 1063 | bugtracker = _("https://mercurial-scm.org/wiki/BugTracker") |
|
1057 | 1064 | warning = (_("** unknown exception encountered, " |
|
1058 | 1065 | "please report by visiting\n** ") + bugtracker + '\n') |
|
1059 | 1066 | sysversion = pycompat.sysbytes(sys.version).replace('\n', '') |
|
1060 | 1067 | warning += ((_("** Python %s\n") % sysversion) + |
|
1061 | 1068 | (_("** Mercurial Distributed SCM (version %s)\n") % |
|
1062 | 1069 | util.version()) + |
|
1063 | 1070 | (_("** Extensions loaded: %s\n") % |
|
1064 | 1071 | ", ".join([x[0] for x in extensions.extensions()]))) |
|
1065 | 1072 | return warning |
|
1066 | 1073 | |
|
1067 | 1074 | def handlecommandexception(ui): |
|
1068 | 1075 | """Produce a warning message for broken commands |
|
1069 | 1076 | |
|
1070 | 1077 | Called when handling an exception; the exception is reraised if |
|
1071 | 1078 | this function returns False, ignored otherwise. |
|
1072 | 1079 | """ |
|
1073 | 1080 | warning = _exceptionwarning(ui) |
|
1074 | 1081 | ui.log("commandexception", "%s\n%s\n", warning, |
|
1075 | 1082 | pycompat.sysbytes(traceback.format_exc())) |
|
1076 | 1083 | ui.warn(warning) |
|
1077 | 1084 | return False # re-raise the exception |
@@ -1,838 +1,856 b'' | |||
|
1 | 1 | # help.py - help data for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2006 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | import itertools |
|
11 | 11 | import os |
|
12 | 12 | import textwrap |
|
13 | 13 | |
|
14 | 14 | from .i18n import ( |
|
15 | 15 | _, |
|
16 | 16 | gettext, |
|
17 | 17 | ) |
|
18 | 18 | from . import ( |
|
19 | 19 | cmdutil, |
|
20 | 20 | encoding, |
|
21 | 21 | error, |
|
22 | 22 | extensions, |
|
23 | 23 | fancyopts, |
|
24 | 24 | filemerge, |
|
25 | 25 | fileset, |
|
26 | 26 | minirst, |
|
27 | 27 | pycompat, |
|
28 | 28 | registrar, |
|
29 | 29 | revset, |
|
30 | 30 | templatefilters, |
|
31 | 31 | templatefuncs, |
|
32 | 32 | templatekw, |
|
33 | 33 | util, |
|
34 | 34 | ) |
|
35 | 35 | from .hgweb import ( |
|
36 | 36 | webcommands, |
|
37 | 37 | ) |
|
38 | 38 | |
|
39 | 39 | _exclkeywords = { |
|
40 | 40 | "(ADVANCED)", |
|
41 | 41 | "(DEPRECATED)", |
|
42 | 42 | "(EXPERIMENTAL)", |
|
43 | 43 | # i18n: "(ADVANCED)" is a keyword, must be translated consistently |
|
44 | 44 | _("(ADVANCED)"), |
|
45 | 45 | # i18n: "(DEPRECATED)" is a keyword, must be translated consistently |
|
46 | 46 | _("(DEPRECATED)"), |
|
47 | 47 | # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently |
|
48 | 48 | _("(EXPERIMENTAL)"), |
|
49 | 49 | } |
|
50 | 50 | |
|
51 | 51 | # The order in which command categories will be displayed. |
|
52 | 52 | # Extensions with custom categories should insert them into this list |
|
53 | 53 | # after/before the appropriate item, rather than replacing the list or |
|
54 | 54 | # assuming absolute positions. |
|
55 | 55 | CATEGORY_ORDER = [ |
|
56 | 56 | registrar.command.CATEGORY_REPO_CREATION, |
|
57 | 57 | registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT, |
|
58 | 58 | registrar.command.CATEGORY_COMMITTING, |
|
59 | 59 | registrar.command.CATEGORY_CHANGE_MANAGEMENT, |
|
60 | 60 | registrar.command.CATEGORY_CHANGE_ORGANIZATION, |
|
61 | 61 | registrar.command.CATEGORY_FILE_CONTENTS, |
|
62 | 62 | registrar.command.CATEGORY_CHANGE_NAVIGATION , |
|
63 | 63 | registrar.command.CATEGORY_WORKING_DIRECTORY, |
|
64 | 64 | registrar.command.CATEGORY_IMPORT_EXPORT, |
|
65 | 65 | registrar.command.CATEGORY_MAINTENANCE, |
|
66 | 66 | registrar.command.CATEGORY_HELP, |
|
67 | 67 | registrar.command.CATEGORY_MISC, |
|
68 | 68 | registrar.command.CATEGORY_NONE, |
|
69 | 69 | ] |
|
70 | 70 | |
|
71 | 71 | # Human-readable category names. These are translated. |
|
72 | 72 | # Extensions with custom categories should add their names here. |
|
73 | 73 | CATEGORY_NAMES = { |
|
74 | 74 | registrar.command.CATEGORY_REPO_CREATION: 'Repository creation', |
|
75 | 75 | registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT: |
|
76 | 76 | 'Remote repository management', |
|
77 | 77 | registrar.command.CATEGORY_COMMITTING: 'Change creation', |
|
78 | 78 | registrar.command.CATEGORY_CHANGE_NAVIGATION: 'Change navigation', |
|
79 | 79 | registrar.command.CATEGORY_CHANGE_MANAGEMENT: 'Change manipulation', |
|
80 | 80 | registrar.command.CATEGORY_CHANGE_ORGANIZATION: 'Change organization', |
|
81 | 81 | registrar.command.CATEGORY_WORKING_DIRECTORY: |
|
82 | 82 | 'Working directory management', |
|
83 | 83 | registrar.command.CATEGORY_FILE_CONTENTS: 'File content management', |
|
84 | 84 | registrar.command.CATEGORY_IMPORT_EXPORT: 'Change import/export', |
|
85 | 85 | registrar.command.CATEGORY_MAINTENANCE: 'Repository maintenance', |
|
86 | 86 | registrar.command.CATEGORY_HELP: 'Help', |
|
87 | 87 | registrar.command.CATEGORY_MISC: 'Miscellaneous commands', |
|
88 | 88 | registrar.command.CATEGORY_NONE: 'Uncategorized commands', |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | # Topic categories. |
|
92 | 92 | TOPIC_CATEGORY_IDS = 'ids' |
|
93 | 93 | TOPIC_CATEGORY_OUTPUT = 'output' |
|
94 | 94 | TOPIC_CATEGORY_CONFIG = 'config' |
|
95 | 95 | TOPIC_CATEGORY_CONCEPTS = 'concepts' |
|
96 | 96 | TOPIC_CATEGORY_MISC = 'misc' |
|
97 | 97 | TOPIC_CATEGORY_NONE = 'none' |
|
98 | 98 | |
|
99 | 99 | # The order in which topic categories will be displayed. |
|
100 | 100 | # Extensions with custom categories should insert them into this list |
|
101 | 101 | # after/before the appropriate item, rather than replacing the list or |
|
102 | 102 | # assuming absolute positions. |
|
103 | 103 | TOPIC_CATEGORY_ORDER = [ |
|
104 | 104 | TOPIC_CATEGORY_IDS, |
|
105 | 105 | TOPIC_CATEGORY_OUTPUT, |
|
106 | 106 | TOPIC_CATEGORY_CONFIG, |
|
107 | 107 | TOPIC_CATEGORY_CONCEPTS, |
|
108 | 108 | TOPIC_CATEGORY_MISC, |
|
109 | 109 | TOPIC_CATEGORY_NONE, |
|
110 | 110 | ] |
|
111 | 111 | |
|
112 | 112 | # Human-readable topic category names. These are translated. |
|
113 | 113 | TOPIC_CATEGORY_NAMES = { |
|
114 | 114 | TOPIC_CATEGORY_IDS: 'Mercurial identifiers', |
|
115 | 115 | TOPIC_CATEGORY_OUTPUT: 'Mercurial output', |
|
116 | 116 | TOPIC_CATEGORY_CONFIG: 'Mercurial configuration', |
|
117 | 117 | TOPIC_CATEGORY_CONCEPTS: 'Concepts', |
|
118 | 118 | TOPIC_CATEGORY_MISC: 'Miscellaneous', |
|
119 | 119 | TOPIC_CATEGORY_NONE: 'Uncategorized topics', |
|
120 | 120 | TOPIC_CATEGORY_NONE: 'Uncategorized topics', |
|
121 | 121 | } |
|
122 | 122 | |
|
123 | 123 | def listexts(header, exts, indent=1, showdeprecated=False): |
|
124 | 124 | '''return a text listing of the given extensions''' |
|
125 | 125 | rst = [] |
|
126 | 126 | if exts: |
|
127 | 127 | for name, desc in sorted(exts.iteritems()): |
|
128 | 128 | if not showdeprecated and any(w in desc for w in _exclkeywords): |
|
129 | 129 | continue |
|
130 | 130 | rst.append('%s:%s: %s\n' % (' ' * indent, name, desc)) |
|
131 | 131 | if rst: |
|
132 | 132 | rst.insert(0, '\n%s\n\n' % header) |
|
133 | 133 | return rst |
|
134 | 134 | |
|
135 | 135 | def extshelp(ui): |
|
136 | 136 | rst = loaddoc('extensions')(ui).splitlines(True) |
|
137 | 137 | rst.extend(listexts( |
|
138 | 138 | _('enabled extensions:'), extensions.enabled(), showdeprecated=True)) |
|
139 | 139 | rst.extend(listexts(_('disabled extensions:'), extensions.disabled(), |
|
140 | 140 | showdeprecated=ui.verbose)) |
|
141 | 141 | doc = ''.join(rst) |
|
142 | 142 | return doc |
|
143 | 143 | |
|
144 | 144 | def optrst(header, options, verbose): |
|
145 | 145 | data = [] |
|
146 | 146 | multioccur = False |
|
147 | 147 | for option in options: |
|
148 | 148 | if len(option) == 5: |
|
149 | 149 | shortopt, longopt, default, desc, optlabel = option |
|
150 | 150 | else: |
|
151 | 151 | shortopt, longopt, default, desc = option |
|
152 | 152 | optlabel = _("VALUE") # default label |
|
153 | 153 | |
|
154 | 154 | if not verbose and any(w in desc for w in _exclkeywords): |
|
155 | 155 | continue |
|
156 | 156 | |
|
157 | 157 | so = '' |
|
158 | 158 | if shortopt: |
|
159 | 159 | so = '-' + shortopt |
|
160 | 160 | lo = '--' + longopt |
|
161 | 161 | |
|
162 | 162 | if isinstance(default, fancyopts.customopt): |
|
163 | 163 | default = default.getdefaultvalue() |
|
164 | 164 | if default and not callable(default): |
|
165 | 165 | # default is of unknown type, and in Python 2 we abused |
|
166 | 166 | # the %s-shows-repr property to handle integers etc. To |
|
167 | 167 | # match that behavior on Python 3, we do str(default) and |
|
168 | 168 | # then convert it to bytes. |
|
169 | 169 | desc += _(" (default: %s)") % pycompat.bytestr(default) |
|
170 | 170 | |
|
171 | 171 | if isinstance(default, list): |
|
172 | 172 | lo += " %s [+]" % optlabel |
|
173 | 173 | multioccur = True |
|
174 | 174 | elif (default is not None) and not isinstance(default, bool): |
|
175 | 175 | lo += " %s" % optlabel |
|
176 | 176 | |
|
177 | 177 | data.append((so, lo, desc)) |
|
178 | 178 | |
|
179 | 179 | if multioccur: |
|
180 | 180 | header += (_(" ([+] can be repeated)")) |
|
181 | 181 | |
|
182 | 182 | rst = ['\n%s:\n\n' % header] |
|
183 | 183 | rst.extend(minirst.maketable(data, 1)) |
|
184 | 184 | |
|
185 | 185 | return ''.join(rst) |
|
186 | 186 | |
|
187 | 187 | def indicateomitted(rst, omitted, notomitted=None): |
|
188 | 188 | rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted) |
|
189 | 189 | if notomitted: |
|
190 | 190 | rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted) |
|
191 | 191 | |
|
192 | def filtercmd(ui, cmd, kw, doc): | |
|
192 | def filtercmd(ui, cmd, func, kw, doc): | |
|
193 | 193 | if not ui.debugflag and cmd.startswith("debug") and kw != "debug": |
|
194 | # Debug command, and user is not looking for those. | |
|
194 | 195 | return True |
|
195 | if not ui.verbose and doc and any(w in doc for w in _exclkeywords): | |
|
196 | if not ui.verbose: | |
|
197 | if not kw and not doc: | |
|
198 | # Command had no documentation, no point in showing it by default. | |
|
199 | return True | |
|
200 | if getattr(func, 'alias', False) and not getattr(func, 'owndoc', False): | |
|
201 | # Alias didn't have its own documentation. | |
|
202 | return True | |
|
203 | if doc and any(w in doc for w in _exclkeywords): | |
|
204 | # Documentation has excluded keywords. | |
|
205 | return True | |
|
206 | if kw == "shortlist" and not getattr(func, 'helpbasic', False): | |
|
207 | # We're presenting the short list but the command is not basic. | |
|
196 | 208 | return True |
|
197 | 209 | if ui.configbool('help', 'hidden-command.%s' % cmd): |
|
210 | # Configuration explicitly hides the command. | |
|
198 | 211 | return True |
|
199 | 212 | return False |
|
200 | 213 | |
|
201 | 214 | def filtertopic(ui, topic): |
|
202 | 215 | return ui.configbool('help', 'hidden-topic.%s' % topic, False) |
|
203 | 216 | |
|
204 | 217 | def topicmatch(ui, commands, kw): |
|
205 | 218 | """Return help topics matching kw. |
|
206 | 219 | |
|
207 | 220 | Returns {'section': [(name, summary), ...], ...} where section is |
|
208 | 221 | one of topics, commands, extensions, or extensioncommands. |
|
209 | 222 | """ |
|
210 | 223 | kw = encoding.lower(kw) |
|
211 | 224 | def lowercontains(container): |
|
212 | 225 | return kw in encoding.lower(container) # translated in helptable |
|
213 | 226 | results = {'topics': [], |
|
214 | 227 | 'commands': [], |
|
215 | 228 | 'extensions': [], |
|
216 | 229 | 'extensioncommands': [], |
|
217 | 230 | } |
|
218 | 231 | for topic in helptable: |
|
219 | 232 | names, header, doc = topic[0:3] |
|
220 | 233 | # Old extensions may use a str as doc. |
|
221 | 234 | if (sum(map(lowercontains, names)) |
|
222 | 235 | or lowercontains(header) |
|
223 | 236 | or (callable(doc) and lowercontains(doc(ui)))): |
|
224 | 237 | name = names[0] |
|
225 | 238 | if not filtertopic(ui, name): |
|
226 | 239 | results['topics'].append((names[0], header)) |
|
227 | 240 | for cmd, entry in commands.table.iteritems(): |
|
228 | 241 | if len(entry) == 3: |
|
229 | 242 | summary = entry[2] |
|
230 | 243 | else: |
|
231 | 244 | summary = '' |
|
232 | 245 | # translate docs *before* searching there |
|
233 | docs = _(pycompat.getdoc(entry[0])) or '' | |
|
246 | func = entry[0] | |
|
247 | docs = _(pycompat.getdoc(func)) or '' | |
|
234 | 248 | if kw in cmd or lowercontains(summary) or lowercontains(docs): |
|
235 | 249 | doclines = docs.splitlines() |
|
236 | 250 | if doclines: |
|
237 | 251 | summary = doclines[0] |
|
238 | 252 | cmdname = cmdutil.parsealiases(cmd)[0] |
|
239 | if filtercmd(ui, cmdname, kw, docs): | |
|
253 | if filtercmd(ui, cmdname, func, kw, docs): | |
|
240 | 254 | continue |
|
241 | 255 | results['commands'].append((cmdname, summary)) |
|
242 | 256 | for name, docs in itertools.chain( |
|
243 | 257 | extensions.enabled(False).iteritems(), |
|
244 | 258 | extensions.disabled().iteritems()): |
|
245 | 259 | if not docs: |
|
246 | 260 | continue |
|
247 | 261 | name = name.rpartition('.')[-1] |
|
248 | 262 | if lowercontains(name) or lowercontains(docs): |
|
249 | 263 | # extension docs are already translated |
|
250 | 264 | results['extensions'].append((name, docs.splitlines()[0])) |
|
251 | 265 | try: |
|
252 | 266 | mod = extensions.load(ui, name, '') |
|
253 | 267 | except ImportError: |
|
254 | 268 | # debug message would be printed in extensions.load() |
|
255 | 269 | continue |
|
256 | 270 | for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems(): |
|
257 | 271 | if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])): |
|
258 | 272 | cmdname = cmdutil.parsealiases(cmd)[0] |
|
259 |
|
|
|
273 | func = entry[0] | |
|
274 | cmddoc = pycompat.getdoc(func) | |
|
260 | 275 | if cmddoc: |
|
261 | 276 | cmddoc = gettext(cmddoc).splitlines()[0] |
|
262 | 277 | else: |
|
263 | 278 | cmddoc = _('(no help text available)') |
|
264 | if filtercmd(ui, cmdname, kw, cmddoc): | |
|
279 | if filtercmd(ui, cmdname, func, kw, cmddoc): | |
|
265 | 280 | continue |
|
266 | 281 | results['extensioncommands'].append((cmdname, cmddoc)) |
|
267 | 282 | return results |
|
268 | 283 | |
|
269 | 284 | def loaddoc(topic, subdir=None): |
|
270 | 285 | """Return a delayed loader for help/topic.txt.""" |
|
271 | 286 | |
|
272 | 287 | def loader(ui): |
|
273 | 288 | docdir = os.path.join(util.datapath, 'help') |
|
274 | 289 | if subdir: |
|
275 | 290 | docdir = os.path.join(docdir, subdir) |
|
276 | 291 | path = os.path.join(docdir, topic + ".txt") |
|
277 | 292 | doc = gettext(util.readfile(path)) |
|
278 | 293 | for rewriter in helphooks.get(topic, []): |
|
279 | 294 | doc = rewriter(ui, topic, doc) |
|
280 | 295 | return doc |
|
281 | 296 | |
|
282 | 297 | return loader |
|
283 | 298 | |
|
284 | 299 | internalstable = sorted([ |
|
285 | 300 | (['bundle2'], _('Bundle2'), |
|
286 | 301 | loaddoc('bundle2', subdir='internals')), |
|
287 | 302 | (['bundles'], _('Bundles'), |
|
288 | 303 | loaddoc('bundles', subdir='internals')), |
|
289 | 304 | (['cbor'], _('CBOR'), |
|
290 | 305 | loaddoc('cbor', subdir='internals')), |
|
291 | 306 | (['censor'], _('Censor'), |
|
292 | 307 | loaddoc('censor', subdir='internals')), |
|
293 | 308 | (['changegroups'], _('Changegroups'), |
|
294 | 309 | loaddoc('changegroups', subdir='internals')), |
|
295 | 310 | (['config'], _('Config Registrar'), |
|
296 | 311 | loaddoc('config', subdir='internals')), |
|
297 | 312 | (['requirements'], _('Repository Requirements'), |
|
298 | 313 | loaddoc('requirements', subdir='internals')), |
|
299 | 314 | (['revlogs'], _('Revision Logs'), |
|
300 | 315 | loaddoc('revlogs', subdir='internals')), |
|
301 | 316 | (['wireprotocol'], _('Wire Protocol'), |
|
302 | 317 | loaddoc('wireprotocol', subdir='internals')), |
|
303 | 318 | (['wireprotocolrpc'], _('Wire Protocol RPC'), |
|
304 | 319 | loaddoc('wireprotocolrpc', subdir='internals')), |
|
305 | 320 | (['wireprotocolv2'], _('Wire Protocol Version 2'), |
|
306 | 321 | loaddoc('wireprotocolv2', subdir='internals')), |
|
307 | 322 | ]) |
|
308 | 323 | |
|
309 | 324 | def internalshelp(ui): |
|
310 | 325 | """Generate the index for the "internals" topic.""" |
|
311 | 326 | lines = ['To access a subtopic, use "hg help internals.{subtopic-name}"\n', |
|
312 | 327 | '\n'] |
|
313 | 328 | for names, header, doc in internalstable: |
|
314 | 329 | lines.append(' :%s: %s\n' % (names[0], header)) |
|
315 | 330 | |
|
316 | 331 | return ''.join(lines) |
|
317 | 332 | |
|
318 | 333 | helptable = sorted([ |
|
319 | 334 | (['bundlespec'], _("Bundle File Formats"), loaddoc('bundlespec'), |
|
320 | 335 | TOPIC_CATEGORY_CONCEPTS), |
|
321 | 336 | (['color'], _("Colorizing Outputs"), loaddoc('color'), |
|
322 | 337 | TOPIC_CATEGORY_OUTPUT), |
|
323 | 338 | (["config", "hgrc"], _("Configuration Files"), loaddoc('config'), |
|
324 | 339 | TOPIC_CATEGORY_CONFIG), |
|
325 | 340 | (['deprecated'], _("Deprecated Features"), loaddoc('deprecated'), |
|
326 | 341 | TOPIC_CATEGORY_MISC), |
|
327 | 342 | (["dates"], _("Date Formats"), loaddoc('dates'), TOPIC_CATEGORY_OUTPUT), |
|
328 | 343 | (["flags"], _("Command-line flags"), loaddoc('flags'), |
|
329 | 344 | TOPIC_CATEGORY_CONFIG), |
|
330 | 345 | (["patterns"], _("File Name Patterns"), loaddoc('patterns'), |
|
331 | 346 | TOPIC_CATEGORY_IDS), |
|
332 | 347 | (['environment', 'env'], _('Environment Variables'), |
|
333 | 348 | loaddoc('environment'), TOPIC_CATEGORY_CONFIG), |
|
334 | 349 | (['revisions', 'revs', 'revsets', 'revset', 'multirevs', 'mrevs'], |
|
335 | 350 | _('Specifying Revisions'), loaddoc('revisions'), TOPIC_CATEGORY_IDS), |
|
336 | 351 | (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets'), |
|
337 | 352 | TOPIC_CATEGORY_IDS), |
|
338 | 353 | (['diffs'], _('Diff Formats'), loaddoc('diffs'), TOPIC_CATEGORY_OUTPUT), |
|
339 | 354 | (['merge-tools', 'mergetools', 'mergetool'], _('Merge Tools'), |
|
340 | 355 | loaddoc('merge-tools'), TOPIC_CATEGORY_CONFIG), |
|
341 | 356 | (['templating', 'templates', 'template', 'style'], _('Template Usage'), |
|
342 | 357 | loaddoc('templates'), TOPIC_CATEGORY_OUTPUT), |
|
343 | 358 | (['urls'], _('URL Paths'), loaddoc('urls'), TOPIC_CATEGORY_IDS), |
|
344 | 359 | (["extensions"], _("Using Additional Features"), extshelp, |
|
345 | 360 | TOPIC_CATEGORY_CONFIG), |
|
346 | 361 | (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos'), |
|
347 | 362 | TOPIC_CATEGORY_CONCEPTS), |
|
348 | 363 | (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb'), |
|
349 | 364 | TOPIC_CATEGORY_CONFIG), |
|
350 | 365 | (["glossary"], _("Glossary"), loaddoc('glossary'), TOPIC_CATEGORY_CONCEPTS), |
|
351 | 366 | (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"), |
|
352 | 367 | loaddoc('hgignore'), TOPIC_CATEGORY_IDS), |
|
353 | 368 | (["phases"], _("Working with Phases"), loaddoc('phases'), |
|
354 | 369 | TOPIC_CATEGORY_CONCEPTS), |
|
355 | 370 | (['scripting'], _('Using Mercurial from scripts and automation'), |
|
356 | 371 | loaddoc('scripting'), TOPIC_CATEGORY_MISC), |
|
357 | 372 | (['internals'], _("Technical implementation topics"), internalshelp, |
|
358 | 373 | TOPIC_CATEGORY_MISC), |
|
359 | 374 | (['pager'], _("Pager Support"), loaddoc('pager'), TOPIC_CATEGORY_CONFIG), |
|
360 | 375 | ]) |
|
361 | 376 | |
|
362 | 377 | # Maps topics with sub-topics to a list of their sub-topics. |
|
363 | 378 | subtopics = { |
|
364 | 379 | 'internals': internalstable, |
|
365 | 380 | } |
|
366 | 381 | |
|
367 | 382 | # Map topics to lists of callable taking the current topic help and |
|
368 | 383 | # returning the updated version |
|
369 | 384 | helphooks = {} |
|
370 | 385 | |
|
371 | 386 | def addtopichook(topic, rewriter): |
|
372 | 387 | helphooks.setdefault(topic, []).append(rewriter) |
|
373 | 388 | |
|
374 | 389 | def makeitemsdoc(ui, topic, doc, marker, items, dedent=False): |
|
375 | 390 | """Extract docstring from the items key to function mapping, build a |
|
376 | 391 | single documentation block and use it to overwrite the marker in doc. |
|
377 | 392 | """ |
|
378 | 393 | entries = [] |
|
379 | 394 | for name in sorted(items): |
|
380 | 395 | text = (pycompat.getdoc(items[name]) or '').rstrip() |
|
381 | 396 | if (not text |
|
382 | 397 | or not ui.verbose and any(w in text for w in _exclkeywords)): |
|
383 | 398 | continue |
|
384 | 399 | text = gettext(text) |
|
385 | 400 | if dedent: |
|
386 | 401 | # Abuse latin1 to use textwrap.dedent() on bytes. |
|
387 | 402 | text = textwrap.dedent(text.decode('latin1')).encode('latin1') |
|
388 | 403 | lines = text.splitlines() |
|
389 | 404 | doclines = [(lines[0])] |
|
390 | 405 | for l in lines[1:]: |
|
391 | 406 | # Stop once we find some Python doctest |
|
392 | 407 | if l.strip().startswith('>>>'): |
|
393 | 408 | break |
|
394 | 409 | if dedent: |
|
395 | 410 | doclines.append(l.rstrip()) |
|
396 | 411 | else: |
|
397 | 412 | doclines.append(' ' + l.strip()) |
|
398 | 413 | entries.append('\n'.join(doclines)) |
|
399 | 414 | entries = '\n\n'.join(entries) |
|
400 | 415 | return doc.replace(marker, entries) |
|
401 | 416 | |
|
402 | 417 | def addtopicsymbols(topic, marker, symbols, dedent=False): |
|
403 | 418 | def add(ui, topic, doc): |
|
404 | 419 | return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent) |
|
405 | 420 | addtopichook(topic, add) |
|
406 | 421 | |
|
407 | 422 | addtopicsymbols('bundlespec', '.. bundlecompressionmarker', |
|
408 | 423 | util.bundlecompressiontopics()) |
|
409 | 424 | addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols) |
|
410 | 425 | addtopicsymbols('merge-tools', '.. internaltoolsmarker', |
|
411 | 426 | filemerge.internalsdoc) |
|
412 | 427 | addtopicsymbols('revisions', '.. predicatesmarker', revset.symbols) |
|
413 | 428 | addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords) |
|
414 | 429 | addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters) |
|
415 | 430 | addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs) |
|
416 | 431 | addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands, |
|
417 | 432 | dedent=True) |
|
418 | 433 | |
|
419 | 434 | def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None, |
|
420 | 435 | **opts): |
|
421 | 436 | ''' |
|
422 | 437 | Generate the help for 'name' as unformatted restructured text. If |
|
423 | 438 | 'name' is None, describe the commands available. |
|
424 | 439 | ''' |
|
425 | 440 | |
|
426 | 441 | opts = pycompat.byteskwargs(opts) |
|
427 | 442 | |
|
428 | 443 | def helpcmd(name, subtopic=None): |
|
429 | 444 | try: |
|
430 | 445 | aliases, entry = cmdutil.findcmd(name, commands.table, |
|
431 | 446 | strict=unknowncmd) |
|
432 | 447 | except error.AmbiguousCommand as inst: |
|
433 | 448 | # py3 fix: except vars can't be used outside the scope of the |
|
434 | 449 | # except block, nor can be used inside a lambda. python issue4617 |
|
435 | 450 | prefix = inst.args[0] |
|
436 | 451 | select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix) |
|
437 | 452 | rst = helplist(select) |
|
438 | 453 | return rst |
|
439 | 454 | |
|
440 | 455 | rst = [] |
|
441 | 456 | |
|
442 | 457 | # check if it's an invalid alias and display its error if it is |
|
443 | 458 | if getattr(entry[0], 'badalias', None): |
|
444 | 459 | rst.append(entry[0].badalias + '\n') |
|
445 | 460 | if entry[0].unknowncmd: |
|
446 | 461 | try: |
|
447 | 462 | rst.extend(helpextcmd(entry[0].cmdname)) |
|
448 | 463 | except error.UnknownCommand: |
|
449 | 464 | pass |
|
450 | 465 | return rst |
|
451 | 466 | |
|
452 | 467 | # synopsis |
|
453 | 468 | if len(entry) > 2: |
|
454 | 469 | if entry[2].startswith('hg'): |
|
455 | 470 | rst.append("%s\n" % entry[2]) |
|
456 | 471 | else: |
|
457 | 472 | rst.append('hg %s %s\n' % (aliases[0], entry[2])) |
|
458 | 473 | else: |
|
459 | 474 | rst.append('hg %s\n' % aliases[0]) |
|
460 | 475 | # aliases |
|
461 | 476 | if full and not ui.quiet and len(aliases) > 1: |
|
462 | 477 | rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:])) |
|
463 | 478 | rst.append('\n') |
|
464 | 479 | |
|
465 | 480 | # description |
|
466 | 481 | doc = gettext(pycompat.getdoc(entry[0])) |
|
467 | 482 | if not doc: |
|
468 | 483 | doc = _("(no help text available)") |
|
469 | 484 | if util.safehasattr(entry[0], 'definition'): # aliased command |
|
470 | 485 | source = entry[0].source |
|
471 | 486 | if entry[0].definition.startswith('!'): # shell alias |
|
472 | 487 | doc = (_('shell alias for: %s\n\n%s\n\ndefined by: %s\n') % |
|
473 | 488 | (entry[0].definition[1:], doc, source)) |
|
474 | 489 | else: |
|
475 | 490 | doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') % |
|
476 | 491 | (entry[0].definition, doc, source)) |
|
477 | 492 | doc = doc.splitlines(True) |
|
478 | 493 | if ui.quiet or not full: |
|
479 | 494 | rst.append(doc[0]) |
|
480 | 495 | else: |
|
481 | 496 | rst.extend(doc) |
|
482 | 497 | rst.append('\n') |
|
483 | 498 | |
|
484 | 499 | # check if this command shadows a non-trivial (multi-line) |
|
485 | 500 | # extension help text |
|
486 | 501 | try: |
|
487 | 502 | mod = extensions.find(name) |
|
488 | 503 | doc = gettext(pycompat.getdoc(mod)) or '' |
|
489 | 504 | if '\n' in doc.strip(): |
|
490 | 505 | msg = _("(use 'hg help -e %s' to show help for " |
|
491 | 506 | "the %s extension)") % (name, name) |
|
492 | 507 | rst.append('\n%s\n' % msg) |
|
493 | 508 | except KeyError: |
|
494 | 509 | pass |
|
495 | 510 | |
|
496 | 511 | # options |
|
497 | 512 | if not ui.quiet and entry[1]: |
|
498 | 513 | rst.append(optrst(_("options"), entry[1], ui.verbose)) |
|
499 | 514 | |
|
500 | 515 | if ui.verbose: |
|
501 | 516 | rst.append(optrst(_("global options"), |
|
502 | 517 | commands.globalopts, ui.verbose)) |
|
503 | 518 | |
|
504 | 519 | if not ui.verbose: |
|
505 | 520 | if not full: |
|
506 | 521 | rst.append(_("\n(use 'hg %s -h' to show more help)\n") |
|
507 | 522 | % name) |
|
508 | 523 | elif not ui.quiet: |
|
509 | 524 | rst.append(_('\n(some details hidden, use --verbose ' |
|
510 | 525 | 'to show complete help)')) |
|
511 | 526 | |
|
512 | 527 | return rst |
|
513 | 528 | |
|
514 | 529 | def helplist(select=None, **opts): |
|
515 | 530 | # Category -> list of commands |
|
516 | 531 | cats = {} |
|
517 | 532 | # Command -> short description |
|
518 | 533 | h = {} |
|
519 | 534 | # Command -> string showing synonyms |
|
520 | 535 | syns = {} |
|
521 | 536 | for c, e in commands.table.iteritems(): |
|
522 | 537 | fs = cmdutil.parsealiases(c) |
|
523 | 538 | f = fs[0] |
|
524 | 539 | syns[f] = ', '.join(fs) |
|
525 | 540 | func = e[0] |
|
526 | 541 | if select and not select(f): |
|
527 | 542 | continue |
|
543 | # Only list built-in commands (defined in commands.py) and aliases | |
|
544 | # (defined in dispatch.py), but not any other extensions. | |
|
545 | # We don't want a circular dependency between this file and | |
|
546 | # dispatch, so reference that by name. | |
|
547 | # TODO(rdamazio): Just show commands from all extensions. | |
|
528 | 548 | if (not select and name != 'shortlist' and |
|
529 |
func.__module__ != commands.__name__ |
|
|
549 | func.__module__ != commands.__name__ and | |
|
550 | func.__module__ != 'mercurial.dispatch'): | |
|
530 | 551 | continue |
|
531 | if name == "shortlist": | |
|
532 | if not getattr(func, 'helpbasic', False): | |
|
533 | continue | |
|
534 | 552 | doc = pycompat.getdoc(func) |
|
535 | if filtercmd(ui, f, name, doc): | |
|
553 | if filtercmd(ui, f, func, name, doc): | |
|
536 | 554 | continue |
|
537 | 555 | doc = gettext(doc) |
|
538 | 556 | if not doc: |
|
539 | 557 | doc = _("(no help text available)") |
|
540 | 558 | h[f] = doc.splitlines()[0].rstrip() |
|
541 | 559 | |
|
542 | 560 | cat = getattr(func, 'helpcategory', None) or ( |
|
543 | 561 | registrar.command.CATEGORY_NONE) |
|
544 | 562 | cats.setdefault(cat, []).append(f) |
|
545 | 563 | |
|
546 | 564 | rst = [] |
|
547 | 565 | if not h: |
|
548 | 566 | if not ui.quiet: |
|
549 | 567 | rst.append(_('no commands defined\n')) |
|
550 | 568 | return rst |
|
551 | 569 | |
|
552 | 570 | # Output top header. |
|
553 | 571 | if not ui.quiet: |
|
554 | 572 | if name == "shortlist": |
|
555 | 573 | rst.append(_('basic commands:\n\n')) |
|
556 | 574 | elif name == "debug": |
|
557 | 575 | rst.append(_('debug commands (internal and unsupported):\n\n')) |
|
558 | 576 | else: |
|
559 | 577 | rst.append(_('list of commands:\n')) |
|
560 | 578 | |
|
561 | 579 | def appendcmds(cmds): |
|
562 | 580 | cmds = sorted(cmds) |
|
563 | 581 | for c in cmds: |
|
564 | 582 | if ui.verbose: |
|
565 | 583 | rst.append(" :%s: %s\n" % (syns[c], h[c])) |
|
566 | 584 | else: |
|
567 | 585 | rst.append(' :%s: %s\n' % (c, h[c])) |
|
568 | 586 | |
|
569 | 587 | if name in ('shortlist', 'debug'): |
|
570 | 588 | # List without categories. |
|
571 | 589 | appendcmds(h) |
|
572 | 590 | else: |
|
573 | 591 | # Check that all categories have an order. |
|
574 | 592 | missing_order = set(cats.keys()) - set(CATEGORY_ORDER) |
|
575 | 593 | if missing_order: |
|
576 | 594 | ui.develwarn('help categories missing from CATEGORY_ORDER: %s' % |
|
577 | 595 | missing_order) |
|
578 | 596 | |
|
579 | 597 | # List per category. |
|
580 | 598 | for cat in CATEGORY_ORDER: |
|
581 | 599 | catfns = cats.get(cat, []) |
|
582 | 600 | if catfns: |
|
583 | 601 | if len(cats) > 1: |
|
584 | 602 | catname = gettext(CATEGORY_NAMES[cat]) |
|
585 | 603 | rst.append("\n%s:\n" % catname) |
|
586 | 604 | rst.append("\n") |
|
587 | 605 | appendcmds(catfns) |
|
588 | 606 | |
|
589 | 607 | ex = opts.get |
|
590 | 608 | anyopts = (ex(r'keyword') or not (ex(r'command') or ex(r'extension'))) |
|
591 | 609 | if not name and anyopts: |
|
592 | 610 | exts = listexts(_('enabled extensions:'), extensions.enabled()) |
|
593 | 611 | if exts: |
|
594 | 612 | rst.append('\n') |
|
595 | 613 | rst.extend(exts) |
|
596 | 614 | |
|
597 | 615 | rst.append(_("\nadditional help topics:\n")) |
|
598 | 616 | # Group commands by category. |
|
599 | 617 | topiccats = {} |
|
600 | 618 | for topic in helptable: |
|
601 | 619 | names, header, doc = topic[0:3] |
|
602 | 620 | if len(topic) > 3 and topic[3]: |
|
603 | 621 | category = topic[3] |
|
604 | 622 | else: |
|
605 | 623 | category = TOPIC_CATEGORY_NONE |
|
606 | 624 | |
|
607 | 625 | topicname = names[0] |
|
608 | 626 | if not filtertopic(ui, topicname): |
|
609 | 627 | topiccats.setdefault(category, []).append( |
|
610 | 628 | (topicname, header)) |
|
611 | 629 | |
|
612 | 630 | # Check that all categories have an order. |
|
613 | 631 | missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER) |
|
614 | 632 | if missing_order: |
|
615 | 633 | ui.develwarn( |
|
616 | 634 | 'help categories missing from TOPIC_CATEGORY_ORDER: %s' % |
|
617 | 635 | missing_order) |
|
618 | 636 | |
|
619 | 637 | # Output topics per category. |
|
620 | 638 | for cat in TOPIC_CATEGORY_ORDER: |
|
621 | 639 | topics = topiccats.get(cat, []) |
|
622 | 640 | if topics: |
|
623 | 641 | if len(topiccats) > 1: |
|
624 | 642 | catname = gettext(TOPIC_CATEGORY_NAMES[cat]) |
|
625 | 643 | rst.append("\n%s:\n" % catname) |
|
626 | 644 | rst.append("\n") |
|
627 | 645 | for t, desc in topics: |
|
628 | 646 | rst.append(" :%s: %s\n" % (t, desc)) |
|
629 | 647 | |
|
630 | 648 | if ui.quiet: |
|
631 | 649 | pass |
|
632 | 650 | elif ui.verbose: |
|
633 | 651 | rst.append('\n%s\n' % optrst(_("global options"), |
|
634 | 652 | commands.globalopts, ui.verbose)) |
|
635 | 653 | if name == 'shortlist': |
|
636 | 654 | rst.append(_("\n(use 'hg help' for the full list " |
|
637 | 655 | "of commands)\n")) |
|
638 | 656 | else: |
|
639 | 657 | if name == 'shortlist': |
|
640 | 658 | rst.append(_("\n(use 'hg help' for the full list of commands " |
|
641 | 659 | "or 'hg -v' for details)\n")) |
|
642 | 660 | elif name and not full: |
|
643 | 661 | rst.append(_("\n(use 'hg help %s' to show the full help " |
|
644 | 662 | "text)\n") % name) |
|
645 | 663 | elif name and syns and name in syns.keys(): |
|
646 | 664 | rst.append(_("\n(use 'hg help -v -e %s' to show built-in " |
|
647 | 665 | "aliases and global options)\n") % name) |
|
648 | 666 | else: |
|
649 | 667 | rst.append(_("\n(use 'hg help -v%s' to show built-in aliases " |
|
650 | 668 | "and global options)\n") |
|
651 | 669 | % (name and " " + name or "")) |
|
652 | 670 | return rst |
|
653 | 671 | |
|
654 | 672 | def helptopic(name, subtopic=None): |
|
655 | 673 | # Look for sub-topic entry first. |
|
656 | 674 | header, doc = None, None |
|
657 | 675 | if subtopic and name in subtopics: |
|
658 | 676 | for names, header, doc in subtopics[name]: |
|
659 | 677 | if subtopic in names: |
|
660 | 678 | break |
|
661 | 679 | |
|
662 | 680 | if not header: |
|
663 | 681 | for topic in helptable: |
|
664 | 682 | names, header, doc = topic[0:3] |
|
665 | 683 | if name in names: |
|
666 | 684 | break |
|
667 | 685 | else: |
|
668 | 686 | raise error.UnknownCommand(name) |
|
669 | 687 | |
|
670 | 688 | rst = [minirst.section(header)] |
|
671 | 689 | |
|
672 | 690 | # description |
|
673 | 691 | if not doc: |
|
674 | 692 | rst.append(" %s\n" % _("(no help text available)")) |
|
675 | 693 | if callable(doc): |
|
676 | 694 | rst += [" %s\n" % l for l in doc(ui).splitlines()] |
|
677 | 695 | |
|
678 | 696 | if not ui.verbose: |
|
679 | 697 | omitted = _('(some details hidden, use --verbose' |
|
680 | 698 | ' to show complete help)') |
|
681 | 699 | indicateomitted(rst, omitted) |
|
682 | 700 | |
|
683 | 701 | try: |
|
684 | 702 | cmdutil.findcmd(name, commands.table) |
|
685 | 703 | rst.append(_("\nuse 'hg help -c %s' to see help for " |
|
686 | 704 | "the %s command\n") % (name, name)) |
|
687 | 705 | except error.UnknownCommand: |
|
688 | 706 | pass |
|
689 | 707 | return rst |
|
690 | 708 | |
|
691 | 709 | def helpext(name, subtopic=None): |
|
692 | 710 | try: |
|
693 | 711 | mod = extensions.find(name) |
|
694 | 712 | doc = gettext(pycompat.getdoc(mod)) or _('no help text available') |
|
695 | 713 | except KeyError: |
|
696 | 714 | mod = None |
|
697 | 715 | doc = extensions.disabledext(name) |
|
698 | 716 | if not doc: |
|
699 | 717 | raise error.UnknownCommand(name) |
|
700 | 718 | |
|
701 | 719 | if '\n' not in doc: |
|
702 | 720 | head, tail = doc, "" |
|
703 | 721 | else: |
|
704 | 722 | head, tail = doc.split('\n', 1) |
|
705 | 723 | rst = [_('%s extension - %s\n\n') % (name.rpartition('.')[-1], head)] |
|
706 | 724 | if tail: |
|
707 | 725 | rst.extend(tail.splitlines(True)) |
|
708 | 726 | rst.append('\n') |
|
709 | 727 | |
|
710 | 728 | if not ui.verbose: |
|
711 | 729 | omitted = _('(some details hidden, use --verbose' |
|
712 | 730 | ' to show complete help)') |
|
713 | 731 | indicateomitted(rst, omitted) |
|
714 | 732 | |
|
715 | 733 | if mod: |
|
716 | 734 | try: |
|
717 | 735 | ct = mod.cmdtable |
|
718 | 736 | except AttributeError: |
|
719 | 737 | ct = {} |
|
720 | 738 | modcmds = set([c.partition('|')[0] for c in ct]) |
|
721 | 739 | rst.extend(helplist(modcmds.__contains__)) |
|
722 | 740 | else: |
|
723 | 741 | rst.append(_("(use 'hg help extensions' for information on enabling" |
|
724 | 742 | " extensions)\n")) |
|
725 | 743 | return rst |
|
726 | 744 | |
|
727 | 745 | def helpextcmd(name, subtopic=None): |
|
728 | 746 | cmd, ext, doc = extensions.disabledcmd(ui, name, |
|
729 | 747 | ui.configbool('ui', 'strict')) |
|
730 | 748 | doc = doc.splitlines()[0] |
|
731 | 749 | |
|
732 | 750 | rst = listexts(_("'%s' is provided by the following " |
|
733 | 751 | "extension:") % cmd, {ext: doc}, indent=4, |
|
734 | 752 | showdeprecated=True) |
|
735 | 753 | rst.append('\n') |
|
736 | 754 | rst.append(_("(use 'hg help extensions' for information on enabling " |
|
737 | 755 | "extensions)\n")) |
|
738 | 756 | return rst |
|
739 | 757 | |
|
740 | 758 | |
|
741 | 759 | rst = [] |
|
742 | 760 | kw = opts.get('keyword') |
|
743 | 761 | if kw or name is None and any(opts[o] for o in opts): |
|
744 | 762 | matches = topicmatch(ui, commands, name or '') |
|
745 | 763 | helpareas = [] |
|
746 | 764 | if opts.get('extension'): |
|
747 | 765 | helpareas += [('extensions', _('Extensions'))] |
|
748 | 766 | if opts.get('command'): |
|
749 | 767 | helpareas += [('commands', _('Commands'))] |
|
750 | 768 | if not helpareas: |
|
751 | 769 | helpareas = [('topics', _('Topics')), |
|
752 | 770 | ('commands', _('Commands')), |
|
753 | 771 | ('extensions', _('Extensions')), |
|
754 | 772 | ('extensioncommands', _('Extension Commands'))] |
|
755 | 773 | for t, title in helpareas: |
|
756 | 774 | if matches[t]: |
|
757 | 775 | rst.append('%s:\n\n' % title) |
|
758 | 776 | rst.extend(minirst.maketable(sorted(matches[t]), 1)) |
|
759 | 777 | rst.append('\n') |
|
760 | 778 | if not rst: |
|
761 | 779 | msg = _('no matches') |
|
762 | 780 | hint = _("try 'hg help' for a list of topics") |
|
763 | 781 | raise error.Abort(msg, hint=hint) |
|
764 | 782 | elif name and name != 'shortlist': |
|
765 | 783 | queries = [] |
|
766 | 784 | if unknowncmd: |
|
767 | 785 | queries += [helpextcmd] |
|
768 | 786 | if opts.get('extension'): |
|
769 | 787 | queries += [helpext] |
|
770 | 788 | if opts.get('command'): |
|
771 | 789 | queries += [helpcmd] |
|
772 | 790 | if not queries: |
|
773 | 791 | queries = (helptopic, helpcmd, helpext, helpextcmd) |
|
774 | 792 | for f in queries: |
|
775 | 793 | try: |
|
776 | 794 | rst = f(name, subtopic) |
|
777 | 795 | break |
|
778 | 796 | except error.UnknownCommand: |
|
779 | 797 | pass |
|
780 | 798 | else: |
|
781 | 799 | if unknowncmd: |
|
782 | 800 | raise error.UnknownCommand(name) |
|
783 | 801 | else: |
|
784 | 802 | msg = _('no such help topic: %s') % name |
|
785 | 803 | hint = _("try 'hg help --keyword %s'") % name |
|
786 | 804 | raise error.Abort(msg, hint=hint) |
|
787 | 805 | else: |
|
788 | 806 | # program name |
|
789 | 807 | if not ui.quiet: |
|
790 | 808 | rst = [_("Mercurial Distributed SCM\n"), '\n'] |
|
791 | 809 | rst.extend(helplist(None, **pycompat.strkwargs(opts))) |
|
792 | 810 | |
|
793 | 811 | return ''.join(rst) |
|
794 | 812 | |
|
795 | 813 | def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False, |
|
796 | 814 | full=True, **opts): |
|
797 | 815 | """get help for a given topic (as a dotted name) as rendered rst |
|
798 | 816 | |
|
799 | 817 | Either returns the rendered help text or raises an exception. |
|
800 | 818 | """ |
|
801 | 819 | if keep is None: |
|
802 | 820 | keep = [] |
|
803 | 821 | else: |
|
804 | 822 | keep = list(keep) # make a copy so we can mutate this later |
|
805 | 823 | |
|
806 | 824 | # <fullname> := <name>[.<subtopic][.<section>] |
|
807 | 825 | name = subtopic = section = None |
|
808 | 826 | if fullname is not None: |
|
809 | 827 | nameparts = fullname.split('.') |
|
810 | 828 | name = nameparts.pop(0) |
|
811 | 829 | if nameparts and name in subtopics: |
|
812 | 830 | subtopic = nameparts.pop(0) |
|
813 | 831 | if nameparts: |
|
814 | 832 | section = encoding.lower('.'.join(nameparts)) |
|
815 | 833 | |
|
816 | 834 | textwidth = ui.configint('ui', 'textwidth') |
|
817 | 835 | termwidth = ui.termwidth() - 2 |
|
818 | 836 | if textwidth <= 0 or termwidth < textwidth: |
|
819 | 837 | textwidth = termwidth |
|
820 | 838 | text = help_(ui, commands, name, |
|
821 | 839 | subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts) |
|
822 | 840 | |
|
823 | 841 | blocks, pruned = minirst.parse(text, keep=keep) |
|
824 | 842 | if 'verbose' in pruned: |
|
825 | 843 | keep.append('omitted') |
|
826 | 844 | else: |
|
827 | 845 | keep.append('notomitted') |
|
828 | 846 | blocks, pruned = minirst.parse(text, keep=keep) |
|
829 | 847 | if section: |
|
830 | 848 | blocks = minirst.filtersections(blocks, section) |
|
831 | 849 | |
|
832 | 850 | # We could have been given a weird ".foo" section without a name |
|
833 | 851 | # to look for, or we could have simply failed to found "foo.bar" |
|
834 | 852 | # because bar isn't a section of foo |
|
835 | 853 | if section and not (blocks and name): |
|
836 | 854 | raise error.Abort(_("help section not found: %s") % fullname) |
|
837 | 855 | |
|
838 | 856 | return minirst.formatplain(blocks, textwidth) |
@@ -1,487 +1,491 b'' | |||
|
1 | 1 | # registrar.py - utilities to register function for specific purpose |
|
2 | 2 | # |
|
3 | 3 | # Copyright FUJIWARA Katsunori <foozy@lares.dti.ne.jp> and others |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | from . import ( |
|
11 | 11 | configitems, |
|
12 | 12 | error, |
|
13 | 13 | pycompat, |
|
14 | 14 | util, |
|
15 | 15 | ) |
|
16 | 16 | |
|
17 | 17 | # unlike the other registered items, config options are neither functions or |
|
18 | 18 | # classes. Registering the option is just small function call. |
|
19 | 19 | # |
|
20 | 20 | # We still add the official API to the registrar module for consistency with |
|
21 | 21 | # the other items extensions want might to register. |
|
22 | 22 | configitem = configitems.getitemregister |
|
23 | 23 | |
|
24 | 24 | class _funcregistrarbase(object): |
|
25 | 25 | """Base of decorator to register a function for specific purpose |
|
26 | 26 | |
|
27 | 27 | This decorator stores decorated functions into own dict 'table'. |
|
28 | 28 | |
|
29 | 29 | The least derived class can be defined by overriding 'formatdoc', |
|
30 | 30 | for example:: |
|
31 | 31 | |
|
32 | 32 | class keyword(_funcregistrarbase): |
|
33 | 33 | _docformat = ":%s: %s" |
|
34 | 34 | |
|
35 | 35 | This should be used as below: |
|
36 | 36 | |
|
37 | 37 | keyword = registrar.keyword() |
|
38 | 38 | |
|
39 | 39 | @keyword('bar') |
|
40 | 40 | def barfunc(*args, **kwargs): |
|
41 | 41 | '''Explanation of bar keyword .... |
|
42 | 42 | ''' |
|
43 | 43 | pass |
|
44 | 44 | |
|
45 | 45 | In this case: |
|
46 | 46 | |
|
47 | 47 | - 'barfunc' is stored as 'bar' in '_table' of an instance 'keyword' above |
|
48 | 48 | - 'barfunc.__doc__' becomes ":bar: Explanation of bar keyword" |
|
49 | 49 | """ |
|
50 | 50 | def __init__(self, table=None): |
|
51 | 51 | if table is None: |
|
52 | 52 | self._table = {} |
|
53 | 53 | else: |
|
54 | 54 | self._table = table |
|
55 | 55 | |
|
56 | 56 | def __call__(self, decl, *args, **kwargs): |
|
57 | 57 | return lambda func: self._doregister(func, decl, *args, **kwargs) |
|
58 | 58 | |
|
59 | 59 | def _doregister(self, func, decl, *args, **kwargs): |
|
60 | 60 | name = self._getname(decl) |
|
61 | 61 | |
|
62 | 62 | if name in self._table: |
|
63 | 63 | msg = 'duplicate registration for name: "%s"' % name |
|
64 | 64 | raise error.ProgrammingError(msg) |
|
65 | 65 | |
|
66 | 66 | if func.__doc__ and not util.safehasattr(func, '_origdoc'): |
|
67 | 67 | doc = pycompat.sysbytes(func.__doc__).strip() |
|
68 | 68 | func._origdoc = doc |
|
69 | 69 | func.__doc__ = pycompat.sysstr(self._formatdoc(decl, doc)) |
|
70 | 70 | |
|
71 | 71 | self._table[name] = func |
|
72 | 72 | self._extrasetup(name, func, *args, **kwargs) |
|
73 | 73 | |
|
74 | 74 | return func |
|
75 | 75 | |
|
76 | 76 | def _parsefuncdecl(self, decl): |
|
77 | 77 | """Parse function declaration and return the name of function in it |
|
78 | 78 | """ |
|
79 | 79 | i = decl.find('(') |
|
80 | 80 | if i >= 0: |
|
81 | 81 | return decl[:i] |
|
82 | 82 | else: |
|
83 | 83 | return decl |
|
84 | 84 | |
|
85 | 85 | def _getname(self, decl): |
|
86 | 86 | """Return the name of the registered function from decl |
|
87 | 87 | |
|
88 | 88 | Derived class should override this, if it allows more |
|
89 | 89 | descriptive 'decl' string than just a name. |
|
90 | 90 | """ |
|
91 | 91 | return decl |
|
92 | 92 | |
|
93 | 93 | _docformat = None |
|
94 | 94 | |
|
95 | 95 | def _formatdoc(self, decl, doc): |
|
96 | 96 | """Return formatted document of the registered function for help |
|
97 | 97 | |
|
98 | 98 | 'doc' is '__doc__.strip()' of the registered function. |
|
99 | 99 | """ |
|
100 | 100 | return self._docformat % (decl, doc) |
|
101 | 101 | |
|
102 | 102 | def _extrasetup(self, name, func): |
|
103 | 103 | """Execute exra setup for registered function, if needed |
|
104 | 104 | """ |
|
105 | 105 | |
|
106 | 106 | class command(_funcregistrarbase): |
|
107 | 107 | """Decorator to register a command function to table |
|
108 | 108 | |
|
109 | 109 | This class receives a command table as its argument. The table should |
|
110 | 110 | be a dict. |
|
111 | 111 | |
|
112 | 112 | The created object can be used as a decorator for adding commands to |
|
113 | 113 | that command table. This accepts multiple arguments to define a command. |
|
114 | 114 | |
|
115 | 115 | The first argument is the command name (as bytes). |
|
116 | 116 | |
|
117 | 117 | The `options` keyword argument is an iterable of tuples defining command |
|
118 | 118 | arguments. See ``mercurial.fancyopts.fancyopts()`` for the format of each |
|
119 | 119 | tuple. |
|
120 | 120 | |
|
121 | 121 | The `synopsis` argument defines a short, one line summary of how to use the |
|
122 | 122 | command. This shows up in the help output. |
|
123 | 123 | |
|
124 | 124 | There are three arguments that control what repository (if any) is found |
|
125 | 125 | and passed to the decorated function: `norepo`, `optionalrepo`, and |
|
126 | 126 | `inferrepo`. |
|
127 | 127 | |
|
128 | 128 | The `norepo` argument defines whether the command does not require a |
|
129 | 129 | local repository. Most commands operate against a repository, thus the |
|
130 | 130 | default is False. When True, no repository will be passed. |
|
131 | 131 | |
|
132 | 132 | The `optionalrepo` argument defines whether the command optionally requires |
|
133 | 133 | a local repository. If no repository can be found, None will be passed |
|
134 | 134 | to the decorated function. |
|
135 | 135 | |
|
136 | 136 | The `inferrepo` argument defines whether to try to find a repository from |
|
137 | 137 | the command line arguments. If True, arguments will be examined for |
|
138 | 138 | potential repository locations. See ``findrepo()``. If a repository is |
|
139 | 139 | found, it will be used and passed to the decorated function. |
|
140 | 140 | |
|
141 | 141 | The `intents` argument defines a set of intended actions or capabilities |
|
142 | 142 | the command is taking. These intents can be used to affect the construction |
|
143 | 143 | of the repository object passed to the command. For example, commands |
|
144 | 144 | declaring that they are read-only could receive a repository that doesn't |
|
145 | 145 | have any methods allowing repository mutation. Other intents could be used |
|
146 | 146 | to prevent the command from running if the requested intent could not be |
|
147 | 147 | fulfilled. |
|
148 | 148 | |
|
149 | 149 | If `helpcategory` is set (usually to one of the constants in the help |
|
150 | 150 | module), the command will be displayed under that category in the help's |
|
151 | 151 | list of commands. |
|
152 | 152 | |
|
153 | 153 | The following intents are defined: |
|
154 | 154 | |
|
155 | 155 | readonly |
|
156 | 156 | The command is read-only |
|
157 | 157 | |
|
158 | 158 | The signature of the decorated function looks like this: |
|
159 | 159 | def cmd(ui[, repo] [, <args>] [, <options>]) |
|
160 | 160 | |
|
161 | 161 | `repo` is required if `norepo` is False. |
|
162 | 162 | `<args>` are positional args (or `*args`) arguments, of non-option |
|
163 | 163 | arguments from the command line. |
|
164 | 164 | `<options>` are keyword arguments (or `**options`) of option arguments |
|
165 | 165 | from the command line. |
|
166 | 166 | |
|
167 | 167 | See the WritingExtensions and MercurialApi documentation for more exhaustive |
|
168 | 168 | descriptions and examples. |
|
169 | 169 | """ |
|
170 | 170 | |
|
171 | 171 | # Command categories for grouping them in help output. |
|
172 | # These can also be specified for aliases, like: | |
|
173 | # [alias] | |
|
174 | # myalias = something | |
|
175 | # myalias:category = repo | |
|
172 | 176 | CATEGORY_REPO_CREATION = 'repo' |
|
173 | 177 | CATEGORY_REMOTE_REPO_MANAGEMENT = 'remote' |
|
174 | 178 | CATEGORY_COMMITTING = 'commit' |
|
175 | 179 | CATEGORY_CHANGE_MANAGEMENT = 'management' |
|
176 | 180 | CATEGORY_CHANGE_ORGANIZATION = 'organization' |
|
177 | 181 | CATEGORY_FILE_CONTENTS = 'files' |
|
178 | 182 | CATEGORY_CHANGE_NAVIGATION = 'navigation' |
|
179 | 183 | CATEGORY_WORKING_DIRECTORY = 'wdir' |
|
180 | 184 | CATEGORY_IMPORT_EXPORT = 'import' |
|
181 | 185 | CATEGORY_MAINTENANCE = 'maintenance' |
|
182 | 186 | CATEGORY_HELP = 'help' |
|
183 | 187 | CATEGORY_MISC = 'misc' |
|
184 | 188 | CATEGORY_NONE = 'none' |
|
185 | 189 | |
|
186 | 190 | def _doregister(self, func, name, options=(), synopsis=None, |
|
187 | 191 | norepo=False, optionalrepo=False, inferrepo=False, |
|
188 | 192 | intents=None, helpcategory=None, helpbasic=False): |
|
189 | 193 | func.norepo = norepo |
|
190 | 194 | func.optionalrepo = optionalrepo |
|
191 | 195 | func.inferrepo = inferrepo |
|
192 | 196 | func.intents = intents or set() |
|
193 | 197 | func.helpcategory = helpcategory |
|
194 | 198 | func.helpbasic = helpbasic |
|
195 | 199 | if synopsis: |
|
196 | 200 | self._table[name] = func, list(options), synopsis |
|
197 | 201 | else: |
|
198 | 202 | self._table[name] = func, list(options) |
|
199 | 203 | return func |
|
200 | 204 | |
|
201 | 205 | INTENT_READONLY = b'readonly' |
|
202 | 206 | |
|
203 | 207 | class revsetpredicate(_funcregistrarbase): |
|
204 | 208 | """Decorator to register revset predicate |
|
205 | 209 | |
|
206 | 210 | Usage:: |
|
207 | 211 | |
|
208 | 212 | revsetpredicate = registrar.revsetpredicate() |
|
209 | 213 | |
|
210 | 214 | @revsetpredicate('mypredicate(arg1, arg2[, arg3])') |
|
211 | 215 | def mypredicatefunc(repo, subset, x): |
|
212 | 216 | '''Explanation of this revset predicate .... |
|
213 | 217 | ''' |
|
214 | 218 | pass |
|
215 | 219 | |
|
216 | 220 | The first string argument is used also in online help. |
|
217 | 221 | |
|
218 | 222 | Optional argument 'safe' indicates whether a predicate is safe for |
|
219 | 223 | DoS attack (False by default). |
|
220 | 224 | |
|
221 | 225 | Optional argument 'takeorder' indicates whether a predicate function |
|
222 | 226 | takes ordering policy as the last argument. |
|
223 | 227 | |
|
224 | 228 | Optional argument 'weight' indicates the estimated run-time cost, useful |
|
225 | 229 | for static optimization, default is 1. Higher weight means more expensive. |
|
226 | 230 | Usually, revsets that are fast and return only one revision has a weight of |
|
227 | 231 | 0.5 (ex. a symbol); revsets with O(changelog) complexity and read only the |
|
228 | 232 | changelog have weight 10 (ex. author); revsets reading manifest deltas have |
|
229 | 233 | weight 30 (ex. adds); revset reading manifest contents have weight 100 |
|
230 | 234 | (ex. contains). Note: those values are flexible. If the revset has a |
|
231 | 235 | same big-O time complexity as 'contains', but with a smaller constant, it |
|
232 | 236 | might have a weight of 90. |
|
233 | 237 | |
|
234 | 238 | 'revsetpredicate' instance in example above can be used to |
|
235 | 239 | decorate multiple functions. |
|
236 | 240 | |
|
237 | 241 | Decorated functions are registered automatically at loading |
|
238 | 242 | extension, if an instance named as 'revsetpredicate' is used for |
|
239 | 243 | decorating in extension. |
|
240 | 244 | |
|
241 | 245 | Otherwise, explicit 'revset.loadpredicate()' is needed. |
|
242 | 246 | """ |
|
243 | 247 | _getname = _funcregistrarbase._parsefuncdecl |
|
244 | 248 | _docformat = "``%s``\n %s" |
|
245 | 249 | |
|
246 | 250 | def _extrasetup(self, name, func, safe=False, takeorder=False, weight=1): |
|
247 | 251 | func._safe = safe |
|
248 | 252 | func._takeorder = takeorder |
|
249 | 253 | func._weight = weight |
|
250 | 254 | |
|
251 | 255 | class filesetpredicate(_funcregistrarbase): |
|
252 | 256 | """Decorator to register fileset predicate |
|
253 | 257 | |
|
254 | 258 | Usage:: |
|
255 | 259 | |
|
256 | 260 | filesetpredicate = registrar.filesetpredicate() |
|
257 | 261 | |
|
258 | 262 | @filesetpredicate('mypredicate()') |
|
259 | 263 | def mypredicatefunc(mctx, x): |
|
260 | 264 | '''Explanation of this fileset predicate .... |
|
261 | 265 | ''' |
|
262 | 266 | pass |
|
263 | 267 | |
|
264 | 268 | The first string argument is used also in online help. |
|
265 | 269 | |
|
266 | 270 | Optional argument 'callstatus' indicates whether a predicate |
|
267 | 271 | implies 'matchctx.status()' at runtime or not (False, by |
|
268 | 272 | default). |
|
269 | 273 | |
|
270 | 274 | Optional argument 'weight' indicates the estimated run-time cost, useful |
|
271 | 275 | for static optimization, default is 1. Higher weight means more expensive. |
|
272 | 276 | There are predefined weights in the 'filesetlang' module. |
|
273 | 277 | |
|
274 | 278 | ====== ============================================================= |
|
275 | 279 | Weight Description and examples |
|
276 | 280 | ====== ============================================================= |
|
277 | 281 | 0.5 basic match patterns (e.g. a symbol) |
|
278 | 282 | 10 computing status (e.g. added()) or accessing a few files |
|
279 | 283 | 30 reading file content for each (e.g. grep()) |
|
280 | 284 | 50 scanning working directory (ignored()) |
|
281 | 285 | ====== ============================================================= |
|
282 | 286 | |
|
283 | 287 | 'filesetpredicate' instance in example above can be used to |
|
284 | 288 | decorate multiple functions. |
|
285 | 289 | |
|
286 | 290 | Decorated functions are registered automatically at loading |
|
287 | 291 | extension, if an instance named as 'filesetpredicate' is used for |
|
288 | 292 | decorating in extension. |
|
289 | 293 | |
|
290 | 294 | Otherwise, explicit 'fileset.loadpredicate()' is needed. |
|
291 | 295 | """ |
|
292 | 296 | _getname = _funcregistrarbase._parsefuncdecl |
|
293 | 297 | _docformat = "``%s``\n %s" |
|
294 | 298 | |
|
295 | 299 | def _extrasetup(self, name, func, callstatus=False, weight=1): |
|
296 | 300 | func._callstatus = callstatus |
|
297 | 301 | func._weight = weight |
|
298 | 302 | |
|
299 | 303 | class _templateregistrarbase(_funcregistrarbase): |
|
300 | 304 | """Base of decorator to register functions as template specific one |
|
301 | 305 | """ |
|
302 | 306 | _docformat = ":%s: %s" |
|
303 | 307 | |
|
304 | 308 | class templatekeyword(_templateregistrarbase): |
|
305 | 309 | """Decorator to register template keyword |
|
306 | 310 | |
|
307 | 311 | Usage:: |
|
308 | 312 | |
|
309 | 313 | templatekeyword = registrar.templatekeyword() |
|
310 | 314 | |
|
311 | 315 | # new API (since Mercurial 4.6) |
|
312 | 316 | @templatekeyword('mykeyword', requires={'repo', 'ctx'}) |
|
313 | 317 | def mykeywordfunc(context, mapping): |
|
314 | 318 | '''Explanation of this template keyword .... |
|
315 | 319 | ''' |
|
316 | 320 | pass |
|
317 | 321 | |
|
318 | 322 | # old API (DEPRECATED) |
|
319 | 323 | @templatekeyword('mykeyword') |
|
320 | 324 | def mykeywordfunc(repo, ctx, templ, cache, revcache, **args): |
|
321 | 325 | '''Explanation of this template keyword .... |
|
322 | 326 | ''' |
|
323 | 327 | pass |
|
324 | 328 | |
|
325 | 329 | The first string argument is used also in online help. |
|
326 | 330 | |
|
327 | 331 | Optional argument 'requires' should be a collection of resource names |
|
328 | 332 | which the template keyword depends on. This also serves as a flag to |
|
329 | 333 | switch to the new API. If 'requires' is unspecified, all template |
|
330 | 334 | keywords and resources are expanded to the function arguments. |
|
331 | 335 | |
|
332 | 336 | 'templatekeyword' instance in example above can be used to |
|
333 | 337 | decorate multiple functions. |
|
334 | 338 | |
|
335 | 339 | Decorated functions are registered automatically at loading |
|
336 | 340 | extension, if an instance named as 'templatekeyword' is used for |
|
337 | 341 | decorating in extension. |
|
338 | 342 | |
|
339 | 343 | Otherwise, explicit 'templatekw.loadkeyword()' is needed. |
|
340 | 344 | """ |
|
341 | 345 | |
|
342 | 346 | def _extrasetup(self, name, func, requires=None): |
|
343 | 347 | func._requires = requires |
|
344 | 348 | |
|
345 | 349 | class templatefilter(_templateregistrarbase): |
|
346 | 350 | """Decorator to register template filer |
|
347 | 351 | |
|
348 | 352 | Usage:: |
|
349 | 353 | |
|
350 | 354 | templatefilter = registrar.templatefilter() |
|
351 | 355 | |
|
352 | 356 | @templatefilter('myfilter', intype=bytes) |
|
353 | 357 | def myfilterfunc(text): |
|
354 | 358 | '''Explanation of this template filter .... |
|
355 | 359 | ''' |
|
356 | 360 | pass |
|
357 | 361 | |
|
358 | 362 | The first string argument is used also in online help. |
|
359 | 363 | |
|
360 | 364 | Optional argument 'intype' defines the type of the input argument, |
|
361 | 365 | which should be (bytes, int, templateutil.date, or None for any.) |
|
362 | 366 | |
|
363 | 367 | 'templatefilter' instance in example above can be used to |
|
364 | 368 | decorate multiple functions. |
|
365 | 369 | |
|
366 | 370 | Decorated functions are registered automatically at loading |
|
367 | 371 | extension, if an instance named as 'templatefilter' is used for |
|
368 | 372 | decorating in extension. |
|
369 | 373 | |
|
370 | 374 | Otherwise, explicit 'templatefilters.loadkeyword()' is needed. |
|
371 | 375 | """ |
|
372 | 376 | |
|
373 | 377 | def _extrasetup(self, name, func, intype=None): |
|
374 | 378 | func._intype = intype |
|
375 | 379 | |
|
376 | 380 | class templatefunc(_templateregistrarbase): |
|
377 | 381 | """Decorator to register template function |
|
378 | 382 | |
|
379 | 383 | Usage:: |
|
380 | 384 | |
|
381 | 385 | templatefunc = registrar.templatefunc() |
|
382 | 386 | |
|
383 | 387 | @templatefunc('myfunc(arg1, arg2[, arg3])', argspec='arg1 arg2 arg3', |
|
384 | 388 | requires={'ctx'}) |
|
385 | 389 | def myfuncfunc(context, mapping, args): |
|
386 | 390 | '''Explanation of this template function .... |
|
387 | 391 | ''' |
|
388 | 392 | pass |
|
389 | 393 | |
|
390 | 394 | The first string argument is used also in online help. |
|
391 | 395 | |
|
392 | 396 | If optional 'argspec' is defined, the function will receive 'args' as |
|
393 | 397 | a dict of named arguments. Otherwise 'args' is a list of positional |
|
394 | 398 | arguments. |
|
395 | 399 | |
|
396 | 400 | Optional argument 'requires' should be a collection of resource names |
|
397 | 401 | which the template function depends on. |
|
398 | 402 | |
|
399 | 403 | 'templatefunc' instance in example above can be used to |
|
400 | 404 | decorate multiple functions. |
|
401 | 405 | |
|
402 | 406 | Decorated functions are registered automatically at loading |
|
403 | 407 | extension, if an instance named as 'templatefunc' is used for |
|
404 | 408 | decorating in extension. |
|
405 | 409 | |
|
406 | 410 | Otherwise, explicit 'templatefuncs.loadfunction()' is needed. |
|
407 | 411 | """ |
|
408 | 412 | _getname = _funcregistrarbase._parsefuncdecl |
|
409 | 413 | |
|
410 | 414 | def _extrasetup(self, name, func, argspec=None, requires=()): |
|
411 | 415 | func._argspec = argspec |
|
412 | 416 | func._requires = requires |
|
413 | 417 | |
|
414 | 418 | class internalmerge(_funcregistrarbase): |
|
415 | 419 | """Decorator to register in-process merge tool |
|
416 | 420 | |
|
417 | 421 | Usage:: |
|
418 | 422 | |
|
419 | 423 | internalmerge = registrar.internalmerge() |
|
420 | 424 | |
|
421 | 425 | @internalmerge('mymerge', internalmerge.mergeonly, |
|
422 | 426 | onfailure=None, precheck=None, |
|
423 | 427 | binary=False, symlink=False): |
|
424 | 428 | def mymergefunc(repo, mynode, orig, fcd, fco, fca, |
|
425 | 429 | toolconf, files, labels=None): |
|
426 | 430 | '''Explanation of this internal merge tool .... |
|
427 | 431 | ''' |
|
428 | 432 | return 1, False # means "conflicted", "no deletion needed" |
|
429 | 433 | |
|
430 | 434 | The first string argument is used to compose actual merge tool name, |
|
431 | 435 | ":name" and "internal:name" (the latter is historical one). |
|
432 | 436 | |
|
433 | 437 | The second argument is one of merge types below: |
|
434 | 438 | |
|
435 | 439 | ========== ======== ======== ========= |
|
436 | 440 | merge type precheck premerge fullmerge |
|
437 | 441 | ========== ======== ======== ========= |
|
438 | 442 | nomerge x x x |
|
439 | 443 | mergeonly o x o |
|
440 | 444 | fullmerge o o o |
|
441 | 445 | ========== ======== ======== ========= |
|
442 | 446 | |
|
443 | 447 | Optional argument 'onfailure' is the format of warning message |
|
444 | 448 | to be used at failure of merging (target filename is specified |
|
445 | 449 | at formatting). Or, None or so, if warning message should be |
|
446 | 450 | suppressed. |
|
447 | 451 | |
|
448 | 452 | Optional argument 'precheck' is the function to be used |
|
449 | 453 | before actual invocation of internal merge tool itself. |
|
450 | 454 | It takes as same arguments as internal merge tool does, other than |
|
451 | 455 | 'files' and 'labels'. If it returns false value, merging is aborted |
|
452 | 456 | immediately (and file is marked as "unresolved"). |
|
453 | 457 | |
|
454 | 458 | Optional argument 'binary' is a binary files capability of internal |
|
455 | 459 | merge tool. 'nomerge' merge type implies binary=True. |
|
456 | 460 | |
|
457 | 461 | Optional argument 'symlink' is a symlinks capability of inetrnal |
|
458 | 462 | merge function. 'nomerge' merge type implies symlink=True. |
|
459 | 463 | |
|
460 | 464 | 'internalmerge' instance in example above can be used to |
|
461 | 465 | decorate multiple functions. |
|
462 | 466 | |
|
463 | 467 | Decorated functions are registered automatically at loading |
|
464 | 468 | extension, if an instance named as 'internalmerge' is used for |
|
465 | 469 | decorating in extension. |
|
466 | 470 | |
|
467 | 471 | Otherwise, explicit 'filemerge.loadinternalmerge()' is needed. |
|
468 | 472 | """ |
|
469 | 473 | _docformat = "``:%s``\n %s" |
|
470 | 474 | |
|
471 | 475 | # merge type definitions: |
|
472 | 476 | nomerge = None |
|
473 | 477 | mergeonly = 'mergeonly' # just the full merge, no premerge |
|
474 | 478 | fullmerge = 'fullmerge' # both premerge and merge |
|
475 | 479 | |
|
476 | 480 | def _extrasetup(self, name, func, mergetype, |
|
477 | 481 | onfailure=None, precheck=None, |
|
478 | 482 | binary=False, symlink=False): |
|
479 | 483 | func.mergetype = mergetype |
|
480 | 484 | func.onfailure = onfailure |
|
481 | 485 | func.precheck = precheck |
|
482 | 486 | |
|
483 | 487 | binarycap = binary or mergetype == self.nomerge |
|
484 | 488 | symlinkcap = symlink or mergetype == self.nomerge |
|
485 | 489 | |
|
486 | 490 | # actual capabilities, which this internal merge tool has |
|
487 | 491 | func.capabilities = {"binary": binarycap, "symlink": symlinkcap} |
@@ -1,718 +1,718 b'' | |||
|
1 | 1 | $ HGFOO=BAR; export HGFOO |
|
2 | 2 | $ cat >> $HGRCPATH <<EOF |
|
3 | 3 | > [alias] |
|
4 | 4 | > # should clobber ci but not commit (issue2993) |
|
5 | 5 | > ci = version |
|
6 | 6 | > myinit = init |
|
7 | 7 | > myinit:doc = This is my documented alias for init. |
|
8 | 8 | > myinit:help = [OPTIONS] [BLA] [BLE] |
|
9 | 9 | > mycommit = commit |
|
10 | 10 | > mycommit:doc = This is my alias with only doc. |
|
11 | 11 | > optionalrepo = showconfig alias.myinit |
|
12 | 12 | > cleanstatus = status -c |
|
13 | 13 | > cleanstatus:help = [ONLYHELPHERE] |
|
14 | 14 | > unknown = bargle |
|
15 | 15 | > ambiguous = s |
|
16 | 16 | > recursive = recursive |
|
17 | 17 | > disabled = email |
|
18 | 18 | > nodefinition = |
|
19 | 19 | > noclosingquotation = ' |
|
20 | 20 | > no--cwd = status --cwd elsewhere |
|
21 | 21 | > no-R = status -R elsewhere |
|
22 | 22 | > no--repo = status --repo elsewhere |
|
23 | 23 | > no--repository = status --repository elsewhere |
|
24 | 24 | > no--config = status --config a.config=1 |
|
25 | 25 | > mylog = log |
|
26 | 26 | > lognull = log -r null |
|
27 | 27 | > lognull:doc = Logs the null rev |
|
28 | 28 | > lognull:help = foo bar baz |
|
29 | 29 | > shortlog = log --template '{rev} {node|short} | {date|isodate}\n' |
|
30 | 30 | > positional = log --template '{\$2} {\$1} | {date|isodate}\n' |
|
31 | 31 | > dln = lognull --debug |
|
32 | 32 | > recursivedoc = dln |
|
33 | 33 | > recursivedoc:doc = Logs the null rev in debug mode |
|
34 | 34 | > nousage = rollback |
|
35 | 35 | > put = export -r 0 -o "\$FOO/%R.diff" |
|
36 | 36 | > blank = !printf '\n' |
|
37 | 37 | > self = !printf '\$0\n' |
|
38 | 38 | > echoall = !printf '\$@\n' |
|
39 | 39 | > echo1 = !printf '\$1\n' |
|
40 | 40 | > echo2 = !printf '\$2\n' |
|
41 | 41 | > echo13 = !printf '\$1 \$3\n' |
|
42 | 42 | > echotokens = !printf "%s\n" "\$@" |
|
43 | 43 | > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g' |
|
44 | 44 | > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g' |
|
45 | 45 | > rt = root |
|
46 | 46 | > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n" |
|
47 | 47 | > idalias = id |
|
48 | 48 | > idaliaslong = id |
|
49 | 49 | > idaliasshell = !echo test |
|
50 | 50 | > parentsshell1 = !echo one |
|
51 | 51 | > parentsshell2 = !echo two |
|
52 | 52 | > escaped1 = !printf 'test\$\$test\n' |
|
53 | 53 | > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"' |
|
54 | 54 | > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"' |
|
55 | 55 | > escaped4 = !printf '\$\$0 \$\$@\n' |
|
56 | 56 | > exit1 = !sh -c 'exit 1' |
|
57 | 57 | > |
|
58 | 58 | > [defaults] |
|
59 | 59 | > mylog = -q |
|
60 | 60 | > lognull = -q |
|
61 | 61 | > log = -v |
|
62 | 62 | > EOF |
|
63 | 63 | |
|
64 | 64 | basic |
|
65 | 65 | |
|
66 | 66 | $ hg myinit alias |
|
67 | 67 | |
|
68 | 68 | help |
|
69 | 69 | |
|
70 | 70 | $ hg help -c | grep myinit |
|
71 |
myinit |
|
|
71 | myinit This is my documented alias for init. | |
|
72 | 72 | $ hg help -c | grep mycommit |
|
73 |
mycommit |
|
|
73 | mycommit This is my alias with only doc. | |
|
74 | 74 | $ hg help -c | grep cleanstatus |
|
75 | cleanstatus show changed files in the working directory | |
|
75 | [1] | |
|
76 | 76 | $ hg help -c | grep lognull |
|
77 |
lognull |
|
|
77 | lognull Logs the null rev | |
|
78 | 78 | $ hg help -c | grep dln |
|
79 | dln Logs the null rev | |
|
79 | [1] | |
|
80 | 80 | $ hg help -c | grep recursivedoc |
|
81 |
recursivedoc |
|
|
81 | recursivedoc Logs the null rev in debug mode | |
|
82 | 82 | $ hg help myinit |
|
83 | 83 | hg myinit [OPTIONS] [BLA] [BLE] |
|
84 | 84 | |
|
85 | 85 | alias for: hg init |
|
86 | 86 | |
|
87 | 87 | This is my documented alias for init. |
|
88 | 88 | |
|
89 | 89 | defined by: * (glob) |
|
90 | 90 | */* (glob) (?) |
|
91 | 91 | */* (glob) (?) |
|
92 | 92 | */* (glob) (?) |
|
93 | 93 | |
|
94 | 94 | options: |
|
95 | 95 | |
|
96 | 96 | -e --ssh CMD specify ssh command to use |
|
97 | 97 | --remotecmd CMD specify hg command to run on the remote side |
|
98 | 98 | --insecure do not verify server certificate (ignoring web.cacerts |
|
99 | 99 | config) |
|
100 | 100 | |
|
101 | 101 | (some details hidden, use --verbose to show complete help) |
|
102 | 102 | |
|
103 | 103 | $ hg help mycommit |
|
104 | 104 | hg mycommit [OPTION]... [FILE]... |
|
105 | 105 | |
|
106 | 106 | alias for: hg commit |
|
107 | 107 | |
|
108 | 108 | This is my alias with only doc. |
|
109 | 109 | |
|
110 | 110 | defined by: * (glob) |
|
111 | 111 | */* (glob) (?) |
|
112 | 112 | */* (glob) (?) |
|
113 | 113 | */* (glob) (?) |
|
114 | 114 | |
|
115 | 115 | options ([+] can be repeated): |
|
116 | 116 | |
|
117 | 117 | -A --addremove mark new/missing files as added/removed before |
|
118 | 118 | committing |
|
119 | 119 | --close-branch mark a branch head as closed |
|
120 | 120 | --amend amend the parent of the working directory |
|
121 | 121 | -s --secret use the secret phase for committing |
|
122 | 122 | -e --edit invoke editor on commit messages |
|
123 | 123 | -i --interactive use interactive mode |
|
124 | 124 | -I --include PATTERN [+] include names matching the given patterns |
|
125 | 125 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
126 | 126 | -m --message TEXT use text as commit message |
|
127 | 127 | -l --logfile FILE read commit message from file |
|
128 | 128 | -d --date DATE record the specified date as commit date |
|
129 | 129 | -u --user USER record the specified user as committer |
|
130 | 130 | -S --subrepos recurse into subrepositories |
|
131 | 131 | |
|
132 | 132 | (some details hidden, use --verbose to show complete help) |
|
133 | 133 | |
|
134 | 134 | $ hg help cleanstatus |
|
135 | 135 | hg cleanstatus [ONLYHELPHERE] |
|
136 | 136 | |
|
137 | 137 | alias for: hg status -c |
|
138 | 138 | |
|
139 | 139 | show changed files in the working directory |
|
140 | 140 | |
|
141 | 141 | Show status of files in the repository. If names are given, only files |
|
142 | 142 | that match are shown. Files that are clean or ignored or the source of a |
|
143 | 143 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
144 | 144 | -C/--copies or -A/--all are given. Unless options described with "show |
|
145 | 145 | only ..." are given, the options -mardu are used. |
|
146 | 146 | |
|
147 | 147 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
148 | 148 | explicitly requested with -u/--unknown or -i/--ignored. |
|
149 | 149 | |
|
150 | 150 | Note: |
|
151 | 151 | 'hg status' may appear to disagree with diff if permissions have |
|
152 | 152 | changed or a merge has occurred. The standard diff format does not |
|
153 | 153 | report permission changes and diff only reports changes relative to one |
|
154 | 154 | merge parent. |
|
155 | 155 | |
|
156 | 156 | If one revision is given, it is used as the base revision. If two |
|
157 | 157 | revisions are given, the differences between them are shown. The --change |
|
158 | 158 | option can also be used as a shortcut to list the changed files of a |
|
159 | 159 | revision from its first parent. |
|
160 | 160 | |
|
161 | 161 | The codes used to show the status of files are: |
|
162 | 162 | |
|
163 | 163 | M = modified |
|
164 | 164 | A = added |
|
165 | 165 | R = removed |
|
166 | 166 | C = clean |
|
167 | 167 | ! = missing (deleted by non-hg command, but still tracked) |
|
168 | 168 | ? = not tracked |
|
169 | 169 | I = ignored |
|
170 | 170 | = origin of the previous file (with --copies) |
|
171 | 171 | |
|
172 | 172 | Returns 0 on success. |
|
173 | 173 | |
|
174 | 174 | defined by: * (glob) |
|
175 | 175 | */* (glob) (?) |
|
176 | 176 | */* (glob) (?) |
|
177 | 177 | */* (glob) (?) |
|
178 | 178 | |
|
179 | 179 | options ([+] can be repeated): |
|
180 | 180 | |
|
181 | 181 | -A --all show status of all files |
|
182 | 182 | -m --modified show only modified files |
|
183 | 183 | -a --added show only added files |
|
184 | 184 | -r --removed show only removed files |
|
185 | 185 | -d --deleted show only deleted (but tracked) files |
|
186 | 186 | -c --clean show only files without changes |
|
187 | 187 | -u --unknown show only unknown (not tracked) files |
|
188 | 188 | -i --ignored show only ignored files |
|
189 | 189 | -n --no-status hide status prefix |
|
190 | 190 | -C --copies show source of copied files |
|
191 | 191 | -0 --print0 end filenames with NUL, for use with xargs |
|
192 | 192 | --rev REV [+] show difference from revision |
|
193 | 193 | --change REV list the changed files of a revision |
|
194 | 194 | -I --include PATTERN [+] include names matching the given patterns |
|
195 | 195 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
196 | 196 | -S --subrepos recurse into subrepositories |
|
197 | 197 | -T --template TEMPLATE display with template |
|
198 | 198 | |
|
199 | 199 | (some details hidden, use --verbose to show complete help) |
|
200 | 200 | |
|
201 | 201 | $ hg help recursivedoc | head -n 5 |
|
202 | 202 | hg recursivedoc foo bar baz |
|
203 | 203 | |
|
204 | 204 | alias for: hg dln |
|
205 | 205 | |
|
206 | 206 | Logs the null rev in debug mode |
|
207 | 207 | |
|
208 | 208 | unknown |
|
209 | 209 | |
|
210 | 210 | $ hg unknown |
|
211 | 211 | abort: alias 'unknown' resolves to unknown command 'bargle' |
|
212 | 212 | [255] |
|
213 | 213 | $ hg help unknown |
|
214 | 214 | alias 'unknown' resolves to unknown command 'bargle' |
|
215 | 215 | |
|
216 | 216 | |
|
217 | 217 | ambiguous |
|
218 | 218 | |
|
219 | 219 | $ hg ambiguous |
|
220 | 220 | abort: alias 'ambiguous' resolves to ambiguous command 's' |
|
221 | 221 | [255] |
|
222 | 222 | $ hg help ambiguous |
|
223 | 223 | alias 'ambiguous' resolves to ambiguous command 's' |
|
224 | 224 | |
|
225 | 225 | |
|
226 | 226 | recursive |
|
227 | 227 | |
|
228 | 228 | $ hg recursive |
|
229 | 229 | abort: alias 'recursive' resolves to unknown command 'recursive' |
|
230 | 230 | [255] |
|
231 | 231 | $ hg help recursive |
|
232 | 232 | alias 'recursive' resolves to unknown command 'recursive' |
|
233 | 233 | |
|
234 | 234 | |
|
235 | 235 | disabled |
|
236 | 236 | |
|
237 | 237 | $ hg disabled |
|
238 | 238 | abort: alias 'disabled' resolves to unknown command 'email' |
|
239 | 239 | ('email' is provided by 'patchbomb' extension) |
|
240 | 240 | [255] |
|
241 | 241 | $ hg help disabled |
|
242 | 242 | alias 'disabled' resolves to unknown command 'email' |
|
243 | 243 | |
|
244 | 244 | 'email' is provided by the following extension: |
|
245 | 245 | |
|
246 | 246 | patchbomb command to send changesets as (a series of) patch emails |
|
247 | 247 | |
|
248 | 248 | (use 'hg help extensions' for information on enabling extensions) |
|
249 | 249 | |
|
250 | 250 | |
|
251 | 251 | no definition |
|
252 | 252 | |
|
253 | 253 | $ hg nodef |
|
254 | 254 | abort: no definition for alias 'nodefinition' |
|
255 | 255 | [255] |
|
256 | 256 | $ hg help nodef |
|
257 | 257 | no definition for alias 'nodefinition' |
|
258 | 258 | |
|
259 | 259 | |
|
260 | 260 | no closing quotation |
|
261 | 261 | |
|
262 | 262 | $ hg noclosing |
|
263 | 263 | abort: error in definition for alias 'noclosingquotation': No closing quotation |
|
264 | 264 | [255] |
|
265 | 265 | $ hg help noclosing |
|
266 | 266 | error in definition for alias 'noclosingquotation': No closing quotation |
|
267 | 267 | |
|
268 | 268 | "--" in alias definition should be preserved |
|
269 | 269 | |
|
270 | 270 | $ hg --config alias.dash='cat --' -R alias dash -r0 |
|
271 | 271 | abort: -r0 not under root '$TESTTMP/alias' |
|
272 | 272 | (consider using '--cwd alias') |
|
273 | 273 | [255] |
|
274 | 274 | |
|
275 | 275 | invalid options |
|
276 | 276 | |
|
277 | 277 | $ hg no--cwd |
|
278 | 278 | abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line |
|
279 | 279 | [255] |
|
280 | 280 | $ hg help no--cwd |
|
281 | 281 | error in definition for alias 'no--cwd': --cwd may only be given on the |
|
282 | 282 | command line |
|
283 | 283 | $ hg no-R |
|
284 | 284 | abort: error in definition for alias 'no-R': -R may only be given on the command line |
|
285 | 285 | [255] |
|
286 | 286 | $ hg help no-R |
|
287 | 287 | error in definition for alias 'no-R': -R may only be given on the command line |
|
288 | 288 | $ hg no--repo |
|
289 | 289 | abort: error in definition for alias 'no--repo': --repo may only be given on the command line |
|
290 | 290 | [255] |
|
291 | 291 | $ hg help no--repo |
|
292 | 292 | error in definition for alias 'no--repo': --repo may only be given on the |
|
293 | 293 | command line |
|
294 | 294 | $ hg no--repository |
|
295 | 295 | abort: error in definition for alias 'no--repository': --repository may only be given on the command line |
|
296 | 296 | [255] |
|
297 | 297 | $ hg help no--repository |
|
298 | 298 | error in definition for alias 'no--repository': --repository may only be given |
|
299 | 299 | on the command line |
|
300 | 300 | $ hg no--config |
|
301 | 301 | abort: error in definition for alias 'no--config': --config may only be given on the command line |
|
302 | 302 | [255] |
|
303 | 303 | $ hg no --config alias.no='--repo elsewhere --cwd elsewhere status' |
|
304 | 304 | abort: error in definition for alias 'no': --repo/--cwd may only be given on the command line |
|
305 | 305 | [255] |
|
306 | 306 | $ hg no --config alias.no='--repo elsewhere' |
|
307 | 307 | abort: error in definition for alias 'no': --repo may only be given on the command line |
|
308 | 308 | [255] |
|
309 | 309 | |
|
310 | 310 | optional repository |
|
311 | 311 | |
|
312 | 312 | #if no-outer-repo |
|
313 | 313 | $ hg optionalrepo |
|
314 | 314 | init |
|
315 | 315 | #endif |
|
316 | 316 | $ cd alias |
|
317 | 317 | $ cat > .hg/hgrc <<EOF |
|
318 | 318 | > [alias] |
|
319 | 319 | > myinit = init -q |
|
320 | 320 | > EOF |
|
321 | 321 | $ hg optionalrepo |
|
322 | 322 | init -q |
|
323 | 323 | |
|
324 | 324 | no usage |
|
325 | 325 | |
|
326 | 326 | $ hg nousage |
|
327 | 327 | no rollback information available |
|
328 | 328 | [1] |
|
329 | 329 | |
|
330 | 330 | $ echo foo > foo |
|
331 | 331 | $ hg commit -Amfoo |
|
332 | 332 | adding foo |
|
333 | 333 | |
|
334 | 334 | infer repository |
|
335 | 335 | |
|
336 | 336 | $ cd .. |
|
337 | 337 | |
|
338 | 338 | #if no-outer-repo |
|
339 | 339 | $ hg shortlog alias/foo |
|
340 | 340 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
341 | 341 | #endif |
|
342 | 342 | |
|
343 | 343 | $ cd alias |
|
344 | 344 | |
|
345 | 345 | with opts |
|
346 | 346 | |
|
347 | 347 | $ hg cleanst |
|
348 | 348 | C foo |
|
349 | 349 | |
|
350 | 350 | |
|
351 | 351 | with opts and whitespace |
|
352 | 352 | |
|
353 | 353 | $ hg shortlog |
|
354 | 354 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
355 | 355 | |
|
356 | 356 | positional arguments |
|
357 | 357 | |
|
358 | 358 | $ hg positional |
|
359 | 359 | abort: too few arguments for command alias |
|
360 | 360 | [255] |
|
361 | 361 | $ hg positional a |
|
362 | 362 | abort: too few arguments for command alias |
|
363 | 363 | [255] |
|
364 | 364 | $ hg positional 'node|short' rev |
|
365 | 365 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
366 | 366 | |
|
367 | 367 | interaction with defaults |
|
368 | 368 | |
|
369 | 369 | $ hg mylog |
|
370 | 370 | 0:e63c23eaa88a |
|
371 | 371 | $ hg lognull |
|
372 | 372 | -1:000000000000 |
|
373 | 373 | |
|
374 | 374 | |
|
375 | 375 | properly recursive |
|
376 | 376 | |
|
377 | 377 | $ hg dln |
|
378 | 378 | changeset: -1:0000000000000000000000000000000000000000 |
|
379 | 379 | phase: public |
|
380 | 380 | parent: -1:0000000000000000000000000000000000000000 |
|
381 | 381 | parent: -1:0000000000000000000000000000000000000000 |
|
382 | 382 | manifest: -1:0000000000000000000000000000000000000000 |
|
383 | 383 | user: |
|
384 | 384 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
385 | 385 | extra: branch=default |
|
386 | 386 | |
|
387 | 387 | |
|
388 | 388 | |
|
389 | 389 | path expanding |
|
390 | 390 | |
|
391 | 391 | $ FOO=`pwd` hg put |
|
392 | 392 | $ cat 0.diff |
|
393 | 393 | # HG changeset patch |
|
394 | 394 | # User test |
|
395 | 395 | # Date 0 0 |
|
396 | 396 | # Thu Jan 01 00:00:00 1970 +0000 |
|
397 | 397 | # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0 |
|
398 | 398 | # Parent 0000000000000000000000000000000000000000 |
|
399 | 399 | foo |
|
400 | 400 | |
|
401 | 401 | diff -r 000000000000 -r e63c23eaa88a foo |
|
402 | 402 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
403 | 403 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
404 | 404 | @@ -0,0 +1,1 @@ |
|
405 | 405 | +foo |
|
406 | 406 | |
|
407 | 407 | |
|
408 | 408 | simple shell aliases |
|
409 | 409 | |
|
410 | 410 | $ hg blank |
|
411 | 411 | |
|
412 | 412 | $ hg blank foo |
|
413 | 413 | |
|
414 | 414 | $ hg self |
|
415 | 415 | self |
|
416 | 416 | $ hg echoall |
|
417 | 417 | |
|
418 | 418 | $ hg echoall foo |
|
419 | 419 | foo |
|
420 | 420 | $ hg echoall 'test $2' foo |
|
421 | 421 | test $2 foo |
|
422 | 422 | $ hg echoall 'test $@' foo '$@' |
|
423 | 423 | test $@ foo $@ |
|
424 | 424 | $ hg echoall 'test "$@"' foo '"$@"' |
|
425 | 425 | test "$@" foo "$@" |
|
426 | 426 | $ hg echo1 foo bar baz |
|
427 | 427 | foo |
|
428 | 428 | $ hg echo2 foo bar baz |
|
429 | 429 | bar |
|
430 | 430 | $ hg echo13 foo bar baz test |
|
431 | 431 | foo baz |
|
432 | 432 | $ hg echo2 foo |
|
433 | 433 | |
|
434 | 434 | $ hg echotokens |
|
435 | 435 | |
|
436 | 436 | $ hg echotokens foo 'bar $1 baz' |
|
437 | 437 | foo |
|
438 | 438 | bar $1 baz |
|
439 | 439 | $ hg echotokens 'test $2' foo |
|
440 | 440 | test $2 |
|
441 | 441 | foo |
|
442 | 442 | $ hg echotokens 'test $@' foo '$@' |
|
443 | 443 | test $@ |
|
444 | 444 | foo |
|
445 | 445 | $@ |
|
446 | 446 | $ hg echotokens 'test "$@"' foo '"$@"' |
|
447 | 447 | test "$@" |
|
448 | 448 | foo |
|
449 | 449 | "$@" |
|
450 | 450 | $ echo bar > bar |
|
451 | 451 | $ hg commit -qA -m bar |
|
452 | 452 | $ hg count . |
|
453 | 453 | 1 |
|
454 | 454 | $ hg count 'branch(default)' |
|
455 | 455 | 2 |
|
456 | 456 | $ hg mcount -r '"branch(default)"' |
|
457 | 457 | 2 |
|
458 | 458 | |
|
459 | 459 | $ hg tglog |
|
460 | 460 | @ 1:042423737847: 'bar' |
|
461 | 461 | | |
|
462 | 462 | o 0:e63c23eaa88a: 'foo' |
|
463 | 463 | |
|
464 | 464 | |
|
465 | 465 | |
|
466 | 466 | shadowing |
|
467 | 467 | |
|
468 | 468 | $ hg i |
|
469 | 469 | hg: command 'i' is ambiguous: |
|
470 | 470 | idalias idaliaslong idaliasshell identify import incoming init |
|
471 | 471 | [255] |
|
472 | 472 | $ hg id |
|
473 | 473 | 042423737847 tip |
|
474 | 474 | $ hg ida |
|
475 | 475 | hg: command 'ida' is ambiguous: |
|
476 | 476 | idalias idaliaslong idaliasshell |
|
477 | 477 | [255] |
|
478 | 478 | $ hg idalias |
|
479 | 479 | 042423737847 tip |
|
480 | 480 | $ hg idaliasl |
|
481 | 481 | 042423737847 tip |
|
482 | 482 | $ hg idaliass |
|
483 | 483 | test |
|
484 | 484 | $ hg parentsshell |
|
485 | 485 | hg: command 'parentsshell' is ambiguous: |
|
486 | 486 | parentsshell1 parentsshell2 |
|
487 | 487 | [255] |
|
488 | 488 | $ hg parentsshell1 |
|
489 | 489 | one |
|
490 | 490 | $ hg parentsshell2 |
|
491 | 491 | two |
|
492 | 492 | |
|
493 | 493 | |
|
494 | 494 | shell aliases with global options |
|
495 | 495 | |
|
496 | 496 | $ hg init sub |
|
497 | 497 | $ cd sub |
|
498 | 498 | $ hg count 'branch(default)' |
|
499 | 499 | abort: unknown revision 'default'! |
|
500 | 500 | 0 |
|
501 | 501 | $ hg -v count 'branch(default)' |
|
502 | 502 | abort: unknown revision 'default'! |
|
503 | 503 | 0 |
|
504 | 504 | $ hg -R .. count 'branch(default)' |
|
505 | 505 | abort: unknown revision 'default'! |
|
506 | 506 | 0 |
|
507 | 507 | $ hg --cwd .. count 'branch(default)' |
|
508 | 508 | 2 |
|
509 | 509 | $ hg echoall --cwd .. |
|
510 | 510 | |
|
511 | 511 | |
|
512 | 512 | "--" passed to shell alias should be preserved |
|
513 | 513 | |
|
514 | 514 | $ hg --config alias.printf='!printf "$@"' printf '%s %s %s\n' -- --cwd .. |
|
515 | 515 | -- --cwd .. |
|
516 | 516 | |
|
517 | 517 | repo specific shell aliases |
|
518 | 518 | |
|
519 | 519 | $ cat >> .hg/hgrc <<EOF |
|
520 | 520 | > [alias] |
|
521 | 521 | > subalias = !echo sub |
|
522 | 522 | > EOF |
|
523 | 523 | $ cat >> ../.hg/hgrc <<EOF |
|
524 | 524 | > [alias] |
|
525 | 525 | > mainalias = !echo main |
|
526 | 526 | > EOF |
|
527 | 527 | |
|
528 | 528 | |
|
529 | 529 | shell alias defined in current repo |
|
530 | 530 | |
|
531 | 531 | $ hg subalias |
|
532 | 532 | sub |
|
533 | 533 | $ hg --cwd .. subalias > /dev/null |
|
534 | 534 | hg: unknown command 'subalias' |
|
535 | 535 | (did you mean idalias?) |
|
536 | 536 | [255] |
|
537 | 537 | $ hg -R .. subalias > /dev/null |
|
538 | 538 | hg: unknown command 'subalias' |
|
539 | 539 | (did you mean idalias?) |
|
540 | 540 | [255] |
|
541 | 541 | |
|
542 | 542 | |
|
543 | 543 | shell alias defined in other repo |
|
544 | 544 | |
|
545 | 545 | $ hg mainalias > /dev/null |
|
546 | 546 | hg: unknown command 'mainalias' |
|
547 | 547 | (did you mean idalias?) |
|
548 | 548 | [255] |
|
549 | 549 | $ hg -R .. mainalias |
|
550 | 550 | main |
|
551 | 551 | $ hg --cwd .. mainalias |
|
552 | 552 | main |
|
553 | 553 | |
|
554 | 554 | typos get useful suggestions |
|
555 | 555 | $ hg --cwd .. manalias |
|
556 | 556 | hg: unknown command 'manalias' |
|
557 | 557 | (did you mean one of idalias, mainalias, manifest?) |
|
558 | 558 | [255] |
|
559 | 559 | |
|
560 | 560 | shell aliases with escaped $ chars |
|
561 | 561 | |
|
562 | 562 | $ hg escaped1 |
|
563 | 563 | test$test |
|
564 | 564 | $ hg escaped2 |
|
565 | 565 | HGFOO is BAR |
|
566 | 566 | $ hg escaped3 HGFOO |
|
567 | 567 | HGFOO is BAR |
|
568 | 568 | $ hg escaped4 test |
|
569 | 569 | $0 $@ |
|
570 | 570 | |
|
571 | 571 | abbreviated name, which matches against both shell alias and the |
|
572 | 572 | command provided extension, should be aborted. |
|
573 | 573 | |
|
574 | 574 | $ cat >> .hg/hgrc <<EOF |
|
575 | 575 | > [extensions] |
|
576 | 576 | > hgext.rebase = |
|
577 | 577 | > EOF |
|
578 | 578 | #if windows |
|
579 | 579 | $ cat >> .hg/hgrc <<EOF |
|
580 | 580 | > [alias] |
|
581 | 581 | > rebate = !echo this is %HG_ARGS% |
|
582 | 582 | > EOF |
|
583 | 583 | #else |
|
584 | 584 | $ cat >> .hg/hgrc <<EOF |
|
585 | 585 | > [alias] |
|
586 | 586 | > rebate = !echo this is \$HG_ARGS |
|
587 | 587 | > EOF |
|
588 | 588 | #endif |
|
589 | 589 | $ cat >> .hg/hgrc <<EOF |
|
590 | 590 | > rebate:doc = This is my alias which just prints something. |
|
591 | 591 | > rebate:help = [MYARGS] |
|
592 | 592 | > EOF |
|
593 | 593 | $ hg reba |
|
594 | 594 | hg: command 'reba' is ambiguous: |
|
595 | 595 | rebase rebate |
|
596 | 596 | [255] |
|
597 | 597 | $ hg rebat |
|
598 | 598 | this is rebate |
|
599 | 599 | $ hg rebat --foo-bar |
|
600 | 600 | this is rebate --foo-bar |
|
601 | 601 | |
|
602 | 602 | help for a shell alias |
|
603 | 603 | |
|
604 | 604 | $ hg help -c | grep rebate |
|
605 |
rebate |
|
|
605 | rebate This is my alias which just prints something. | |
|
606 | 606 | $ hg help rebate |
|
607 | 607 | hg rebate [MYARGS] |
|
608 | 608 | |
|
609 | 609 | shell alias for: echo this is %HG_ARGS% (windows !) |
|
610 | 610 | shell alias for: echo this is $HG_ARGS (no-windows !) |
|
611 | 611 | |
|
612 | 612 | This is my alias which just prints something. |
|
613 | 613 | |
|
614 | 614 | defined by:* (glob) |
|
615 | 615 | */* (glob) (?) |
|
616 | 616 | */* (glob) (?) |
|
617 | 617 | */* (glob) (?) |
|
618 | 618 | |
|
619 | 619 | (some details hidden, use --verbose to show complete help) |
|
620 | 620 | |
|
621 | 621 | invalid character in user-specified help |
|
622 | 622 | |
|
623 | 623 | >>> with open('.hg/hgrc', 'ab') as f: |
|
624 | 624 | ... f.write(b'[alias]\n' |
|
625 | 625 | ... b'invaliddoc = log\n' |
|
626 | 626 | ... b'invaliddoc:doc = \xc0\n' |
|
627 | 627 | ... b'invalidhelp = log\n' |
|
628 | 628 | ... b'invalidhelp:help = \xc0\n') and None |
|
629 | 629 | $ hg help invaliddoc |
|
630 | 630 | non-ASCII character in alias definition 'invaliddoc:doc' |
|
631 | 631 | $ hg help invalidhelp |
|
632 | 632 | non-ASCII character in alias definition 'invalidhelp:help' |
|
633 | 633 | $ hg invaliddoc |
|
634 | 634 | abort: non-ASCII character in alias definition 'invaliddoc:doc' |
|
635 | 635 | [255] |
|
636 | 636 | $ hg invalidhelp |
|
637 | 637 | abort: non-ASCII character in alias definition 'invalidhelp:help' |
|
638 | 638 | [255] |
|
639 | 639 | |
|
640 | 640 | invalid arguments |
|
641 | 641 | |
|
642 | 642 | $ hg rt foo |
|
643 | 643 | hg rt: invalid arguments |
|
644 | 644 | hg rt |
|
645 | 645 | |
|
646 | 646 | alias for: hg root |
|
647 | 647 | |
|
648 | 648 | (use 'hg rt -h' to show more help) |
|
649 | 649 | [255] |
|
650 | 650 | |
|
651 | 651 | invalid global arguments for normal commands, aliases, and shell aliases |
|
652 | 652 | |
|
653 | 653 | $ hg --invalid root |
|
654 | 654 | hg: option --invalid not recognized |
|
655 | 655 | (use 'hg help -v' for a list of global options) |
|
656 | 656 | [255] |
|
657 | 657 | $ hg --invalid mylog |
|
658 | 658 | hg: option --invalid not recognized |
|
659 | 659 | (use 'hg help -v' for a list of global options) |
|
660 | 660 | [255] |
|
661 | 661 | $ hg --invalid blank |
|
662 | 662 | hg: option --invalid not recognized |
|
663 | 663 | (use 'hg help -v' for a list of global options) |
|
664 | 664 | [255] |
|
665 | 665 | |
|
666 | 666 | environment variable changes in alias commands |
|
667 | 667 | |
|
668 | 668 | $ cat > $TESTTMP/expandalias.py <<EOF |
|
669 | 669 | > import os |
|
670 | 670 | > from mercurial import cmdutil, commands, registrar |
|
671 | 671 | > cmdtable = {} |
|
672 | 672 | > command = registrar.command(cmdtable) |
|
673 | 673 | > @command(b'expandalias') |
|
674 | 674 | > def expandalias(ui, repo, name): |
|
675 | 675 | > alias = cmdutil.findcmd(name, commands.table)[1][0] |
|
676 | 676 | > ui.write(b'%s args: %s\n' % (name, b' '.join(alias.args))) |
|
677 | 677 | > os.environ['COUNT'] = '2' |
|
678 | 678 | > ui.write(b'%s args: %s (with COUNT=2)\n' % (name, b' '.join(alias.args))) |
|
679 | 679 | > EOF |
|
680 | 680 | |
|
681 | 681 | $ cat >> $HGRCPATH <<'EOF' |
|
682 | 682 | > [extensions] |
|
683 | 683 | > expandalias = $TESTTMP/expandalias.py |
|
684 | 684 | > [alias] |
|
685 | 685 | > showcount = log -T "$COUNT" -r . |
|
686 | 686 | > EOF |
|
687 | 687 | |
|
688 | 688 | $ COUNT=1 hg expandalias showcount |
|
689 | 689 | showcount args: -T 1 -r . |
|
690 | 690 | showcount args: -T 2 -r . (with COUNT=2) |
|
691 | 691 | |
|
692 | 692 | This should show id: |
|
693 | 693 | |
|
694 | 694 | $ hg --config alias.log='id' log |
|
695 | 695 | 000000000000 tip |
|
696 | 696 | |
|
697 | 697 | This shouldn't: |
|
698 | 698 | |
|
699 | 699 | $ hg --config alias.log='id' history |
|
700 | 700 | |
|
701 | 701 | $ cd ../.. |
|
702 | 702 | |
|
703 | 703 | return code of command and shell aliases: |
|
704 | 704 | |
|
705 | 705 | $ hg mycommit -R alias |
|
706 | 706 | nothing changed |
|
707 | 707 | [1] |
|
708 | 708 | $ hg exit1 |
|
709 | 709 | [1] |
|
710 | 710 | |
|
711 | 711 | #if no-outer-repo |
|
712 | 712 | $ hg root |
|
713 | 713 | abort: no repository found in '$TESTTMP' (.hg not found)! |
|
714 | 714 | [255] |
|
715 | 715 | $ hg --config alias.hgroot='!hg root' hgroot |
|
716 | 716 | abort: no repository found in '$TESTTMP' (.hg not found)! |
|
717 | 717 | [255] |
|
718 | 718 | #endif |
@@ -1,3902 +1,3930 b'' | |||
|
1 | 1 | Short help: |
|
2 | 2 | |
|
3 | 3 | $ hg |
|
4 | 4 | Mercurial Distributed SCM |
|
5 | 5 | |
|
6 | 6 | basic commands: |
|
7 | 7 | |
|
8 | 8 | add add the specified files on the next commit |
|
9 | 9 | annotate show changeset information by line for each file |
|
10 | 10 | clone make a copy of an existing repository |
|
11 | 11 | commit commit the specified files or all outstanding changes |
|
12 | 12 | diff diff repository (or selected files) |
|
13 | 13 | export dump the header and diffs for one or more changesets |
|
14 | 14 | forget forget the specified files on the next commit |
|
15 | 15 | init create a new repository in the given directory |
|
16 | 16 | log show revision history of entire repository or files |
|
17 | 17 | merge merge another revision into working directory |
|
18 | 18 | pull pull changes from the specified source |
|
19 | 19 | push push changes to the specified destination |
|
20 | 20 | remove remove the specified files on the next commit |
|
21 | 21 | serve start stand-alone webserver |
|
22 | 22 | status show changed files in the working directory |
|
23 | 23 | summary summarize working directory state |
|
24 | 24 | update update working directory (or switch revisions) |
|
25 | 25 | |
|
26 | 26 | (use 'hg help' for the full list of commands or 'hg -v' for details) |
|
27 | 27 | |
|
28 | 28 | $ hg -q |
|
29 | 29 | add add the specified files on the next commit |
|
30 | 30 | annotate show changeset information by line for each file |
|
31 | 31 | clone make a copy of an existing repository |
|
32 | 32 | commit commit the specified files or all outstanding changes |
|
33 | 33 | diff diff repository (or selected files) |
|
34 | 34 | export dump the header and diffs for one or more changesets |
|
35 | 35 | forget forget the specified files on the next commit |
|
36 | 36 | init create a new repository in the given directory |
|
37 | 37 | log show revision history of entire repository or files |
|
38 | 38 | merge merge another revision into working directory |
|
39 | 39 | pull pull changes from the specified source |
|
40 | 40 | push push changes to the specified destination |
|
41 | 41 | remove remove the specified files on the next commit |
|
42 | 42 | serve start stand-alone webserver |
|
43 | 43 | status show changed files in the working directory |
|
44 | 44 | summary summarize working directory state |
|
45 | 45 | update update working directory (or switch revisions) |
|
46 | 46 | |
|
47 | 47 | Extra extensions will be printed in help output in a non-reliable order since |
|
48 | 48 | the extension is unknown. |
|
49 | 49 | #if no-extraextensions |
|
50 | 50 | |
|
51 | 51 | $ hg help |
|
52 | 52 | Mercurial Distributed SCM |
|
53 | 53 | |
|
54 | 54 | list of commands: |
|
55 | 55 | |
|
56 | 56 | Repository creation: |
|
57 | 57 | |
|
58 | 58 | clone make a copy of an existing repository |
|
59 | 59 | init create a new repository in the given directory |
|
60 | 60 | |
|
61 | 61 | Remote repository management: |
|
62 | 62 | |
|
63 | 63 | incoming show new changesets found in source |
|
64 | 64 | outgoing show changesets not found in the destination |
|
65 | 65 | paths show aliases for remote repositories |
|
66 | 66 | pull pull changes from the specified source |
|
67 | 67 | push push changes to the specified destination |
|
68 | 68 | serve start stand-alone webserver |
|
69 | 69 | |
|
70 | 70 | Change creation: |
|
71 | 71 | |
|
72 | 72 | commit commit the specified files or all outstanding changes |
|
73 | 73 | |
|
74 | 74 | Change manipulation: |
|
75 | 75 | |
|
76 | 76 | backout reverse effect of earlier changeset |
|
77 | 77 | graft copy changes from other branches onto the current branch |
|
78 | 78 | merge merge another revision into working directory |
|
79 | 79 | |
|
80 | 80 | Change organization: |
|
81 | 81 | |
|
82 | 82 | bookmarks create a new bookmark or list existing bookmarks |
|
83 | 83 | branch set or show the current branch name |
|
84 | 84 | branches list repository named branches |
|
85 | 85 | phase set or show the current phase name |
|
86 | 86 | tag add one or more tags for the current or given revision |
|
87 | 87 | tags list repository tags |
|
88 | 88 | |
|
89 | 89 | File content management: |
|
90 | 90 | |
|
91 | 91 | annotate show changeset information by line for each file |
|
92 | 92 | cat output the current or given revision of files |
|
93 | 93 | copy mark files as copied for the next commit |
|
94 | 94 | diff diff repository (or selected files) |
|
95 | 95 | grep search revision history for a pattern in specified files |
|
96 | 96 | |
|
97 | 97 | Change navigation: |
|
98 | 98 | |
|
99 | 99 | bisect subdivision search of changesets |
|
100 | 100 | heads show branch heads |
|
101 | 101 | identify identify the working directory or specified revision |
|
102 | 102 | log show revision history of entire repository or files |
|
103 | 103 | |
|
104 | 104 | Working directory management: |
|
105 | 105 | |
|
106 | 106 | add add the specified files on the next commit |
|
107 | 107 | addremove add all new files, delete all missing files |
|
108 | 108 | files list tracked files |
|
109 | 109 | forget forget the specified files on the next commit |
|
110 | 110 | remove remove the specified files on the next commit |
|
111 | 111 | rename rename files; equivalent of copy + remove |
|
112 | 112 | resolve redo merges or set/view the merge status of files |
|
113 | 113 | revert restore files to their checkout state |
|
114 | 114 | root print the root (top) of the current working directory |
|
115 | 115 | status show changed files in the working directory |
|
116 | 116 | summary summarize working directory state |
|
117 | 117 | update update working directory (or switch revisions) |
|
118 | 118 | |
|
119 | 119 | Change import/export: |
|
120 | 120 | |
|
121 | 121 | archive create an unversioned archive of a repository revision |
|
122 | 122 | bundle create a bundle file |
|
123 | 123 | export dump the header and diffs for one or more changesets |
|
124 | 124 | import import an ordered set of patches |
|
125 | 125 | unbundle apply one or more bundle files |
|
126 | 126 | |
|
127 | 127 | Repository maintenance: |
|
128 | 128 | |
|
129 | 129 | manifest output the current or given revision of the project manifest |
|
130 | 130 | recover roll back an interrupted transaction |
|
131 | 131 | verify verify the integrity of the repository |
|
132 | 132 | |
|
133 | 133 | Help: |
|
134 | 134 | |
|
135 | 135 | config show combined config settings from all hgrc files |
|
136 | 136 | help show help for a given topic or a help overview |
|
137 | 137 | version output version and copyright information |
|
138 | 138 | |
|
139 | 139 | additional help topics: |
|
140 | 140 | |
|
141 | 141 | Mercurial identifiers: |
|
142 | 142 | |
|
143 | 143 | filesets Specifying File Sets |
|
144 | 144 | hgignore Syntax for Mercurial Ignore Files |
|
145 | 145 | patterns File Name Patterns |
|
146 | 146 | revisions Specifying Revisions |
|
147 | 147 | urls URL Paths |
|
148 | 148 | |
|
149 | 149 | Mercurial output: |
|
150 | 150 | |
|
151 | 151 | color Colorizing Outputs |
|
152 | 152 | dates Date Formats |
|
153 | 153 | diffs Diff Formats |
|
154 | 154 | templating Template Usage |
|
155 | 155 | |
|
156 | 156 | Mercurial configuration: |
|
157 | 157 | |
|
158 | 158 | config Configuration Files |
|
159 | 159 | environment Environment Variables |
|
160 | 160 | extensions Using Additional Features |
|
161 | 161 | flags Command-line flags |
|
162 | 162 | hgweb Configuring hgweb |
|
163 | 163 | merge-tools Merge Tools |
|
164 | 164 | pager Pager Support |
|
165 | 165 | |
|
166 | 166 | Concepts: |
|
167 | 167 | |
|
168 | 168 | bundlespec Bundle File Formats |
|
169 | 169 | glossary Glossary |
|
170 | 170 | phases Working with Phases |
|
171 | 171 | subrepos Subrepositories |
|
172 | 172 | |
|
173 | 173 | Miscellaneous: |
|
174 | 174 | |
|
175 | 175 | deprecated Deprecated Features |
|
176 | 176 | internals Technical implementation topics |
|
177 | 177 | scripting Using Mercurial from scripts and automation |
|
178 | 178 | |
|
179 | 179 | (use 'hg help -v' to show built-in aliases and global options) |
|
180 | 180 | |
|
181 | 181 | $ hg -q help |
|
182 | 182 | Repository creation: |
|
183 | 183 | |
|
184 | 184 | clone make a copy of an existing repository |
|
185 | 185 | init create a new repository in the given directory |
|
186 | 186 | |
|
187 | 187 | Remote repository management: |
|
188 | 188 | |
|
189 | 189 | incoming show new changesets found in source |
|
190 | 190 | outgoing show changesets not found in the destination |
|
191 | 191 | paths show aliases for remote repositories |
|
192 | 192 | pull pull changes from the specified source |
|
193 | 193 | push push changes to the specified destination |
|
194 | 194 | serve start stand-alone webserver |
|
195 | 195 | |
|
196 | 196 | Change creation: |
|
197 | 197 | |
|
198 | 198 | commit commit the specified files or all outstanding changes |
|
199 | 199 | |
|
200 | 200 | Change manipulation: |
|
201 | 201 | |
|
202 | 202 | backout reverse effect of earlier changeset |
|
203 | 203 | graft copy changes from other branches onto the current branch |
|
204 | 204 | merge merge another revision into working directory |
|
205 | 205 | |
|
206 | 206 | Change organization: |
|
207 | 207 | |
|
208 | 208 | bookmarks create a new bookmark or list existing bookmarks |
|
209 | 209 | branch set or show the current branch name |
|
210 | 210 | branches list repository named branches |
|
211 | 211 | phase set or show the current phase name |
|
212 | 212 | tag add one or more tags for the current or given revision |
|
213 | 213 | tags list repository tags |
|
214 | 214 | |
|
215 | 215 | File content management: |
|
216 | 216 | |
|
217 | 217 | annotate show changeset information by line for each file |
|
218 | 218 | cat output the current or given revision of files |
|
219 | 219 | copy mark files as copied for the next commit |
|
220 | 220 | diff diff repository (or selected files) |
|
221 | 221 | grep search revision history for a pattern in specified files |
|
222 | 222 | |
|
223 | 223 | Change navigation: |
|
224 | 224 | |
|
225 | 225 | bisect subdivision search of changesets |
|
226 | 226 | heads show branch heads |
|
227 | 227 | identify identify the working directory or specified revision |
|
228 | 228 | log show revision history of entire repository or files |
|
229 | 229 | |
|
230 | 230 | Working directory management: |
|
231 | 231 | |
|
232 | 232 | add add the specified files on the next commit |
|
233 | 233 | addremove add all new files, delete all missing files |
|
234 | 234 | files list tracked files |
|
235 | 235 | forget forget the specified files on the next commit |
|
236 | 236 | remove remove the specified files on the next commit |
|
237 | 237 | rename rename files; equivalent of copy + remove |
|
238 | 238 | resolve redo merges or set/view the merge status of files |
|
239 | 239 | revert restore files to their checkout state |
|
240 | 240 | root print the root (top) of the current working directory |
|
241 | 241 | status show changed files in the working directory |
|
242 | 242 | summary summarize working directory state |
|
243 | 243 | update update working directory (or switch revisions) |
|
244 | 244 | |
|
245 | 245 | Change import/export: |
|
246 | 246 | |
|
247 | 247 | archive create an unversioned archive of a repository revision |
|
248 | 248 | bundle create a bundle file |
|
249 | 249 | export dump the header and diffs for one or more changesets |
|
250 | 250 | import import an ordered set of patches |
|
251 | 251 | unbundle apply one or more bundle files |
|
252 | 252 | |
|
253 | 253 | Repository maintenance: |
|
254 | 254 | |
|
255 | 255 | manifest output the current or given revision of the project manifest |
|
256 | 256 | recover roll back an interrupted transaction |
|
257 | 257 | verify verify the integrity of the repository |
|
258 | 258 | |
|
259 | 259 | Help: |
|
260 | 260 | |
|
261 | 261 | config show combined config settings from all hgrc files |
|
262 | 262 | help show help for a given topic or a help overview |
|
263 | 263 | version output version and copyright information |
|
264 | 264 | |
|
265 | 265 | additional help topics: |
|
266 | 266 | |
|
267 | 267 | Mercurial identifiers: |
|
268 | 268 | |
|
269 | 269 | filesets Specifying File Sets |
|
270 | 270 | hgignore Syntax for Mercurial Ignore Files |
|
271 | 271 | patterns File Name Patterns |
|
272 | 272 | revisions Specifying Revisions |
|
273 | 273 | urls URL Paths |
|
274 | 274 | |
|
275 | 275 | Mercurial output: |
|
276 | 276 | |
|
277 | 277 | color Colorizing Outputs |
|
278 | 278 | dates Date Formats |
|
279 | 279 | diffs Diff Formats |
|
280 | 280 | templating Template Usage |
|
281 | 281 | |
|
282 | 282 | Mercurial configuration: |
|
283 | 283 | |
|
284 | 284 | config Configuration Files |
|
285 | 285 | environment Environment Variables |
|
286 | 286 | extensions Using Additional Features |
|
287 | 287 | flags Command-line flags |
|
288 | 288 | hgweb Configuring hgweb |
|
289 | 289 | merge-tools Merge Tools |
|
290 | 290 | pager Pager Support |
|
291 | 291 | |
|
292 | 292 | Concepts: |
|
293 | 293 | |
|
294 | 294 | bundlespec Bundle File Formats |
|
295 | 295 | glossary Glossary |
|
296 | 296 | phases Working with Phases |
|
297 | 297 | subrepos Subrepositories |
|
298 | 298 | |
|
299 | 299 | Miscellaneous: |
|
300 | 300 | |
|
301 | 301 | deprecated Deprecated Features |
|
302 | 302 | internals Technical implementation topics |
|
303 | 303 | scripting Using Mercurial from scripts and automation |
|
304 | 304 | |
|
305 | 305 | Test extension help: |
|
306 | 306 | $ hg help extensions --config extensions.rebase= --config extensions.children= |
|
307 | 307 | Using Additional Features |
|
308 | 308 | """"""""""""""""""""""""" |
|
309 | 309 | |
|
310 | 310 | Mercurial has the ability to add new features through the use of |
|
311 | 311 | extensions. Extensions may add new commands, add options to existing |
|
312 | 312 | commands, change the default behavior of commands, or implement hooks. |
|
313 | 313 | |
|
314 | 314 | To enable the "foo" extension, either shipped with Mercurial or in the |
|
315 | 315 | Python search path, create an entry for it in your configuration file, |
|
316 | 316 | like this: |
|
317 | 317 | |
|
318 | 318 | [extensions] |
|
319 | 319 | foo = |
|
320 | 320 | |
|
321 | 321 | You may also specify the full path to an extension: |
|
322 | 322 | |
|
323 | 323 | [extensions] |
|
324 | 324 | myfeature = ~/.hgext/myfeature.py |
|
325 | 325 | |
|
326 | 326 | See 'hg help config' for more information on configuration files. |
|
327 | 327 | |
|
328 | 328 | Extensions are not loaded by default for a variety of reasons: they can |
|
329 | 329 | increase startup overhead; they may be meant for advanced usage only; they |
|
330 | 330 | may provide potentially dangerous abilities (such as letting you destroy |
|
331 | 331 | or modify history); they might not be ready for prime time; or they may |
|
332 | 332 | alter some usual behaviors of stock Mercurial. It is thus up to the user |
|
333 | 333 | to activate extensions as needed. |
|
334 | 334 | |
|
335 | 335 | To explicitly disable an extension enabled in a configuration file of |
|
336 | 336 | broader scope, prepend its path with !: |
|
337 | 337 | |
|
338 | 338 | [extensions] |
|
339 | 339 | # disabling extension bar residing in /path/to/extension/bar.py |
|
340 | 340 | bar = !/path/to/extension/bar.py |
|
341 | 341 | # ditto, but no path was supplied for extension baz |
|
342 | 342 | baz = ! |
|
343 | 343 | |
|
344 | 344 | enabled extensions: |
|
345 | 345 | |
|
346 | 346 | children command to display child changesets (DEPRECATED) |
|
347 | 347 | rebase command to move sets of revisions to a different ancestor |
|
348 | 348 | |
|
349 | 349 | disabled extensions: |
|
350 | 350 | |
|
351 | 351 | acl hooks for controlling repository access |
|
352 | 352 | blackbox log repository events to a blackbox for debugging |
|
353 | 353 | bugzilla hooks for integrating with the Bugzilla bug tracker |
|
354 | 354 | censor erase file content at a given revision |
|
355 | 355 | churn command to display statistics about repository history |
|
356 | 356 | clonebundles advertise pre-generated bundles to seed clones |
|
357 | 357 | closehead close arbitrary heads without checking them out first |
|
358 | 358 | convert import revisions from foreign VCS repositories into |
|
359 | 359 | Mercurial |
|
360 | 360 | eol automatically manage newlines in repository files |
|
361 | 361 | extdiff command to allow external programs to compare revisions |
|
362 | 362 | factotum http authentication with factotum |
|
363 | 363 | githelp try mapping git commands to Mercurial commands |
|
364 | 364 | gpg commands to sign and verify changesets |
|
365 | 365 | hgk browse the repository in a graphical way |
|
366 | 366 | highlight syntax highlighting for hgweb (requires Pygments) |
|
367 | 367 | histedit interactive history editing |
|
368 | 368 | keyword expand keywords in tracked files |
|
369 | 369 | largefiles track large binary files |
|
370 | 370 | mq manage a stack of patches |
|
371 | 371 | notify hooks for sending email push notifications |
|
372 | 372 | patchbomb command to send changesets as (a series of) patch emails |
|
373 | 373 | purge command to delete untracked files from the working |
|
374 | 374 | directory |
|
375 | 375 | relink recreates hardlinks between repository clones |
|
376 | 376 | schemes extend schemes with shortcuts to repository swarms |
|
377 | 377 | share share a common history between several working directories |
|
378 | 378 | shelve save and restore changes to the working directory |
|
379 | 379 | strip strip changesets and their descendants from history |
|
380 | 380 | transplant command to transplant changesets from another branch |
|
381 | 381 | win32mbcs allow the use of MBCS paths with problematic encodings |
|
382 | 382 | zeroconf discover and advertise repositories on the local network |
|
383 | 383 | |
|
384 | 384 | #endif |
|
385 | 385 | |
|
386 | 386 | Verify that deprecated extensions are included if --verbose: |
|
387 | 387 | |
|
388 | 388 | $ hg -v help extensions | grep children |
|
389 | 389 | children command to display child changesets (DEPRECATED) |
|
390 | 390 | |
|
391 | 391 | Verify that extension keywords appear in help templates |
|
392 | 392 | |
|
393 | 393 | $ hg help --config extensions.transplant= templating|grep transplant > /dev/null |
|
394 | 394 | |
|
395 | 395 | Test short command list with verbose option |
|
396 | 396 | |
|
397 | 397 | $ hg -v help shortlist |
|
398 | 398 | Mercurial Distributed SCM |
|
399 | 399 | |
|
400 | 400 | basic commands: |
|
401 | 401 | |
|
402 | 402 | add add the specified files on the next commit |
|
403 | 403 | annotate, blame |
|
404 | 404 | show changeset information by line for each file |
|
405 | 405 | clone make a copy of an existing repository |
|
406 | 406 | commit, ci commit the specified files or all outstanding changes |
|
407 | 407 | diff diff repository (or selected files) |
|
408 | 408 | export dump the header and diffs for one or more changesets |
|
409 | 409 | forget forget the specified files on the next commit |
|
410 | 410 | init create a new repository in the given directory |
|
411 | 411 | log, history show revision history of entire repository or files |
|
412 | 412 | merge merge another revision into working directory |
|
413 | 413 | pull pull changes from the specified source |
|
414 | 414 | push push changes to the specified destination |
|
415 | 415 | remove, rm remove the specified files on the next commit |
|
416 | 416 | serve start stand-alone webserver |
|
417 | 417 | status, st show changed files in the working directory |
|
418 | 418 | summary, sum summarize working directory state |
|
419 | 419 | update, up, checkout, co |
|
420 | 420 | update working directory (or switch revisions) |
|
421 | 421 | |
|
422 | 422 | global options ([+] can be repeated): |
|
423 | 423 | |
|
424 | 424 | -R --repository REPO repository root directory or name of overlay bundle |
|
425 | 425 | file |
|
426 | 426 | --cwd DIR change working directory |
|
427 | 427 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
428 | 428 | all prompts |
|
429 | 429 | -q --quiet suppress output |
|
430 | 430 | -v --verbose enable additional output |
|
431 | 431 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
432 | 432 | debug) |
|
433 | 433 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
434 | 434 | --debug enable debugging output |
|
435 | 435 | --debugger start debugger |
|
436 | 436 | --encoding ENCODE set the charset encoding (default: ascii) |
|
437 | 437 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
438 | 438 | --traceback always print a traceback on exception |
|
439 | 439 | --time time how long the command takes |
|
440 | 440 | --profile print command execution profile |
|
441 | 441 | --version output version information and exit |
|
442 | 442 | -h --help display help and exit |
|
443 | 443 | --hidden consider hidden changesets |
|
444 | 444 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
445 | 445 | (default: auto) |
|
446 | 446 | |
|
447 | 447 | (use 'hg help' for the full list of commands) |
|
448 | 448 | |
|
449 | 449 | $ hg add -h |
|
450 | 450 | hg add [OPTION]... [FILE]... |
|
451 | 451 | |
|
452 | 452 | add the specified files on the next commit |
|
453 | 453 | |
|
454 | 454 | Schedule files to be version controlled and added to the repository. |
|
455 | 455 | |
|
456 | 456 | The files will be added to the repository at the next commit. To undo an |
|
457 | 457 | add before that, see 'hg forget'. |
|
458 | 458 | |
|
459 | 459 | If no names are given, add all files to the repository (except files |
|
460 | 460 | matching ".hgignore"). |
|
461 | 461 | |
|
462 | 462 | Returns 0 if all files are successfully added. |
|
463 | 463 | |
|
464 | 464 | options ([+] can be repeated): |
|
465 | 465 | |
|
466 | 466 | -I --include PATTERN [+] include names matching the given patterns |
|
467 | 467 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
468 | 468 | -S --subrepos recurse into subrepositories |
|
469 | 469 | -n --dry-run do not perform actions, just print output |
|
470 | 470 | |
|
471 | 471 | (some details hidden, use --verbose to show complete help) |
|
472 | 472 | |
|
473 | 473 | Verbose help for add |
|
474 | 474 | |
|
475 | 475 | $ hg add -hv |
|
476 | 476 | hg add [OPTION]... [FILE]... |
|
477 | 477 | |
|
478 | 478 | add the specified files on the next commit |
|
479 | 479 | |
|
480 | 480 | Schedule files to be version controlled and added to the repository. |
|
481 | 481 | |
|
482 | 482 | The files will be added to the repository at the next commit. To undo an |
|
483 | 483 | add before that, see 'hg forget'. |
|
484 | 484 | |
|
485 | 485 | If no names are given, add all files to the repository (except files |
|
486 | 486 | matching ".hgignore"). |
|
487 | 487 | |
|
488 | 488 | Examples: |
|
489 | 489 | |
|
490 | 490 | - New (unknown) files are added automatically by 'hg add': |
|
491 | 491 | |
|
492 | 492 | $ ls |
|
493 | 493 | foo.c |
|
494 | 494 | $ hg status |
|
495 | 495 | ? foo.c |
|
496 | 496 | $ hg add |
|
497 | 497 | adding foo.c |
|
498 | 498 | $ hg status |
|
499 | 499 | A foo.c |
|
500 | 500 | |
|
501 | 501 | - Specific files to be added can be specified: |
|
502 | 502 | |
|
503 | 503 | $ ls |
|
504 | 504 | bar.c foo.c |
|
505 | 505 | $ hg status |
|
506 | 506 | ? bar.c |
|
507 | 507 | ? foo.c |
|
508 | 508 | $ hg add bar.c |
|
509 | 509 | $ hg status |
|
510 | 510 | A bar.c |
|
511 | 511 | ? foo.c |
|
512 | 512 | |
|
513 | 513 | Returns 0 if all files are successfully added. |
|
514 | 514 | |
|
515 | 515 | options ([+] can be repeated): |
|
516 | 516 | |
|
517 | 517 | -I --include PATTERN [+] include names matching the given patterns |
|
518 | 518 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
519 | 519 | -S --subrepos recurse into subrepositories |
|
520 | 520 | -n --dry-run do not perform actions, just print output |
|
521 | 521 | |
|
522 | 522 | global options ([+] can be repeated): |
|
523 | 523 | |
|
524 | 524 | -R --repository REPO repository root directory or name of overlay bundle |
|
525 | 525 | file |
|
526 | 526 | --cwd DIR change working directory |
|
527 | 527 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
528 | 528 | all prompts |
|
529 | 529 | -q --quiet suppress output |
|
530 | 530 | -v --verbose enable additional output |
|
531 | 531 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
532 | 532 | debug) |
|
533 | 533 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
534 | 534 | --debug enable debugging output |
|
535 | 535 | --debugger start debugger |
|
536 | 536 | --encoding ENCODE set the charset encoding (default: ascii) |
|
537 | 537 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
538 | 538 | --traceback always print a traceback on exception |
|
539 | 539 | --time time how long the command takes |
|
540 | 540 | --profile print command execution profile |
|
541 | 541 | --version output version information and exit |
|
542 | 542 | -h --help display help and exit |
|
543 | 543 | --hidden consider hidden changesets |
|
544 | 544 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
545 | 545 | (default: auto) |
|
546 | 546 | |
|
547 | 547 | Test the textwidth config option |
|
548 | 548 | |
|
549 | 549 | $ hg root -h --config ui.textwidth=50 |
|
550 | 550 | hg root |
|
551 | 551 | |
|
552 | 552 | print the root (top) of the current working |
|
553 | 553 | directory |
|
554 | 554 | |
|
555 | 555 | Print the root directory of the current |
|
556 | 556 | repository. |
|
557 | 557 | |
|
558 | 558 | Returns 0 on success. |
|
559 | 559 | |
|
560 | 560 | (some details hidden, use --verbose to show |
|
561 | 561 | complete help) |
|
562 | 562 | |
|
563 | 563 | Test help option with version option |
|
564 | 564 | |
|
565 | 565 | $ hg add -h --version |
|
566 | 566 | Mercurial Distributed SCM (version *) (glob) |
|
567 | 567 | (see https://mercurial-scm.org for more information) |
|
568 | 568 | |
|
569 | 569 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
570 | 570 | This is free software; see the source for copying conditions. There is NO |
|
571 | 571 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
572 | 572 | |
|
573 | 573 | $ hg add --skjdfks |
|
574 | 574 | hg add: option --skjdfks not recognized |
|
575 | 575 | hg add [OPTION]... [FILE]... |
|
576 | 576 | |
|
577 | 577 | add the specified files on the next commit |
|
578 | 578 | |
|
579 | 579 | options ([+] can be repeated): |
|
580 | 580 | |
|
581 | 581 | -I --include PATTERN [+] include names matching the given patterns |
|
582 | 582 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
583 | 583 | -S --subrepos recurse into subrepositories |
|
584 | 584 | -n --dry-run do not perform actions, just print output |
|
585 | 585 | |
|
586 | 586 | (use 'hg add -h' to show more help) |
|
587 | 587 | [255] |
|
588 | 588 | |
|
589 | 589 | Test ambiguous command help |
|
590 | 590 | |
|
591 | 591 | $ hg help ad |
|
592 | 592 | list of commands: |
|
593 | 593 | |
|
594 | 594 | add add the specified files on the next commit |
|
595 | 595 | addremove add all new files, delete all missing files |
|
596 | 596 | |
|
597 | 597 | (use 'hg help -v ad' to show built-in aliases and global options) |
|
598 | 598 | |
|
599 | 599 | Test command without options |
|
600 | 600 | |
|
601 | 601 | $ hg help verify |
|
602 | 602 | hg verify |
|
603 | 603 | |
|
604 | 604 | verify the integrity of the repository |
|
605 | 605 | |
|
606 | 606 | Verify the integrity of the current repository. |
|
607 | 607 | |
|
608 | 608 | This will perform an extensive check of the repository's integrity, |
|
609 | 609 | validating the hashes and checksums of each entry in the changelog, |
|
610 | 610 | manifest, and tracked files, as well as the integrity of their crosslinks |
|
611 | 611 | and indices. |
|
612 | 612 | |
|
613 | 613 | Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more |
|
614 | 614 | information about recovery from corruption of the repository. |
|
615 | 615 | |
|
616 | 616 | Returns 0 on success, 1 if errors are encountered. |
|
617 | 617 | |
|
618 | 618 | (some details hidden, use --verbose to show complete help) |
|
619 | 619 | |
|
620 | 620 | $ hg help diff |
|
621 | 621 | hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]... |
|
622 | 622 | |
|
623 | 623 | diff repository (or selected files) |
|
624 | 624 | |
|
625 | 625 | Show differences between revisions for the specified files. |
|
626 | 626 | |
|
627 | 627 | Differences between files are shown using the unified diff format. |
|
628 | 628 | |
|
629 | 629 | Note: |
|
630 | 630 | 'hg diff' may generate unexpected results for merges, as it will |
|
631 | 631 | default to comparing against the working directory's first parent |
|
632 | 632 | changeset if no revisions are specified. |
|
633 | 633 | |
|
634 | 634 | When two revision arguments are given, then changes are shown between |
|
635 | 635 | those revisions. If only one revision is specified then that revision is |
|
636 | 636 | compared to the working directory, and, when no revisions are specified, |
|
637 | 637 | the working directory files are compared to its first parent. |
|
638 | 638 | |
|
639 | 639 | Alternatively you can specify -c/--change with a revision to see the |
|
640 | 640 | changes in that changeset relative to its first parent. |
|
641 | 641 | |
|
642 | 642 | Without the -a/--text option, diff will avoid generating diffs of files it |
|
643 | 643 | detects as binary. With -a, diff will generate a diff anyway, probably |
|
644 | 644 | with undesirable results. |
|
645 | 645 | |
|
646 | 646 | Use the -g/--git option to generate diffs in the git extended diff format. |
|
647 | 647 | For more information, read 'hg help diffs'. |
|
648 | 648 | |
|
649 | 649 | Returns 0 on success. |
|
650 | 650 | |
|
651 | 651 | options ([+] can be repeated): |
|
652 | 652 | |
|
653 | 653 | -r --rev REV [+] revision |
|
654 | 654 | -c --change REV change made by revision |
|
655 | 655 | -a --text treat all files as text |
|
656 | 656 | -g --git use git extended diff format |
|
657 | 657 | --binary generate binary diffs in git mode (default) |
|
658 | 658 | --nodates omit dates from diff headers |
|
659 | 659 | --noprefix omit a/ and b/ prefixes from filenames |
|
660 | 660 | -p --show-function show which function each change is in |
|
661 | 661 | --reverse produce a diff that undoes the changes |
|
662 | 662 | -w --ignore-all-space ignore white space when comparing lines |
|
663 | 663 | -b --ignore-space-change ignore changes in the amount of white space |
|
664 | 664 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
665 | 665 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL |
|
666 | 666 | -U --unified NUM number of lines of context to show |
|
667 | 667 | --stat output diffstat-style summary of changes |
|
668 | 668 | --root DIR produce diffs relative to subdirectory |
|
669 | 669 | -I --include PATTERN [+] include names matching the given patterns |
|
670 | 670 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
671 | 671 | -S --subrepos recurse into subrepositories |
|
672 | 672 | |
|
673 | 673 | (some details hidden, use --verbose to show complete help) |
|
674 | 674 | |
|
675 | 675 | $ hg help status |
|
676 | 676 | hg status [OPTION]... [FILE]... |
|
677 | 677 | |
|
678 | 678 | aliases: st |
|
679 | 679 | |
|
680 | 680 | show changed files in the working directory |
|
681 | 681 | |
|
682 | 682 | Show status of files in the repository. If names are given, only files |
|
683 | 683 | that match are shown. Files that are clean or ignored or the source of a |
|
684 | 684 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
685 | 685 | -C/--copies or -A/--all are given. Unless options described with "show |
|
686 | 686 | only ..." are given, the options -mardu are used. |
|
687 | 687 | |
|
688 | 688 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
689 | 689 | explicitly requested with -u/--unknown or -i/--ignored. |
|
690 | 690 | |
|
691 | 691 | Note: |
|
692 | 692 | 'hg status' may appear to disagree with diff if permissions have |
|
693 | 693 | changed or a merge has occurred. The standard diff format does not |
|
694 | 694 | report permission changes and diff only reports changes relative to one |
|
695 | 695 | merge parent. |
|
696 | 696 | |
|
697 | 697 | If one revision is given, it is used as the base revision. If two |
|
698 | 698 | revisions are given, the differences between them are shown. The --change |
|
699 | 699 | option can also be used as a shortcut to list the changed files of a |
|
700 | 700 | revision from its first parent. |
|
701 | 701 | |
|
702 | 702 | The codes used to show the status of files are: |
|
703 | 703 | |
|
704 | 704 | M = modified |
|
705 | 705 | A = added |
|
706 | 706 | R = removed |
|
707 | 707 | C = clean |
|
708 | 708 | ! = missing (deleted by non-hg command, but still tracked) |
|
709 | 709 | ? = not tracked |
|
710 | 710 | I = ignored |
|
711 | 711 | = origin of the previous file (with --copies) |
|
712 | 712 | |
|
713 | 713 | Returns 0 on success. |
|
714 | 714 | |
|
715 | 715 | options ([+] can be repeated): |
|
716 | 716 | |
|
717 | 717 | -A --all show status of all files |
|
718 | 718 | -m --modified show only modified files |
|
719 | 719 | -a --added show only added files |
|
720 | 720 | -r --removed show only removed files |
|
721 | 721 | -d --deleted show only deleted (but tracked) files |
|
722 | 722 | -c --clean show only files without changes |
|
723 | 723 | -u --unknown show only unknown (not tracked) files |
|
724 | 724 | -i --ignored show only ignored files |
|
725 | 725 | -n --no-status hide status prefix |
|
726 | 726 | -C --copies show source of copied files |
|
727 | 727 | -0 --print0 end filenames with NUL, for use with xargs |
|
728 | 728 | --rev REV [+] show difference from revision |
|
729 | 729 | --change REV list the changed files of a revision |
|
730 | 730 | -I --include PATTERN [+] include names matching the given patterns |
|
731 | 731 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
732 | 732 | -S --subrepos recurse into subrepositories |
|
733 | 733 | -T --template TEMPLATE display with template |
|
734 | 734 | |
|
735 | 735 | (some details hidden, use --verbose to show complete help) |
|
736 | 736 | |
|
737 | 737 | $ hg -q help status |
|
738 | 738 | hg status [OPTION]... [FILE]... |
|
739 | 739 | |
|
740 | 740 | show changed files in the working directory |
|
741 | 741 | |
|
742 | 742 | $ hg help foo |
|
743 | 743 | abort: no such help topic: foo |
|
744 | 744 | (try 'hg help --keyword foo') |
|
745 | 745 | [255] |
|
746 | 746 | |
|
747 | 747 | $ hg skjdfks |
|
748 | 748 | hg: unknown command 'skjdfks' |
|
749 | 749 | (use 'hg help' for a list of commands) |
|
750 | 750 | [255] |
|
751 | 751 | |
|
752 | 752 | Typoed command gives suggestion |
|
753 | 753 | $ hg puls |
|
754 | 754 | hg: unknown command 'puls' |
|
755 | 755 | (did you mean one of pull, push?) |
|
756 | 756 | [255] |
|
757 | 757 | |
|
758 | 758 | Not enabled extension gets suggested |
|
759 | 759 | |
|
760 | 760 | $ hg rebase |
|
761 | 761 | hg: unknown command 'rebase' |
|
762 | 762 | 'rebase' is provided by the following extension: |
|
763 | 763 | |
|
764 | 764 | rebase command to move sets of revisions to a different ancestor |
|
765 | 765 | |
|
766 | 766 | (use 'hg help extensions' for information on enabling extensions) |
|
767 | 767 | [255] |
|
768 | 768 | |
|
769 | 769 | Disabled extension gets suggested |
|
770 | 770 | $ hg --config extensions.rebase=! rebase |
|
771 | 771 | hg: unknown command 'rebase' |
|
772 | 772 | 'rebase' is provided by the following extension: |
|
773 | 773 | |
|
774 | 774 | rebase command to move sets of revisions to a different ancestor |
|
775 | 775 | |
|
776 | 776 | (use 'hg help extensions' for information on enabling extensions) |
|
777 | 777 | [255] |
|
778 | 778 | |
|
779 | 779 | Make sure that we don't run afoul of the help system thinking that |
|
780 | 780 | this is a section and erroring out weirdly. |
|
781 | 781 | |
|
782 | 782 | $ hg .log |
|
783 | 783 | hg: unknown command '.log' |
|
784 | 784 | (did you mean log?) |
|
785 | 785 | [255] |
|
786 | 786 | |
|
787 | 787 | $ hg log. |
|
788 | 788 | hg: unknown command 'log.' |
|
789 | 789 | (did you mean log?) |
|
790 | 790 | [255] |
|
791 | 791 | $ hg pu.lh |
|
792 | 792 | hg: unknown command 'pu.lh' |
|
793 | 793 | (did you mean one of pull, push?) |
|
794 | 794 | [255] |
|
795 | 795 | |
|
796 | 796 | $ cat > helpext.py <<EOF |
|
797 | 797 | > import os |
|
798 | 798 | > from mercurial import commands, fancyopts, registrar |
|
799 | 799 | > |
|
800 | 800 | > def func(arg): |
|
801 | 801 | > return '%sfoo' % arg |
|
802 | 802 | > class customopt(fancyopts.customopt): |
|
803 | 803 | > def newstate(self, oldstate, newparam, abort): |
|
804 | 804 | > return '%sbar' % oldstate |
|
805 | 805 | > cmdtable = {} |
|
806 | 806 | > command = registrar.command(cmdtable) |
|
807 | 807 | > |
|
808 | 808 | > @command(b'nohelp', |
|
809 | 809 | > [(b'', b'longdesc', 3, b'x'*67), |
|
810 | 810 | > (b'n', b'', None, b'normal desc'), |
|
811 | 811 | > (b'', b'newline', b'', b'line1\nline2'), |
|
812 | 812 | > (b'', b'callableopt', func, b'adds foo'), |
|
813 | 813 | > (b'', b'customopt', customopt(''), b'adds bar'), |
|
814 | 814 | > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')], |
|
815 | 815 | > b'hg nohelp', |
|
816 | 816 | > norepo=True) |
|
817 | 817 | > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')]) |
|
818 | 818 | > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')]) |
|
819 | 819 | > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')]) |
|
820 | 820 | > def nohelp(ui, *args, **kwargs): |
|
821 | 821 | > pass |
|
822 | 822 | > |
|
823 | 823 | > def uisetup(ui): |
|
824 | 824 | > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext') |
|
825 | 825 | > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext') |
|
826 | > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext') | |
|
827 | > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext') | |
|
828 | > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext') | |
|
826 | 829 | > |
|
827 | 830 | > EOF |
|
828 | 831 | $ echo '[extensions]' >> $HGRCPATH |
|
829 | 832 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH |
|
830 | 833 | |
|
831 | 834 | Test for aliases |
|
832 | 835 | |
|
836 | $ hg help | grep hgalias | |
|
837 | hgalias My doc | |
|
838 | ||
|
833 | 839 | $ hg help hgalias |
|
834 | 840 | hg hgalias [--remote] |
|
835 | 841 | |
|
836 | 842 | alias for: hg summary |
|
837 | 843 | |
|
844 | My doc | |
|
845 | ||
|
846 | defined by: helpext | |
|
847 | ||
|
848 | options: | |
|
849 | ||
|
850 | --remote check for push and pull | |
|
851 | ||
|
852 | (some details hidden, use --verbose to show complete help) | |
|
853 | $ hg help hgaliasnodoc | |
|
854 | hg hgaliasnodoc [--remote] | |
|
855 | ||
|
856 | alias for: hg summary | |
|
857 | ||
|
838 | 858 | summarize working directory state |
|
839 | 859 | |
|
840 | 860 | This generates a brief summary of the working directory state, including |
|
841 | 861 | parents, branch, commit status, phase and available updates. |
|
842 | 862 | |
|
843 | 863 | With the --remote option, this will check the default paths for incoming |
|
844 | 864 | and outgoing changes. This can be time-consuming. |
|
845 | 865 | |
|
846 | 866 | Returns 0 on success. |
|
847 | 867 | |
|
848 | 868 | defined by: helpext |
|
849 | 869 | |
|
850 | 870 | options: |
|
851 | 871 | |
|
852 | 872 | --remote check for push and pull |
|
853 | 873 | |
|
854 | 874 | (some details hidden, use --verbose to show complete help) |
|
855 | 875 | |
|
856 | 876 | $ hg help shellalias |
|
857 | 877 | hg shellalias |
|
858 | 878 | |
|
859 | 879 | shell alias for: echo hi |
|
860 | 880 | |
|
861 | 881 | (no help text available) |
|
862 | 882 | |
|
863 | 883 | defined by: helpext |
|
864 | 884 | |
|
865 | 885 | (some details hidden, use --verbose to show complete help) |
|
866 | 886 | |
|
867 | 887 | Test command with no help text |
|
868 | 888 | |
|
869 | 889 | $ hg help nohelp |
|
870 | 890 | hg nohelp |
|
871 | 891 | |
|
872 | 892 | (no help text available) |
|
873 | 893 | |
|
874 | 894 | options: |
|
875 | 895 | |
|
876 | 896 | --longdesc VALUE |
|
877 | 897 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
878 | 898 | xxxxxxxxxxxxxxxxxxxxxxx (default: 3) |
|
879 | 899 | -n -- normal desc |
|
880 | 900 | --newline VALUE line1 line2 |
|
881 | 901 | --callableopt VALUE adds foo |
|
882 | 902 | --customopt VALUE adds bar |
|
883 | 903 | --customopt-withdefault VALUE adds bar (default: foo) |
|
884 | 904 | |
|
885 | 905 | (some details hidden, use --verbose to show complete help) |
|
886 | 906 | |
|
887 | 907 | $ hg help -k nohelp |
|
888 | 908 | Commands: |
|
889 | 909 | |
|
890 | 910 | nohelp hg nohelp |
|
891 | 911 | |
|
892 | 912 | Extension Commands: |
|
893 | 913 | |
|
894 | 914 | nohelp (no help text available) |
|
895 | 915 | |
|
896 | 916 | Test that default list of commands omits extension commands |
|
897 | 917 | |
|
898 | 918 | #if no-extraextensions |
|
899 | 919 | |
|
900 | 920 | $ hg help |
|
901 | 921 | Mercurial Distributed SCM |
|
902 | 922 | |
|
903 | 923 | list of commands: |
|
904 | 924 | |
|
905 | 925 | Repository creation: |
|
906 | 926 | |
|
907 | 927 | clone make a copy of an existing repository |
|
908 | 928 | init create a new repository in the given directory |
|
909 | 929 | |
|
910 | 930 | Remote repository management: |
|
911 | 931 | |
|
912 | 932 | incoming show new changesets found in source |
|
913 | 933 | outgoing show changesets not found in the destination |
|
914 | 934 | paths show aliases for remote repositories |
|
915 | 935 | pull pull changes from the specified source |
|
916 | 936 | push push changes to the specified destination |
|
917 | 937 | serve start stand-alone webserver |
|
918 | 938 | |
|
919 | 939 | Change creation: |
|
920 | 940 | |
|
921 | 941 | commit commit the specified files or all outstanding changes |
|
922 | 942 | |
|
923 | 943 | Change manipulation: |
|
924 | 944 | |
|
925 | 945 | backout reverse effect of earlier changeset |
|
926 | 946 | graft copy changes from other branches onto the current branch |
|
927 | 947 | merge merge another revision into working directory |
|
928 | 948 | |
|
929 | 949 | Change organization: |
|
930 | 950 | |
|
931 | 951 | bookmarks create a new bookmark or list existing bookmarks |
|
932 | 952 | branch set or show the current branch name |
|
933 | 953 | branches list repository named branches |
|
934 | 954 | phase set or show the current phase name |
|
935 | 955 | tag add one or more tags for the current or given revision |
|
936 | 956 | tags list repository tags |
|
937 | 957 | |
|
938 | 958 | File content management: |
|
939 | 959 | |
|
940 | 960 | annotate show changeset information by line for each file |
|
941 | 961 | cat output the current or given revision of files |
|
942 | 962 | copy mark files as copied for the next commit |
|
943 | 963 | diff diff repository (or selected files) |
|
944 | 964 | grep search revision history for a pattern in specified files |
|
945 | 965 | |
|
946 | 966 | Change navigation: |
|
947 | 967 | |
|
948 | 968 | bisect subdivision search of changesets |
|
949 | 969 | heads show branch heads |
|
970 | hgalias My doc | |
|
950 | 971 | identify identify the working directory or specified revision |
|
951 | 972 | log show revision history of entire repository or files |
|
952 | 973 | |
|
953 | 974 | Working directory management: |
|
954 | 975 | |
|
955 | 976 | add add the specified files on the next commit |
|
956 | 977 | addremove add all new files, delete all missing files |
|
957 | 978 | files list tracked files |
|
958 | 979 | forget forget the specified files on the next commit |
|
959 | 980 | remove remove the specified files on the next commit |
|
960 | 981 | rename rename files; equivalent of copy + remove |
|
961 | 982 | resolve redo merges or set/view the merge status of files |
|
962 | 983 | revert restore files to their checkout state |
|
963 | 984 | root print the root (top) of the current working directory |
|
964 | 985 | status show changed files in the working directory |
|
965 | 986 | summary summarize working directory state |
|
966 | 987 | update update working directory (or switch revisions) |
|
967 | 988 | |
|
968 | 989 | Change import/export: |
|
969 | 990 | |
|
970 | 991 | archive create an unversioned archive of a repository revision |
|
971 | 992 | bundle create a bundle file |
|
972 | 993 | export dump the header and diffs for one or more changesets |
|
973 | 994 | import import an ordered set of patches |
|
974 | 995 | unbundle apply one or more bundle files |
|
975 | 996 | |
|
976 | 997 | Repository maintenance: |
|
977 | 998 | |
|
978 | 999 | manifest output the current or given revision of the project manifest |
|
979 | 1000 | recover roll back an interrupted transaction |
|
980 | 1001 | verify verify the integrity of the repository |
|
981 | 1002 | |
|
982 | 1003 | Help: |
|
983 | 1004 | |
|
984 | 1005 | config show combined config settings from all hgrc files |
|
985 | 1006 | help show help for a given topic or a help overview |
|
986 | 1007 | version output version and copyright information |
|
987 | 1008 | |
|
988 | 1009 | enabled extensions: |
|
989 | 1010 | |
|
990 | 1011 | helpext (no help text available) |
|
991 | 1012 | |
|
992 | 1013 | additional help topics: |
|
993 | 1014 | |
|
994 | 1015 | Mercurial identifiers: |
|
995 | 1016 | |
|
996 | 1017 | filesets Specifying File Sets |
|
997 | 1018 | hgignore Syntax for Mercurial Ignore Files |
|
998 | 1019 | patterns File Name Patterns |
|
999 | 1020 | revisions Specifying Revisions |
|
1000 | 1021 | urls URL Paths |
|
1001 | 1022 | |
|
1002 | 1023 | Mercurial output: |
|
1003 | 1024 | |
|
1004 | 1025 | color Colorizing Outputs |
|
1005 | 1026 | dates Date Formats |
|
1006 | 1027 | diffs Diff Formats |
|
1007 | 1028 | templating Template Usage |
|
1008 | 1029 | |
|
1009 | 1030 | Mercurial configuration: |
|
1010 | 1031 | |
|
1011 | 1032 | config Configuration Files |
|
1012 | 1033 | environment Environment Variables |
|
1013 | 1034 | extensions Using Additional Features |
|
1014 | 1035 | flags Command-line flags |
|
1015 | 1036 | hgweb Configuring hgweb |
|
1016 | 1037 | merge-tools Merge Tools |
|
1017 | 1038 | pager Pager Support |
|
1018 | 1039 | |
|
1019 | 1040 | Concepts: |
|
1020 | 1041 | |
|
1021 | 1042 | bundlespec Bundle File Formats |
|
1022 | 1043 | glossary Glossary |
|
1023 | 1044 | phases Working with Phases |
|
1024 | 1045 | subrepos Subrepositories |
|
1025 | 1046 | |
|
1026 | 1047 | Miscellaneous: |
|
1027 | 1048 | |
|
1028 | 1049 | deprecated Deprecated Features |
|
1029 | 1050 | internals Technical implementation topics |
|
1030 | 1051 | scripting Using Mercurial from scripts and automation |
|
1031 | 1052 | |
|
1032 | 1053 | (use 'hg help -v' to show built-in aliases and global options) |
|
1033 | 1054 | |
|
1034 | 1055 | #endif |
|
1035 | 1056 | |
|
1036 | 1057 | Test list of internal help commands |
|
1037 | 1058 | |
|
1038 | 1059 | $ hg help debug |
|
1039 | 1060 | debug commands (internal and unsupported): |
|
1040 | 1061 | |
|
1041 | 1062 | debugancestor |
|
1042 | 1063 | find the ancestor revision of two revisions in a given index |
|
1043 | 1064 | debugapplystreamclonebundle |
|
1044 | 1065 | apply a stream clone bundle file |
|
1045 | 1066 | debugbuilddag |
|
1046 | 1067 | builds a repo with a given DAG from scratch in the current |
|
1047 | 1068 | empty repo |
|
1048 | 1069 | debugbundle lists the contents of a bundle |
|
1049 | 1070 | debugcapabilities |
|
1050 | 1071 | lists the capabilities of a remote peer |
|
1051 | 1072 | debugcheckstate |
|
1052 | 1073 | validate the correctness of the current dirstate |
|
1053 | 1074 | debugcolor show available color, effects or style |
|
1054 | 1075 | debugcommands |
|
1055 | 1076 | list all available commands and options |
|
1056 | 1077 | debugcomplete |
|
1057 | 1078 | returns the completion list associated with the given command |
|
1058 | 1079 | debugcreatestreamclonebundle |
|
1059 | 1080 | create a stream clone bundle file |
|
1060 | 1081 | debugdag format the changelog or an index DAG as a concise textual |
|
1061 | 1082 | description |
|
1062 | 1083 | debugdata dump the contents of a data file revision |
|
1063 | 1084 | debugdate parse and display a date |
|
1064 | 1085 | debugdeltachain |
|
1065 | 1086 | dump information about delta chains in a revlog |
|
1066 | 1087 | debugdirstate |
|
1067 | 1088 | show the contents of the current dirstate |
|
1068 | 1089 | debugdiscovery |
|
1069 | 1090 | runs the changeset discovery protocol in isolation |
|
1070 | 1091 | debugdownload |
|
1071 | 1092 | download a resource using Mercurial logic and config |
|
1072 | 1093 | debugextensions |
|
1073 | 1094 | show information about active extensions |
|
1074 | 1095 | debugfileset parse and apply a fileset specification |
|
1075 | 1096 | debugformat display format information about the current repository |
|
1076 | 1097 | debugfsinfo show information detected about current filesystem |
|
1077 | 1098 | debuggetbundle |
|
1078 | 1099 | retrieves a bundle from a repo |
|
1079 | 1100 | debugignore display the combined ignore pattern and information about |
|
1080 | 1101 | ignored files |
|
1081 | 1102 | debugindex dump index data for a storage primitive |
|
1082 | 1103 | debugindexdot |
|
1083 | 1104 | dump an index DAG as a graphviz dot file |
|
1084 | 1105 | debugindexstats |
|
1085 | 1106 | show stats related to the changelog index |
|
1086 | 1107 | debuginstall test Mercurial installation |
|
1087 | 1108 | debugknown test whether node ids are known to a repo |
|
1088 | 1109 | debuglocks show or modify state of locks |
|
1089 | 1110 | debugmanifestfulltextcache |
|
1090 | 1111 | show, clear or amend the contents of the manifest fulltext |
|
1091 | 1112 | cache |
|
1092 | 1113 | debugmergestate |
|
1093 | 1114 | print merge state |
|
1094 | 1115 | debugnamecomplete |
|
1095 | 1116 | complete "names" - tags, open branch names, bookmark names |
|
1096 | 1117 | debugobsolete |
|
1097 | 1118 | create arbitrary obsolete marker |
|
1098 | 1119 | debugoptADV (no help text available) |
|
1099 | 1120 | debugoptDEP (no help text available) |
|
1100 | 1121 | debugoptEXP (no help text available) |
|
1101 | 1122 | debugpathcomplete |
|
1102 | 1123 | complete part or all of a tracked path |
|
1103 | 1124 | debugpeer establish a connection to a peer repository |
|
1104 | 1125 | debugpickmergetool |
|
1105 | 1126 | examine which merge tool is chosen for specified file |
|
1106 | 1127 | debugpushkey access the pushkey key/value protocol |
|
1107 | 1128 | debugpvec (no help text available) |
|
1108 | 1129 | debugrebuilddirstate |
|
1109 | 1130 | rebuild the dirstate as it would look like for the given |
|
1110 | 1131 | revision |
|
1111 | 1132 | debugrebuildfncache |
|
1112 | 1133 | rebuild the fncache file |
|
1113 | 1134 | debugrename dump rename information |
|
1114 | 1135 | debugrevlog show data and statistics about a revlog |
|
1115 | 1136 | debugrevlogindex |
|
1116 | 1137 | dump the contents of a revlog index |
|
1117 | 1138 | debugrevspec parse and apply a revision specification |
|
1118 | 1139 | debugserve run a server with advanced settings |
|
1119 | 1140 | debugsetparents |
|
1120 | 1141 | manually set the parents of the current working directory |
|
1121 | 1142 | debugssl test a secure connection to a server |
|
1122 | 1143 | debugsub (no help text available) |
|
1123 | 1144 | debugsuccessorssets |
|
1124 | 1145 | show set of successors for revision |
|
1125 | 1146 | debugtemplate |
|
1126 | 1147 | parse and apply a template |
|
1127 | 1148 | debuguigetpass |
|
1128 | 1149 | show prompt to type password |
|
1129 | 1150 | debuguiprompt |
|
1130 | 1151 | show plain prompt |
|
1131 | 1152 | debugupdatecaches |
|
1132 | 1153 | warm all known caches in the repository |
|
1133 | 1154 | debugupgraderepo |
|
1134 | 1155 | upgrade a repository to use different features |
|
1135 | 1156 | debugwalk show how files match on given patterns |
|
1136 | 1157 | debugwhyunstable |
|
1137 | 1158 | explain instabilities of a changeset |
|
1138 | 1159 | debugwireargs |
|
1139 | 1160 | (no help text available) |
|
1140 | 1161 | debugwireproto |
|
1141 | 1162 | send wire protocol commands to a server |
|
1142 | 1163 | |
|
1143 | 1164 | (use 'hg help -v debug' to show built-in aliases and global options) |
|
1144 | 1165 | |
|
1145 | 1166 | internals topic renders index of available sub-topics |
|
1146 | 1167 | |
|
1147 | 1168 | $ hg help internals |
|
1148 | 1169 | Technical implementation topics |
|
1149 | 1170 | """"""""""""""""""""""""""""""" |
|
1150 | 1171 | |
|
1151 | 1172 | To access a subtopic, use "hg help internals.{subtopic-name}" |
|
1152 | 1173 | |
|
1153 | 1174 | bundle2 Bundle2 |
|
1154 | 1175 | bundles Bundles |
|
1155 | 1176 | cbor CBOR |
|
1156 | 1177 | censor Censor |
|
1157 | 1178 | changegroups Changegroups |
|
1158 | 1179 | config Config Registrar |
|
1159 | 1180 | requirements Repository Requirements |
|
1160 | 1181 | revlogs Revision Logs |
|
1161 | 1182 | wireprotocol Wire Protocol |
|
1162 | 1183 | wireprotocolrpc |
|
1163 | 1184 | Wire Protocol RPC |
|
1164 | 1185 | wireprotocolv2 |
|
1165 | 1186 | Wire Protocol Version 2 |
|
1166 | 1187 | |
|
1167 | 1188 | sub-topics can be accessed |
|
1168 | 1189 | |
|
1169 | 1190 | $ hg help internals.changegroups |
|
1170 | 1191 | Changegroups |
|
1171 | 1192 | """""""""""" |
|
1172 | 1193 | |
|
1173 | 1194 | Changegroups are representations of repository revlog data, specifically |
|
1174 | 1195 | the changelog data, root/flat manifest data, treemanifest data, and |
|
1175 | 1196 | filelogs. |
|
1176 | 1197 | |
|
1177 | 1198 | There are 3 versions of changegroups: "1", "2", and "3". From a high- |
|
1178 | 1199 | level, versions "1" and "2" are almost exactly the same, with the only |
|
1179 | 1200 | difference being an additional item in the *delta header*. Version "3" |
|
1180 | 1201 | adds support for storage flags in the *delta header* and optionally |
|
1181 | 1202 | exchanging treemanifests (enabled by setting an option on the |
|
1182 | 1203 | "changegroup" part in the bundle2). |
|
1183 | 1204 | |
|
1184 | 1205 | Changegroups when not exchanging treemanifests consist of 3 logical |
|
1185 | 1206 | segments: |
|
1186 | 1207 | |
|
1187 | 1208 | +---------------------------------+ |
|
1188 | 1209 | | | | | |
|
1189 | 1210 | | changeset | manifest | filelogs | |
|
1190 | 1211 | | | | | |
|
1191 | 1212 | | | | | |
|
1192 | 1213 | +---------------------------------+ |
|
1193 | 1214 | |
|
1194 | 1215 | When exchanging treemanifests, there are 4 logical segments: |
|
1195 | 1216 | |
|
1196 | 1217 | +-------------------------------------------------+ |
|
1197 | 1218 | | | | | | |
|
1198 | 1219 | | changeset | root | treemanifests | filelogs | |
|
1199 | 1220 | | | manifest | | | |
|
1200 | 1221 | | | | | | |
|
1201 | 1222 | +-------------------------------------------------+ |
|
1202 | 1223 | |
|
1203 | 1224 | The principle building block of each segment is a *chunk*. A *chunk* is a |
|
1204 | 1225 | framed piece of data: |
|
1205 | 1226 | |
|
1206 | 1227 | +---------------------------------------+ |
|
1207 | 1228 | | | | |
|
1208 | 1229 | | length | data | |
|
1209 | 1230 | | (4 bytes) | (<length - 4> bytes) | |
|
1210 | 1231 | | | | |
|
1211 | 1232 | +---------------------------------------+ |
|
1212 | 1233 | |
|
1213 | 1234 | All integers are big-endian signed integers. Each chunk starts with a |
|
1214 | 1235 | 32-bit integer indicating the length of the entire chunk (including the |
|
1215 | 1236 | length field itself). |
|
1216 | 1237 | |
|
1217 | 1238 | There is a special case chunk that has a value of 0 for the length |
|
1218 | 1239 | ("0x00000000"). We call this an *empty chunk*. |
|
1219 | 1240 | |
|
1220 | 1241 | Delta Groups |
|
1221 | 1242 | ============ |
|
1222 | 1243 | |
|
1223 | 1244 | A *delta group* expresses the content of a revlog as a series of deltas, |
|
1224 | 1245 | or patches against previous revisions. |
|
1225 | 1246 | |
|
1226 | 1247 | Delta groups consist of 0 or more *chunks* followed by the *empty chunk* |
|
1227 | 1248 | to signal the end of the delta group: |
|
1228 | 1249 | |
|
1229 | 1250 | +------------------------------------------------------------------------+ |
|
1230 | 1251 | | | | | | | |
|
1231 | 1252 | | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 | |
|
1232 | 1253 | | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) | |
|
1233 | 1254 | | | | | | | |
|
1234 | 1255 | +------------------------------------------------------------------------+ |
|
1235 | 1256 | |
|
1236 | 1257 | Each *chunk*'s data consists of the following: |
|
1237 | 1258 | |
|
1238 | 1259 | +---------------------------------------+ |
|
1239 | 1260 | | | | |
|
1240 | 1261 | | delta header | delta data | |
|
1241 | 1262 | | (various by version) | (various) | |
|
1242 | 1263 | | | | |
|
1243 | 1264 | +---------------------------------------+ |
|
1244 | 1265 | |
|
1245 | 1266 | The *delta data* is a series of *delta*s that describe a diff from an |
|
1246 | 1267 | existing entry (either that the recipient already has, or previously |
|
1247 | 1268 | specified in the bundle/changegroup). |
|
1248 | 1269 | |
|
1249 | 1270 | The *delta header* is different between versions "1", "2", and "3" of the |
|
1250 | 1271 | changegroup format. |
|
1251 | 1272 | |
|
1252 | 1273 | Version 1 (headerlen=80): |
|
1253 | 1274 | |
|
1254 | 1275 | +------------------------------------------------------+ |
|
1255 | 1276 | | | | | | |
|
1256 | 1277 | | node | p1 node | p2 node | link node | |
|
1257 | 1278 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
1258 | 1279 | | | | | | |
|
1259 | 1280 | +------------------------------------------------------+ |
|
1260 | 1281 | |
|
1261 | 1282 | Version 2 (headerlen=100): |
|
1262 | 1283 | |
|
1263 | 1284 | +------------------------------------------------------------------+ |
|
1264 | 1285 | | | | | | | |
|
1265 | 1286 | | node | p1 node | p2 node | base node | link node | |
|
1266 | 1287 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
1267 | 1288 | | | | | | | |
|
1268 | 1289 | +------------------------------------------------------------------+ |
|
1269 | 1290 | |
|
1270 | 1291 | Version 3 (headerlen=102): |
|
1271 | 1292 | |
|
1272 | 1293 | +------------------------------------------------------------------------------+ |
|
1273 | 1294 | | | | | | | | |
|
1274 | 1295 | | node | p1 node | p2 node | base node | link node | flags | |
|
1275 | 1296 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | |
|
1276 | 1297 | | | | | | | | |
|
1277 | 1298 | +------------------------------------------------------------------------------+ |
|
1278 | 1299 | |
|
1279 | 1300 | The *delta data* consists of "chunklen - 4 - headerlen" bytes, which |
|
1280 | 1301 | contain a series of *delta*s, densely packed (no separators). These deltas |
|
1281 | 1302 | describe a diff from an existing entry (either that the recipient already |
|
1282 | 1303 | has, or previously specified in the bundle/changegroup). The format is |
|
1283 | 1304 | described more fully in "hg help internals.bdiff", but briefly: |
|
1284 | 1305 | |
|
1285 | 1306 | +---------------------------------------------------------------+ |
|
1286 | 1307 | | | | | | |
|
1287 | 1308 | | start offset | end offset | new length | content | |
|
1288 | 1309 | | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) | |
|
1289 | 1310 | | | | | | |
|
1290 | 1311 | +---------------------------------------------------------------+ |
|
1291 | 1312 | |
|
1292 | 1313 | Please note that the length field in the delta data does *not* include |
|
1293 | 1314 | itself. |
|
1294 | 1315 | |
|
1295 | 1316 | In version 1, the delta is always applied against the previous node from |
|
1296 | 1317 | the changegroup or the first parent if this is the first entry in the |
|
1297 | 1318 | changegroup. |
|
1298 | 1319 | |
|
1299 | 1320 | In version 2 and up, the delta base node is encoded in the entry in the |
|
1300 | 1321 | changegroup. This allows the delta to be expressed against any parent, |
|
1301 | 1322 | which can result in smaller deltas and more efficient encoding of data. |
|
1302 | 1323 | |
|
1303 | 1324 | The *flags* field holds bitwise flags affecting the processing of revision |
|
1304 | 1325 | data. The following flags are defined: |
|
1305 | 1326 | |
|
1306 | 1327 | 32768 |
|
1307 | 1328 | Censored revision. The revision's fulltext has been replaced by censor |
|
1308 | 1329 | metadata. May only occur on file revisions. |
|
1309 | 1330 | |
|
1310 | 1331 | 16384 |
|
1311 | 1332 | Ellipsis revision. Revision hash does not match data (likely due to |
|
1312 | 1333 | rewritten parents). |
|
1313 | 1334 | |
|
1314 | 1335 | 8192 |
|
1315 | 1336 | Externally stored. The revision fulltext contains "key:value" "\n" |
|
1316 | 1337 | delimited metadata defining an object stored elsewhere. Used by the LFS |
|
1317 | 1338 | extension. |
|
1318 | 1339 | |
|
1319 | 1340 | For historical reasons, the integer values are identical to revlog version |
|
1320 | 1341 | 1 per-revision storage flags and correspond to bits being set in this |
|
1321 | 1342 | 2-byte field. Bits were allocated starting from the most-significant bit, |
|
1322 | 1343 | hence the reverse ordering and allocation of these flags. |
|
1323 | 1344 | |
|
1324 | 1345 | Changeset Segment |
|
1325 | 1346 | ================= |
|
1326 | 1347 | |
|
1327 | 1348 | The *changeset segment* consists of a single *delta group* holding |
|
1328 | 1349 | changelog data. The *empty chunk* at the end of the *delta group* denotes |
|
1329 | 1350 | the boundary to the *manifest segment*. |
|
1330 | 1351 | |
|
1331 | 1352 | Manifest Segment |
|
1332 | 1353 | ================ |
|
1333 | 1354 | |
|
1334 | 1355 | The *manifest segment* consists of a single *delta group* holding manifest |
|
1335 | 1356 | data. If treemanifests are in use, it contains only the manifest for the |
|
1336 | 1357 | root directory of the repository. Otherwise, it contains the entire |
|
1337 | 1358 | manifest data. The *empty chunk* at the end of the *delta group* denotes |
|
1338 | 1359 | the boundary to the next segment (either the *treemanifests segment* or |
|
1339 | 1360 | the *filelogs segment*, depending on version and the request options). |
|
1340 | 1361 | |
|
1341 | 1362 | Treemanifests Segment |
|
1342 | 1363 | --------------------- |
|
1343 | 1364 | |
|
1344 | 1365 | The *treemanifests segment* only exists in changegroup version "3", and |
|
1345 | 1366 | only if the 'treemanifest' param is part of the bundle2 changegroup part |
|
1346 | 1367 | (it is not possible to use changegroup version 3 outside of bundle2). |
|
1347 | 1368 | Aside from the filenames in the *treemanifests segment* containing a |
|
1348 | 1369 | trailing "/" character, it behaves identically to the *filelogs segment* |
|
1349 | 1370 | (see below). The final sub-segment is followed by an *empty chunk* |
|
1350 | 1371 | (logically, a sub-segment with filename size 0). This denotes the boundary |
|
1351 | 1372 | to the *filelogs segment*. |
|
1352 | 1373 | |
|
1353 | 1374 | Filelogs Segment |
|
1354 | 1375 | ================ |
|
1355 | 1376 | |
|
1356 | 1377 | The *filelogs segment* consists of multiple sub-segments, each |
|
1357 | 1378 | corresponding to an individual file whose data is being described: |
|
1358 | 1379 | |
|
1359 | 1380 | +--------------------------------------------------+ |
|
1360 | 1381 | | | | | | | |
|
1361 | 1382 | | filelog0 | filelog1 | filelog2 | ... | 0x0 | |
|
1362 | 1383 | | | | | | (4 bytes) | |
|
1363 | 1384 | | | | | | | |
|
1364 | 1385 | +--------------------------------------------------+ |
|
1365 | 1386 | |
|
1366 | 1387 | The final filelog sub-segment is followed by an *empty chunk* (logically, |
|
1367 | 1388 | a sub-segment with filename size 0). This denotes the end of the segment |
|
1368 | 1389 | and of the overall changegroup. |
|
1369 | 1390 | |
|
1370 | 1391 | Each filelog sub-segment consists of the following: |
|
1371 | 1392 | |
|
1372 | 1393 | +------------------------------------------------------+ |
|
1373 | 1394 | | | | | |
|
1374 | 1395 | | filename length | filename | delta group | |
|
1375 | 1396 | | (4 bytes) | (<length - 4> bytes) | (various) | |
|
1376 | 1397 | | | | | |
|
1377 | 1398 | +------------------------------------------------------+ |
|
1378 | 1399 | |
|
1379 | 1400 | That is, a *chunk* consisting of the filename (not terminated or padded) |
|
1380 | 1401 | followed by N chunks constituting the *delta group* for this file. The |
|
1381 | 1402 | *empty chunk* at the end of each *delta group* denotes the boundary to the |
|
1382 | 1403 | next filelog sub-segment. |
|
1383 | 1404 | |
|
1384 | 1405 | Test list of commands with command with no help text |
|
1385 | 1406 | |
|
1386 | 1407 | $ hg help helpext |
|
1387 | 1408 | helpext extension - no help text available |
|
1388 | 1409 | |
|
1389 | 1410 | list of commands: |
|
1390 | 1411 | |
|
1391 | 1412 | nohelp (no help text available) |
|
1392 | 1413 | |
|
1393 | 1414 | (use 'hg help -v helpext' to show built-in aliases and global options) |
|
1394 | 1415 | |
|
1395 | 1416 | |
|
1396 | 1417 | test advanced, deprecated and experimental options are hidden in command help |
|
1397 | 1418 | $ hg help debugoptADV |
|
1398 | 1419 | hg debugoptADV |
|
1399 | 1420 | |
|
1400 | 1421 | (no help text available) |
|
1401 | 1422 | |
|
1402 | 1423 | options: |
|
1403 | 1424 | |
|
1404 | 1425 | (some details hidden, use --verbose to show complete help) |
|
1405 | 1426 | $ hg help debugoptDEP |
|
1406 | 1427 | hg debugoptDEP |
|
1407 | 1428 | |
|
1408 | 1429 | (no help text available) |
|
1409 | 1430 | |
|
1410 | 1431 | options: |
|
1411 | 1432 | |
|
1412 | 1433 | (some details hidden, use --verbose to show complete help) |
|
1413 | 1434 | |
|
1414 | 1435 | $ hg help debugoptEXP |
|
1415 | 1436 | hg debugoptEXP |
|
1416 | 1437 | |
|
1417 | 1438 | (no help text available) |
|
1418 | 1439 | |
|
1419 | 1440 | options: |
|
1420 | 1441 | |
|
1421 | 1442 | (some details hidden, use --verbose to show complete help) |
|
1422 | 1443 | |
|
1423 | 1444 | test advanced, deprecated and experimental options are shown with -v |
|
1424 | 1445 | $ hg help -v debugoptADV | grep aopt |
|
1425 | 1446 | --aopt option is (ADVANCED) |
|
1426 | 1447 | $ hg help -v debugoptDEP | grep dopt |
|
1427 | 1448 | --dopt option is (DEPRECATED) |
|
1428 | 1449 | $ hg help -v debugoptEXP | grep eopt |
|
1429 | 1450 | --eopt option is (EXPERIMENTAL) |
|
1430 | 1451 | |
|
1431 | 1452 | #if gettext |
|
1432 | 1453 | test deprecated option is hidden with translation with untranslated description |
|
1433 | 1454 | (use many globy for not failing on changed transaction) |
|
1434 | 1455 | $ LANGUAGE=sv hg help debugoptDEP |
|
1435 | 1456 | hg debugoptDEP |
|
1436 | 1457 | |
|
1437 | 1458 | (*) (glob) |
|
1438 | 1459 | |
|
1439 | 1460 | options: |
|
1440 | 1461 | |
|
1441 | 1462 | (some details hidden, use --verbose to show complete help) |
|
1442 | 1463 | #endif |
|
1443 | 1464 | |
|
1444 | 1465 | Test commands that collide with topics (issue4240) |
|
1445 | 1466 | |
|
1446 | 1467 | $ hg config -hq |
|
1447 | 1468 | hg config [-u] [NAME]... |
|
1448 | 1469 | |
|
1449 | 1470 | show combined config settings from all hgrc files |
|
1450 | 1471 | $ hg showconfig -hq |
|
1451 | 1472 | hg config [-u] [NAME]... |
|
1452 | 1473 | |
|
1453 | 1474 | show combined config settings from all hgrc files |
|
1454 | 1475 | |
|
1455 | 1476 | Test a help topic |
|
1456 | 1477 | |
|
1457 | 1478 | $ hg help dates |
|
1458 | 1479 | Date Formats |
|
1459 | 1480 | """""""""""" |
|
1460 | 1481 | |
|
1461 | 1482 | Some commands allow the user to specify a date, e.g.: |
|
1462 | 1483 | |
|
1463 | 1484 | - backout, commit, import, tag: Specify the commit date. |
|
1464 | 1485 | - log, revert, update: Select revision(s) by date. |
|
1465 | 1486 | |
|
1466 | 1487 | Many date formats are valid. Here are some examples: |
|
1467 | 1488 | |
|
1468 | 1489 | - "Wed Dec 6 13:18:29 2006" (local timezone assumed) |
|
1469 | 1490 | - "Dec 6 13:18 -0600" (year assumed, time offset provided) |
|
1470 | 1491 | - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) |
|
1471 | 1492 | - "Dec 6" (midnight) |
|
1472 | 1493 | - "13:18" (today assumed) |
|
1473 | 1494 | - "3:39" (3:39AM assumed) |
|
1474 | 1495 | - "3:39pm" (15:39) |
|
1475 | 1496 | - "2006-12-06 13:18:29" (ISO 8601 format) |
|
1476 | 1497 | - "2006-12-6 13:18" |
|
1477 | 1498 | - "2006-12-6" |
|
1478 | 1499 | - "12-6" |
|
1479 | 1500 | - "12/6" |
|
1480 | 1501 | - "12/6/6" (Dec 6 2006) |
|
1481 | 1502 | - "today" (midnight) |
|
1482 | 1503 | - "yesterday" (midnight) |
|
1483 | 1504 | - "now" - right now |
|
1484 | 1505 | |
|
1485 | 1506 | Lastly, there is Mercurial's internal format: |
|
1486 | 1507 | |
|
1487 | 1508 | - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC) |
|
1488 | 1509 | |
|
1489 | 1510 | This is the internal representation format for dates. The first number is |
|
1490 | 1511 | the number of seconds since the epoch (1970-01-01 00:00 UTC). The second |
|
1491 | 1512 | is the offset of the local timezone, in seconds west of UTC (negative if |
|
1492 | 1513 | the timezone is east of UTC). |
|
1493 | 1514 | |
|
1494 | 1515 | The log command also accepts date ranges: |
|
1495 | 1516 | |
|
1496 | 1517 | - "<DATE" - at or before a given date/time |
|
1497 | 1518 | - ">DATE" - on or after a given date/time |
|
1498 | 1519 | - "DATE to DATE" - a date range, inclusive |
|
1499 | 1520 | - "-DAYS" - within a given number of days of today |
|
1500 | 1521 | |
|
1501 | 1522 | Test repeated config section name |
|
1502 | 1523 | |
|
1503 | 1524 | $ hg help config.host |
|
1504 | 1525 | "http_proxy.host" |
|
1505 | 1526 | Host name and (optional) port of the proxy server, for example |
|
1506 | 1527 | "myproxy:8000". |
|
1507 | 1528 | |
|
1508 | 1529 | "smtp.host" |
|
1509 | 1530 | Host name of mail server, e.g. "mail.example.com". |
|
1510 | 1531 | |
|
1511 | 1532 | |
|
1512 | 1533 | Test section name with dot |
|
1513 | 1534 | |
|
1514 | 1535 | $ hg help config.ui.username |
|
1515 | 1536 | "ui.username" |
|
1516 | 1537 | The committer of a changeset created when running "commit". Typically |
|
1517 | 1538 | a person's name and email address, e.g. "Fred Widget |
|
1518 | 1539 | <fred@example.com>". Environment variables in the username are |
|
1519 | 1540 | expanded. |
|
1520 | 1541 | |
|
1521 | 1542 | (default: "$EMAIL" or "username@hostname". If the username in hgrc is |
|
1522 | 1543 | empty, e.g. if the system admin set "username =" in the system hgrc, |
|
1523 | 1544 | it has to be specified manually or in a different hgrc file) |
|
1524 | 1545 | |
|
1525 | 1546 | |
|
1526 | 1547 | $ hg help config.annotate.git |
|
1527 | 1548 | abort: help section not found: config.annotate.git |
|
1528 | 1549 | [255] |
|
1529 | 1550 | |
|
1530 | 1551 | $ hg help config.update.check |
|
1531 | 1552 | "commands.update.check" |
|
1532 | 1553 | Determines what level of checking 'hg update' will perform before |
|
1533 | 1554 | moving to a destination revision. Valid values are "abort", "none", |
|
1534 | 1555 | "linear", and "noconflict". "abort" always fails if the working |
|
1535 | 1556 | directory has uncommitted changes. "none" performs no checking, and |
|
1536 | 1557 | may result in a merge with uncommitted changes. "linear" allows any |
|
1537 | 1558 | update as long as it follows a straight line in the revision history, |
|
1538 | 1559 | and may trigger a merge with uncommitted changes. "noconflict" will |
|
1539 | 1560 | allow any update which would not trigger a merge with uncommitted |
|
1540 | 1561 | changes, if any are present. (default: "linear") |
|
1541 | 1562 | |
|
1542 | 1563 | |
|
1543 | 1564 | $ hg help config.commands.update.check |
|
1544 | 1565 | "commands.update.check" |
|
1545 | 1566 | Determines what level of checking 'hg update' will perform before |
|
1546 | 1567 | moving to a destination revision. Valid values are "abort", "none", |
|
1547 | 1568 | "linear", and "noconflict". "abort" always fails if the working |
|
1548 | 1569 | directory has uncommitted changes. "none" performs no checking, and |
|
1549 | 1570 | may result in a merge with uncommitted changes. "linear" allows any |
|
1550 | 1571 | update as long as it follows a straight line in the revision history, |
|
1551 | 1572 | and may trigger a merge with uncommitted changes. "noconflict" will |
|
1552 | 1573 | allow any update which would not trigger a merge with uncommitted |
|
1553 | 1574 | changes, if any are present. (default: "linear") |
|
1554 | 1575 | |
|
1555 | 1576 | |
|
1556 | 1577 | $ hg help config.ommands.update.check |
|
1557 | 1578 | abort: help section not found: config.ommands.update.check |
|
1558 | 1579 | [255] |
|
1559 | 1580 | |
|
1560 | 1581 | Unrelated trailing paragraphs shouldn't be included |
|
1561 | 1582 | |
|
1562 | 1583 | $ hg help config.extramsg | grep '^$' |
|
1563 | 1584 | |
|
1564 | 1585 | |
|
1565 | 1586 | Test capitalized section name |
|
1566 | 1587 | |
|
1567 | 1588 | $ hg help scripting.HGPLAIN > /dev/null |
|
1568 | 1589 | |
|
1569 | 1590 | Help subsection: |
|
1570 | 1591 | |
|
1571 | 1592 | $ hg help config.charsets |grep "Email example:" > /dev/null |
|
1572 | 1593 | [1] |
|
1573 | 1594 | |
|
1574 | 1595 | Show nested definitions |
|
1575 | 1596 | ("profiling.type"[break]"ls"[break]"stat"[break]) |
|
1576 | 1597 | |
|
1577 | 1598 | $ hg help config.type | egrep '^$'|wc -l |
|
1578 | 1599 | \s*3 (re) |
|
1579 | 1600 | |
|
1580 | 1601 | $ hg help config.profiling.type.ls |
|
1581 | 1602 | "profiling.type.ls" |
|
1582 | 1603 | Use Python's built-in instrumenting profiler. This profiler works on |
|
1583 | 1604 | all platforms, but each line number it reports is the first line of |
|
1584 | 1605 | a function. This restriction makes it difficult to identify the |
|
1585 | 1606 | expensive parts of a non-trivial function. |
|
1586 | 1607 | |
|
1587 | 1608 | |
|
1588 | 1609 | Separate sections from subsections |
|
1589 | 1610 | |
|
1590 | 1611 | $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq |
|
1591 | 1612 | "format" |
|
1592 | 1613 | -------- |
|
1593 | 1614 | |
|
1594 | 1615 | "usegeneraldelta" |
|
1595 | 1616 | |
|
1596 | 1617 | "dotencode" |
|
1597 | 1618 | |
|
1598 | 1619 | "usefncache" |
|
1599 | 1620 | |
|
1600 | 1621 | "usestore" |
|
1601 | 1622 | |
|
1602 | 1623 | "profiling" |
|
1603 | 1624 | ----------- |
|
1604 | 1625 | |
|
1605 | 1626 | "format" |
|
1606 | 1627 | |
|
1607 | 1628 | "progress" |
|
1608 | 1629 | ---------- |
|
1609 | 1630 | |
|
1610 | 1631 | "format" |
|
1611 | 1632 | |
|
1612 | 1633 | |
|
1613 | 1634 | Last item in help config.*: |
|
1614 | 1635 | |
|
1615 | 1636 | $ hg help config.`hg help config|grep '^ "'| \ |
|
1616 | 1637 | > tail -1|sed 's![ "]*!!g'`| \ |
|
1617 | 1638 | > grep 'hg help -c config' > /dev/null |
|
1618 | 1639 | [1] |
|
1619 | 1640 | |
|
1620 | 1641 | note to use help -c for general hg help config: |
|
1621 | 1642 | |
|
1622 | 1643 | $ hg help config |grep 'hg help -c config' > /dev/null |
|
1623 | 1644 | |
|
1624 | 1645 | Test templating help |
|
1625 | 1646 | |
|
1626 | 1647 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' |
|
1627 | 1648 | desc String. The text of the changeset description. |
|
1628 | 1649 | diffstat String. Statistics of changes with the following format: |
|
1629 | 1650 | firstline Any text. Returns the first line of text. |
|
1630 | 1651 | nonempty Any text. Returns '(none)' if the string is empty. |
|
1631 | 1652 | |
|
1632 | 1653 | Test deprecated items |
|
1633 | 1654 | |
|
1634 | 1655 | $ hg help -v templating | grep currentbookmark |
|
1635 | 1656 | currentbookmark |
|
1636 | 1657 | $ hg help templating | (grep currentbookmark || true) |
|
1637 | 1658 | |
|
1638 | 1659 | Test help hooks |
|
1639 | 1660 | |
|
1640 | 1661 | $ cat > helphook1.py <<EOF |
|
1641 | 1662 | > from mercurial import help |
|
1642 | 1663 | > |
|
1643 | 1664 | > def rewrite(ui, topic, doc): |
|
1644 | 1665 | > return doc + b'\nhelphook1\n' |
|
1645 | 1666 | > |
|
1646 | 1667 | > def extsetup(ui): |
|
1647 | 1668 | > help.addtopichook(b'revisions', rewrite) |
|
1648 | 1669 | > EOF |
|
1649 | 1670 | $ cat > helphook2.py <<EOF |
|
1650 | 1671 | > from mercurial import help |
|
1651 | 1672 | > |
|
1652 | 1673 | > def rewrite(ui, topic, doc): |
|
1653 | 1674 | > return doc + b'\nhelphook2\n' |
|
1654 | 1675 | > |
|
1655 | 1676 | > def extsetup(ui): |
|
1656 | 1677 | > help.addtopichook(b'revisions', rewrite) |
|
1657 | 1678 | > EOF |
|
1658 | 1679 | $ echo '[extensions]' >> $HGRCPATH |
|
1659 | 1680 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH |
|
1660 | 1681 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH |
|
1661 | 1682 | $ hg help revsets | grep helphook |
|
1662 | 1683 | helphook1 |
|
1663 | 1684 | helphook2 |
|
1664 | 1685 | |
|
1665 | 1686 | help -c should only show debug --debug |
|
1666 | 1687 | |
|
1667 | 1688 | $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$' |
|
1668 | 1689 | [1] |
|
1669 | 1690 | |
|
1670 | 1691 | help -c should only show deprecated for -v |
|
1671 | 1692 | |
|
1672 | 1693 | $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$' |
|
1673 | 1694 | [1] |
|
1674 | 1695 | |
|
1675 | 1696 | Test -s / --system |
|
1676 | 1697 | |
|
1677 | 1698 | $ hg help config.files -s windows |grep 'etc/mercurial' | \ |
|
1678 | 1699 | > wc -l | sed -e 's/ //g' |
|
1679 | 1700 | 0 |
|
1680 | 1701 | $ hg help config.files --system unix | grep 'USER' | \ |
|
1681 | 1702 | > wc -l | sed -e 's/ //g' |
|
1682 | 1703 | 0 |
|
1683 | 1704 | |
|
1684 | 1705 | Test -e / -c / -k combinations |
|
1685 | 1706 | |
|
1686 | 1707 | $ hg help -c|egrep '^[A-Z].*:|^ debug' |
|
1687 | 1708 | Commands: |
|
1688 | 1709 | $ hg help -e|egrep '^[A-Z].*:|^ debug' |
|
1689 | 1710 | Extensions: |
|
1690 | 1711 | $ hg help -k|egrep '^[A-Z].*:|^ debug' |
|
1691 | 1712 | Topics: |
|
1692 | 1713 | Commands: |
|
1693 | 1714 | Extensions: |
|
1694 | 1715 | Extension Commands: |
|
1695 | 1716 | $ hg help -c schemes |
|
1696 | 1717 | abort: no such help topic: schemes |
|
1697 | 1718 | (try 'hg help --keyword schemes') |
|
1698 | 1719 | [255] |
|
1699 | 1720 | $ hg help -e schemes |head -1 |
|
1700 | 1721 | schemes extension - extend schemes with shortcuts to repository swarms |
|
1701 | 1722 | $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):' |
|
1702 | 1723 | Commands: |
|
1703 | 1724 | $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):' |
|
1704 | 1725 | Extensions: |
|
1705 | 1726 | $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):' |
|
1706 | 1727 | Extensions: |
|
1707 | 1728 | Commands: |
|
1708 | 1729 | $ hg help -c commit > /dev/null |
|
1709 | 1730 | $ hg help -e -c commit > /dev/null |
|
1710 | 1731 | $ hg help -e commit |
|
1711 | 1732 | abort: no such help topic: commit |
|
1712 | 1733 | (try 'hg help --keyword commit') |
|
1713 | 1734 | [255] |
|
1714 | 1735 | |
|
1715 | 1736 | Test keyword search help |
|
1716 | 1737 | |
|
1717 | 1738 | $ cat > prefixedname.py <<EOF |
|
1718 | 1739 | > '''matched against word "clone" |
|
1719 | 1740 | > ''' |
|
1720 | 1741 | > EOF |
|
1721 | 1742 | $ echo '[extensions]' >> $HGRCPATH |
|
1722 | 1743 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH |
|
1723 | 1744 | $ hg help -k clone |
|
1724 | 1745 | Topics: |
|
1725 | 1746 | |
|
1726 | 1747 | config Configuration Files |
|
1727 | 1748 | extensions Using Additional Features |
|
1728 | 1749 | glossary Glossary |
|
1729 | 1750 | phases Working with Phases |
|
1730 | 1751 | subrepos Subrepositories |
|
1731 | 1752 | urls URL Paths |
|
1732 | 1753 | |
|
1733 | 1754 | Commands: |
|
1734 | 1755 | |
|
1735 | 1756 | bookmarks create a new bookmark or list existing bookmarks |
|
1736 | 1757 | clone make a copy of an existing repository |
|
1737 | 1758 | paths show aliases for remote repositories |
|
1738 | 1759 | pull pull changes from the specified source |
|
1739 | 1760 | update update working directory (or switch revisions) |
|
1740 | 1761 | |
|
1741 | 1762 | Extensions: |
|
1742 | 1763 | |
|
1743 | 1764 | clonebundles advertise pre-generated bundles to seed clones |
|
1744 | 1765 | narrow create clones which fetch history data for subset of files |
|
1745 | 1766 | (EXPERIMENTAL) |
|
1746 | 1767 | prefixedname matched against word "clone" |
|
1747 | 1768 | relink recreates hardlinks between repository clones |
|
1748 | 1769 | |
|
1749 | 1770 | Extension Commands: |
|
1750 | 1771 | |
|
1751 | 1772 | qclone clone main and patch repository at same time |
|
1752 | 1773 | |
|
1753 | 1774 | Test unfound topic |
|
1754 | 1775 | |
|
1755 | 1776 | $ hg help nonexistingtopicthatwillneverexisteverever |
|
1756 | 1777 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever |
|
1757 | 1778 | (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever') |
|
1758 | 1779 | [255] |
|
1759 | 1780 | |
|
1760 | 1781 | Test unfound keyword |
|
1761 | 1782 | |
|
1762 | 1783 | $ hg help --keyword nonexistingwordthatwillneverexisteverever |
|
1763 | 1784 | abort: no matches |
|
1764 | 1785 | (try 'hg help' for a list of topics) |
|
1765 | 1786 | [255] |
|
1766 | 1787 | |
|
1767 | 1788 | Test omit indicating for help |
|
1768 | 1789 | |
|
1769 | 1790 | $ cat > addverboseitems.py <<EOF |
|
1770 | 1791 | > '''extension to test omit indicating. |
|
1771 | 1792 | > |
|
1772 | 1793 | > This paragraph is never omitted (for extension) |
|
1773 | 1794 | > |
|
1774 | 1795 | > .. container:: verbose |
|
1775 | 1796 | > |
|
1776 | 1797 | > This paragraph is omitted, |
|
1777 | 1798 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension) |
|
1778 | 1799 | > |
|
1779 | 1800 | > This paragraph is never omitted, too (for extension) |
|
1780 | 1801 | > ''' |
|
1781 | 1802 | > from __future__ import absolute_import |
|
1782 | 1803 | > from mercurial import commands, help |
|
1783 | 1804 | > testtopic = b"""This paragraph is never omitted (for topic). |
|
1784 | 1805 | > |
|
1785 | 1806 | > .. container:: verbose |
|
1786 | 1807 | > |
|
1787 | 1808 | > This paragraph is omitted, |
|
1788 | 1809 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic) |
|
1789 | 1810 | > |
|
1790 | 1811 | > This paragraph is never omitted, too (for topic) |
|
1791 | 1812 | > """ |
|
1792 | 1813 | > def extsetup(ui): |
|
1793 | 1814 | > help.helptable.append(([b"topic-containing-verbose"], |
|
1794 | 1815 | > b"This is the topic to test omit indicating.", |
|
1795 | 1816 | > lambda ui: testtopic)) |
|
1796 | 1817 | > EOF |
|
1797 | 1818 | $ echo '[extensions]' >> $HGRCPATH |
|
1798 | 1819 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH |
|
1799 | 1820 | $ hg help addverboseitems |
|
1800 | 1821 | addverboseitems extension - extension to test omit indicating. |
|
1801 | 1822 | |
|
1802 | 1823 | This paragraph is never omitted (for extension) |
|
1803 | 1824 | |
|
1804 | 1825 | This paragraph is never omitted, too (for extension) |
|
1805 | 1826 | |
|
1806 | 1827 | (some details hidden, use --verbose to show complete help) |
|
1807 | 1828 | |
|
1808 | 1829 | no commands defined |
|
1809 | 1830 | $ hg help -v addverboseitems |
|
1810 | 1831 | addverboseitems extension - extension to test omit indicating. |
|
1811 | 1832 | |
|
1812 | 1833 | This paragraph is never omitted (for extension) |
|
1813 | 1834 | |
|
1814 | 1835 | This paragraph is omitted, if 'hg help' is invoked without "-v" (for |
|
1815 | 1836 | extension) |
|
1816 | 1837 | |
|
1817 | 1838 | This paragraph is never omitted, too (for extension) |
|
1818 | 1839 | |
|
1819 | 1840 | no commands defined |
|
1820 | 1841 | $ hg help topic-containing-verbose |
|
1821 | 1842 | This is the topic to test omit indicating. |
|
1822 | 1843 | """""""""""""""""""""""""""""""""""""""""" |
|
1823 | 1844 | |
|
1824 | 1845 | This paragraph is never omitted (for topic). |
|
1825 | 1846 | |
|
1826 | 1847 | This paragraph is never omitted, too (for topic) |
|
1827 | 1848 | |
|
1828 | 1849 | (some details hidden, use --verbose to show complete help) |
|
1829 | 1850 | $ hg help -v topic-containing-verbose |
|
1830 | 1851 | This is the topic to test omit indicating. |
|
1831 | 1852 | """""""""""""""""""""""""""""""""""""""""" |
|
1832 | 1853 | |
|
1833 | 1854 | This paragraph is never omitted (for topic). |
|
1834 | 1855 | |
|
1835 | 1856 | This paragraph is omitted, if 'hg help' is invoked without "-v" (for |
|
1836 | 1857 | topic) |
|
1837 | 1858 | |
|
1838 | 1859 | This paragraph is never omitted, too (for topic) |
|
1839 | 1860 | |
|
1840 | 1861 | Test section lookup |
|
1841 | 1862 | |
|
1842 | 1863 | $ hg help revset.merge |
|
1843 | 1864 | "merge()" |
|
1844 | 1865 | Changeset is a merge changeset. |
|
1845 | 1866 | |
|
1846 | 1867 | $ hg help glossary.dag |
|
1847 | 1868 | DAG |
|
1848 | 1869 | The repository of changesets of a distributed version control system |
|
1849 | 1870 | (DVCS) can be described as a directed acyclic graph (DAG), consisting |
|
1850 | 1871 | of nodes and edges, where nodes correspond to changesets and edges |
|
1851 | 1872 | imply a parent -> child relation. This graph can be visualized by |
|
1852 | 1873 | graphical tools such as 'hg log --graph'. In Mercurial, the DAG is |
|
1853 | 1874 | limited by the requirement for children to have at most two parents. |
|
1854 | 1875 | |
|
1855 | 1876 | |
|
1856 | 1877 | $ hg help hgrc.paths |
|
1857 | 1878 | "paths" |
|
1858 | 1879 | ------- |
|
1859 | 1880 | |
|
1860 | 1881 | Assigns symbolic names and behavior to repositories. |
|
1861 | 1882 | |
|
1862 | 1883 | Options are symbolic names defining the URL or directory that is the |
|
1863 | 1884 | location of the repository. Example: |
|
1864 | 1885 | |
|
1865 | 1886 | [paths] |
|
1866 | 1887 | my_server = https://example.com/my_repo |
|
1867 | 1888 | local_path = /home/me/repo |
|
1868 | 1889 | |
|
1869 | 1890 | These symbolic names can be used from the command line. To pull from |
|
1870 | 1891 | "my_server": 'hg pull my_server'. To push to "local_path": 'hg push |
|
1871 | 1892 | local_path'. |
|
1872 | 1893 | |
|
1873 | 1894 | Options containing colons (":") denote sub-options that can influence |
|
1874 | 1895 | behavior for that specific path. Example: |
|
1875 | 1896 | |
|
1876 | 1897 | [paths] |
|
1877 | 1898 | my_server = https://example.com/my_path |
|
1878 | 1899 | my_server:pushurl = ssh://example.com/my_path |
|
1879 | 1900 | |
|
1880 | 1901 | The following sub-options can be defined: |
|
1881 | 1902 | |
|
1882 | 1903 | "pushurl" |
|
1883 | 1904 | The URL to use for push operations. If not defined, the location |
|
1884 | 1905 | defined by the path's main entry is used. |
|
1885 | 1906 | |
|
1886 | 1907 | "pushrev" |
|
1887 | 1908 | A revset defining which revisions to push by default. |
|
1888 | 1909 | |
|
1889 | 1910 | When 'hg push' is executed without a "-r" argument, the revset defined |
|
1890 | 1911 | by this sub-option is evaluated to determine what to push. |
|
1891 | 1912 | |
|
1892 | 1913 | For example, a value of "." will push the working directory's revision |
|
1893 | 1914 | by default. |
|
1894 | 1915 | |
|
1895 | 1916 | Revsets specifying bookmarks will not result in the bookmark being |
|
1896 | 1917 | pushed. |
|
1897 | 1918 | |
|
1898 | 1919 | The following special named paths exist: |
|
1899 | 1920 | |
|
1900 | 1921 | "default" |
|
1901 | 1922 | The URL or directory to use when no source or remote is specified. |
|
1902 | 1923 | |
|
1903 | 1924 | 'hg clone' will automatically define this path to the location the |
|
1904 | 1925 | repository was cloned from. |
|
1905 | 1926 | |
|
1906 | 1927 | "default-push" |
|
1907 | 1928 | (deprecated) The URL or directory for the default 'hg push' location. |
|
1908 | 1929 | "default:pushurl" should be used instead. |
|
1909 | 1930 | |
|
1910 | 1931 | $ hg help glossary.mcguffin |
|
1911 | 1932 | abort: help section not found: glossary.mcguffin |
|
1912 | 1933 | [255] |
|
1913 | 1934 | |
|
1914 | 1935 | $ hg help glossary.mc.guffin |
|
1915 | 1936 | abort: help section not found: glossary.mc.guffin |
|
1916 | 1937 | [255] |
|
1917 | 1938 | |
|
1918 | 1939 | $ hg help template.files |
|
1919 | 1940 | files List of strings. All files modified, added, or removed by |
|
1920 | 1941 | this changeset. |
|
1921 | 1942 | files(pattern) |
|
1922 | 1943 | All files of the current changeset matching the pattern. See |
|
1923 | 1944 | 'hg help patterns'. |
|
1924 | 1945 | |
|
1925 | 1946 | Test section lookup by translated message |
|
1926 | 1947 | |
|
1927 | 1948 | str.lower() instead of encoding.lower(str) on translated message might |
|
1928 | 1949 | make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z) |
|
1929 | 1950 | as the second or later byte of multi-byte character. |
|
1930 | 1951 | |
|
1931 | 1952 | For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932) |
|
1932 | 1953 | contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this |
|
1933 | 1954 | replacement makes message meaningless. |
|
1934 | 1955 | |
|
1935 | 1956 | This tests that section lookup by translated string isn't broken by |
|
1936 | 1957 | such str.lower(). |
|
1937 | 1958 | |
|
1938 | 1959 | $ "$PYTHON" <<EOF |
|
1939 | 1960 | > def escape(s): |
|
1940 | 1961 | > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932')) |
|
1941 | 1962 | > # translation of "record" in ja_JP.cp932 |
|
1942 | 1963 | > upper = b"\x8bL\x98^" |
|
1943 | 1964 | > # str.lower()-ed section name should be treated as different one |
|
1944 | 1965 | > lower = b"\x8bl\x98^" |
|
1945 | 1966 | > with open('ambiguous.py', 'wb') as fp: |
|
1946 | 1967 | > fp.write(b"""# ambiguous section names in ja_JP.cp932 |
|
1947 | 1968 | > u'''summary of extension |
|
1948 | 1969 | > |
|
1949 | 1970 | > %s |
|
1950 | 1971 | > ---- |
|
1951 | 1972 | > |
|
1952 | 1973 | > Upper name should show only this message |
|
1953 | 1974 | > |
|
1954 | 1975 | > %s |
|
1955 | 1976 | > ---- |
|
1956 | 1977 | > |
|
1957 | 1978 | > Lower name should show only this message |
|
1958 | 1979 | > |
|
1959 | 1980 | > subsequent section |
|
1960 | 1981 | > ------------------ |
|
1961 | 1982 | > |
|
1962 | 1983 | > This should be hidden at 'hg help ambiguous' with section name. |
|
1963 | 1984 | > ''' |
|
1964 | 1985 | > """ % (escape(upper), escape(lower))) |
|
1965 | 1986 | > EOF |
|
1966 | 1987 | |
|
1967 | 1988 | $ cat >> $HGRCPATH <<EOF |
|
1968 | 1989 | > [extensions] |
|
1969 | 1990 | > ambiguous = ./ambiguous.py |
|
1970 | 1991 | > EOF |
|
1971 | 1992 | |
|
1972 | 1993 | $ "$PYTHON" <<EOF | sh |
|
1973 | 1994 | > from mercurial import pycompat |
|
1974 | 1995 | > upper = b"\x8bL\x98^" |
|
1975 | 1996 | > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper) |
|
1976 | 1997 | > EOF |
|
1977 | 1998 | \x8bL\x98^ (esc) |
|
1978 | 1999 | ---- |
|
1979 | 2000 | |
|
1980 | 2001 | Upper name should show only this message |
|
1981 | 2002 | |
|
1982 | 2003 | |
|
1983 | 2004 | $ "$PYTHON" <<EOF | sh |
|
1984 | 2005 | > from mercurial import pycompat |
|
1985 | 2006 | > lower = b"\x8bl\x98^" |
|
1986 | 2007 | > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower) |
|
1987 | 2008 | > EOF |
|
1988 | 2009 | \x8bl\x98^ (esc) |
|
1989 | 2010 | ---- |
|
1990 | 2011 | |
|
1991 | 2012 | Lower name should show only this message |
|
1992 | 2013 | |
|
1993 | 2014 | |
|
1994 | 2015 | $ cat >> $HGRCPATH <<EOF |
|
1995 | 2016 | > [extensions] |
|
1996 | 2017 | > ambiguous = ! |
|
1997 | 2018 | > EOF |
|
1998 | 2019 | |
|
1999 | 2020 | Show help content of disabled extensions |
|
2000 | 2021 | |
|
2001 | 2022 | $ cat >> $HGRCPATH <<EOF |
|
2002 | 2023 | > [extensions] |
|
2003 | 2024 | > ambiguous = !./ambiguous.py |
|
2004 | 2025 | > EOF |
|
2005 | 2026 | $ hg help -e ambiguous |
|
2006 | 2027 | ambiguous extension - (no help text available) |
|
2007 | 2028 | |
|
2008 | 2029 | (use 'hg help extensions' for information on enabling extensions) |
|
2009 | 2030 | |
|
2010 | 2031 | Test dynamic list of merge tools only shows up once |
|
2011 | 2032 | $ hg help merge-tools |
|
2012 | 2033 | Merge Tools |
|
2013 | 2034 | """"""""""" |
|
2014 | 2035 | |
|
2015 | 2036 | To merge files Mercurial uses merge tools. |
|
2016 | 2037 | |
|
2017 | 2038 | A merge tool combines two different versions of a file into a merged file. |
|
2018 | 2039 | Merge tools are given the two files and the greatest common ancestor of |
|
2019 | 2040 | the two file versions, so they can determine the changes made on both |
|
2020 | 2041 | branches. |
|
2021 | 2042 | |
|
2022 | 2043 | Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg |
|
2023 | 2044 | backout' and in several extensions. |
|
2024 | 2045 | |
|
2025 | 2046 | Usually, the merge tool tries to automatically reconcile the files by |
|
2026 | 2047 | combining all non-overlapping changes that occurred separately in the two |
|
2027 | 2048 | different evolutions of the same initial base file. Furthermore, some |
|
2028 | 2049 | interactive merge programs make it easier to manually resolve conflicting |
|
2029 | 2050 | merges, either in a graphical way, or by inserting some conflict markers. |
|
2030 | 2051 | Mercurial does not include any interactive merge programs but relies on |
|
2031 | 2052 | external tools for that. |
|
2032 | 2053 | |
|
2033 | 2054 | Available merge tools |
|
2034 | 2055 | ===================== |
|
2035 | 2056 | |
|
2036 | 2057 | External merge tools and their properties are configured in the merge- |
|
2037 | 2058 | tools configuration section - see hgrc(5) - but they can often just be |
|
2038 | 2059 | named by their executable. |
|
2039 | 2060 | |
|
2040 | 2061 | A merge tool is generally usable if its executable can be found on the |
|
2041 | 2062 | system and if it can handle the merge. The executable is found if it is an |
|
2042 | 2063 | absolute or relative executable path or the name of an application in the |
|
2043 | 2064 | executable search path. The tool is assumed to be able to handle the merge |
|
2044 | 2065 | if it can handle symlinks if the file is a symlink, if it can handle |
|
2045 | 2066 | binary files if the file is binary, and if a GUI is available if the tool |
|
2046 | 2067 | requires a GUI. |
|
2047 | 2068 | |
|
2048 | 2069 | There are some internal merge tools which can be used. The internal merge |
|
2049 | 2070 | tools are: |
|
2050 | 2071 | |
|
2051 | 2072 | ":dump" |
|
2052 | 2073 | Creates three versions of the files to merge, containing the contents of |
|
2053 | 2074 | local, other and base. These files can then be used to perform a merge |
|
2054 | 2075 | manually. If the file to be merged is named "a.txt", these files will |
|
2055 | 2076 | accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and |
|
2056 | 2077 | they will be placed in the same directory as "a.txt". |
|
2057 | 2078 | |
|
2058 | 2079 | This implies premerge. Therefore, files aren't dumped, if premerge runs |
|
2059 | 2080 | successfully. Use :forcedump to forcibly write files out. |
|
2060 | 2081 | |
|
2061 | 2082 | (actual capabilities: binary, symlink) |
|
2062 | 2083 | |
|
2063 | 2084 | ":fail" |
|
2064 | 2085 | Rather than attempting to merge files that were modified on both |
|
2065 | 2086 | branches, it marks them as unresolved. The resolve command must be used |
|
2066 | 2087 | to resolve these conflicts. |
|
2067 | 2088 | |
|
2068 | 2089 | (actual capabilities: binary, symlink) |
|
2069 | 2090 | |
|
2070 | 2091 | ":forcedump" |
|
2071 | 2092 | Creates three versions of the files as same as :dump, but omits |
|
2072 | 2093 | premerge. |
|
2073 | 2094 | |
|
2074 | 2095 | (actual capabilities: binary, symlink) |
|
2075 | 2096 | |
|
2076 | 2097 | ":local" |
|
2077 | 2098 | Uses the local 'p1()' version of files as the merged version. |
|
2078 | 2099 | |
|
2079 | 2100 | (actual capabilities: binary, symlink) |
|
2080 | 2101 | |
|
2081 | 2102 | ":merge" |
|
2082 | 2103 | Uses the internal non-interactive simple merge algorithm for merging |
|
2083 | 2104 | files. It will fail if there are any conflicts and leave markers in the |
|
2084 | 2105 | partially merged file. Markers will have two sections, one for each side |
|
2085 | 2106 | of merge. |
|
2086 | 2107 | |
|
2087 | 2108 | ":merge-local" |
|
2088 | 2109 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
2089 | 2110 | local 'p1()' changes. |
|
2090 | 2111 | |
|
2091 | 2112 | ":merge-other" |
|
2092 | 2113 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
2093 | 2114 | other 'p2()' changes. |
|
2094 | 2115 | |
|
2095 | 2116 | ":merge3" |
|
2096 | 2117 | Uses the internal non-interactive simple merge algorithm for merging |
|
2097 | 2118 | files. It will fail if there are any conflicts and leave markers in the |
|
2098 | 2119 | partially merged file. Marker will have three sections, one from each |
|
2099 | 2120 | side of the merge and one for the base content. |
|
2100 | 2121 | |
|
2101 | 2122 | ":other" |
|
2102 | 2123 | Uses the other 'p2()' version of files as the merged version. |
|
2103 | 2124 | |
|
2104 | 2125 | (actual capabilities: binary, symlink) |
|
2105 | 2126 | |
|
2106 | 2127 | ":prompt" |
|
2107 | 2128 | Asks the user which of the local 'p1()' or the other 'p2()' version to |
|
2108 | 2129 | keep as the merged version. |
|
2109 | 2130 | |
|
2110 | 2131 | (actual capabilities: binary, symlink) |
|
2111 | 2132 | |
|
2112 | 2133 | ":tagmerge" |
|
2113 | 2134 | Uses the internal tag merge algorithm (experimental). |
|
2114 | 2135 | |
|
2115 | 2136 | ":union" |
|
2116 | 2137 | Uses the internal non-interactive simple merge algorithm for merging |
|
2117 | 2138 | files. It will use both left and right sides for conflict regions. No |
|
2118 | 2139 | markers are inserted. |
|
2119 | 2140 | |
|
2120 | 2141 | Internal tools are always available and do not require a GUI but will by |
|
2121 | 2142 | default not handle symlinks or binary files. See next section for detail |
|
2122 | 2143 | about "actual capabilities" described above. |
|
2123 | 2144 | |
|
2124 | 2145 | Choosing a merge tool |
|
2125 | 2146 | ===================== |
|
2126 | 2147 | |
|
2127 | 2148 | Mercurial uses these rules when deciding which merge tool to use: |
|
2128 | 2149 | |
|
2129 | 2150 | 1. If a tool has been specified with the --tool option to merge or |
|
2130 | 2151 | resolve, it is used. If it is the name of a tool in the merge-tools |
|
2131 | 2152 | configuration, its configuration is used. Otherwise the specified tool |
|
2132 | 2153 | must be executable by the shell. |
|
2133 | 2154 | 2. If the "HGMERGE" environment variable is present, its value is used and |
|
2134 | 2155 | must be executable by the shell. |
|
2135 | 2156 | 3. If the filename of the file to be merged matches any of the patterns in |
|
2136 | 2157 | the merge-patterns configuration section, the first usable merge tool |
|
2137 | 2158 | corresponding to a matching pattern is used. |
|
2138 | 2159 | 4. If ui.merge is set it will be considered next. If the value is not the |
|
2139 | 2160 | name of a configured tool, the specified value is used and must be |
|
2140 | 2161 | executable by the shell. Otherwise the named tool is used if it is |
|
2141 | 2162 | usable. |
|
2142 | 2163 | 5. If any usable merge tools are present in the merge-tools configuration |
|
2143 | 2164 | section, the one with the highest priority is used. |
|
2144 | 2165 | 6. If a program named "hgmerge" can be found on the system, it is used - |
|
2145 | 2166 | but it will by default not be used for symlinks and binary files. |
|
2146 | 2167 | 7. If the file to be merged is not binary and is not a symlink, then |
|
2147 | 2168 | internal ":merge" is used. |
|
2148 | 2169 | 8. Otherwise, ":prompt" is used. |
|
2149 | 2170 | |
|
2150 | 2171 | For historical reason, Mercurial treats merge tools as below while |
|
2151 | 2172 | examining rules above. |
|
2152 | 2173 | |
|
2153 | 2174 | step specified via binary symlink |
|
2154 | 2175 | ---------------------------------- |
|
2155 | 2176 | 1. --tool o/o o/o |
|
2156 | 2177 | 2. HGMERGE o/o o/o |
|
2157 | 2178 | 3. merge-patterns o/o(*) x/?(*) |
|
2158 | 2179 | 4. ui.merge x/?(*) x/?(*) |
|
2159 | 2180 | |
|
2160 | 2181 | Each capability column indicates Mercurial behavior for internal/external |
|
2161 | 2182 | merge tools at examining each rule. |
|
2162 | 2183 | |
|
2163 | 2184 | - "o": "assume that a tool has capability" |
|
2164 | 2185 | - "x": "assume that a tool does not have capability" |
|
2165 | 2186 | - "?": "check actual capability of a tool" |
|
2166 | 2187 | |
|
2167 | 2188 | If "merge.strict-capability-check" configuration is true, Mercurial checks |
|
2168 | 2189 | capabilities of merge tools strictly in (*) cases above (= each capability |
|
2169 | 2190 | column becomes "?/?"). It is false by default for backward compatibility. |
|
2170 | 2191 | |
|
2171 | 2192 | Note: |
|
2172 | 2193 | After selecting a merge program, Mercurial will by default attempt to |
|
2173 | 2194 | merge the files using a simple merge algorithm first. Only if it |
|
2174 | 2195 | doesn't succeed because of conflicting changes will Mercurial actually |
|
2175 | 2196 | execute the merge program. Whether to use the simple merge algorithm |
|
2176 | 2197 | first can be controlled by the premerge setting of the merge tool. |
|
2177 | 2198 | Premerge is enabled by default unless the file is binary or a symlink. |
|
2178 | 2199 | |
|
2179 | 2200 | See the merge-tools and ui sections of hgrc(5) for details on the |
|
2180 | 2201 | configuration of merge tools. |
|
2181 | 2202 | |
|
2182 | 2203 | Compression engines listed in `hg help bundlespec` |
|
2183 | 2204 | |
|
2184 | 2205 | $ hg help bundlespec | grep gzip |
|
2185 | 2206 | "v1" bundles can only use the "gzip", "bzip2", and "none" compression |
|
2186 | 2207 | An algorithm that produces smaller bundles than "gzip". |
|
2187 | 2208 | This engine will likely produce smaller bundles than "gzip" but will be |
|
2188 | 2209 | "gzip" |
|
2189 | 2210 | better compression than "gzip". It also frequently yields better (?) |
|
2190 | 2211 | |
|
2191 | 2212 | Test usage of section marks in help documents |
|
2192 | 2213 | |
|
2193 | 2214 | $ cd "$TESTDIR"/../doc |
|
2194 | 2215 | $ "$PYTHON" check-seclevel.py |
|
2195 | 2216 | $ cd $TESTTMP |
|
2196 | 2217 | |
|
2197 | 2218 | #if serve |
|
2198 | 2219 | |
|
2199 | 2220 | Test the help pages in hgweb. |
|
2200 | 2221 | |
|
2201 | 2222 | Dish up an empty repo; serve it cold. |
|
2202 | 2223 | |
|
2203 | 2224 | $ hg init "$TESTTMP/test" |
|
2204 | 2225 | $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid |
|
2205 | 2226 | $ cat hg.pid >> $DAEMON_PIDS |
|
2206 | 2227 | |
|
2207 | 2228 | $ get-with-headers.py $LOCALIP:$HGPORT "help" |
|
2208 | 2229 | 200 Script output follows |
|
2209 | 2230 | |
|
2210 | 2231 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2211 | 2232 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2212 | 2233 | <head> |
|
2213 | 2234 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2214 | 2235 | <meta name="robots" content="index, nofollow" /> |
|
2215 | 2236 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2216 | 2237 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2217 | 2238 | |
|
2218 | 2239 | <title>Help: Index</title> |
|
2219 | 2240 | </head> |
|
2220 | 2241 | <body> |
|
2221 | 2242 | |
|
2222 | 2243 | <div class="container"> |
|
2223 | 2244 | <div class="menu"> |
|
2224 | 2245 | <div class="logo"> |
|
2225 | 2246 | <a href="https://mercurial-scm.org/"> |
|
2226 | 2247 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2227 | 2248 | </div> |
|
2228 | 2249 | <ul> |
|
2229 | 2250 | <li><a href="/shortlog">log</a></li> |
|
2230 | 2251 | <li><a href="/graph">graph</a></li> |
|
2231 | 2252 | <li><a href="/tags">tags</a></li> |
|
2232 | 2253 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2233 | 2254 | <li><a href="/branches">branches</a></li> |
|
2234 | 2255 | </ul> |
|
2235 | 2256 | <ul> |
|
2236 | 2257 | <li class="active">help</li> |
|
2237 | 2258 | </ul> |
|
2238 | 2259 | </div> |
|
2239 | 2260 | |
|
2240 | 2261 | <div class="main"> |
|
2241 | 2262 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2242 | 2263 | |
|
2243 | 2264 | <form class="search" action="/log"> |
|
2244 | 2265 | |
|
2245 | 2266 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
2246 | 2267 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2247 | 2268 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2248 | 2269 | </form> |
|
2249 | 2270 | <table class="bigtable"> |
|
2250 | 2271 | <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr> |
|
2251 | 2272 | |
|
2252 | 2273 | <tr><td> |
|
2253 | 2274 | <a href="/help/bundlespec"> |
|
2254 | 2275 | bundlespec |
|
2255 | 2276 | </a> |
|
2256 | 2277 | </td><td> |
|
2257 | 2278 | Bundle File Formats |
|
2258 | 2279 | </td></tr> |
|
2259 | 2280 | <tr><td> |
|
2260 | 2281 | <a href="/help/color"> |
|
2261 | 2282 | color |
|
2262 | 2283 | </a> |
|
2263 | 2284 | </td><td> |
|
2264 | 2285 | Colorizing Outputs |
|
2265 | 2286 | </td></tr> |
|
2266 | 2287 | <tr><td> |
|
2267 | 2288 | <a href="/help/config"> |
|
2268 | 2289 | config |
|
2269 | 2290 | </a> |
|
2270 | 2291 | </td><td> |
|
2271 | 2292 | Configuration Files |
|
2272 | 2293 | </td></tr> |
|
2273 | 2294 | <tr><td> |
|
2274 | 2295 | <a href="/help/dates"> |
|
2275 | 2296 | dates |
|
2276 | 2297 | </a> |
|
2277 | 2298 | </td><td> |
|
2278 | 2299 | Date Formats |
|
2279 | 2300 | </td></tr> |
|
2280 | 2301 | <tr><td> |
|
2281 | 2302 | <a href="/help/deprecated"> |
|
2282 | 2303 | deprecated |
|
2283 | 2304 | </a> |
|
2284 | 2305 | </td><td> |
|
2285 | 2306 | Deprecated Features |
|
2286 | 2307 | </td></tr> |
|
2287 | 2308 | <tr><td> |
|
2288 | 2309 | <a href="/help/diffs"> |
|
2289 | 2310 | diffs |
|
2290 | 2311 | </a> |
|
2291 | 2312 | </td><td> |
|
2292 | 2313 | Diff Formats |
|
2293 | 2314 | </td></tr> |
|
2294 | 2315 | <tr><td> |
|
2295 | 2316 | <a href="/help/environment"> |
|
2296 | 2317 | environment |
|
2297 | 2318 | </a> |
|
2298 | 2319 | </td><td> |
|
2299 | 2320 | Environment Variables |
|
2300 | 2321 | </td></tr> |
|
2301 | 2322 | <tr><td> |
|
2302 | 2323 | <a href="/help/extensions"> |
|
2303 | 2324 | extensions |
|
2304 | 2325 | </a> |
|
2305 | 2326 | </td><td> |
|
2306 | 2327 | Using Additional Features |
|
2307 | 2328 | </td></tr> |
|
2308 | 2329 | <tr><td> |
|
2309 | 2330 | <a href="/help/filesets"> |
|
2310 | 2331 | filesets |
|
2311 | 2332 | </a> |
|
2312 | 2333 | </td><td> |
|
2313 | 2334 | Specifying File Sets |
|
2314 | 2335 | </td></tr> |
|
2315 | 2336 | <tr><td> |
|
2316 | 2337 | <a href="/help/flags"> |
|
2317 | 2338 | flags |
|
2318 | 2339 | </a> |
|
2319 | 2340 | </td><td> |
|
2320 | 2341 | Command-line flags |
|
2321 | 2342 | </td></tr> |
|
2322 | 2343 | <tr><td> |
|
2323 | 2344 | <a href="/help/glossary"> |
|
2324 | 2345 | glossary |
|
2325 | 2346 | </a> |
|
2326 | 2347 | </td><td> |
|
2327 | 2348 | Glossary |
|
2328 | 2349 | </td></tr> |
|
2329 | 2350 | <tr><td> |
|
2330 | 2351 | <a href="/help/hgignore"> |
|
2331 | 2352 | hgignore |
|
2332 | 2353 | </a> |
|
2333 | 2354 | </td><td> |
|
2334 | 2355 | Syntax for Mercurial Ignore Files |
|
2335 | 2356 | </td></tr> |
|
2336 | 2357 | <tr><td> |
|
2337 | 2358 | <a href="/help/hgweb"> |
|
2338 | 2359 | hgweb |
|
2339 | 2360 | </a> |
|
2340 | 2361 | </td><td> |
|
2341 | 2362 | Configuring hgweb |
|
2342 | 2363 | </td></tr> |
|
2343 | 2364 | <tr><td> |
|
2344 | 2365 | <a href="/help/internals"> |
|
2345 | 2366 | internals |
|
2346 | 2367 | </a> |
|
2347 | 2368 | </td><td> |
|
2348 | 2369 | Technical implementation topics |
|
2349 | 2370 | </td></tr> |
|
2350 | 2371 | <tr><td> |
|
2351 | 2372 | <a href="/help/merge-tools"> |
|
2352 | 2373 | merge-tools |
|
2353 | 2374 | </a> |
|
2354 | 2375 | </td><td> |
|
2355 | 2376 | Merge Tools |
|
2356 | 2377 | </td></tr> |
|
2357 | 2378 | <tr><td> |
|
2358 | 2379 | <a href="/help/pager"> |
|
2359 | 2380 | pager |
|
2360 | 2381 | </a> |
|
2361 | 2382 | </td><td> |
|
2362 | 2383 | Pager Support |
|
2363 | 2384 | </td></tr> |
|
2364 | 2385 | <tr><td> |
|
2365 | 2386 | <a href="/help/patterns"> |
|
2366 | 2387 | patterns |
|
2367 | 2388 | </a> |
|
2368 | 2389 | </td><td> |
|
2369 | 2390 | File Name Patterns |
|
2370 | 2391 | </td></tr> |
|
2371 | 2392 | <tr><td> |
|
2372 | 2393 | <a href="/help/phases"> |
|
2373 | 2394 | phases |
|
2374 | 2395 | </a> |
|
2375 | 2396 | </td><td> |
|
2376 | 2397 | Working with Phases |
|
2377 | 2398 | </td></tr> |
|
2378 | 2399 | <tr><td> |
|
2379 | 2400 | <a href="/help/revisions"> |
|
2380 | 2401 | revisions |
|
2381 | 2402 | </a> |
|
2382 | 2403 | </td><td> |
|
2383 | 2404 | Specifying Revisions |
|
2384 | 2405 | </td></tr> |
|
2385 | 2406 | <tr><td> |
|
2386 | 2407 | <a href="/help/scripting"> |
|
2387 | 2408 | scripting |
|
2388 | 2409 | </a> |
|
2389 | 2410 | </td><td> |
|
2390 | 2411 | Using Mercurial from scripts and automation |
|
2391 | 2412 | </td></tr> |
|
2392 | 2413 | <tr><td> |
|
2393 | 2414 | <a href="/help/subrepos"> |
|
2394 | 2415 | subrepos |
|
2395 | 2416 | </a> |
|
2396 | 2417 | </td><td> |
|
2397 | 2418 | Subrepositories |
|
2398 | 2419 | </td></tr> |
|
2399 | 2420 | <tr><td> |
|
2400 | 2421 | <a href="/help/templating"> |
|
2401 | 2422 | templating |
|
2402 | 2423 | </a> |
|
2403 | 2424 | </td><td> |
|
2404 | 2425 | Template Usage |
|
2405 | 2426 | </td></tr> |
|
2406 | 2427 | <tr><td> |
|
2407 | 2428 | <a href="/help/urls"> |
|
2408 | 2429 | urls |
|
2409 | 2430 | </a> |
|
2410 | 2431 | </td><td> |
|
2411 | 2432 | URL Paths |
|
2412 | 2433 | </td></tr> |
|
2413 | 2434 | <tr><td> |
|
2414 | 2435 | <a href="/help/topic-containing-verbose"> |
|
2415 | 2436 | topic-containing-verbose |
|
2416 | 2437 | </a> |
|
2417 | 2438 | </td><td> |
|
2418 | 2439 | This is the topic to test omit indicating. |
|
2419 | 2440 | </td></tr> |
|
2420 | 2441 | |
|
2421 | 2442 | |
|
2422 | 2443 | <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr> |
|
2423 | 2444 | |
|
2424 | 2445 | <tr><td> |
|
2425 | 2446 | <a href="/help/add"> |
|
2426 | 2447 | add |
|
2427 | 2448 | </a> |
|
2428 | 2449 | </td><td> |
|
2429 | 2450 | add the specified files on the next commit |
|
2430 | 2451 | </td></tr> |
|
2431 | 2452 | <tr><td> |
|
2432 | 2453 | <a href="/help/annotate"> |
|
2433 | 2454 | annotate |
|
2434 | 2455 | </a> |
|
2435 | 2456 | </td><td> |
|
2436 | 2457 | show changeset information by line for each file |
|
2437 | 2458 | </td></tr> |
|
2438 | 2459 | <tr><td> |
|
2439 | 2460 | <a href="/help/clone"> |
|
2440 | 2461 | clone |
|
2441 | 2462 | </a> |
|
2442 | 2463 | </td><td> |
|
2443 | 2464 | make a copy of an existing repository |
|
2444 | 2465 | </td></tr> |
|
2445 | 2466 | <tr><td> |
|
2446 | 2467 | <a href="/help/commit"> |
|
2447 | 2468 | commit |
|
2448 | 2469 | </a> |
|
2449 | 2470 | </td><td> |
|
2450 | 2471 | commit the specified files or all outstanding changes |
|
2451 | 2472 | </td></tr> |
|
2452 | 2473 | <tr><td> |
|
2453 | 2474 | <a href="/help/diff"> |
|
2454 | 2475 | diff |
|
2455 | 2476 | </a> |
|
2456 | 2477 | </td><td> |
|
2457 | 2478 | diff repository (or selected files) |
|
2458 | 2479 | </td></tr> |
|
2459 | 2480 | <tr><td> |
|
2460 | 2481 | <a href="/help/export"> |
|
2461 | 2482 | export |
|
2462 | 2483 | </a> |
|
2463 | 2484 | </td><td> |
|
2464 | 2485 | dump the header and diffs for one or more changesets |
|
2465 | 2486 | </td></tr> |
|
2466 | 2487 | <tr><td> |
|
2467 | 2488 | <a href="/help/forget"> |
|
2468 | 2489 | forget |
|
2469 | 2490 | </a> |
|
2470 | 2491 | </td><td> |
|
2471 | 2492 | forget the specified files on the next commit |
|
2472 | 2493 | </td></tr> |
|
2473 | 2494 | <tr><td> |
|
2474 | 2495 | <a href="/help/init"> |
|
2475 | 2496 | init |
|
2476 | 2497 | </a> |
|
2477 | 2498 | </td><td> |
|
2478 | 2499 | create a new repository in the given directory |
|
2479 | 2500 | </td></tr> |
|
2480 | 2501 | <tr><td> |
|
2481 | 2502 | <a href="/help/log"> |
|
2482 | 2503 | log |
|
2483 | 2504 | </a> |
|
2484 | 2505 | </td><td> |
|
2485 | 2506 | show revision history of entire repository or files |
|
2486 | 2507 | </td></tr> |
|
2487 | 2508 | <tr><td> |
|
2488 | 2509 | <a href="/help/merge"> |
|
2489 | 2510 | merge |
|
2490 | 2511 | </a> |
|
2491 | 2512 | </td><td> |
|
2492 | 2513 | merge another revision into working directory |
|
2493 | 2514 | </td></tr> |
|
2494 | 2515 | <tr><td> |
|
2495 | 2516 | <a href="/help/pull"> |
|
2496 | 2517 | pull |
|
2497 | 2518 | </a> |
|
2498 | 2519 | </td><td> |
|
2499 | 2520 | pull changes from the specified source |
|
2500 | 2521 | </td></tr> |
|
2501 | 2522 | <tr><td> |
|
2502 | 2523 | <a href="/help/push"> |
|
2503 | 2524 | push |
|
2504 | 2525 | </a> |
|
2505 | 2526 | </td><td> |
|
2506 | 2527 | push changes to the specified destination |
|
2507 | 2528 | </td></tr> |
|
2508 | 2529 | <tr><td> |
|
2509 | 2530 | <a href="/help/remove"> |
|
2510 | 2531 | remove |
|
2511 | 2532 | </a> |
|
2512 | 2533 | </td><td> |
|
2513 | 2534 | remove the specified files on the next commit |
|
2514 | 2535 | </td></tr> |
|
2515 | 2536 | <tr><td> |
|
2516 | 2537 | <a href="/help/serve"> |
|
2517 | 2538 | serve |
|
2518 | 2539 | </a> |
|
2519 | 2540 | </td><td> |
|
2520 | 2541 | start stand-alone webserver |
|
2521 | 2542 | </td></tr> |
|
2522 | 2543 | <tr><td> |
|
2523 | 2544 | <a href="/help/status"> |
|
2524 | 2545 | status |
|
2525 | 2546 | </a> |
|
2526 | 2547 | </td><td> |
|
2527 | 2548 | show changed files in the working directory |
|
2528 | 2549 | </td></tr> |
|
2529 | 2550 | <tr><td> |
|
2530 | 2551 | <a href="/help/summary"> |
|
2531 | 2552 | summary |
|
2532 | 2553 | </a> |
|
2533 | 2554 | </td><td> |
|
2534 | 2555 | summarize working directory state |
|
2535 | 2556 | </td></tr> |
|
2536 | 2557 | <tr><td> |
|
2537 | 2558 | <a href="/help/update"> |
|
2538 | 2559 | update |
|
2539 | 2560 | </a> |
|
2540 | 2561 | </td><td> |
|
2541 | 2562 | update working directory (or switch revisions) |
|
2542 | 2563 | </td></tr> |
|
2543 | 2564 | |
|
2544 | 2565 | |
|
2545 | 2566 | |
|
2546 | 2567 | <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr> |
|
2547 | 2568 | |
|
2548 | 2569 | <tr><td> |
|
2549 | 2570 | <a href="/help/addremove"> |
|
2550 | 2571 | addremove |
|
2551 | 2572 | </a> |
|
2552 | 2573 | </td><td> |
|
2553 | 2574 | add all new files, delete all missing files |
|
2554 | 2575 | </td></tr> |
|
2555 | 2576 | <tr><td> |
|
2556 | 2577 | <a href="/help/archive"> |
|
2557 | 2578 | archive |
|
2558 | 2579 | </a> |
|
2559 | 2580 | </td><td> |
|
2560 | 2581 | create an unversioned archive of a repository revision |
|
2561 | 2582 | </td></tr> |
|
2562 | 2583 | <tr><td> |
|
2563 | 2584 | <a href="/help/backout"> |
|
2564 | 2585 | backout |
|
2565 | 2586 | </a> |
|
2566 | 2587 | </td><td> |
|
2567 | 2588 | reverse effect of earlier changeset |
|
2568 | 2589 | </td></tr> |
|
2569 | 2590 | <tr><td> |
|
2570 | 2591 | <a href="/help/bisect"> |
|
2571 | 2592 | bisect |
|
2572 | 2593 | </a> |
|
2573 | 2594 | </td><td> |
|
2574 | 2595 | subdivision search of changesets |
|
2575 | 2596 | </td></tr> |
|
2576 | 2597 | <tr><td> |
|
2577 | 2598 | <a href="/help/bookmarks"> |
|
2578 | 2599 | bookmarks |
|
2579 | 2600 | </a> |
|
2580 | 2601 | </td><td> |
|
2581 | 2602 | create a new bookmark or list existing bookmarks |
|
2582 | 2603 | </td></tr> |
|
2583 | 2604 | <tr><td> |
|
2584 | 2605 | <a href="/help/branch"> |
|
2585 | 2606 | branch |
|
2586 | 2607 | </a> |
|
2587 | 2608 | </td><td> |
|
2588 | 2609 | set or show the current branch name |
|
2589 | 2610 | </td></tr> |
|
2590 | 2611 | <tr><td> |
|
2591 | 2612 | <a href="/help/branches"> |
|
2592 | 2613 | branches |
|
2593 | 2614 | </a> |
|
2594 | 2615 | </td><td> |
|
2595 | 2616 | list repository named branches |
|
2596 | 2617 | </td></tr> |
|
2597 | 2618 | <tr><td> |
|
2598 | 2619 | <a href="/help/bundle"> |
|
2599 | 2620 | bundle |
|
2600 | 2621 | </a> |
|
2601 | 2622 | </td><td> |
|
2602 | 2623 | create a bundle file |
|
2603 | 2624 | </td></tr> |
|
2604 | 2625 | <tr><td> |
|
2605 | 2626 | <a href="/help/cat"> |
|
2606 | 2627 | cat |
|
2607 | 2628 | </a> |
|
2608 | 2629 | </td><td> |
|
2609 | 2630 | output the current or given revision of files |
|
2610 | 2631 | </td></tr> |
|
2611 | 2632 | <tr><td> |
|
2612 | 2633 | <a href="/help/config"> |
|
2613 | 2634 | config |
|
2614 | 2635 | </a> |
|
2615 | 2636 | </td><td> |
|
2616 | 2637 | show combined config settings from all hgrc files |
|
2617 | 2638 | </td></tr> |
|
2618 | 2639 | <tr><td> |
|
2619 | 2640 | <a href="/help/copy"> |
|
2620 | 2641 | copy |
|
2621 | 2642 | </a> |
|
2622 | 2643 | </td><td> |
|
2623 | 2644 | mark files as copied for the next commit |
|
2624 | 2645 | </td></tr> |
|
2625 | 2646 | <tr><td> |
|
2626 | 2647 | <a href="/help/files"> |
|
2627 | 2648 | files |
|
2628 | 2649 | </a> |
|
2629 | 2650 | </td><td> |
|
2630 | 2651 | list tracked files |
|
2631 | 2652 | </td></tr> |
|
2632 | 2653 | <tr><td> |
|
2633 | 2654 | <a href="/help/graft"> |
|
2634 | 2655 | graft |
|
2635 | 2656 | </a> |
|
2636 | 2657 | </td><td> |
|
2637 | 2658 | copy changes from other branches onto the current branch |
|
2638 | 2659 | </td></tr> |
|
2639 | 2660 | <tr><td> |
|
2640 | 2661 | <a href="/help/grep"> |
|
2641 | 2662 | grep |
|
2642 | 2663 | </a> |
|
2643 | 2664 | </td><td> |
|
2644 | 2665 | search revision history for a pattern in specified files |
|
2645 | 2666 | </td></tr> |
|
2646 | 2667 | <tr><td> |
|
2647 | 2668 | <a href="/help/heads"> |
|
2648 | 2669 | heads |
|
2649 | 2670 | </a> |
|
2650 | 2671 | </td><td> |
|
2651 | 2672 | show branch heads |
|
2652 | 2673 | </td></tr> |
|
2653 | 2674 | <tr><td> |
|
2654 | 2675 | <a href="/help/help"> |
|
2655 | 2676 | help |
|
2656 | 2677 | </a> |
|
2657 | 2678 | </td><td> |
|
2658 | 2679 | show help for a given topic or a help overview |
|
2659 | 2680 | </td></tr> |
|
2660 | 2681 | <tr><td> |
|
2661 | 2682 | <a href="/help/hgalias"> |
|
2662 | 2683 | hgalias |
|
2663 | 2684 | </a> |
|
2664 | 2685 | </td><td> |
|
2686 | My doc | |
|
2687 | </td></tr> | |
|
2688 | <tr><td> | |
|
2689 | <a href="/help/hgaliasnodoc"> | |
|
2690 | hgaliasnodoc | |
|
2691 | </a> | |
|
2692 | </td><td> | |
|
2665 | 2693 | summarize working directory state |
|
2666 | 2694 | </td></tr> |
|
2667 | 2695 | <tr><td> |
|
2668 | 2696 | <a href="/help/identify"> |
|
2669 | 2697 | identify |
|
2670 | 2698 | </a> |
|
2671 | 2699 | </td><td> |
|
2672 | 2700 | identify the working directory or specified revision |
|
2673 | 2701 | </td></tr> |
|
2674 | 2702 | <tr><td> |
|
2675 | 2703 | <a href="/help/import"> |
|
2676 | 2704 | import |
|
2677 | 2705 | </a> |
|
2678 | 2706 | </td><td> |
|
2679 | 2707 | import an ordered set of patches |
|
2680 | 2708 | </td></tr> |
|
2681 | 2709 | <tr><td> |
|
2682 | 2710 | <a href="/help/incoming"> |
|
2683 | 2711 | incoming |
|
2684 | 2712 | </a> |
|
2685 | 2713 | </td><td> |
|
2686 | 2714 | show new changesets found in source |
|
2687 | 2715 | </td></tr> |
|
2688 | 2716 | <tr><td> |
|
2689 | 2717 | <a href="/help/manifest"> |
|
2690 | 2718 | manifest |
|
2691 | 2719 | </a> |
|
2692 | 2720 | </td><td> |
|
2693 | 2721 | output the current or given revision of the project manifest |
|
2694 | 2722 | </td></tr> |
|
2695 | 2723 | <tr><td> |
|
2696 | 2724 | <a href="/help/nohelp"> |
|
2697 | 2725 | nohelp |
|
2698 | 2726 | </a> |
|
2699 | 2727 | </td><td> |
|
2700 | 2728 | (no help text available) |
|
2701 | 2729 | </td></tr> |
|
2702 | 2730 | <tr><td> |
|
2703 | 2731 | <a href="/help/outgoing"> |
|
2704 | 2732 | outgoing |
|
2705 | 2733 | </a> |
|
2706 | 2734 | </td><td> |
|
2707 | 2735 | show changesets not found in the destination |
|
2708 | 2736 | </td></tr> |
|
2709 | 2737 | <tr><td> |
|
2710 | 2738 | <a href="/help/paths"> |
|
2711 | 2739 | paths |
|
2712 | 2740 | </a> |
|
2713 | 2741 | </td><td> |
|
2714 | 2742 | show aliases for remote repositories |
|
2715 | 2743 | </td></tr> |
|
2716 | 2744 | <tr><td> |
|
2717 | 2745 | <a href="/help/phase"> |
|
2718 | 2746 | phase |
|
2719 | 2747 | </a> |
|
2720 | 2748 | </td><td> |
|
2721 | 2749 | set or show the current phase name |
|
2722 | 2750 | </td></tr> |
|
2723 | 2751 | <tr><td> |
|
2724 | 2752 | <a href="/help/recover"> |
|
2725 | 2753 | recover |
|
2726 | 2754 | </a> |
|
2727 | 2755 | </td><td> |
|
2728 | 2756 | roll back an interrupted transaction |
|
2729 | 2757 | </td></tr> |
|
2730 | 2758 | <tr><td> |
|
2731 | 2759 | <a href="/help/rename"> |
|
2732 | 2760 | rename |
|
2733 | 2761 | </a> |
|
2734 | 2762 | </td><td> |
|
2735 | 2763 | rename files; equivalent of copy + remove |
|
2736 | 2764 | </td></tr> |
|
2737 | 2765 | <tr><td> |
|
2738 | 2766 | <a href="/help/resolve"> |
|
2739 | 2767 | resolve |
|
2740 | 2768 | </a> |
|
2741 | 2769 | </td><td> |
|
2742 | 2770 | redo merges or set/view the merge status of files |
|
2743 | 2771 | </td></tr> |
|
2744 | 2772 | <tr><td> |
|
2745 | 2773 | <a href="/help/revert"> |
|
2746 | 2774 | revert |
|
2747 | 2775 | </a> |
|
2748 | 2776 | </td><td> |
|
2749 | 2777 | restore files to their checkout state |
|
2750 | 2778 | </td></tr> |
|
2751 | 2779 | <tr><td> |
|
2752 | 2780 | <a href="/help/root"> |
|
2753 | 2781 | root |
|
2754 | 2782 | </a> |
|
2755 | 2783 | </td><td> |
|
2756 | 2784 | print the root (top) of the current working directory |
|
2757 | 2785 | </td></tr> |
|
2758 | 2786 | <tr><td> |
|
2759 | 2787 | <a href="/help/shellalias"> |
|
2760 | 2788 | shellalias |
|
2761 | 2789 | </a> |
|
2762 | 2790 | </td><td> |
|
2763 | 2791 | (no help text available) |
|
2764 | 2792 | </td></tr> |
|
2765 | 2793 | <tr><td> |
|
2766 | 2794 | <a href="/help/tag"> |
|
2767 | 2795 | tag |
|
2768 | 2796 | </a> |
|
2769 | 2797 | </td><td> |
|
2770 | 2798 | add one or more tags for the current or given revision |
|
2771 | 2799 | </td></tr> |
|
2772 | 2800 | <tr><td> |
|
2773 | 2801 | <a href="/help/tags"> |
|
2774 | 2802 | tags |
|
2775 | 2803 | </a> |
|
2776 | 2804 | </td><td> |
|
2777 | 2805 | list repository tags |
|
2778 | 2806 | </td></tr> |
|
2779 | 2807 | <tr><td> |
|
2780 | 2808 | <a href="/help/unbundle"> |
|
2781 | 2809 | unbundle |
|
2782 | 2810 | </a> |
|
2783 | 2811 | </td><td> |
|
2784 | 2812 | apply one or more bundle files |
|
2785 | 2813 | </td></tr> |
|
2786 | 2814 | <tr><td> |
|
2787 | 2815 | <a href="/help/verify"> |
|
2788 | 2816 | verify |
|
2789 | 2817 | </a> |
|
2790 | 2818 | </td><td> |
|
2791 | 2819 | verify the integrity of the repository |
|
2792 | 2820 | </td></tr> |
|
2793 | 2821 | <tr><td> |
|
2794 | 2822 | <a href="/help/version"> |
|
2795 | 2823 | version |
|
2796 | 2824 | </a> |
|
2797 | 2825 | </td><td> |
|
2798 | 2826 | output version and copyright information |
|
2799 | 2827 | </td></tr> |
|
2800 | 2828 | |
|
2801 | 2829 | |
|
2802 | 2830 | </table> |
|
2803 | 2831 | </div> |
|
2804 | 2832 | </div> |
|
2805 | 2833 | |
|
2806 | 2834 | |
|
2807 | 2835 | |
|
2808 | 2836 | </body> |
|
2809 | 2837 | </html> |
|
2810 | 2838 | |
|
2811 | 2839 | |
|
2812 | 2840 | $ get-with-headers.py $LOCALIP:$HGPORT "help/add" |
|
2813 | 2841 | 200 Script output follows |
|
2814 | 2842 | |
|
2815 | 2843 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2816 | 2844 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2817 | 2845 | <head> |
|
2818 | 2846 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2819 | 2847 | <meta name="robots" content="index, nofollow" /> |
|
2820 | 2848 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2821 | 2849 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2822 | 2850 | |
|
2823 | 2851 | <title>Help: add</title> |
|
2824 | 2852 | </head> |
|
2825 | 2853 | <body> |
|
2826 | 2854 | |
|
2827 | 2855 | <div class="container"> |
|
2828 | 2856 | <div class="menu"> |
|
2829 | 2857 | <div class="logo"> |
|
2830 | 2858 | <a href="https://mercurial-scm.org/"> |
|
2831 | 2859 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2832 | 2860 | </div> |
|
2833 | 2861 | <ul> |
|
2834 | 2862 | <li><a href="/shortlog">log</a></li> |
|
2835 | 2863 | <li><a href="/graph">graph</a></li> |
|
2836 | 2864 | <li><a href="/tags">tags</a></li> |
|
2837 | 2865 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2838 | 2866 | <li><a href="/branches">branches</a></li> |
|
2839 | 2867 | </ul> |
|
2840 | 2868 | <ul> |
|
2841 | 2869 | <li class="active"><a href="/help">help</a></li> |
|
2842 | 2870 | </ul> |
|
2843 | 2871 | </div> |
|
2844 | 2872 | |
|
2845 | 2873 | <div class="main"> |
|
2846 | 2874 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2847 | 2875 | <h3>Help: add</h3> |
|
2848 | 2876 | |
|
2849 | 2877 | <form class="search" action="/log"> |
|
2850 | 2878 | |
|
2851 | 2879 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
2852 | 2880 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2853 | 2881 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2854 | 2882 | </form> |
|
2855 | 2883 | <div id="doc"> |
|
2856 | 2884 | <p> |
|
2857 | 2885 | hg add [OPTION]... [FILE]... |
|
2858 | 2886 | </p> |
|
2859 | 2887 | <p> |
|
2860 | 2888 | add the specified files on the next commit |
|
2861 | 2889 | </p> |
|
2862 | 2890 | <p> |
|
2863 | 2891 | Schedule files to be version controlled and added to the |
|
2864 | 2892 | repository. |
|
2865 | 2893 | </p> |
|
2866 | 2894 | <p> |
|
2867 | 2895 | The files will be added to the repository at the next commit. To |
|
2868 | 2896 | undo an add before that, see 'hg forget'. |
|
2869 | 2897 | </p> |
|
2870 | 2898 | <p> |
|
2871 | 2899 | If no names are given, add all files to the repository (except |
|
2872 | 2900 | files matching ".hgignore"). |
|
2873 | 2901 | </p> |
|
2874 | 2902 | <p> |
|
2875 | 2903 | Examples: |
|
2876 | 2904 | </p> |
|
2877 | 2905 | <ul> |
|
2878 | 2906 | <li> New (unknown) files are added automatically by 'hg add': |
|
2879 | 2907 | <pre> |
|
2880 | 2908 | \$ ls (re) |
|
2881 | 2909 | foo.c |
|
2882 | 2910 | \$ hg status (re) |
|
2883 | 2911 | ? foo.c |
|
2884 | 2912 | \$ hg add (re) |
|
2885 | 2913 | adding foo.c |
|
2886 | 2914 | \$ hg status (re) |
|
2887 | 2915 | A foo.c |
|
2888 | 2916 | </pre> |
|
2889 | 2917 | <li> Specific files to be added can be specified: |
|
2890 | 2918 | <pre> |
|
2891 | 2919 | \$ ls (re) |
|
2892 | 2920 | bar.c foo.c |
|
2893 | 2921 | \$ hg status (re) |
|
2894 | 2922 | ? bar.c |
|
2895 | 2923 | ? foo.c |
|
2896 | 2924 | \$ hg add bar.c (re) |
|
2897 | 2925 | \$ hg status (re) |
|
2898 | 2926 | A bar.c |
|
2899 | 2927 | ? foo.c |
|
2900 | 2928 | </pre> |
|
2901 | 2929 | </ul> |
|
2902 | 2930 | <p> |
|
2903 | 2931 | Returns 0 if all files are successfully added. |
|
2904 | 2932 | </p> |
|
2905 | 2933 | <p> |
|
2906 | 2934 | options ([+] can be repeated): |
|
2907 | 2935 | </p> |
|
2908 | 2936 | <table> |
|
2909 | 2937 | <tr><td>-I</td> |
|
2910 | 2938 | <td>--include PATTERN [+]</td> |
|
2911 | 2939 | <td>include names matching the given patterns</td></tr> |
|
2912 | 2940 | <tr><td>-X</td> |
|
2913 | 2941 | <td>--exclude PATTERN [+]</td> |
|
2914 | 2942 | <td>exclude names matching the given patterns</td></tr> |
|
2915 | 2943 | <tr><td>-S</td> |
|
2916 | 2944 | <td>--subrepos</td> |
|
2917 | 2945 | <td>recurse into subrepositories</td></tr> |
|
2918 | 2946 | <tr><td>-n</td> |
|
2919 | 2947 | <td>--dry-run</td> |
|
2920 | 2948 | <td>do not perform actions, just print output</td></tr> |
|
2921 | 2949 | </table> |
|
2922 | 2950 | <p> |
|
2923 | 2951 | global options ([+] can be repeated): |
|
2924 | 2952 | </p> |
|
2925 | 2953 | <table> |
|
2926 | 2954 | <tr><td>-R</td> |
|
2927 | 2955 | <td>--repository REPO</td> |
|
2928 | 2956 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
2929 | 2957 | <tr><td></td> |
|
2930 | 2958 | <td>--cwd DIR</td> |
|
2931 | 2959 | <td>change working directory</td></tr> |
|
2932 | 2960 | <tr><td>-y</td> |
|
2933 | 2961 | <td>--noninteractive</td> |
|
2934 | 2962 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
2935 | 2963 | <tr><td>-q</td> |
|
2936 | 2964 | <td>--quiet</td> |
|
2937 | 2965 | <td>suppress output</td></tr> |
|
2938 | 2966 | <tr><td>-v</td> |
|
2939 | 2967 | <td>--verbose</td> |
|
2940 | 2968 | <td>enable additional output</td></tr> |
|
2941 | 2969 | <tr><td></td> |
|
2942 | 2970 | <td>--color TYPE</td> |
|
2943 | 2971 | <td>when to colorize (boolean, always, auto, never, or debug)</td></tr> |
|
2944 | 2972 | <tr><td></td> |
|
2945 | 2973 | <td>--config CONFIG [+]</td> |
|
2946 | 2974 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
2947 | 2975 | <tr><td></td> |
|
2948 | 2976 | <td>--debug</td> |
|
2949 | 2977 | <td>enable debugging output</td></tr> |
|
2950 | 2978 | <tr><td></td> |
|
2951 | 2979 | <td>--debugger</td> |
|
2952 | 2980 | <td>start debugger</td></tr> |
|
2953 | 2981 | <tr><td></td> |
|
2954 | 2982 | <td>--encoding ENCODE</td> |
|
2955 | 2983 | <td>set the charset encoding (default: ascii)</td></tr> |
|
2956 | 2984 | <tr><td></td> |
|
2957 | 2985 | <td>--encodingmode MODE</td> |
|
2958 | 2986 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
2959 | 2987 | <tr><td></td> |
|
2960 | 2988 | <td>--traceback</td> |
|
2961 | 2989 | <td>always print a traceback on exception</td></tr> |
|
2962 | 2990 | <tr><td></td> |
|
2963 | 2991 | <td>--time</td> |
|
2964 | 2992 | <td>time how long the command takes</td></tr> |
|
2965 | 2993 | <tr><td></td> |
|
2966 | 2994 | <td>--profile</td> |
|
2967 | 2995 | <td>print command execution profile</td></tr> |
|
2968 | 2996 | <tr><td></td> |
|
2969 | 2997 | <td>--version</td> |
|
2970 | 2998 | <td>output version information and exit</td></tr> |
|
2971 | 2999 | <tr><td>-h</td> |
|
2972 | 3000 | <td>--help</td> |
|
2973 | 3001 | <td>display help and exit</td></tr> |
|
2974 | 3002 | <tr><td></td> |
|
2975 | 3003 | <td>--hidden</td> |
|
2976 | 3004 | <td>consider hidden changesets</td></tr> |
|
2977 | 3005 | <tr><td></td> |
|
2978 | 3006 | <td>--pager TYPE</td> |
|
2979 | 3007 | <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr> |
|
2980 | 3008 | </table> |
|
2981 | 3009 | |
|
2982 | 3010 | </div> |
|
2983 | 3011 | </div> |
|
2984 | 3012 | </div> |
|
2985 | 3013 | |
|
2986 | 3014 | |
|
2987 | 3015 | |
|
2988 | 3016 | </body> |
|
2989 | 3017 | </html> |
|
2990 | 3018 | |
|
2991 | 3019 | |
|
2992 | 3020 | $ get-with-headers.py $LOCALIP:$HGPORT "help/remove" |
|
2993 | 3021 | 200 Script output follows |
|
2994 | 3022 | |
|
2995 | 3023 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2996 | 3024 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2997 | 3025 | <head> |
|
2998 | 3026 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2999 | 3027 | <meta name="robots" content="index, nofollow" /> |
|
3000 | 3028 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3001 | 3029 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3002 | 3030 | |
|
3003 | 3031 | <title>Help: remove</title> |
|
3004 | 3032 | </head> |
|
3005 | 3033 | <body> |
|
3006 | 3034 | |
|
3007 | 3035 | <div class="container"> |
|
3008 | 3036 | <div class="menu"> |
|
3009 | 3037 | <div class="logo"> |
|
3010 | 3038 | <a href="https://mercurial-scm.org/"> |
|
3011 | 3039 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3012 | 3040 | </div> |
|
3013 | 3041 | <ul> |
|
3014 | 3042 | <li><a href="/shortlog">log</a></li> |
|
3015 | 3043 | <li><a href="/graph">graph</a></li> |
|
3016 | 3044 | <li><a href="/tags">tags</a></li> |
|
3017 | 3045 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3018 | 3046 | <li><a href="/branches">branches</a></li> |
|
3019 | 3047 | </ul> |
|
3020 | 3048 | <ul> |
|
3021 | 3049 | <li class="active"><a href="/help">help</a></li> |
|
3022 | 3050 | </ul> |
|
3023 | 3051 | </div> |
|
3024 | 3052 | |
|
3025 | 3053 | <div class="main"> |
|
3026 | 3054 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3027 | 3055 | <h3>Help: remove</h3> |
|
3028 | 3056 | |
|
3029 | 3057 | <form class="search" action="/log"> |
|
3030 | 3058 | |
|
3031 | 3059 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3032 | 3060 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3033 | 3061 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3034 | 3062 | </form> |
|
3035 | 3063 | <div id="doc"> |
|
3036 | 3064 | <p> |
|
3037 | 3065 | hg remove [OPTION]... FILE... |
|
3038 | 3066 | </p> |
|
3039 | 3067 | <p> |
|
3040 | 3068 | aliases: rm |
|
3041 | 3069 | </p> |
|
3042 | 3070 | <p> |
|
3043 | 3071 | remove the specified files on the next commit |
|
3044 | 3072 | </p> |
|
3045 | 3073 | <p> |
|
3046 | 3074 | Schedule the indicated files for removal from the current branch. |
|
3047 | 3075 | </p> |
|
3048 | 3076 | <p> |
|
3049 | 3077 | This command schedules the files to be removed at the next commit. |
|
3050 | 3078 | To undo a remove before that, see 'hg revert'. To undo added |
|
3051 | 3079 | files, see 'hg forget'. |
|
3052 | 3080 | </p> |
|
3053 | 3081 | <p> |
|
3054 | 3082 | -A/--after can be used to remove only files that have already |
|
3055 | 3083 | been deleted, -f/--force can be used to force deletion, and -Af |
|
3056 | 3084 | can be used to remove files from the next revision without |
|
3057 | 3085 | deleting them from the working directory. |
|
3058 | 3086 | </p> |
|
3059 | 3087 | <p> |
|
3060 | 3088 | The following table details the behavior of remove for different |
|
3061 | 3089 | file states (columns) and option combinations (rows). The file |
|
3062 | 3090 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
3063 | 3091 | (as reported by 'hg status'). The actions are Warn, Remove |
|
3064 | 3092 | (from branch) and Delete (from disk): |
|
3065 | 3093 | </p> |
|
3066 | 3094 | <table> |
|
3067 | 3095 | <tr><td>opt/state</td> |
|
3068 | 3096 | <td>A</td> |
|
3069 | 3097 | <td>C</td> |
|
3070 | 3098 | <td>M</td> |
|
3071 | 3099 | <td>!</td></tr> |
|
3072 | 3100 | <tr><td>none</td> |
|
3073 | 3101 | <td>W</td> |
|
3074 | 3102 | <td>RD</td> |
|
3075 | 3103 | <td>W</td> |
|
3076 | 3104 | <td>R</td></tr> |
|
3077 | 3105 | <tr><td>-f</td> |
|
3078 | 3106 | <td>R</td> |
|
3079 | 3107 | <td>RD</td> |
|
3080 | 3108 | <td>RD</td> |
|
3081 | 3109 | <td>R</td></tr> |
|
3082 | 3110 | <tr><td>-A</td> |
|
3083 | 3111 | <td>W</td> |
|
3084 | 3112 | <td>W</td> |
|
3085 | 3113 | <td>W</td> |
|
3086 | 3114 | <td>R</td></tr> |
|
3087 | 3115 | <tr><td>-Af</td> |
|
3088 | 3116 | <td>R</td> |
|
3089 | 3117 | <td>R</td> |
|
3090 | 3118 | <td>R</td> |
|
3091 | 3119 | <td>R</td></tr> |
|
3092 | 3120 | </table> |
|
3093 | 3121 | <p> |
|
3094 | 3122 | <b>Note:</b> |
|
3095 | 3123 | </p> |
|
3096 | 3124 | <p> |
|
3097 | 3125 | 'hg remove' never deletes files in Added [A] state from the |
|
3098 | 3126 | working directory, not even if "--force" is specified. |
|
3099 | 3127 | </p> |
|
3100 | 3128 | <p> |
|
3101 | 3129 | Returns 0 on success, 1 if any warnings encountered. |
|
3102 | 3130 | </p> |
|
3103 | 3131 | <p> |
|
3104 | 3132 | options ([+] can be repeated): |
|
3105 | 3133 | </p> |
|
3106 | 3134 | <table> |
|
3107 | 3135 | <tr><td>-A</td> |
|
3108 | 3136 | <td>--after</td> |
|
3109 | 3137 | <td>record delete for missing files</td></tr> |
|
3110 | 3138 | <tr><td>-f</td> |
|
3111 | 3139 | <td>--force</td> |
|
3112 | 3140 | <td>forget added files, delete modified files</td></tr> |
|
3113 | 3141 | <tr><td>-S</td> |
|
3114 | 3142 | <td>--subrepos</td> |
|
3115 | 3143 | <td>recurse into subrepositories</td></tr> |
|
3116 | 3144 | <tr><td>-I</td> |
|
3117 | 3145 | <td>--include PATTERN [+]</td> |
|
3118 | 3146 | <td>include names matching the given patterns</td></tr> |
|
3119 | 3147 | <tr><td>-X</td> |
|
3120 | 3148 | <td>--exclude PATTERN [+]</td> |
|
3121 | 3149 | <td>exclude names matching the given patterns</td></tr> |
|
3122 | 3150 | <tr><td>-n</td> |
|
3123 | 3151 | <td>--dry-run</td> |
|
3124 | 3152 | <td>do not perform actions, just print output</td></tr> |
|
3125 | 3153 | </table> |
|
3126 | 3154 | <p> |
|
3127 | 3155 | global options ([+] can be repeated): |
|
3128 | 3156 | </p> |
|
3129 | 3157 | <table> |
|
3130 | 3158 | <tr><td>-R</td> |
|
3131 | 3159 | <td>--repository REPO</td> |
|
3132 | 3160 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
3133 | 3161 | <tr><td></td> |
|
3134 | 3162 | <td>--cwd DIR</td> |
|
3135 | 3163 | <td>change working directory</td></tr> |
|
3136 | 3164 | <tr><td>-y</td> |
|
3137 | 3165 | <td>--noninteractive</td> |
|
3138 | 3166 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
3139 | 3167 | <tr><td>-q</td> |
|
3140 | 3168 | <td>--quiet</td> |
|
3141 | 3169 | <td>suppress output</td></tr> |
|
3142 | 3170 | <tr><td>-v</td> |
|
3143 | 3171 | <td>--verbose</td> |
|
3144 | 3172 | <td>enable additional output</td></tr> |
|
3145 | 3173 | <tr><td></td> |
|
3146 | 3174 | <td>--color TYPE</td> |
|
3147 | 3175 | <td>when to colorize (boolean, always, auto, never, or debug)</td></tr> |
|
3148 | 3176 | <tr><td></td> |
|
3149 | 3177 | <td>--config CONFIG [+]</td> |
|
3150 | 3178 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
3151 | 3179 | <tr><td></td> |
|
3152 | 3180 | <td>--debug</td> |
|
3153 | 3181 | <td>enable debugging output</td></tr> |
|
3154 | 3182 | <tr><td></td> |
|
3155 | 3183 | <td>--debugger</td> |
|
3156 | 3184 | <td>start debugger</td></tr> |
|
3157 | 3185 | <tr><td></td> |
|
3158 | 3186 | <td>--encoding ENCODE</td> |
|
3159 | 3187 | <td>set the charset encoding (default: ascii)</td></tr> |
|
3160 | 3188 | <tr><td></td> |
|
3161 | 3189 | <td>--encodingmode MODE</td> |
|
3162 | 3190 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
3163 | 3191 | <tr><td></td> |
|
3164 | 3192 | <td>--traceback</td> |
|
3165 | 3193 | <td>always print a traceback on exception</td></tr> |
|
3166 | 3194 | <tr><td></td> |
|
3167 | 3195 | <td>--time</td> |
|
3168 | 3196 | <td>time how long the command takes</td></tr> |
|
3169 | 3197 | <tr><td></td> |
|
3170 | 3198 | <td>--profile</td> |
|
3171 | 3199 | <td>print command execution profile</td></tr> |
|
3172 | 3200 | <tr><td></td> |
|
3173 | 3201 | <td>--version</td> |
|
3174 | 3202 | <td>output version information and exit</td></tr> |
|
3175 | 3203 | <tr><td>-h</td> |
|
3176 | 3204 | <td>--help</td> |
|
3177 | 3205 | <td>display help and exit</td></tr> |
|
3178 | 3206 | <tr><td></td> |
|
3179 | 3207 | <td>--hidden</td> |
|
3180 | 3208 | <td>consider hidden changesets</td></tr> |
|
3181 | 3209 | <tr><td></td> |
|
3182 | 3210 | <td>--pager TYPE</td> |
|
3183 | 3211 | <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr> |
|
3184 | 3212 | </table> |
|
3185 | 3213 | |
|
3186 | 3214 | </div> |
|
3187 | 3215 | </div> |
|
3188 | 3216 | </div> |
|
3189 | 3217 | |
|
3190 | 3218 | |
|
3191 | 3219 | |
|
3192 | 3220 | </body> |
|
3193 | 3221 | </html> |
|
3194 | 3222 | |
|
3195 | 3223 | |
|
3196 | 3224 | $ get-with-headers.py $LOCALIP:$HGPORT "help/dates" |
|
3197 | 3225 | 200 Script output follows |
|
3198 | 3226 | |
|
3199 | 3227 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3200 | 3228 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3201 | 3229 | <head> |
|
3202 | 3230 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3203 | 3231 | <meta name="robots" content="index, nofollow" /> |
|
3204 | 3232 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3205 | 3233 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3206 | 3234 | |
|
3207 | 3235 | <title>Help: dates</title> |
|
3208 | 3236 | </head> |
|
3209 | 3237 | <body> |
|
3210 | 3238 | |
|
3211 | 3239 | <div class="container"> |
|
3212 | 3240 | <div class="menu"> |
|
3213 | 3241 | <div class="logo"> |
|
3214 | 3242 | <a href="https://mercurial-scm.org/"> |
|
3215 | 3243 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3216 | 3244 | </div> |
|
3217 | 3245 | <ul> |
|
3218 | 3246 | <li><a href="/shortlog">log</a></li> |
|
3219 | 3247 | <li><a href="/graph">graph</a></li> |
|
3220 | 3248 | <li><a href="/tags">tags</a></li> |
|
3221 | 3249 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3222 | 3250 | <li><a href="/branches">branches</a></li> |
|
3223 | 3251 | </ul> |
|
3224 | 3252 | <ul> |
|
3225 | 3253 | <li class="active"><a href="/help">help</a></li> |
|
3226 | 3254 | </ul> |
|
3227 | 3255 | </div> |
|
3228 | 3256 | |
|
3229 | 3257 | <div class="main"> |
|
3230 | 3258 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3231 | 3259 | <h3>Help: dates</h3> |
|
3232 | 3260 | |
|
3233 | 3261 | <form class="search" action="/log"> |
|
3234 | 3262 | |
|
3235 | 3263 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3236 | 3264 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3237 | 3265 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3238 | 3266 | </form> |
|
3239 | 3267 | <div id="doc"> |
|
3240 | 3268 | <h1>Date Formats</h1> |
|
3241 | 3269 | <p> |
|
3242 | 3270 | Some commands allow the user to specify a date, e.g.: |
|
3243 | 3271 | </p> |
|
3244 | 3272 | <ul> |
|
3245 | 3273 | <li> backout, commit, import, tag: Specify the commit date. |
|
3246 | 3274 | <li> log, revert, update: Select revision(s) by date. |
|
3247 | 3275 | </ul> |
|
3248 | 3276 | <p> |
|
3249 | 3277 | Many date formats are valid. Here are some examples: |
|
3250 | 3278 | </p> |
|
3251 | 3279 | <ul> |
|
3252 | 3280 | <li> "Wed Dec 6 13:18:29 2006" (local timezone assumed) |
|
3253 | 3281 | <li> "Dec 6 13:18 -0600" (year assumed, time offset provided) |
|
3254 | 3282 | <li> "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) |
|
3255 | 3283 | <li> "Dec 6" (midnight) |
|
3256 | 3284 | <li> "13:18" (today assumed) |
|
3257 | 3285 | <li> "3:39" (3:39AM assumed) |
|
3258 | 3286 | <li> "3:39pm" (15:39) |
|
3259 | 3287 | <li> "2006-12-06 13:18:29" (ISO 8601 format) |
|
3260 | 3288 | <li> "2006-12-6 13:18" |
|
3261 | 3289 | <li> "2006-12-6" |
|
3262 | 3290 | <li> "12-6" |
|
3263 | 3291 | <li> "12/6" |
|
3264 | 3292 | <li> "12/6/6" (Dec 6 2006) |
|
3265 | 3293 | <li> "today" (midnight) |
|
3266 | 3294 | <li> "yesterday" (midnight) |
|
3267 | 3295 | <li> "now" - right now |
|
3268 | 3296 | </ul> |
|
3269 | 3297 | <p> |
|
3270 | 3298 | Lastly, there is Mercurial's internal format: |
|
3271 | 3299 | </p> |
|
3272 | 3300 | <ul> |
|
3273 | 3301 | <li> "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC) |
|
3274 | 3302 | </ul> |
|
3275 | 3303 | <p> |
|
3276 | 3304 | This is the internal representation format for dates. The first number |
|
3277 | 3305 | is the number of seconds since the epoch (1970-01-01 00:00 UTC). The |
|
3278 | 3306 | second is the offset of the local timezone, in seconds west of UTC |
|
3279 | 3307 | (negative if the timezone is east of UTC). |
|
3280 | 3308 | </p> |
|
3281 | 3309 | <p> |
|
3282 | 3310 | The log command also accepts date ranges: |
|
3283 | 3311 | </p> |
|
3284 | 3312 | <ul> |
|
3285 | 3313 | <li> "<DATE" - at or before a given date/time |
|
3286 | 3314 | <li> ">DATE" - on or after a given date/time |
|
3287 | 3315 | <li> "DATE to DATE" - a date range, inclusive |
|
3288 | 3316 | <li> "-DAYS" - within a given number of days of today |
|
3289 | 3317 | </ul> |
|
3290 | 3318 | |
|
3291 | 3319 | </div> |
|
3292 | 3320 | </div> |
|
3293 | 3321 | </div> |
|
3294 | 3322 | |
|
3295 | 3323 | |
|
3296 | 3324 | |
|
3297 | 3325 | </body> |
|
3298 | 3326 | </html> |
|
3299 | 3327 | |
|
3300 | 3328 | |
|
3301 | 3329 | $ get-with-headers.py $LOCALIP:$HGPORT "help/pager" |
|
3302 | 3330 | 200 Script output follows |
|
3303 | 3331 | |
|
3304 | 3332 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3305 | 3333 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3306 | 3334 | <head> |
|
3307 | 3335 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3308 | 3336 | <meta name="robots" content="index, nofollow" /> |
|
3309 | 3337 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3310 | 3338 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3311 | 3339 | |
|
3312 | 3340 | <title>Help: pager</title> |
|
3313 | 3341 | </head> |
|
3314 | 3342 | <body> |
|
3315 | 3343 | |
|
3316 | 3344 | <div class="container"> |
|
3317 | 3345 | <div class="menu"> |
|
3318 | 3346 | <div class="logo"> |
|
3319 | 3347 | <a href="https://mercurial-scm.org/"> |
|
3320 | 3348 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3321 | 3349 | </div> |
|
3322 | 3350 | <ul> |
|
3323 | 3351 | <li><a href="/shortlog">log</a></li> |
|
3324 | 3352 | <li><a href="/graph">graph</a></li> |
|
3325 | 3353 | <li><a href="/tags">tags</a></li> |
|
3326 | 3354 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3327 | 3355 | <li><a href="/branches">branches</a></li> |
|
3328 | 3356 | </ul> |
|
3329 | 3357 | <ul> |
|
3330 | 3358 | <li class="active"><a href="/help">help</a></li> |
|
3331 | 3359 | </ul> |
|
3332 | 3360 | </div> |
|
3333 | 3361 | |
|
3334 | 3362 | <div class="main"> |
|
3335 | 3363 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3336 | 3364 | <h3>Help: pager</h3> |
|
3337 | 3365 | |
|
3338 | 3366 | <form class="search" action="/log"> |
|
3339 | 3367 | |
|
3340 | 3368 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3341 | 3369 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3342 | 3370 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3343 | 3371 | </form> |
|
3344 | 3372 | <div id="doc"> |
|
3345 | 3373 | <h1>Pager Support</h1> |
|
3346 | 3374 | <p> |
|
3347 | 3375 | Some Mercurial commands can produce a lot of output, and Mercurial will |
|
3348 | 3376 | attempt to use a pager to make those commands more pleasant. |
|
3349 | 3377 | </p> |
|
3350 | 3378 | <p> |
|
3351 | 3379 | To set the pager that should be used, set the application variable: |
|
3352 | 3380 | </p> |
|
3353 | 3381 | <pre> |
|
3354 | 3382 | [pager] |
|
3355 | 3383 | pager = less -FRX |
|
3356 | 3384 | </pre> |
|
3357 | 3385 | <p> |
|
3358 | 3386 | If no pager is set in the user or repository configuration, Mercurial uses the |
|
3359 | 3387 | environment variable $PAGER. If $PAGER is not set, pager.pager from the default |
|
3360 | 3388 | or system configuration is used. If none of these are set, a default pager will |
|
3361 | 3389 | be used, typically 'less' on Unix and 'more' on Windows. |
|
3362 | 3390 | </p> |
|
3363 | 3391 | <p> |
|
3364 | 3392 | You can disable the pager for certain commands by adding them to the |
|
3365 | 3393 | pager.ignore list: |
|
3366 | 3394 | </p> |
|
3367 | 3395 | <pre> |
|
3368 | 3396 | [pager] |
|
3369 | 3397 | ignore = version, help, update |
|
3370 | 3398 | </pre> |
|
3371 | 3399 | <p> |
|
3372 | 3400 | To ignore global commands like 'hg version' or 'hg help', you have |
|
3373 | 3401 | to specify them in your user configuration file. |
|
3374 | 3402 | </p> |
|
3375 | 3403 | <p> |
|
3376 | 3404 | To control whether the pager is used at all for an individual command, |
|
3377 | 3405 | you can use --pager=<value>: |
|
3378 | 3406 | </p> |
|
3379 | 3407 | <ul> |
|
3380 | 3408 | <li> use as needed: 'auto'. |
|
3381 | 3409 | <li> require the pager: 'yes' or 'on'. |
|
3382 | 3410 | <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work). |
|
3383 | 3411 | </ul> |
|
3384 | 3412 | <p> |
|
3385 | 3413 | To globally turn off all attempts to use a pager, set: |
|
3386 | 3414 | </p> |
|
3387 | 3415 | <pre> |
|
3388 | 3416 | [ui] |
|
3389 | 3417 | paginate = never |
|
3390 | 3418 | </pre> |
|
3391 | 3419 | <p> |
|
3392 | 3420 | which will prevent the pager from running. |
|
3393 | 3421 | </p> |
|
3394 | 3422 | |
|
3395 | 3423 | </div> |
|
3396 | 3424 | </div> |
|
3397 | 3425 | </div> |
|
3398 | 3426 | |
|
3399 | 3427 | |
|
3400 | 3428 | |
|
3401 | 3429 | </body> |
|
3402 | 3430 | </html> |
|
3403 | 3431 | |
|
3404 | 3432 | |
|
3405 | 3433 | Sub-topic indexes rendered properly |
|
3406 | 3434 | |
|
3407 | 3435 | $ get-with-headers.py $LOCALIP:$HGPORT "help/internals" |
|
3408 | 3436 | 200 Script output follows |
|
3409 | 3437 | |
|
3410 | 3438 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3411 | 3439 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3412 | 3440 | <head> |
|
3413 | 3441 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3414 | 3442 | <meta name="robots" content="index, nofollow" /> |
|
3415 | 3443 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3416 | 3444 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3417 | 3445 | |
|
3418 | 3446 | <title>Help: internals</title> |
|
3419 | 3447 | </head> |
|
3420 | 3448 | <body> |
|
3421 | 3449 | |
|
3422 | 3450 | <div class="container"> |
|
3423 | 3451 | <div class="menu"> |
|
3424 | 3452 | <div class="logo"> |
|
3425 | 3453 | <a href="https://mercurial-scm.org/"> |
|
3426 | 3454 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3427 | 3455 | </div> |
|
3428 | 3456 | <ul> |
|
3429 | 3457 | <li><a href="/shortlog">log</a></li> |
|
3430 | 3458 | <li><a href="/graph">graph</a></li> |
|
3431 | 3459 | <li><a href="/tags">tags</a></li> |
|
3432 | 3460 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3433 | 3461 | <li><a href="/branches">branches</a></li> |
|
3434 | 3462 | </ul> |
|
3435 | 3463 | <ul> |
|
3436 | 3464 | <li><a href="/help">help</a></li> |
|
3437 | 3465 | </ul> |
|
3438 | 3466 | </div> |
|
3439 | 3467 | |
|
3440 | 3468 | <div class="main"> |
|
3441 | 3469 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3442 | 3470 | |
|
3443 | 3471 | <form class="search" action="/log"> |
|
3444 | 3472 | |
|
3445 | 3473 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3446 | 3474 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3447 | 3475 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3448 | 3476 | </form> |
|
3449 | 3477 | <table class="bigtable"> |
|
3450 | 3478 | <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr> |
|
3451 | 3479 | |
|
3452 | 3480 | <tr><td> |
|
3453 | 3481 | <a href="/help/internals.bundle2"> |
|
3454 | 3482 | bundle2 |
|
3455 | 3483 | </a> |
|
3456 | 3484 | </td><td> |
|
3457 | 3485 | Bundle2 |
|
3458 | 3486 | </td></tr> |
|
3459 | 3487 | <tr><td> |
|
3460 | 3488 | <a href="/help/internals.bundles"> |
|
3461 | 3489 | bundles |
|
3462 | 3490 | </a> |
|
3463 | 3491 | </td><td> |
|
3464 | 3492 | Bundles |
|
3465 | 3493 | </td></tr> |
|
3466 | 3494 | <tr><td> |
|
3467 | 3495 | <a href="/help/internals.cbor"> |
|
3468 | 3496 | cbor |
|
3469 | 3497 | </a> |
|
3470 | 3498 | </td><td> |
|
3471 | 3499 | CBOR |
|
3472 | 3500 | </td></tr> |
|
3473 | 3501 | <tr><td> |
|
3474 | 3502 | <a href="/help/internals.censor"> |
|
3475 | 3503 | censor |
|
3476 | 3504 | </a> |
|
3477 | 3505 | </td><td> |
|
3478 | 3506 | Censor |
|
3479 | 3507 | </td></tr> |
|
3480 | 3508 | <tr><td> |
|
3481 | 3509 | <a href="/help/internals.changegroups"> |
|
3482 | 3510 | changegroups |
|
3483 | 3511 | </a> |
|
3484 | 3512 | </td><td> |
|
3485 | 3513 | Changegroups |
|
3486 | 3514 | </td></tr> |
|
3487 | 3515 | <tr><td> |
|
3488 | 3516 | <a href="/help/internals.config"> |
|
3489 | 3517 | config |
|
3490 | 3518 | </a> |
|
3491 | 3519 | </td><td> |
|
3492 | 3520 | Config Registrar |
|
3493 | 3521 | </td></tr> |
|
3494 | 3522 | <tr><td> |
|
3495 | 3523 | <a href="/help/internals.requirements"> |
|
3496 | 3524 | requirements |
|
3497 | 3525 | </a> |
|
3498 | 3526 | </td><td> |
|
3499 | 3527 | Repository Requirements |
|
3500 | 3528 | </td></tr> |
|
3501 | 3529 | <tr><td> |
|
3502 | 3530 | <a href="/help/internals.revlogs"> |
|
3503 | 3531 | revlogs |
|
3504 | 3532 | </a> |
|
3505 | 3533 | </td><td> |
|
3506 | 3534 | Revision Logs |
|
3507 | 3535 | </td></tr> |
|
3508 | 3536 | <tr><td> |
|
3509 | 3537 | <a href="/help/internals.wireprotocol"> |
|
3510 | 3538 | wireprotocol |
|
3511 | 3539 | </a> |
|
3512 | 3540 | </td><td> |
|
3513 | 3541 | Wire Protocol |
|
3514 | 3542 | </td></tr> |
|
3515 | 3543 | <tr><td> |
|
3516 | 3544 | <a href="/help/internals.wireprotocolrpc"> |
|
3517 | 3545 | wireprotocolrpc |
|
3518 | 3546 | </a> |
|
3519 | 3547 | </td><td> |
|
3520 | 3548 | Wire Protocol RPC |
|
3521 | 3549 | </td></tr> |
|
3522 | 3550 | <tr><td> |
|
3523 | 3551 | <a href="/help/internals.wireprotocolv2"> |
|
3524 | 3552 | wireprotocolv2 |
|
3525 | 3553 | </a> |
|
3526 | 3554 | </td><td> |
|
3527 | 3555 | Wire Protocol Version 2 |
|
3528 | 3556 | </td></tr> |
|
3529 | 3557 | |
|
3530 | 3558 | |
|
3531 | 3559 | |
|
3532 | 3560 | |
|
3533 | 3561 | |
|
3534 | 3562 | </table> |
|
3535 | 3563 | </div> |
|
3536 | 3564 | </div> |
|
3537 | 3565 | |
|
3538 | 3566 | |
|
3539 | 3567 | |
|
3540 | 3568 | </body> |
|
3541 | 3569 | </html> |
|
3542 | 3570 | |
|
3543 | 3571 | |
|
3544 | 3572 | Sub-topic topics rendered properly |
|
3545 | 3573 | |
|
3546 | 3574 | $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups" |
|
3547 | 3575 | 200 Script output follows |
|
3548 | 3576 | |
|
3549 | 3577 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3550 | 3578 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3551 | 3579 | <head> |
|
3552 | 3580 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3553 | 3581 | <meta name="robots" content="index, nofollow" /> |
|
3554 | 3582 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3555 | 3583 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3556 | 3584 | |
|
3557 | 3585 | <title>Help: internals.changegroups</title> |
|
3558 | 3586 | </head> |
|
3559 | 3587 | <body> |
|
3560 | 3588 | |
|
3561 | 3589 | <div class="container"> |
|
3562 | 3590 | <div class="menu"> |
|
3563 | 3591 | <div class="logo"> |
|
3564 | 3592 | <a href="https://mercurial-scm.org/"> |
|
3565 | 3593 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3566 | 3594 | </div> |
|
3567 | 3595 | <ul> |
|
3568 | 3596 | <li><a href="/shortlog">log</a></li> |
|
3569 | 3597 | <li><a href="/graph">graph</a></li> |
|
3570 | 3598 | <li><a href="/tags">tags</a></li> |
|
3571 | 3599 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3572 | 3600 | <li><a href="/branches">branches</a></li> |
|
3573 | 3601 | </ul> |
|
3574 | 3602 | <ul> |
|
3575 | 3603 | <li class="active"><a href="/help">help</a></li> |
|
3576 | 3604 | </ul> |
|
3577 | 3605 | </div> |
|
3578 | 3606 | |
|
3579 | 3607 | <div class="main"> |
|
3580 | 3608 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3581 | 3609 | <h3>Help: internals.changegroups</h3> |
|
3582 | 3610 | |
|
3583 | 3611 | <form class="search" action="/log"> |
|
3584 | 3612 | |
|
3585 | 3613 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3586 | 3614 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3587 | 3615 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3588 | 3616 | </form> |
|
3589 | 3617 | <div id="doc"> |
|
3590 | 3618 | <h1>Changegroups</h1> |
|
3591 | 3619 | <p> |
|
3592 | 3620 | Changegroups are representations of repository revlog data, specifically |
|
3593 | 3621 | the changelog data, root/flat manifest data, treemanifest data, and |
|
3594 | 3622 | filelogs. |
|
3595 | 3623 | </p> |
|
3596 | 3624 | <p> |
|
3597 | 3625 | There are 3 versions of changegroups: "1", "2", and "3". From a |
|
3598 | 3626 | high-level, versions "1" and "2" are almost exactly the same, with the |
|
3599 | 3627 | only difference being an additional item in the *delta header*. Version |
|
3600 | 3628 | "3" adds support for storage flags in the *delta header* and optionally |
|
3601 | 3629 | exchanging treemanifests (enabled by setting an option on the |
|
3602 | 3630 | "changegroup" part in the bundle2). |
|
3603 | 3631 | </p> |
|
3604 | 3632 | <p> |
|
3605 | 3633 | Changegroups when not exchanging treemanifests consist of 3 logical |
|
3606 | 3634 | segments: |
|
3607 | 3635 | </p> |
|
3608 | 3636 | <pre> |
|
3609 | 3637 | +---------------------------------+ |
|
3610 | 3638 | | | | | |
|
3611 | 3639 | | changeset | manifest | filelogs | |
|
3612 | 3640 | | | | | |
|
3613 | 3641 | | | | | |
|
3614 | 3642 | +---------------------------------+ |
|
3615 | 3643 | </pre> |
|
3616 | 3644 | <p> |
|
3617 | 3645 | When exchanging treemanifests, there are 4 logical segments: |
|
3618 | 3646 | </p> |
|
3619 | 3647 | <pre> |
|
3620 | 3648 | +-------------------------------------------------+ |
|
3621 | 3649 | | | | | | |
|
3622 | 3650 | | changeset | root | treemanifests | filelogs | |
|
3623 | 3651 | | | manifest | | | |
|
3624 | 3652 | | | | | | |
|
3625 | 3653 | +-------------------------------------------------+ |
|
3626 | 3654 | </pre> |
|
3627 | 3655 | <p> |
|
3628 | 3656 | The principle building block of each segment is a *chunk*. A *chunk* |
|
3629 | 3657 | is a framed piece of data: |
|
3630 | 3658 | </p> |
|
3631 | 3659 | <pre> |
|
3632 | 3660 | +---------------------------------------+ |
|
3633 | 3661 | | | | |
|
3634 | 3662 | | length | data | |
|
3635 | 3663 | | (4 bytes) | (<length - 4> bytes) | |
|
3636 | 3664 | | | | |
|
3637 | 3665 | +---------------------------------------+ |
|
3638 | 3666 | </pre> |
|
3639 | 3667 | <p> |
|
3640 | 3668 | All integers are big-endian signed integers. Each chunk starts with a 32-bit |
|
3641 | 3669 | integer indicating the length of the entire chunk (including the length field |
|
3642 | 3670 | itself). |
|
3643 | 3671 | </p> |
|
3644 | 3672 | <p> |
|
3645 | 3673 | There is a special case chunk that has a value of 0 for the length |
|
3646 | 3674 | ("0x00000000"). We call this an *empty chunk*. |
|
3647 | 3675 | </p> |
|
3648 | 3676 | <h2>Delta Groups</h2> |
|
3649 | 3677 | <p> |
|
3650 | 3678 | A *delta group* expresses the content of a revlog as a series of deltas, |
|
3651 | 3679 | or patches against previous revisions. |
|
3652 | 3680 | </p> |
|
3653 | 3681 | <p> |
|
3654 | 3682 | Delta groups consist of 0 or more *chunks* followed by the *empty chunk* |
|
3655 | 3683 | to signal the end of the delta group: |
|
3656 | 3684 | </p> |
|
3657 | 3685 | <pre> |
|
3658 | 3686 | +------------------------------------------------------------------------+ |
|
3659 | 3687 | | | | | | | |
|
3660 | 3688 | | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 | |
|
3661 | 3689 | | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) | |
|
3662 | 3690 | | | | | | | |
|
3663 | 3691 | +------------------------------------------------------------------------+ |
|
3664 | 3692 | </pre> |
|
3665 | 3693 | <p> |
|
3666 | 3694 | Each *chunk*'s data consists of the following: |
|
3667 | 3695 | </p> |
|
3668 | 3696 | <pre> |
|
3669 | 3697 | +---------------------------------------+ |
|
3670 | 3698 | | | | |
|
3671 | 3699 | | delta header | delta data | |
|
3672 | 3700 | | (various by version) | (various) | |
|
3673 | 3701 | | | | |
|
3674 | 3702 | +---------------------------------------+ |
|
3675 | 3703 | </pre> |
|
3676 | 3704 | <p> |
|
3677 | 3705 | The *delta data* is a series of *delta*s that describe a diff from an existing |
|
3678 | 3706 | entry (either that the recipient already has, or previously specified in the |
|
3679 | 3707 | bundle/changegroup). |
|
3680 | 3708 | </p> |
|
3681 | 3709 | <p> |
|
3682 | 3710 | The *delta header* is different between versions "1", "2", and |
|
3683 | 3711 | "3" of the changegroup format. |
|
3684 | 3712 | </p> |
|
3685 | 3713 | <p> |
|
3686 | 3714 | Version 1 (headerlen=80): |
|
3687 | 3715 | </p> |
|
3688 | 3716 | <pre> |
|
3689 | 3717 | +------------------------------------------------------+ |
|
3690 | 3718 | | | | | | |
|
3691 | 3719 | | node | p1 node | p2 node | link node | |
|
3692 | 3720 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
3693 | 3721 | | | | | | |
|
3694 | 3722 | +------------------------------------------------------+ |
|
3695 | 3723 | </pre> |
|
3696 | 3724 | <p> |
|
3697 | 3725 | Version 2 (headerlen=100): |
|
3698 | 3726 | </p> |
|
3699 | 3727 | <pre> |
|
3700 | 3728 | +------------------------------------------------------------------+ |
|
3701 | 3729 | | | | | | | |
|
3702 | 3730 | | node | p1 node | p2 node | base node | link node | |
|
3703 | 3731 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
3704 | 3732 | | | | | | | |
|
3705 | 3733 | +------------------------------------------------------------------+ |
|
3706 | 3734 | </pre> |
|
3707 | 3735 | <p> |
|
3708 | 3736 | Version 3 (headerlen=102): |
|
3709 | 3737 | </p> |
|
3710 | 3738 | <pre> |
|
3711 | 3739 | +------------------------------------------------------------------------------+ |
|
3712 | 3740 | | | | | | | | |
|
3713 | 3741 | | node | p1 node | p2 node | base node | link node | flags | |
|
3714 | 3742 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | |
|
3715 | 3743 | | | | | | | | |
|
3716 | 3744 | +------------------------------------------------------------------------------+ |
|
3717 | 3745 | </pre> |
|
3718 | 3746 | <p> |
|
3719 | 3747 | The *delta data* consists of "chunklen - 4 - headerlen" bytes, which contain a |
|
3720 | 3748 | series of *delta*s, densely packed (no separators). These deltas describe a diff |
|
3721 | 3749 | from an existing entry (either that the recipient already has, or previously |
|
3722 | 3750 | specified in the bundle/changegroup). The format is described more fully in |
|
3723 | 3751 | "hg help internals.bdiff", but briefly: |
|
3724 | 3752 | </p> |
|
3725 | 3753 | <pre> |
|
3726 | 3754 | +---------------------------------------------------------------+ |
|
3727 | 3755 | | | | | | |
|
3728 | 3756 | | start offset | end offset | new length | content | |
|
3729 | 3757 | | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) | |
|
3730 | 3758 | | | | | | |
|
3731 | 3759 | +---------------------------------------------------------------+ |
|
3732 | 3760 | </pre> |
|
3733 | 3761 | <p> |
|
3734 | 3762 | Please note that the length field in the delta data does *not* include itself. |
|
3735 | 3763 | </p> |
|
3736 | 3764 | <p> |
|
3737 | 3765 | In version 1, the delta is always applied against the previous node from |
|
3738 | 3766 | the changegroup or the first parent if this is the first entry in the |
|
3739 | 3767 | changegroup. |
|
3740 | 3768 | </p> |
|
3741 | 3769 | <p> |
|
3742 | 3770 | In version 2 and up, the delta base node is encoded in the entry in the |
|
3743 | 3771 | changegroup. This allows the delta to be expressed against any parent, |
|
3744 | 3772 | which can result in smaller deltas and more efficient encoding of data. |
|
3745 | 3773 | </p> |
|
3746 | 3774 | <p> |
|
3747 | 3775 | The *flags* field holds bitwise flags affecting the processing of revision |
|
3748 | 3776 | data. The following flags are defined: |
|
3749 | 3777 | </p> |
|
3750 | 3778 | <dl> |
|
3751 | 3779 | <dt>32768 |
|
3752 | 3780 | <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions. |
|
3753 | 3781 | <dt>16384 |
|
3754 | 3782 | <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents). |
|
3755 | 3783 | <dt>8192 |
|
3756 | 3784 | <dd>Externally stored. The revision fulltext contains "key:value" "\n" delimited metadata defining an object stored elsewhere. Used by the LFS extension. |
|
3757 | 3785 | </dl> |
|
3758 | 3786 | <p> |
|
3759 | 3787 | For historical reasons, the integer values are identical to revlog version 1 |
|
3760 | 3788 | per-revision storage flags and correspond to bits being set in this 2-byte |
|
3761 | 3789 | field. Bits were allocated starting from the most-significant bit, hence the |
|
3762 | 3790 | reverse ordering and allocation of these flags. |
|
3763 | 3791 | </p> |
|
3764 | 3792 | <h2>Changeset Segment</h2> |
|
3765 | 3793 | <p> |
|
3766 | 3794 | The *changeset segment* consists of a single *delta group* holding |
|
3767 | 3795 | changelog data. The *empty chunk* at the end of the *delta group* denotes |
|
3768 | 3796 | the boundary to the *manifest segment*. |
|
3769 | 3797 | </p> |
|
3770 | 3798 | <h2>Manifest Segment</h2> |
|
3771 | 3799 | <p> |
|
3772 | 3800 | The *manifest segment* consists of a single *delta group* holding manifest |
|
3773 | 3801 | data. If treemanifests are in use, it contains only the manifest for the |
|
3774 | 3802 | root directory of the repository. Otherwise, it contains the entire |
|
3775 | 3803 | manifest data. The *empty chunk* at the end of the *delta group* denotes |
|
3776 | 3804 | the boundary to the next segment (either the *treemanifests segment* or the |
|
3777 | 3805 | *filelogs segment*, depending on version and the request options). |
|
3778 | 3806 | </p> |
|
3779 | 3807 | <h3>Treemanifests Segment</h3> |
|
3780 | 3808 | <p> |
|
3781 | 3809 | The *treemanifests segment* only exists in changegroup version "3", and |
|
3782 | 3810 | only if the 'treemanifest' param is part of the bundle2 changegroup part |
|
3783 | 3811 | (it is not possible to use changegroup version 3 outside of bundle2). |
|
3784 | 3812 | Aside from the filenames in the *treemanifests segment* containing a |
|
3785 | 3813 | trailing "/" character, it behaves identically to the *filelogs segment* |
|
3786 | 3814 | (see below). The final sub-segment is followed by an *empty chunk* (logically, |
|
3787 | 3815 | a sub-segment with filename size 0). This denotes the boundary to the |
|
3788 | 3816 | *filelogs segment*. |
|
3789 | 3817 | </p> |
|
3790 | 3818 | <h2>Filelogs Segment</h2> |
|
3791 | 3819 | <p> |
|
3792 | 3820 | The *filelogs segment* consists of multiple sub-segments, each |
|
3793 | 3821 | corresponding to an individual file whose data is being described: |
|
3794 | 3822 | </p> |
|
3795 | 3823 | <pre> |
|
3796 | 3824 | +--------------------------------------------------+ |
|
3797 | 3825 | | | | | | | |
|
3798 | 3826 | | filelog0 | filelog1 | filelog2 | ... | 0x0 | |
|
3799 | 3827 | | | | | | (4 bytes) | |
|
3800 | 3828 | | | | | | | |
|
3801 | 3829 | +--------------------------------------------------+ |
|
3802 | 3830 | </pre> |
|
3803 | 3831 | <p> |
|
3804 | 3832 | The final filelog sub-segment is followed by an *empty chunk* (logically, |
|
3805 | 3833 | a sub-segment with filename size 0). This denotes the end of the segment |
|
3806 | 3834 | and of the overall changegroup. |
|
3807 | 3835 | </p> |
|
3808 | 3836 | <p> |
|
3809 | 3837 | Each filelog sub-segment consists of the following: |
|
3810 | 3838 | </p> |
|
3811 | 3839 | <pre> |
|
3812 | 3840 | +------------------------------------------------------+ |
|
3813 | 3841 | | | | | |
|
3814 | 3842 | | filename length | filename | delta group | |
|
3815 | 3843 | | (4 bytes) | (<length - 4> bytes) | (various) | |
|
3816 | 3844 | | | | | |
|
3817 | 3845 | +------------------------------------------------------+ |
|
3818 | 3846 | </pre> |
|
3819 | 3847 | <p> |
|
3820 | 3848 | That is, a *chunk* consisting of the filename (not terminated or padded) |
|
3821 | 3849 | followed by N chunks constituting the *delta group* for this file. The |
|
3822 | 3850 | *empty chunk* at the end of each *delta group* denotes the boundary to the |
|
3823 | 3851 | next filelog sub-segment. |
|
3824 | 3852 | </p> |
|
3825 | 3853 | |
|
3826 | 3854 | </div> |
|
3827 | 3855 | </div> |
|
3828 | 3856 | </div> |
|
3829 | 3857 | |
|
3830 | 3858 | |
|
3831 | 3859 | |
|
3832 | 3860 | </body> |
|
3833 | 3861 | </html> |
|
3834 | 3862 | |
|
3835 | 3863 | |
|
3836 | 3864 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic" |
|
3837 | 3865 | 404 Not Found |
|
3838 | 3866 | |
|
3839 | 3867 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3840 | 3868 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3841 | 3869 | <head> |
|
3842 | 3870 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3843 | 3871 | <meta name="robots" content="index, nofollow" /> |
|
3844 | 3872 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3845 | 3873 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3846 | 3874 | |
|
3847 | 3875 | <title>test: error</title> |
|
3848 | 3876 | </head> |
|
3849 | 3877 | <body> |
|
3850 | 3878 | |
|
3851 | 3879 | <div class="container"> |
|
3852 | 3880 | <div class="menu"> |
|
3853 | 3881 | <div class="logo"> |
|
3854 | 3882 | <a href="https://mercurial-scm.org/"> |
|
3855 | 3883 | <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> |
|
3856 | 3884 | </div> |
|
3857 | 3885 | <ul> |
|
3858 | 3886 | <li><a href="/shortlog">log</a></li> |
|
3859 | 3887 | <li><a href="/graph">graph</a></li> |
|
3860 | 3888 | <li><a href="/tags">tags</a></li> |
|
3861 | 3889 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3862 | 3890 | <li><a href="/branches">branches</a></li> |
|
3863 | 3891 | </ul> |
|
3864 | 3892 | <ul> |
|
3865 | 3893 | <li><a href="/help">help</a></li> |
|
3866 | 3894 | </ul> |
|
3867 | 3895 | </div> |
|
3868 | 3896 | |
|
3869 | 3897 | <div class="main"> |
|
3870 | 3898 | |
|
3871 | 3899 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3872 | 3900 | <h3>error</h3> |
|
3873 | 3901 | |
|
3874 | 3902 | |
|
3875 | 3903 | <form class="search" action="/log"> |
|
3876 | 3904 | |
|
3877 | 3905 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3878 | 3906 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3879 | 3907 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3880 | 3908 | </form> |
|
3881 | 3909 | |
|
3882 | 3910 | <div class="description"> |
|
3883 | 3911 | <p> |
|
3884 | 3912 | An error occurred while processing your request: |
|
3885 | 3913 | </p> |
|
3886 | 3914 | <p> |
|
3887 | 3915 | Not Found |
|
3888 | 3916 | </p> |
|
3889 | 3917 | </div> |
|
3890 | 3918 | </div> |
|
3891 | 3919 | </div> |
|
3892 | 3920 | |
|
3893 | 3921 | |
|
3894 | 3922 | |
|
3895 | 3923 | </body> |
|
3896 | 3924 | </html> |
|
3897 | 3925 | |
|
3898 | 3926 | [1] |
|
3899 | 3927 | |
|
3900 | 3928 | $ killdaemons.py |
|
3901 | 3929 | |
|
3902 | 3930 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now