Commit Graph

5381 Commits

Author SHA1 Message Date
Mads Kiilerich
1df3d48d73 tests: change odd uses of 'if hghave' to #if 2012-06-10 13:01:40 +02:00
Adrian Buehlmann
cc8d5d2d8e tests/run-tests: avoid C:/ in arguments
MSYS replaces C:/... in arguments with C;... as it interprets the C:/ as a
colon separated POSIX path list. The colon is replaced with ; (path separator
on Windows) according to

  http://www.mingw.org/wiki/Posix_path_conversion

So we must not replace \ with / for neither $TESTTMP nor $TESTDIR, but we
have to keep replacing \ with / for the Popen4 call of function hghave. If we
don't do the latter, test-run-tests.t will fail with

  $ python run-tests.py --local test-run-tests.t

  --- C:\Users\adi\hgrepos\hg-main\tests\test-run-tests.t
  +++ C:\Users\adi\hgrepos\hg-main\tests\test-run-tests.t.err
  @@ -70,6 +70,7 @@
     tested
   #else
     $ echo skipped
  +  skipped
   #endif

   #if false


An additional tweak in test-ssh.t is needed that globs away an encoded path,
as it can't be translated back to $TESTTMP, because the backslashes in the
output have been already encoded as %5C.

This patch makes test-ssh.t pass in MSYS on Windows.
2012-06-10 03:05:59 +02:00
Adrian Buehlmann
a98fa3a65d test-commit: remove extra cd ..
This specific cd .. leaves the base directory of the test ($TESTTMP).

Removing it avoids that test artifacts (e.g. files) are created
outside of the base directory.
2012-06-09 14:20:25 +02:00
Olav Reinert
919979c82d help: test keyword search in translated text.
Tests that help keyword search is able to search the translated help text when
using a non-English language.
2012-06-08 23:37:11 +02:00
Eduard-Cristian Stefan
28068f0f96 test-mq-subrepo-svn: enable for Windows 2012-06-08 05:49:50 +03:00
Eduard-Cristian Stefan
cf08ec9f79 test-convert-git: remove the read-only attribute of repository files
Git object files are stored read-only in the filesystem. Trying to remove a
read-only file on windows will fail with access denied, so we have to make them
writeable before they can be removed.
2012-06-08 05:37:06 +03:00
Eduard-Cristian Stefan
14ce40c59d test-convert: disable autocrlf for git
Git might have autocrlf=true as a global or default setting, especially on
windows. That is not expected in the tests and can cause
+  warning: LF will be replaced by CRLF in d/b.
+  The file will have its original line endings in your working directory.

Explicitly setting it false will make the test pass in some setups - but still
not out of the box.
2012-06-08 05:31:28 +03:00
Adrian Buehlmann
6e5f4815b5 tests/hghave: implement #if true / #if false
For unconditionally testing / skipping a section. Useful for testing the test
infrastructure in test-run-tests.t and for debugging/developing tests.
2012-06-08 15:11:05 +02:00
Adrian Buehlmann
2f072ea573 tests/run-tests: use $TMP on Windows (issue3490)
This is just a short-term workaround for that issue. More work needs to be
done on scmutil.canonpath & friends.

