Commit Graph

32287 Commits

Author SHA1 Message Date
Yuya Nishihara
4a4dca2dbc cat: do not start pager if output will be written to file 2017-05-27 18:52:46 +09:00
Yuya Nishihara
1d54e26edc cat: pass filename template as explicit argument
I'll move the handling of the '-' filename to commands.cat().
2017-05-27 18:50:05 +09:00
Yuya Nishihara
3070054965 cmdutil: extract function checking if pattern should be taken as stdin/out
This will be used in commands.cat().
2017-05-25 21:28:08 +09:00
Yuya Nishihara
c171e2c0bc cmdutil: drop deprecated hack to pass file object to makefileobj() (API)
All callers pass a string 'pat' or None.
2017-05-25 21:25:49 +09:00
Yuya Nishihara
97a0e41896 encoding: make sure "wide" variable never be referenced from other modules
Better to not expose (maybe-) unicode objects.
2017-05-29 21:57:51 +09:00
Augie Fackler
cdf974c00c manifest: use itertools.chain() instead of + for Python 3 compat
This is all pure-Python code, so I'm not too worried about perf here,
but we can come back and fix it should it be a problem.

With this change, the manifest code passes most unit tests on Python 3
(once the tests are corrected with many b prefixes. I've got a little
more to sort out there and then I'll mail that change too.
2017-05-28 21:29:58 -04:00
Augie Fackler
83192b065a manifest: fix some pure-Python parser bits to work on Python 3 2017-05-28 21:29:15 -04:00
Augie Fackler
2043a66a56 tests: make test-manifest finish importing in Python 3
The test is still broken, but now it executes.
2017-05-28 18:08:36 -04:00
Augie Fackler
55330be1b5 tests: drop assertIn polyfill now that we're 2.7-only 2017-05-28 18:08:14 -04:00
Gregory Szorc
21a83ae27a perf: benchmark command for revlog indexes
We didn't have explicit microbenchmark coverage for loading revlog
indexes. That seems like a useful thing to have, so let's add it.

We currently measure the low-level nodemap APIs. There is room to
hook in at the actual revlog layer. This could be done as a follow-up.

The hackiest thing about this patch is specifying revlog paths.
Other commands have arguments that allow resolution of changelog,
manifest, and filelog. I needed to hook in at a lower level of
the revlog API than what the existing helper functions to resolve
revlogs allowed. I was too lazy to write some new APIs. This could
be done as a follow-up easily enough.

Example output for `hg perfrevlogindex 00changelog.i` on my
Firefox repo (404418 revisions):

! revlog constructor
! wall 0.003106 comb 0.000000 user 0.000000 sys 0.000000 (best of 912)
! read
! wall 0.003077 comb 0.000000 user 0.000000 sys 0.000000 (best of 924)
! create index object
! wall 0.000000 comb 0.000000 user 0.000000 sys 0.000000 (best of 1803994)
! retrieve index entry for rev 0
! wall 0.000193 comb 0.000000 user 0.000000 sys 0.000000 (best of 14037)
! look up missing node
! wall 0.003313 comb 0.000000 user 0.000000 sys 0.000000 (best of 865)
! look up node at rev 0
! wall 0.003295 comb 0.010000 user 0.010000 sys 0.000000 (best of 858)
! look up node at 1/4 len
! wall 0.002598 comb 0.010000 user 0.010000 sys 0.000000 (best of 1103)
! look up node at 1/2 len
! wall 0.001909 comb 0.000000 user 0.000000 sys 0.000000 (best of 1507)
! look up node at 3/4 len
! wall 0.001213 comb 0.000000 user 0.000000 sys 0.000000 (best of 2275)
! look up node at tip
! wall 0.000453 comb 0.000000 user 0.000000 sys 0.000000 (best of 5697)
! look up all nodes (forward)
! wall 0.094615 comb 0.100000 user 0.100000 sys 0.000000 (best of 100)
! look up all nodes (reverse)
! wall 0.045889 comb 0.050000 user 0.050000 sys 0.000000 (best of 100)
! retrieve all index entries (forward)
! wall 0.078398 comb 0.080000 user 0.060000 sys 0.020000 (best of 100)
! retrieve all index entries (reverse)
! wall 0.079376 comb 0.080000 user 0.070000 sys 0.010000 (best of 100)
2017-05-28 11:13:10 -07:00
Gregory Szorc
845664d2aa perf: rename perfrevlog to perfrevlogrevisions
We have a couple of commands beginning with "perfrevlog." The
actual "perfrevlog" command actually measures resolving the fulltext
of multiple revisions. So let's rename it to reflect what it actually
does.
2017-05-28 10:56:28 -07:00
Augie Fackler
e49ffa58a6 server: use pycompat to get argv 2017-05-28 15:43:26 -04:00
Augie Fackler
0d4ce4ae60 encoding: make wide character class list a sysstr
That's what east_asian_width returns, so just match it.
2017-05-28 13:27:29 -04:00
Augie Fackler
fa101cc823 cmdutil: use sorted(dict) instead of x = dict.keys(); x.sort()
The former both does less work and has the virtue of working on Python 3.
2017-05-28 14:02:14 -04:00
Augie Fackler
544ce9f54d util: look for empty-sysstr instead of empty-bytesstr in textwrap code
Fixes behavior on Python 3.
2017-05-28 16:17:43 -04:00
Augie Fackler
a2d8d347df minirst: look for column delimiters using slices instead of indicies
This works on both Python 2 and 3.
2017-05-28 15:47:43 -04:00
Augie Fackler
daa802d908 minirst: grab a byte, not an int, for the underline style 2017-05-28 13:36:02 -04:00
Augie Fackler
6fdf576b44 minirst: use bytes.strip instead of str.strip 2017-05-28 13:41:42 -04:00
Pulkit Goyal
9b6f1eb5d7 py3: use pycompat.bytestr so that we don't get ascii values
This fixes `hg files 'set:(**.py)'` which makes test-check-py3-compat.t able to
run on Python 3. So if you now do `python3 ./run-tests.py
test-check-py3-compat`, the test will actually run.
2017-05-29 16:21:15 +05:30
Pulkit Goyal
1bcf30c9f1 py3: update test-check-py3-compat.t 2017-05-29 16:08:37 +05:30
Augie Fackler
9b41371db4 loader: pywatchman appears to already be py3 compatible
Our loader was doing some confusing things in pywatchman, but it looks
like we shouldn't be using it there anyway.
2017-05-28 15:45:47 -04:00
Augie Fackler
5eec184f61 py3: update test expectations for py3-commands test 2017-05-28 17:02:24 -04:00
Jun Wu
f7e72658ec context: do not cache manifestctx
This will make sure when ctx.repo.manifestlog changes, a correct new
manifestctx is returned. repo.manifestlog takes care of caching so the
manifestctx won't be reconstructed every time.
2017-05-25 17:20:43 -07:00
Jun Wu
716a09c254 test-context: add a case demonstrating manifest caching problem
This issue was discovered when testing absorb on Windows. What happens are:

  1. ctx.p1().manifestctx gets cached.
     let's call ctx.p1().manifestctx._revlog() "mrevlog1"
  2. repo.manifestlog gets invalidated.
     let's call repo.manifestlog._revlog "mrevlog2"
  3. repo.commitctx(ctx)
     commitctx uses ctx.p1().manifestctx and writes to "mrevlog1"
  4. repo[n].manifest()
     cannot find the manifest node in "mrevlog2"

This patch adds a test case to reproduce the issue.
2017-05-25 17:06:32 -07:00
Pierre-Yves David
b594eddde5 debugbundle: display the content of obsmarkers parts
We parse and display the markers in the part when possible.
2017-05-25 16:50:46 +02:00
Pierre-Yves David
8873a232c1 bundle: add an experimental knob to include obsmarkers in bundle
The "hg bundle" command is a good place to test if the inclusion of obsmarkers
within a bundle is working well (part exists, content is correct etc). So we
add a way to have them included.

Ideally, this would be controlled by a change around bundlespec (bundlespec
"v3" + arguments). However, my main goal is to have obsmarkers included in
bundle created by the 'hg strip' command, not the 'hg bundle' so for now I'm
avoiding the detour through bundlespec rework territory.

Better debug output for obsmarkers in 'debugbundle' will be added in later
changesets. The 'test-obsolete-bundle-strip.t' test will also get updated in a
later changeset to keep the current changeset smaller.
2017-05-28 11:50:43 -07:00
Pierre-Yves David
ffd8983573 bundle2: move function building obsmarker-part in the bundle2 module
We move it next to similar part building functions. We will need it for the
"writenewbundle" logic. This will allow us to easily include obsmarkers in
on-disk bundle, a necessary step before having `hg strip` also operate on
markers.

(Yes, the bundle2 module was already too large, but there any many
interdependencies between its components so it is non-trivial to split, this is
a quest for another adventure.)
2017-05-28 11:48:18 -07:00
Yuya Nishihara
c52484bc8a policy: remove unused policynoc and policynocffi constants 2017-05-02 21:45:48 +09:00
Yuya Nishihara
ec67ed9553 cffi: remove superfluous "if True" blocks 2017-05-02 21:45:10 +09:00
Yuya Nishihara
720bf3b0d8 cffi: split modules from pure
The copyright lines are updated per change history.

cffi/osutil.py isn't tested since I have no access to OS X machine right now,
sorry.
2017-05-02 21:15:31 +09:00
Yuya Nishihara
9fb4289a5c policy: extend API version checks for cffi
This is just a stub for future extension. I could add a version constant to
CFFI modules by putting it to both ffi.set_source() and ffi.cdef(), but that
doesn't seem right. So for now, cffi modules will be explicitly unversioned
(i.e. version constant must be undefined or set to None.) We can revisit it
later when we need to consider CFFI support more seriously.
2017-05-28 15:45:52 +09:00
Yuya Nishihara
cde823009a filterpyflakes: allow reexporting pure symbols from cffi modules
cffi modules will do 'from ..pure.<module> import *'.
2017-05-28 17:36:01 +09:00
Yuya Nishihara
b44d32013d import-checker: guess names of C extension modules
Since extension modules aren't included in the list of source files, they
need to be populated somehow. Otherwise the import from cext/cffi would be
treated as a global one.
2017-05-02 22:28:18 +09:00
Yuya Nishihara
a603182b94 import-checker: convert localmods to a set of module names
This makes it easy to add a source-less module name to the set.
2017-05-28 15:21:18 +09:00
Yuya Nishihara
b28bfa196a import-checker: allow importing symbols from pure modules
This allows us to re-export pure functions from cffi modules:

  # mercurial/cffi/base85.py
  from ..pure.base85 import *
2017-05-02 22:24:57 +09:00
Yuya Nishihara
fa3c51ef73 cffi: put compiled modules into mercurial.cffi package
Don't pollute the top-level namespace.
2017-05-02 21:08:38 +09:00
Yuya Nishihara
5cccfd11fb cffi: rename build scripts
This frees up cffi package for modules to be split from pure.
2017-05-02 21:04:40 +09:00
Martin von Zweigbergk
882acf90e8 match: remove support for includes from patternmatcher
Includes (and excludes) are now delegated to the includematcher.
2017-05-19 11:44:05 -07:00
Martin von Zweigbergk
19566696b9 match: simplify includematcher a bit
The "include" we have in symbols is redundant and the double negative
in visitdir() can be removed.
2017-05-22 23:31:15 -07:00
Martin von Zweigbergk
66dd6b9e1c match: remove support for non-include patterns from includematcher
The includematcher will always get at least one include pattern and
will never get any non-include patterns, so we can remove most of the
code in it. This patch does mostly straight-forward deletions of
code. We will clean up further later.
2017-05-19 13:36:34 -07:00
Martin von Zweigbergk
1ba59afc49 match: split up main matcher into patternmatcher and includematcher
At this point the includematcher is an exact copy of the main matcher
class. We will specialize and simplify both classes in the following
patches. This initial unmodified copy is just to make the differences
clearer. We also rename the main matcher to "patternmatcher" for
consistency.

I may eventually merge this new includematcher back into the main
matcher, but I think doing it this way makes the intermediate steps
clearer regardless.
2017-05-19 22:36:14 -07:00
Martin von Zweigbergk
ce94f073cb match: remove support for exact matching from main matcher class
Exact matching is now handled by the exactmatcher class.

We can safely remove _files from the __repr__() implementation,
because even though the field is set, the patternspat field is enough
for the representation to be unambiguous (which was not the case when
the matcher could handle exact matches).
2017-05-18 23:39:39 -07:00
Martin von Zweigbergk
6cc2daf5d6 match: handle exact matching using new exactmatcher 2017-05-17 09:26:15 -07:00
Martin von Zweigbergk
5e8aba2103 merge: use intersectmatchers() in "m2-vs-ma optimization"
It doesn't seem like this can actually happen, but seems like cleaner
anyway.
2017-05-12 16:33:33 -07:00
Martin von Zweigbergk
7767620115 match: handle includes using new intersectionmatcher 2017-05-12 23:12:05 -07:00
Martin von Zweigbergk
8a54c0d671 match: move entire uipath() implementation to basematcher
Even though most matchers will always want to use the relative path in
uipath(), when we add support for intersecting matcher, we will want
to control which form to use for any kind of matcher without knowing
the type (see next patch), so we need the implementation on the base
class.

Also rename the attribute from "pathrestricted" to "relativeuipath"
since there actually are cases where we match everything but still use
relative paths (like when the user runs "hg files .." from inside
mercurial/).
2017-05-25 14:32:56 -07:00
Pierre-Yves David
35e577df8a local-clone: also copy tags related caches
This caches provide a large speedup for some repositories. Keeping it around is
valuable.
2017-05-25 12:09:09 +02:00
Pierre-Yves David
540a8c90f4 local-clone: also copy revs-branch-cache files
This cache provides a large speedup for some repositories. Keeping it around is
valuable.
2017-05-25 12:05:33 +02:00
Pierre-Yves David
2fbd792e60 local-clone: extract the listing of caches to copy
Right now, the clone only copies the branchmap caches. There are multiple
other valuable caches that we should copy and extensions might add their own.
So we add a function to list the cache files to copy from the repository. The
repository argument is unused but extensions will want it.
2017-05-25 11:59:07 +02:00
Pierre-Yves David
d09b0ef1ef local-clone: extract the closure copying caches
Closures often get on the way. They are not much value in having that as a
closure so I'm extracting it at the module level.
2017-05-25 11:55:00 +02:00