Commit Graph

200 Commits

Author SHA1 Message Date
Pierre-Yves David
4e9586f18e clfilter: enforce hidden filtering on all repository accesses
We ensure all repositores created through `mercurial.hg.repository`
are "hidden" filtered. This is an even stronger enforcement than
86530c899687.

Citing Matt's response to changeset 86530c899687 installing filtering
in dispatch:

> Unfortunately, this means that code that doesn't go through dispatch (ie all
> those crazy misguided people using Mercurial as a library) are going to see
> these hidden changesets.
>
> Might be better to instead install the filter in localrepo construction by
> default and disable it in dispatch.
2013-01-11 20:34:54 +01:00
Pierre-Yves David
a1985448ad clfilter: enforce hidden changeset globally
The dispatch code now enables filtering of "hidden" changesets globally. The
filter is installed before command and extension invocation. The `--hidden`
switch is now global and disables this filtering for any command.

Code in log dedicated to changeset exclusion is removed as this global filtering
has the same effect.
2013-01-08 20:37:37 +01:00
Mads Kiilerich
5584e7ca16 dispatch: show empty filename in OSError aborts
Mercurial would sometimes exit with:
  abort: No such file or directory
where str of the actual OSError exception was the more helpful:
  [Errno 2] No such file or directory: ''

The exception will now always show the filename and quote it:
  abort: No such file or directory: ''
2013-01-07 02:00:29 +01:00
Pierre-Yves David
ed7bbaa14c dispatch: handle empty testedwith value in extension
When extensions had an empty `testedwith` attribute the code tried to parse it
and failed. As a result the actual error were shallowed by a This crash.

We now treat empty strip as 'unknown'
2013-01-04 19:06:42 +01:00
Siddharth Agarwal
a5e71891bd commands: don't infer repo for commands like update (issue2748)
Maintain a whitelist of commands to infer the repo for instead. The whitelist
contains those commands that take file(s) in the working dir as arguments.
2012-10-16 11:43:15 -07:00
Mads Kiilerich
688b9e2048 check-code: indent 4 spaces in py files 2012-07-31 03:30:42 +02:00
Thomas Arendsen Hein
2b505739fb dispatch: fix traceback when extension was tested with newer versions only
The "worst" extension still is the one tested with the lowest tested version
below the current version of Mercurial, but if an extension with was only
tested with newer versions, it is considered a candidate for a bad extension,
too. In this case extensions which have been tested with higher versions of
Mercurial are considered better. This allows finding the oldest extension if
ct can't be calculated correctly and therefore defaults to an empty tuple, and
it involves less changes to the comparison logic during the current code
freeze.
2012-07-19 21:20:56 +02:00
Martin Geisler
65ea7aa7d4 dispatch: lowercase --time message 2012-06-12 14:18:18 +02:00
Adrian Buehlmann
cf5a074e7d dispatch: tolerate non-standard version strings in tuplever() (issue3470)
When developing, we may see non-standard version strings of the form

  5d64306f39bb+20120525

which caused tuplever() to raise

  ValueError: invalid literal for int() with base 10: '5d64306f39bb'

and shadowing the real traceback.
2012-05-25 14:24:07 +02:00
Augie Fackler
1d813c0d7e dispatch: try and identify third-party extensions as sources of tracebacks
Extension authors should explicitly declare their supported hg
versions and include a buglink attribute in their extension. In the
event that a traceback occurs, we'll identify the
least-recently-tested extensionas the most likely source of the defect
and suggest the user disable that extension.

Packagers should make every effort to ship hg versions from exact
tags, or with as few modifications as possible so that the versioning
can work appropriately.
2012-05-16 16:18:07 -05:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
Brodie Rao
a7ef0a0cc5 cleanup: "not x in y" -> "x not in y" 2012-05-12 16:00:57 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Patrick Mezard
9c5568246f alias: inherit command optionalrepo flag (issue3298)
Commands working without a repository, like "init", are listed in
commands.norepo. Commands optionally using a repository, like "showconfig", are
listed in commands.optionalrepo. Command aliases were inheriting the former but
not the latter.
2012-05-05 12:21:22 +02:00
Yuya Nishihara
8284425c7d commands: parse ui.strict config item as bool 2012-05-06 23:58:04 +09:00
Bryan O'Sullivan
af2413c514 dispatch: add support for statprof as a profiler
This can be selected using the config variable profiling.type or
the environment variable HGPROF ("ls" for the default, "stat" for
statprof).  The only tuneable is the frequency, profiling.freq,
which defaults to 1000 Hz.

