Commit Graph

106 Commits

Author SHA1 Message Date
Yuya Nishihara
f0fc1531a4 parser: stabilize output of prettyformat() by using byte-safe repr()
The format of leaf nodes is slightly changed so they look more similar to
internal nodes.
2017-09-03 21:17:25 +09:00
Augie Fackler
6fec0d4521 tests: update test-glog to pass our import checker 2017-08-22 15:51:18 -04:00
Boris Feld
c886c86073 test: update evolution config
evolution* config has been rewritten in stabilization* in the previous patch,
update tests file to use the new names.

Differential Revision: https://phab.mercurial-scm.org/D249
2017-08-04 18:41:16 +02:00
Augie Fackler
9a0414f5ae tests: clean up many print statements to be print functions instead
Differential Revision: https://phab.mercurial-scm.org/D294
2017-06-15 14:22:25 -04:00
Boris Feld
b989852f8f debugobsolete: also report the number of obsoleted changesets
This seems useful to have the number of obsoleted changesets when calling
debugobsolete.
2017-07-16 02:33:14 +02:00
Boris Feld
f7e21a1d7c util: raise ParseError when parsing dates (BC)
d46a7814be5f refactored util.parsedate in order to raise ValueError instead
of Abort for using with ui.configwith. It causes several problems, putting
arbitrary bytes in ValueError can cause issues with Python 3. Moreover, we
added a function to convert ValueError exceptions back to Abort.

A better approach would be to make parsedate raises ParseError, removing
the convert function and update configwith to also catch ParseError.

The side-effect is that error message when giving an invalid date in CLI
change from:

  abort: invalid date: 'foo bar'

to:

  hg: parse error: invalid date: 'foo bar'

I'm not sure if it's an acceptable change, I found personally the error
message more clear but more verbose too.
2017-05-24 17:50:17 +02:00
Yuya Nishihara
5fbb2d3cd5 graphlog: optionally strip quotes from graphnode template (BC)
For consistency with the other template options.
2017-02-25 19:28:16 +09:00
Yuya Nishihara
fe309eba0e graphlog: draw multiple edges towards null node (issue5440)
Before, edge (r, null) was processed only once by newparents. However what
we really need is just stripping the edge (null, null).
2017-03-20 11:50:55 +09:00
Yuya Nishihara
b2229f5117 revset: split language services to revsetlang module (API)
New revsetlang module hosts parser, tokenizer, and miscellaneous functions
working on parsed tree. It does not include functions for evaluation such as
getset() and match().

  2288 mercurial/revset.py
   684 mercurial/revsetlang.py
  2972 total

get*() functions are aliased since they are common in revset.py.
2017-02-19 18:19:33 +09:00
Yuya Nishihara
ec5675abe6 revset: wrap arguments of 'or' by 'list' node
This makes the number of 'or' arguments deterministic so we can attach
additional ordering flag to all operator nodes. See the next patch.

We rewrite the tree immediately after chained 'or' operations are flattened
by simplifyinfixops(), so we don't need to care if arguments are stored in
x[1] or x[1:].
2016-08-07 17:04:05 +09:00
Martijn Pieters
d3f28a7e4b graphmod: update edgemap in-place
The edgemap update was not actually propagated to future asciiedge calls;
update the edge state dictionary in-place instead.
2016-05-16 16:41:26 +01:00
Martijn Pieters
66e28b5732 graphmod: partial edge styling
Allow for a style to only apply to the last N lines (for positive N) or
everything but the first N lines (for negative N) of the section along the
current node. This allows for more subtle grandparent styling.

So from the default:

  $ hg log -G ...
  o    Lorem ipsum dolor sit
  :\   amet, consectetur
  : :  adipiscing elit, sed
  : :  do eiusmod tempor
  : :
  o :  incididunt ut labore
  | :  et dolore magna
  | :  aliqua. Ut enim ad
  | :  minim veniam, quis
  |/
  o  nostrud exercitation
  :  ullamco laboris nisi
  :  ut aliquip ex ea
  :  commodo consequat.
  :
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu

