Commit Graph

35 Commits

Author SHA1 Message Date
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