Commit Graph

1161 Commits

Author SHA1 Message Date
Augie Fackler
ad0fddea79 check-code: disallow use of dict(key=value) construction
{} literals are faster and more consistent across Python 2 and 3.

Whitelisted the one use of dict() that is using a generator expresion.
2014-03-12 13:31:27 -04:00
Augie Fackler
46b365066d synthrepo: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:12:26 -04:00
Matt Mackall
b41bd8b777 contrib: drop tmplrewrite
Needed for the 1.3 transition in 2009, no longer relevant
2014-03-01 20:08:41 -06:00
Danek Duvall
4a6ebc20e6 solaris: diff -u emits "No differences encountered"
Solaris diff -u isn't silent when two files are identical, and tests that
don't account for that will fail.  Fix those tests, and introduce a check
that prevents reintroduction.
2014-02-19 13:46:49 -08:00
Simon Heimberg
18c74b7667 help: remove last occurrences of ".. note::" without two newlines
When we add two newlines after ".. note::" translators will not see this
entry. And all versions of docutils interpret this paragraph correctly
(details in 89e31d6e438f).
2014-02-19 13:25:28 +01:00
Simon Heimberg
305a187eff tests: lines with largefile .* file://$TESTTMP also match on windows
on windows, largefile paths are written as "file:///C:/temp/...", corresponding
to "file:///$TESTTMP/..." (all three slashes shown).
But on posix systems they are written as "file:///tmp/..." corresponding to
"file://$TESTTMP/..." (only two slashes shown).

Write the glob "file:/*/" to match both versions.
2014-01-27 21:39:25 +01:00
Simon Heimberg
617e52dc43 tests: rewrite path in test-shelve.t for not being mangled on msys
msys (on windows) converets '-R bundle:.XX/XX' to '-R bundle:;.XX/XX'. Avoid
this by writing '-R bundle://.XX/XX'. This is used more often than the
alternative work arounds like '-Rbundle://.XX/XX' or '-R bundle:Y/../.XX/XX'.
2014-02-10 22:56:10 +01:00
Augie Fackler
5de383e853 fix_bytesmod: fix defects in fix_bytesmod so it produces working code
Prior to this change, the fixer did not always add the py3kcompat
import to files, and did not manage to blacklist itself.
2014-02-04 18:09:20 -05:00
Mads Kiilerich
33b57154bd import-checker: handle standard modules with arch in the filename
Installations with module names like
/usr/lib/python2.7/lib-dynload/bz2.x86_64-linux-gnu.so occurs in the wild.

Let's just ignore everything after first '.' when guessing the Python module
name.
2014-02-07 02:59:46 +01:00
Mads Kiilerich
2e81b00ce5 contrib/Makefile.python: build local Python from source
This provides an easy way to install new or old Python versions on Unixish
systems. It is mainly intended for testing Mercurial with different Python
versions.

Example:
  $ cd build
  $ make -f ../contrib/Makefile.python python PYTHONVER=2.4 PREFIX=/tmp/p24
  $ /tmp/p24/bin/python -V
  Python 2.4

Tested on Fedora, Debian and Ubuntu with Python versions from 2.4 to 2.7.6.

Most Python versions need some workarounds to compile on Debian-ish systems.
The workarounds do not do any significant harm on Fedora.
2013-02-10 00:11:45 +01:00
Mads Kiilerich
446ad18e32 import-checker: show stdlib and relative imports separately
Make the output more useful for debugging problems.
2014-02-05 01:43:51 +01:00
Mads Kiilerich
5651d48005 import-checker: fix names of dynamically loaded modules
The import checker found standard library modules such as
lib-dynload/zlibmodule.so but saw that as a 'zlibmodule' module, not as the
'zlib' module.

Debian ships Python with most modules built-in and this incorrect handling of
dynamic modules did thus not cause problems on that platform.

Fedora ships Python with as many modules as possible loaded dynamically. That
made the import checker tests fail with incorrect classification of the
following modules: array fcntl grp itertools time zlib.

This change makes test-module-imports.t pass on Fedora.
2014-02-05 01:30:33 +01:00
Steve Borho
deded2d9ba wix: pull in new templates 2014-01-23 14:06:15 -06:00
Mads Kiilerich
771c21f193 util: introduce util.debugstacktrace for showing a stack trace without crashing
This is often very handy when hacking/debugging.

