Commit Graph

28844 Commits

Author SHA1 Message Date
Pulkit Goyal
05677e56ec tests: make test-trusted use absolute_import 2016-04-14 00:49:58 +05:30
Yuya Nishihara
d00a0ddedf templater: add parsing and expansion rules to process "templatealias" section
The debugtemplate command is updated to show expanded tree, but still the
template engine doesn't support alias expansion. That's why the test says
"parse error" for now.
2016-03-27 20:31:56 +09:00
Yuya Nishihara
b9d70a8ce1 templater: add function to parse whole string as template expression
This will be a parser of template aliases, and it can also be used for
processing quoted string templates in map files. That's why this function
isn't defined in the upcoming _aliasrules class.
2016-03-27 20:29:03 +09:00
Yuya Nishihara
85d1a67355 parser: factor out _trygetfunc() that extracts function name and arguments
This provides a customization point for templater. In templater, there are
two ways to call a unary function: func(x) and x|func. They are processed
differently in templater due to historical reasons, but they should be
handled in the same way while expanding aliases. In short, x|func should be
processed as syntactic sugar for func(x).

_funcnode and _getlist() are replaced by _trygetfunc().
2016-03-29 17:27:34 +09:00
Yuya Nishihara
f873b2cea1 parser: make _getalias() return (alias, pattern-args) pair
This allows us to factor out a function that extracts a function (name, args)
pair. See the next patch for why.
2016-03-29 17:21:11 +09:00
Yuya Nishihara
22818c3975 parser: drop redundant comparison between alias declaration tree and pattern
Since _getalias() explicitly tests the type and name of the pattern tree, we
don't need to compare "a.tree == tree" for 'symbol', and "a.tree == tree[:2]"
for 'func', where tree is either ('symbol', name) or ('func', ('symbol', name)).

This change helps implementing better handling of template aliases. See the
subsequent patches for details.

The alias.tree field is removed as it is no longer used.
2016-03-29 16:50:16 +09:00
timeless
2778e2894f patchbomb: fix public-is-missing hint
Without this, there is no space between a hash and the -r preceding the next
line in the use hg push hint
2016-04-14 14:26:37 +00:00
timeless
d34aba084e tests: clarify patchbomb repo is public not remote 2016-04-14 14:36:52 +00:00
timeless
13f6bf6c8e run-tests: set HGMODULEPOLICY for --pure
Without this, my python 2.6 virtualenv test run with --pure and
--local fails with:

+  ImportError: Python minor version mismatch: The Mercurial extension modules were compiled with Python 2.7.8, but Mercurial is currently using Python with sys.hexversion=33950192: Python 2.6.9 (unknown, Apr 13 2016, 12:40:12)
+  [GCC 4.9.2 20141101 (Red Hat 4.9.2-1)]
+   at: ~/hg/py26/bin/python
2016-04-13 13:51:39 +00:00
Nathaniel Manista
9e78f05831 cmdutil: avoid recycling variable name "name" in namespaces code
This just feels like asking for future trouble and confusion.
2016-04-14 15:26:18 -04:00
liscju
4b86252e85 update: fix bare update to work on new branch
So far bare update on new branch results in
'abort: branch new-branch not found'. This commit fixes
this by updating to the parent of wctx.

The effect of updating to the parent of wctx is to move to the paren't
branch - this means that it is no longer necessary to prevent you from
updating if you would lose your newly created branch.
2016-04-05 06:53:33 +02:00
liscju
22e1e3529b remove: fix --force option help description (issue5177)
Before this commit --force option help description stated
that file was removed and deleted even if file was added
or modified which is not true. Force option removes added
file only from dirstate, it doesn't delete it from the
filesystem.
2016-04-13 09:56:51 +02:00
Martijn Pieters
7d4b1c457a logtoprocess: new experimental extension
This extension lets you direct specific ui.log() information to shell
commands, spawned in the background. This can be used to, say, capture
timings, commandfailure tracebacks, etc., making the output available
to other command-line tools.
2016-04-05 17:39:59 +01:00
Mads Kiilerich
274ba69e53 convert: keep converted hg parents that are outside convert.hg.revs (BC)
Before, when converting revisions without also including their already
converted parents in convert.hg.revs, the parents would no longer be parents.

That seems unfortunate and we dare to assume that nobody ever wants that.

Instead, preserve parents that are outside the current convert range but
already have been converted.