to

  $ hg log -G --config "experimental.graphstyle.grandparent=2." ...
  o    Lorem ipsum dolor sit
  |\   amet, consectetur
  | |  adipiscing elit, sed
  . .  do eiusmod tempor
  . .
  o |  incididunt ut labore
  | |  et dolore magna
  | |  aliqua. Ut enim ad
  | |  minim veniam, quis
  |/
  o  nostrud exercitation
  |  ullamco laboris nisi
  |  ut aliquip ex ea
  .  commodo consequat.
  .
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu

or

  $ hg log -G --config "experimental.graphstyle.grandparent=1:" ...
  o    Lorem ipsum dolor sit
  |\   amet, consectetur
  | |  adipiscing elit, sed
  | |  do eiusmod tempor
  : :
  o |  incididunt ut labore
  | |  et dolore magna
  | |  aliqua. Ut enim ad
  | |  minim veniam, quis
  |/
  o  nostrud exercitation
  |  ullamco laboris nisi
  |  ut aliquip ex ea
  |  commodo consequat.
  :
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu

or

  $ hg log -G --config "experimental.graphstyle.grandparent=-2!" ...
  o    Lorem ipsum dolor sit
  |\   amet, consectetur
  ! !  adipiscing elit, sed
  ! !  do eiusmod tempor
  ! !
  o |  incididunt ut labore
  | |  et dolore magna
  | |  aliqua. Ut enim ad
  | |  minim veniam, quis
  |/
  o  nostrud exercitation
  |  ullamco laboris nisi
  !  ut aliquip ex ea
  !  commodo consequat.
  !
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu
2016-05-04 20:11:59 +01:00
Martijn Pieters
4b822b7401 graphmod: disable graph styling when HGPLAIN is set (issue5212)
Produce stable output for tools to rely on by hardcoding all edge styles to
"|". This ensures that any tool parsing the output of hg log -G still gets the
same behaviour as pre-3.8 releases.
2016-04-20 16:33:13 +01:00
Martijn Pieters
2f489ce3b5 graphmod: fix seen state handling for > 2 parents (issue5174)
When there are more than 2 parents for a given node (in a sparse graph), extra
dummy nodes are inserted to transition the lines more gradually. However, since
the seen state was not updated when yielding the extra nodes, the wrong graph
styles were being applied to the nodes.
2016-04-20 18:26:29 +01:00
santiagopim
ab2ab42ccf graphmod: shorten graph
Shorten the graph, cutting the all vertical (not oblique) edges rows.
Activate with 'graphshorten = true' in [experimental] section.

Example graph with deactivated option:

$ hg log --graph --template '{rev} {desc|firstline}' --rev 1035:1015
o    1035 Merge with BOS
|\
| o  1034 Fix help output, and a few broken tests.
| |
| o    1033 Merge with MPM.
| |\
| | o  1032 Get patchbomb working with tip again.
| | |
| | o  1031 Rewrite log command.  New version is faster and more featureful.
| | |
| | o    1030 Merge with MPM.
| | |\
| | | o  1029 Emacs: implement hg-incoming, hg-outgoing and hg-push.
| | | |
| | | o  1028 Add commands.debugconfig.
| | | |
| | | o  1027 Emacs: fix up hg-log and hg-diff to operate more uniformly.
| | | |
| | | o    1026 Merge with MPM.
| | | |\
| | | | o  1025 Merge with MPM.
| | | | |
| | | | ~
| | | o  1024 Sync buffers prior to doing a diff.
| | | |
| | | ~
o | |  1023 Minor tweak to the revgen algorithm
|/ /
o |  1022 Minor hgwebdir tweaks
| |
o |  1021 Add Makefile to the manifest
| |
o |  1020 Add default make rule
| |
o |  1019 Create helper functions for I/O to files in the working directory
| |
o |  1018 Add some aliases
| |
o |  1017 Fix up help for binary options
|/
o  1016 Teach annotate about binary files
|
o  1015 Add automatic binary file detection to diff and export
|
~