$TMP on Windows is specified to be defined, and it has correct casing, so we
can use that as the default dir for tempfile.mkdtemp on Windows.
2012-06-08 15:11:05 +02:00
Adrian Buehlmann
6a35c44685 test-import: enable for Windows 2012-06-08 15:11:05 +02:00
Adrian Buehlmann
87c663dfca test-import: remove unneeded chmod call
As pointed out by Mads, setting the x bit on dummypatch.py is unneeded, because
it is called with 'python ../dummypatch.py'.
2012-06-08 15:11:05 +02:00
Adrian Buehlmann
3168076da4 test-log: enable for Windows 2012-06-08 15:11:05 +02:00
Adrian Buehlmann
6043ceae50 test-revert: enable for Windows 2012-06-08 15:11:05 +02:00
Thomas Arendsen Hein
b3cb4187dd help: fix 'hg help -k' matching an extension without docs
getattr is not needed, __doc__ always exists and defaults to None
2012-06-07 15:54:40 +02:00
Adrian Buehlmann
519e4c0d6f test-add: enable for Windows 2012-06-05 22:46:14 +02:00
Adrian Buehlmann
dc41c6e820 test-addremove: remove bits about con.xml
Windows reserved filename warnings are already enough tested in test-add.t.
This enables the test for Windows.
2012-06-05 23:13:45 +02:00
Adrian Buehlmann
3bd79faaba hghave: wrap command in 'sh -c "..."' for has_pyflakes()
Without this, the has_pyflakes() check always fails in MSYS on Windows.
2012-05-27 18:25:04 +02:00
Joshua Redstone
e38b770424 revlog: add optional stoprev arg to revlog.ancestors()
This will be used as a step in removing reachable() in a future diff.
Doing it now because bryano is in the process of rewriting ancestors in
C.  This depends on bryano's patch to replace *revs with revs in the
declaration of revlog.ancestors.
2012-06-01 15:44:13 -07:00
Bryan O'Sullivan
141bd09daa revlog: descendants(*revs) becomes descendants(revs) (API)
Once again making the API more rational, as with ancestors.
2012-06-01 12:45:16 -07:00
Bryan O'Sullivan
6ba97b40c1 revlog: ancestors(*revs) becomes ancestors(revs) (API)
Accepting a variable number of arguments as the old API did is
deeply ugly, particularly as it means the API can't be extended
with new arguments.  Partly as a result, we have at least three
different implementations of the same ancestors algorithm (!?).

Most callers were forced to call ancestors(*somelist), adding to
both inefficiency and ugliness.
2012-06-01 12:37:18 -07:00
Adrian Buehlmann
d7c544fe9c test-tags: enable for Windows
It turns out that MSYS does have a chmod.exe, but it has no effect. So, the
inserted "#if unix-permissions" is somewhat redundant, as the test would pass
without it as well: it would simply write the tag cache, despite what the
comment says.

But I'm actually in favor of inserting the #if, as it makes it clearer what's
going on.
2012-06-04 21:40:38 +02:00
Adrian Buehlmann
aa19a6c240 tests: roll test-copy2.t into test-copy.t 2012-06-04 21:09:54 +02:00
Olav Reinert
c77c77574f help: format all output using RST
This change is the last patch needed to implement help text generation based
only on formatting a single text object marked up with RST.
2012-06-02 11:28:43 +02:00
Olav Reinert
54cafa029d help: format command and option list help using RST
This patch changes the function which generates help text about commands and
options to use RST formatting. Tables describing options have been formatted
using RST table markup for some time already, so their appearance does not
change. Command lists, however, change appearance.

To format non-verbose command lists, RST field list markup was chosen, because
it resembles the old format:

<http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists>

In the old (hand-coded) format of non-verbose command lists, the left column is
12 characters wide. Our minirst implementation formats field lists with a left
column 14 characters wide, so this patch changes the appearance of help output
correspondingly:

<http://markmail.org/message/krl4cxopsnii7s6z?q=mercurial+reinert+from:%22Olav+Reinert%22&page=2>

The minirst markup most closely resembling the old verbose command lists is
definition lists. But using it would cause a blank line to be inserted between
each command definition, making the output excessively long, and no more
useful than before. To avoid this, I chose to use field lists also for verbose
command help, resulting in output like this example:

 add           add the specified files on the next commit
 annotate, blame
               show changeset information by line for each file
 clone         make a copy of an existing repository
 commit, ci    commit the specified files or all outstanding changes
 diff          diff repository (or selected files)
 export        dump the header and diffs for one or more changesets
 forget        forget the specified files on the next commit
 init          create a new repository in the given directory
 log, history  show revision history of entire repository or files
 merge         merge working directory with another revision
 phase         set or show the current phase name
 pull          pull changes from the specified source
 push          push changes to the specified destination
 qdiff         diff of the current patch and subsequent modifications
 qinit         init a new queue repository (DEPRECATED)
 qnew          create a new patch
 qpop          pop the current patch off the stack
 qpush         push the next patch onto the stack
 qrefresh      update the current patch
 remove, rm    remove the specified files on the next commit
 serve         start stand-alone webserver
 status, st    show changed files in the working directory
 summary, sum  summarize working directory state
 update, up, checkout, co
               update working directory (or switch revisions)

