Yuya Nishihara <yuya@tcha.org> [Sun, 28 Jun 2015 22:57:33 +0900] rev 25706
revset: port extra() to support keyword arguments
This is an example to show how keyword arguments are processed.
Yuya Nishihara <yuya@tcha.org> [Sat, 27 Jun 2015 17:25:01 +0900] rev 25705
revset: add function to build dict of positional and keyword arguments
Keyword arguments will be convenient for functions that will take more than
one optional or boolean flags. For example,
file(pattern[, subrepos=false])
subrepo([[pattern], status])
Because I don't think all functions should accept key=value syntax, getkwargs()
does not support variadic functions such as 'ancestor(*changeset)'.
The core logic is placed in the parser module because keyword arguments will
be more useful in the templater, where functions take more options. Test cases
will be added by the next patch.
Yuya Nishihara <yuya@tcha.org> [Sat, 27 Jun 2015 17:05:28 +0900] rev 25704
revset: add parsing rule for key=value pair
It will be used as an keyword argument.
Note that our "=" operator is left-associative. In general, the assignment
operator is right-associative, but we don't care because it isn't allowed to
chain "=" operations.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 28 Jun 2015 12:46:34 -0700] rev 25703
import-checker: establish modern import convention
We introduce a new convention for declaring imports and enforce it via
the import checker script.
The new convention is only active when absolute imports are used, which is
currently nowhere. Keying off "from __future__ import absolute_import" to
engage the new import convention seems like the easiest solution. It is
also beneficial for Mercurial to use this mode because it means less work
and ambiguity for the importer and potentially better performance due to
fewer stat() system calls because the importer won't look for modules in
relative paths unless explicitly asked.
Once all files are converted to use absolute import, we can refactor
this code to again only have a single import convention and we can
require use of absolute import in the style checker.
The rules for the new convention are documented in the docstring of the
added function. Tests have been added to test-module-imports.t. Some
tests are sensitive to newlines and source column position, which makes
docstring testing difficult and/or impossible.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 28 Jun 2015 12:28:48 -0700] rev 25702
import-checker: establish new function for verifying import conventions
A future patch will formalize the modern import convention. In
preparation for that, introduce a new wrapper function that will invoke
the proper function.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 28 Jun 2015 09:36:58 -0700] rev 25701
import-checker: resolve relative imports
"from . import X" will produce an ImportFrom ast node with .module =
None. This resulted in a run-time error from attempting to concatenate
None with a str.
Another problem with relative imports is that the prefix may be dynamic
based on the "level" attribute of the import. e.g. "from ." has level 1
and "from .." has level 2.
We teach the "fromlocal" function how to cope with relative imports.
Where appropriate, the consumer passes in the level so relative module
names may be resolved properly.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 26 Jun 2015 23:23:10 -0400] rev 25700
templatekw: use a list of tags in getlatesttags() instead of joining them
This will be used in the next patch.
It also points out that the documentation for '{latesttag}' is not quite
accurate, since it says "most recent global tag" (singular). I assume it is too
radical of a change to convert it to a list of strings. At least ':' is
currently a reserved character in tag names.
Durham Goode <durham@fb.com> [Mon, 29 Jun 2015 17:19:58 -0700] rev 25699
convert: improve support for unusual .gitmodules
Previously convert would throw an exception if it encountered a git commit with
a .gitmodules file that was malformed (i.e. was missing, but had submodule
files, or was malformed).
Instead of breaking the convert entirely, let's print error messages and move
on.
Durham Goode <durham@fb.com> [Mon, 29 Jun 2015 17:19:18 -0700] rev 25698
convert: handle .gitmodules with non-tab whitespaces
The old implementation assumed .gitmodules file lines always began
with tabs. It can be any whitespace, so lets trim the lines
appropriately.
Durham Goode <durham@fb.com> [Mon, 29 Jun 2015 13:39:05 -0700] rev 25697
convert: fix bug with converting the same commit twice
Convert had a bug where it relied on repo.tip() to be the newly committed
commit. This was not the case if the commit already existed in the repository
(since repo.commitctx() did nothing, the tip() referenced some random other
commit and the revmap got corrupted).
This fixes it by using the node returned by repo.commitctx().
Yuya Nishihara <yuya@tcha.org> [Sat, 27 Jun 2015 15:28:46 +0900] rev 25696
templater: remove workaround for escaped quoted string in quoted template
This patch backs out
554d6fcc3c84 which should no longer be needed.
The test for '{\"invalid\"}' is removed because the parser is permissive for
\"...\" literal.
Matt Mackall <mpm@selenic.com> [Wed, 01 Jul 2015 16:33:31 -0500] rev 25695
merge with stable