Commit Graph

44 Commits

Author SHA1 Message Date
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
2e50d5587f smartset: move set classes and related functions from revset module (API)
These classes are pretty large and independent from revset computation.

  2961 mercurial/revset.py
   973 mercurial/smartset.py
  3934 total

revset.prettyformatset() is renamed to smartset.prettyformat(). Smartset
classes are aliased since they are quite common in revset.py.
2016-10-16 17:28:51 +09:00
Yuya Nishihara
0a5e04d63d formatter: add overview of API and example as doctest 2016-10-22 15:02:11 +09:00
Pulkit Goyal
8c6c495c76 tests: make test-doctest use absolute_import 2016-04-16 03:38:23 +05:30
Augie Fackler
d33d6a0cb5 changegroup: introduce cg3, which has support for exchanging treemanifests
I'm not entirely happy with using a trailing / on a "file" entry for
transferring a treemanifest. We've discussed putting some flags on
each file header[0], but I'm unconvinced that's actually any better:
if we were going to add another feature to the cg format we'd still be
doing a version bump anyway to cg4, so I'm inclined to not spend time
coming up with a more sophisticated format until we actually know what
the next feature we want to stuff in a changegroup will be.

Test changes outside test-treemanifest.t are only due to the new CG3
bundlecap showing up in the wire protocol.

Many thanks to adgar@google.com and martinvonz@google.com for helping
me with various odd corners of the changegroup and treemanifest API.

0: It's not hard refactoring, nor is it a lot of work. I'm just
disinclined to do speculative work when it's not clear what the
customer would actually be.
2015-12-11 11:23:49 -05:00
Eugene Baranov
afafa68827 convert: use 'default' for specifying branch name in branchmap (issue4753)
A fix for issue2653 with f5abbf51a76e introduced a discrepancy how default
branch should be denoted when converting with branchmap from different SCM.
E.g. for Git and Mercurial you need to use 'default' whilst for Perforce and
SVN you had to use 'None'. This changeset unifies 'default' for such purposes
whilst falling back to 'None' when no 'default' mapping specified.
2015-07-14 14:40:56 +01:00
Eugene Baranov
39327b5b56 convert: unescape Perforce-escaped special characters in filenames 2015-07-14 16:23:57 +01:00
Yuya Nishihara
4444465461 templater: introduce one-pass parsing of nested template strings
Instead of re-parsing quoted strings as templates, the tokenizer can delegate
the parsing of nested template strings to the parser. It has two benefits:

 1. syntax errors can be reported with absolute positions
 2. nested template can use quotes just like shell: "{"{rev}"}"

It doesn't sound nice that the tokenizer recurses into the parser. We could
instead make the tokenize itself recursive, but it would be much more
complicated because we would have to adjust binding strengths carefully and
put dummy infix operators to concatenate template fragments.

Now "string" token without r"" never appears. It will be removed by the next
patch.
2015-06-15 23:11:35 +09:00
Yuya Nishihara
ca51f820ee parser: add helper to reduce nesting of chained infix operations
This will be used to avoid stack overflow caused by chained 'or' operations
in revset.
2015-04-26 18:05:23 +09:00
Siddharth Agarwal
3aa3a9554f patch.pathtransform: add doctests
In upcoming patches we're going to make this function more complex, so add some
unit tests for it.
2015-03-06 21:48:40 -08:00
Mads Kiilerich
44bd94dc4e mq: refactor patchheader header ordering to match export (BC)
The refactoring also gives more robust and extendable handling of other HG
headers.
2014-09-24 02:41:11 +02:00
FUJIWARA Katsunori
85d651396d subrepo: normalize path in the specific way for problematic encodings
Before this patch, "reporelpath()" uses "rstrip(os.sep)" to trim
"os.sep" at the end of "parent.root" path.

But it doesn't work correctly with some problematic encodings on
Windows, because some multi-byte characters in such encodings contain
'\\' (0x5c) as the tail byte of them.

In such cases, "reporelpath()" leaves unexpected '\\' at the beginning
of the path returned to callers.

"lcalrepository.root" seems not to have tail "os.sep", because it is
always normalized by "os.path.realpath()" in "vfs.__init__()", but in
fact it has tail "os.sep", if it is a root (of the drive): path
normalization trims tail "os.sep" off "/foo/bar/", but doesn't trim
one off "/".

So, just avoiding "rstrip(os.sep)" in "reporelpath()" causes
regression around issue3033 fixed by e3dfde137fa5.

This patch introduces "pathutil.normasprefix" to normalize specified
path in the specific way for problematic encodings without regression
around issue3033.
2014-05-08 19:03:00 +09:00
Siddharth Agarwal
cb8e8f55a1 subrepo: factor out Git version check to add doctests
Followup to 80233b59577b::49a2288fb74f.
2014-03-21 16:09:17 -07:00
Yuya Nishihara
b9bc586fe9 clone: add doctest for default destination 2014-03-22 00:46:08 +09:00
Mads Kiilerich
17aeb0d9e4 convert: make subversion revsplit more stable when meeting revisions without @
revsplit would crash for instance if given a subversion string without @ ...
and that could somehow happen when playing around with convert.
2014-02-07 17:28:37 +01:00
Mads Kiilerich
b0ab086db9 convert: readability and test of rpairs function 2013-11-17 11:18:39 -05:00
Mads Kiilerich
18b361e0b2 tests: make doctest test runner less verbose 2013-11-17 11:16:59 -05:00
Bryan O'Sullivan
6ad1b7d190 dispatch: add doctests for _earlygetopt 2013-04-29 14:14:41 -07:00
Remy Blank
77663c5e65 posix: fix split() for the case where the path is at the root of the filesystem
posixpath.split() strips '/' from the dirname *unless it is the root*. This
patch reproduces this behavior in posix.split(). The old behavior causes a
crash when creating a file at the root of the repo with localrepo.wfile()
when the repo is at the root of the filesystem.
2013-01-09 20:27:17 +01:00
Yann E. MORIN
e24b85ec3e templates/filters: add doctest to the 'person' filter
Add a doctest with an hopefuly-comprehensive list of combinations
we can expect in real-life situations.

