Commit Graph

304 Commits

Author SHA1 Message Date
David Soria Parra
81153f2f12 dispatch: translate alias debugging messages 2011-06-21 13:24:19 +02:00
Idan Kamara
5e2d608efc dispatch: write shell alias output to ui out descriptor 2011-06-07 13:39:09 +03:00
Idan Kamara
c2b2fe4489 dispatch: fix for-loop variable name 2011-06-14 20:25:38 +03:00
Idan Kamara
c08a096623 dispatch: assign I/O descriptors from the request to the ui 2011-06-08 14:54:47 +03:00
Idan Kamara
e05ad378b0 dispatch: add I/O descriptors to the request 2011-06-07 13:39:09 +03:00
Idan Kamara
b335d3e278 dispatch: propagate ui command options to the local ui (issue2523)
so the ui object passed to pre/post python hooks has the verbose flag
(and the rest) set correctly
2011-06-13 00:19:26 +03:00
Idan Kamara
a910ab36b8 dispatch: add repo to the request
allows callers of dispatch.dispatch to pass in
an initialized repo object to be used.

-R/--repository overrides the request repo.
2011-06-02 00:43:34 +03:00
Idan Kamara
b9dc5b5bf7 dispatch: use the request to store the ui object
and check if we got one before creating.

note that the contents of the ui object might change after
dispatch() returns (by options passed through --config for example),
to ensure it doesn't, pass a copy() of it.
2011-05-26 00:53:23 +03:00
Idan Kamara
5544ef8f07 dispatch: wrap dispatch related information in a request class
currently only stores the arguments.
2011-05-26 00:44:11 +03:00
Martin Geisler
58a533fee9 help: add -c/--command flag to only show command help (issue2799) 2011-05-10 14:42:53 +02:00
Augie Fackler
79ea417a18 dispatch: use safehasattr instead of hasattr 2011-07-25 15:17:47 -05:00
Matt Mackall
e7ac311a48 merge with stable 2011-07-22 17:17:23 -05:00
Matt Mackall
550b5c3614 alias: pass local ui to shell alias
This avoids an additional config read
2011-07-15 18:03:37 -05:00
Matt Mackall
c229c0a5cf aliases: drop cwd manipulation
Already done in _dispatch
2011-07-15 16:06:54 -05:00
Matt Mackall
5ce8f05f45 dispatch: move shell alias handling after early arg handling
--cwd, --repo, and --config obviously should be handled first
2011-07-15 16:06:53 -05:00
Matt Mackall
4773ae257d merge with stable 2011-07-13 16:29:28 -05:00
Matt Mackall
bd16bb0fe4 dispatch: fix checking of rpath in _getlocal
This avoids an extra config read
2011-07-12 16:36:34 -05:00
Alexander Solovyov
325788efb7 add positional arguments to non-shell aliases 2011-05-01 12:29:32 +02:00
Dan Villiom Podlaski Christiansen
1eaa37ca32 dispatch: handle IndexErrors 2011-05-01 11:01:57 +02:00
Idan Kamara
762d333ae9 eliminate various naked except clauses 2011-04-23 00:51:25 +03:00
Matt Mackall
a33ce77f33 dispatch: improve repository not found message
This should help clarify what the problem is in various problematic
cases like ssh.
2011-04-20 14:28:40 -05:00
Adrian Buehlmann
3efb31d590 help: do not show full help text for command on option errors
Example

  $ hg clone --jump foo bar
  hg clone: option --jump not recognized
  hg clone [OPTION]... SOURCE [DEST]

  make a copy of an existing repository

  options:

   -U --noupdate           the clone will include an empty working copy (only a
                           repository)
   -u --updaterev REV      revision, tag or branch to check out
   -r --rev REV [+]        include the specified changeset
   -b --branch BRANCH [+]  clone only the specified branch
      --pull               use pull protocol to copy metadata
      --uncompressed       use uncompressed transfer (fast over LAN)
   -e --ssh CMD            specify ssh command to use
      --remotecmd CMD      specify hg command to run on the remote side
      --insecure           do not verify server certificate (ignoring
                           web.cacerts config)

  [+] marked option can be specified multiple times

  use "hg help clone" to show the full help text