Calling util.debugstacktrace('hey') from a place in hg will give something like:
  hey at:
   ./hg:38                                     in <module>
   /home/user/hgsrc/mercurial/dispatch.py:28   in run
   /home/user/hgsrc/mercurial/dispatch.py:65   in dispatch
   /home/user/hgsrc/mercurial/dispatch.py:88   in _runcatch
   /home/user/hgsrc/mercurial/dispatch.py:740  in _dispatch
   /home/user/hgsrc/mercurial/dispatch.py:514  in runcommand
   /home/user/hgsrc/mercurial/dispatch.py:830  in _runcommand
   /home/user/hgsrc/mercurial/dispatch.py:801  in checkargs
   /home/user/hgsrc/mercurial/dispatch.py:737  in <lambda>
   /home/user/hgsrc/mercurial/util.py:472      in check
...
2014-01-12 23:28:21 +01:00
Simon Heimberg
c202d2b08f check-code: print debug output when an ignore pattern matches 2014-01-07 22:29:57 +01:00
Simon Heimberg
20f36987da check-code: drop now unused check-code-ignore
Using check-code-ignore to skip the failures on a line has several
disadvantages:
 * It skips all check-code failures on a line, not only the one it was created
   for.
 * It does not give any hint for which rule it was added, making it difficult to
   see when it is not needed anymore.
So drop this pragma in favor of better alternatives promoted before.
2014-01-07 22:29:51 +01:00
Simon Heimberg
2af7eb452d check-code: explain what to do when a check-code rule mismatches
In the past several approaches were used when a check-code rule triggered
without a good reason. Not all of them looked nice, some were even wrong.
Suggest some good practices which should be used instead.
2014-01-07 22:29:44 +01:00
Simon Heimberg
8a4db51de9 check-code: always report when a file is skipped by "no-check-code"
Skipping an entire file generally from checking is an important event, so
report it always.
Do not tell the check name because skipping does not depend on it. Directly
skip the entire file instead of checking more patterns and skip again.

The pragma no-check-code was introduced by accident in the past. (Fixed in
bc3ff9741549 and aa06d5c0d698.) This now is prevented because the files
to skip have to be listed in the test output of test-check-code-hg.t.
2014-01-07 22:29:15 +01:00
Simon Heimberg
cfe498cdf6 check-code: do not skip entire file, skip only one match instead
Skipping of the entire file has been introduced in 4ff3c5cd4ae4.
2014-01-07 22:28:45 +01:00
Kevin Bullock
6a83843bd3 doc: bump copyright year 2014-01-10 16:26:11 -06:00
Pierre-Yves David
f834b74f49 perf: fix perfvolatilesets
The repoview's `filteredrevs` has been renamed to `filterrevs` at some point.
perf was never informed.
2013-12-23 16:04:51 -08:00
Augie Fackler
3dbcd046f6 import-checker: suppress check-code about any()
ast is a new enough module that this script can't work on any version
of Python without any(), so we'll just use it.
2014-01-01 17:57:48 -05:00
Augie Fackler
84d472600b import-checker: use any() and a genexp to avoid awkward for/else construction 2013-12-24 19:10:04 -05:00
Chris Jerdonek
9908f472a9 import-checker: make test-module-imports.t work using virtualenv (issue4129)
This patch modifies contrib/import-checker.py so that test-module-imports.t
will pass if run using virtualenv.  The patch achieves this by adding two
new prefixes to the list of allowable sys.path prefixes.  The added prefixes
are the directories of two modules in the stdlib.  The modules selected are
a minimal set that allowed the return value of list_stdlib_modules() to
match the return value without virtualenv, when run on the patch author's
machine: Mac OS X 10.8, Python 2.7.6.
2013-12-22 21:20:38 -08:00
Chris Jerdonek
4162c2e12f import-checker: refactor sys.path prefix check (issue4129)
This patch refactors the logic in contrib/import-checker.py responsible for
checking the beginnings of the paths in sys.path.  In particular, it adds a
variable that defines the set of allowed prefixes.