The parents returned in getcommit() are unconditionally converted, so we
introduce a separate optparents with optional parents.
2016-04-13 00:16:21 +02:00
Mads Kiilerich
baa3481392 tests: coverage of ancestry with convert in multiple non-overlapping steps
This exposes that parent information is lost in cases where it is possible to
preserve it - and where it thus would make sense if that was what happened.
2016-03-24 16:01:07 -07:00
Yuya Nishihara
4d9561138b revset: rename findaliases() to expandaliases()
This function returns a full tree of alias expansion applied, which sounds
different from what "findaliases" would do.
2016-02-29 22:58:15 +09:00
Yuya Nishihara
e178513a20 parser: add short comment how aliases are expanded in phases 2016-03-29 16:30:59 +09:00
Yuya Nishihara
8c48f711f6 parser: reorder alias expansion routine to return early
I think it improves readability to move trivial cases first, and unindent
blocks.
2016-03-29 16:19:31 +09:00
Yuya Nishihara
45e9c21bc0 parser: move functions that process alias expansion to rule-set class
They will be commonly used by revset and templater. It isn't easy to understand
how _expand() works, so I'll add comments by a follow-up patch.

The local variable 'alias' is renamed to 'a' to avoid shadowing the global
'alias' class.
2016-02-29 22:15:44 +09:00
Yuya Nishihara
5da75dff02 revset: unindent codes in _getalias() function
We generally do return early if tree isn't a tuple.
2016-02-29 22:10:48 +09:00
Yuya Nishihara
a98783fa06 parser: extract helper that creates a dict of aliases
This will be common between revset and templater.

The local variable 'alias' is renamed to 'a' to avoid shadowing the global
'alias' class.
2016-02-29 19:24:15 +09:00
Yuya Nishihara
53c5cbd213 parser: construct alias object by rule-set class
It was odd that the revsetalias did the whole parsing stuff in __init__().
Instead, this patch adds a factory function to the aliasrules class, and
makes the alias (= revsetalias) class a plain-old value object.
2016-02-29 18:33:30 +09: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
Jason Gauci
ab72794fc8 tests: ensure that 'hg update' is disabled during histedit (issue3655) 2016-04-11 12:06:18 -07:00
Matt Harbison
6416635956 test-remove: drop a useless Windows specific conditional
The Windows branch didn't pick up the 'deleting' progress bar addition from
fbfaef28d47c.  But since the Windows branch already globbed the error message,
let's just drop the other branch.
2016-04-12 00:34:02 -04:00
Matt Harbison
1d574a1dd2 test-blackbox: add missing glob for Windows
The test warns instead of completes without this.
2016-03-15 23:04:35 -04:00
Matt Harbison
f6129be11b test-largefiles: stabilize output for Windows
Systems with unix-permissions have a test above this that adds an additional
head.
2016-03-15 21:56:01 -04:00
Matt Harbison
d0d9df3699 test-import: fix output on Windows
There's a symlink conditionalized test above this that causes the rev to be 1.
It isn't important to this test, so ignore it.
2016-03-15 21:47:43 -04:00
Matt Harbison
0f04af5785 test-install: fix output on Windows
See 388e9591df04.
2016-03-15 21:45:32 -04:00
timeless
93c46657f1 check-code: reject import urllib 2016-04-07 00:34:07 +00:00
timeless
109fcbc79e pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
timeless
7816ecf261 pycompat: add util.urlerr util.urlreq classes for py3 compat
python3 url.request and url.error are mapped as util.urlreq/util.urlerr
python2 equivalents from urllib/urllib2 are mapped according to the py3
hierarchy
2016-04-07 00:05:48 +00:00
Yuya Nishihara
805fdba29f test-progress: disable mocking-time tests on chg
It's hard to make these tests compatible with chg because a mocked time.time()
is recorded and accessed by progbar at random timing. I don't think it's worth
fixing this test as it is considered a unit test of time estimates, so just
ignores on chg.
2016-03-20 16:49:56 -07:00
Yuya Nishihara
87bcd87c28 hghave: add "chg" flag to skip tests that can't be compatible with chg
Several tests fail with chg for several reasons such as loaded chgserver
extension, running uisetup() per server instead of per runcommand, etc.
Since these tests can't/shouldn't be changed to be chg friendly, we need
a flag to skip them.

This patch explicitly drops CHGHG environment if chg isn't involved. This
way, hghave can just check if CHGHG exists.
2016-03-20 14:55:56 -07:00
timeless
e22da4a832 tests: add new test for #! shebang lines
* use #!/bin/sh not e.g. #!/usr/bin/sh
* use #!/usr/bin/env python not e.g. #!/usr/bin/python
2016-04-06 19:09:12 +00:00
Mads Kiilerich
069bac6a3e largefiles: introduce push --lfrev to control which revisions are pushed
The default of pushing all largefiles referenced in outgoing revisions is safe,
but also expensive and sometimes not what is needed. We thus introduce a
--lfrev option, similar to what pull already has.

