Commit Graph

91 Commits

Author SHA1 Message Date
Brodie Rao
6f58bfc15e color/progress: subclass ui instead of using wrapfunction (issue2096)
This resolves the issue of hg cmd --mq not being colorized. This was due
to color wrapping only the instance of ui passed to dispatch._runcommand(),
which isn't the same ui object that mq.mqcommand() receives. After dispatch
calls extensions.loadall(), it makes sure any changes to ui.__class__ in
uisetup are propagated.

progress is updated to wrap ui in the same manner because wrapfunction
doesn't play well when ui.__class__ has been replaced by another extension
(orig will point to the old class method instead of color's).
2010-07-01 19:23:26 -05:00
Chad Dombrova
22bbfbd44a provide pre- and post- hooks with parsed command line arguments.
python hooks are passed two new keyword arguments:
- opts: a dict of options; unsepcified options are set to their default
- pats: a list of arguments

shell hooks receive two new variables containing string representations
of the above data:
- $HG_OPTS
- $HG_PATS

for example, the opts and pats for 'hg -f v1.1' would be:
{'force': True, 'message': '', 'rev': '', 'user': '', 'date': '', 'local': None, 'remove': None, 'mq': None}
['v1.1']
2010-06-10 09:32:19 -07:00
Dirkjan Ochtman
64bb18f0dd cleanups: undefined variables 2010-06-08 09:30:45 +02:00
Matt Mackall
969c51b3cf error: add new ParseError for various parsing errors 2010-06-04 20:57:26 -05:00
Matt Mackall
13c76ff349 error: change ParseError to CommandError 2010-06-04 20:19:53 -05:00
Martin Geisler
efb421d772 Merge with stable 2010-05-21 14:21:27 +02:00
Martin Geisler
b064e04066 dispatch: include Python version in traceback 2010-05-21 13:40:59 +02:00
Martin Geisler
cbc9868177 Merge with stable 2010-05-01 16:15:27 +02:00
Dan Villiom Podlaski Christiansen
16da932a11 dispatch: don't mangle ImportError abort messages
Previously, Mercurial assumed that the last word of the string
representation was the name of the moduled that was imported. This
assmption is incorrect, despite being true for the common case of an
exception raised by the Python VM.

For example, hgsubversion raises an ImportError with a helpful message
if the Subversion bindings were not found. The final word of this
message is not meaningful on its own, and is never the name of a
module.

This patch changes the output printed to be a simple stringification
of the exception instance. In most cases, this will be `abort: No
module named X!' rather than `abort: could not import module X!'.

No functionality change; all tests pass.
2010-04-30 18:11:56 +02:00
Simon Heimberg
4b52c68f90 dispatch: ignore if signals can not be set
This happens if the code is executed in a thread.
This patch allows tortoisehg to start the inotify server again.
2010-04-07 02:41:22 +02:00
Matt Mackall
399ebe1c0f Merge with stable 2010-04-19 17:00:02 -05:00
Martin Geisler
5cb99e439d Merge with stable 2010-03-31 17:32:19 +02:00
Alexander Solovyov
3283fbd2f5 expand paths in aliases 2010-03-27 13:39:45 +02:00
Benoit Boissinot
3db7df2869 style: use consistent variable names (*mod) with imports which would shadow 2010-03-11 17:43:44 +01:00
Yuya Nishihara
c01490d7d8 alias: fixes exception when displaying translated help text
__doc__ of aliased command shouldn't cointain non-ASCII characters,
because it'll be gettext-ed later by commands.help_().
Here gettext can raise UnicodeDecodeError.

Once concatenated two translatable strings into one, it become untranslatable.
So this patch moves 'alias for:' from dispatch.cmdalias to commands.help_,
where help texts are translated.

'alias for:' was introduced by 027d5c280eda.
2010-03-01 23:27:44 +09:00
Brendan Cully
3743c1ee43 mq: make init -Q do what qinit -c did 2010-02-08 10:50:00 +01:00
Brodie Rao
91c6eab10f dispatch: provide help for disabled extensions and commands
Before a command is declared unknown, each extension in hgext is searched,
starting with hgext.<cmdname>. If there's a matching command, a help message
suggests the appropriate extension and how to enable it.

Every extension could potentially be imported, but for cases like rebase,
relink, etc. only one extension is imported.

For the case of "hg help disabledext", if the extension is in hgext, the
extension description is read and a similar help suggestion is printed.
No extension import occurs.
2010-02-07 14:01:43 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Nicolas Dumazet
686db2d57f alias: do not crash when aliased command has no usage help text 2009-12-03 14:14:44 +09:00
Bill Schroeder
a75ddfba7d dispatch: better error message for --config option 2009-11-04 13:44:15 -06:00
Benoit Boissinot
80a458a464 pychecker: remove unused local variables 2009-10-31 17:04:46 +01:00
Yuya Nishihara
ac33bbc42b extensions: changed to call extsetup() from extensions.loadall()
previously uisetup() was invoked by extensions.loadall(), but
extsetup() was by _dispatch().

there's no need to split them because we have nothing to do
between uisetup() and extsetup().

this fixes issue1824 indirectly.
2009-10-28 23:55:23 +09:00
Alexander Solovyov
32999e4659 make path expanding more consistent
This expands ~user and $FOO constructs in ui.ignore files, [defaults],
[paths], extension paths, and HGRCPATH files.
2009-10-19 22:19:28 +03:00
Martin Geisler
969ff27288 Merge with crew-stable 2009-09-19 13:55:18 +02:00
Martin Geisler
af0872c777 dispatch: catch ConfigError while constructing ui 2009-09-19 13:52:54 +02:00
Martin Geisler
9f1896c083 do not attempt to translate ui.debug output 2009-09-19 01:15:38 +02:00
Andrey Somov
2ccddf5ead improve code readability 2009-09-09 11:12:36 +02:00
Simon Heimberg
fac4c72eee extensions: pass ui arguement to extsetup if accepted 2009-08-16 00:41:24 +02:00
Martin Geisler
559ff1708d extensions: load and configure extensions in well-defined phases
Extensions are now loaded with a call-graph like this:

  dispatch._dispatch
      extensions.loadall
          extensions.load
                # add foo module to extensions._extensions
          extensions.load
                # add bar module to extensions._extensions

          foo.uisetup(ui)
          bar.uisetup(ui)

      foo.extsetup()
      bar.extsetup()

      commands.table.update(foo.cmdtable)
      commands.table.update(bar.cmdtable)

  hg.repository
      foo.reposetup(ui, repo)
      bar.reposetup(ui, repo)

The uisetup calls could easily be moved out to dispatch._dispatch, but
have been kept in extensions.loadall since at least TortoiseHg calls
extensions.loadall and expects it to call uisetup.

The extensions.load function called uisetup. It now has an unused ui
argument which has been kept for backwards compatibility.
2009-08-29 00:29:16 +02:00
Dirkjan Ochtman
1d29e68744 change wiki/bts URLs to point to new hostname 2009-06-24 15:32:37 +02:00
Martin Geisler
16155b528f merged with crew 2009-06-21 19:06:57 +02:00
Sune Foldager
f5c1bbf245 translated a bunch of strings to danish 2009-06-20 19:46:01 +02:00
Brendan Cully
5189b36798 Move alias into core 2009-05-30 11:32:23 -07:00
Dirkjan Ochtman
605b944edf kill trailing whitespace 2009-06-19 13:47:50 +02:00
Brodie Rao
bf35ee672b help: don't display bogus help messages for invalid aliases 2009-12-05 23:26:27 -05:00
Henrik Stuart
f8df6b526d Merge with stable 2009-12-03 06:35:39 +01:00
Peter Arrenbrecht
995f74f0cd alias: improve help text for command aliases
Displays the line "alias for: hg ..." with the original command including options,
followed by the command's original help text.
2009-11-11 17:48:00 +01:00
Henri Wiechers
6284050410 dispatch: minor refactoring
Renamed local variable i to entry in _dispatch.
2009-11-13 16:38:27 +02:00
Martin Geisler
ca3bc4a9ab dispatch: remember loaded extensions in a real set 2009-05-07 17:56:57 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
de487eacda ui: print_exc() -> traceback() 2009-04-26 16:50:44 -05:00
Matt Mackall
be7d59ab85 ui: kill most users of parentui name and arg, replace with .copy() 2009-04-26 16:50:43 -05:00
Matt Mackall
e8b3de6bf8 ui: introduce new config parser 2009-04-23 15:40:10 -05:00
Matt Mackall
0174734c46 ui: kill updateopts
Move setconfig into dispatch._parseconfig
2009-04-23 15:40:10 -05:00
Matt Mackall
ebffe5ccb8 ui: refactor option setting
No more passing options as constructor keywords. Basic options are now
always stored in the overlay for simplicity and consistency.
2009-04-23 15:40:10 -05:00
Nicolas Dumazet
6ebdee6dde profiling: Adding support for kcachegrind output format, using lsprofcalltree 2009-04-08 14:20:57 +02:00
Nicolas Dumazet
f2cfd93c8c profiling: Adding a profiling.format config variable
Allows defining other output formats for profiling.

If an invalid format is given, output a warning and ignore it.
For now, only the standard 'text' value is supported.
2009-04-02 16:01:30 +09:00
Nicolas Dumazet
14ff1a53ae profiling: Adding profiling.output config variable
If specified, outputs profiling data to the said file.
Prints to stderr by default
2009-04-08 14:19:41 +02:00