Example graph with activated option:

$ hg log --graph --template '{rev} {desc|firstline}' --rev 1035:1015
o    1035 Merge with BOS
|\
| o  1034 Fix help output, and a few broken tests.
| o    1033 Merge with MPM.
| |\
| | o  1032 Get patchbomb working with tip again.
| | o  1031 Rewrite log command.  New version is faster and more featureful.
| | o    1030 Merge with MPM.
| | |\
| | | o  1029 Emacs: implement hg-incoming, hg-outgoing and hg-push.
| | | o  1028 Add commands.debugconfig.
| | | o  1027 Emacs: fix up hg-log and hg-diff to operate more uniformly.
| | | o    1026 Merge with MPM.
| | | |\
| | | | o  1025 Merge with MPM.
| | | | |
| | | | ~
| | | o  1024 Sync buffers prior to doing a diff.
| | | |
| | | ~
o | |  1023 Minor tweak to the revgen algorithm
|/ /
o |  1022 Minor hgwebdir tweaks
o |  1021 Add Makefile to the manifest
o |  1020 Add default make rule
o |  1019 Create helper functions for I/O to files in the working directory
o |  1018 Add some aliases
o |  1017 Fix up help for binary options
|/
o  1016 Teach annotate about binary files
o  1015 Add automatic binary file detection to diff and export
|
~
2016-04-08 16:42:43 +02:00
Martijn Pieters
9775d72529 graphmod: set default edge styles for ascii graphs (BC)
Leaving regular parent edges set to |, grandparent edges set to : and missing
parent edges set to end early. A sample graph:

  o    changeset:   32:d06dffa21a31
  |\   parent:      27:886ed638191b
  | :  parent:      31:621d83e11f67
  | :
  o :  changeset:   31:621d83e11f67
  |\:  parent:      21:d42a756af44d
  | :  parent:      30:6e11cd4b648f
  | :
  o :    changeset:   30:6e11cd4b648f
  |\ \   parent:      28:44ecd0b9ae99
  | ~ :  parent:      29:cd9bb2be7593
  |  /
  o :    changeset:   28:44ecd0b9ae99
  |\ \   parent:      1:6db2ef61d156
  | ~ :  parent:      26:7f25b6c2f0b9
  |  /
  o :    changeset:   26:7f25b6c2f0b9
  |\ \   parent:      18:1aa84d96232a
  | | :  parent:      25:91da8ed57247
  | | :
  | o :  changeset:   25:91da8ed57247
  | |\:  parent:      21:d42a756af44d
  | | :  parent:      24:a9c19a3d96b7
  | | :
  | o :    changeset:   24:a9c19a3d96b7
  | |\ \   parent:      0:e6eb3150255d
  | | ~ :  parent:      23:a01cddf0766d
  | |  /
  | o :    changeset:   23:a01cddf0766d
  | |\ \   parent:      1:6db2ef61d156
  | | ~ :  parent:      22:e0d9cccacb5d
  | |  /
  | o :  changeset:   22:e0d9cccacb5d
  |/:/   parent:      18:1aa84d96232a
  | :    parent:      21:d42a756af44d
  | :
  | o    changeset:   21:d42a756af44d
  | |\   parent:      19:31ddc2c1573b
  | | |  parent:      20:d30ed6450e32
  | | |
  +---o  changeset:   20:d30ed6450e32
  | | |  parent:      0:e6eb3150255d
  | | ~  parent:      18:1aa84d96232a
  | |
  | o    changeset:   19:31ddc2c1573b
  | |\   parent:      15:1dda3f72782d
  | ~ ~  parent:      17:44765d7c06e0
  |
  o  changeset:   18:1aa84d96232a
     parent:      1:6db2ef61d156
     parent:      15:1dda3f72782d