Motivation for this change

  If the user already has specified the command, he probably already knows
  the command to some extent. Apparently, he has a problem with the options,
  so we show him just the synopsis with the short help and the details about
  the options, with a hint on the last line how to get the full help text.

Why is Mercurial better with this change?

  Experts who just forgot about the details of an option don't get that
  much text thrown at them, while the newbies still get a hint on the last
  line how to get the full help text.
2011-04-17 11:37:11 +02:00
Adrian Buehlmann
a8a418601f introduce new RequirementError (issue2649)
This improves the misleading error message

  $ hg identify
  abort: there is no Mercurial repository here (.hg not found)!

to the more explicit

  $ hg identify
  abort: requirement 'fake' not supported!

for all commands in commands.optionalrepo, which includes the identify
and serve commands in particular.

This is for the case when a new entry in .hg/requires will be defined
in a future Mercurial release.
2011-02-18 20:25:25 +01:00
Wagner Bruna
297638695f dispatch: fix typo in debug message 2011-02-16 21:02:41 -02:00
Roman Sokolov
ba47cd9ff8 dispatch: use flag cmdalias.shell for detecting shell aliases 2011-02-10 15:41:34 +03:00
Roman Sokolov
00ca6be77b dispatch: debug message for missing arguments in shell alias
Shows debug message if alias definition contains substitution variables,
but insufficient number of arguments supplied.
2011-02-11 03:46:28 +03:00
Roman Sokolov
7a0b42e376 dispatch: support for $ escaping in shell-alias definition
Sigils in shell-alias can be escaped by doubling them.
2011-02-11 03:32:40 +03:00
Adrian Buehlmann
9e0069c080 Make sure bundlerepo doesn't leak temp files (issue2491)
Add empty repository.close() and call it in dispatch.

Remove bundlerepository.__del__(), merging it into bundlerepository.close(),
which overrides repository.close().

http://docs.python.org/reference/datamodel.html says:

"It is not guaranteed that __del__() methods are called for objects that
still exist when the interpreter exits."
2011-02-12 10:58:11 +01:00
Yuya Nishihara
da93c3bd0b url: add --insecure option to bypass verification of ssl certificates
If --insecure specified, it behaves in the same way as no web.cacerts
configured.

Also shows hint for --insecure option when _verifycert() failed. But currently
the hint isn't displayed on SSLError, because it needs a certain level of
changes.
2011-01-29 23:23:24 +09:00
Steve Losh
3171599307 alias: fall back to normal error handling for ambigious commands (fixes issue2475) 2010-11-05 15:54:32 -04:00
Matt Mackall
4d7b056fed traceback: point to BugTracker on the wiki 2010-10-25 13:06:37 -05:00
Martin Geisler
b7a041ed06 dispatch: backout 3b699ee0e66d
The parenthesis may need translation too: Laurens Holst pointed out
that Japanese uses full-width parentheses: () (U+FF08 U+FF09).
2010-10-21 11:23:26 +02:00
Martin Geisler
77ce66fb6a check-code: find trailing whitespace 2010-10-20 10:13:04 +02:00
Steve Losh
0224e99d28 alias: fail gracefully when invalid global options are given (issue2442)
This patch modifies the check for shell aliases to prevent crashing when an invalid
global option is given.

