Commit Graph

51 Commits

Author SHA1 Message Date
Augie Fackler
070f42ffe6 tests: update test-archive to pass our module import checker 2017-08-22 14:58:21 -04:00
Augie Fackler
28ce6eb339 tests: update test-archive to always use hashlib
We don't need the fallback to the old modules anymore.
2017-08-22 14:57:52 -04:00
Augie Fackler
e5d7bd82c5 cleanup: use $PYTHON to run python in many more tests
Spotted one of these, then wrote a check-code rule that caught them
all. It will be the next change.
2017-06-20 09:45:02 -04:00
Jun Wu
7bdcbacb01 tests: use LOCALIP
This patch replaces hardcoded 127.0.0.1 with $LOCALIP in all tests.

Till now, the IPv6 series should make tests pass on common IPv6 systems
where the local device has the address "::1" and the hostname "localhost"
resolves to "::1".
2017-02-16 09:38:52 -08:00
Augie Fackler
a0c4b1e6da tests: work around FreeBSD's unzip having slightly different output
According to man 1 unzip, this unzip appeared in FreeBSD 8.0. It's
what comes as /usr/bin/unzip, so we may as well cater to it since it's
easy.
2017-01-18 23:43:41 -05:00
Anton Shestakov
c8fa236a7e hgweb: test the order of archive links 2017-01-11 01:25:07 +08:00
Augie Fackler
afe4cc8905 tests: glob whitespace between path and OK in unzip(1) output
FreeBSD's unzip(1) uses tabs instead of a run of spaces.
2016-07-15 12:49:58 -04:00
timeless
8b2047ee8d tests: test-archive.t use mercurial.util for urllib compat 2016-05-06 19:24:25 +00:00
timeless
dab1736e8d tests: test-archive.t use sys.stdout.buffer for binary output in py3 2016-05-06 19:19:12 +00:00
timeless
87268c8bde tests: test-archive.t use absolute_import
This is a step to adding a mercurial dependency to simplify py3 compat
2016-05-06 19:17:49 +00:00
timeless
58c27b50c6 tests: test-archive.t use open() instead of file() for py3 compat 2016-05-06 19:16:16 +00:00
timeless
1cc4292424 tests: test-archive.t use print_function 2016-05-06 19:15:37 +00:00
timeless
cb60f66ee7 tests: remove lines that enable progress extension
progress has not been an extension for a long time,
it has been integrated into core, thus these lines
have not done anything for a while.
2016-03-20 04:54:35 +00:00
Pierre-Yves David
77d8baf9e3 progress: stop double-wrapping of ui class
We were wrapping the ui class again and again (uisetup, reposetup,
subrepo setup, remote repo setup, etc). We now avoid that. This has
impact on tests that were double-printing data because of this.
2015-06-07 18:11:23 -07:00
Matt Mackall
b709208c37 tests: drop DAEMON_PIDS from killdaemons calls 2015-06-08 14:55:40 -05:00
Matt Mackall
3ad28905f6 tests: drop explicit $TESTDIR from executables
$TESTDIR is added to the path, so this is superfluous. Also,
inconsistent use of quotes means we might have broken on tests with
paths containing spaces.
2015-06-08 14:44:30 -05:00
Pierre-Yves David
281365197e progress: get the extremely verbose output out of default debug
When the progress extension is not enabled, each call to 'ui.progress' used to
issue a debug message. This results is a very verbose output and often redundant
in tests. Dropping it makes tests less volatile to factor they do not meant to
test.

We had to alter the sed trick in 'test-rename-merge2.t'. Sed is used to drop all
output from a certain point and hidding the progress output remove its anchor.
So we anchor on something else.
2015-05-09 23:40:40 -07:00
Siddharth Agarwal
94be18d96c archive: store number of changes since latest tag as well
This is different from latesttagdistance in that while latesttagdistance is
defined to be the length of the longest path to the latest tag,
changessincelatesttag is the number of changes contained in @ that aren't
contained in the latest tag. So, if 't' is the latest tag in the repository
below:

      t
      |
      v
 --o--o----o
    \       \
     ..o..o..@