2016-03-23 13:34:47 -07:00
Pierre-Yves David
34ff160b27 graphmod: move the graphstyle options to experimental
I let this slip in the [ui] section during the review, as far as I understand we
don't plan to actually support customisation of the output on we are happy with
our choice.  The option are just here to help people tests various options so we
can decide which one we'll actually use.

I'm moving the config option in the experimental section to make this clearer
and avoid making them part of the public API by mistake.
2016-03-24 00:09:58 -07:00
Martijn Pieters
146cd7366a graphmod: allow edges to end early
Rather than draw an edge all the way to the bottom of the graph, make it
possible to end an edge to parents that are not part of the graph early on.
This results in a far cleaner graph.

Any edge type can be set to end early; set the ui.graphstyle.<edgetype>
parameter to the empty string to enable this.

For example, setting the following configuration:

    [ui]
    graphstyle.grandparent = :
    graphstyle.missing =

would result in a graph like this:

  o    changeset:   32:d06dffa21a31
  |\   parent:      27:886ed638191b
  | :  parent:      31:621d83e11f67
  | :
  o :  changeset:   31:621d83e11f67
  |\:  parent:      21:d42a756af44d
  | :  parent:      30:6e11cd4b648f
  | :
  o :    changeset:   30:6e11cd4b648f
  |\ \   parent:      28:44ecd0b9ae99
  | ~ :  parent:      29:cd9bb2be7593
  |  /
  o :    changeset:   28:44ecd0b9ae99
  |\ \   parent:      1:6db2ef61d156
  | ~ :  parent:      26:7f25b6c2f0b9
  |  /
  o :    changeset:   26:7f25b6c2f0b9
  |\ \   parent:      18:1aa84d96232a
  | | :  parent:      25:91da8ed57247
  | | :
  | o :  changeset:   25:91da8ed57247
  | |\:  parent:      21:d42a756af44d
  | | :  parent:      24:a9c19a3d96b7
  | | :
  | o :    changeset:   24:a9c19a3d96b7
  | |\ \   parent:      0:e6eb3150255d
  | | ~ :  parent:      23:a01cddf0766d
  | |  /
  | o :    changeset:   23:a01cddf0766d
  | |\ \   parent:      1:6db2ef61d156
  | | ~ :  parent:      22:e0d9cccacb5d
  | |  /
  | o :  changeset:   22:e0d9cccacb5d
  |/:/   parent:      18:1aa84d96232a
  | :    parent:      21:d42a756af44d
  | :
  | o    changeset:   21:d42a756af44d
  | |\   parent:      19:31ddc2c1573b
  | | |  parent:      20:d30ed6450e32
  | | |
  +---o  changeset:   20:d30ed6450e32
  | | |  parent:      0:e6eb3150255d
  | | ~  parent:      18:1aa84d96232a
  | |
  | o    changeset:   19:31ddc2c1573b
  | |\   parent:      15:1dda3f72782d
  | ~ ~  parent:      17:44765d7c06e0
  |
  o  changeset:   18:1aa84d96232a
     parent:      1:6db2ef61d156
     parent:      15:1dda3f72782d

The default configuration leaves all 3 types set to |.

This is part of the work towards moving smartlog upstream; currently smartlog
injects extra nodes into the graph to indicate grandparent relationships (nodes
elided).
2016-03-19 16:37:47 -07:00
Martijn Pieters
32562c645b graphmod: allow for different styles for different edge types
Rather than draw all edges as solid lines, allow for using different styles for
different edge types. For example you could use dotted lines for edges that
do not connect to a parent, and dashed lines when connecting to a grandparent
(implying missing nodes in between).

For example, setting the following configuration:

    [ui]
    graphstyle.grandparent = :
    graphstyle.missing = .