This change is a move towards generating all help text as a list of strings
marked up with RST.
2012-06-02 11:25:40 +02:00
Adrian Buehlmann
18c4705033 test-revset: enable for Windows
In MSYS, the test fails like this if the hghave exit at the beginning is
removed:

  --- C:\Users\adi\hgrepos\hg-main\tests\test-revset.t
  +++ C:\Users\adi\hgrepos\hg-main\tests\test-revset.t.err
  @@ -58,7 +58,7 @@
     $ hg co 3
     2 files updated, 0 files merged, 0 files removed, 0 files unresolved
     $ hg branch /a/b/c/
  -  marked working directory as branch /a/b/c/
  +  marked working directory as branch a:/b/c/
     (branches are permanent and global, did you want a bookmark?)
     $ hg ci -Aqm"5 bug"

  @@ -252,7 +252,7 @@
     2 a-b-c-
     3 +a+b+c+
     4 -a-b-c-
  -  5 /a/b/c/
  +  5 a:/b/c/
     6 _a_b_c_
     7 .a.b.c.
     $ log 'children(ancestor(4,5))'

due to the posix path conversion done by MSYS globally, as explained here

  http://www.mingw.org/wiki/Posix_path_conversion

The solution is a bit lame, but it is simple and works: don't use strings that
look like '/a/b', in order not to trigger the path magic done by MSYS.

So, if we can agree not to insist on testing branch names starting with '/',
then this relatively simple patch makes the test pass both on Windows with MSYS
and Linux.
2012-06-03 09:06:15 +02:00
Adrian Buehlmann
6949570f9b tests: roll test-commit-copy.t into test-commit.t 2012-06-04 18:40:31 +02:00
Adrian Buehlmann
64ff78f040 tests: roll test-clone-failure.t into test-clone.t 2012-06-04 19:05:22 +02:00
Adrian Buehlmann
638f9b0293 test-clone-failure: enable for Windows using #if 2012-06-01 13:38:18 +02:00
Adrian Buehlmann
90db2767be test-paths.t: enable for Windows using #if
If the no-msys exit at the beginning is removed, the test fails on Windows with
MSYS with:

  --- C:\Users\adi\hgrepos\hg-main\tests\test-paths.t
  +++ C:\Users\adi\hgrepos\hg-main\tests\test-paths.t.err
  @@ -24,7 +24,7 @@
     expand = $TESTTMP/a/foo/bar (glob)
     $ SOMETHING=/foo hg paths
     dupe = $TESTTMP/b (glob)
  -  expand = /foo/bar
  +  expand = c:/MinGW/msys/1.0/foo/bar
     $ hg paths -q
     dupe
     expand

caused by http://www.mingw.org/wiki/Posix_path_conversion .
2012-06-03 19:35:45 +02:00
Mads Kiilerich
7d411da706 tests: introduce c-style conditional sections in .t tests
This makes it possible to have conditional sections like:

#if windows
  $ echo foo
  foo
#else
  $ echo bar
  bar
#endif

The directives and skipped sections are treated like comments, so don't
interleave them with commands and their output.

The parameters to #if are evaluated while preparing the test by passing them
over to hghave. Requirements can thus be negated with 'no-' prefix, and
multiple requirements must all be true to return true.
2012-06-01 02:25:12 +02:00
Adrian Buehlmann
a82229c619 run-tests: don't add python lines to expected dict
For test input lines of *.t files starting with '  >>> ', the code block for
'  >>> '

609:        if l.startswith('  >>> '): # python inlines
610:            after.setdefault(pos, []).append(l)

was (unsurprisingly) executed, but because there was an "if" instead of an
"elif" on the condition "l.startswith('  ... ')", program execution proceeded
to line 636

635:        elif l.startswith('  '): # results
636:            # queue up a list of expected results
637:            expected.setdefault(pos, []).append(l[2:])

due to the fact that if l starts with '  >>> ' it also starts with '  '.

The net effect was that python command lines in *.t files were (surprisingly)
also added to the "expected" dict.

This caused no externally observable bad behavior, as the "expected" dict was
not consulted for these lines.
2012-05-30 14:28:57 +02:00
Adrian Buehlmann
2a2b372dec run-test: replace backslashes in TESTDIR
This may cause troubles in MSYS on Windows.
2012-06-03 19:35:23 +02:00
David Schleimer
499f4df5a8 hg-ssh: read-only flag
Allows you to restrict a ssh key to have read-only access to a set of
repos by passing the --read-only flag to hg-ssh.