This does not cover corner cases, for example when a CR or LF is
embedded in the name (allowed by RFC 5322!).

Code in tests/test-doctest.py contributed by:
    Martin Geisler <mg@aragost.com>
Thanks!

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2012-03-07 01:02:12 +01:00
FUJIWARA Katsunori
f6b7a91d98 minirst: use unicode string as intermediate form for replacement
# this change redones part of e0051068893a, backed out by 38c00c035629

Some character encodings use ASCII characters other than
control/alphabet/digit as a part of multi-bytes characters, so direct
replacing with such characters on strings in local encoding causes
invalid byte sequences.

[mpm: test changed to simple doctest]
2011-10-31 21:06:18 +09:00
Matt Mackall
9580de9b45 util: add a doctest for empty sha() calls 2011-10-31 15:41:39 -05:00
Matt Mackall
005a60af31 revset: add formatspec convenience query builder 2011-07-21 14:05:45 -05:00
Sune Foldager
73c8696ab4 ui: add configint function and tests 2011-05-03 22:28:08 +02:00
Adrian Buehlmann
d3fe813516 store: add some doctests 2011-04-17 17:55:34 +02:00
Mads Kiilerich
6e8efc0e0c hgweb: doctest of url creation from wildcard expansion 2011-02-15 01:04:10 +01:00
Matt Mackall
8946a77df1 date: fix matching of underspecified date ranges
In a date like 10:30, there are two underspecified ends: the specific
end (seconds) and the broad end (day, month, year). When matching
"10:30", we need to allow the specific end to go from 0 to 59 seconds,
while the broad end is assumed to be today's date.

Similar handling applies for a date range like "Mar 1": year is fixed
to today, any time matches.
2010-12-29 14:04:47 -06:00
Patrick Mezard
ad8768fb1a test-doctest: test url.py again, removed by ce9891a26112 2010-12-28 14:53:08 +01:00
Matt Mackall
c7059d3926 encoding: add localstr class to track UTF-8 version of transcoded strings
This allows UTF-8 strings to losslessly round-trip through Mercurial
2010-11-24 15:38:52 -06:00
Mads Kiilerich
2fcbe3473c merge with stable 2010-10-01 00:54:03 +02:00
Mads Kiilerich
04a1302ca7 test-doctest: test the modules that contains doctests 2010-10-01 00:48:51 +02:00
Martin Geisler
e0e3bf4835 match: add narrowmatcher class
This class can be used to adapt an existing match object to a new
match object that only cares about paths within a certain
subdirectory.
2010-09-03 12:58:51 +02:00
Peter Arrenbrecht
b9ce7f49a5 debugbuilddag: build a changelog dag from a concise description
Useful in tests to quickly build a complex DAG in an empty repo.
Handles local tags and named branches.
Options to, at each rev,
 - create a new file,
 - overwrite the same file,
 - append to the same file,
 - write to a specific line in a mergeable file.
Can run shell commands during DAG buildup.
2010-06-10 11:49:48 +02:00
Peter Arrenbrecht
b2bbef20ef dagparser: parses and formats DAGs as concise text
As discussed during the sprint. See the doc comment and doctests
for specification and examples. This is used in subsequent patches
to export revlog and changelog DAGs, and to generate a repo with
a given changelog DAG.
2010-06-10 11:48:15 +02:00
Matt Mackall
a2acbc421b fix up a bunch of check-code warnings 2010-02-09 14:12:22 -06:00
Dirkjan Ochtman
664ef048a7 merge with crew-stable 2008-10-20 14:52:58 +02:00
Dirkjan Ochtman
e085823cf1 clean up trailing spaces 2008-10-20 14:51:55 +02:00
Patrick Mezard
910e49f24f test-doctest: remove TERM env variable only if it's there 2008-10-11 16:40:59 +02:00
Mads Kiilerich
b0d9bb04f5 tests: fix readline escape characters in output for test-doctest.py 2008-09-18 13:48:41 +02:00
Patrick Mezard
8e45917fce convert: fix builtin cvsps under Windows
Drafted and reviewed by Frank Kingswood <frank@kingswood-consulting.co.uk>.
2008-10-13 17:31:03 +01:00
Manuel Holtgrewe
4a33cb8d98 Do not display passwords with pull/push/incoming/outgoing
Passwords specified in the repository URL are now displayed as '***'
when accessing the remote repository.
2007-11-05 20:29:32 +01:00
Alexis S. L. Carvalho
56d1444a26 httprepo: quote the path part of the URL
This should fix a 'hg clone "http://hg.example.org/path with spaces/"'

The code tries to do the right thing when the user passes a path that's
already escaped in part (e.g. "http://hg.example.org/path%20with spaces/").

If we're redirected, urllib2 will happily follow the URL it's given
without escaping anything.  I'm not sure what we would have to hook
to work around that.
2007-08-06 00:35:06 -03:00
Thomas Arendsen Hein
a93551d740 Unified #! paths for python scripts and removed them for test modules. 2007-03-01 22:15:17 +01:00
Benoit Boissinot
eeb30a5065 [extendedchangelog] encode/decode function
encode '\n', '\r' and '\0'
2006-10-02 22:35:37 +02:00