When an invalid global option is given the check will simply return and let the
normal error handling for this case happen.
2010-10-17 13:24:37 -04:00
Brodie Rao
95903377bf dispatch: properly handle relative path aliases used with -R (issue2376)
This ensures the repo config is read relative to the repo root during
dispatch.
2010-10-04 15:07:12 -05:00
Brodie Rao
4236676bfc dispatch: remove superfluous try/except when reading local ui config
ui.readconfig() already handles IOError in this case.
2010-10-04 14:26:38 -05:00
Steve Losh
a6ad45cc76 alias: back up and restore commands.norepo before checking for shell aliases 2010-10-08 16:10:00 -04:00
Steve Losh
0ec78824a3 alias: only allow global options before a shell alias, pass later ones through
This patch refactors the dispatch code to change how arguments to shell aliases
are handled.

A separate "pass" to determine whether a command is a shell alias has been
added. The rough steps dispatch now performs when a command is given are these:

* Parse all arguments up to the command name.

* If any arguments such as --repository or --cwd are given (which could change
  the config file used, and therefore the definition of aliases), they are
  taken into account.

* We determine whether the command is a shell alias.

    * If so, execute the alias. The --repo and --cwd arguments are still in effect.
      Any arguments *after* the command name are passed unchanged through to the
      shell command (and interpolated as normal.

    * If the command is *not* a shell alias, the dispatching is effectively "reset"
      and reparsed as normal in its entirety.

The net effect of this patch is to make shell alias commands behave as you
would expect.

Any arguments you give to a shell alias *after* the alias name are passed
through unchanged. This lets you do something like the following:

    [alias]
    filereleased = !$HG log -r 'descendants(adds("$1")) and tagged()' -l1 $2 $3 $4 $5

    $ hg filereleased hgext/bookmarks.py --style compact

Previously the `--style compact` part would fail because Mercurial would
interpret those arguments as arguments to the alias command itself (which
doesn't take any arguments).

Also: running something like `hg -R ~/src/hg-crew filereleased
hgext/bookmarks.py` when `filereleased` is only defined in that repo's config
will now work.

These global arguments can *only* be given to a shell alias *before* the alias
name.  For example, this will *not* work in the above situation:

    $ hg filereleased -R ~/src/hg-crew hgext/bookmarks.py

The reason for this is that you may want to pass arguments like --repository to
the alias (or, more likely, their short versions like -R):

    [alias]
    own = !chown $@ `$HG root`

    $ hg own steve
    $ hg own -R steve
2010-08-24 18:25:33 -04:00
Wagner Bruna
ea2a96f4d4 i18n: unmark untranslatable string 2010-09-13 10:04:41 -03:00
Brodie Rao
9eaf2eb198 alias: on --debug, print expansion when it has invalid arguments 2010-08-27 20:45:18 -04:00
Brodie Rao
edc433c7fd alias: print what command is being shadowed in debug message 2010-08-27 20:45:11 -04:00
Martin Geisler
cb36142754 Merge with stable 2010-08-29 22:55:37 +02:00
Martin Geisler
5f46f16fb7 Lowercase error messages 2010-08-29 22:37:58 +02:00
Matt Mackall
aad5cb0594 merge with stable 2010-08-25 15:20:25 -05:00
Brodie Rao
6c64db37bc alias: make shadowing behavior more consistent (issue2054)
Currently, given an alias like the following:

    [alias]
    summary = summary --remote

The alias might be executed - or it might not - depending on the order
of the cmdtable dict.

This happens because cmdalias gets assigned back to the cmdtable like so:

    cmdtable['summary'] = ...

Yet '^summary|sum' is still in the table, so which one cmdutil.findcmd()
chooses isn't deterministic.

This patch makes cmdalias assign back to '^summary|sum'. It uses the same
cmdtable key lookup that extensions.wrapcommand() does.
2010-08-21 22:48:14 -04:00
Steve Losh
51f95d13a2 aliases: provide more flexible ways to work with shell alias arguments
This patch changes the functionality of shell aliases to add more powerful
options for working with shell alias arguments.

First: the alias name + arguments to a shell alias are set as an HG_ARGS
environment variable, delimited by spaces. This matches the behavior of hooks.

Second: any occurrences of "$@" (without quotes) are replaced with the
arguments, separated by spaces. This happens *before* the alias gets to the shell.

Third: any positive numeric variables ("$1", "$2", etc) are replaced with the
appropriate argument, indexed from 1. "$0" is replaced with the name of the
alias. Any "extra" numeric variables are replaced with an empty string.  This
happens *before* the alias gets to the shell.

These changes allow for more flexible shell aliases:

    [alias]
    echo = !echo $@
    count = !hg log -r "$@" --template='.' | wc -c | sed -e 's/ //g'
    qqueuemv = !mv "`hg root`/.hg/patches-$1" "`hg root`/.hg/patches-$2"

In action:

    $ hg echo foo
    foo

    $ hg count 'branch(default)'
    901

    $ hg count 'branch(stable) and keyword(fixes)'
    102

    $ hg qqueuemv myfeature somefeature
2010-08-18 18:56:44 -04:00
Matt Mackall
5d4700455d log: add logging for commands 2010-08-19 11:14:09 -05:00
Nicolas Dumazet
2476f9eec3 merge with stable 2010-07-31 11:41:58 +09:00
Nicolas Dumazet
576074569c dispatch: trailing whitespace 2010-07-31 11:36:24 +09:00
Matt Mackall
f93eb1deca Merge with crew 2010-07-27 16:03:42 -05:00
Dan Villiom Podlaski Christiansen
c5b2d719bd alias: improved diagnostic when arguments include --cwd, etc.
The logic pre-emptively checks for -R, --repo, --repository and --cwd
in order to give the user a more helpful error message. In addition,
each option is handled invididually, which avoids listing them all in
the error.

Before:

% hg --config alias.broken='push --cwd /dev/null' broken
abort: Option --cwd may not be abbreviated!

After:

% hg --config alias.broken='push --cwd /dev/null' broken
error in definition for alias 'broken': --cwd may only be given on the command line
2010-07-27 14:43:40 +02:00
Matt Mackall
671535ddb7 Merge with stable 2010-07-25 21:20:05 -05:00
Matt Mackall
42d9b2046b Merge with stable 2010-07-25 21:20:05 -05:00
Brodie Rao
11c127f205 alias: ensure checksignature() is applied directly to the command (issue2286)
Aliased commands that received bad arguments would raise TypeError instead of
SignatureError. This only affected commands that weren't wrapped by extensions.
Using util.checksignature() in cmdalias.__call__() ensures SignatureError is
raised correctly.
2010-07-22 15:26:26 -04:00
Mads Kiilerich
cd85e285e0 dispatch: give better error message when cwd doesn't exist (issue2293)
Previous behavior wasn't very helpful:
$ hg st foo
abort: No such file or directory

Now we tell more about what failed:
abort: error getting current working directory: No such file or directory
2010-07-24 00:38:08 +02:00
Patrick Mezard
e250cc89dc dispatch: write Abort hint to stderr too 2010-07-26 22:28:37 +02:00
Martin Geisler
8f362a460f mark ui.warn strings for translation 2010-07-16 14:44:30 +02:00
Martin Geisler
f985c9d777 Merge with stable 2010-07-16 14:45:52 +02:00
Benoit Boissinot
a13fa80461 Abort: add a hint argument, printed in the next line inside parenthesis
discovery was using a custom made message for this purpose
push now returns -1 after aborting, instead of 1 previously
2010-07-15 14:41:22 +02:00
Henrik Stuart
c4714744e5 merge stable to default 2010-07-14 20:41:01 +02:00
Steve Losh
c2cf2592b2 dispatch: add shell aliases
This patch adds git-style "shell aliases" to Mercurial.

Any alias with a definition beginning with a '!' will be treated as a shell
alias. For example:

    [alias]
    echo = !echo
    qempty = !hg qrefresh -X "`hg root`" ; echo Emptied patch "`hg qtop`"

    $ hg echo foo
    foo
    $ hg qempty
    Emptied patch foo
    $
2010-07-07 18:49:43 -04:00
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
Mads Kiilerich
5181c38b3b debugger: give a little intro before entering pdb 2010-06-30 17:23:16 +02:00
Mads Kiilerich
9f20fc60d6 debugger: show traceback before entering pdb post-mortem 2010-06-30 17:20:42 +02: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
Nicolas Dumazet
b87b90da60 profiling: dropping hotshot profiling. --profile as a unique profiling option
hotshot was an experimental module, which is broken for Python < 2.5
And even for Python >= 2.5 users, hotshot usage is discouraged: cProfile
(formerly lsprof) should be used instead.
2009-04-08 14:18:20 +02:00
Matt Mackall
642f4d7151 move encoding bits from util to encoding
In addition to cleaning up util, this gets rid of some circular dependencies.
2009-04-03 14:51:48 -05:00
Peter Arrenbrecht
bc21361ed2 cleanup: drop unused imports 2009-03-23 13:12:07 +01:00
Bill Barry
8ac447bbd7 dispatch: extract command execution block into method
This pulls the pre-command hook/command/post-command hook workflow out of
the method it is in and puts it into its own method so that it potentially
could be exposed for extensions to wrap.
2009-02-12 09:36:15 -07:00
Augie Fackler
7131a2f8b7 fancyopts: Parse options that occur after arguments.
This changes the behavior of qguard in the case of setting negative guards, as -- will now always be required.
Fixes issue1402.
Doc fixes for mq by mpm.
2009-02-10 13:26:00 -06:00
Matt Mackall
3296a955b6 warn if --repository provided for norepo commands 2009-01-28 14:27:44 -06:00
Matt Mackall
104a85dee5 error: move SignatureError 2009-01-12 13:51:43 -06:00
Matt Mackall
9db9afd227 dispatch: sort exception handlers 2009-01-12 13:35:35 -06:00
Matt Mackall
7f3bf9b19d error: move SignalInterrupt
now derived from KeyboardInterrupt to simplify catches
2009-01-12 11:48:05 -06:00
Matt Mackall
e61d364b61 error: move UnknownCommand and AmbiguousCommand 2009-01-12 11:39:38 -06:00
Matt Mackall
534da54d07 error: move UnexpectedOutput (now ResponseError) 2009-01-12 11:28:28 -06:00
Matt Mackall
76c90d50e6 error: move lock errors
rename LockException to LockError
2009-01-12 11:09:14 -06:00
Matt Mackall
e0735a1762 error: move repo errors
rename NoCapability to CapabilityError
2009-01-12 10:42:31 -06:00
Matt Mackall
d3bf622cc2 error: move ParseError 2009-01-11 23:04:24 -06:00
Matt Mackall
d15d559b7c errors: move revlog errors
- create error.py for exception classes to reduce demandloading
- move revlog exceptions to it
- change users to import error and drop revlog import if possible
2009-01-11 22:48:28 -06:00
Matt Mackall
356502607f refactor version code
- simplify version detection code
- move detection code into setup.py
- move version reading function into util.py
- drop version.py code

This makes hg more closely follow its own recommendation of how to deal with
versioning your builds: use hg id in your build script.
2009-01-10 18:02:38 -06:00
Benoit Boissinot
4668c151a4 use inst.args instead of using __getitem__ directly
DeprecationWarning: __getitem__ not supported for exception classes in 3.x;
use args attribute
2008-12-06 15:57:11 +01:00
Matt Mackall
648df6f0b1 dispatch: generalize signature checking for extension command wrapping 2008-11-18 16:02:14 -06:00
Benoit Boissinot
ea7fe6dacc remove unused variables 2008-10-28 19:25:26 +01:00
Thomas Arendsen Hein
ba25030ab6 Minor cleanup: Add missing space forgotten in recent change. 2008-10-23 19:27:25 +02:00
Matt Mackall
bebeb261d5 findcmd: have dispatch look up strict flag 2008-10-22 17:34:08 -05:00
Benoit Boissinot
ebcbcef11c merge with -stable 2008-09-06 17:04:01 +02:00
Benoit Boissinot
61cdb0bdd6 show extensions loaded on traceback 2008-09-05 10:00:57 +02:00
Benoit Boissinot
d179cdfe82 a socket error might be a tuple or a singleton 2008-09-06 00:45:13 +02:00
Joel Rosdahl
c26213193c Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg 2008-03-06 22:51:16 +01:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Jesse Glick
d21d195944 Infer a --repository argument from command arguments when reasonable.
In particular: if invoked without -R from a CWD not inside a repo, having been
passed one or more file paths as command arguments, where the nearest enclosing
repo of all of those paths is the same, quietly infer a -R option for that repo.
Otherwise abort with an error message as before.
2008-01-25 04:11:32 -05:00
Thomas Arendsen Hein
6f399a19b1 merge backout 2008-02-18 19:21:33 +01:00
Thomas Arendsen Hein
4d33c02751 Backed out changeset 8105fa3c7347 (see issue971/msg5317) 2008-02-18 19:20:22 +01:00
Bryan O'Sullivan
dfa3e1ea9b profiling: allow CGI and FastCGI to be profiled 2008-02-01 13:09:45 -08:00
Matt Mackall
d743a8c08a hooks: fix pre- and post- hooks specified in .hg/hgrc
We were looking up hooks in the wrong ui object. Also, we weren't
handling hooks to commands without a repo.
2008-01-18 09:03:17 -06:00
Kirill Smelkov
e928c8fcaf dispatch: allow extensions to provide setup code
we'll need this soon, when record extension will optionally depend
on mq early -- when preparing cmdtable.

Also, if accepted, ExtensionHowto wiki should be updated as well.
2008-01-10 12:07:18 +03:00
Peter Arrenbrecht
18fb9f5e5e Fix income/pull with bundle and -R (issue 820).
Uses ui.setconfig() to tell bundlerepo where the main repo is. This is
needed for when the --repository option is used.

Adds tests to test-bundle and a new test script
test-mq-pull-from-bundle, which plays out the situation that initially
made me detect this bug

(hg -R .hg/patches pull ../bundle.hg).
2007-12-18 14:11:13 -06:00
Matt Mackall
2b6b8e4e67 dispatch: report OOM rather than traceback 2007-12-10 10:23:45 -06:00
Matt Mackall
ad28be7c23 i18n: fix complaints from pygettext 2007-11-20 15:54:25 -06:00
Alexis S. L. Carvalho
e073cf982f Set bundle.mainreporoot only after checking that it's a local repo
Fixes issue977.
2008-02-14 18:08:16 -02:00
Bryan O'Sullivan
b945cf7339 profile: expand PID in output file name 2008-02-01 13:31:46 -08:00
Alexis S. L. Carvalho
d11dad17a3 Remove demandimport.enable from dispatch.py 2007-08-18 14:25:55 -03:00
Alexis S. L. Carvalho
0f222fbdf3 Move enabling of demandimport to dispatch.py
This avoids loading many modules before enabling demandimport.
2007-08-17 17:33:27 -03:00
Alexis S. L. Carvalho
dc23a7db18 Move cmdtable and reposetup handling out of extensions.py
A new function (extensions.extensions) allows the code that is
interested in those attributes to handle them directly.

This allows some cleanups of extensions.py.  Notably, we can
remove the extensions.commandtable hack.

It also makes it easier to add standard extension attributes,
like a "hgwebsetup" function or a "helptable" dict that augments
the data in help.py, etc.
2007-08-17 17:33:27 -03:00
Matt Mackall
c08427e0e8 dispatch: move command dispatching into its own module
- move command dispatching functions from commands and cmdutil to dispatch
- change findcmd to take a table argument
- remove circular import of commands in cmdutil
- privatize helper functions in dispatch
2007-08-15 16:55:13 -05:00