then latesttagdistance is 2, but changessincelatesttag is 4.

Note that changessincelatesttag is always greater than or equal to the
latesttagdistance -- that's because changessincelatesttag counts all the
changes in the longest path since the latest tag, and possibly others. This is
an important fact that we'll take advantage of in upcoming patches.
2014-12-12 15:27:13 -08:00
Matt Harbison
eae366b6a1 hgweb: fix a crash when using web.archivesubrepos
A matcher is required when enabling the subrepo option on archival.archive(),
because that calls match.narrowmatcher(), which accesses fields on the object.
It's therefore probably a bad idea to default the matcher to None on archive(),
but that's a fix for default.
2014-11-05 21:33:45 -05:00
Matt Harbison
6daa20236a tests: introduce a subrepository to test-archive.t
This will be used in an upcoming patch to add coverage for web.archivesubrepos.
2014-11-05 20:31:58 -05:00
Matt Mackall
11be5cc27c tests: replace exit 80 with #require 2014-08-06 11:43:59 -05:00
Mads Kiilerich
5e0a4774db tests: fix void and invalid test in test-archive.t
An echo statement was missed in the .t-ification in 3bb9b928bd5a so we ended up
with invalid sh syntax. But at the same time a continuation line was marked as
$ instead of > and we thus added the salt that made the expression valid again.
2013-10-03 14:50:46 +02:00
Angel Ezquerra
21863e23e9 hgweb: respond HTTP_NOT_FOUND when an archive request does not match any files 2013-03-21 23:27:37 +01:00
Angel Ezquerra
9b84fa41a7 archive: raise error.Abort if the file pattern matches no files
Note that we could raise this exception even if no pattern were specified, but
the revision contained no files. However this should not happen in practice
since in that case commands.py/archive would exit earlier with an "no working
directory: please specify a revision" error message instead.
2013-03-21 22:09:15 +01:00
Angel Ezquerra
ec145a5631 hgweb: teach archive how to download a specific directory or file
The archive web command now takes into account the "file" request entry, if one
is provided.

The provided "file" is processed as a "path" corresponding to a directory or
file that will be downloaded.

With this change hgweb can to process requests such as:

    http://mercurial.selenic.com/hg/archive/tip.zip/mercurial/templates

This will download all files on the mercurial/templates directory as a zip file.
It is not possible to specify file patterns ('glob', 'relglob', 'path',
'relpath', 're', 'relre' nor 'set'). The server will reject those with a
403 HTTP error response.

Note that this is a first step to add support for downloading directories from
the web interface. A following patch will modify the archiveentry map entry on
the different templates so that it adds the current folder path to the archive
links.
2013-02-10 11:52:05 +01:00
Angel Ezquerra
1216a119f7 test-archive: gracefully handle HTTPErrors on get-with-headers
This avoids pritting out a traceback when a get-with-headers call causes hgweb
to respond with an HTTPError code.
2013-02-06 10:06:45 +01:00
Mads Kiilerich
13cd04eefb tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup 2012-10-10 01:37:54 +02:00
Bryan O'Sullivan
7a018d3dd7 Merge with crew-stable 2012-09-19 09:38:51 -07:00
FUJIWARA Katsunori
e08cbc5b19 archival: add "extended-timestamp" extra block for zip archives (issue3600)
Before this patch, zip archives created by "hg archive" are extracted
with unexpected timestamp, if TZ is not configured as GMT.

This patch adds "extended-timestamp" extra block to zip archives, and
unzip will extract such archives with timestamp specified in added
extra block, even though TZ is not configured as GMT.

Please see documents below for detail about specification of zip file
format and "extended-timestamp" extra block:

  http://www.pkware.com/documents/casestudies/APPNOTE.TXT
  http://www.opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra.fld

Original implementation of this patch was suggested by "Jun Omae
<jun66j5@gmail.com>".
2012-09-18 19:46:15 +09:00
Patrick Mezard
7d8680da1f killdaemons: take file argument explicitely
It makes it easier to use as a generic replacement for kill utility,
mostly for Windows tests.
2012-08-20 22:36:51 +02:00
Mads Kiilerich
1fda0b1af1 tests: prepare get-with-headers.py for MSYS
get-with-headers.py took the http GET parameter as a command line parameter
that had to start with '/'. MSYS on windows will mangle such paths.