would result in a graph like this:

  o    changeset:   32:d06dffa21a31
  |\   parent:      27:886ed638191b
  | :  parent:      31:621d83e11f67
  | :
  o :  changeset:   31:621d83e11f67
  |\:  parent:      21:d42a756af44d
  | :  parent:      30:6e11cd4b648f
  | :
  o :    changeset:   30:6e11cd4b648f
  |\ \   parent:      28:44ecd0b9ae99
  | . :  parent:      29:cd9bb2be7593
  | . :
  o . :    changeset:   28:44ecd0b9ae99
  |\ \ \   parent:      1:6db2ef61d156
  | . . :  parent:      26:7f25b6c2f0b9
  | . . :
  o . . :    changeset:   26:7f25b6c2f0b9
  |\ \ \ \   parent:      18:1aa84d96232a
  | | . . :  parent:      25:91da8ed57247
  | | . . :
  | o-----+  changeset:   25:91da8ed57247
  | | . . :  parent:      21:d42a756af44d
  | | . . :  parent:      24:a9c19a3d96b7
  | | . . :
  | o . . :    changeset:   24:a9c19a3d96b7
  | |\ \ \ \   parent:      0:e6eb3150255d
  | | . . . :  parent:      23:a01cddf0766d
  | | . . . :
  | o---+ . :  changeset:   23:a01cddf0766d
  | | . . . :  parent:      1:6db2ef61d156
  | | . . . :  parent:      22:e0d9cccacb5d
  | | . . . :
  | o-------+  changeset:   22:e0d9cccacb5d
  | . . . . :  parent:      18:1aa84d96232a
  |/ / / / /   parent:      21:d42a756af44d
  | . . . :
  | . . . o    changeset:   21:d42a756af44d
  | . . . |\   parent:      19:31ddc2c1573b
  | . . . | |  parent:      20:d30ed6450e32
  | . . . | |
  +-+-------o  changeset:   20:d30ed6450e32
  | . . . |    parent:      0:e6eb3150255d
  | . . . |    parent:      18:1aa84d96232a
  | . . . |
  | . . . o    changeset:   19:31ddc2c1573b
  | . . . .\   parent:      15:1dda3f72782d
  | . . . . |  parent:      17:44765d7c06e0
  | . . . . |
  o---+---+ |  changeset:   18:1aa84d96232a
    . . . . |  parent:      1:6db2ef61d156
   / / / / /   parent:      15:1dda3f72782d
  . . . . .


Edge styles can be altered by setting the following one-character config options::

    [ui]
    graphstyle.parent = |
    graphstyle.grandparent = :
    graphstyle.missing = .

The default configuration leaves all 3 types set to |, leaving graph styles
unaffected.

This is part of the work towards moving smartlog upstream; currently smartlog
injects extra nodes into the graph to indicate grandparent relationships (nodes
elided).
2016-03-19 16:46:15 -07:00
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
6b8c99a6d3 revset: flatten chained 'list' operations (aka function args) (issue5072)
Internal _matchfiles() function can take bunch of arguments, which would
lead to a maximum recursion depth error. This patch avoids the excessive
stack use by flattening 'list' nodes beforehand.

Since getlist() no longer takes a nested 'list' nodes, _parsealiasdecl()
also needs to flatten argument list, "aliasname($1, $2, ...)".
2016-02-02 23:49:49 +09:00
Augie Fackler
3fdeab8ee1 test-glog: avoid check-code violation after next patch
Danek's patch will help us avoid spurious test breakages on
Solaris. This test wasn't broken on Solaris because of the grep(1)
use, but it will upset check-code. Use cmp to silence check-code since
it doesn't matter.
2015-12-29 18:11:14 -05:00
Yuya Nishihara
10b6f5819b graphlog: make node symbol templatable by ui.graphnodetemplate option
New ui.graphnodetemplate option allows us to colorize a node symbol by phase
or branch,

  [ui]
  graphnodetemplate = {label('graphnode.{phase}', graphnode)}
  [color]
  graphnode.draft = yellow bold

