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