This is useful in an environment where the number of unix users you
can or are willing to create is limited.  In such an environment,
multiple users or applications will share a single unix account.  Some
of those applications will likely need read-only access to the
repository.  This change makes it possible to grant them such access
without requiring that they use a separate unix account.
2012-05-22 15:17:37 -07:00
Levi Bard
c4e66ba62d bookmarks: allow existing remote bookmarks to become heads when pushing 2012-05-13 10:21:27 +02:00
Matt Mackall
42a5f1bd45 strip: move bookmark deletion before strip to deal with filecache invalidation 2012-06-01 23:42:27 -05:00
Matt Mackall
da90115a02 merge with stable 2012-06-01 15:14:29 -05:00
Patrick Mezard
5315858d38 patch: keep patching after missing copy source (issue3480)
When applying a patch renaming/copying 'a' to 'b' on a revision where
'a' does not exist, the patching process would abort immediately,
without processing the remaining hunks and without reporting it. This
patch makes the patching no longer abort and possible hunks applied on
the copied/renamed file be written in reject files.
2012-06-01 17:37:56 +02:00
Simon King
099a5c925c revset: add pattern matching to 'extra' revset expression 2012-05-30 23:14:04 +01:00
Simon King
93954249b9 revset: add pattern matching to the 'user' revset expression 2012-05-30 23:13:58 +01:00
Simon King
e5e759a651 revset: add pattern matching to 'bookmarks' revset expression 2012-05-30 23:13:33 +01:00
Simon King
85110850a9 revset: add pattern matching to 'branch' revset expression 2012-05-30 23:13:33 +01:00
Simon King
9ecf845d55 revset: add pattern matching to 'tag' revset expression
If the string provided to the 'tag' predicate starts with 're:', the rest
of the string will be treated as a regular expression and matched against
all tags in the repository.

There is a slight backwards-compatibility problem for people who actually
have tags that start with 're:'. As a workaround, these tags can be matched
using a 'literal:' prefix.

If no tags match the pattern, an error is raised. This matches the behaviour
of the previous exact-match code.
2012-05-30 23:13:33 +01:00
Olav Reinert
70c42374e2 minirst: generate tables as a list of joined lines 2012-06-01 11:58:23 +02:00
Matt Mackall
d4e4a5b5be revpair: handle odd ranges (issue3474) 2012-05-30 14:13:57 -05:00
Christian Ebert
06fe63f255 keyword: support commit --amend (issue3471)
Include a test as well.
2012-05-26 20:46:12 +02:00
Patrick Mezard
139c15da66 revset: fix infinite alias expansion detection
The alias expansion code it changed from:
1- Get replacement tree
2- Substitute arguments in the replacement tree
3- Expand the replacement tree again

into:

1- Get the replacement tree
2- Expand the replacement tree
3- Expand the arguments
4- Substitute the expanded arguments in the replacement tree

and fixes cases like:

  [revsetalias]
  level1($1, $2) = $1 or $2
  level2($1, $2) = level1($2, $1)

  $ hg log -r "level2(level1(1, 2), 3)"

where the original version incorrectly aborted on infinite expansion
error, because it was confusing the expanded aliases with their
arguments.
2012-05-19 17:19:55 +02:00
Patrick Mezard
c7a80dee31 revset: explicitely tag alias arguments for expansion
The current revset alias expansion code works like:
1- Get the replacement tree
2- Substitute the variables in the replacement tree
3- Expand the replacement tree

It makes it easy to substitute alias arguments because the placeholders
are always replaced before the updated replacement tree is expanded
again. Unfortunately, to fix other alias expansion issues, we need to
reorder the sequence and delay the argument substitution. To solve this,
a new "virtual" construct called _aliasarg() is introduced and injected
when parsing the aliases definitions. Only _aliasarg() will be
substituted in the argument expansion phase instead of all regular
matching string. We also check user inputs do not contain unexpected
_aliasarg() instances to avoid argument injections.
2012-05-19 17:18:29 +02:00
Matt Mackall
b49b66c0f2 merge with crew 2012-05-30 14:31:39 -05:00
Matt Mackall
bfe92722a0 merge with stable 2012-05-30 14:21:58 -05:00
Thomas Arendsen Hein
6c60809dcc merge: show renamed on one and deleted on the other side in debug output 2012-05-23 21:34:29 +02:00