Show More
@@ -1,413 +1,417 b'' | |||||
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 |
|
5 | # This software may be used and distributed according to the terms | |
6 | # of the GNU General Public License, incorporated herein by reference. |
|
6 | # of the GNU General Public License, incorporated herein by reference. | |
7 |
|
7 | |||
8 | from node import * |
|
8 | from node import * | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | import os, sys, atexit, signal, pdb, traceback, socket, errno, shlex, time |
|
10 | import os, sys, atexit, signal, pdb, traceback, socket, errno, shlex, time | |
11 | import util, commands, hg, lock, fancyopts, revlog, version, extensions, hook |
|
11 | import util, commands, hg, lock, fancyopts, revlog, version, extensions, hook | |
12 | import cmdutil |
|
12 | import cmdutil | |
13 | import ui as _ui |
|
13 | import ui as _ui | |
14 |
|
14 | |||
15 | class ParseError(Exception): |
|
15 | class ParseError(Exception): | |
16 | """Exception raised on errors in parsing the command line.""" |
|
16 | """Exception raised on errors in parsing the command line.""" | |
17 |
|
17 | |||
18 | def run(): |
|
18 | def run(): | |
19 | "run the command in sys.argv" |
|
19 | "run the command in sys.argv" | |
20 | sys.exit(dispatch(sys.argv[1:])) |
|
20 | sys.exit(dispatch(sys.argv[1:])) | |
21 |
|
21 | |||
22 | def dispatch(args): |
|
22 | def dispatch(args): | |
23 | "run the command specified in args" |
|
23 | "run the command specified in args" | |
24 | try: |
|
24 | try: | |
25 | u = _ui.ui(traceback='--traceback' in args) |
|
25 | u = _ui.ui(traceback='--traceback' in args) | |
26 | except util.Abort, inst: |
|
26 | except util.Abort, inst: | |
27 | sys.stderr.write(_("abort: %s\n") % inst) |
|
27 | sys.stderr.write(_("abort: %s\n") % inst) | |
28 | return -1 |
|
28 | return -1 | |
29 | return _runcatch(u, args) |
|
29 | return _runcatch(u, args) | |
30 |
|
30 | |||
31 | def _runcatch(ui, args): |
|
31 | def _runcatch(ui, args): | |
32 | def catchterm(*args): |
|
32 | def catchterm(*args): | |
33 | raise util.SignalInterrupt |
|
33 | raise util.SignalInterrupt | |
34 |
|
34 | |||
35 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
|
35 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': | |
36 | num = getattr(signal, name, None) |
|
36 | num = getattr(signal, name, None) | |
37 | if num: signal.signal(num, catchterm) |
|
37 | if num: signal.signal(num, catchterm) | |
38 |
|
38 | |||
39 | try: |
|
39 | try: | |
40 | try: |
|
40 | try: | |
41 | # enter the debugger before command execution |
|
41 | # enter the debugger before command execution | |
42 | if '--debugger' in args: |
|
42 | if '--debugger' in args: | |
43 | pdb.set_trace() |
|
43 | pdb.set_trace() | |
44 | try: |
|
44 | try: | |
45 | return _dispatch(ui, args) |
|
45 | return _dispatch(ui, args) | |
46 | finally: |
|
46 | finally: | |
47 | ui.flush() |
|
47 | ui.flush() | |
48 | except: |
|
48 | except: | |
49 | # enter the debugger when we hit an exception |
|
49 | # enter the debugger when we hit an exception | |
50 | if '--debugger' in args: |
|
50 | if '--debugger' in args: | |
51 | pdb.post_mortem(sys.exc_info()[2]) |
|
51 | pdb.post_mortem(sys.exc_info()[2]) | |
52 | ui.print_exc() |
|
52 | ui.print_exc() | |
53 | raise |
|
53 | raise | |
54 |
|
54 | |||
55 | except ParseError, inst: |
|
55 | except ParseError, inst: | |
56 | if inst.args[0]: |
|
56 | if inst.args[0]: | |
57 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) |
|
57 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) | |
58 | commands.help_(ui, inst.args[0]) |
|
58 | commands.help_(ui, inst.args[0]) | |
59 | else: |
|
59 | else: | |
60 | ui.warn(_("hg: %s\n") % inst.args[1]) |
|
60 | ui.warn(_("hg: %s\n") % inst.args[1]) | |
61 | commands.help_(ui, 'shortlist') |
|
61 | commands.help_(ui, 'shortlist') | |
62 | except cmdutil.AmbiguousCommand, inst: |
|
62 | except cmdutil.AmbiguousCommand, inst: | |
63 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
|
63 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % | |
64 | (inst.args[0], " ".join(inst.args[1]))) |
|
64 | (inst.args[0], " ".join(inst.args[1]))) | |
65 | except cmdutil.UnknownCommand, inst: |
|
65 | except cmdutil.UnknownCommand, inst: | |
66 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) |
|
66 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) | |
67 | commands.help_(ui, 'shortlist') |
|
67 | commands.help_(ui, 'shortlist') | |
68 | except hg.RepoError, inst: |
|
68 | except hg.RepoError, inst: | |
69 | ui.warn(_("abort: %s!\n") % inst) |
|
69 | ui.warn(_("abort: %s!\n") % inst) | |
70 | except lock.LockHeld, inst: |
|
70 | except lock.LockHeld, inst: | |
71 | if inst.errno == errno.ETIMEDOUT: |
|
71 | if inst.errno == errno.ETIMEDOUT: | |
72 | reason = _('timed out waiting for lock held by %s') % inst.locker |
|
72 | reason = _('timed out waiting for lock held by %s') % inst.locker | |
73 | else: |
|
73 | else: | |
74 | reason = _('lock held by %s') % inst.locker |
|
74 | reason = _('lock held by %s') % inst.locker | |
75 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
|
75 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) | |
76 | except lock.LockUnavailable, inst: |
|
76 | except lock.LockUnavailable, inst: | |
77 | ui.warn(_("abort: could not lock %s: %s\n") % |
|
77 | ui.warn(_("abort: could not lock %s: %s\n") % | |
78 | (inst.desc or inst.filename, inst.strerror)) |
|
78 | (inst.desc or inst.filename, inst.strerror)) | |
79 | except revlog.RevlogError, inst: |
|
79 | except revlog.RevlogError, inst: | |
80 | ui.warn(_("abort: %s!\n") % inst) |
|
80 | ui.warn(_("abort: %s!\n") % inst) | |
81 | except util.SignalInterrupt: |
|
81 | except util.SignalInterrupt: | |
82 | ui.warn(_("killed!\n")) |
|
82 | ui.warn(_("killed!\n")) | |
83 | except KeyboardInterrupt: |
|
83 | except KeyboardInterrupt: | |
84 | try: |
|
84 | try: | |
85 | ui.warn(_("interrupted!\n")) |
|
85 | ui.warn(_("interrupted!\n")) | |
86 | except IOError, inst: |
|
86 | except IOError, inst: | |
87 | if inst.errno == errno.EPIPE: |
|
87 | if inst.errno == errno.EPIPE: | |
88 | if ui.debugflag: |
|
88 | if ui.debugflag: | |
89 | ui.warn(_("\nbroken pipe\n")) |
|
89 | ui.warn(_("\nbroken pipe\n")) | |
90 | else: |
|
90 | else: | |
91 | raise |
|
91 | raise | |
92 | except socket.error, inst: |
|
92 | except socket.error, inst: | |
93 | ui.warn(_("abort: %s\n") % inst[1]) |
|
93 | ui.warn(_("abort: %s\n") % inst[1]) | |
94 | except IOError, inst: |
|
94 | except IOError, inst: | |
95 | if hasattr(inst, "code"): |
|
95 | if hasattr(inst, "code"): | |
96 | ui.warn(_("abort: %s\n") % inst) |
|
96 | ui.warn(_("abort: %s\n") % inst) | |
97 | elif hasattr(inst, "reason"): |
|
97 | elif hasattr(inst, "reason"): | |
98 | try: # usually it is in the form (errno, strerror) |
|
98 | try: # usually it is in the form (errno, strerror) | |
99 | reason = inst.reason.args[1] |
|
99 | reason = inst.reason.args[1] | |
100 | except: # it might be anything, for example a string |
|
100 | except: # it might be anything, for example a string | |
101 | reason = inst.reason |
|
101 | reason = inst.reason | |
102 | ui.warn(_("abort: error: %s\n") % reason) |
|
102 | ui.warn(_("abort: error: %s\n") % reason) | |
103 | elif hasattr(inst, "args") and inst[0] == errno.EPIPE: |
|
103 | elif hasattr(inst, "args") and inst[0] == errno.EPIPE: | |
104 | if ui.debugflag: |
|
104 | if ui.debugflag: | |
105 | ui.warn(_("broken pipe\n")) |
|
105 | ui.warn(_("broken pipe\n")) | |
106 | elif getattr(inst, "strerror", None): |
|
106 | elif getattr(inst, "strerror", None): | |
107 | if getattr(inst, "filename", None): |
|
107 | if getattr(inst, "filename", None): | |
108 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
|
108 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | |
109 | else: |
|
109 | else: | |
110 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
110 | ui.warn(_("abort: %s\n") % inst.strerror) | |
111 | else: |
|
111 | else: | |
112 | raise |
|
112 | raise | |
113 | except OSError, inst: |
|
113 | except OSError, inst: | |
114 | if getattr(inst, "filename", None): |
|
114 | if getattr(inst, "filename", None): | |
115 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
|
115 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | |
116 | else: |
|
116 | else: | |
117 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
117 | ui.warn(_("abort: %s\n") % inst.strerror) | |
118 | except util.UnexpectedOutput, inst: |
|
118 | except util.UnexpectedOutput, inst: | |
119 | ui.warn(_("abort: %s") % inst[0]) |
|
119 | ui.warn(_("abort: %s") % inst[0]) | |
120 | if not isinstance(inst[1], basestring): |
|
120 | if not isinstance(inst[1], basestring): | |
121 | ui.warn(" %r\n" % (inst[1],)) |
|
121 | ui.warn(" %r\n" % (inst[1],)) | |
122 | elif not inst[1]: |
|
122 | elif not inst[1]: | |
123 | ui.warn(_(" empty string\n")) |
|
123 | ui.warn(_(" empty string\n")) | |
124 | else: |
|
124 | else: | |
125 | ui.warn("\n%r\n" % util.ellipsis(inst[1])) |
|
125 | ui.warn("\n%r\n" % util.ellipsis(inst[1])) | |
126 | except ImportError, inst: |
|
126 | except ImportError, inst: | |
127 | m = str(inst).split()[-1] |
|
127 | m = str(inst).split()[-1] | |
128 | ui.warn(_("abort: could not import module %s!\n") % m) |
|
128 | ui.warn(_("abort: could not import module %s!\n") % m) | |
129 | if m in "mpatch bdiff".split(): |
|
129 | if m in "mpatch bdiff".split(): | |
130 | ui.warn(_("(did you forget to compile extensions?)\n")) |
|
130 | ui.warn(_("(did you forget to compile extensions?)\n")) | |
131 | elif m in "zlib".split(): |
|
131 | elif m in "zlib".split(): | |
132 | ui.warn(_("(is your Python install correct?)\n")) |
|
132 | ui.warn(_("(is your Python install correct?)\n")) | |
133 |
|
133 | |||
134 | except util.Abort, inst: |
|
134 | except util.Abort, inst: | |
135 | ui.warn(_("abort: %s\n") % inst) |
|
135 | ui.warn(_("abort: %s\n") % inst) | |
136 | except MemoryError: |
|
136 | except MemoryError: | |
137 | ui.warn(_("abort: out of memory\n")) |
|
137 | ui.warn(_("abort: out of memory\n")) | |
138 | except SystemExit, inst: |
|
138 | except SystemExit, inst: | |
139 | # Commands shouldn't sys.exit directly, but give a return code. |
|
139 | # Commands shouldn't sys.exit directly, but give a return code. | |
140 | # Just in case catch this and and pass exit code to caller. |
|
140 | # Just in case catch this and and pass exit code to caller. | |
141 | return inst.code |
|
141 | return inst.code | |
142 | except: |
|
142 | except: | |
143 | ui.warn(_("** unknown exception encountered, details follow\n")) |
|
143 | ui.warn(_("** unknown exception encountered, details follow\n")) | |
144 | ui.warn(_("** report bug details to " |
|
144 | ui.warn(_("** report bug details to " | |
145 | "http://www.selenic.com/mercurial/bts\n")) |
|
145 | "http://www.selenic.com/mercurial/bts\n")) | |
146 | ui.warn(_("** or mercurial@selenic.com\n")) |
|
146 | ui.warn(_("** or mercurial@selenic.com\n")) | |
147 | ui.warn(_("** Mercurial Distributed SCM (version %s)\n") |
|
147 | ui.warn(_("** Mercurial Distributed SCM (version %s)\n") | |
148 | % version.get_version()) |
|
148 | % version.get_version()) | |
149 | raise |
|
149 | raise | |
150 |
|
150 | |||
151 | return -1 |
|
151 | return -1 | |
152 |
|
152 | |||
153 | def _findrepo(): |
|
153 | def _findrepo(p): | |
154 | p = os.getcwd() |
|
|||
155 | while not os.path.isdir(os.path.join(p, ".hg")): |
|
154 | while not os.path.isdir(os.path.join(p, ".hg")): | |
156 | oldp, p = p, os.path.dirname(p) |
|
155 | oldp, p = p, os.path.dirname(p) | |
157 | if p == oldp: |
|
156 | if p == oldp: | |
158 | return None |
|
157 | return None | |
159 |
|
158 | |||
160 | return p |
|
159 | return p | |
161 |
|
160 | |||
162 | def _parse(ui, args): |
|
161 | def _parse(ui, args): | |
163 | options = {} |
|
162 | options = {} | |
164 | cmdoptions = {} |
|
163 | cmdoptions = {} | |
165 |
|
164 | |||
166 | try: |
|
165 | try: | |
167 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
166 | args = fancyopts.fancyopts(args, commands.globalopts, options) | |
168 | except fancyopts.getopt.GetoptError, inst: |
|
167 | except fancyopts.getopt.GetoptError, inst: | |
169 | raise ParseError(None, inst) |
|
168 | raise ParseError(None, inst) | |
170 |
|
169 | |||
171 | if args: |
|
170 | if args: | |
172 | cmd, args = args[0], args[1:] |
|
171 | cmd, args = args[0], args[1:] | |
173 | aliases, i = cmdutil.findcmd(ui, cmd, commands.table) |
|
172 | aliases, i = cmdutil.findcmd(ui, cmd, commands.table) | |
174 | cmd = aliases[0] |
|
173 | cmd = aliases[0] | |
175 | defaults = ui.config("defaults", cmd) |
|
174 | defaults = ui.config("defaults", cmd) | |
176 | if defaults: |
|
175 | if defaults: | |
177 | args = shlex.split(defaults) + args |
|
176 | args = shlex.split(defaults) + args | |
178 | c = list(i[1]) |
|
177 | c = list(i[1]) | |
179 | else: |
|
178 | else: | |
180 | cmd = None |
|
179 | cmd = None | |
181 | c = [] |
|
180 | c = [] | |
182 |
|
181 | |||
183 | # combine global options into local |
|
182 | # combine global options into local | |
184 | for o in commands.globalopts: |
|
183 | for o in commands.globalopts: | |
185 | c.append((o[0], o[1], options[o[1]], o[3])) |
|
184 | c.append((o[0], o[1], options[o[1]], o[3])) | |
186 |
|
185 | |||
187 | try: |
|
186 | try: | |
188 | args = fancyopts.fancyopts(args, c, cmdoptions) |
|
187 | args = fancyopts.fancyopts(args, c, cmdoptions) | |
189 | except fancyopts.getopt.GetoptError, inst: |
|
188 | except fancyopts.getopt.GetoptError, inst: | |
190 | raise ParseError(cmd, inst) |
|
189 | raise ParseError(cmd, inst) | |
191 |
|
190 | |||
192 | # separate global options back out |
|
191 | # separate global options back out | |
193 | for o in commands.globalopts: |
|
192 | for o in commands.globalopts: | |
194 | n = o[1] |
|
193 | n = o[1] | |
195 | options[n] = cmdoptions[n] |
|
194 | options[n] = cmdoptions[n] | |
196 | del cmdoptions[n] |
|
195 | del cmdoptions[n] | |
197 |
|
196 | |||
198 | return (cmd, cmd and i[0] or None, args, options, cmdoptions) |
|
197 | return (cmd, cmd and i[0] or None, args, options, cmdoptions) | |
199 |
|
198 | |||
200 | def _parseconfig(config): |
|
199 | def _parseconfig(config): | |
201 | """parse the --config options from the command line""" |
|
200 | """parse the --config options from the command line""" | |
202 | parsed = [] |
|
201 | parsed = [] | |
203 | for cfg in config: |
|
202 | for cfg in config: | |
204 | try: |
|
203 | try: | |
205 | name, value = cfg.split('=', 1) |
|
204 | name, value = cfg.split('=', 1) | |
206 | section, name = name.split('.', 1) |
|
205 | section, name = name.split('.', 1) | |
207 | if not section or not name: |
|
206 | if not section or not name: | |
208 | raise IndexError |
|
207 | raise IndexError | |
209 | parsed.append((section, name, value)) |
|
208 | parsed.append((section, name, value)) | |
210 | except (IndexError, ValueError): |
|
209 | except (IndexError, ValueError): | |
211 | raise util.Abort(_('malformed --config option: %s') % cfg) |
|
210 | raise util.Abort(_('malformed --config option: %s') % cfg) | |
212 | return parsed |
|
211 | return parsed | |
213 |
|
212 | |||
214 | def _earlygetopt(aliases, args): |
|
213 | def _earlygetopt(aliases, args): | |
215 | """Return list of values for an option (or aliases). |
|
214 | """Return list of values for an option (or aliases). | |
216 |
|
215 | |||
217 | The values are listed in the order they appear in args. |
|
216 | The values are listed in the order they appear in args. | |
218 | The options and values are removed from args. |
|
217 | The options and values are removed from args. | |
219 | """ |
|
218 | """ | |
220 | try: |
|
219 | try: | |
221 | argcount = args.index("--") |
|
220 | argcount = args.index("--") | |
222 | except ValueError: |
|
221 | except ValueError: | |
223 | argcount = len(args) |
|
222 | argcount = len(args) | |
224 | shortopts = [opt for opt in aliases if len(opt) == 2] |
|
223 | shortopts = [opt for opt in aliases if len(opt) == 2] | |
225 | values = [] |
|
224 | values = [] | |
226 | pos = 0 |
|
225 | pos = 0 | |
227 | while pos < argcount: |
|
226 | while pos < argcount: | |
228 | if args[pos] in aliases: |
|
227 | if args[pos] in aliases: | |
229 | if pos + 1 >= argcount: |
|
228 | if pos + 1 >= argcount: | |
230 | # ignore and let getopt report an error if there is no value |
|
229 | # ignore and let getopt report an error if there is no value | |
231 | break |
|
230 | break | |
232 | del args[pos] |
|
231 | del args[pos] | |
233 | values.append(args.pop(pos)) |
|
232 | values.append(args.pop(pos)) | |
234 | argcount -= 2 |
|
233 | argcount -= 2 | |
235 | elif args[pos][:2] in shortopts: |
|
234 | elif args[pos][:2] in shortopts: | |
236 | # short option can have no following space, e.g. hg log -Rfoo |
|
235 | # short option can have no following space, e.g. hg log -Rfoo | |
237 | values.append(args.pop(pos)[2:]) |
|
236 | values.append(args.pop(pos)[2:]) | |
238 | argcount -= 1 |
|
237 | argcount -= 1 | |
239 | else: |
|
238 | else: | |
240 | pos += 1 |
|
239 | pos += 1 | |
241 | return values |
|
240 | return values | |
242 |
|
241 | |||
243 | _loaded = {} |
|
242 | _loaded = {} | |
244 | def _dispatch(ui, args): |
|
243 | def _dispatch(ui, args): | |
245 | # read --config before doing anything else |
|
244 | # read --config before doing anything else | |
246 | # (e.g. to change trust settings for reading .hg/hgrc) |
|
245 | # (e.g. to change trust settings for reading .hg/hgrc) | |
247 | config = _earlygetopt(['--config'], args) |
|
246 | config = _earlygetopt(['--config'], args) | |
248 | if config: |
|
247 | if config: | |
249 | ui.updateopts(config=_parseconfig(config)) |
|
248 | ui.updateopts(config=_parseconfig(config)) | |
250 |
|
249 | |||
251 | # check for cwd |
|
250 | # check for cwd | |
252 | cwd = _earlygetopt(['--cwd'], args) |
|
251 | cwd = _earlygetopt(['--cwd'], args) | |
253 | if cwd: |
|
252 | if cwd: | |
254 | os.chdir(cwd[-1]) |
|
253 | os.chdir(cwd[-1]) | |
255 |
|
254 | |||
256 | # read the local repository .hgrc into a local ui object |
|
255 | # read the local repository .hgrc into a local ui object | |
257 | path = _findrepo() or "" |
|
256 | path = _findrepo(os.getcwd()) or "" | |
258 | if not path: |
|
257 | if not path: | |
259 | lui = ui |
|
258 | lui = ui | |
260 | if path: |
|
259 | if path: | |
261 | try: |
|
260 | try: | |
262 | lui = _ui.ui(parentui=ui) |
|
261 | lui = _ui.ui(parentui=ui) | |
263 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
|
262 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) | |
264 | except IOError: |
|
263 | except IOError: | |
265 | pass |
|
264 | pass | |
266 |
|
265 | |||
267 | # now we can expand paths, even ones in .hg/hgrc |
|
266 | # now we can expand paths, even ones in .hg/hgrc | |
268 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) |
|
267 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) | |
269 | if rpath: |
|
268 | if rpath: | |
270 | path = lui.expandpath(rpath[-1]) |
|
269 | path = lui.expandpath(rpath[-1]) | |
271 | lui = _ui.ui(parentui=ui) |
|
270 | lui = _ui.ui(parentui=ui) | |
272 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
|
271 | lui.readconfig(os.path.join(path, ".hg", "hgrc")) | |
273 |
|
272 | |||
274 | extensions.loadall(lui) |
|
273 | extensions.loadall(lui) | |
275 | for name, module in extensions.extensions(): |
|
274 | for name, module in extensions.extensions(): | |
276 | if name in _loaded: |
|
275 | if name in _loaded: | |
277 | continue |
|
276 | continue | |
278 |
|
277 | |||
279 | # setup extensions |
|
278 | # setup extensions | |
280 | # TODO this should be generalized to scheme, where extensions can |
|
279 | # TODO this should be generalized to scheme, where extensions can | |
281 | # redepend on other extensions. then we should toposort them, and |
|
280 | # redepend on other extensions. then we should toposort them, and | |
282 | # do initialization in correct order |
|
281 | # do initialization in correct order | |
283 | extsetup = getattr(module, 'extsetup', None) |
|
282 | extsetup = getattr(module, 'extsetup', None) | |
284 | if extsetup: |
|
283 | if extsetup: | |
285 | extsetup() |
|
284 | extsetup() | |
286 |
|
285 | |||
287 | cmdtable = getattr(module, 'cmdtable', {}) |
|
286 | cmdtable = getattr(module, 'cmdtable', {}) | |
288 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] |
|
287 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] | |
289 | if overrides: |
|
288 | if overrides: | |
290 | ui.warn(_("extension '%s' overrides commands: %s\n") |
|
289 | ui.warn(_("extension '%s' overrides commands: %s\n") | |
291 | % (name, " ".join(overrides))) |
|
290 | % (name, " ".join(overrides))) | |
292 | commands.table.update(cmdtable) |
|
291 | commands.table.update(cmdtable) | |
293 | _loaded[name] = 1 |
|
292 | _loaded[name] = 1 | |
294 | # check for fallback encoding |
|
293 | # check for fallback encoding | |
295 | fallback = lui.config('ui', 'fallbackencoding') |
|
294 | fallback = lui.config('ui', 'fallbackencoding') | |
296 | if fallback: |
|
295 | if fallback: | |
297 | util._fallbackencoding = fallback |
|
296 | util._fallbackencoding = fallback | |
298 |
|
297 | |||
299 | fullargs = args |
|
298 | fullargs = args | |
300 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
299 | cmd, func, args, options, cmdoptions = _parse(lui, args) | |
301 |
|
300 | |||
302 | if options["config"]: |
|
301 | if options["config"]: | |
303 | raise util.Abort(_("Option --config may not be abbreviated!")) |
|
302 | raise util.Abort(_("Option --config may not be abbreviated!")) | |
304 | if options["cwd"]: |
|
303 | if options["cwd"]: | |
305 | raise util.Abort(_("Option --cwd may not be abbreviated!")) |
|
304 | raise util.Abort(_("Option --cwd may not be abbreviated!")) | |
306 | if options["repository"]: |
|
305 | if options["repository"]: | |
307 | raise util.Abort(_( |
|
306 | raise util.Abort(_( | |
308 | "Option -R has to be separated from other options (i.e. not -qR) " |
|
307 | "Option -R has to be separated from other options (i.e. not -qR) " | |
309 | "and --repository may only be abbreviated as --repo!")) |
|
308 | "and --repository may only be abbreviated as --repo!")) | |
310 |
|
309 | |||
311 | if options["encoding"]: |
|
310 | if options["encoding"]: | |
312 | util._encoding = options["encoding"] |
|
311 | util._encoding = options["encoding"] | |
313 | if options["encodingmode"]: |
|
312 | if options["encodingmode"]: | |
314 | util._encodingmode = options["encodingmode"] |
|
313 | util._encodingmode = options["encodingmode"] | |
315 | if options["time"]: |
|
314 | if options["time"]: | |
316 | def get_times(): |
|
315 | def get_times(): | |
317 | t = os.times() |
|
316 | t = os.times() | |
318 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() |
|
317 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() | |
319 | t = (t[0], t[1], t[2], t[3], time.clock()) |
|
318 | t = (t[0], t[1], t[2], t[3], time.clock()) | |
320 | return t |
|
319 | return t | |
321 | s = get_times() |
|
320 | s = get_times() | |
322 | def print_time(): |
|
321 | def print_time(): | |
323 | t = get_times() |
|
322 | t = get_times() | |
324 | ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
|
323 | ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % | |
325 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
|
324 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) | |
326 | atexit.register(print_time) |
|
325 | atexit.register(print_time) | |
327 |
|
326 | |||
328 | ui.updateopts(options["verbose"], options["debug"], options["quiet"], |
|
327 | ui.updateopts(options["verbose"], options["debug"], options["quiet"], | |
329 | not options["noninteractive"], options["traceback"]) |
|
328 | not options["noninteractive"], options["traceback"]) | |
330 |
|
329 | |||
331 | if options['help']: |
|
330 | if options['help']: | |
332 | return commands.help_(ui, cmd, options['version']) |
|
331 | return commands.help_(ui, cmd, options['version']) | |
333 | elif options['version']: |
|
332 | elif options['version']: | |
334 | return commands.version_(ui) |
|
333 | return commands.version_(ui) | |
335 | elif not cmd: |
|
334 | elif not cmd: | |
336 | return commands.help_(ui, 'shortlist') |
|
335 | return commands.help_(ui, 'shortlist') | |
337 |
|
336 | |||
338 | repo = None |
|
337 | repo = None | |
339 | if cmd not in commands.norepo.split(): |
|
338 | if cmd not in commands.norepo.split(): | |
340 | try: |
|
339 | try: | |
341 | repo = hg.repository(ui, path=path) |
|
340 | repo = hg.repository(ui, path=path) | |
342 | ui = repo.ui |
|
341 | ui = repo.ui | |
343 | if not repo.local(): |
|
342 | if not repo.local(): | |
344 | raise util.Abort(_("repository '%s' is not local") % path) |
|
343 | raise util.Abort(_("repository '%s' is not local") % path) | |
345 | ui.setconfig("bundle", "mainreporoot", repo.root) |
|
344 | ui.setconfig("bundle", "mainreporoot", repo.root) | |
346 | except hg.RepoError: |
|
345 | except hg.RepoError: | |
347 | if cmd not in commands.optionalrepo.split(): |
|
346 | if cmd not in commands.optionalrepo.split(): | |
|
347 | if args and not path: # try to infer -R from command args | |||
|
348 | repos = map(_findrepo, args) | |||
|
349 | guess = repos[0] | |||
|
350 | if guess and repos.count(guess) == len(repos): | |||
|
351 | return _dispatch(ui, ['--repository', guess] + fullargs) | |||
348 | if not path: |
|
352 | if not path: | |
349 | raise hg.RepoError(_("There is no Mercurial repository here" |
|
353 | raise hg.RepoError(_("There is no Mercurial repository here" | |
350 | " (.hg not found)")) |
|
354 | " (.hg not found)")) | |
351 | raise |
|
355 | raise | |
352 | d = lambda: func(ui, repo, *args, **cmdoptions) |
|
356 | d = lambda: func(ui, repo, *args, **cmdoptions) | |
353 | else: |
|
357 | else: | |
354 | d = lambda: func(ui, *args, **cmdoptions) |
|
358 | d = lambda: func(ui, *args, **cmdoptions) | |
355 |
|
359 | |||
356 | # run pre-hook, and abort if it fails |
|
360 | # run pre-hook, and abort if it fails | |
357 | ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs)) |
|
361 | ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs)) | |
358 | if ret: |
|
362 | if ret: | |
359 | return ret |
|
363 | return ret | |
360 | ret = _runcommand(ui, options, cmd, d) |
|
364 | ret = _runcommand(ui, options, cmd, d) | |
361 | # run post-hook, passing command result |
|
365 | # run post-hook, passing command result | |
362 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), |
|
366 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), | |
363 | result = ret) |
|
367 | result = ret) | |
364 | return ret |
|
368 | return ret | |
365 |
|
369 | |||
366 | def _runcommand(ui, options, cmd, cmdfunc): |
|
370 | def _runcommand(ui, options, cmd, cmdfunc): | |
367 | def checkargs(): |
|
371 | def checkargs(): | |
368 | try: |
|
372 | try: | |
369 | return cmdfunc() |
|
373 | return cmdfunc() | |
370 | except TypeError, inst: |
|
374 | except TypeError, inst: | |
371 | # was this an argument error? |
|
375 | # was this an argument error? | |
372 | tb = traceback.extract_tb(sys.exc_info()[2]) |
|
376 | tb = traceback.extract_tb(sys.exc_info()[2]) | |
373 | if len(tb) != 2: # no |
|
377 | if len(tb) != 2: # no | |
374 | raise |
|
378 | raise | |
375 | raise ParseError(cmd, _("invalid arguments")) |
|
379 | raise ParseError(cmd, _("invalid arguments")) | |
376 |
|
380 | |||
377 | if options['profile']: |
|
381 | if options['profile']: | |
378 | import hotshot, hotshot.stats |
|
382 | import hotshot, hotshot.stats | |
379 | prof = hotshot.Profile("hg.prof") |
|
383 | prof = hotshot.Profile("hg.prof") | |
380 | try: |
|
384 | try: | |
381 | try: |
|
385 | try: | |
382 | return prof.runcall(checkargs) |
|
386 | return prof.runcall(checkargs) | |
383 | except: |
|
387 | except: | |
384 | try: |
|
388 | try: | |
385 | ui.warn(_('exception raised - generating ' |
|
389 | ui.warn(_('exception raised - generating ' | |
386 | 'profile anyway\n')) |
|
390 | 'profile anyway\n')) | |
387 | except: |
|
391 | except: | |
388 | pass |
|
392 | pass | |
389 | raise |
|
393 | raise | |
390 | finally: |
|
394 | finally: | |
391 | prof.close() |
|
395 | prof.close() | |
392 | stats = hotshot.stats.load("hg.prof") |
|
396 | stats = hotshot.stats.load("hg.prof") | |
393 | stats.strip_dirs() |
|
397 | stats.strip_dirs() | |
394 | stats.sort_stats('time', 'calls') |
|
398 | stats.sort_stats('time', 'calls') | |
395 | stats.print_stats(40) |
|
399 | stats.print_stats(40) | |
396 | elif options['lsprof']: |
|
400 | elif options['lsprof']: | |
397 | try: |
|
401 | try: | |
398 | from mercurial import lsprof |
|
402 | from mercurial import lsprof | |
399 | except ImportError: |
|
403 | except ImportError: | |
400 | raise util.Abort(_( |
|
404 | raise util.Abort(_( | |
401 | 'lsprof not available - install from ' |
|
405 | 'lsprof not available - install from ' | |
402 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) |
|
406 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) | |
403 | p = lsprof.Profiler() |
|
407 | p = lsprof.Profiler() | |
404 | p.enable(subcalls=True) |
|
408 | p.enable(subcalls=True) | |
405 | try: |
|
409 | try: | |
406 | return checkargs() |
|
410 | return checkargs() | |
407 | finally: |
|
411 | finally: | |
408 | p.disable() |
|
412 | p.disable() | |
409 | stats = lsprof.Stats(p.getstats()) |
|
413 | stats = lsprof.Stats(p.getstats()) | |
410 | stats.sort() |
|
414 | stats.sort() | |
411 | stats.pprint(top=10, file=sys.stderr, climit=5) |
|
415 | stats.pprint(top=10, file=sys.stderr, climit=5) | |
412 | else: |
|
416 | else: | |
413 | return checkargs() |
|
417 | return checkargs() |
@@ -1,87 +1,94 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | hg init a |
|
3 | hg init a | |
4 | cd a |
|
4 | cd a | |
5 | echo a > a |
|
5 | echo a > a | |
6 | hg ci -A -d'1 0' -m a |
|
6 | hg ci -A -d'1 0' -m a | |
7 |
|
7 | |||
8 | cd .. |
|
8 | cd .. | |
9 |
|
9 | |||
10 | hg init b |
|
10 | hg init b | |
11 | cd b |
|
11 | cd b | |
12 | echo b > b |
|
12 | echo b > b | |
13 | hg ci -A -d'1 0' -m b |
|
13 | hg ci -A -d'1 0' -m b | |
14 |
|
14 | |||
15 | cd .. |
|
15 | cd .. | |
16 |
|
16 | |||
17 | hg clone a c |
|
17 | hg clone a c | |
18 | cd c |
|
18 | cd c | |
19 | hg pull -f ../b |
|
19 | hg pull -f ../b | |
20 | hg merge |
|
20 | hg merge | |
21 |
|
21 | |||
22 | cd .. |
|
22 | cd .. | |
23 |
|
23 | |||
24 | echo %% -R/--repository |
|
24 | echo %% -R/--repository | |
25 | hg -R a tip |
|
25 | hg -R a tip | |
26 | hg --repository b tip |
|
26 | hg --repository b tip | |
27 |
|
27 | |||
|
28 | echo %% implicit -R | |||
|
29 | hg ann a/a | |||
|
30 | hg ann a/a a/a | |||
|
31 | hg ann a/a b/b | |||
|
32 | hg -R b ann a/a | |||
|
33 | hg log | |||
|
34 | ||||
28 | echo %% abbrev of long option |
|
35 | echo %% abbrev of long option | |
29 | hg --repo c tip |
|
36 | hg --repo c tip | |
30 |
|
37 | |||
31 | echo "%% earlygetopt with duplicate options (36d23de02da1)" |
|
38 | echo "%% earlygetopt with duplicate options (36d23de02da1)" | |
32 | hg --cwd a --cwd b --cwd c tip |
|
39 | hg --cwd a --cwd b --cwd c tip | |
33 | hg --repo c --repository b -R a tip |
|
40 | hg --repo c --repository b -R a tip | |
34 |
|
41 | |||
35 | echo "%% earlygetopt short option without following space" |
|
42 | echo "%% earlygetopt short option without following space" | |
36 | hg -q -Rb tip |
|
43 | hg -q -Rb tip | |
37 |
|
44 | |||
38 | echo "%% earlygetopt with illegal abbreviations" |
|
45 | echo "%% earlygetopt with illegal abbreviations" | |
39 | hg --confi "foo.bar=baz" |
|
46 | hg --confi "foo.bar=baz" | |
40 | hg --cw a tip |
|
47 | hg --cw a tip | |
41 | hg --rep a tip |
|
48 | hg --rep a tip | |
42 | hg --repositor a tip |
|
49 | hg --repositor a tip | |
43 | hg -qR a tip |
|
50 | hg -qR a tip | |
44 | hg -qRa tip |
|
51 | hg -qRa tip | |
45 |
|
52 | |||
46 | echo %% --cwd |
|
53 | echo %% --cwd | |
47 | hg --cwd a parents |
|
54 | hg --cwd a parents | |
48 |
|
55 | |||
49 | echo %% -y/--noninteractive - just be sure it is parsed |
|
56 | echo %% -y/--noninteractive - just be sure it is parsed | |
50 | hg --cwd a tip -q --noninteractive |
|
57 | hg --cwd a tip -q --noninteractive | |
51 | hg --cwd a tip -q -y |
|
58 | hg --cwd a tip -q -y | |
52 |
|
59 | |||
53 | echo %% -q/--quiet |
|
60 | echo %% -q/--quiet | |
54 | hg -R a -q tip |
|
61 | hg -R a -q tip | |
55 | hg -R b -q tip |
|
62 | hg -R b -q tip | |
56 | hg -R c --quiet parents |
|
63 | hg -R c --quiet parents | |
57 |
|
64 | |||
58 | echo %% -v/--verbose |
|
65 | echo %% -v/--verbose | |
59 | hg --cwd c head -v |
|
66 | hg --cwd c head -v | |
60 | hg --cwd b tip --verbose |
|
67 | hg --cwd b tip --verbose | |
61 |
|
68 | |||
62 | echo %% --config |
|
69 | echo %% --config | |
63 | hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo |
|
70 | hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo | |
64 | hg --cwd c --config '' tip -q |
|
71 | hg --cwd c --config '' tip -q | |
65 | hg --cwd c --config a.b tip -q |
|
72 | hg --cwd c --config a.b tip -q | |
66 | hg --cwd c --config a tip -q |
|
73 | hg --cwd c --config a tip -q | |
67 | hg --cwd c --config a.= tip -q |
|
74 | hg --cwd c --config a.= tip -q | |
68 | hg --cwd c --config .b= tip -q |
|
75 | hg --cwd c --config .b= tip -q | |
69 |
|
76 | |||
70 | echo %% --debug |
|
77 | echo %% --debug | |
71 | hg --cwd c log --debug |
|
78 | hg --cwd c log --debug | |
72 |
|
79 | |||
73 | echo %% --traceback |
|
80 | echo %% --traceback | |
74 | hg --cwd c --config x --traceback tip 2>&1 | grep -i 'traceback' |
|
81 | hg --cwd c --config x --traceback tip 2>&1 | grep -i 'traceback' | |
75 |
|
82 | |||
76 | echo %% --time |
|
83 | echo %% --time | |
77 | hg --cwd a --time tip 2>&1 | grep '^Time:' | sed 's/[0-9][0-9]*/x/g' |
|
84 | hg --cwd a --time tip 2>&1 | grep '^Time:' | sed 's/[0-9][0-9]*/x/g' | |
78 |
|
85 | |||
79 | echo %% --version |
|
86 | echo %% --version | |
80 | hg --version -q | sed 's/version [^)]*/version xxx/' |
|
87 | hg --version -q | sed 's/version [^)]*/version xxx/' | |
81 |
|
88 | |||
82 | echo %% -h/--help |
|
89 | echo %% -h/--help | |
83 | hg -h |
|
90 | hg -h | |
84 | hg --help |
|
91 | hg --help | |
85 |
|
92 | |||
86 | echo %% not tested: --debugger |
|
93 | echo %% not tested: --debugger | |
87 |
|
94 |
@@ -1,247 +1,253 b'' | |||||
1 | adding a |
|
1 | adding a | |
2 | adding b |
|
2 | adding b | |
3 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
3 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
4 | pulling from ../b |
|
4 | pulling from ../b | |
5 | searching for changes |
|
5 | searching for changes | |
6 | warning: repository is unrelated |
|
6 | warning: repository is unrelated | |
7 | adding changesets |
|
7 | adding changesets | |
8 | adding manifests |
|
8 | adding manifests | |
9 | adding file changes |
|
9 | adding file changes | |
10 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
10 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
11 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
11 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
12 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
12 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
13 | (branch merge, don't forget to commit) |
|
13 | (branch merge, don't forget to commit) | |
14 | %% -R/--repository |
|
14 | %% -R/--repository | |
15 | changeset: 0:8580ff50825a |
|
15 | changeset: 0:8580ff50825a | |
16 | tag: tip |
|
16 | tag: tip | |
17 | user: test |
|
17 | user: test | |
18 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
18 | date: Thu Jan 01 00:00:01 1970 +0000 | |
19 | summary: a |
|
19 | summary: a | |
20 |
|
20 | |||
21 | changeset: 0:b6c483daf290 |
|
21 | changeset: 0:b6c483daf290 | |
22 | tag: tip |
|
22 | tag: tip | |
23 | user: test |
|
23 | user: test | |
24 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
24 | date: Thu Jan 01 00:00:01 1970 +0000 | |
25 | summary: b |
|
25 | summary: b | |
26 |
|
26 | |||
|
27 | %% implicit -R | |||
|
28 | 0: a | |||
|
29 | 0: a | |||
|
30 | abort: There is no Mercurial repository here (.hg not found)! | |||
|
31 | abort: a/a not under root | |||
|
32 | abort: There is no Mercurial repository here (.hg not found)! | |||
27 | %% abbrev of long option |
|
33 | %% abbrev of long option | |
28 | changeset: 1:b6c483daf290 |
|
34 | changeset: 1:b6c483daf290 | |
29 | tag: tip |
|
35 | tag: tip | |
30 | parent: -1:000000000000 |
|
36 | parent: -1:000000000000 | |
31 | user: test |
|
37 | user: test | |
32 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
38 | date: Thu Jan 01 00:00:01 1970 +0000 | |
33 | summary: b |
|
39 | summary: b | |
34 |
|
40 | |||
35 | %% earlygetopt with duplicate options (36d23de02da1) |
|
41 | %% earlygetopt with duplicate options (36d23de02da1) | |
36 | changeset: 1:b6c483daf290 |
|
42 | changeset: 1:b6c483daf290 | |
37 | tag: tip |
|
43 | tag: tip | |
38 | parent: -1:000000000000 |
|
44 | parent: -1:000000000000 | |
39 | user: test |
|
45 | user: test | |
40 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
46 | date: Thu Jan 01 00:00:01 1970 +0000 | |
41 | summary: b |
|
47 | summary: b | |
42 |
|
48 | |||
43 | changeset: 0:8580ff50825a |
|
49 | changeset: 0:8580ff50825a | |
44 | tag: tip |
|
50 | tag: tip | |
45 | user: test |
|
51 | user: test | |
46 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
52 | date: Thu Jan 01 00:00:01 1970 +0000 | |
47 | summary: a |
|
53 | summary: a | |
48 |
|
54 | |||
49 | %% earlygetopt short option without following space |
|
55 | %% earlygetopt short option without following space | |
50 | 0:b6c483daf290 |
|
56 | 0:b6c483daf290 | |
51 | %% earlygetopt with illegal abbreviations |
|
57 | %% earlygetopt with illegal abbreviations | |
52 | abort: Option --config may not be abbreviated! |
|
58 | abort: Option --config may not be abbreviated! | |
53 | abort: Option --cwd may not be abbreviated! |
|
59 | abort: Option --cwd may not be abbreviated! | |
54 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! |
|
60 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! | |
55 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! |
|
61 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! | |
56 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! |
|
62 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! | |
57 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! |
|
63 | abort: Option -R has to be separated from other options (i.e. not -qR) and --repository may only be abbreviated as --repo! | |
58 | %% --cwd |
|
64 | %% --cwd | |
59 | changeset: 0:8580ff50825a |
|
65 | changeset: 0:8580ff50825a | |
60 | tag: tip |
|
66 | tag: tip | |
61 | user: test |
|
67 | user: test | |
62 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
68 | date: Thu Jan 01 00:00:01 1970 +0000 | |
63 | summary: a |
|
69 | summary: a | |
64 |
|
70 | |||
65 | %% -y/--noninteractive - just be sure it is parsed |
|
71 | %% -y/--noninteractive - just be sure it is parsed | |
66 | 0:8580ff50825a |
|
72 | 0:8580ff50825a | |
67 | 0:8580ff50825a |
|
73 | 0:8580ff50825a | |
68 | %% -q/--quiet |
|
74 | %% -q/--quiet | |
69 | 0:8580ff50825a |
|
75 | 0:8580ff50825a | |
70 | 0:b6c483daf290 |
|
76 | 0:b6c483daf290 | |
71 | 0:8580ff50825a |
|
77 | 0:8580ff50825a | |
72 | 1:b6c483daf290 |
|
78 | 1:b6c483daf290 | |
73 | %% -v/--verbose |
|
79 | %% -v/--verbose | |
74 | changeset: 1:b6c483daf290 |
|
80 | changeset: 1:b6c483daf290 | |
75 | tag: tip |
|
81 | tag: tip | |
76 | parent: -1:000000000000 |
|
82 | parent: -1:000000000000 | |
77 | user: test |
|
83 | user: test | |
78 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
84 | date: Thu Jan 01 00:00:01 1970 +0000 | |
79 | files: b |
|
85 | files: b | |
80 | description: |
|
86 | description: | |
81 | b |
|
87 | b | |
82 |
|
88 | |||
83 |
|
89 | |||
84 | changeset: 0:8580ff50825a |
|
90 | changeset: 0:8580ff50825a | |
85 | user: test |
|
91 | user: test | |
86 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
92 | date: Thu Jan 01 00:00:01 1970 +0000 | |
87 | files: a |
|
93 | files: a | |
88 | description: |
|
94 | description: | |
89 | a |
|
95 | a | |
90 |
|
96 | |||
91 |
|
97 | |||
92 | changeset: 0:b6c483daf290 |
|
98 | changeset: 0:b6c483daf290 | |
93 | tag: tip |
|
99 | tag: tip | |
94 | user: test |
|
100 | user: test | |
95 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
101 | date: Thu Jan 01 00:00:01 1970 +0000 | |
96 | files: b |
|
102 | files: b | |
97 | description: |
|
103 | description: | |
98 | b |
|
104 | b | |
99 |
|
105 | |||
100 |
|
106 | |||
101 | %% --config |
|
107 | %% --config | |
102 | quuxfoo |
|
108 | quuxfoo | |
103 | abort: malformed --config option: |
|
109 | abort: malformed --config option: | |
104 | abort: malformed --config option: a.b |
|
110 | abort: malformed --config option: a.b | |
105 | abort: malformed --config option: a |
|
111 | abort: malformed --config option: a | |
106 | abort: malformed --config option: a.= |
|
112 | abort: malformed --config option: a.= | |
107 | abort: malformed --config option: .b= |
|
113 | abort: malformed --config option: .b= | |
108 | %% --debug |
|
114 | %% --debug | |
109 | changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a |
|
115 | changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a | |
110 | tag: tip |
|
116 | tag: tip | |
111 | parent: -1:0000000000000000000000000000000000000000 |
|
117 | parent: -1:0000000000000000000000000000000000000000 | |
112 | parent: -1:0000000000000000000000000000000000000000 |
|
118 | parent: -1:0000000000000000000000000000000000000000 | |
113 | manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49 |
|
119 | manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49 | |
114 | user: test |
|
120 | user: test | |
115 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
121 | date: Thu Jan 01 00:00:01 1970 +0000 | |
116 | files+: b |
|
122 | files+: b | |
117 | extra: branch=default |
|
123 | extra: branch=default | |
118 | description: |
|
124 | description: | |
119 | b |
|
125 | b | |
120 |
|
126 | |||
121 |
|
127 | |||
122 | changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab |
|
128 | changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab | |
123 | parent: -1:0000000000000000000000000000000000000000 |
|
129 | parent: -1:0000000000000000000000000000000000000000 | |
124 | parent: -1:0000000000000000000000000000000000000000 |
|
130 | parent: -1:0000000000000000000000000000000000000000 | |
125 | manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 |
|
131 | manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 | |
126 | user: test |
|
132 | user: test | |
127 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
133 | date: Thu Jan 01 00:00:01 1970 +0000 | |
128 | files+: a |
|
134 | files+: a | |
129 | extra: branch=default |
|
135 | extra: branch=default | |
130 | description: |
|
136 | description: | |
131 | a |
|
137 | a | |
132 |
|
138 | |||
133 |
|
139 | |||
134 | %% --traceback |
|
140 | %% --traceback | |
135 | Traceback (most recent call last): |
|
141 | Traceback (most recent call last): | |
136 | %% --time |
|
142 | %% --time | |
137 | Time: real x.x secs (user x.x+x.x sys x.x+x.x) |
|
143 | Time: real x.x secs (user x.x+x.x sys x.x+x.x) | |
138 | %% --version |
|
144 | %% --version | |
139 | Mercurial Distributed SCM (version xxx) |
|
145 | Mercurial Distributed SCM (version xxx) | |
140 | %% -h/--help |
|
146 | %% -h/--help | |
141 | Mercurial Distributed SCM |
|
147 | Mercurial Distributed SCM | |
142 |
|
148 | |||
143 | list of commands: |
|
149 | list of commands: | |
144 |
|
150 | |||
145 | add add the specified files on the next commit |
|
151 | add add the specified files on the next commit | |
146 | addremove add all new files, delete all missing files |
|
152 | addremove add all new files, delete all missing files | |
147 | annotate show changeset information per file line |
|
153 | annotate show changeset information per file line | |
148 | archive create unversioned archive of a repository revision |
|
154 | archive create unversioned archive of a repository revision | |
149 | backout reverse effect of earlier changeset |
|
155 | backout reverse effect of earlier changeset | |
150 | bisect subdivision search of changesets |
|
156 | bisect subdivision search of changesets | |
151 | branch set or show the current branch name |
|
157 | branch set or show the current branch name | |
152 | branches list repository named branches |
|
158 | branches list repository named branches | |
153 | bundle create a changegroup file |
|
159 | bundle create a changegroup file | |
154 | cat output the current or given revision of files |
|
160 | cat output the current or given revision of files | |
155 | clone make a copy of an existing repository |
|
161 | clone make a copy of an existing repository | |
156 | commit commit the specified files or all outstanding changes |
|
162 | commit commit the specified files or all outstanding changes | |
157 | copy mark files as copied for the next commit |
|
163 | copy mark files as copied for the next commit | |
158 | diff diff repository (or selected files) |
|
164 | diff diff repository (or selected files) | |
159 | export dump the header and diffs for one or more changesets |
|
165 | export dump the header and diffs for one or more changesets | |
160 | grep search for a pattern in specified files and revisions |
|
166 | grep search for a pattern in specified files and revisions | |
161 | heads show current repository heads or show branch heads |
|
167 | heads show current repository heads or show branch heads | |
162 | help show help for a command, extension, or list of commands |
|
168 | help show help for a command, extension, or list of commands | |
163 | identify identify the working copy or specified revision |
|
169 | identify identify the working copy or specified revision | |
164 | import import an ordered set of patches |
|
170 | import import an ordered set of patches | |
165 | incoming show new changesets found in source |
|
171 | incoming show new changesets found in source | |
166 | init create a new repository in the given directory |
|
172 | init create a new repository in the given directory | |
167 | locate locate files matching specific patterns |
|
173 | locate locate files matching specific patterns | |
168 | log show revision history of entire repository or files |
|
174 | log show revision history of entire repository or files | |
169 | manifest output the current or given revision of the project manifest |
|
175 | manifest output the current or given revision of the project manifest | |
170 | merge merge working directory with another revision |
|
176 | merge merge working directory with another revision | |
171 | outgoing show changesets not found in destination |
|
177 | outgoing show changesets not found in destination | |
172 | parents show the parents of the working dir or revision |
|
178 | parents show the parents of the working dir or revision | |
173 | paths show definition of symbolic path names |
|
179 | paths show definition of symbolic path names | |
174 | pull pull changes from the specified source |
|
180 | pull pull changes from the specified source | |
175 | push push changes to the specified destination |
|
181 | push push changes to the specified destination | |
176 | recover roll back an interrupted transaction |
|
182 | recover roll back an interrupted transaction | |
177 | remove remove the specified files on the next commit |
|
183 | remove remove the specified files on the next commit | |
178 | rename rename files; equivalent of copy + remove |
|
184 | rename rename files; equivalent of copy + remove | |
179 | revert restore individual files or dirs to an earlier state |
|
185 | revert restore individual files or dirs to an earlier state | |
180 | rollback roll back the last transaction |
|
186 | rollback roll back the last transaction | |
181 | root print the root (top) of the current working dir |
|
187 | root print the root (top) of the current working dir | |
182 | serve export the repository via HTTP |
|
188 | serve export the repository via HTTP | |
183 | showconfig show combined config settings from all hgrc files |
|
189 | showconfig show combined config settings from all hgrc files | |
184 | status show changed files in the working directory |
|
190 | status show changed files in the working directory | |
185 | tag add a tag for the current or given revision |
|
191 | tag add a tag for the current or given revision | |
186 | tags list repository tags |
|
192 | tags list repository tags | |
187 | tip show the tip revision |
|
193 | tip show the tip revision | |
188 | unbundle apply one or more changegroup files |
|
194 | unbundle apply one or more changegroup files | |
189 | update update working directory |
|
195 | update update working directory | |
190 | verify verify the integrity of the repository |
|
196 | verify verify the integrity of the repository | |
191 | version output version and copyright information |
|
197 | version output version and copyright information | |
192 |
|
198 | |||
193 | use "hg -v help" to show aliases and global options |
|
199 | use "hg -v help" to show aliases and global options | |
194 | Mercurial Distributed SCM |
|
200 | Mercurial Distributed SCM | |
195 |
|
201 | |||
196 | list of commands: |
|
202 | list of commands: | |
197 |
|
203 | |||
198 | add add the specified files on the next commit |
|
204 | add add the specified files on the next commit | |
199 | addremove add all new files, delete all missing files |
|
205 | addremove add all new files, delete all missing files | |
200 | annotate show changeset information per file line |
|
206 | annotate show changeset information per file line | |
201 | archive create unversioned archive of a repository revision |
|
207 | archive create unversioned archive of a repository revision | |
202 | backout reverse effect of earlier changeset |
|
208 | backout reverse effect of earlier changeset | |
203 | bisect subdivision search of changesets |
|
209 | bisect subdivision search of changesets | |
204 | branch set or show the current branch name |
|
210 | branch set or show the current branch name | |
205 | branches list repository named branches |
|
211 | branches list repository named branches | |
206 | bundle create a changegroup file |
|
212 | bundle create a changegroup file | |
207 | cat output the current or given revision of files |
|
213 | cat output the current or given revision of files | |
208 | clone make a copy of an existing repository |
|
214 | clone make a copy of an existing repository | |
209 | commit commit the specified files or all outstanding changes |
|
215 | commit commit the specified files or all outstanding changes | |
210 | copy mark files as copied for the next commit |
|
216 | copy mark files as copied for the next commit | |
211 | diff diff repository (or selected files) |
|
217 | diff diff repository (or selected files) | |
212 | export dump the header and diffs for one or more changesets |
|
218 | export dump the header and diffs for one or more changesets | |
213 | grep search for a pattern in specified files and revisions |
|
219 | grep search for a pattern in specified files and revisions | |
214 | heads show current repository heads or show branch heads |
|
220 | heads show current repository heads or show branch heads | |
215 | help show help for a command, extension, or list of commands |
|
221 | help show help for a command, extension, or list of commands | |
216 | identify identify the working copy or specified revision |
|
222 | identify identify the working copy or specified revision | |
217 | import import an ordered set of patches |
|
223 | import import an ordered set of patches | |
218 | incoming show new changesets found in source |
|
224 | incoming show new changesets found in source | |
219 | init create a new repository in the given directory |
|
225 | init create a new repository in the given directory | |
220 | locate locate files matching specific patterns |
|
226 | locate locate files matching specific patterns | |
221 | log show revision history of entire repository or files |
|
227 | log show revision history of entire repository or files | |
222 | manifest output the current or given revision of the project manifest |
|
228 | manifest output the current or given revision of the project manifest | |
223 | merge merge working directory with another revision |
|
229 | merge merge working directory with another revision | |
224 | outgoing show changesets not found in destination |
|
230 | outgoing show changesets not found in destination | |
225 | parents show the parents of the working dir or revision |
|
231 | parents show the parents of the working dir or revision | |
226 | paths show definition of symbolic path names |
|
232 | paths show definition of symbolic path names | |
227 | pull pull changes from the specified source |
|
233 | pull pull changes from the specified source | |
228 | push push changes to the specified destination |
|
234 | push push changes to the specified destination | |
229 | recover roll back an interrupted transaction |
|
235 | recover roll back an interrupted transaction | |
230 | remove remove the specified files on the next commit |
|
236 | remove remove the specified files on the next commit | |
231 | rename rename files; equivalent of copy + remove |
|
237 | rename rename files; equivalent of copy + remove | |
232 | revert restore individual files or dirs to an earlier state |
|
238 | revert restore individual files or dirs to an earlier state | |
233 | rollback roll back the last transaction |
|
239 | rollback roll back the last transaction | |
234 | root print the root (top) of the current working dir |
|
240 | root print the root (top) of the current working dir | |
235 | serve export the repository via HTTP |
|
241 | serve export the repository via HTTP | |
236 | showconfig show combined config settings from all hgrc files |
|
242 | showconfig show combined config settings from all hgrc files | |
237 | status show changed files in the working directory |
|
243 | status show changed files in the working directory | |
238 | tag add a tag for the current or given revision |
|
244 | tag add a tag for the current or given revision | |
239 | tags list repository tags |
|
245 | tags list repository tags | |
240 | tip show the tip revision |
|
246 | tip show the tip revision | |
241 | unbundle apply one or more changegroup files |
|
247 | unbundle apply one or more changegroup files | |
242 | update update working directory |
|
248 | update update working directory | |
243 | verify verify the integrity of the repository |
|
249 | verify verify the integrity of the repository | |
244 | version output version and copyright information |
|
250 | version output version and copyright information | |
245 |
|
251 | |||
246 | use "hg -v help" to show aliases and global options |
|
252 | use "hg -v help" to show aliases and global options | |
247 | %% not tested: --debugger |
|
253 | %% not tested: --debugger |
General Comments 0
You need to be logged in to leave comments.
Login now