Commit Graph

22787 Commits

Author SHA1 Message Date
Pierre-Yves David
98513b6f74 generatorset: implement first and last methods 2014-10-06 12:52:36 -07:00
Pierre-Yves David
0a7da549e2 addset: implement first and last methods
The implementation is non-lazy for now. One may want to make it more lazy in the
future.
2014-10-06 11:57:59 -07:00
Pierre-Yves David
0567fe01bf spanset: implement first and last methods 2014-10-06 11:54:53 -07:00
Pierre-Yves David
798e6b00b0 smartset: add first and last methods
In multiple places in the code, we use `someset[0]` or `someset[-1]`. This
works only because the `someset` is usually a baseset. For the same reason we
introduce a `first` and `last` methods to be implemented for all smartset
classes.
2014-10-06 11:46:53 -07:00
Pierre-Yves David
b73c13bbd6 getgraphlogrevs: remove user of baseset.append
A `baseset` has multiple cached results and will get even more in the future.
Making it an object "populated once" like the other smartsets makes it both safer
and simpler. The append method will be removed at some point.
2014-10-07 00:20:00 -07:00
Pierre-Yves David
cac69b710e getlogrevs: remove user of baseset.append
A `baseset` has multiple cached results and will get even more in the future.
Making it an object "populated once" like the other smartsets makes it both safer
and simpler. The append method will be removed at some point.
2014-10-07 00:04:16 -07:00
Pierre-Yves David
a814455e99 revset-last: remove user of baseset.append
A `baseset` has multiple cached results and will get even more in the future.
Making it an object "populated once" like the other smartsets makes it both safer
and simpler. The append method will be removed at some point.
2014-10-08 00:55:09 -07:00
Pierre-Yves David
e7663a53cd revset-limit: remove user of baseset.append
A `baseset` has multiple cached results and will get even more in the future.
Making it an object "populated once" like the other smartsets makes it both safer
and simpler. The append method will be removed at some point.
2014-10-06 10:57:01 -07:00
Pierre-Yves David
828936e45f mq: use revs.sort() to ensure the set is ascending
Sorting is super-cheap with the new smartset class, so we can use it to enforce
the order. Otherwise all smartset classes would have to allow direct indexing.
2014-10-07 00:12:56 -07:00
Pierre-Yves David
9f5274f4bc baseset: use default value instead of [] when possible
For pure cleanup purposes, we replace all the occurences of `baseset([])` with
`baseset()`.
2014-10-06 10:41:43 -07:00
Pierre-Yves David
a046529f73 generatorset: implement isascending and isdescending 2014-10-04 06:17:18 -07:00
Pierre-Yves David
d4b459bd9f generatorset: explicitly track iteration order
The expected iteration order may be different than the fast iteration order (eg:
ancestors(42) is expected to be iterated upward but is fast/lazy to compute
downward.

So we explicitly track the iteration order and enforce it if the manual
iteration is requested.

Default expected iteration order of a generator set is ascending because I'm
not aware of any descending revset that need a generatorset. The first to find
such descending revset will have the pleasure to make this configurable.
2014-10-03 21:11:56 -07:00
Pierre-Yves David
a82beab10d addset: drop caching through generatorset
The utility of this cache is debatable (no visible benchmark impact) and using
generatorset for such purpose makes the code complicated.

We drop it for now. Someone can reintroduce a smart version of it in the future
if it is detected to be relevant.
2014-10-03 20:23:02 -07:00
Pierre-Yves David
e6831448a3 generatorset: get list-based fast iterations after the generator is consumed
When all revisions are known, we shortcut most of the class logic to use list
iteration instead. The cost of the sort is expected to be non-significant. The
list creation and sorting could be done lazily in the future. We have to copy
the list to not break existing iterator created before we finished consuming the
generator.
2014-10-03 21:01:30 -07:00
Pierre-Yves David
1d2cf353fc generatorset: move iteration code into _iterator
_iterator handles the generator iteration. The `__iter__` method will need
changes to handle ordering-related information.
2014-10-03 20:48:28 -07:00
Pierre-Yves David
a0f1c697e2 generatorset: stop using a base as the _genlist
It does not add anything and makes it more complicated to have a simple baseset
implementation.
2014-10-03 20:43:48 -07:00
Pierre-Yves David
9d3c052ee3 generatorset: drop the leading underscore in the class name
This is a real smart set now.
2014-10-03 20:12:02 -07:00
Pierre-Yves David
dc2b8470bf generatorset: update the docstring now that it is a smartset
The documentation was still stating that this class was not a smartset. We drop
that part.
2014-10-03 20:14:43 -07:00
Pierre-Yves David
ccc0b916ad addset: drop the leading underscore from the class name
This class is now a real smartset.
2014-10-03 20:18:48 -07:00
Pierre-Yves David
e434af74be addset: this is a smartset, update the docstring
The documentation was still stating that this class is a not a smartset. We drop
that part.
2014-10-03 20:17:12 -07:00
Pierre-Yves David
d1e22facbe addset: use the ascending argument in _iterordered
Fix a bug where fastasc and fastdesc were iterator in the same order as
self._ascending.
2014-10-09 05:27:23 -07:00
Matt Mackall
0146d3ccb5 rebase: add help examples 2014-10-08 14:03:07 -05:00
Matt Mackall
22f04735c2 rebase: attempt to clarify --base 2014-10-08 13:40:50 -05:00
Augie Fackler
541b5c0392 manifest: rearrange add() method and add comments for clarity
Omit the check of bool(p1) since it's always true in practice: it will
either be nullid or some valid manifest sha, and we know nullid won't
ever be in the cache so we can simplify understanding of this code.
2014-10-08 12:59:11 -04:00
Augie Fackler
d3360906bf manifest: simplify manifest.add() by making args required
I verified that changed was never false (it was always a 2-tuple) by
adding

@@ -220,6 +225,8 @@ class manifest(revlog.revlog):

     def add(self, map, transaction, link, p1=None, p2=None,
             changed=None):
+        if not changed:
+            assert False, 'changed was %r' % changed
         # if we're using the cache, make sure it is valid and
         # parented by the same node we're diffing against
         if not (changed and p1 and (p1 in self._mancache)):

and observing that the test suite still passed. Making all the
arguments required should help future readers understand what's going
on here.
2014-10-08 11:52:30 -04:00
Matt Mackall
8352e734a1 Added signature for changeset a9cf27087b11 2014-10-01 14:59:33 -05:00
Matt Mackall
d9617ffd58 merge with i18n 2014-10-01 12:35:18 -05:00
Jordi Gutiérrez Hermoso
678a04feed diff: document the nobinary option
Since ce44c3c7c2be, we have a diff.nobinary option. This is handy, but
the only way I found out about it was by looking at the release notes
for 3.1, which is not something I normally do.
2014-09-30 16:59:07 -04:00
Wagner Bruna
0be158ded2 i18n-pt_BR: minor fixes and rewording on histedit help text 2014-09-30 13:43:30 -03:00
Yuya Nishihara
525193c247 templater: fix precedence of --style and --template options
Since 266cfa7de44d, --template option is ignored if --style is specified,
which is wrong according to the doc of show_changeset():

    Display format will be the first non-empty hit of:
    1. option 'template'
    2. option 'style'
    ...
2014-09-30 23:15:56 +09:00
Wagner Bruna
61b30f0d0e i18n-pt_BR: synchronized with d307c14fbf45 2014-09-30 10:17:59 -03:00
Wagner Bruna
60436bc97f merge with i18n 2014-09-30 10:13:25 -03:00
Anton Shestakov
1119de7215 hgweb: refresh hgweb.repo on phase change (issue4061)
Make hgweb.refresh() also look at phaseroots file (in addition to 00changelog.i
file) and reload the repo when os.stat returns different mtime or size than
cached, signifying the file was modified.

This way if user changes phase of a changeset (secret <-> draft), there's no
need to restart hg serve to see the change.
2014-09-27 21:59:55 +09:00
Matt Mackall
5f07bb0a47 help: fix typo in log examples 2014-09-29 16:42:12 -05:00
Augie Fackler
43d13e71a7 manifest: move manifest parsing to module-level
We'll need this in the sharded manifest hashing routine, and I need to
tweak it anyway, so make it module-level now.
2014-09-25 14:13:31 -04:00
Augie Fackler
b2278203f5 revlog: move references to revlog.hash to inside the revlog class
This will make it possible for subclasses to have different hashing
schemes when appropriate. I anticipate using this in manifests.

Note that there's still one client of mercurial.revlog.hash() outside
of revlog: mercurial.context.memctx uses it to construct the file
entries in an in-memory manifest. I don't think this will be a problem
in the immediate future, so I've left it as-is.
2014-09-24 15:14:44 -04:00
Augie Fackler
44b8666b93 revlog: mark nullhash as module-private
No other module should ever need this, so mark it with _ so nobody
tries to use it.
2014-09-24 15:10:52 -04:00
Yuya Nishihara
2f53d7a8aa ui: disable echo back of prompt input if ui is set to non-tty purposely
d735f8a82023 is nice for test output, but it also affects command-server
channel.  Command-server client shouldn't receive echo-back message, which
makes it harder to parse the output.
2014-10-08 20:51:01 +09:00
Siddharth Agarwal
0b13ea03ab dirstate: cache util.normcase while constructing the foldmap
This is a small win on OS X. hg perfdirstatefoldmap:

before: wall 0.399708 comb 0.410000 user 0.390000 sys 0.020000 (best of 25)
after:  wall 0.386331 comb 0.390000 user 0.370000 sys 0.020000 (best of 25)
2014-10-03 18:48:09 -07:00
Siddharth Agarwal
c72f8412c6 normcase: for darwin, use fast ASCII lower
Constructing the foldmap is much faster on OS X now. For a large real-world
repo, hg perfdirstatefoldmap:

before: wall 0.805278 comb 0.800000 user 0.790000 sys 0.010000 (best of 13)
after:  wall 0.399708 comb 0.410000 user 0.390000 sys 0.020000 (best of 25)

This is a nice boost to 'hg status', especially with the third-party hgwatchman
extension enabled (which eliminates stat calls). For the above repo, 'hg
status' goes from 1.17 seconds to 0.74.
2014-10-03 18:47:28 -07:00
Siddharth Agarwal
6a0b47b797 perf: add a way to measure the perf of constructing the foldmap
Constructing the foldmap is a necessary part of operations like 'hg status' on
OS X. This command allows us to measure the perf of constructing it.
2014-10-03 19:58:26 -07:00
Siddharth Agarwal
8298f08c96 encoding.lower: use fast ASCII lower
This benefits, among other things, the case collision auditor.

On a Linux system with a large real-world repo where all filenames are ASCII,
hg perfcca:

before: wall 0.260157 comb 0.270000 user 0.230000 sys 0.040000 (best of 38)
after:  wall 0.164616 comb 0.160000 user 0.160000 sys 0.000000 (best of 54)
2014-10-03 18:45:56 -07:00
Siddharth Agarwal
e56ab5399b parsers: add a function to efficiently lowercase ASCII strings
We need a way to efficiently lowercase ASCII strings. For example, 'hg status'
needs to build up the fold map -- a map from a canonical case (for OS X,
lowercase) to the actual case of each file and directory in the dirstate.

The current way we do that is to try decoding to ASCII and then calling
lower() on the string, labeled 'orig' below:

    str.decode('ascii')
    return str.lower()

This is pretty inefficient, and it turns out we can do much better.

I also tested out a condition-based approach, labeled 'cond' below:

    (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c

'cond' turned out to be slower in all cases. A 256-byte lookup table with
invalid values for everything past 127 performed similarly, but this was less
verbose.

On OS X 10.9 with LLVM version 6.0 (clang-600.0.51), the asciilower function
was run against two corpuses.

Corpus 1 (list of files from real-world repo, > 100k files):
orig:   wall 0.428567 comb 0.430000 user 0.430000 sys 0.000000 (best of 24)
cond:   wall 0.077204 comb 0.070000 user 0.070000 sys 0.000000 (best of 100)
lookup: wall 0.060714 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)

Corpus 2 (mozilla-central, 113k files):
orig:   wall 0.238406 comb 0.240000 user 0.240000 sys 0.000000 (best of 42)
cond:   wall 0.040779 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
lookup: wall 0.037623 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)

