Commit Graph

28205 Commits

Author SHA1 Message Date
Yuya Nishihara
3e3e4eca75 graphlog: bring back color to node symbol template
Follows up 64cf8f39aac2. A ui object is required to render labels.
2016-03-09 23:57:15 +09:00
Yuya Nishihara
0703170780 revset: add inspection data to max() and min() functions
We are likely to be interested in how these functions build a result set.
2016-02-16 21:44:13 +09:00
Yuya Nishihara
80f2bcf6b5 revset: add inspection data to limit() and last() functions
We are likely to be interested in how these functions calculate a result set.
2016-02-16 21:43:51 +09:00
Yuya Nishihara
654d7bc89a revset: stub to add extra data to baseset for better inspection
We sometimes construct a baseset from filtering result. In that case, a
baseset can provide more precise information how it is constructed.
2016-02-16 21:32:00 +09:00
Yuya Nishihara
5ec1f7ff3f revset: add inspection data to all filter() calls
This is useful for debugging revset construction.
2016-02-13 20:05:57 +09:00
Yuya Nishihara
587a07dd40 revset: add extra data to filteredset for better inspection
A filteredset is heavily used, but it cannot provide a printable information
how given set is filtered because a condition is an arbitrary callable object.

This patch adds an optional "condrepr" object that is used only by repr(). To
minimize the maintaining/runtime overhead of "condrepr", its type is overloaded
as follows:

  type      example
  --------  ---------------------------------
  tuple     ('<not %r>', other)
  str       '<branch closed>'
  callable  lambda: '<branch %r>' % sorted(b)
  object    other
2016-02-13 19:25:11 +09:00
timeless
7846832020 zeroconf: replace reduce+add with itertools.chain 2016-03-01 10:18:47 +00:00
timeless
a2c7933e41 zeroconf: replace has_key with in 2016-03-01 10:22:10 +00:00
timeless
a36c36a4d9 zeroconf: compare singleton using is 2016-03-01 09:59:58 +00:00
timeless
9c4fb14309 zeroconf: remove camelcase in identifiers 2016-03-01 09:57:45 +00:00
timeless
8236c6ab8f setup: switch to with open as
We're leaving the modulepolicy bit alone, because it's being
rewritten in the next commit.
2016-03-09 15:35:57 +00:00
timeless
2194aed867 win32mbcs: use absolute_import 2016-03-02 21:50:35 +00:00
timeless
78f32a823b notify: use absolute_import 2016-03-02 21:48:08 +00:00
timeless
3d3cc1c01c patchbomb: use absolute_import 2016-03-02 21:42:42 +00:00
timeless
0d9e787fe4 convert: __init__ use absolute_import 2016-03-02 16:34:43 +00:00
timeless
798be7b824 convert: cvs use absolute_import 2016-03-02 16:41:35 +00:00
timeless
2ac9193926 convert: transport use absolute_import 2016-03-02 16:37:50 +00:00
timeless
4bcfa639ac convert: bzr use absolute_import 2016-03-02 16:32:52 +00:00
timeless
d982b75f31 convert: common use absolute_import 2016-03-02 16:26:35 +00:00
timeless
d9aed31d36 convert: convcmd use absolute_import 2016-03-02 16:23:28 +00:00
timeless
d35bed319b convert: subversion use absolute_import 2016-03-02 16:13:05 +00:00
timeless
57b0b61ecb blackbox: guard against recursion from dirty check 2016-03-08 20:34:59 +00:00
timeless
189e3f9aca tests: divorce blackbox test from test-dispatch.py
I used test-dispatch.py to demonstrate what would happen if
a log file changed from being readonly to writable, by
having it replace a directory (proxy for readonly/not-writable)
with a log file in between transactions of a running python
process (proxy for Mercurial).

This commit makes it easier for people to follow what the test
is doing, by creating a real file that people can read.
2016-03-08 20:52:57 +00:00
timeless
8a88474c92 tests: test-dispatch use print_function 2016-03-08 20:57:40 +00:00
timeless
e113808b95 tests: test-dispatch use absolute_import 2016-03-08 20:57:15 +00:00
timeless
4ff3d8a36b templater: ignore orig/rej files
If your mercurial/templates/ directory is dirty, then the template system would
otherwise import duplicate templates from the .orig files and potentially try to
parse .rej files.

