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