The primary purpose of this change is to make it easier to add more allowed
prefixes.  This will be useful in resolving issue4129, which involves making
the function list_stdlib_modules() work when run from a virtualenv.
2013-12-22 14:10:26 -08:00
Brodie Rao
aba805d85d perf: add perfmoonwalk command to walk the changelog backwards
This lets us test the effectiveness (or ineffectiveness) of the revlog chunk
cache when walking revlogs backwards.
2013-11-17 18:04:28 -05:00
Matt Mackall
4223982ebe merge with stable 2013-12-01 14:10:53 -06:00
Andrew Shadura
e4287fe436 hgk: fix tag list parser (issue4101)
As tags may have embedded spaces, and "hg tags" command doesn't escape them,
the output of the command doesn't make a well-formed list, so we can't just
iterate over it. Instead, apply a simple regexp to transform it to a list
which we actually use. Line boundary matching should be enabled.
2013-12-01 13:53:24 -06:00
Sean Farley
337aa76166 bash_completion: add global support for -b|--branch
Previously, only -r|--rev was parsed globally which meant 'hg push -b <tab>'
would try to complete a path instead of a branch.
2013-11-26 14:33:18 -06:00
Sean Farley
fa42f28d41 bash_completion: add global support for -B|--bookmark
Previously, only -r|--rev was parsed globally which meant 'hg push -B <tab>'
would try to complete a path instead of a bookmark.
2013-11-26 14:31:40 -06:00
Sean Farley
2c4a9fc383 bash_completion: change --rev if-else block into a case
Again, this doesn't change behavior but does make it easy to add cases in the
next patch.
2013-11-26 14:04:12 -06:00
Sean Farley
fdb3859999 bash_completion: simplify if-else logic
There is no change in functionality here but this makes refactoring this later
easier.
2013-11-26 13:55:33 -06:00
Sean Farley
dd1a68daaa bash_completion: add _hg_branches for list of branches 2013-11-25 11:38:14 -05:00
Sean Farley
894084345f bash_completion: add -B|--bookmark support for strip 2013-11-26 14:38:14 -06:00
Sean Farley
de5568a073 bash_completion: add completion for deleting a shelve 2013-11-22 14:58:41 -05:00
Martin Geisler
dc22476982 contrib: don't mention obsolete graphlog extension in mercurial.ini 2013-11-22 19:12:18 +01:00
Martin Geisler
477180c942 contrib: stop mentioning obsolete graphlog extension in sample.hgrc 2013-11-22 19:11:48 +01:00
Martin Geisler
422edf9e4c contrib: promote strip extension over MQ in sample.hgrc 2013-11-22 17:14:44 +01:00
Sean Farley
f8159f9cef bash_completion: use correct command for listing shelves
Previously, _hg_shelves used the unshelve command to list current shelves. This
is actually the wrong command. The correct usage is 'hg shelve -l' so we use
that instead.
2013-11-21 15:14:52 -05:00
Sean Farley
e43c652608 bash_completion: remove restriction on bookmark completion
Previously, we only completed a bookmark when deleting or renaming a
bookmark. Since we can now move a bookmark forward, we drop this restriction.
2013-11-20 19:13:24 -05:00
Sean Farley
a3bd83dd26 bash_completion: fix issue with subdirectories not being completed
Previously, if there was a directory between the file and first-level directory (e.g. 'bar' in
foo/bar/file), then bash_completion would only list 'foo/file' instead of 'foo/bar/file'.

This behavior was introduced in ed00ea08afda to fix spaces in file names. In
this patch, we keep that behavior while also fixing subdirectory completion by
reverting ed00ea08afda and instead add backslashes to whitespace manually. This
approach means adding the completion option 'nospace' since we do this manually
now.
2013-11-20 14:45:18 -05:00
Sean Farley
46fae822f1 bash_completion: determine root executable in case of alias
This solves an issue for users that have "alias hg='hg --some_opts'" where they
would see wrong entries in the completion output (such as color codes).
2013-11-20 13:19:55 -05:00
Sean Farley
728e53206c bash_completion: expand aliased commands 2013-11-20 15:16:54 -05:00
Sean Farley
8ef12c7d6e bash_completion: untabify 2013-11-19 11:45:30 -05:00
Simon Heimberg
a4feb953c7 check-code: prepend warning prefix only once, but for each warning
The code adding the prefix is now run once per pattern. It was run once per
file (after the change 17484f4c54fb).
Demonstrate that it is working now by extending the test. Raise two different
warnings, one of them twice.
2013-11-09 10:21:20 +01:00
Augie Fackler
cdece79d51 import-checker: try a little harder to show fewer cycles
This makes sure that all cycles begin with the lexicographically first
module, so that we're less likely to show overlapping cycles in the
final analysis.
2013-11-17 13:33:20 -05:00
Augie Fackler
7362c1b4c8 import-checker: ignore nested imports 2013-11-17 16:58:18 -05:00
Augie Fackler
acbe5bcee3 contrib: add an import checker
This checks for cycles in the module graph and verifies that imports
of stdlib modules are not on the same line as relative imports of
mercurial modules.
2013-11-17 13:04:18 -05:00
Augie Fackler
2859ed15ec subsettable: move from repoview to branchmap, the only place it's used
This is a step towards breaking an import cycle between revset and
repoview. Import cycles happened to work in Python 2 with implicit
relative imports, but breaks on Python 3 when we start using explicit
relative imports via 2to3 rewrite rules.
2013-11-06 14:38:34 -05:00
Simon Heimberg
6295e690d1 check-code: document last ignore regexp
For easier remembering to delete when it is not needed anymore.
2013-11-09 14:50:12 +01:00