##// END OF EJS Templates
py3: add b'' prefixes in tests/test-custom-filters.t...
Pulkit Goyal -
r38082:6e713711 default
parent child Browse files
Show More
@@ -1,66 +1,66 b''
1 $ hg init
1 $ hg init
2
2
3 $ cat > .hg/hgrc <<EOF
3 $ cat > .hg/hgrc <<EOF
4 > [extensions]
4 > [extensions]
5 > prefixfilter = prefix.py
5 > prefixfilter = prefix.py
6 > [encode]
6 > [encode]
7 > *.txt = stripprefix: Copyright 2046, The Masters
7 > *.txt = stripprefix: Copyright 2046, The Masters
8 > [decode]
8 > [decode]
9 > *.txt = insertprefix: Copyright 2046, The Masters
9 > *.txt = insertprefix: Copyright 2046, The Masters
10 > EOF
10 > EOF
11
11
12 $ cat > prefix.py <<EOF
12 $ cat > prefix.py <<EOF
13 > from mercurial import error
13 > from mercurial import error
14 > def stripprefix(s, cmd, filename, **kwargs):
14 > def stripprefix(s, cmd, filename, **kwargs):
15 > header = '%s\n' % cmd
15 > header = b'%s\n' % cmd
16 > if s[:len(header)] != header:
16 > if s[:len(header)] != header:
17 > raise error.Abort('missing header "%s" in %s' % (cmd, filename))
17 > raise error.Abort(b'missing header "%s" in %s' % (cmd, filename))
18 > return s[len(header):]
18 > return s[len(header):]
19 > def insertprefix(s, cmd):
19 > def insertprefix(s, cmd):
20 > return '%s\n%s' % (cmd, s)
20 > return b'%s\n%s' % (cmd, s)
21 > def reposetup(ui, repo):
21 > def reposetup(ui, repo):
22 > repo.adddatafilter('stripprefix:', stripprefix)
22 > repo.adddatafilter(b'stripprefix:', stripprefix)
23 > repo.adddatafilter('insertprefix:', insertprefix)
23 > repo.adddatafilter(b'insertprefix:', insertprefix)
24 > EOF
24 > EOF
25
25
26 $ cat > .hgignore <<EOF
26 $ cat > .hgignore <<EOF
27 > .hgignore
27 > .hgignore
28 > prefix.py
28 > prefix.py
29 > prefix.pyc
29 > prefix.pyc
30 > EOF
30 > EOF
31
31
32 $ cat > stuff.txt <<EOF
32 $ cat > stuff.txt <<EOF
33 > Copyright 2046, The Masters
33 > Copyright 2046, The Masters
34 > Some stuff to ponder very carefully.
34 > Some stuff to ponder very carefully.
35 > EOF
35 > EOF
36 $ hg add stuff.txt
36 $ hg add stuff.txt
37 $ hg ci -m stuff
37 $ hg ci -m stuff
38
38
39 Repository data:
39 Repository data:
40
40
41 $ hg cat stuff.txt
41 $ hg cat stuff.txt
42 Some stuff to ponder very carefully.
42 Some stuff to ponder very carefully.
43
43
44 Fresh checkout:
44 Fresh checkout:
45
45
46 $ rm stuff.txt
46 $ rm stuff.txt
47 $ hg up -C
47 $ hg up -C
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 $ cat stuff.txt
49 $ cat stuff.txt
50 Copyright 2046, The Masters
50 Copyright 2046, The Masters
51 Some stuff to ponder very carefully.
51 Some stuff to ponder very carefully.
52 $ echo "Very very carefully." >> stuff.txt
52 $ echo "Very very carefully." >> stuff.txt
53 $ hg stat
53 $ hg stat
54 M stuff.txt
54 M stuff.txt
55
55
56 $ echo "Unauthorized material subject to destruction." > morestuff.txt
56 $ echo "Unauthorized material subject to destruction." > morestuff.txt
57
57
58 Problem encoding:
58 Problem encoding:
59
59
60 $ hg add morestuff.txt
60 $ hg add morestuff.txt
61 $ hg ci -m morestuff
61 $ hg ci -m morestuff
62 abort: missing header "Copyright 2046, The Masters" in morestuff.txt
62 abort: missing header "Copyright 2046, The Masters" in morestuff.txt
63 [255]
63 [255]
64 $ hg stat
64 $ hg stat
65 M stuff.txt
65 M stuff.txt
66 A morestuff.txt
66 A morestuff.txt
General Comments 0
You need to be logged in to leave comments. Login now