##// END OF EJS Templates
dispatch: improve repository not found message...
Matt Mackall -
r13967:f85c9b0f default
parent child Browse files
Show More
@@ -1,655 +1,655 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 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 _
8 from i18n import _
9 import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re
9 import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re
10 import util, commands, hg, fancyopts, extensions, hook, error
10 import util, commands, hg, fancyopts, extensions, hook, error
11 import cmdutil, encoding
11 import cmdutil, encoding
12 import ui as uimod
12 import ui as uimod
13
13
14 def run():
14 def run():
15 "run the command in sys.argv"
15 "run the command in sys.argv"
16 sys.exit(dispatch(sys.argv[1:]))
16 sys.exit(dispatch(sys.argv[1:]))
17
17
18 def dispatch(args):
18 def dispatch(args):
19 "run the command specified in args"
19 "run the command specified in args"
20 try:
20 try:
21 u = uimod.ui()
21 u = uimod.ui()
22 if '--traceback' in args:
22 if '--traceback' in args:
23 u.setconfig('ui', 'traceback', 'on')
23 u.setconfig('ui', 'traceback', 'on')
24 except util.Abort, inst:
24 except util.Abort, inst:
25 sys.stderr.write(_("abort: %s\n") % inst)
25 sys.stderr.write(_("abort: %s\n") % inst)
26 if inst.hint:
26 if inst.hint:
27 sys.stderr.write(_("(%s)\n") % inst.hint)
27 sys.stderr.write(_("(%s)\n") % inst.hint)
28 return -1
28 return -1
29 except error.ParseError, inst:
29 except error.ParseError, inst:
30 if len(inst.args) > 1:
30 if len(inst.args) > 1:
31 sys.stderr.write(_("hg: parse error at %s: %s\n") %
31 sys.stderr.write(_("hg: parse error at %s: %s\n") %
32 (inst.args[1], inst.args[0]))
32 (inst.args[1], inst.args[0]))
33 else:
33 else:
34 sys.stderr.write(_("hg: parse error: %s\n") % inst.args[0])
34 sys.stderr.write(_("hg: parse error: %s\n") % inst.args[0])
35 return -1
35 return -1
36 return _runcatch(u, args)
36 return _runcatch(u, args)
37
37
38 def _runcatch(ui, args):
38 def _runcatch(ui, args):
39 def catchterm(*args):
39 def catchterm(*args):
40 raise error.SignalInterrupt
40 raise error.SignalInterrupt
41
41
42 try:
42 try:
43 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
43 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
44 num = getattr(signal, name, None)
44 num = getattr(signal, name, None)
45 if num:
45 if num:
46 signal.signal(num, catchterm)
46 signal.signal(num, catchterm)
47 except ValueError:
47 except ValueError:
48 pass # happens if called in a thread
48 pass # happens if called in a thread
49
49
50 try:
50 try:
51 try:
51 try:
52 # enter the debugger before command execution
52 # enter the debugger before command execution
53 if '--debugger' in args:
53 if '--debugger' in args:
54 ui.warn(_("entering debugger - "
54 ui.warn(_("entering debugger - "
55 "type c to continue starting hg or h for help\n"))
55 "type c to continue starting hg or h for help\n"))
56 pdb.set_trace()
56 pdb.set_trace()
57 try:
57 try:
58 return _dispatch(ui, args)
58 return _dispatch(ui, args)
59 finally:
59 finally:
60 ui.flush()
60 ui.flush()
61 except:
61 except:
62 # enter the debugger when we hit an exception
62 # enter the debugger when we hit an exception
63 if '--debugger' in args:
63 if '--debugger' in args:
64 traceback.print_exc()
64 traceback.print_exc()
65 pdb.post_mortem(sys.exc_info()[2])
65 pdb.post_mortem(sys.exc_info()[2])
66 ui.traceback()
66 ui.traceback()
67 raise
67 raise
68
68
69 # Global exception handling, alphabetically
69 # Global exception handling, alphabetically
70 # Mercurial-specific first, followed by built-in and library exceptions
70 # Mercurial-specific first, followed by built-in and library exceptions
71 except error.AmbiguousCommand, inst:
71 except error.AmbiguousCommand, inst:
72 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") %
72 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") %
73 (inst.args[0], " ".join(inst.args[1])))
73 (inst.args[0], " ".join(inst.args[1])))
74 except error.ParseError, inst:
74 except error.ParseError, inst:
75 if len(inst.args) > 1:
75 if len(inst.args) > 1:
76 ui.warn(_("hg: parse error at %s: %s\n") %
76 ui.warn(_("hg: parse error at %s: %s\n") %
77 (inst.args[1], inst.args[0]))
77 (inst.args[1], inst.args[0]))
78 else:
78 else:
79 ui.warn(_("hg: parse error: %s\n") % inst.args[0])
79 ui.warn(_("hg: parse error: %s\n") % inst.args[0])
80 return -1
80 return -1
81 except error.LockHeld, inst:
81 except error.LockHeld, inst:
82 if inst.errno == errno.ETIMEDOUT:
82 if inst.errno == errno.ETIMEDOUT:
83 reason = _('timed out waiting for lock held by %s') % inst.locker
83 reason = _('timed out waiting for lock held by %s') % inst.locker
84 else:
84 else:
85 reason = _('lock held by %s') % inst.locker
85 reason = _('lock held by %s') % inst.locker
86 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
86 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
87 except error.LockUnavailable, inst:
87 except error.LockUnavailable, inst:
88 ui.warn(_("abort: could not lock %s: %s\n") %
88 ui.warn(_("abort: could not lock %s: %s\n") %
89 (inst.desc or inst.filename, inst.strerror))
89 (inst.desc or inst.filename, inst.strerror))
90 except error.CommandError, inst:
90 except error.CommandError, inst:
91 if inst.args[0]:
91 if inst.args[0]:
92 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
92 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
93 commands.help_(ui, inst.args[0], full=False)
93 commands.help_(ui, inst.args[0], full=False)
94 else:
94 else:
95 ui.warn(_("hg: %s\n") % inst.args[1])
95 ui.warn(_("hg: %s\n") % inst.args[1])
96 commands.help_(ui, 'shortlist')
96 commands.help_(ui, 'shortlist')
97 except error.RepoError, inst:
97 except error.RepoError, inst:
98 ui.warn(_("abort: %s!\n") % inst)
98 ui.warn(_("abort: %s!\n") % inst)
99 except error.ResponseError, inst:
99 except error.ResponseError, inst:
100 ui.warn(_("abort: %s") % inst.args[0])
100 ui.warn(_("abort: %s") % inst.args[0])
101 if not isinstance(inst.args[1], basestring):
101 if not isinstance(inst.args[1], basestring):
102 ui.warn(" %r\n" % (inst.args[1],))
102 ui.warn(" %r\n" % (inst.args[1],))
103 elif not inst.args[1]:
103 elif not inst.args[1]:
104 ui.warn(_(" empty string\n"))
104 ui.warn(_(" empty string\n"))
105 else:
105 else:
106 ui.warn("\n%r\n" % util.ellipsis(inst.args[1]))
106 ui.warn("\n%r\n" % util.ellipsis(inst.args[1]))
107 except error.RevlogError, inst:
107 except error.RevlogError, inst:
108 ui.warn(_("abort: %s!\n") % inst)
108 ui.warn(_("abort: %s!\n") % inst)
109 except error.SignalInterrupt:
109 except error.SignalInterrupt:
110 ui.warn(_("killed!\n"))
110 ui.warn(_("killed!\n"))
111 except error.UnknownCommand, inst:
111 except error.UnknownCommand, inst:
112 ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
112 ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
113 try:
113 try:
114 # check if the command is in a disabled extension
114 # check if the command is in a disabled extension
115 # (but don't check for extensions themselves)
115 # (but don't check for extensions themselves)
116 commands.help_(ui, inst.args[0], unknowncmd=True)
116 commands.help_(ui, inst.args[0], unknowncmd=True)
117 except error.UnknownCommand:
117 except error.UnknownCommand:
118 commands.help_(ui, 'shortlist')
118 commands.help_(ui, 'shortlist')
119 except util.Abort, inst:
119 except util.Abort, inst:
120 ui.warn(_("abort: %s\n") % inst)
120 ui.warn(_("abort: %s\n") % inst)
121 if inst.hint:
121 if inst.hint:
122 ui.warn(_("(%s)\n") % inst.hint)
122 ui.warn(_("(%s)\n") % inst.hint)
123 except ImportError, inst:
123 except ImportError, inst:
124 ui.warn(_("abort: %s!\n") % inst)
124 ui.warn(_("abort: %s!\n") % inst)
125 m = str(inst).split()[-1]
125 m = str(inst).split()[-1]
126 if m in "mpatch bdiff".split():
126 if m in "mpatch bdiff".split():
127 ui.warn(_("(did you forget to compile extensions?)\n"))
127 ui.warn(_("(did you forget to compile extensions?)\n"))
128 elif m in "zlib".split():
128 elif m in "zlib".split():
129 ui.warn(_("(is your Python install correct?)\n"))
129 ui.warn(_("(is your Python install correct?)\n"))
130 except IOError, inst:
130 except IOError, inst:
131 if hasattr(inst, "code"):
131 if hasattr(inst, "code"):
132 ui.warn(_("abort: %s\n") % inst)
132 ui.warn(_("abort: %s\n") % inst)
133 elif hasattr(inst, "reason"):
133 elif hasattr(inst, "reason"):
134 try: # usually it is in the form (errno, strerror)
134 try: # usually it is in the form (errno, strerror)
135 reason = inst.reason.args[1]
135 reason = inst.reason.args[1]
136 except: # it might be anything, for example a string
136 except: # it might be anything, for example a string
137 reason = inst.reason
137 reason = inst.reason
138 ui.warn(_("abort: error: %s\n") % reason)
138 ui.warn(_("abort: error: %s\n") % reason)
139 elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE:
139 elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE:
140 if ui.debugflag:
140 if ui.debugflag:
141 ui.warn(_("broken pipe\n"))
141 ui.warn(_("broken pipe\n"))
142 elif getattr(inst, "strerror", None):
142 elif getattr(inst, "strerror", None):
143 if getattr(inst, "filename", None):
143 if getattr(inst, "filename", None):
144 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
144 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
145 else:
145 else:
146 ui.warn(_("abort: %s\n") % inst.strerror)
146 ui.warn(_("abort: %s\n") % inst.strerror)
147 else:
147 else:
148 raise
148 raise
149 except OSError, inst:
149 except OSError, inst:
150 if getattr(inst, "filename", None):
150 if getattr(inst, "filename", None):
151 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
151 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
152 else:
152 else:
153 ui.warn(_("abort: %s\n") % inst.strerror)
153 ui.warn(_("abort: %s\n") % inst.strerror)
154 except KeyboardInterrupt:
154 except KeyboardInterrupt:
155 try:
155 try:
156 ui.warn(_("interrupted!\n"))
156 ui.warn(_("interrupted!\n"))
157 except IOError, inst:
157 except IOError, inst:
158 if inst.errno == errno.EPIPE:
158 if inst.errno == errno.EPIPE:
159 if ui.debugflag:
159 if ui.debugflag:
160 ui.warn(_("\nbroken pipe\n"))
160 ui.warn(_("\nbroken pipe\n"))
161 else:
161 else:
162 raise
162 raise
163 except MemoryError:
163 except MemoryError:
164 ui.warn(_("abort: out of memory\n"))
164 ui.warn(_("abort: out of memory\n"))
165 except SystemExit, inst:
165 except SystemExit, inst:
166 # Commands shouldn't sys.exit directly, but give a return code.
166 # Commands shouldn't sys.exit directly, but give a return code.
167 # Just in case catch this and and pass exit code to caller.
167 # Just in case catch this and and pass exit code to caller.
168 return inst.code
168 return inst.code
169 except socket.error, inst:
169 except socket.error, inst:
170 ui.warn(_("abort: %s\n") % inst.args[-1])
170 ui.warn(_("abort: %s\n") % inst.args[-1])
171 except:
171 except:
172 ui.warn(_("** unknown exception encountered,"
172 ui.warn(_("** unknown exception encountered,"
173 " please report by visiting\n"))
173 " please report by visiting\n"))
174 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n"))
174 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n"))
175 ui.warn(_("** Python %s\n") % sys.version.replace('\n', ''))
175 ui.warn(_("** Python %s\n") % sys.version.replace('\n', ''))
176 ui.warn(_("** Mercurial Distributed SCM (version %s)\n")
176 ui.warn(_("** Mercurial Distributed SCM (version %s)\n")
177 % util.version())
177 % util.version())
178 ui.warn(_("** Extensions loaded: %s\n")
178 ui.warn(_("** Extensions loaded: %s\n")
179 % ", ".join([x[0] for x in extensions.extensions()]))
179 % ", ".join([x[0] for x in extensions.extensions()]))
180 raise
180 raise
181
181
182 return -1
182 return -1
183
183
184 def aliasargs(fn):
184 def aliasargs(fn):
185 if hasattr(fn, 'args'):
185 if hasattr(fn, 'args'):
186 return fn.args
186 return fn.args
187 return []
187 return []
188
188
189 class cmdalias(object):
189 class cmdalias(object):
190 def __init__(self, name, definition, cmdtable):
190 def __init__(self, name, definition, cmdtable):
191 self.name = self.cmd = name
191 self.name = self.cmd = name
192 self.cmdname = ''
192 self.cmdname = ''
193 self.definition = definition
193 self.definition = definition
194 self.args = []
194 self.args = []
195 self.opts = []
195 self.opts = []
196 self.help = ''
196 self.help = ''
197 self.norepo = True
197 self.norepo = True
198 self.badalias = False
198 self.badalias = False
199
199
200 try:
200 try:
201 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
201 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
202 for alias, e in cmdtable.iteritems():
202 for alias, e in cmdtable.iteritems():
203 if e is entry:
203 if e is entry:
204 self.cmd = alias
204 self.cmd = alias
205 break
205 break
206 self.shadows = True
206 self.shadows = True
207 except error.UnknownCommand:
207 except error.UnknownCommand:
208 self.shadows = False
208 self.shadows = False
209
209
210 if not self.definition:
210 if not self.definition:
211 def fn(ui, *args):
211 def fn(ui, *args):
212 ui.warn(_("no definition for alias '%s'\n") % self.name)
212 ui.warn(_("no definition for alias '%s'\n") % self.name)
213 return 1
213 return 1
214 self.fn = fn
214 self.fn = fn
215 self.badalias = True
215 self.badalias = True
216
216
217 return
217 return
218
218
219 if self.definition.startswith('!'):
219 if self.definition.startswith('!'):
220 self.shell = True
220 self.shell = True
221 def fn(ui, *args):
221 def fn(ui, *args):
222 env = {'HG_ARGS': ' '.join((self.name,) + args)}
222 env = {'HG_ARGS': ' '.join((self.name,) + args)}
223 def _checkvar(m):
223 def _checkvar(m):
224 if m.groups()[0] == '$':
224 if m.groups()[0] == '$':
225 return m.group()
225 return m.group()
226 elif int(m.groups()[0]) <= len(args):
226 elif int(m.groups()[0]) <= len(args):
227 return m.group()
227 return m.group()
228 else:
228 else:
229 ui.debug(_("No argument found for substitution "
229 ui.debug(_("No argument found for substitution "
230 "of %i variable in alias '%s' definition.")
230 "of %i variable in alias '%s' definition.")
231 % (int(m.groups()[0]), self.name))
231 % (int(m.groups()[0]), self.name))
232 return ''
232 return ''
233 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
233 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
234 replace = dict((str(i + 1), arg) for i, arg in enumerate(args))
234 replace = dict((str(i + 1), arg) for i, arg in enumerate(args))
235 replace['0'] = self.name
235 replace['0'] = self.name
236 replace['@'] = ' '.join(args)
236 replace['@'] = ' '.join(args)
237 cmd = util.interpolate(r'\$', replace, cmd, escape_prefix=True)
237 cmd = util.interpolate(r'\$', replace, cmd, escape_prefix=True)
238 return util.system(cmd, environ=env)
238 return util.system(cmd, environ=env)
239 self.fn = fn
239 self.fn = fn
240 return
240 return
241
241
242 args = shlex.split(self.definition)
242 args = shlex.split(self.definition)
243 self.cmdname = cmd = args.pop(0)
243 self.cmdname = cmd = args.pop(0)
244 args = map(util.expandpath, args)
244 args = map(util.expandpath, args)
245
245
246 for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
246 for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
247 if _earlygetopt([invalidarg], args):
247 if _earlygetopt([invalidarg], args):
248 def fn(ui, *args):
248 def fn(ui, *args):
249 ui.warn(_("error in definition for alias '%s': %s may only "
249 ui.warn(_("error in definition for alias '%s': %s may only "
250 "be given on the command line\n")
250 "be given on the command line\n")
251 % (self.name, invalidarg))
251 % (self.name, invalidarg))
252 return 1
252 return 1
253
253
254 self.fn = fn
254 self.fn = fn
255 self.badalias = True
255 self.badalias = True
256 return
256 return
257
257
258 try:
258 try:
259 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
259 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
260 if len(tableentry) > 2:
260 if len(tableentry) > 2:
261 self.fn, self.opts, self.help = tableentry
261 self.fn, self.opts, self.help = tableentry
262 else:
262 else:
263 self.fn, self.opts = tableentry
263 self.fn, self.opts = tableentry
264
264
265 self.args = aliasargs(self.fn) + args
265 self.args = aliasargs(self.fn) + args
266 if cmd not in commands.norepo.split(' '):
266 if cmd not in commands.norepo.split(' '):
267 self.norepo = False
267 self.norepo = False
268 if self.help.startswith("hg " + cmd):
268 if self.help.startswith("hg " + cmd):
269 # drop prefix in old-style help lines so hg shows the alias
269 # drop prefix in old-style help lines so hg shows the alias
270 self.help = self.help[4 + len(cmd):]
270 self.help = self.help[4 + len(cmd):]
271 self.__doc__ = self.fn.__doc__
271 self.__doc__ = self.fn.__doc__
272
272
273 except error.UnknownCommand:
273 except error.UnknownCommand:
274 def fn(ui, *args):
274 def fn(ui, *args):
275 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
275 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
276 % (self.name, cmd))
276 % (self.name, cmd))
277 try:
277 try:
278 # check if the command is in a disabled extension
278 # check if the command is in a disabled extension
279 commands.help_(ui, cmd, unknowncmd=True)
279 commands.help_(ui, cmd, unknowncmd=True)
280 except error.UnknownCommand:
280 except error.UnknownCommand:
281 pass
281 pass
282 return 1
282 return 1
283 self.fn = fn
283 self.fn = fn
284 self.badalias = True
284 self.badalias = True
285 except error.AmbiguousCommand:
285 except error.AmbiguousCommand:
286 def fn(ui, *args):
286 def fn(ui, *args):
287 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
287 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
288 % (self.name, cmd))
288 % (self.name, cmd))
289 return 1
289 return 1
290 self.fn = fn
290 self.fn = fn
291 self.badalias = True
291 self.badalias = True
292
292
293 def __call__(self, ui, *args, **opts):
293 def __call__(self, ui, *args, **opts):
294 if self.shadows:
294 if self.shadows:
295 ui.debug("alias '%s' shadows command '%s'\n" %
295 ui.debug("alias '%s' shadows command '%s'\n" %
296 (self.name, self.cmdname))
296 (self.name, self.cmdname))
297
297
298 if hasattr(self, 'shell'):
298 if hasattr(self, 'shell'):
299 return self.fn(ui, *args, **opts)
299 return self.fn(ui, *args, **opts)
300 else:
300 else:
301 try:
301 try:
302 util.checksignature(self.fn)(ui, *args, **opts)
302 util.checksignature(self.fn)(ui, *args, **opts)
303 except error.SignatureError:
303 except error.SignatureError:
304 args = ' '.join([self.cmdname] + self.args)
304 args = ' '.join([self.cmdname] + self.args)
305 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
305 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
306 raise
306 raise
307
307
308 def addaliases(ui, cmdtable):
308 def addaliases(ui, cmdtable):
309 # aliases are processed after extensions have been loaded, so they
309 # aliases are processed after extensions have been loaded, so they
310 # may use extension commands. Aliases can also use other alias definitions,
310 # may use extension commands. Aliases can also use other alias definitions,
311 # but only if they have been defined prior to the current definition.
311 # but only if they have been defined prior to the current definition.
312 for alias, definition in ui.configitems('alias'):
312 for alias, definition in ui.configitems('alias'):
313 aliasdef = cmdalias(alias, definition, cmdtable)
313 aliasdef = cmdalias(alias, definition, cmdtable)
314 cmdtable[aliasdef.cmd] = (aliasdef, aliasdef.opts, aliasdef.help)
314 cmdtable[aliasdef.cmd] = (aliasdef, aliasdef.opts, aliasdef.help)
315 if aliasdef.norepo:
315 if aliasdef.norepo:
316 commands.norepo += ' %s' % alias
316 commands.norepo += ' %s' % alias
317
317
318 def _parse(ui, args):
318 def _parse(ui, args):
319 options = {}
319 options = {}
320 cmdoptions = {}
320 cmdoptions = {}
321
321
322 try:
322 try:
323 args = fancyopts.fancyopts(args, commands.globalopts, options)
323 args = fancyopts.fancyopts(args, commands.globalopts, options)
324 except fancyopts.getopt.GetoptError, inst:
324 except fancyopts.getopt.GetoptError, inst:
325 raise error.CommandError(None, inst)
325 raise error.CommandError(None, inst)
326
326
327 if args:
327 if args:
328 cmd, args = args[0], args[1:]
328 cmd, args = args[0], args[1:]
329 aliases, entry = cmdutil.findcmd(cmd, commands.table,
329 aliases, entry = cmdutil.findcmd(cmd, commands.table,
330 ui.config("ui", "strict"))
330 ui.config("ui", "strict"))
331 cmd = aliases[0]
331 cmd = aliases[0]
332 args = aliasargs(entry[0]) + args
332 args = aliasargs(entry[0]) + args
333 defaults = ui.config("defaults", cmd)
333 defaults = ui.config("defaults", cmd)
334 if defaults:
334 if defaults:
335 args = map(util.expandpath, shlex.split(defaults)) + args
335 args = map(util.expandpath, shlex.split(defaults)) + args
336 c = list(entry[1])
336 c = list(entry[1])
337 else:
337 else:
338 cmd = None
338 cmd = None
339 c = []
339 c = []
340
340
341 # combine global options into local
341 # combine global options into local
342 for o in commands.globalopts:
342 for o in commands.globalopts:
343 c.append((o[0], o[1], options[o[1]], o[3]))
343 c.append((o[0], o[1], options[o[1]], o[3]))
344
344
345 try:
345 try:
346 args = fancyopts.fancyopts(args, c, cmdoptions, True)
346 args = fancyopts.fancyopts(args, c, cmdoptions, True)
347 except fancyopts.getopt.GetoptError, inst:
347 except fancyopts.getopt.GetoptError, inst:
348 raise error.CommandError(cmd, inst)
348 raise error.CommandError(cmd, inst)
349
349
350 # separate global options back out
350 # separate global options back out
351 for o in commands.globalopts:
351 for o in commands.globalopts:
352 n = o[1]
352 n = o[1]
353 options[n] = cmdoptions[n]
353 options[n] = cmdoptions[n]
354 del cmdoptions[n]
354 del cmdoptions[n]
355
355
356 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
356 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
357
357
358 def _parseconfig(ui, config):
358 def _parseconfig(ui, config):
359 """parse the --config options from the command line"""
359 """parse the --config options from the command line"""
360 for cfg in config:
360 for cfg in config:
361 try:
361 try:
362 name, value = cfg.split('=', 1)
362 name, value = cfg.split('=', 1)
363 section, name = name.split('.', 1)
363 section, name = name.split('.', 1)
364 if not section or not name:
364 if not section or not name:
365 raise IndexError
365 raise IndexError
366 ui.setconfig(section, name, value)
366 ui.setconfig(section, name, value)
367 except (IndexError, ValueError):
367 except (IndexError, ValueError):
368 raise util.Abort(_('malformed --config option: %r '
368 raise util.Abort(_('malformed --config option: %r '
369 '(use --config section.name=value)') % cfg)
369 '(use --config section.name=value)') % cfg)
370
370
371 def _earlygetopt(aliases, args):
371 def _earlygetopt(aliases, args):
372 """Return list of values for an option (or aliases).
372 """Return list of values for an option (or aliases).
373
373
374 The values are listed in the order they appear in args.
374 The values are listed in the order they appear in args.
375 The options and values are removed from args.
375 The options and values are removed from args.
376 """
376 """
377 try:
377 try:
378 argcount = args.index("--")
378 argcount = args.index("--")
379 except ValueError:
379 except ValueError:
380 argcount = len(args)
380 argcount = len(args)
381 shortopts = [opt for opt in aliases if len(opt) == 2]
381 shortopts = [opt for opt in aliases if len(opt) == 2]
382 values = []
382 values = []
383 pos = 0
383 pos = 0
384 while pos < argcount:
384 while pos < argcount:
385 if args[pos] in aliases:
385 if args[pos] in aliases:
386 if pos + 1 >= argcount:
386 if pos + 1 >= argcount:
387 # ignore and let getopt report an error if there is no value
387 # ignore and let getopt report an error if there is no value
388 break
388 break
389 del args[pos]
389 del args[pos]
390 values.append(args.pop(pos))
390 values.append(args.pop(pos))
391 argcount -= 2
391 argcount -= 2
392 elif args[pos][:2] in shortopts:
392 elif args[pos][:2] in shortopts:
393 # short option can have no following space, e.g. hg log -Rfoo
393 # short option can have no following space, e.g. hg log -Rfoo
394 values.append(args.pop(pos)[2:])
394 values.append(args.pop(pos)[2:])
395 argcount -= 1
395 argcount -= 1
396 else:
396 else:
397 pos += 1
397 pos += 1
398 return values
398 return values
399
399
400 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
400 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
401 # run pre-hook, and abort if it fails
401 # run pre-hook, and abort if it fails
402 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs),
402 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs),
403 pats=cmdpats, opts=cmdoptions)
403 pats=cmdpats, opts=cmdoptions)
404 if ret:
404 if ret:
405 return ret
405 return ret
406 ret = _runcommand(ui, options, cmd, d)
406 ret = _runcommand(ui, options, cmd, d)
407 # run post-hook, passing command result
407 # run post-hook, passing command result
408 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
408 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
409 result=ret, pats=cmdpats, opts=cmdoptions)
409 result=ret, pats=cmdpats, opts=cmdoptions)
410 return ret
410 return ret
411
411
412 def _getlocal(ui, rpath):
412 def _getlocal(ui, rpath):
413 """Return (path, local ui object) for the given target path.
413 """Return (path, local ui object) for the given target path.
414
414
415 Takes paths in [cwd]/.hg/hgrc into account."
415 Takes paths in [cwd]/.hg/hgrc into account."
416 """
416 """
417 try:
417 try:
418 wd = os.getcwd()
418 wd = os.getcwd()
419 except OSError, e:
419 except OSError, e:
420 raise util.Abort(_("error getting current working directory: %s") %
420 raise util.Abort(_("error getting current working directory: %s") %
421 e.strerror)
421 e.strerror)
422 path = cmdutil.findrepo(wd) or ""
422 path = cmdutil.findrepo(wd) or ""
423 if not path:
423 if not path:
424 lui = ui
424 lui = ui
425 else:
425 else:
426 lui = ui.copy()
426 lui = ui.copy()
427 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
427 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
428
428
429 if rpath:
429 if rpath:
430 path = lui.expandpath(rpath[-1])
430 path = lui.expandpath(rpath[-1])
431 lui = ui.copy()
431 lui = ui.copy()
432 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
432 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
433
433
434 return path, lui
434 return path, lui
435
435
436 def _checkshellalias(ui, args):
436 def _checkshellalias(ui, args):
437 cwd = os.getcwd()
437 cwd = os.getcwd()
438 norepo = commands.norepo
438 norepo = commands.norepo
439 options = {}
439 options = {}
440
440
441 try:
441 try:
442 args = fancyopts.fancyopts(args, commands.globalopts, options)
442 args = fancyopts.fancyopts(args, commands.globalopts, options)
443 except fancyopts.getopt.GetoptError:
443 except fancyopts.getopt.GetoptError:
444 return
444 return
445
445
446 if not args:
446 if not args:
447 return
447 return
448
448
449 _parseconfig(ui, options['config'])
449 _parseconfig(ui, options['config'])
450 if options['cwd']:
450 if options['cwd']:
451 os.chdir(options['cwd'])
451 os.chdir(options['cwd'])
452
452
453 path, lui = _getlocal(ui, [options['repository']])
453 path, lui = _getlocal(ui, [options['repository']])
454
454
455 cmdtable = commands.table.copy()
455 cmdtable = commands.table.copy()
456 addaliases(lui, cmdtable)
456 addaliases(lui, cmdtable)
457
457
458 cmd = args[0]
458 cmd = args[0]
459 try:
459 try:
460 aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict"))
460 aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict"))
461 except (error.AmbiguousCommand, error.UnknownCommand):
461 except (error.AmbiguousCommand, error.UnknownCommand):
462 commands.norepo = norepo
462 commands.norepo = norepo
463 os.chdir(cwd)
463 os.chdir(cwd)
464 return
464 return
465
465
466 cmd = aliases[0]
466 cmd = aliases[0]
467 fn = entry[0]
467 fn = entry[0]
468
468
469 if cmd and hasattr(fn, 'shell'):
469 if cmd and hasattr(fn, 'shell'):
470 d = lambda: fn(ui, *args[1:])
470 d = lambda: fn(ui, *args[1:])
471 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
471 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
472
472
473 commands.norepo = norepo
473 commands.norepo = norepo
474 os.chdir(cwd)
474 os.chdir(cwd)
475
475
476 _loaded = set()
476 _loaded = set()
477 def _dispatch(ui, args):
477 def _dispatch(ui, args):
478 shellaliasfn = _checkshellalias(ui, args)
478 shellaliasfn = _checkshellalias(ui, args)
479 if shellaliasfn:
479 if shellaliasfn:
480 return shellaliasfn()
480 return shellaliasfn()
481
481
482 # read --config before doing anything else
482 # read --config before doing anything else
483 # (e.g. to change trust settings for reading .hg/hgrc)
483 # (e.g. to change trust settings for reading .hg/hgrc)
484 _parseconfig(ui, _earlygetopt(['--config'], args))
484 _parseconfig(ui, _earlygetopt(['--config'], args))
485
485
486 # check for cwd
486 # check for cwd
487 cwd = _earlygetopt(['--cwd'], args)
487 cwd = _earlygetopt(['--cwd'], args)
488 if cwd:
488 if cwd:
489 os.chdir(cwd[-1])
489 os.chdir(cwd[-1])
490
490
491 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
491 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
492 path, lui = _getlocal(ui, rpath)
492 path, lui = _getlocal(ui, rpath)
493
493
494 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
494 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
495 # reposetup. Programs like TortoiseHg will call _dispatch several
495 # reposetup. Programs like TortoiseHg will call _dispatch several
496 # times so we keep track of configured extensions in _loaded.
496 # times so we keep track of configured extensions in _loaded.
497 extensions.loadall(lui)
497 extensions.loadall(lui)
498 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
498 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
499 # Propagate any changes to lui.__class__ by extensions
499 # Propagate any changes to lui.__class__ by extensions
500 ui.__class__ = lui.__class__
500 ui.__class__ = lui.__class__
501
501
502 # (uisetup and extsetup are handled in extensions.loadall)
502 # (uisetup and extsetup are handled in extensions.loadall)
503
503
504 for name, module in exts:
504 for name, module in exts:
505 cmdtable = getattr(module, 'cmdtable', {})
505 cmdtable = getattr(module, 'cmdtable', {})
506 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
506 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
507 if overrides:
507 if overrides:
508 ui.warn(_("extension '%s' overrides commands: %s\n")
508 ui.warn(_("extension '%s' overrides commands: %s\n")
509 % (name, " ".join(overrides)))
509 % (name, " ".join(overrides)))
510 commands.table.update(cmdtable)
510 commands.table.update(cmdtable)
511 _loaded.add(name)
511 _loaded.add(name)
512
512
513 # (reposetup is handled in hg.repository)
513 # (reposetup is handled in hg.repository)
514
514
515 addaliases(lui, commands.table)
515 addaliases(lui, commands.table)
516
516
517 # check for fallback encoding
517 # check for fallback encoding
518 fallback = lui.config('ui', 'fallbackencoding')
518 fallback = lui.config('ui', 'fallbackencoding')
519 if fallback:
519 if fallback:
520 encoding.fallbackencoding = fallback
520 encoding.fallbackencoding = fallback
521
521
522 fullargs = args
522 fullargs = args
523 cmd, func, args, options, cmdoptions = _parse(lui, args)
523 cmd, func, args, options, cmdoptions = _parse(lui, args)
524
524
525 if options["config"]:
525 if options["config"]:
526 raise util.Abort(_("option --config may not be abbreviated!"))
526 raise util.Abort(_("option --config may not be abbreviated!"))
527 if options["cwd"]:
527 if options["cwd"]:
528 raise util.Abort(_("option --cwd may not be abbreviated!"))
528 raise util.Abort(_("option --cwd may not be abbreviated!"))
529 if options["repository"]:
529 if options["repository"]:
530 raise util.Abort(_(
530 raise util.Abort(_(
531 "Option -R has to be separated from other options (e.g. not -qR) "
531 "Option -R has to be separated from other options (e.g. not -qR) "
532 "and --repository may only be abbreviated as --repo!"))
532 "and --repository may only be abbreviated as --repo!"))
533
533
534 if options["encoding"]:
534 if options["encoding"]:
535 encoding.encoding = options["encoding"]
535 encoding.encoding = options["encoding"]
536 if options["encodingmode"]:
536 if options["encodingmode"]:
537 encoding.encodingmode = options["encodingmode"]
537 encoding.encodingmode = options["encodingmode"]
538 if options["time"]:
538 if options["time"]:
539 def get_times():
539 def get_times():
540 t = os.times()
540 t = os.times()
541 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
541 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
542 t = (t[0], t[1], t[2], t[3], time.clock())
542 t = (t[0], t[1], t[2], t[3], time.clock())
543 return t
543 return t
544 s = get_times()
544 s = get_times()
545 def print_time():
545 def print_time():
546 t = get_times()
546 t = get_times()
547 ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
547 ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
548 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
548 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
549 atexit.register(print_time)
549 atexit.register(print_time)
550
550
551 if options['verbose'] or options['debug'] or options['quiet']:
551 if options['verbose'] or options['debug'] or options['quiet']:
552 ui.setconfig('ui', 'verbose', str(bool(options['verbose'])))
552 ui.setconfig('ui', 'verbose', str(bool(options['verbose'])))
553 ui.setconfig('ui', 'debug', str(bool(options['debug'])))
553 ui.setconfig('ui', 'debug', str(bool(options['debug'])))
554 ui.setconfig('ui', 'quiet', str(bool(options['quiet'])))
554 ui.setconfig('ui', 'quiet', str(bool(options['quiet'])))
555 if options['traceback']:
555 if options['traceback']:
556 ui.setconfig('ui', 'traceback', 'on')
556 ui.setconfig('ui', 'traceback', 'on')
557 if options['noninteractive']:
557 if options['noninteractive']:
558 ui.setconfig('ui', 'interactive', 'off')
558 ui.setconfig('ui', 'interactive', 'off')
559
559
560 if cmdoptions.get('insecure', False):
560 if cmdoptions.get('insecure', False):
561 ui.setconfig('web', 'cacerts', '')
561 ui.setconfig('web', 'cacerts', '')
562
562
563 if options['help']:
563 if options['help']:
564 return commands.help_(ui, cmd, options['version'])
564 return commands.help_(ui, cmd, options['version'])
565 elif options['version']:
565 elif options['version']:
566 return commands.version_(ui)
566 return commands.version_(ui)
567 elif not cmd:
567 elif not cmd:
568 return commands.help_(ui, 'shortlist')
568 return commands.help_(ui, 'shortlist')
569
569
570 repo = None
570 repo = None
571 cmdpats = args[:]
571 cmdpats = args[:]
572 if cmd not in commands.norepo.split():
572 if cmd not in commands.norepo.split():
573 try:
573 try:
574 repo = hg.repository(ui, path=path)
574 repo = hg.repository(ui, path=path)
575 ui = repo.ui
575 ui = repo.ui
576 if not repo.local():
576 if not repo.local():
577 raise util.Abort(_("repository '%s' is not local") % path)
577 raise util.Abort(_("repository '%s' is not local") % path)
578 ui.setconfig("bundle", "mainreporoot", repo.root)
578 ui.setconfig("bundle", "mainreporoot", repo.root)
579 except error.RequirementError:
579 except error.RequirementError:
580 raise
580 raise
581 except error.RepoError:
581 except error.RepoError:
582 if cmd not in commands.optionalrepo.split():
582 if cmd not in commands.optionalrepo.split():
583 if args and not path: # try to infer -R from command args
583 if args and not path: # try to infer -R from command args
584 repos = map(cmdutil.findrepo, args)
584 repos = map(cmdutil.findrepo, args)
585 guess = repos[0]
585 guess = repos[0]
586 if guess and repos.count(guess) == len(repos):
586 if guess and repos.count(guess) == len(repos):
587 return _dispatch(ui, ['--repository', guess] + fullargs)
587 return _dispatch(ui, ['--repository', guess] + fullargs)
588 if not path:
588 if not path:
589 raise error.RepoError(_("There is no Mercurial repository"
589 raise error.RepoError(_("no repository found in %r"
590 " here (.hg not found)"))
590 " (.hg not found)") % os.getcwd())
591 raise
591 raise
592 args.insert(0, repo)
592 args.insert(0, repo)
593 elif rpath:
593 elif rpath:
594 ui.warn(_("warning: --repository ignored\n"))
594 ui.warn(_("warning: --repository ignored\n"))
595
595
596 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
596 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
597 ui.log("command", msg + "\n")
597 ui.log("command", msg + "\n")
598 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
598 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
599 try:
599 try:
600 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
600 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
601 cmdpats, cmdoptions)
601 cmdpats, cmdoptions)
602 finally:
602 finally:
603 if repo:
603 if repo:
604 repo.close()
604 repo.close()
605
605
606 def _runcommand(ui, options, cmd, cmdfunc):
606 def _runcommand(ui, options, cmd, cmdfunc):
607 def checkargs():
607 def checkargs():
608 try:
608 try:
609 return cmdfunc()
609 return cmdfunc()
610 except error.SignatureError:
610 except error.SignatureError:
611 raise error.CommandError(cmd, _("invalid arguments"))
611 raise error.CommandError(cmd, _("invalid arguments"))
612
612
613 if options['profile']:
613 if options['profile']:
614 format = ui.config('profiling', 'format', default='text')
614 format = ui.config('profiling', 'format', default='text')
615
615
616 if not format in ['text', 'kcachegrind']:
616 if not format in ['text', 'kcachegrind']:
617 ui.warn(_("unrecognized profiling format '%s'"
617 ui.warn(_("unrecognized profiling format '%s'"
618 " - Ignored\n") % format)
618 " - Ignored\n") % format)
619 format = 'text'
619 format = 'text'
620
620
621 output = ui.config('profiling', 'output')
621 output = ui.config('profiling', 'output')
622
622
623 if output:
623 if output:
624 path = ui.expandpath(output)
624 path = ui.expandpath(output)
625 ostream = open(path, 'wb')
625 ostream = open(path, 'wb')
626 else:
626 else:
627 ostream = sys.stderr
627 ostream = sys.stderr
628
628
629 try:
629 try:
630 from mercurial import lsprof
630 from mercurial import lsprof
631 except ImportError:
631 except ImportError:
632 raise util.Abort(_(
632 raise util.Abort(_(
633 'lsprof not available - install from '
633 'lsprof not available - install from '
634 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
634 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
635 p = lsprof.Profiler()
635 p = lsprof.Profiler()
636 p.enable(subcalls=True)
636 p.enable(subcalls=True)
637 try:
637 try:
638 return checkargs()
638 return checkargs()
639 finally:
639 finally:
640 p.disable()
640 p.disable()
641
641
642 if format == 'kcachegrind':
642 if format == 'kcachegrind':
643 import lsprofcalltree
643 import lsprofcalltree
644 calltree = lsprofcalltree.KCacheGrind(p)
644 calltree = lsprofcalltree.KCacheGrind(p)
645 calltree.output(ostream)
645 calltree.output(ostream)
646 else:
646 else:
647 # format == 'text'
647 # format == 'text'
648 stats = lsprof.Stats(p.getstats())
648 stats = lsprof.Stats(p.getstats())
649 stats.sort()
649 stats.sort()
650 stats.pprint(top=10, file=ostream, climit=5)
650 stats.pprint(top=10, file=ostream, climit=5)
651
651
652 if output:
652 if output:
653 ostream.close()
653 ostream.close()
654 else:
654 else:
655 return checkargs()
655 return checkargs()
@@ -1,52 +1,52 b''
1 test command parsing and dispatch
1 test command parsing and dispatch
2
2
3 $ "$TESTDIR/hghave" no-outer-repo || exit 80
3 $ "$TESTDIR/hghave" no-outer-repo || exit 80
4
4
5 $ dir=`pwd`
5 $ dir=`pwd`
6
6
7 $ hg init a
7 $ hg init a
8 $ cd a
8 $ cd a
9 $ echo a > a
9 $ echo a > a
10 $ hg ci -Ama
10 $ hg ci -Ama
11 adding a
11 adding a
12
12
13 Missing arg:
13 Missing arg:
14
14
15 $ hg cat
15 $ hg cat
16 hg cat: invalid arguments
16 hg cat: invalid arguments
17 hg cat [OPTION]... FILE...
17 hg cat [OPTION]... FILE...
18
18
19 output the current or given revision of files
19 output the current or given revision of files
20
20
21 options:
21 options:
22
22
23 -o --output FORMAT print output to file with formatted name
23 -o --output FORMAT print output to file with formatted name
24 -r --rev REV print the given revision
24 -r --rev REV print the given revision
25 --decode apply any matching decode filter
25 --decode apply any matching decode filter
26 -I --include PATTERN [+] include names matching the given patterns
26 -I --include PATTERN [+] include names matching the given patterns
27 -X --exclude PATTERN [+] exclude names matching the given patterns
27 -X --exclude PATTERN [+] exclude names matching the given patterns
28
28
29 [+] marked option can be specified multiple times
29 [+] marked option can be specified multiple times
30
30
31 use "hg help cat" to show the full help text
31 use "hg help cat" to show the full help text
32 [255]
32 [255]
33
33
34 [defaults]
34 [defaults]
35
35
36 $ hg cat a
36 $ hg cat a
37 a
37 a
38 $ cat >> $HGRCPATH <<EOF
38 $ cat >> $HGRCPATH <<EOF
39 > [defaults]
39 > [defaults]
40 > cat = -r null
40 > cat = -r null
41 > EOF
41 > EOF
42 $ hg cat a
42 $ hg cat a
43 a: no such file in rev 000000000000
43 a: no such file in rev 000000000000
44 [1]
44 [1]
45
45
46 No repo:
46 No repo:
47
47
48 $ cd $dir
48 $ cd $dir
49 $ hg cat
49 $ hg cat
50 abort: There is no Mercurial repository here (.hg not found)!
50 abort: no repository found in '$TESTTMP' (.hg not found)!
51 [255]
51 [255]
52
52
@@ -1,434 +1,434 b''
1 $ "$TESTDIR/hghave" no-outer-repo || exit 80
1 $ "$TESTDIR/hghave" no-outer-repo || exit 80
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 adding a
7 adding a
8
8
9 $ cd ..
9 $ cd ..
10
10
11 $ hg init b
11 $ hg init b
12 $ cd b
12 $ cd b
13 $ echo b > b
13 $ echo b > b
14 $ hg ci -A -d'1 0' -m b
14 $ hg ci -A -d'1 0' -m b
15 adding b
15 adding b
16
16
17 $ cd ..
17 $ cd ..
18
18
19 $ hg clone a c
19 $ hg clone a c
20 updating to branch default
20 updating to branch default
21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 $ cd c
22 $ cd c
23 $ cat >> .hg/hgrc <<EOF
23 $ cat >> .hg/hgrc <<EOF
24 > [paths]
24 > [paths]
25 > relative = ../a
25 > relative = ../a
26 > EOF
26 > EOF
27 $ hg pull -f ../b
27 $ hg pull -f ../b
28 pulling from ../b
28 pulling from ../b
29 searching for changes
29 searching for changes
30 warning: repository is unrelated
30 warning: repository is unrelated
31 requesting all changes
31 requesting all changes
32 adding changesets
32 adding changesets
33 adding manifests
33 adding manifests
34 adding file changes
34 adding file changes
35 added 1 changesets with 1 changes to 1 files (+1 heads)
35 added 1 changesets with 1 changes to 1 files (+1 heads)
36 (run 'hg heads' to see heads, 'hg merge' to merge)
36 (run 'hg heads' to see heads, 'hg merge' to merge)
37 $ hg merge
37 $ hg merge
38 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 (branch merge, don't forget to commit)
39 (branch merge, don't forget to commit)
40
40
41 $ cd ..
41 $ cd ..
42
42
43 Testing -R/--repository:
43 Testing -R/--repository:
44
44
45 $ hg -R a tip
45 $ hg -R a tip
46 changeset: 0:8580ff50825a
46 changeset: 0:8580ff50825a
47 tag: tip
47 tag: tip
48 user: test
48 user: test
49 date: Thu Jan 01 00:00:01 1970 +0000
49 date: Thu Jan 01 00:00:01 1970 +0000
50 summary: a
50 summary: a
51
51
52 $ hg --repository b tip
52 $ hg --repository b tip
53 changeset: 0:b6c483daf290
53 changeset: 0:b6c483daf290
54 tag: tip
54 tag: tip
55 user: test
55 user: test
56 date: Thu Jan 01 00:00:01 1970 +0000
56 date: Thu Jan 01 00:00:01 1970 +0000
57 summary: b
57 summary: b
58
58
59
59
60 -R with a URL:
60 -R with a URL:
61
61
62 $ hg -R file:a identify
62 $ hg -R file:a identify
63 8580ff50825a tip
63 8580ff50825a tip
64 $ hg -R file://localhost/`pwd`/a/ identify
64 $ hg -R file://localhost/`pwd`/a/ identify
65 8580ff50825a tip
65 8580ff50825a tip
66
66
67 -R with path aliases:
67 -R with path aliases:
68
68
69 $ cd c
69 $ cd c
70 $ hg -R default identify
70 $ hg -R default identify
71 8580ff50825a tip
71 8580ff50825a tip
72 $ hg -R relative identify
72 $ hg -R relative identify
73 8580ff50825a tip
73 8580ff50825a tip
74 $ echo '[paths]' >> $HGRCPATH
74 $ echo '[paths]' >> $HGRCPATH
75 $ echo 'relativetohome = a' >> $HGRCPATH
75 $ echo 'relativetohome = a' >> $HGRCPATH
76 $ HOME=`pwd`/../ hg -R relativetohome identify
76 $ HOME=`pwd`/../ hg -R relativetohome identify
77 8580ff50825a tip
77 8580ff50825a tip
78 $ cd ..
78 $ cd ..
79
79
80 Implicit -R:
80 Implicit -R:
81
81
82 $ hg ann a/a
82 $ hg ann a/a
83 0: a
83 0: a
84 $ hg ann a/a a/a
84 $ hg ann a/a a/a
85 0: a
85 0: a
86 $ hg ann a/a b/b
86 $ hg ann a/a b/b
87 abort: There is no Mercurial repository here (.hg not found)!
87 abort: no repository found in '$TESTTMP' (.hg not found)!
88 [255]
88 [255]
89 $ hg -R b ann a/a
89 $ hg -R b ann a/a
90 abort: a/a not under root
90 abort: a/a not under root
91 [255]
91 [255]
92 $ hg log
92 $ hg log
93 abort: There is no Mercurial repository here (.hg not found)!
93 abort: no repository found in '$TESTTMP' (.hg not found)!
94 [255]
94 [255]
95
95
96 Abbreviation of long option:
96 Abbreviation of long option:
97
97
98 $ hg --repo c tip
98 $ hg --repo c tip
99 changeset: 1:b6c483daf290
99 changeset: 1:b6c483daf290
100 tag: tip
100 tag: tip
101 parent: -1:000000000000
101 parent: -1:000000000000
102 user: test
102 user: test
103 date: Thu Jan 01 00:00:01 1970 +0000
103 date: Thu Jan 01 00:00:01 1970 +0000
104 summary: b
104 summary: b
105
105
106
106
107 earlygetopt with duplicate options (36d23de02da1):
107 earlygetopt with duplicate options (36d23de02da1):
108
108
109 $ hg --cwd a --cwd b --cwd c tip
109 $ hg --cwd a --cwd b --cwd c tip
110 changeset: 1:b6c483daf290
110 changeset: 1:b6c483daf290
111 tag: tip
111 tag: tip
112 parent: -1:000000000000
112 parent: -1:000000000000
113 user: test
113 user: test
114 date: Thu Jan 01 00:00:01 1970 +0000
114 date: Thu Jan 01 00:00:01 1970 +0000
115 summary: b
115 summary: b
116
116
117 $ hg --repo c --repository b -R a tip
117 $ hg --repo c --repository b -R a tip
118 changeset: 0:8580ff50825a
118 changeset: 0:8580ff50825a
119 tag: tip
119 tag: tip
120 user: test
120 user: test
121 date: Thu Jan 01 00:00:01 1970 +0000
121 date: Thu Jan 01 00:00:01 1970 +0000
122 summary: a
122 summary: a
123
123
124
124
125 earlygetopt short option without following space:
125 earlygetopt short option without following space:
126
126
127 $ hg -q -Rb tip
127 $ hg -q -Rb tip
128 0:b6c483daf290
128 0:b6c483daf290
129
129
130 earlygetopt with illegal abbreviations:
130 earlygetopt with illegal abbreviations:
131
131
132 $ hg --confi "foo.bar=baz"
132 $ hg --confi "foo.bar=baz"
133 abort: option --config may not be abbreviated!
133 abort: option --config may not be abbreviated!
134 [255]
134 [255]
135 $ hg --cw a tip
135 $ hg --cw a tip
136 abort: option --cwd may not be abbreviated!
136 abort: option --cwd may not be abbreviated!
137 [255]
137 [255]
138 $ hg --rep a tip
138 $ hg --rep a tip
139 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
139 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
140 [255]
140 [255]
141 $ hg --repositor a tip
141 $ hg --repositor a tip
142 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
142 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
143 [255]
143 [255]
144 $ hg -qR a tip
144 $ hg -qR a tip
145 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
145 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
146 [255]
146 [255]
147 $ hg -qRa tip
147 $ hg -qRa tip
148 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
148 abort: Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
149 [255]
149 [255]
150
150
151 Testing --cwd:
151 Testing --cwd:
152
152
153 $ hg --cwd a parents
153 $ hg --cwd a parents
154 changeset: 0:8580ff50825a
154 changeset: 0:8580ff50825a
155 tag: tip
155 tag: tip
156 user: test
156 user: test
157 date: Thu Jan 01 00:00:01 1970 +0000
157 date: Thu Jan 01 00:00:01 1970 +0000
158 summary: a
158 summary: a
159
159
160
160
161 Testing -y/--noninteractive - just be sure it is parsed:
161 Testing -y/--noninteractive - just be sure it is parsed:
162
162
163 $ hg --cwd a tip -q --noninteractive
163 $ hg --cwd a tip -q --noninteractive
164 0:8580ff50825a
164 0:8580ff50825a
165 $ hg --cwd a tip -q -y
165 $ hg --cwd a tip -q -y
166 0:8580ff50825a
166 0:8580ff50825a
167
167
168 Testing -q/--quiet:
168 Testing -q/--quiet:
169
169
170 $ hg -R a -q tip
170 $ hg -R a -q tip
171 0:8580ff50825a
171 0:8580ff50825a
172 $ hg -R b -q tip
172 $ hg -R b -q tip
173 0:b6c483daf290
173 0:b6c483daf290
174 $ hg -R c --quiet parents
174 $ hg -R c --quiet parents
175 0:8580ff50825a
175 0:8580ff50825a
176 1:b6c483daf290
176 1:b6c483daf290
177
177
178 Testing -v/--verbose:
178 Testing -v/--verbose:
179
179
180 $ hg --cwd c head -v
180 $ hg --cwd c head -v
181 changeset: 1:b6c483daf290
181 changeset: 1:b6c483daf290
182 tag: tip
182 tag: tip
183 parent: -1:000000000000
183 parent: -1:000000000000
184 user: test
184 user: test
185 date: Thu Jan 01 00:00:01 1970 +0000
185 date: Thu Jan 01 00:00:01 1970 +0000
186 files: b
186 files: b
187 description:
187 description:
188 b
188 b
189
189
190
190
191 changeset: 0:8580ff50825a
191 changeset: 0:8580ff50825a
192 user: test
192 user: test
193 date: Thu Jan 01 00:00:01 1970 +0000
193 date: Thu Jan 01 00:00:01 1970 +0000
194 files: a
194 files: a
195 description:
195 description:
196 a
196 a
197
197
198
198
199 $ hg --cwd b tip --verbose
199 $ hg --cwd b tip --verbose
200 changeset: 0:b6c483daf290
200 changeset: 0:b6c483daf290
201 tag: tip
201 tag: tip
202 user: test
202 user: test
203 date: Thu Jan 01 00:00:01 1970 +0000
203 date: Thu Jan 01 00:00:01 1970 +0000
204 files: b
204 files: b
205 description:
205 description:
206 b
206 b
207
207
208
208
209
209
210 Testing --config:
210 Testing --config:
211
211
212 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
212 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
213 quuxfoo
213 quuxfoo
214 $ hg --cwd c --config '' tip -q
214 $ hg --cwd c --config '' tip -q
215 abort: malformed --config option: '' (use --config section.name=value)
215 abort: malformed --config option: '' (use --config section.name=value)
216 [255]
216 [255]
217 $ hg --cwd c --config a.b tip -q
217 $ hg --cwd c --config a.b tip -q
218 abort: malformed --config option: 'a.b' (use --config section.name=value)
218 abort: malformed --config option: 'a.b' (use --config section.name=value)
219 [255]
219 [255]
220 $ hg --cwd c --config a tip -q
220 $ hg --cwd c --config a tip -q
221 abort: malformed --config option: 'a' (use --config section.name=value)
221 abort: malformed --config option: 'a' (use --config section.name=value)
222 [255]
222 [255]
223 $ hg --cwd c --config a.= tip -q
223 $ hg --cwd c --config a.= tip -q
224 abort: malformed --config option: 'a.=' (use --config section.name=value)
224 abort: malformed --config option: 'a.=' (use --config section.name=value)
225 [255]
225 [255]
226 $ hg --cwd c --config .b= tip -q
226 $ hg --cwd c --config .b= tip -q
227 abort: malformed --config option: '.b=' (use --config section.name=value)
227 abort: malformed --config option: '.b=' (use --config section.name=value)
228 [255]
228 [255]
229
229
230 Testing --debug:
230 Testing --debug:
231
231
232 $ hg --cwd c log --debug
232 $ hg --cwd c log --debug
233 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
233 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
234 tag: tip
234 tag: tip
235 parent: -1:0000000000000000000000000000000000000000
235 parent: -1:0000000000000000000000000000000000000000
236 parent: -1:0000000000000000000000000000000000000000
236 parent: -1:0000000000000000000000000000000000000000
237 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
237 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
238 user: test
238 user: test
239 date: Thu Jan 01 00:00:01 1970 +0000
239 date: Thu Jan 01 00:00:01 1970 +0000
240 files+: b
240 files+: b
241 extra: branch=default
241 extra: branch=default
242 description:
242 description:
243 b
243 b
244
244
245
245
246 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
246 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
247 parent: -1:0000000000000000000000000000000000000000
247 parent: -1:0000000000000000000000000000000000000000
248 parent: -1:0000000000000000000000000000000000000000
248 parent: -1:0000000000000000000000000000000000000000
249 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
249 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
250 user: test
250 user: test
251 date: Thu Jan 01 00:00:01 1970 +0000
251 date: Thu Jan 01 00:00:01 1970 +0000
252 files+: a
252 files+: a
253 extra: branch=default
253 extra: branch=default
254 description:
254 description:
255 a
255 a
256
256
257
257
258
258
259 Testing --traceback:
259 Testing --traceback:
260
260
261 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
261 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
262 Traceback (most recent call last):
262 Traceback (most recent call last):
263
263
264 Testing --time:
264 Testing --time:
265
265
266 $ hg --cwd a --time id
266 $ hg --cwd a --time id
267 8580ff50825a tip
267 8580ff50825a tip
268 Time: real * (glob)
268 Time: real * (glob)
269
269
270 Testing --version:
270 Testing --version:
271
271
272 $ hg --version -q
272 $ hg --version -q
273 Mercurial Distributed SCM * (glob)
273 Mercurial Distributed SCM * (glob)
274
274
275 Testing -h/--help:
275 Testing -h/--help:
276
276
277 $ hg -h
277 $ hg -h
278 Mercurial Distributed SCM
278 Mercurial Distributed SCM
279
279
280 list of commands:
280 list of commands:
281
281
282 add add the specified files on the next commit
282 add add the specified files on the next commit
283 addremove add all new files, delete all missing files
283 addremove add all new files, delete all missing files
284 annotate show changeset information by line for each file
284 annotate show changeset information by line for each file
285 archive create an unversioned archive of a repository revision
285 archive create an unversioned archive of a repository revision
286 backout reverse effect of earlier changeset
286 backout reverse effect of earlier changeset
287 bisect subdivision search of changesets
287 bisect subdivision search of changesets
288 bookmarks track a line of development with movable markers
288 bookmarks track a line of development with movable markers
289 branch set or show the current branch name
289 branch set or show the current branch name
290 branches list repository named branches
290 branches list repository named branches
291 bundle create a changegroup file
291 bundle create a changegroup file
292 cat output the current or given revision of files
292 cat output the current or given revision of files
293 clone make a copy of an existing repository
293 clone make a copy of an existing repository
294 commit commit the specified files or all outstanding changes
294 commit commit the specified files or all outstanding changes
295 copy mark files as copied for the next commit
295 copy mark files as copied for the next commit
296 diff diff repository (or selected files)
296 diff diff repository (or selected files)
297 export dump the header and diffs for one or more changesets
297 export dump the header and diffs for one or more changesets
298 forget forget the specified files on the next commit
298 forget forget the specified files on the next commit
299 grep search for a pattern in specified files and revisions
299 grep search for a pattern in specified files and revisions
300 heads show current repository heads or show branch heads
300 heads show current repository heads or show branch heads
301 help show help for a given topic or a help overview
301 help show help for a given topic or a help overview
302 identify identify the working copy or specified revision
302 identify identify the working copy or specified revision
303 import import an ordered set of patches
303 import import an ordered set of patches
304 incoming show new changesets found in source
304 incoming show new changesets found in source
305 init create a new repository in the given directory
305 init create a new repository in the given directory
306 locate locate files matching specific patterns
306 locate locate files matching specific patterns
307 log show revision history of entire repository or files
307 log show revision history of entire repository or files
308 manifest output the current or given revision of the project manifest
308 manifest output the current or given revision of the project manifest
309 merge merge working directory with another revision
309 merge merge working directory with another revision
310 outgoing show changesets not found in the destination
310 outgoing show changesets not found in the destination
311 parents show the parents of the working directory or revision
311 parents show the parents of the working directory or revision
312 paths show aliases for remote repositories
312 paths show aliases for remote repositories
313 pull pull changes from the specified source
313 pull pull changes from the specified source
314 push push changes to the specified destination
314 push push changes to the specified destination
315 recover roll back an interrupted transaction
315 recover roll back an interrupted transaction
316 remove remove the specified files on the next commit
316 remove remove the specified files on the next commit
317 rename rename files; equivalent of copy + remove
317 rename rename files; equivalent of copy + remove
318 resolve redo merges or set/view the merge status of files
318 resolve redo merges or set/view the merge status of files
319 revert restore individual files or directories to an earlier state
319 revert restore individual files or directories to an earlier state
320 rollback roll back the last transaction (dangerous)
320 rollback roll back the last transaction (dangerous)
321 root print the root (top) of the current working directory
321 root print the root (top) of the current working directory
322 serve start stand-alone webserver
322 serve start stand-alone webserver
323 showconfig show combined config settings from all hgrc files
323 showconfig show combined config settings from all hgrc files
324 status show changed files in the working directory
324 status show changed files in the working directory
325 summary summarize working directory state
325 summary summarize working directory state
326 tag add one or more tags for the current or given revision
326 tag add one or more tags for the current or given revision
327 tags list repository tags
327 tags list repository tags
328 tip show the tip revision
328 tip show the tip revision
329 unbundle apply one or more changegroup files
329 unbundle apply one or more changegroup files
330 update update working directory (or switch revisions)
330 update update working directory (or switch revisions)
331 verify verify the integrity of the repository
331 verify verify the integrity of the repository
332 version output version and copyright information
332 version output version and copyright information
333
333
334 additional help topics:
334 additional help topics:
335
335
336 config Configuration Files
336 config Configuration Files
337 dates Date Formats
337 dates Date Formats
338 diffs Diff Formats
338 diffs Diff Formats
339 environment Environment Variables
339 environment Environment Variables
340 extensions Using additional features
340 extensions Using additional features
341 glossary Glossary
341 glossary Glossary
342 hgweb Configuring hgweb
342 hgweb Configuring hgweb
343 merge-tools Merge Tools
343 merge-tools Merge Tools
344 multirevs Specifying Multiple Revisions
344 multirevs Specifying Multiple Revisions
345 patterns File Name Patterns
345 patterns File Name Patterns
346 revisions Specifying Single Revisions
346 revisions Specifying Single Revisions
347 revsets Specifying Revision Sets
347 revsets Specifying Revision Sets
348 subrepos Subrepositories
348 subrepos Subrepositories
349 templating Template Usage
349 templating Template Usage
350 urls URL Paths
350 urls URL Paths
351
351
352 use "hg -v help" to show builtin aliases and global options
352 use "hg -v help" to show builtin aliases and global options
353
353
354
354
355
355
356 $ hg --help
356 $ hg --help
357 Mercurial Distributed SCM
357 Mercurial Distributed SCM
358
358
359 list of commands:
359 list of commands:
360
360
361 add add the specified files on the next commit
361 add add the specified files on the next commit
362 addremove add all new files, delete all missing files
362 addremove add all new files, delete all missing files
363 annotate show changeset information by line for each file
363 annotate show changeset information by line for each file
364 archive create an unversioned archive of a repository revision
364 archive create an unversioned archive of a repository revision
365 backout reverse effect of earlier changeset
365 backout reverse effect of earlier changeset
366 bisect subdivision search of changesets
366 bisect subdivision search of changesets
367 bookmarks track a line of development with movable markers
367 bookmarks track a line of development with movable markers
368 branch set or show the current branch name
368 branch set or show the current branch name
369 branches list repository named branches
369 branches list repository named branches
370 bundle create a changegroup file
370 bundle create a changegroup file
371 cat output the current or given revision of files
371 cat output the current or given revision of files
372 clone make a copy of an existing repository
372 clone make a copy of an existing repository
373 commit commit the specified files or all outstanding changes
373 commit commit the specified files or all outstanding changes
374 copy mark files as copied for the next commit
374 copy mark files as copied for the next commit
375 diff diff repository (or selected files)
375 diff diff repository (or selected files)
376 export dump the header and diffs for one or more changesets
376 export dump the header and diffs for one or more changesets
377 forget forget the specified files on the next commit
377 forget forget the specified files on the next commit
378 grep search for a pattern in specified files and revisions
378 grep search for a pattern in specified files and revisions
379 heads show current repository heads or show branch heads
379 heads show current repository heads or show branch heads
380 help show help for a given topic or a help overview
380 help show help for a given topic or a help overview
381 identify identify the working copy or specified revision
381 identify identify the working copy or specified revision
382 import import an ordered set of patches
382 import import an ordered set of patches
383 incoming show new changesets found in source
383 incoming show new changesets found in source
384 init create a new repository in the given directory
384 init create a new repository in the given directory
385 locate locate files matching specific patterns
385 locate locate files matching specific patterns
386 log show revision history of entire repository or files
386 log show revision history of entire repository or files
387 manifest output the current or given revision of the project manifest
387 manifest output the current or given revision of the project manifest
388 merge merge working directory with another revision
388 merge merge working directory with another revision
389 outgoing show changesets not found in the destination
389 outgoing show changesets not found in the destination
390 parents show the parents of the working directory or revision
390 parents show the parents of the working directory or revision
391 paths show aliases for remote repositories
391 paths show aliases for remote repositories
392 pull pull changes from the specified source
392 pull pull changes from the specified source
393 push push changes to the specified destination
393 push push changes to the specified destination
394 recover roll back an interrupted transaction
394 recover roll back an interrupted transaction
395 remove remove the specified files on the next commit
395 remove remove the specified files on the next commit
396 rename rename files; equivalent of copy + remove
396 rename rename files; equivalent of copy + remove
397 resolve redo merges or set/view the merge status of files
397 resolve redo merges or set/view the merge status of files
398 revert restore individual files or directories to an earlier state
398 revert restore individual files or directories to an earlier state
399 rollback roll back the last transaction (dangerous)
399 rollback roll back the last transaction (dangerous)
400 root print the root (top) of the current working directory
400 root print the root (top) of the current working directory
401 serve start stand-alone webserver
401 serve start stand-alone webserver
402 showconfig show combined config settings from all hgrc files
402 showconfig show combined config settings from all hgrc files
403 status show changed files in the working directory
403 status show changed files in the working directory
404 summary summarize working directory state
404 summary summarize working directory state
405 tag add one or more tags for the current or given revision
405 tag add one or more tags for the current or given revision
406 tags list repository tags
406 tags list repository tags
407 tip show the tip revision
407 tip show the tip revision
408 unbundle apply one or more changegroup files
408 unbundle apply one or more changegroup files
409 update update working directory (or switch revisions)
409 update update working directory (or switch revisions)
410 verify verify the integrity of the repository
410 verify verify the integrity of the repository
411 version output version and copyright information
411 version output version and copyright information
412
412
413 additional help topics:
413 additional help topics:
414
414
415 config Configuration Files
415 config Configuration Files
416 dates Date Formats
416 dates Date Formats
417 diffs Diff Formats
417 diffs Diff Formats
418 environment Environment Variables
418 environment Environment Variables
419 extensions Using additional features
419 extensions Using additional features
420 glossary Glossary
420 glossary Glossary
421 hgweb Configuring hgweb
421 hgweb Configuring hgweb
422 merge-tools Merge Tools
422 merge-tools Merge Tools
423 multirevs Specifying Multiple Revisions
423 multirevs Specifying Multiple Revisions
424 patterns File Name Patterns
424 patterns File Name Patterns
425 revisions Specifying Single Revisions
425 revisions Specifying Single Revisions
426 revsets Specifying Revision Sets
426 revsets Specifying Revision Sets
427 subrepos Subrepositories
427 subrepos Subrepositories
428 templating Template Usage
428 templating Template Usage
429 urls URL Paths
429 urls URL Paths
430
430
431 use "hg -v help" to show builtin aliases and global options
431 use "hg -v help" to show builtin aliases and global options
432
432
433 Not tested: --debugger
433 Not tested: --debugger
434
434
@@ -1,24 +1,24 b''
1 Translations are optional:
1 Translations are optional:
2
2
3 $ "$TESTDIR/hghave" gettext || exit 80
3 $ "$TESTDIR/hghave" gettext || exit 80
4
4
5 Test that translations are compiled and installed correctly.
5 Test that translations are compiled and installed correctly.
6
6
7 Default encoding in tests is "ascii" and the translation is encoded
7 Default encoding in tests is "ascii" and the translation is encoded
8 using the "replace" error handler:
8 using the "replace" error handler:
9
9
10 $ LANGUAGE=pt_BR hg tip
10 $ LANGUAGE=pt_BR hg tip
11 abortado: N?o h? um reposit?rio do Mercurial aqui (.hg n?o encontrado)!
11 abortado: no repository found in '$TESTTMP' (.hg not found)!
12 [255]
12 [255]
13
13
14 Using a more accomodating encoding:
14 Using a more accomodating encoding:
15
15
16 $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
16 $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
17 abortado: N\xc3\xa3o h\xc3\xa1 um reposit\xc3\xb3rio do Mercurial aqui (.hg n\xc3\xa3o encontrado)! (esc)
17 abortado: no repository found in '$TESTTMP' (.hg not found)!
18 [255]
18 [255]
19
19
20 Different encoding:
20 Different encoding:
21
21
22 $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
22 $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
23 abortado: N\xe3o h\xe1 um reposit\xf3rio do Mercurial aqui (.hg n\xe3o encontrado)! (esc)
23 abortado: no repository found in '$TESTTMP' (.hg not found)!
24 [255]
24 [255]
General Comments 0
You need to be logged in to leave comments. Login now