or use a variety of unicode emoji characters, and so on. (You'll need less-481
to display non-BMP unicode character.)

  [ui]
  graphnodetemplate = {ifeq(obsolete, 'stable', graphnode, '\xf0\x9f\x92\xa9')}
2015-11-14 17:25:43 +09:00
Yuya Nishihara
3732960ab3 revset: use integer representation of wdir() in revset
This is the simplest way to handle wdir() revision in revset. None didn't
work well because revset heavily depends on integer operations such as min(),
max(), sorted(), x:y, etc.

One downside is that we cannot do "wctx.rev() in set" because wctx.rev() is
still None. We could wrap the result set by wdirproxyset that translates None
to wdirrev, but it seems overengineered at this point.

    result = getset(repo, subset, tree)
    if 'wdir' in funcsused(tree):
        result = wdirproxyset(result)

Test cases need the '(all() + wdir()) &' hack because we have yet to fix the
bootstrapping issue of null and wdir.
2015-03-16 16:17:06 +09:00
Matt Mackall
2173cc3777 merge with stable 2015-06-29 16:38:22 -05:00
Matt Harbison
d4e8d4f13c archive: don't assume '.' is being archived for changessincelatesttag
Hardcoding '.' is wrong, and yielded strange results when archiving old
revisions.  For example, when archiving the cset that adds the signature to 3.4
(a4f6d198e7df), the resulting value was previously 51 (the number of commits on
stable between 3.4 and today), even though it was a direct descendant of a tag,
with a {latesttagdistance} of 2.  This still includes all other _ancestor_ paths
not included in {latesttag}.

Note that archiving wdir() currently blows up several lines above this when
building the 'base' variable.  Since wdir() isn't documented, ignore that it
needs work to handle wdir() here for now.
2015-06-25 21:16:47 -04:00
Yuya Nishihara
799e490a3c revset: drop magic of fullreposet membership test (issue4682)
This patch partially backs out a9a86cbbc5b2 and adds an alternative workaround
to functions that evaluate "null" and "wdir()". Because the new workaround is
incomplete, "first(null)" and "min(null)" don't work as expected. But they were
not usable until 3.4 and "null" isn't commonly used, we can postpone a complete
fix for 3.5.

The issue4682 was caused because "branch(default)" is evaluated to
"<filteredset <fullreposet>>", keeping fullreposet magic. The next patch will
fix crash on "branch(null)", but without this patch, it would make
"null in <branch(default)>" be True, which means "children(branch(default))"
would return all revisions but merge (p2 != null).

I believe the right fix is to stop propagating fullreposet magic on filter(),
but it wouldn't fit to stable release. Also, we should discuss how to handle
"null" and "wdir()" in revset before.
2015-05-24 10:29:33 +09:00
Yuya Nishihara
ee4ca20b38 revset: have all() filter out null revision
I'm not sure if "all()" should filter out "null", but "all()" is stated as
'the same as "0:tip"' (except that it doesn't reorder the subset, I think.)

This patch is intended to avoid exposing a fullreposet to graphmod.dagwalker(),
which would result in strange drawing in future version:

  |
  o  changeset:   0:f8035bb17114
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add a

caused by:

    parents = sorted(set([p.rev() for p in ctx.parents()
                          if p.rev() in revs]))

We cannot add "and p.rev() != nullrev" here because revs may actually include
"null" revision.
2015-01-10 14:49:50 +09:00
Yuya Nishihara
74fe7e4a0f graphlog: do not bypass commands.log so that -fr works
Since 1c6485ced49b, opts dict can be modified in commands.log() before calling
cmdutil.graphlog().
2015-03-04 21:47:07 +09:00
Durham Goode
0744c2b71c log: make -fr show complete history from the given revs
Right now it's very obtuse to show the history of a particular rev (hg log -r
'reverse(::foo)'). This changes the -f option to make it follow history for the
revs specified by -r.