Since editing/reverting these templates isn't an unexpected action, and since
they're in .hgignore, it's best that the template system know to skip them."
2016-03-02 05:27:07 +00:00
timeless
1fcd9b7563 resolve: when pats do not match, hint about path:
Suggest a command that would probably work.
2015-12-24 04:31:34 +00:00
liscju
5a50693a7e shelve: changes getting opts values by get method
When shelve is used by another extension that doesn't
provide all necessary values in opts shelve raises
KeyError exception. This patch fixes this by getting
values from opts dictionary with get method.
2016-03-09 08:21:57 +01:00
Gregory Szorc
443b14a872 contrib: remove references to 2to3
The custom porting fixers are removed. A comment related to 2to3
has been removed from the import checker.

After this patch, no references to 2to3 remain.
2016-02-27 21:15:16 -08:00
Gregory Szorc
3e662313cc check-code: remove redundant import style check
We have a dedicated tool that checks for import conventions. Remove
a redundant and less powerful check.
2016-02-27 21:14:17 -08:00
Gregory Szorc
0a19894b15 setup: remove support for 2to3
We want to run unaltered source on multiple Python versions. We
won't be using 2to3 for Python 3 support.
2016-02-27 21:11:24 -08:00
Gregory Szorc
426b834415 run-tests: remove 2to3 support
Our goal is to have 1 code base that works on 2.6, 2.7, and 3.5+.
2to3 won't be used. Stop passing it to setup.py.
2016-02-27 21:08:37 -08:00
liscju
7a7ee3b559 histedit: adds hint how to reorder changesets at editor (issue3766) 2016-03-08 21:59:06 +01:00
FUJIWARA Katsunori
905d970f59 revset: replace predicate by revsetpredicate of registrar
To make all built-in predicates be known to hggettext, loading
built-in predicates by loadpredicate() should be placed before fixing
i18nfunctions but after all of predicate decorating.
2016-03-08 23:04:53 +09:00
FUJIWARA Katsunori
60e9ee2742 revset: replace extpredicate by revsetpredicate of registrar
This patch consists of changes below (these can't be applied
separately).

  - replace revset.extpredicate by registrar.revsetpredicate in
    extensions

  - remove setup() on an instance named as revsetpredicate in
    uisetup()/extsetup() of each extensions

    registrar.revsetpredicate doesn't have setup() API.

  - put new entry for revsetpredicate into extraloaders in dispatch

    This causes implicit loading predicate functions at loading
    extension.

    This loading mechanism requires that an extension has an instance
    named as revsetpredicate, and this is reason why
    largefiles/__init__.py is also changed in this patch.

Before this patch, test-revset.t tests that all decorated revset
predicates are loaded by explicit setup() at once ("all or nothing").

Now, test-revset.t tests that any revset predicate isn't loaded at
failure of loading extension, because loading itself is executed by
dispatch and it can't be controlled on extension side.
2016-03-08 23:04:53 +09:00
FUJIWARA Katsunori
8227e106c7 registrar: define revsetpredicate to decorate revset predicate
revsetpredicate is used to replace revset.predicate and
revset.extpredicate in subsequent patches.

This patch also adds loadpredicate() to revset, because this
combination helps to figure out how the name of safe predicate is put
into safesymbols.

This patch still uses safesymbols set to examine whether the predicate
corresponded to the 'name' is safe from DoS attack or not, because
just setting func._safe property needs changes below for such
examination.

  before:
      name in revset.safesymbols

  after:
      getattr(revset.symbols.get(name, None), '_safe', False)

"automatic registration" described in help doc of revsetpredicate
class will be achieved by the subsequent patch, which lists
loadpredicate() up in dispatch.extraloaders.
2016-03-08 23:04:53 +09:00
FUJIWARA Katsunori
e72a9be81f registrar: introduce new class for registration to replace funcregistrar
_funcregistrarbase differs from funcregistrar in points below:

  - every code paths should use same class derived from
    _funcregistrarbase to register functions in a same category

    funcregistrar expects (3rd party) extensions to use (a class
    derived from) delayregistrar.

  - actual extra setup should be executed in another function

    For example, marking revset predicate as "safe" is executed in a
    class derived from _funcregistrarbase, but putting name of "safe"
    predicate into safesymbols is executed in another function for it.

    funcregistrar expects derived classes to do so.

