##// END OF EJS Templates
dispatch: write Abort hint to stderr too
Patrick Mezard -
r11683:757f39fa default
parent child Browse files
Show More
@@ -1,550 +1,550 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
9 import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback
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.stdout.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])
93 commands.help_(ui, inst.args[0])
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.status(_("(%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, details follow\n"))
172 ui.warn(_("** unknown exception encountered, details follow\n"))
173 ui.warn(_("** report bug details to "
173 ui.warn(_("** report bug details to "
174 "http://mercurial.selenic.com/bts/\n"))
174 "http://mercurial.selenic.com/bts/\n"))
175 ui.warn(_("** or mercurial@selenic.com\n"))
175 ui.warn(_("** or mercurial@selenic.com\n"))
176 ui.warn(_("** Python %s\n") % sys.version.replace('\n', ''))
176 ui.warn(_("** Python %s\n") % sys.version.replace('\n', ''))
177 ui.warn(_("** Mercurial Distributed SCM (version %s)\n")
177 ui.warn(_("** Mercurial Distributed SCM (version %s)\n")
178 % util.version())
178 % util.version())
179 ui.warn(_("** Extensions loaded: %s\n")
179 ui.warn(_("** Extensions loaded: %s\n")
180 % ", ".join([x[0] for x in extensions.extensions()]))
180 % ", ".join([x[0] for x in extensions.extensions()]))
181 raise
181 raise
182
182
183 return -1
183 return -1
184
184
185 def aliasargs(fn):
185 def aliasargs(fn):
186 if hasattr(fn, 'args'):
186 if hasattr(fn, 'args'):
187 return fn.args
187 return fn.args
188 return []
188 return []
189
189
190 class cmdalias(object):
190 class cmdalias(object):
191 def __init__(self, name, definition, cmdtable):
191 def __init__(self, name, definition, cmdtable):
192 self.name = name
192 self.name = name
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 cmdutil.findcmd(self.name, cmdtable, True)
201 cmdutil.findcmd(self.name, cmdtable, True)
202 self.shadows = True
202 self.shadows = True
203 except error.UnknownCommand:
203 except error.UnknownCommand:
204 self.shadows = False
204 self.shadows = False
205
205
206 if not self.definition:
206 if not self.definition:
207 def fn(ui, *args):
207 def fn(ui, *args):
208 ui.warn(_("no definition for alias '%s'\n") % self.name)
208 ui.warn(_("no definition for alias '%s'\n") % self.name)
209 return 1
209 return 1
210 self.fn = fn
210 self.fn = fn
211 self.badalias = True
211 self.badalias = True
212
212
213 return
213 return
214
214
215 if self.definition.startswith('!'):
215 if self.definition.startswith('!'):
216 def fn(ui, *args):
216 def fn(ui, *args):
217 cmd = '%s %s' % (self.definition[1:], ' '.join(args))
217 cmd = '%s %s' % (self.definition[1:], ' '.join(args))
218 return util.system(cmd)
218 return util.system(cmd)
219 self.fn = fn
219 self.fn = fn
220 return
220 return
221
221
222 args = shlex.split(self.definition)
222 args = shlex.split(self.definition)
223 cmd = args.pop(0)
223 cmd = args.pop(0)
224 args = map(util.expandpath, args)
224 args = map(util.expandpath, args)
225
225
226 try:
226 try:
227 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
227 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
228 if len(tableentry) > 2:
228 if len(tableentry) > 2:
229 self.fn, self.opts, self.help = tableentry
229 self.fn, self.opts, self.help = tableentry
230 else:
230 else:
231 self.fn, self.opts = tableentry
231 self.fn, self.opts = tableentry
232
232
233 self.args = aliasargs(self.fn) + args
233 self.args = aliasargs(self.fn) + args
234 if cmd not in commands.norepo.split(' '):
234 if cmd not in commands.norepo.split(' '):
235 self.norepo = False
235 self.norepo = False
236 if self.help.startswith("hg " + cmd):
236 if self.help.startswith("hg " + cmd):
237 # drop prefix in old-style help lines so hg shows the alias
237 # drop prefix in old-style help lines so hg shows the alias
238 self.help = self.help[4 + len(cmd):]
238 self.help = self.help[4 + len(cmd):]
239 self.__doc__ = self.fn.__doc__
239 self.__doc__ = self.fn.__doc__
240
240
241 except error.UnknownCommand:
241 except error.UnknownCommand:
242 def fn(ui, *args):
242 def fn(ui, *args):
243 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
243 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
244 % (self.name, cmd))
244 % (self.name, cmd))
245 try:
245 try:
246 # check if the command is in a disabled extension
246 # check if the command is in a disabled extension
247 commands.help_(ui, cmd, unknowncmd=True)
247 commands.help_(ui, cmd, unknowncmd=True)
248 except error.UnknownCommand:
248 except error.UnknownCommand:
249 pass
249 pass
250 return 1
250 return 1
251 self.fn = fn
251 self.fn = fn
252 self.badalias = True
252 self.badalias = True
253 except error.AmbiguousCommand:
253 except error.AmbiguousCommand:
254 def fn(ui, *args):
254 def fn(ui, *args):
255 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
255 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
256 % (self.name, cmd))
256 % (self.name, cmd))
257 return 1
257 return 1
258 self.fn = fn
258 self.fn = fn
259 self.badalias = True
259 self.badalias = True
260
260
261 def __call__(self, ui, *args, **opts):
261 def __call__(self, ui, *args, **opts):
262 if self.shadows:
262 if self.shadows:
263 ui.debug("alias '%s' shadows command\n" % self.name)
263 ui.debug("alias '%s' shadows command\n" % self.name)
264
264
265 return self.fn(ui, *args, **opts)
265 return self.fn(ui, *args, **opts)
266
266
267 def addaliases(ui, cmdtable):
267 def addaliases(ui, cmdtable):
268 # aliases are processed after extensions have been loaded, so they
268 # aliases are processed after extensions have been loaded, so they
269 # may use extension commands. Aliases can also use other alias definitions,
269 # may use extension commands. Aliases can also use other alias definitions,
270 # but only if they have been defined prior to the current definition.
270 # but only if they have been defined prior to the current definition.
271 for alias, definition in ui.configitems('alias'):
271 for alias, definition in ui.configitems('alias'):
272 aliasdef = cmdalias(alias, definition, cmdtable)
272 aliasdef = cmdalias(alias, definition, cmdtable)
273 cmdtable[alias] = (aliasdef, aliasdef.opts, aliasdef.help)
273 cmdtable[alias] = (aliasdef, aliasdef.opts, aliasdef.help)
274 if aliasdef.norepo:
274 if aliasdef.norepo:
275 commands.norepo += ' %s' % alias
275 commands.norepo += ' %s' % alias
276
276
277 def _parse(ui, args):
277 def _parse(ui, args):
278 options = {}
278 options = {}
279 cmdoptions = {}
279 cmdoptions = {}
280
280
281 try:
281 try:
282 args = fancyopts.fancyopts(args, commands.globalopts, options)
282 args = fancyopts.fancyopts(args, commands.globalopts, options)
283 except fancyopts.getopt.GetoptError, inst:
283 except fancyopts.getopt.GetoptError, inst:
284 raise error.CommandError(None, inst)
284 raise error.CommandError(None, inst)
285
285
286 if args:
286 if args:
287 cmd, args = args[0], args[1:]
287 cmd, args = args[0], args[1:]
288 aliases, entry = cmdutil.findcmd(cmd, commands.table,
288 aliases, entry = cmdutil.findcmd(cmd, commands.table,
289 ui.config("ui", "strict"))
289 ui.config("ui", "strict"))
290 cmd = aliases[0]
290 cmd = aliases[0]
291 args = aliasargs(entry[0]) + args
291 args = aliasargs(entry[0]) + args
292 defaults = ui.config("defaults", cmd)
292 defaults = ui.config("defaults", cmd)
293 if defaults:
293 if defaults:
294 args = map(util.expandpath, shlex.split(defaults)) + args
294 args = map(util.expandpath, shlex.split(defaults)) + args
295 c = list(entry[1])
295 c = list(entry[1])
296 else:
296 else:
297 cmd = None
297 cmd = None
298 c = []
298 c = []
299
299
300 # combine global options into local
300 # combine global options into local
301 for o in commands.globalopts:
301 for o in commands.globalopts:
302 c.append((o[0], o[1], options[o[1]], o[3]))
302 c.append((o[0], o[1], options[o[1]], o[3]))
303
303
304 try:
304 try:
305 args = fancyopts.fancyopts(args, c, cmdoptions, True)
305 args = fancyopts.fancyopts(args, c, cmdoptions, True)
306 except fancyopts.getopt.GetoptError, inst:
306 except fancyopts.getopt.GetoptError, inst:
307 raise error.CommandError(cmd, inst)
307 raise error.CommandError(cmd, inst)
308
308
309 # separate global options back out
309 # separate global options back out
310 for o in commands.globalopts:
310 for o in commands.globalopts:
311 n = o[1]
311 n = o[1]
312 options[n] = cmdoptions[n]
312 options[n] = cmdoptions[n]
313 del cmdoptions[n]
313 del cmdoptions[n]
314
314
315 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
315 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
316
316
317 def _parseconfig(ui, config):
317 def _parseconfig(ui, config):
318 """parse the --config options from the command line"""
318 """parse the --config options from the command line"""
319 for cfg in config:
319 for cfg in config:
320 try:
320 try:
321 name, value = cfg.split('=', 1)
321 name, value = cfg.split('=', 1)
322 section, name = name.split('.', 1)
322 section, name = name.split('.', 1)
323 if not section or not name:
323 if not section or not name:
324 raise IndexError
324 raise IndexError
325 ui.setconfig(section, name, value)
325 ui.setconfig(section, name, value)
326 except (IndexError, ValueError):
326 except (IndexError, ValueError):
327 raise util.Abort(_('malformed --config option: %r '
327 raise util.Abort(_('malformed --config option: %r '
328 '(use --config section.name=value)') % cfg)
328 '(use --config section.name=value)') % cfg)
329
329
330 def _earlygetopt(aliases, args):
330 def _earlygetopt(aliases, args):
331 """Return list of values for an option (or aliases).
331 """Return list of values for an option (or aliases).
332
332
333 The values are listed in the order they appear in args.
333 The values are listed in the order they appear in args.
334 The options and values are removed from args.
334 The options and values are removed from args.
335 """
335 """
336 try:
336 try:
337 argcount = args.index("--")
337 argcount = args.index("--")
338 except ValueError:
338 except ValueError:
339 argcount = len(args)
339 argcount = len(args)
340 shortopts = [opt for opt in aliases if len(opt) == 2]
340 shortopts = [opt for opt in aliases if len(opt) == 2]
341 values = []
341 values = []
342 pos = 0
342 pos = 0
343 while pos < argcount:
343 while pos < argcount:
344 if args[pos] in aliases:
344 if args[pos] in aliases:
345 if pos + 1 >= argcount:
345 if pos + 1 >= argcount:
346 # ignore and let getopt report an error if there is no value
346 # ignore and let getopt report an error if there is no value
347 break
347 break
348 del args[pos]
348 del args[pos]
349 values.append(args.pop(pos))
349 values.append(args.pop(pos))
350 argcount -= 2
350 argcount -= 2
351 elif args[pos][:2] in shortopts:
351 elif args[pos][:2] in shortopts:
352 # short option can have no following space, e.g. hg log -Rfoo
352 # short option can have no following space, e.g. hg log -Rfoo
353 values.append(args.pop(pos)[2:])
353 values.append(args.pop(pos)[2:])
354 argcount -= 1
354 argcount -= 1
355 else:
355 else:
356 pos += 1
356 pos += 1
357 return values
357 return values
358
358
359 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
359 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
360 # run pre-hook, and abort if it fails
360 # run pre-hook, and abort if it fails
361 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),
362 pats=cmdpats, opts=cmdoptions)
362 pats=cmdpats, opts=cmdoptions)
363 if ret:
363 if ret:
364 return ret
364 return ret
365 ret = _runcommand(ui, options, cmd, d)
365 ret = _runcommand(ui, options, cmd, d)
366 # run post-hook, passing command result
366 # run post-hook, passing command result
367 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
367 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
368 result=ret, pats=cmdpats, opts=cmdoptions)
368 result=ret, pats=cmdpats, opts=cmdoptions)
369 return ret
369 return ret
370
370
371 _loaded = set()
371 _loaded = set()
372 def _dispatch(ui, args):
372 def _dispatch(ui, args):
373 # read --config before doing anything else
373 # read --config before doing anything else
374 # (e.g. to change trust settings for reading .hg/hgrc)
374 # (e.g. to change trust settings for reading .hg/hgrc)
375 _parseconfig(ui, _earlygetopt(['--config'], args))
375 _parseconfig(ui, _earlygetopt(['--config'], args))
376
376
377 # check for cwd
377 # check for cwd
378 cwd = _earlygetopt(['--cwd'], args)
378 cwd = _earlygetopt(['--cwd'], args)
379 if cwd:
379 if cwd:
380 os.chdir(cwd[-1])
380 os.chdir(cwd[-1])
381
381
382 # read the local repository .hgrc into a local ui object
382 # read the local repository .hgrc into a local ui object
383 path = cmdutil.findrepo(os.getcwd()) or ""
383 path = cmdutil.findrepo(os.getcwd()) or ""
384 if not path:
384 if not path:
385 lui = ui
385 lui = ui
386 else:
386 else:
387 try:
387 try:
388 lui = ui.copy()
388 lui = ui.copy()
389 lui.readconfig(os.path.join(path, ".hg", "hgrc"))
389 lui.readconfig(os.path.join(path, ".hg", "hgrc"))
390 except IOError:
390 except IOError:
391 pass
391 pass
392
392
393 # now we can expand paths, even ones in .hg/hgrc
393 # now we can expand paths, even ones in .hg/hgrc
394 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
394 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
395 if rpath:
395 if rpath:
396 path = lui.expandpath(rpath[-1])
396 path = lui.expandpath(rpath[-1])
397 lui = ui.copy()
397 lui = ui.copy()
398 lui.readconfig(os.path.join(path, ".hg", "hgrc"))
398 lui.readconfig(os.path.join(path, ".hg", "hgrc"))
399
399
400 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
400 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
401 # reposetup. Programs like TortoiseHg will call _dispatch several
401 # reposetup. Programs like TortoiseHg will call _dispatch several
402 # times so we keep track of configured extensions in _loaded.
402 # times so we keep track of configured extensions in _loaded.
403 extensions.loadall(lui)
403 extensions.loadall(lui)
404 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
404 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
405 # Propagate any changes to lui.__class__ by extensions
405 # Propagate any changes to lui.__class__ by extensions
406 ui.__class__ = lui.__class__
406 ui.__class__ = lui.__class__
407
407
408 # (uisetup and extsetup are handled in extensions.loadall)
408 # (uisetup and extsetup are handled in extensions.loadall)
409
409
410 for name, module in exts:
410 for name, module in exts:
411 cmdtable = getattr(module, 'cmdtable', {})
411 cmdtable = getattr(module, 'cmdtable', {})
412 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
412 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
413 if overrides:
413 if overrides:
414 ui.warn(_("extension '%s' overrides commands: %s\n")
414 ui.warn(_("extension '%s' overrides commands: %s\n")
415 % (name, " ".join(overrides)))
415 % (name, " ".join(overrides)))
416 commands.table.update(cmdtable)
416 commands.table.update(cmdtable)
417 _loaded.add(name)
417 _loaded.add(name)
418
418
419 # (reposetup is handled in hg.repository)
419 # (reposetup is handled in hg.repository)
420
420
421 addaliases(lui, commands.table)
421 addaliases(lui, commands.table)
422
422
423 # check for fallback encoding
423 # check for fallback encoding
424 fallback = lui.config('ui', 'fallbackencoding')
424 fallback = lui.config('ui', 'fallbackencoding')
425 if fallback:
425 if fallback:
426 encoding.fallbackencoding = fallback
426 encoding.fallbackencoding = fallback
427
427
428 fullargs = args
428 fullargs = args
429 cmd, func, args, options, cmdoptions = _parse(lui, args)
429 cmd, func, args, options, cmdoptions = _parse(lui, args)
430
430
431 if options["config"]:
431 if options["config"]:
432 raise util.Abort(_("Option --config may not be abbreviated!"))
432 raise util.Abort(_("Option --config may not be abbreviated!"))
433 if options["cwd"]:
433 if options["cwd"]:
434 raise util.Abort(_("Option --cwd may not be abbreviated!"))
434 raise util.Abort(_("Option --cwd may not be abbreviated!"))
435 if options["repository"]:
435 if options["repository"]:
436 raise util.Abort(_(
436 raise util.Abort(_(
437 "Option -R has to be separated from other options (e.g. not -qR) "
437 "Option -R has to be separated from other options (e.g. not -qR) "
438 "and --repository may only be abbreviated as --repo!"))
438 "and --repository may only be abbreviated as --repo!"))
439
439
440 if options["encoding"]:
440 if options["encoding"]:
441 encoding.encoding = options["encoding"]
441 encoding.encoding = options["encoding"]
442 if options["encodingmode"]:
442 if options["encodingmode"]:
443 encoding.encodingmode = options["encodingmode"]
443 encoding.encodingmode = options["encodingmode"]
444 if options["time"]:
444 if options["time"]:
445 def get_times():
445 def get_times():
446 t = os.times()
446 t = os.times()
447 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
447 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
448 t = (t[0], t[1], t[2], t[3], time.clock())
448 t = (t[0], t[1], t[2], t[3], time.clock())
449 return t
449 return t
450 s = get_times()
450 s = get_times()
451 def print_time():
451 def print_time():
452 t = get_times()
452 t = get_times()
453 ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
453 ui.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
454 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
454 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
455 atexit.register(print_time)
455 atexit.register(print_time)
456
456
457 if options['verbose'] or options['debug'] or options['quiet']:
457 if options['verbose'] or options['debug'] or options['quiet']:
458 ui.setconfig('ui', 'verbose', str(bool(options['verbose'])))
458 ui.setconfig('ui', 'verbose', str(bool(options['verbose'])))
459 ui.setconfig('ui', 'debug', str(bool(options['debug'])))
459 ui.setconfig('ui', 'debug', str(bool(options['debug'])))
460 ui.setconfig('ui', 'quiet', str(bool(options['quiet'])))
460 ui.setconfig('ui', 'quiet', str(bool(options['quiet'])))
461 if options['traceback']:
461 if options['traceback']:
462 ui.setconfig('ui', 'traceback', 'on')
462 ui.setconfig('ui', 'traceback', 'on')
463 if options['noninteractive']:
463 if options['noninteractive']:
464 ui.setconfig('ui', 'interactive', 'off')
464 ui.setconfig('ui', 'interactive', 'off')
465
465
466 if options['help']:
466 if options['help']:
467 return commands.help_(ui, cmd, options['version'])
467 return commands.help_(ui, cmd, options['version'])
468 elif options['version']:
468 elif options['version']:
469 return commands.version_(ui)
469 return commands.version_(ui)
470 elif not cmd:
470 elif not cmd:
471 return commands.help_(ui, 'shortlist')
471 return commands.help_(ui, 'shortlist')
472
472
473 repo = None
473 repo = None
474 cmdpats = args[:]
474 cmdpats = args[:]
475 if cmd not in commands.norepo.split():
475 if cmd not in commands.norepo.split():
476 try:
476 try:
477 repo = hg.repository(ui, path=path)
477 repo = hg.repository(ui, path=path)
478 ui = repo.ui
478 ui = repo.ui
479 if not repo.local():
479 if not repo.local():
480 raise util.Abort(_("repository '%s' is not local") % path)
480 raise util.Abort(_("repository '%s' is not local") % path)
481 ui.setconfig("bundle", "mainreporoot", repo.root)
481 ui.setconfig("bundle", "mainreporoot", repo.root)
482 except error.RepoError:
482 except error.RepoError:
483 if cmd not in commands.optionalrepo.split():
483 if cmd not in commands.optionalrepo.split():
484 if args and not path: # try to infer -R from command args
484 if args and not path: # try to infer -R from command args
485 repos = map(cmdutil.findrepo, args)
485 repos = map(cmdutil.findrepo, args)
486 guess = repos[0]
486 guess = repos[0]
487 if guess and repos.count(guess) == len(repos):
487 if guess and repos.count(guess) == len(repos):
488 return _dispatch(ui, ['--repository', guess] + fullargs)
488 return _dispatch(ui, ['--repository', guess] + fullargs)
489 if not path:
489 if not path:
490 raise error.RepoError(_("There is no Mercurial repository"
490 raise error.RepoError(_("There is no Mercurial repository"
491 " here (.hg not found)"))
491 " here (.hg not found)"))
492 raise
492 raise
493 args.insert(0, repo)
493 args.insert(0, repo)
494 elif rpath:
494 elif rpath:
495 ui.warn(_("warning: --repository ignored\n"))
495 ui.warn(_("warning: --repository ignored\n"))
496
496
497 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
497 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
498 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
498 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
499 cmdpats, cmdoptions)
499 cmdpats, cmdoptions)
500
500
501 def _runcommand(ui, options, cmd, cmdfunc):
501 def _runcommand(ui, options, cmd, cmdfunc):
502 def checkargs():
502 def checkargs():
503 try:
503 try:
504 return cmdfunc()
504 return cmdfunc()
505 except error.SignatureError:
505 except error.SignatureError:
506 raise error.CommandError(cmd, _("invalid arguments"))
506 raise error.CommandError(cmd, _("invalid arguments"))
507
507
508 if options['profile']:
508 if options['profile']:
509 format = ui.config('profiling', 'format', default='text')
509 format = ui.config('profiling', 'format', default='text')
510
510
511 if not format in ['text', 'kcachegrind']:
511 if not format in ['text', 'kcachegrind']:
512 ui.warn(_("unrecognized profiling format '%s'"
512 ui.warn(_("unrecognized profiling format '%s'"
513 " - Ignored\n") % format)
513 " - Ignored\n") % format)
514 format = 'text'
514 format = 'text'
515
515
516 output = ui.config('profiling', 'output')
516 output = ui.config('profiling', 'output')
517
517
518 if output:
518 if output:
519 path = ui.expandpath(output)
519 path = ui.expandpath(output)
520 ostream = open(path, 'wb')
520 ostream = open(path, 'wb')
521 else:
521 else:
522 ostream = sys.stderr
522 ostream = sys.stderr
523
523
524 try:
524 try:
525 from mercurial import lsprof
525 from mercurial import lsprof
526 except ImportError:
526 except ImportError:
527 raise util.Abort(_(
527 raise util.Abort(_(
528 'lsprof not available - install from '
528 'lsprof not available - install from '
529 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
529 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
530 p = lsprof.Profiler()
530 p = lsprof.Profiler()
531 p.enable(subcalls=True)
531 p.enable(subcalls=True)
532 try:
532 try:
533 return checkargs()
533 return checkargs()
534 finally:
534 finally:
535 p.disable()
535 p.disable()
536
536
537 if format == 'kcachegrind':
537 if format == 'kcachegrind':
538 import lsprofcalltree
538 import lsprofcalltree
539 calltree = lsprofcalltree.KCacheGrind(p)
539 calltree = lsprofcalltree.KCacheGrind(p)
540 calltree.output(ostream)
540 calltree.output(ostream)
541 else:
541 else:
542 # format == 'text'
542 # format == 'text'
543 stats = lsprof.Stats(p.getstats())
543 stats = lsprof.Stats(p.getstats())
544 stats.sort()
544 stats.sort()
545 stats.pprint(top=10, file=ostream, climit=5)
545 stats.pprint(top=10, file=ostream, climit=5)
546
546
547 if output:
547 if output:
548 ostream.close()
548 ostream.close()
549 else:
549 else:
550 return checkargs()
550 return checkargs()
@@ -1,303 +1,304 b''
1 % first revision, no sub
1 % first revision, no sub
2 adding a
2 adding a
3 % add first sub
3 % add first sub
4 abort: can't commit subrepos without .hgsub
4 abort: can't commit subrepos without .hgsub
5 adding a
5 adding a
6 parent: 0:f7b1eb17ad24 tip
6 parent: 0:f7b1eb17ad24 tip
7 0
7 0
8 branch: default
8 branch: default
9 commit: 1 added, 1 subrepos
9 commit: 1 added, 1 subrepos
10 update: (current)
10 update: (current)
11 committing subrepository s
11 committing subrepository s
12 parent: 1:7cf8cfea66e4 tip
12 parent: 1:7cf8cfea66e4 tip
13 1
13 1
14 branch: default
14 branch: default
15 commit: 1 subrepos
15 commit: 1 subrepos
16 update: (current)
16 update: (current)
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 parent: 1:7cf8cfea66e4 tip
18 parent: 1:7cf8cfea66e4 tip
19 1
19 1
20 branch: default
20 branch: default
21 commit: (clean)
21 commit: (clean)
22 update: (current)
22 update: (current)
23 % add sub sub
23 % add sub sub
24 parent: 1:7cf8cfea66e4 tip
24 parent: 1:7cf8cfea66e4 tip
25 1
25 1
26 branch: default
26 branch: default
27 commit: 1 subrepos
27 commit: 1 subrepos
28 update: (current)
28 update: (current)
29 committing subrepository s
29 committing subrepository s
30 committing subrepository s/ss
30 committing subrepository s/ss
31 parent: 2:df30734270ae tip
31 parent: 2:df30734270ae tip
32 2
32 2
33 branch: default
33 branch: default
34 commit: (clean)
34 commit: (clean)
35 update: (current)
35 update: (current)
36 % bump sub rev
36 % bump sub rev
37 committing subrepository s
37 committing subrepository s
38 % leave sub dirty
38 % leave sub dirty
39 committing subrepository s
39 committing subrepository s
40 changeset: 3:1c833a7a9e3a
40 changeset: 3:1c833a7a9e3a
41 tag: tip
41 tag: tip
42 user: test
42 user: test
43 date: Thu Jan 01 00:00:00 1970 +0000
43 date: Thu Jan 01 00:00:00 1970 +0000
44 summary: 4
44 summary: 4
45
45
46 % check caching
46 % check caching
47 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
47 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
48 % restore
48 % restore
49 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 path s
50 path s
51 source s
51 source s
52 revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e
52 revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e
53 % new branch for merge tests
53 % new branch for merge tests
54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 adding t/t
55 adding t/t
56 % 5
56 % 5
57 committing subrepository t
57 committing subrepository t
58 created new head
58 created new head
59 % 6
59 % 6
60 committing subrepository t
60 committing subrepository t
61 path s
61 path s
62 source s
62 source s
63 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
63 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
64 path t
64 path t
65 source t
65 source t
66 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
66 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
67 % 7
67 % 7
68 committing subrepository t
68 committing subrepository t
69 % 8
69 % 8
70 % merge tests
70 % merge tests
71 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 (branch merge, don't forget to commit)
73 (branch merge, don't forget to commit)
74 path s
74 path s
75 source s
75 source s
76 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
76 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
77 path t
77 path t
78 source t
78 source t
79 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
79 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
80 created new head
80 created new head
81 searching for copies back to rev 2
81 searching for copies back to rev 2
82 resolving manifests
82 resolving manifests
83 overwrite None partial False
83 overwrite None partial False
84 ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4
84 ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4
85 .hgsubstate: versions differ -> m
85 .hgsubstate: versions differ -> m
86 update: .hgsubstate 1/1 files (100.00%)
86 update: .hgsubstate 1/1 files (100.00%)
87 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
87 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
88 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
88 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
89 getting subrepo t
89 getting subrepo t
90 resolving manifests
90 resolving manifests
91 overwrite True partial False
91 overwrite True partial False
92 ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
92 ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
93 t: remote is newer -> g
93 t: remote is newer -> g
94 update: t 1/1 files (100.00%)
94 update: t 1/1 files (100.00%)
95 getting t
95 getting t
96 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
96 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 (branch merge, don't forget to commit)
97 (branch merge, don't forget to commit)
98 path s
98 path s
99 source s
99 source s
100 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
100 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
101 path t
101 path t
102 source t
102 source t
103 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
103 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
104 committing subrepository t
104 committing subrepository t
105 searching for copies back to rev 2
105 searching for copies back to rev 2
106 resolving manifests
106 resolving manifests
107 overwrite None partial False
107 overwrite None partial False
108 ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf
108 ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf
109 .hgsubstate: versions differ -> m
109 .hgsubstate: versions differ -> m
110 update: .hgsubstate 1/1 files (100.00%)
110 update: .hgsubstate 1/1 files (100.00%)
111 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
111 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
112 subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
112 subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
113 merging subrepo t
113 merging subrepo t
114 searching for copies back to rev 2
114 searching for copies back to rev 2
115 resolving manifests
115 resolving manifests
116 overwrite None partial False
116 overwrite None partial False
117 ancestor 6747d179aa9a local 20a0db6fbf6c+ remote 7af322bc1198
117 ancestor 6747d179aa9a local 20a0db6fbf6c+ remote 7af322bc1198
118 t: versions differ -> m
118 t: versions differ -> m
119 preserving t for resolve of t
119 preserving t for resolve of t
120 update: t 1/1 files (100.00%)
120 update: t 1/1 files (100.00%)
121 picked tool 'internal:merge' for t (binary False symlink False)
121 picked tool 'internal:merge' for t (binary False symlink False)
122 merging t
122 merging t
123 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
123 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
124 warning: conflicts during merge.
124 warning: conflicts during merge.
125 merging t failed!
125 merging t failed!
126 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
126 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
127 use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
127 use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
128 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
128 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 (branch merge, don't forget to commit)
129 (branch merge, don't forget to commit)
130 % should conflict
130 % should conflict
131 <<<<<<< local
131 <<<<<<< local
132 conflict
132 conflict
133 =======
133 =======
134 t3
134 t3
135 >>>>>>> other
135 >>>>>>> other
136 % clone
136 % clone
137 updating to branch default
137 updating to branch default
138 pulling subrepo s from .../sub/t/s
138 pulling subrepo s from .../sub/t/s
139 requesting all changes
139 requesting all changes
140 adding changesets
140 adding changesets
141 adding manifests
141 adding manifests
142 adding file changes
142 adding file changes
143 added 4 changesets with 5 changes to 3 files
143 added 4 changesets with 5 changes to 3 files
144 pulling subrepo s/ss from .../sub/t/s/ss
144 pulling subrepo s/ss from .../sub/t/s/ss
145 requesting all changes
145 requesting all changes
146 adding changesets
146 adding changesets
147 adding manifests
147 adding manifests
148 adding file changes
148 adding file changes
149 added 1 changesets with 1 changes to 1 files
149 added 1 changesets with 1 changes to 1 files
150 pulling subrepo t from .../sub/t/t
150 pulling subrepo t from .../sub/t/t
151 requesting all changes
151 requesting all changes
152 adding changesets
152 adding changesets
153 adding manifests
153 adding manifests
154 adding file changes
154 adding file changes
155 added 4 changesets with 4 changes to 1 files (+1 heads)
155 added 4 changesets with 4 changes to 1 files (+1 heads)
156 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
157 path s
157 path s
158 source s
158 source s
159 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
159 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
160 path t
160 path t
161 source t
161 source t
162 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
162 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
163 % push
163 % push
164 committing subrepository t
164 committing subrepository t
165 pushing ...sub/t
165 pushing ...sub/t
166 pushing ...sub/t/s/ss
166 pushing ...sub/t/s/ss
167 searching for changes
167 searching for changes
168 no changes found
168 no changes found
169 pushing ...sub/t/s
169 pushing ...sub/t/s
170 searching for changes
170 searching for changes
171 no changes found
171 no changes found
172 pushing ...sub/t/t
172 pushing ...sub/t/t
173 searching for changes
173 searching for changes
174 adding changesets
174 adding changesets
175 adding manifests
175 adding manifests
176 adding file changes
176 adding file changes
177 added 1 changesets with 1 changes to 1 files
177 added 1 changesets with 1 changes to 1 files
178 searching for changes
178 searching for changes
179 adding changesets
179 adding changesets
180 adding manifests
180 adding manifests
181 adding file changes
181 adding file changes
182 added 1 changesets with 1 changes to 1 files
182 added 1 changesets with 1 changes to 1 files
183 % push -f
183 % push -f
184 committing subrepository s
184 committing subrepository s
185 abort: push creates new remote heads on branch 'default'!
185 abort: push creates new remote heads on branch 'default'!
186 (did you forget to merge? use push -f to force)
186 pushing ...sub/t
187 pushing ...sub/t
187 pushing ...sub/t/s/ss
188 pushing ...sub/t/s/ss
188 searching for changes
189 searching for changes
189 no changes found
190 no changes found
190 pushing ...sub/t/s
191 pushing ...sub/t/s
191 searching for changes
192 searching for changes
192 (did you forget to merge? use push -f to force)
193 pushing ...sub/t
193 pushing ...sub/t
194 pushing ...sub/t/s/ss
194 pushing ...sub/t/s/ss
195 searching for changes
195 searching for changes
196 no changes found
196 no changes found
197 pushing ...sub/t/s
197 pushing ...sub/t/s
198 searching for changes
198 searching for changes
199 adding changesets
199 adding changesets
200 adding manifests
200 adding manifests
201 adding file changes
201 adding file changes
202 added 1 changesets with 1 changes to 1 files (+1 heads)
202 added 1 changesets with 1 changes to 1 files (+1 heads)
203 pushing ...sub/t/t
203 pushing ...sub/t/t
204 searching for changes
204 searching for changes
205 no changes found
205 no changes found
206 searching for changes
206 searching for changes
207 adding changesets
207 adding changesets
208 adding manifests
208 adding manifests
209 adding file changes
209 adding file changes
210 added 1 changesets with 1 changes to 1 files
210 added 1 changesets with 1 changes to 1 files
211 % update
211 % update
212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 committing subrepository t
213 committing subrepository t
214 % pull
214 % pull
215 pulling ...sub/t
215 pulling ...sub/t
216 searching for changes
216 searching for changes
217 adding changesets
217 adding changesets
218 adding manifests
218 adding manifests
219 adding file changes
219 adding file changes
220 added 1 changesets with 1 changes to 1 files
220 added 1 changesets with 1 changes to 1 files
221 (run 'hg update' to get a working copy)
221 (run 'hg update' to get a working copy)
222 pulling subrepo t from .../sub/t/t
222 pulling subrepo t from .../sub/t/t
223 searching for changes
223 searching for changes
224 adding changesets
224 adding changesets
225 adding manifests
225 adding manifests
226 adding file changes
226 adding file changes
227 added 1 changesets with 1 changes to 1 files
227 added 1 changesets with 1 changes to 1 files
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 blah
229 blah
230 % bogus subrepo path aborts
230 % bogus subrepo path aborts
231 abort: missing ] in subrepo source
231 abort: missing ] in subrepo source
232 % issue 1986
232 % issue 1986
233 adding a
233 adding a
234 marked working directory as branch br
234 marked working directory as branch br
235 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 adding b
236 adding b
237 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
237 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 (branch merge, don't forget to commit)
239 (branch merge, don't forget to commit)
240 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
240 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 adding c
241 adding c
242 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
242 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
243 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
244 (branch merge, don't forget to commit)
244 (branch merge, don't forget to commit)
245 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
245 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
246 adding .hgsub
246 adding .hgsub
247 committing subrepository s
247 committing subrepository s
248 marked working directory as branch br
248 marked working directory as branch br
249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
250 adding b
250 adding b
251 committing subrepository s
251 committing subrepository s
252 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
252 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
253 adding c
253 adding c
254 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
254 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
255 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 (branch merge, don't forget to commit)
256 (branch merge, don't forget to commit)
257 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
257 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 adding d
259 adding d
260 committing subrepository s
260 committing subrepository s
261 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
261 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
262 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
262 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 adding e
263 adding e
264 committing subrepository s
264 committing subrepository s
265 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 (branch merge, don't forget to commit)
267 (branch merge, don't forget to commit)
268 % test subrepo delete from .hgsubstate
268 % test subrepo delete from .hgsubstate
269 adding testdelete/nested/foo
269 adding testdelete/nested/foo
270 adding testdelete/nested2/foo
270 adding testdelete/nested2/foo
271 adding testdelete/.hgsub
271 adding testdelete/.hgsub
272 committing subrepository nested2
272 committing subrepository nested2
273 committing subrepository nested
273 committing subrepository nested
274 nested
274 nested
275 % test repository cloning
275 % test repository cloning
276 adding nested_absolute/foo
276 adding nested_absolute/foo
277 adding nested_relative/foo2
277 adding nested_relative/foo2
278 adding main/.hgsub
278 adding main/.hgsub
279 committing subrepository nested_relative
279 committing subrepository nested_relative
280 committing subrepository nested_absolute
280 committing subrepository nested_absolute
281 updating to branch default
281 updating to branch default
282 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
282 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
283 [paths]
283 [paths]
284 default = $HGTMP/test-subrepo/sub/mercurial/nested_absolute
284 default = $HGTMP/test-subrepo/sub/mercurial/nested_absolute
285 [paths]
285 [paths]
286 default = $HGTMP/test-subrepo/sub/mercurial/nested_relative
286 default = $HGTMP/test-subrepo/sub/mercurial/nested_relative
287 % issue 1977
287 % issue 1977
288 adding a
288 adding a
289 adding .hgsub
289 adding .hgsub
290 committing subrepository s
290 committing subrepository s
291 updating to branch default
291 updating to branch default
292 pulling subrepo s from .../sub/repo/s
292 pulling subrepo s from .../sub/repo/s
293 requesting all changes
293 requesting all changes
294 adding changesets
294 adding changesets
295 adding manifests
295 adding manifests
296 adding file changes
296 adding file changes
297 added 1 changesets with 1 changes to 1 files
297 added 1 changesets with 1 changes to 1 files
298 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
300 created new head
300 created new head
301 committing subrepository s
301 committing subrepository s
302 abort: push creates new remote heads on branch 'default'!
302 abort: push creates new remote heads on branch 'default'!
303 (did you forget to merge? use push -f to force)
303 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
304 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now