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