By specifying an empty set of revisions (or null), it is possible to get lazy
(and insecure!) pushes of revisions without referenced largefiles, similar to
how pull works.
2016-03-27 13:00:28 -07:00
Mads Kiilerich
66a29f6996 largefiles: don't access repo.changelog directly in getlfilestoupload
Make it possible to pass both nodes and revisions to getlfilestoupload.
2016-04-13 01:45:45 +02:00
Mads Kiilerich
940d175900 localrepo: refactor prepushoutgoinghook to take a pushop
prepushoutgoinghook was introduced in 8dfcd476a7f7 and largefiles is the only
in-tree use of it. Refactor it to be more useful for other use cases in
largefiles.
2016-04-13 01:09:11 +02:00
Yuya Nishihara
2e16bca7bf parser: unify parser function of alias declaration and definition
We no longer have to keep them separately.
2016-03-29 00:08:25 +09:00
Yuya Nishihara
06651e61a2 revset: unify function that parses alias declaration and definition
We no longer need separate parsers. Only difference between _parsealiasdecl()
and _parsealiasdefn() is whether or not to flatten 'or' tree. Since alias
declaration should have no 'or' operator, there was no practical difference.
2016-03-29 00:05:14 +09:00
Yuya Nishihara
5392dbd7d3 parser: move alias definition parser to common rule-set class
The original _parsealiasdefn() function is split into common _builddefn()
and revset-specific _parsealiasdefn(). revset._relabelaliasargs() is removed
as it is no longer used.

The doctests are ported by using the dummy parse().
2016-02-29 18:10:07 +09:00
Yuya Nishihara
188dee35c2 parser: move _relabelaliasargs() to common rule-set class
This has no doctest because it will be covered by _builddefn() introduced
by the next patch.

revset._relabelaliasargs() will be removed soon.
2016-02-29 18:00:51 +09:00
Yuya Nishihara
6b447db164 parser: move alias declaration parser to common rule-set class
The original _parsealiasdecl() function is split into common _builddecl()
and revset-specific _parsealiasdecl(). And the original _parsealiasdecl()
call is temporarily replaced by rules._builddecl(), which should be eliminated
later.

The doctests are mostly ported by using the dummy parse(), but the test for
'foo bar' is kept in _parsealiasdecl() as it checks if "pos != len(decl)" is
working. Also, 'foo($1)' test is added to make sure the alias tokenizer can
handle '$1' symbol, which is the only reason why we need _parsealiasdecl().
2016-02-29 17:54:03 +09:00
Yuya Nishihara
c51267a286 parser: add stub class that will host alias parsing and expansion
This class will keep syntax rules that are necessary to parse and expand
aliases. The implementations will be extracted from the revset module. In
order to make the porting easier, this class keeps parsedecl and parsedefn
separately, which will be unified later. Also, getlist and funcnode will
be refactored by future patches for better handling of the template aliases.

The following public functions will be added:

  aliasrules.build(decl, defn) -> aliasobj
    parse decl and defn into an object that keeps alias name, arguments
    and replacement tree.
  aliasrules.buildmap(aliasitems) -> aliasdict
    helper to build() a dict of alias objects from a list of (decl, defn)
  aliasrules.expand(aliasdict, tree) -> tree
    expand aliases in tree recursively

Because these functions aren't introduced by this series, there would remain
a few wrapper functions in the revset module. These ugly wrappers should be
eliminated by the next series.

This class is considered an inheritable namespace, which will host only
class/static methods. That's because it won't have no object-scope variables.
I'm not a big fan of using class as a syntax sugar, but I admit it can improve
code readability at some level. So let's give it a try.
2016-04-03 16:55:23 +09:00
Yuya Nishihara
76a8e3fd6c revset: narrow scope of "except ParseError" block in _parsealiasdecl()
This helps to factor out a common function. "if True" will be removed soon.
2016-02-29 17:43:39 +09:00
Kostia Balytskyi
47727221bc obsstore: move delete function from obsstore class to repair module
Since one of the original patches was accepted already and people on the
mailing list still have suggestions as to how this should be improved, I'm
implementing those suggestions in the following patches (this and the ones that
might follow).
2016-04-12 04:06:50 -07:00
Kostia Balytskyi
ab0e2307c2 debugobsolete: style fixes to debugobsolete that slipped from original commit 2016-04-12 03:40:53 -07:00
Matt Mackall
d6208af0bb import: document --exact behavior in more detail 2016-03-09 10:47:33 -05:00
Adrian Buehlmann
86883218e1 util: add doctest to datestr() 2016-04-11 19:46:50 +02:00
Florent Gallaire
ecd665adf8 date: fix boundary check of negative integer 2016-04-12 00:30:28 +02:00