The current -f -r behavior is to limit the result of -r to only the
commits that are ancestors of the current working copy. Changing this
is a bit of a BC break, but the old behavior is A) rare, B) easy to
emulate (& ::.), and C) currently undefined. The new behavior is
frequently requested enough that I think the change is worth it.
2015-02-06 11:04:55 -08:00
Yuya Nishihara
ea398a57c8 log: fix --follow null parent not to include revision 0
If p1 is null, ':.' is translated as '0:null'. But rangeset can't handle null,
only revision 0 was visible.  Because 'null' should not be listed implicitly,
"log --follow" (without -r) should be empty if p1 is null.

Test of "hg grep -f" is added for cmdutil.walkchangerevs().
2015-02-06 21:53:39 +09:00
Yuya Nishihara
f70a0be178 graphlog: remove too early return from getgraphlogrevs() for empty repo
Even if repository is empty, null revision should exist.
2015-02-05 23:14:44 +09:00
Yuya Nishihara
ed458b9332 log: use rev() to build revset of --follow option from numeric revision
startrev can be -1.
2015-01-10 13:14:00 +09:00
Yuya Nishihara
d23a5c2002 revset: reduce nesting of chained 'or' operations (issue4624)
This reduces the stack depth of chained 'or' operations:
 - from O(n) to O(1) at the parsing, alias expansion and optimization phases
 - from O(n) to O(log(n)) at the evaluation phase

simplifyinfixops() must be applied immediately after the parsing phase.
Otherwise, alias expansion would crash by "maximum recursion depth exceeded"
error.

Test cases use 'x:y|y:z' instead of 'x|y' because I'm planning to optimize
'x|y' in a different way.

Benchmarks:

0) a2acce8dcd95
1) this patch

revset #0: 0 + 1 + 2 + ... + 200
0) wall 0.026347 comb 0.030000 user 0.030000 sys 0.000000 (best of 101)
1) wall 0.023858 comb 0.030000 user 0.030000 sys 0.000000 (best of 112)

revset #1: 0 + 1 + 2 + ... + 1000
0) maximum recursion depth exceeded
1) wall 0.483341 comb 0.480000 user 0.480000 sys 0.000000 (best of 20)

revset #2: sort(0 + 1 + 2 + ... + 200)
0) wall 0.013404 comb 0.010000 user 0.010000 sys 0.000000 (best of 196)
1) wall 0.006814 comb 0.010000 user 0.010000 sys 0.000000 (best of 375)

revset #3: sort(0 + 1 + 2 + ... + 1000)
0) maximum recursion depth exceeded
1) wall 0.035240 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
2015-04-26 18:13:48 +09:00
Matt Mackall
07ca4361bb merge with stable 2015-05-26 07:44:37 -05:00
Yuya Nishihara
0aa2a7df4d revset: move validation of incomplete parsing to parse() function
revset.parse() should be responsible for all parsing errors. Perhaps it wasn't
because 'revset.parse' was not a real function when the validation code was
added at ac01134d0a40.
2015-04-26 19:42:47 +09:00
Durham Goode
fd373c16b0 log: fix log revset instability
The log/graphlog revset was not producing stable results since it was
iterating over a dict. Now we sort before iterating to guarantee a fixed order.

This fixes some potential flakiness in the tests.
2014-12-08 15:41:54 -08:00
Durham Goode
74a5156e21 log: fix log -f slow path to actually follow history
The revset created when -f was used with a slow path (for patterns and
directories) did not actually contain any logic to enforce follow. Instead it
was depending on the passed in subset to already be limited (which was limited
to :. but not ::.). This fixes it by adding a '& ::.' to any -f log revset.

