Mercurial > hg
annotate tests/test-custom-filters @ 7429:dbc40381620e
tests: Skip tests if they will fail because of outer repo
For different reasons these tests will fail if run in a tmpdir which is in a hg
repo.
The following three tests assumes no .hg in path dirs - I don't know how to
work around that:
* test-dispatch explicitly tests for no repo and expects "abort: There is no
Mercurial repository here (.hg not found)!"
* test-extension expects parentui to be None when not cd'ed to a repo dir
* test-globalopts tests that implicit -R works correctly - that could perhaps be
done from another repo instead of assuming no repo
The following two might be worth investigating further:
* test-convert-svn-sink fails for unknown reasons, starting with "abort:
unresolved merge conflicts (see hg resolve)"
* test-glog gets strange failures when testing "from outer space"
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 27 Nov 2008 00:57:31 +0100 |
parents | f3a8b5360100 |
children | a964ab624385 |
rev | line source |
---|---|
6066
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
1 #!/bin/sh |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
2 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
3 hg init |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
4 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
5 cat > .hg/hgrc <<EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
6 [extensions] |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
7 prefixfilter = prefix.py |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
8 [encode] |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
9 *.txt = stripprefix: Copyright 2046, The Masters |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
10 [decode] |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
11 *.txt = insertprefix: Copyright 2046, The Masters |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
12 EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
13 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
14 cat > prefix.py <<EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
15 from mercurial import util |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
16 def stripprefix(s, cmd, filename, **kwargs): |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
17 header = '%s\n' % cmd |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
18 if s[:len(header)] != header: |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
19 raise util.Abort('missing header "%s" in %s' % (cmd, filename)) |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
20 return s[len(header):] |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
21 def insertprefix(s, cmd): |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
22 return '%s\n%s' % (cmd, s) |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
23 def reposetup(ui, repo): |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
24 repo.adddatafilter('stripprefix:', stripprefix) |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
25 repo.adddatafilter('insertprefix:', insertprefix) |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
26 EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
27 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
28 cat > .hgignore <<EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
29 .hgignore |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
30 prefix.py |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
31 prefix.pyc |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
32 EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
33 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
34 cat > stuff.txt <<EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
35 Copyright 2046, The Masters |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
36 Some stuff to ponder very carefully. |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
37 EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
38 hg add stuff.txt |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
39 hg ci -m stuff |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
40 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
41 echo '% Repository data:' |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
42 hg cat stuff.txt |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
43 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
44 echo '% Fresh checkout:' |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
45 rm stuff.txt |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
46 hg up |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
47 cat stuff.txt |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
48 echo >> stuff.txt <<EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
49 Very very carefully. |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
50 EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
51 hg stat |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
52 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
53 cat > morestuff.txt <<EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
54 Unauthorized material subject to destruction. |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
55 EOF |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
56 |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
57 echo '% Problem encoding:' |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
58 hg add morestuff.txt |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
59 hg ci -m morestuff |
f3a8b5360100
Strip filter name from command before passing to filter function.
Jesse Glick <jesse.glick@sun.com>
parents:
diff
changeset
|
60 hg stat |