On a Linux server-class machine with GCC 4.4.6 20120305 (Red Hat 4.4.6-4):

Corpus 1 (real-world repo, > 100k files):
orig:   wall 0.260899 comb 0.260000 user 0.260000 sys 0.000000 (best of 38)
cond:   wall 0.054818 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)
lookup: wall 0.048489 comb 0.050000 user 0.050000 sys 0.000000 (best of 100)

Corpus 2 (mozilla-central, 113k files):
orig:   wall 0.153082 comb 0.150000 user 0.150000 sys 0.000000 (best of 65)
cond:   wall 0.031007 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
lookup: wall 0.028793 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)

SSE instructions might help even more, but I didn't experiment with those.
2014-10-03 18:42:39 -07:00
Martin von Zweigbergk
60c55cc10d match: remove unnecessary setting of self._always
The 'always' class calls its parent constructor with an empty list of
patterns, which will result in a matcher that always matches. The
parent constructor will set self._always to True in such cases, so
there is no need to set it again.
2014-09-30 15:58:08 -07:00
Yuya Nishihara
5079a4aa16 bookmarks: port to generic templater 2014-10-03 00:43:22 +09:00
Yuya Nishihara
9ea06d6a89 bookmarks: split ui.write() so that it can be easily ported to formatter api
Test output changes because color labels are applied separately.
2014-10-03 00:36:36 +09:00
Yuya Nishihara
aa2e66b72c bookmarks: iterate bookmarks list even if it is known to be empty
This clarifies that "no bookmarks set" is displayed in addition to the list
of bookmarks.  In JSON output, for example, [] should be written if empty,
and "no bookmarks set" message should be skipped.
2014-10-03 00:15:39 +09:00
David Soria Parra
fdc87e21e5 repoview: remove hiddencache verification
We have been running hiddencache verification since 3.1.1 and so
far not received a bug report concerning it. Therefore we remove
the verification code and make the hiddencache authoritive. That
way we get the intended speedup.
2014-10-06 07:29:40 -07:00
Jordi Gutiérrez Hermoso
88894fbfa7 color: reorganise and sectionify the help text
The color docstring was getting long. This splits it up into
bite-sized sections and rearranges the order of the paragraphs a
little to match these sections.
2014-10-06 08:18:03 -04:00
Jordi Gutiérrez Hermoso
6a56d95986 color: update description of the extension
The color extension long ago ceased to work only for the status and
qseries commands.
2014-10-06 08:16:40 -04:00