New class is named as module private one, because code paths, which
register functions, should use not it directly but one derived from
it.
2016-03-08 23:04:53 +09:00
FUJIWARA Katsunori
f9e776bc8b dispatch: make loading extra information from extension extensible
This patch makes loading extra information from extension module at
dispatching extensible. Factoring 'loadcmdtable()' into commands.py is
a part of generalization of loading extra information.

This extensibility assumes registration of new function like below,
for example:

  - revset predicate
  - fileset predicate
  - template keyword
  - template filter
  - template function
  - internal merge tool
  - web command

This patch requires not loader function itself but container module
and the name of it, because listing loader function directly up
implies actual loading module of it, even if it isn't used at runtime
(for example, extensions don't always define revset predicate)
2016-03-08 23:04:53 +09:00
Durham Goode
f5bc3ca716 parsers: optimize filtered headrevs logic
The old native head revs logic would iterate over every node, starting from 0,
and check if every node was filtered (by testing it against the filteredrevs
python set). On large repos with hundreds of thousands of commits, this could
take 150ms.

This new logic iterates over the nodes in reverse order, and skips the filtered
check if we've seen an unfiltered child of the node. This saves approximately a
bagillion filteredrevs set checks, which shaves the time down from 150ms to
20ms during every branch cache write.
2016-03-08 00:20:08 -08:00
FUJIWARA Katsunori
9edf9953ec destutil: choose non-closed branch head at first (BC)
Before this patch, destupdate() returns the tipmost (descendant)
branch head regardless of closed or not. But updating to closed branch
head isn't reasonable for ordinary workflow, because:

  - "hg heads" doesn't show closed heads (= updated parent itself) by
    default

  - subsequent committing on it re-opens closed branch

    even if inactivation of closed head is needed, update destination
    isn't it, because it should be merged into to another branch in
    such case.

This patch chooses non-closed descendant branch head as default update
destination at first. If all descendant branch heads are closed,
destupdate() returns the tipmost closed branch head.

For simplicity, this patch chooses adding _destupdatebranchfallback()
instead largely changing _destupdatebranch().

This patch changes not only normal lookup code path, but also the "no
default branch" code path, for consistency.
2016-03-07 03:14:19 +09:00
Kostia Balytskyi
e31d7d20ae formatter: make labels work with templated output
To describe the bug this fix is addressing, one can do
   ``$ hg status -T "{label('red', path)}\n" --color=debug``
and observe that the label is not applied before my fix and applied with it.
2016-03-08 04:08:33 -08:00
timeless
dd989dbe5f hghave: improve description of Hypothesis 2016-03-08 14:32:03 +00:00
timeless
8f60984480 purge: use absolute_import 2016-03-02 21:39:55 +00:00
timeless
9df52ee9f1 record: use absolute_import 2016-03-02 21:38:32 +00:00
timeless
37728f6a24 relink: use absolute_import 2016-03-02 21:36:14 +00:00
timeless
bf3fcbb8c7 schemas: use absolute_import 2016-03-02 21:33:55 +00:00
timeless
067d78e42f shelve: use absolute_import 2016-03-02 21:30:51 +00:00
timeless
fe1b5c51ca strip: use absolute_import 2016-03-02 21:26:36 +00:00
Martijn Pieters
a7c9554a48 graphmod: augment the graph to include more information about the edges
The walker knows when an edge leads to a direct parent, a grandparent (skipping
revisions not part of the revset) and parents that are missing altogether
(neither it nor a grandparent is in the revset). Add this information to the
parents sequence yielded.
2016-03-04 14:44:32 +00:00
Martijn Pieters
a973afd498 graphmod: refactor state handling
Move ASCII graph state to a dictionary, to clarify what is being tracked. Move
the 'seen' state (tracking currently active edges) into this structure.
2016-03-04 14:44:32 +00:00