Commit Graph

18583 Commits

Author SHA1 Message Date
Augie Fackler
dad740cf16 help: convert dict to strkwargs 2017-05-28 13:28:41 -04:00
Augie Fackler
2f5077fef1 util: use sysstr.join instead of bytes.join in textwrap wrapper 2017-05-28 13:42:16 -04:00
Yuya Nishihara
477ffb0437 match: define exactmatcher.matchfn statically
This should eliminate the reference cycle, self.matchfn -> self.exact -> self.
2017-05-28 23:54:31 +09:00
Yuya Nishihara
b7251d7b93 match: remove override of prefix() from differencematcher
It's exactly the same as basematcher.prefix().
2017-05-28 23:51:30 +09:00
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
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
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
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
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
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
Pierre-Yves David
1a819b73cb obsolete: fix relevant-obsmarkers computation on pruned changeset
The markers pruning a node was not directly considered relevant for the pruned
node, only to its parents.

This went unnoticed during obsmarkers exchange because all
ancestors of the pruned node would be included in the computation.
This still affects obsmarkers exchange a bit since "inline" prune markers would
be ignored (see second test case). This went unnoticed, because in such case,
we always push another obsolescence markers for that node.

We add explicit tests covering this case.

(The set of relevant changeset is use in the obsmarkers discovery protocol used
in the evolve experimental extension, the impact will be handled on the
extension side).
2017-05-25 19:37:29 +02:00
Siddharth Agarwal
51c7d417b5 annotate: add a new experimental --skip option to skip revs
This option is most useful for mechanical code modifications, especially ones
that retain the same number of lines.
2017-05-24 19:39:33 -07:00
Siddharth Agarwal
259f128038 annotate: add core algorithm to skip a rev
The core algorithm is inspired by git hyper-blame, implemented at
https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/master/git_hyper_blame.py.

The heuristic is as documented in the comments.
2017-05-24 19:07:14 -07:00
Siddharth Agarwal
19daf128b1 annotate: make pair take all parents to pair against
In upcoming patches we'll need to be aware of all parents at the same time.

This also exposes a potential bug: if a line can be annotated with both parents
of a merge commit, it'll always be annotated with p2, not p1. I'm not sure if
that's what we want, but at least the code makes it clear now.
2017-05-24 17:40:08 -07:00
Siddharth Agarwal
136c8f6192 annotate: move pair function to top level
We'll want to make this more complicated and have unit tests for it in upcoming
patches.
2017-05-24 17:38:28 -07:00
Yuya Nishihara
6f42d09a39 bookmarks: fix check of hash-like name to not abort by ambiguous identifier
'mark in repo' may raise LookupError. I set it to not be warned since bookmark
names shorter than 4 chars aren't checked and short names are likely to be
ambiguous.
2017-05-25 23:20:00 +09:00
Yuya Nishihara
75533e6603 localrepo: document that __contains__() may raise LookupError 2017-05-25 23:18:02 +09:00