If statprof is not available, a warning is printed.
2012-04-09 13:48:45 -07:00
Matt Mackall
2cf26ea8f0 merge with stable 2012-03-27 16:17:46 -05:00
Matt Mackall
3eb6e77c5e alias: abort on missing positional args (issue3331) 2012-03-27 16:13:59 -05:00
Matt Mackall
39c1d7334a merge with stable 2012-03-22 17:08:05 -05:00
Matt Mackall
8fac36f6df aliases: use empty string for missing position parameters (issue3331) 2012-03-22 17:07:39 -05:00
Matt Mackall
000c79b7ce profile: add undocumented config options for profiler output 2012-03-15 15:59:26 -05:00
Martin Geisler
cf414756e1 dispatch: lowercase abort message 2012-01-06 16:16:58 +01:00
Martin Geisler
237daccf1b dispatch: remove extra newline
The return statement belongs to the lines above.
2011-12-10 18:40:05 +01:00
Matt Mackall
75db0d196a merge with stable 2011-11-17 16:53:17 -06:00
Mads Kiilerich
065de91b14 add missing localization markup 2011-11-11 01:07:10 +01:00
Mads Kiilerich
06a1eb11e4 dispatch: exit with 8-bit exit code
The exit code returned from a program to the shell is unsigned 8-bit, but
Mercurial would sometimes try to exit with negative numbers or None. sys.exit
on Unix will convert that to 8-bit exit codes, but on Windows negative values
showed up as 0.

The exit code is now explicitly converted to unsigned 8-bit.
2011-11-07 03:14:53 +01:00
Augie Fackler
b0cd40af6a alias: don't shadow commands that we only partially matched (issue2993) (BC)
Previously, if you set an alias for "ci", it'd also shadow "commit"
even though you didn't specify that. This occurred for all commands
with explicit short variations.
2011-10-11 17:20:03 -05:00
Matt Mackall
96e41d94f5 merge with stable 2011-08-05 16:07:51 -05:00
Matt Mackall
1731276051 help: drop with_version
If --version is specified, we print the version and exit (as documented).
2011-08-04 15:08:41 -05:00
Idan Kamara
073a89cf8a dispatch: don't rewrap aliases that have the same definition
Previously aliases that overrode existing commands would wrap the old alias
on every call to dispatch() (twice actually), which is an obvious re-entrancy
issue for things like the command server or TortoiseHG.
2011-08-04 19:41:23 +03:00
Andrew Pritchard
2d8acb3e0b wireproto: add out-of-band error class to allow remote repo to report errors
Older clients will still print the provided error message and not much else:
over ssh, this will be each line prefixed with 'remote: ' in addition to an
"abort: unexpected response: '\n'"; over http, this will be the '---%<---'
banners in addition to the 'does not appear to be a repository' message.

Currently, clients with this patch will display 'abort: remote error:\n' and
the provided error text, but it is trivial to style the error text however is
deemed appropriate.
2011-08-02 15:21:10 -04:00
Matt Mackall
e75325116a merge with stable 2011-08-01 10:54:34 -05:00
Idan Kamara
19f1b36e00 dispatch: make sure global options on the command line take precedence
So if a user has verbose=True somewhere in his .hgrc files, giving -q
on the command line will override that.

This basically reverts cd10f447ccba.
2011-07-30 21:04:14 +03:00
David Golub
11baa243a9 dispatch: avoid double backslashes in error message
The use of %r in the format string caused Python to display Windows paths with
double backslashes.
2011-07-21 16:02:34 -04:00
Idan Kamara
27bbf9363c dispatch: don't use request repo if we have --cwd 2011-07-11 17:46:55 +03:00
Pierre-Yves David
f95a6cfc12 error: Add a hint argument to RepoError
This use the same mechanism than Abort. Except clause stay distinct
because RepoError add "!" at the end of the message.
2011-06-25 02:30:17 +02:00
Idan Kamara
a1bff0c5fe dispatch: set config options on the request repo.ui 2011-06-24 19:44:59 +03:00
Idan Kamara
f0f55bda59 dispatch: return read config options 2011-06-24 19:44:59 +03:00
Idan Kamara
122edf3c57 dispatch: set global options on the request repo.ui
If the request has a repo, and global options such as --verbose are passed,
we need to set those explicitly on the repo.ui.
2011-06-24 19:44:58 +03:00
Idan Kamara
ff97debbbd dispatch: make sure unspecified global ui options don't override old values 2011-06-24 12:16:14 +03:00
Idan Kamara
c368cbab93 dispatch: set descriptors on the request repo.ui 2011-06-24 19:38:28 +03:00
Idan Kamara
22edb918b3 dispatch: pass the correct ui to runcommand
For commands that take a repo, repo.ui is passed as the ui to runcommand.
This restores that behaviour when the request has a repo.
2011-06-24 19:36:44 +03:00
Idan Kamara
848255e076 dispatch: check for None before closing repo
We were trying to call close() if repo == None and req.repo != None.
This can happen when running commands that don't take a repo.
2011-06-24 16:30:43 +03:00
Idan Kamara
27964e7418 dispatch: do not close the request repo
Closing here means we've closed the repo passed to us in the request,
which is not our responsibility.

This is essential for bundlerepo, and possibly other localrepository
subclasses who do something in their close().
2011-06-21 17:08:21 +03:00
David Soria Parra
881ac28f17 i18n: remove translation of debug messages 2011-06-21 18:35:13 +02:00
Martin Geisler
01ba8f6e18 Backed out changeset 48c996bf6ba4
Debug messages should not be translated.
2011-06-21 14:57:17 +02:00
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