annotate tests/test-custom-filters @ 8051:718c8f01feb2

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Sat, 11 Apr 2009 23:21:39 +0200
parents f3a8b5360100
children a964ab624385
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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