Instead of applying a workaround everywhere (such as an extra '/') we let
get-with-headers.py add the mandatory '/'. That is consistent with the
url path handling in the Mercurial url class.

A few tests sent 'GET ?cmd=...' which is invalid. They will now send 'GET
/?cmd=...'.

This will not enable any tests for being run on windows - only remove one
reason they were disabled.
2012-06-21 03:05:02 +02:00
Thomas Arendsen Hein
00da630fc2 merge with stable 2012-06-12 12:10:47 +02:00
Thomas Arendsen Hein
0c30f8dca5 archive: make progress only show files that are actually archived
Before this, files that are excluded (or not included) were shown when
using progress bar or --debug.

Reported by Andrew Shadura.
2012-06-12 12:05:52 +02:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Thomas Arendsen Hein
21bb7c4cdc tests: make tests work if directory contains special characters
With this quoting tests will work e.g. in "/tmp/foo bar/mercurial/".
2012-04-03 19:06:35 +02:00
Mads Kiilerich
8415df7277 tests: use 'hghave serve' to guard tests that requires serve daemon management 2011-11-07 03:24:53 +01:00
Martin Geisler
5a0135a6ca tests: remove redundant mkdir
There are still many tests that check that a bare 'hg init'
initializes the current directory.
2011-04-19 12:04:44 +02:00
Augie Fackler
5de2d97578 progress using tests: disable time estimates to avoid flakiness 2010-12-15 10:55:14 -06:00
Martin Geisler
70d929229e archive: add support for progress extension 2010-11-29 16:17:05 +01:00
Martin Geisler
1b63f30958 test-archive: whitespace cleanup 2010-12-15 09:52:20 +01:00
Brodie Rao
b5fe0d906e tests: add glob matching for unified tests
This adds a " (glob)" marker that works like a simpler version of
(re): "*" is converted to ".*", and "?" is converted to ".".

Both special characters can be escaped using "\", and the backslash
itself can be escaped as well.

Other glob-style syntax, like "**", "[chars]", or "[!chars]", isn't
supported.
2010-09-22 16:06:02 -05:00
Brodie Rao
7d7d96bd74 tests: require regexes in unified tests to be marked with " (re)"
Consider this test:

  $ hg glog --template '{rev}:{node|short} "{desc}"\n'
  @  2:20c4f79fd7ac "3"
  |
  | o  1:38f24201dcab "2"
  |/
  o  0:2a18120dc1c9 "1"

Because each line beginning with "|" can be compiled as a regular
expression (equivalent to ".*|"), they will match any output.

Similarly:

  $ echo foo


The blank output line can be compiled as a regular expression and will
also match any output.

With this patch, none of the above output lines will be matched as
regular expressions. A line must end in " (re)" in order to be matched
as one.

Lines are still matched literally first, so the following will pass:

  $ echo 'foo (re)'
  foo (re)
2010-09-22 16:06:00 -05:00
Brodie Rao
3ed54dfa3d tests: improve regexes in unified tests 2010-09-22 16:05:58 -05:00
Matt Mackall
dcc838ad18 tests: fix touch -t with RHEL 2010-09-22 15:33:08 -05:00
Dan Villiom Podlaski Christiansen
8e99053714 tests: compatibility fix.
'touch -d *' doesn't work on Mac OS X. In order to prevent this from
occuring again, a check for the case is added to 'check-code.py'.
2010-09-21 18:36:23 +02:00
Matt Mackall
5d9fc42983 tests: drop a bunch of sed calls from unified tests 2010-09-21 16:44:13 -05:00
Matt Mackall
89bcf054c9 tests: fixup tests using unzip -l 2010-09-20 15:50:36 -05:00
Matt Mackall
bf9417da11 tests: exit 0 no longer needed on unified tests 2010-09-17 17:03:04 -05:00
Martin Geisler
989dda555a merge with stable 2010-09-20 15:42:58 +02:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00