hg log -f <file> is still broken, in that it can return results that aren't
actually ancestors of the current file, but fixing that has major perf
implications, so we'll deal with it later.
2014-12-05 14:27:32 -08:00
Durham Goode
312ed291dd obsolete: update tests to use obsolete options
The obsolete._enabled flag has become a config option. This updates all but one
of the tests to use the minimal number of flags necessary for them to pass.  For
most tests this is just 'createmarkers', for a couple tests it's
'allowunstable', and for even fewer it's 'exchange'.
2014-10-14 13:34:25 -07:00
Augie Fackler
a5ddb1dcfe tests: use $PYTHON instead of hardcoding python
This makes running the testsuite with pypy possible.
2014-10-15 15:35:59 -04:00
Pierre-Yves David
2213bfcae4 revset-_descendant: rework the whole sorting and combining logic
We use the & operator to combine with subset (since this is more likely to be
optimised than filter) and we enforce the sorting of the result. Without this
enforced sorting, we may result in a different iteration order than the set
_descendent was computed from.

This reverts a bad `test-glog.t` change from 7904906883bd.

Another side effect is that `test-mq.t` shows `qparent::` including `-1` if
`qparent is -1`. This sound like a positive change.

This has good and bad impacts on the benchmarks, here is a good ones:

revset: 0::
before) wall 0.045489 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
after)  wall 0.034330 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)

revset: roots((0::) - (0::tip))
before)  wall 0.134090 comb 0.140000 user 0.140000 sys 0.000000 (best of 63)
after) wall 0.128346 comb 0.130000 user 0.130000 sys 0.000000 (best of 69)

revset: ::p1(p1(tip))::
before) wall 0.143892 comb 0.140000 user 0.140000 sys 0.000000 (best of 55)
after)  wall 0.124502 comb 0.130000 user 0.130000 sys 0.000000 (best of 65)

revset: roots((0:tip)::)
before) wall 0.204966 comb 0.200000 user 0.200000 sys 0.000000 (best of 43)
after) wall 0.184455 comb 0.180000 user 0.180000 sys 0.000000 (best of 47)

Here is a bad one:

revset: (20000::) - (20000)
before) wall 0.009592 comb 0.010000 user 0.010000 sys 0.000000 (best of 222)
after)  wall 0.029837 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)
2014-10-09 09:12:54 -07:00
Durham Goode
4bf8cd87a5 log: allow patterns with -f
It's not uncommon for a user to want to run log with a pattern or directory name
on the history of their current commit.  Currently we prevent that, but
I can't think of any reason to continue blocking that.

This commit removes the restriction and allows 'hg log -f <dir/pat>'
2014-07-22 22:40:16 -07:00
Lucas Moscovicz
2794920df6 log: changed implementation to use graphlog code
Now that revsets work in a lazy way, log code can be changed to parse every
option into a revset and then evaluate it lazily.

Now expressions like

  "hg log -b default -b ."

are converted into a revset using the same code as graphlog.
2014-02-28 15:10:56 -08:00
Matt Mackall
34b49de789 diff: use second filename for --stat reporting on git patches (issue4221) 2014-04-11 16:38:55 -04:00
Cristian Zamfir
c85ed151ff hg log: solves bug regarding hg log -r 0:null (issue4039)
'hg log -r 0:null' was showing only one changeset(the '-1' one) instead of the first two changesets.
2014-03-12 10:26:48 +02:00
Martin Geisler
7316194bdf tests: don't load unnecessary graphlog extension
Since graphlog is in core, we can use 'hg log -G' instead.
2013-11-22 19:14:17 +01:00
Alexander Plavin
48936f264c revlog: fix a regression with null revision
Introduced in the patch which fixes issue3497
Part of that patch was erroneously submitted and it shouldn't be in the code
2013-04-18 16:46:09 +04:00
Alexander Plavin
829cf92d16 log: fix behavior with empty repositories (issue3497)
Make output in this special case consistent with general case one.
2013-04-17 00:29:54 +04:00
Kevin Bullock
c54ed8bf64 tests: add regression tests for another revrange edge case
These tests would've passed before 99686e12b04e and a8620592704a.
Inserting them to make sure that continues to be the case.
2013-01-23 11:55:39 -06:00
Bryan O'Sullivan
9937540784 graphmod: don't try to visit nullrev (issue3772) 2013-01-23 00:20:26 -06:00