##// END OF EJS Templates
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich -
r12943:7439ea41 stable
parent child Browse files
Show More
@@ -1,144 +1,144 b''
1 1
2 2 $ "$TESTDIR/hghave" darcs || exit 80
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "convert=" >> $HGRCPATH
5 5 $ echo 'graphlog =' >> $HGRCPATH
6 6 $ DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
7 7 $ HOME=`pwd`/do_not_use_HOME_darcs; export HOME
8 8
9 9 skip if we can't import elementtree
10 10
11 11 $ mkdir dummy
12 12 $ mkdir dummy/_darcs
13 13 $ if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then
14 14 > echo 'skipped: missing feature: elementtree module'
15 15 > exit 80
16 16 > fi
17 17
18 18 try converting darcs1 repository
19 19
20 20 $ hg clone -q "$TESTDIR/darcs1.hg" darcs
21 21 $ hg convert -s darcs darcs/darcs1 2>&1 | grep darcs-1.0
22 22 darcs-1.0 repository format is unsupported, please upgrade
23 23
24 24 initialize darcs repo
25 25
26 26 $ mkdir darcs-repo
27 27 $ cd darcs-repo
28 28 $ darcs init
29 29 $ echo a > a
30 30 $ darcs record -a -l -m p0
31 31 Finished recording patch 'p0'
32 32 $ cd ..
33 33
34 34 branch and update
35 35
36 36 $ darcs get darcs-repo darcs-clone >/dev/null
37 37 $ cd darcs-clone
38 38 $ echo c >> a
39 39 $ echo c > c
40 40 $ darcs record -a -l -m p1.1
41 41 Finished recording patch 'p1.1'
42 42 $ cd ..
43 43
44 44 update source
45 45
46 46 $ cd darcs-repo
47 47 $ echo b >> a
48 48 $ echo b > b
49 49 $ darcs record -a -l -m p1.2
50 50 Finished recording patch 'p1.2'
51 51
52 52 $ darcs pull -a ../darcs-clone
53 53 Backing up ./a(-darcs-backup0)
54 54 We have conflicts in the following files:
55 55 ./a
56 56 Finished pulling and applying.
57 57 $ sleep 1
58 58 $ echo e > a
59 59 $ echo f > f
60 60 $ mkdir dir
61 61 $ echo d > dir/d
62 62 $ echo d > dir/d2
63 63 $ darcs record -a -l -m p2
64 64 Finished recording patch 'p2'
65 65
66 66 test file and directory move
67 67
68 68 $ darcs mv f ff
69 69
70 70 Test remove + move
71 71
72 72 $ darcs remove dir/d2
73 73 $ rm dir/d2
74 74 $ darcs mv dir dir2
75 75 $ darcs record -a -l -m p3
76 76 Finished recording patch 'p3'
77 77
78 78 test utf-8 commit message and author
79 79
80 80 $ echo g > g
81 81
82 82 darcs is encoding agnostic, so it takes whatever bytes it's given
83 83
84 84 $ darcs record -a -l -m 'p4: desc ñ' -A 'author ñ'
85 85 Finished recording patch 'p4: desc \xc3\xb1' (esc)
86 86
87 87 Test latin-1 commit message
88 88
89 89 $ echo h > h
90 90 $ printf "p5: desc " > ../p5
91 91 $ python -c 'print "".join([chr(i) for i in range(128, 256)])' >> ../p5
92 92 $ darcs record -a -l --logfile ../p5
93 93 Finished recording patch 'p5: desc \x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff' (esc)
94 94
95 95 $ glog()
96 96 > {
97 97 > HGENCODING=utf-8 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@"
98 98 > }
99 99 $ cd ..
100 100 $ hg convert darcs-repo darcs-repo-hg
101 101 initializing destination darcs-repo-hg repository
102 102 scanning source...
103 103 sorting...
104 104 converting...
105 105 6 p0
106 106 5 p1.2
107 107 4 p1.1
108 108 3 p2
109 109 2 p3
110 110 1 p4: desc ?
111 111 0 p5: desc ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
112 112
113 113 The converter does not currently handle patch conflicts very well.
114 114 When they occur, it reverts *all* changes and moves forward,
115 115 letting the conflict resolving patch fix collisions.
116 116 Unfortunately, non-conflicting changes, like the addition of the
117 117 "c" file in p1.1 patch are reverted too.
118 118 Just to say that manifest not listing "c" here is a bug.
119 119
120 $ HGENCODING=latin-1 glog -R darcs-repo-hg -r 6 | "$TESTDIR"/printrepr.py
121 o 6 "p5: desc \xc2\x80\xc2\x81\xc2\x82\xc2\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99\xc2\x9a\xc2\x9b\xc2\x9c\xc2\x9d\xc2\x9e\xc2\x9f\xc2\xa0\xc2\xa1\xc2\xa2\xc2\xa3\xc2\xa4\xc2\xa5\xc2\xa6\xc2\xa7\xc2\xa8\xc2\xa9\xc2\xaa\xc2\xab\xc2\xac\xc2\xad\xc2\xae\xc2\xaf\xc2\xb0\xc2\xb1\xc2\xb2\xc2\xb3\xc2\xb4\xc2\xb5\xc2\xb6\xc2\xb7\xc2\xb8\xc2\xb9\xc2\xba\xc2\xbb\xc2\xbc\xc2\xbd\xc2\xbe\xc2\xbf\xc3\x80\xc3\x81\xc3\x82\xc3\x83\xc3\x84\xc3\x85\xc3\x86\xc3\x87\xc3\x88\xc3\x89\xc3\x8a\xc3\x8b\xc3\x8c\xc3\x8d\xc3\x8e\xc3\x8f\xc3\x90\xc3\x91\xc3\x92\xc3\x93\xc3\x94\xc3\x95\xc3\x96\xc3\x97\xc3\x98\xc3\x99\xc3\x9a\xc3\x9b\xc3\x9c\xc3\x9d\xc3\x9e\xc3\x9f\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4\xc3\xa5\xc3\xa6\xc3\xa7\xc3\xa8\xc3\xa9\xc3\xaa\xc3\xab\xc3\xac\xc3\xad\xc3\xae\xc3\xaf\xc3\xb0\xc3\xb1\xc3\xb2\xc3\xb3\xc3\xb4\xc3\xb5\xc3\xb6\xc3\xb7\xc3\xb8\xc3\xb9\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3\xbe\xc3\xbf" (test@example.org) files: h
120 $ HGENCODING=latin-1 glog -R darcs-repo-hg -r 6
121 o 6 "p5: desc \xc2\x80\xc2\x81\xc2\x82\xc2\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99\xc2\x9a\xc2\x9b\xc2\x9c\xc2\x9d\xc2\x9e\xc2\x9f\xc2\xa0\xc2\xa1\xc2\xa2\xc2\xa3\xc2\xa4\xc2\xa5\xc2\xa6\xc2\xa7\xc2\xa8\xc2\xa9\xc2\xaa\xc2\xab\xc2\xac\xc2\xad\xc2\xae\xc2\xaf\xc2\xb0\xc2\xb1\xc2\xb2\xc2\xb3\xc2\xb4\xc2\xb5\xc2\xb6\xc2\xb7\xc2\xb8\xc2\xb9\xc2\xba\xc2\xbb\xc2\xbc\xc2\xbd\xc2\xbe\xc2\xbf\xc3\x80\xc3\x81\xc3\x82\xc3\x83\xc3\x84\xc3\x85\xc3\x86\xc3\x87\xc3\x88\xc3\x89\xc3\x8a\xc3\x8b\xc3\x8c\xc3\x8d\xc3\x8e\xc3\x8f\xc3\x90\xc3\x91\xc3\x92\xc3\x93\xc3\x94\xc3\x95\xc3\x96\xc3\x97\xc3\x98\xc3\x99\xc3\x9a\xc3\x9b\xc3\x9c\xc3\x9d\xc3\x9e\xc3\x9f\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4\xc3\xa5\xc3\xa6\xc3\xa7\xc3\xa8\xc3\xa9\xc3\xaa\xc3\xab\xc3\xac\xc3\xad\xc3\xae\xc3\xaf\xc3\xb0\xc3\xb1\xc3\xb2\xc3\xb3\xc3\xb4\xc3\xb5\xc3\xb6\xc3\xb7\xc3\xb8\xc3\xb9\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3\xbe\xc3\xbf" (test@example.org) files: h (esc)
122 122 |
123 $ HGENCODING=utf-8 glog -R darcs-repo-hg -r 0:5 | "$TESTDIR"/printrepr.py
124 o 5 "p4: desc \xc3\xb1" (author \xc3\xb1) files: g
123 $ HGENCODING=utf-8 glog -R darcs-repo-hg -r 0:5
124 o 5 "p4: desc \xc3\xb1" (author \xc3\xb1) files: g (esc)
125 125 |
126 126 o 4 "p3" (test@example.org) files: dir/d dir/d2 dir2/d f ff
127 127 |
128 128 o 3 "p2" (test@example.org) files: a dir/d dir/d2 f
129 129 |
130 130 o 2 "p1.1" (test@example.org) files:
131 131 |
132 132 o 1 "p1.2" (test@example.org) files: a b
133 133 |
134 134 o 0 "p0" (test@example.org) files: a
135 135
136 136
137 137 $ hg up -q -R darcs-repo-hg
138 138 $ hg -R darcs-repo-hg manifest --debug
139 139 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644 a
140 140 1e88685f5ddec574a34c70af492f95b6debc8741 644 b
141 141 37406831adc447ec2385014019599dfec953c806 644 dir2/d
142 142 b783a337463792a5c7d548ad85a7d3253c16ba8c 644 ff
143 143 0973eb1b2ecc4de7fafe7447ce1b7462108b4848 644 g
144 144 fe6f8b4f507fe3eb524c527192a84920a4288dac 644 h
@@ -1,135 +1,135 b''
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 4 $ cat > $HGRCPATH <<EOF
5 5 > [extensions]
6 6 > convert =
7 7 > graphlog =
8 8 > EOF
9 9
10 10 $ svnadmin create svn-repo
11 11 $ svnadmin load -q svn-repo < "$TESTDIR/svn/encoding.svndump"
12 12
13 13 Convert while testing all possible outputs
14 14
15 15 $ hg --debug convert svn-repo A-hg
16 16 initializing destination A-hg repository
17 17 reparent to file://*/svn-repo (glob)
18 18 run hg sink pre-conversion action
19 19 scanning source...
20 20 found trunk at 'trunk'
21 21 found tags at 'tags'
22 22 found branches at 'branches'
23 23 found branch branch\xc3\xa9 at 5 (esc)
24 24 found branch branch\xc3\xa9e at 6 (esc)
25 25 scanning: 1 revisions
26 26 reparent to file://*/svn-repo/trunk (glob)
27 27 fetching revision log for "/trunk" from 4 to 0
28 28 parsing revision 4 (2 changes)
29 29 parsing revision 3 (4 changes)
30 30 parsing revision 2 (3 changes)
31 31 parsing revision 1 (3 changes)
32 32 no copyfrom path, don't know what to do.
33 33 '/branches' is not under '/trunk', ignoring
34 34 '/tags' is not under '/trunk', ignoring
35 35 scanning: 2 revisions
36 36 reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
37 37 fetching revision log for "/branches/branch\xc3\xa9" from 5 to 0 (esc)
38 38 parsing revision 5 (1 changes)
39 39 reparent to file://*/svn-repo (glob)
40 40 reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
41 41 found parent of branch /branches/branch\xc3\xa9 at 4: /trunk (esc)
42 42 scanning: 3 revisions
43 43 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
44 44 fetching revision log for "/branches/branch\xc3\xa9e" from 6 to 0 (esc)
45 45 parsing revision 6 (1 changes)
46 46 reparent to file://*/svn-repo (glob)
47 47 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
48 48 found parent of branch /branches/branch\xc3\xa9e at 5: /branches/branch\xc3\xa9 (esc)
49 49 scanning: 4 revisions
50 50 scanning: 5 revisions
51 51 scanning: 6 revisions
52 52 sorting...
53 53 converting...
54 54 5 init projA
55 55 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@1
56 56 converting: 0/6 revisions (0.00%)
57 57 4 hello
58 58 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@2
59 59 converting: 1/6 revisions (16.67%)
60 60 reparent to file://*/svn-repo/trunk (glob)
61 61 scanning paths: /trunk/\xc3\xa0 0/3 (0.00%) (esc)
62 62 scanning paths: /trunk/\xc3\xa0/e\xcc\x81 1/3 (33.33%) (esc)
63 63 scanning paths: /trunk/\xc3\xa9 2/3 (66.67%) (esc)
64 64 \xc3\xa0/e\xcc\x81 (esc)
65 65 getting files: \xc3\xa0/e\xcc\x81 1/2 (50.00%) (esc)
66 66 \xc3\xa9 (esc)
67 67 getting files: \xc3\xa9 2/2 (100.00%) (esc)
68 68 3 copy files
69 69 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@3
70 70 converting: 2/6 revisions (33.33%)
71 71 scanning paths: /trunk/\xc3\xa0 0/4 (0.00%) (esc)
72 72 gone from -1
73 73 reparent to file://*/svn-repo (glob)
74 74 reparent to file://*/svn-repo/trunk (glob)
75 75 scanning paths: /trunk/\xc3\xa8 1/4 (25.00%) (esc)
76 76 copied to \xc3\xa8 from \xc3\xa9@2 (esc)
77 77 scanning paths: /trunk/\xc3\xa9 2/4 (50.00%) (esc)
78 78 gone from -1
79 79 reparent to file://*/svn-repo (glob)
80 80 reparent to file://*/svn-repo/trunk (glob)
81 81 scanning paths: /trunk/\xc3\xb9 3/4 (75.00%) (esc)
82 82 mark /trunk/\xc3\xb9 came from \xc3\xa0:2 (esc)
83 83 \xc3\xa0/e\xcc\x81 (esc)
84 84 getting files: \xc3\xa0/e\xcc\x81 1/4 (25.00%) (esc)
85 85 \xc3\xa8 (esc)
86 86 getting files: \xc3\xa8 2/4 (50.00%) (esc)
87 87 \xc3\xa8: copy \xc3\xa9:6b67ccefd5ce6de77e7ead4f5292843a0255329f (esc)
88 88 \xc3\xa9 (esc)
89 89 getting files: \xc3\xa9 3/4 (75.00%) (esc)
90 90 \xc3\xb9/e\xcc\x81 (esc)
91 91 getting files: \xc3\xb9/e\xcc\x81 4/4 (100.00%) (esc)
92 92 \xc3\xb9/e\xcc\x81: copy \xc3\xa0/e\xcc\x81:a9092a3d84a37b9993b5c73576f6de29b7ea50f6 (esc)
93 93 2 remove files
94 94 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@4
95 95 converting: 3/6 revisions (50.00%)
96 96 scanning paths: /trunk/\xc3\xa8 0/2 (0.00%) (esc)
97 97 gone from -1
98 98 reparent to file://*/svn-repo (glob)
99 99 reparent to file://*/svn-repo/trunk (glob)
100 100 scanning paths: /trunk/\xc3\xb9 1/2 (50.00%) (esc)
101 101 gone from -1
102 102 reparent to file://*/svn-repo (glob)
103 103 reparent to file://*/svn-repo/trunk (glob)
104 104 \xc3\xa8 (esc)
105 105 getting files: \xc3\xa8 1/2 (50.00%) (esc)
106 106 \xc3\xb9/e\xcc\x81 (esc)
107 107 getting files: \xc3\xb9/e\xcc\x81 2/2 (100.00%) (esc)
108 108 1 branch to branch?
109 109 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?@5
110 110 converting: 4/6 revisions (66.67%)
111 111 reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
112 112 scanning paths: /branches/branch\xc3\xa9 0/1 (0.00%) (esc)
113 113 0 branch to branch?e
114 114 source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?e@6
115 115 converting: 5/6 revisions (83.33%)
116 116 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
117 117 scanning paths: /branches/branch\xc3\xa9e 0/1 (0.00%) (esc)
118 118 reparent to file://*/svn-repo (glob)
119 119 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
120 120 reparent to file://*/svn-repo (glob)
121 121 reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
122 122 updating tags
123 123 .hgtags
124 124 run hg sink post-conversion action
125 125 $ cd A-hg
126 126 $ hg up
127 127 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
128 128
129 129 Check tags are in UTF-8
130 130
131 $ python -c "print '\n'.join([('%r' % l) for l in file('.hgtags', 'rb').readlines()])"
132 '221c3fdaf24df5f14c0a64c597581e2eacfb47bb branch\xc3\xa9e\n'
133 '7a40952c2db29cf00d9e31df3749e98d8a4bdcbf branch\xc3\xa9\n'
131 $ cat .hgtags
132 221c3fdaf24df5f14c0a64c597581e2eacfb47bb branch\xc3\xa9e (esc)
133 7a40952c2db29cf00d9e31df3749e98d8a4bdcbf branch\xc3\xa9 (esc)
134 134
135 135 $ cd ..
@@ -1,125 +1,125 b''
1 1 Test adding .hgeol
2 2
3 3 $ cat > $HGRCPATH <<EOF
4 4 > [diff]
5 5 > git = 1
6 6 > EOF
7 7 $ seteol () {
8 8 > if [ $1 = "LF" ]; then
9 9 > EOL='\n'
10 10 > else
11 11 > EOL='\r\n'
12 12 > fi
13 13 > }
14 14 $ makerepo () {
15 15 > echo
16 16 > echo "# ==== setup repository ===="
17 17 > echo '% hg init'
18 18 > hg init repo
19 19 > cd repo
20 20 > printf "first\nsecond\nthird\n" > a.txt
21 21 > hg commit -d '100 0' --addremove -m 'LF commit'
22 22 > cd ..
23 23 > }
24 24 $ dotest () {
25 25 > seteol $1
26 26 > echo
27 27 > echo "% hg clone repo repo-$1"
28 28 > hg clone repo repo-$1
29 29 > cd repo-$1
30 30 > cat > .hg/hgrc <<EOF
31 31 > [extensions]
32 32 > eol =
33 33 > [eol]
34 34 > native = LF
35 35 > EOF
36 36 > cat > .hgeol <<EOF
37 37 > [patterns]
38 38 > **.txt = native
39 39 > [repository]
40 40 > native = $1
41 41 > EOF
42 42 > echo '% hg add .hgeol'
43 43 > hg add .hgeol
44 44 > echo '% hg status'
45 45 > hg status
46 46 > echo '% hg commit'
47 47 > hg commit -d '200 0' -m 'Added .hgeol file'
48 48 > echo '% hg status'
49 49 > hg status
50 50 > echo '% hg tip -p'
51 > hg tip -p | python $TESTDIR/printrepr.py
51 > hg tip -p
52 52 > cd ..
53 53 > rm -r repo-$1
54 54 > }
55 55 $ makerepo
56 56
57 57 # ==== setup repository ====
58 58 % hg init
59 59 adding a.txt
60 60 $ dotest LF
61 61
62 62 % hg clone repo repo-LF
63 63 updating to branch default
64 64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 65 % hg add .hgeol
66 66 % hg status
67 67 A .hgeol
68 68 % hg commit
69 69 % hg status
70 70 % hg tip -p
71 71 changeset: 1:33503edb53b0
72 72 tag: tip
73 73 user: test
74 74 date: Thu Jan 01 00:03:20 1970 +0000
75 75 summary: Added .hgeol file
76 76
77 77 diff --git a/.hgeol b/.hgeol
78 78 new file mode 100644
79 79 --- /dev/null
80 80 +++ b/.hgeol
81 81 @@ -0,0 +1,4 @@
82 82 +[patterns]
83 83 +**.txt = native
84 84 +[repository]
85 85 +native = LF
86 86
87 87 $ dotest CRLF
88 88
89 89 % hg clone repo repo-CRLF
90 90 updating to branch default
91 91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 92 % hg add .hgeol
93 93 % hg status
94 94 M a.txt
95 95 A .hgeol
96 96 % hg commit
97 97 % hg status
98 98 % hg tip -p
99 99 changeset: 1:6e64eaa9eb23
100 100 tag: tip
101 101 user: test
102 102 date: Thu Jan 01 00:03:20 1970 +0000
103 103 summary: Added .hgeol file
104 104
105 105 diff --git a/.hgeol b/.hgeol
106 106 new file mode 100644
107 107 --- /dev/null
108 108 +++ b/.hgeol
109 109 @@ -0,0 +1,4 @@
110 110 +[patterns]
111 111 +**.txt = native
112 112 +[repository]
113 113 +native = CRLF
114 114 diff --git a/a.txt b/a.txt
115 115 --- a/a.txt
116 116 +++ b/a.txt
117 117 @@ -1,3 +1,3 @@
118 118 -first
119 119 -second
120 120 -third
121 +first\r
122 +second\r
123 +third\r
121 +first\r (esc)
122 +second\r (esc)
123 +third\r (esc)
124 124
125 125 $ rm -r repo
@@ -1,77 +1,77 b''
1 1 Testing cloning with the EOL extension
2 2
3 3 $ cat > $HGRCPATH <<EOF
4 4 > [diff]
5 5 > git = True
6 6 >
7 7 > [extensions]
8 8 > eol =
9 9 >
10 10 > [eol]
11 11 > native = CRLF
12 12 > EOF
13 13
14 14 setup repository
15 15
16 16 $ hg init repo
17 17 $ cd repo
18 18 $ cat > .hgeol <<EOF
19 19 > [patterns]
20 20 > **.txt = native
21 21 > EOF
22 22 $ printf "first\r\nsecond\r\nthird\r\n" > a.txt
23 23 $ hg commit --addremove -m 'checkin'
24 24 adding .hgeol
25 25 adding a.txt
26 26
27 27 Clone
28 28
29 29 $ cd ..
30 30 $ hg clone repo repo-2
31 31 updating to branch default
32 32 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 33 $ cd repo-2
34 $ python $TESTDIR/printrepr.py < a.txt
35 first\r
36 second\r
37 third\r
38 $ hg cat a.txt | python $TESTDIR/printrepr.py
34 $ cat a.txt
35 first\r (esc)
36 second\r (esc)
37 third\r (esc)
38 $ hg cat a.txt
39 39 first
40 40 second
41 41 third
42 42 $ hg remove .hgeol
43 43 $ hg commit -m 'remove eol'
44 44 $ hg push --quiet
45 45 $ cd ..
46 46
47 47 Test clone of repo with .hgeol in working dir, but no .hgeol in tip
48 48
49 49 $ hg clone repo repo-3
50 50 updating to branch default
51 51 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 52 $ cd repo-3
53 53
54 $ python $TESTDIR/printrepr.py < a.txt
54 $ cat a.txt
55 55 first
56 56 second
57 57 third
58 58
59 59 Test clone of revision with .hgeol
60 60
61 61 $ cd ..
62 62 $ hg clone -r 0 repo repo-4
63 63 adding changesets
64 64 adding manifests
65 65 adding file changes
66 66 added 1 changesets with 2 changes to 2 files
67 67 updating to branch default
68 68 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 69 $ cd repo-4
70 70 $ cat .hgeol
71 71 [patterns]
72 72 **.txt = native
73 73
74 $ python $TESTDIR/printrepr.py < a.txt
75 first\r
76 second\r
77 third\r
74 $ cat a.txt
75 first\r (esc)
76 second\r (esc)
77 third\r (esc)
@@ -1,400 +1,400 b''
1 1 Test EOL patching
2 2
3 3 $ cat > $HGRCPATH <<EOF
4 4 > [diff]
5 5 > git = 1
6 6 > EOF
7 7
8 8 Set up helpers
9 9
10 10 $ seteol () {
11 11 > if [ $1 = "LF" ]; then
12 12 > EOL='\n'
13 13 > else
14 14 > EOL='\r\n'
15 15 > fi
16 16 > }
17 17
18 18 $ makerepo () {
19 19 > seteol $1
20 20 > echo
21 21 > echo "# ==== setup $1 repository ===="
22 22 > echo '% hg init'
23 23 > hg init repo
24 24 > cd repo
25 25 > cat > .hgeol <<EOF
26 26 > [repository]
27 27 > native = $1
28 28 > [patterns]
29 29 > unix.txt = LF
30 30 > win.txt = CRLF
31 31 > **.txt = native
32 32 > EOF
33 33 > printf "first\r\nsecond\r\nthird\r\n" > win.txt
34 34 > printf "first\nsecond\nthird\n" > unix.txt
35 35 > printf "first${EOL}second${EOL}third${EOL}" > native.txt
36 36 > hg commit --addremove -m 'checkin'
37 37 > cd ..
38 38 > }
39 39
40 40 $ dotest () {
41 41 > seteol $1
42 42 > echo
43 43 > echo "% hg clone repo repo-$1"
44 44 > hg clone --noupdate repo repo-$1
45 45 > cd repo-$1
46 46 > cat > .hg/hgrc <<EOF
47 47 > [extensions]
48 48 > eol =
49 49 > [eol]
50 50 > native = $1
51 51 > EOF
52 52 > hg update
53 > echo '% printrepr.py native.txt'
54 > python $TESTDIR/printrepr.py < native.txt
55 > echo '% printrepr.py unix.txt'
56 > python $TESTDIR/printrepr.py < unix.txt
57 > echo '% printrepr.py win.txt'
58 > python $TESTDIR/printrepr.py < win.txt
53 > echo '% native.txt'
54 > cat native.txt
55 > echo '% unix.txt'
56 > cat unix.txt
57 > echo '% win.txt'
58 > cat win.txt
59 59 > printf "first${EOL}third${EOL}" > native.txt
60 60 > printf "first\r\nthird\r\n" > win.txt
61 61 > printf "first\nthird\n" > unix.txt
62 62 > echo '% hg diff'
63 63 > hg diff > p
64 > python $TESTDIR/printrepr.py < p
64 > cat p
65 65 > echo '% hg revert'
66 66 > hg revert --all
67 67 > echo '% hg import'
68 68 > hg import -m 'patch' p
69 > echo '% printrepr.py native.txt'
70 > python $TESTDIR/printrepr.py < native.txt
71 > echo '% printrepr.py unix.txt'
72 > python $TESTDIR/printrepr.py < unix.txt
73 > echo '% printrepr.py win.txt'
74 > python $TESTDIR/printrepr.py < win.txt
69 > echo '% native.txt'
70 > cat native.txt
71 > echo '% unix.txt'
72 > cat unix.txt
73 > echo '% win.txt'
74 > cat win.txt
75 75 > echo '% hg diff -c tip'
76 > hg diff -c tip | python $TESTDIR/printrepr.py
76 > hg diff -c tip
77 77 > cd ..
78 78 > rm -r repo-$1
79 79 > }
80 80
81 81 Run tests
82 82
83 83 $ makerepo LF
84 84
85 85 # ==== setup LF repository ====
86 86 % hg init
87 87 adding .hgeol
88 88 adding native.txt
89 89 adding unix.txt
90 90 adding win.txt
91 91 $ dotest LF
92 92
93 93 % hg clone repo repo-LF
94 94 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 % printrepr.py native.txt
95 % native.txt
96 96 first
97 97 second
98 98 third
99 % printrepr.py unix.txt
99 % unix.txt
100 100 first
101 101 second
102 102 third
103 % printrepr.py win.txt
104 first\r
105 second\r
106 third\r
103 % win.txt
104 first\r (esc)
105 second\r (esc)
106 third\r (esc)
107 107 % hg diff
108 108 diff --git a/native.txt b/native.txt
109 109 --- a/native.txt
110 110 +++ b/native.txt
111 111 @@ -1,3 +1,2 @@
112 112 first
113 113 -second
114 114 third
115 115 diff --git a/unix.txt b/unix.txt
116 116 --- a/unix.txt
117 117 +++ b/unix.txt
118 118 @@ -1,3 +1,2 @@
119 119 first
120 120 -second
121 121 third
122 122 diff --git a/win.txt b/win.txt
123 123 --- a/win.txt
124 124 +++ b/win.txt
125 125 @@ -1,3 +1,2 @@
126 first\r
127 -second\r
128 third\r
126 first\r (esc)
127 -second\r (esc)
128 third\r (esc)
129 129 % hg revert
130 130 reverting native.txt
131 131 reverting unix.txt
132 132 reverting win.txt
133 133 % hg import
134 134 applying p
135 % printrepr.py native.txt
135 % native.txt
136 136 first
137 137 third
138 % printrepr.py unix.txt
138 % unix.txt
139 139 first
140 140 third
141 % printrepr.py win.txt
142 first\r
143 third\r
141 % win.txt
142 first\r (esc)
143 third\r (esc)
144 144 % hg diff -c tip
145 145 diff --git a/native.txt b/native.txt
146 146 --- a/native.txt
147 147 +++ b/native.txt
148 148 @@ -1,3 +1,2 @@
149 149 first
150 150 -second
151 151 third
152 152 diff --git a/unix.txt b/unix.txt
153 153 --- a/unix.txt
154 154 +++ b/unix.txt
155 155 @@ -1,3 +1,2 @@
156 156 first
157 157 -second
158 158 third
159 159 diff --git a/win.txt b/win.txt
160 160 --- a/win.txt
161 161 +++ b/win.txt
162 162 @@ -1,3 +1,2 @@
163 first\r
164 -second\r
165 third\r
163 first\r (esc)
164 -second\r (esc)
165 third\r (esc)
166 166 $ dotest CRLF
167 167
168 168 % hg clone repo repo-CRLF
169 169 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 % printrepr.py native.txt
171 first\r
172 second\r
173 third\r
174 % printrepr.py unix.txt
170 % native.txt
171 first\r (esc)
172 second\r (esc)
173 third\r (esc)
174 % unix.txt
175 175 first
176 176 second
177 177 third
178 % printrepr.py win.txt
179 first\r
180 second\r
181 third\r
178 % win.txt
179 first\r (esc)
180 second\r (esc)
181 third\r (esc)
182 182 % hg diff
183 183 diff --git a/native.txt b/native.txt
184 184 --- a/native.txt
185 185 +++ b/native.txt
186 186 @@ -1,3 +1,2 @@
187 187 first
188 188 -second
189 189 third
190 190 diff --git a/unix.txt b/unix.txt
191 191 --- a/unix.txt
192 192 +++ b/unix.txt
193 193 @@ -1,3 +1,2 @@
194 194 first
195 195 -second
196 196 third
197 197 diff --git a/win.txt b/win.txt
198 198 --- a/win.txt
199 199 +++ b/win.txt
200 200 @@ -1,3 +1,2 @@
201 first\r
202 -second\r
203 third\r
201 first\r (esc)
202 -second\r (esc)
203 third\r (esc)
204 204 % hg revert
205 205 reverting native.txt
206 206 reverting unix.txt
207 207 reverting win.txt
208 208 % hg import
209 209 applying p
210 % printrepr.py native.txt
211 first\r
212 third\r
213 % printrepr.py unix.txt
210 % native.txt
211 first\r (esc)
212 third\r (esc)
213 % unix.txt
214 214 first
215 215 third
216 % printrepr.py win.txt
217 first\r
218 third\r
216 % win.txt
217 first\r (esc)
218 third\r (esc)
219 219 % hg diff -c tip
220 220 diff --git a/native.txt b/native.txt
221 221 --- a/native.txt
222 222 +++ b/native.txt
223 223 @@ -1,3 +1,2 @@
224 224 first
225 225 -second
226 226 third
227 227 diff --git a/unix.txt b/unix.txt
228 228 --- a/unix.txt
229 229 +++ b/unix.txt
230 230 @@ -1,3 +1,2 @@
231 231 first
232 232 -second
233 233 third
234 234 diff --git a/win.txt b/win.txt
235 235 --- a/win.txt
236 236 +++ b/win.txt
237 237 @@ -1,3 +1,2 @@
238 first\r
239 -second\r
240 third\r
238 first\r (esc)
239 -second\r (esc)
240 third\r (esc)
241 241 $ rm -r repo
242 242 $ makerepo CRLF
243 243
244 244 # ==== setup CRLF repository ====
245 245 % hg init
246 246 adding .hgeol
247 247 adding native.txt
248 248 adding unix.txt
249 249 adding win.txt
250 250 $ dotest LF
251 251
252 252 % hg clone repo repo-LF
253 253 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 % printrepr.py native.txt
254 % native.txt
255 255 first
256 256 second
257 257 third
258 % printrepr.py unix.txt
258 % unix.txt
259 259 first
260 260 second
261 261 third
262 % printrepr.py win.txt
263 first\r
264 second\r
265 third\r
262 % win.txt
263 first\r (esc)
264 second\r (esc)
265 third\r (esc)
266 266 % hg diff
267 267 diff --git a/native.txt b/native.txt
268 268 --- a/native.txt
269 269 +++ b/native.txt
270 270 @@ -1,3 +1,2 @@
271 first\r
272 -second\r
273 third\r
271 first\r (esc)
272 -second\r (esc)
273 third\r (esc)
274 274 diff --git a/unix.txt b/unix.txt
275 275 --- a/unix.txt
276 276 +++ b/unix.txt
277 277 @@ -1,3 +1,2 @@
278 278 first
279 279 -second
280 280 third
281 281 diff --git a/win.txt b/win.txt
282 282 --- a/win.txt
283 283 +++ b/win.txt
284 284 @@ -1,3 +1,2 @@
285 first\r
286 -second\r
287 third\r
285 first\r (esc)
286 -second\r (esc)
287 third\r (esc)
288 288 % hg revert
289 289 reverting native.txt
290 290 reverting unix.txt
291 291 reverting win.txt
292 292 % hg import
293 293 applying p
294 % printrepr.py native.txt
294 % native.txt
295 295 first
296 296 third
297 % printrepr.py unix.txt
297 % unix.txt
298 298 first
299 299 third
300 % printrepr.py win.txt
301 first\r
302 third\r
300 % win.txt
301 first\r (esc)
302 third\r (esc)
303 303 % hg diff -c tip
304 304 diff --git a/native.txt b/native.txt
305 305 --- a/native.txt
306 306 +++ b/native.txt
307 307 @@ -1,3 +1,2 @@
308 first\r
309 -second\r
310 third\r
308 first\r (esc)
309 -second\r (esc)
310 third\r (esc)
311 311 diff --git a/unix.txt b/unix.txt
312 312 --- a/unix.txt
313 313 +++ b/unix.txt
314 314 @@ -1,3 +1,2 @@
315 315 first
316 316 -second
317 317 third
318 318 diff --git a/win.txt b/win.txt
319 319 --- a/win.txt
320 320 +++ b/win.txt
321 321 @@ -1,3 +1,2 @@
322 first\r
323 -second\r
324 third\r
322 first\r (esc)
323 -second\r (esc)
324 third\r (esc)
325 325 $ dotest CRLF
326 326
327 327 % hg clone repo repo-CRLF
328 328 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
329 % printrepr.py native.txt
330 first\r
331 second\r
332 third\r
333 % printrepr.py unix.txt
329 % native.txt
330 first\r (esc)
331 second\r (esc)
332 third\r (esc)
333 % unix.txt
334 334 first
335 335 second
336 336 third
337 % printrepr.py win.txt
338 first\r
339 second\r
340 third\r
337 % win.txt
338 first\r (esc)
339 second\r (esc)
340 third\r (esc)
341 341 % hg diff
342 342 diff --git a/native.txt b/native.txt
343 343 --- a/native.txt
344 344 +++ b/native.txt
345 345 @@ -1,3 +1,2 @@
346 first\r
347 -second\r
348 third\r
346 first\r (esc)
347 -second\r (esc)
348 third\r (esc)
349 349 diff --git a/unix.txt b/unix.txt
350 350 --- a/unix.txt
351 351 +++ b/unix.txt
352 352 @@ -1,3 +1,2 @@
353 353 first
354 354 -second
355 355 third
356 356 diff --git a/win.txt b/win.txt
357 357 --- a/win.txt
358 358 +++ b/win.txt
359 359 @@ -1,3 +1,2 @@
360 first\r
361 -second\r
362 third\r
360 first\r (esc)
361 -second\r (esc)
362 third\r (esc)
363 363 % hg revert
364 364 reverting native.txt
365 365 reverting unix.txt
366 366 reverting win.txt
367 367 % hg import
368 368 applying p
369 % printrepr.py native.txt
370 first\r
371 third\r
372 % printrepr.py unix.txt
369 % native.txt
370 first\r (esc)
371 third\r (esc)
372 % unix.txt
373 373 first
374 374 third
375 % printrepr.py win.txt
376 first\r
377 third\r
375 % win.txt
376 first\r (esc)
377 third\r (esc)
378 378 % hg diff -c tip
379 379 diff --git a/native.txt b/native.txt
380 380 --- a/native.txt
381 381 +++ b/native.txt
382 382 @@ -1,3 +1,2 @@
383 first\r
384 -second\r
385 third\r
383 first\r (esc)
384 -second\r (esc)
385 third\r (esc)
386 386 diff --git a/unix.txt b/unix.txt
387 387 --- a/unix.txt
388 388 +++ b/unix.txt
389 389 @@ -1,3 +1,2 @@
390 390 first
391 391 -second
392 392 third
393 393 diff --git a/win.txt b/win.txt
394 394 --- a/win.txt
395 395 +++ b/win.txt
396 396 @@ -1,3 +1,2 @@
397 first\r
398 -second\r
399 third\r
397 first\r (esc)
398 -second\r (esc)
399 third\r (esc)
400 400 $ rm -r repo
@@ -1,152 +1,152 b''
1 1 Test EOL update
2 2
3 3 $ cat > $HGRCPATH <<EOF
4 4 > [diff]
5 5 > git = 1
6 6 > EOF
7 7
8 8 $ seteol () {
9 9 > if [ $1 = "LF" ]; then
10 10 > EOL='\n'
11 11 > else
12 12 > EOL='\r\n'
13 13 > fi
14 14 > }
15 15
16 16 $ makerepo () {
17 17 > echo
18 18 > echo "# ==== setup repository ===="
19 19 > echo '% hg init'
20 20 > hg init repo
21 21 > cd repo
22 22 >
23 23 > cat > .hgeol <<EOF
24 24 > [patterns]
25 25 > **.txt = LF
26 26 > EOF
27 27 >
28 28 > printf "first\nsecond\nthird\n" > a.txt
29 29 > hg commit --addremove -m 'LF commit'
30 30 >
31 31 > cat > .hgeol <<EOF
32 32 > [patterns]
33 33 > **.txt = CRLF
34 34 > EOF
35 35 >
36 36 > printf "first\r\nsecond\r\nthird\r\n" > a.txt
37 37 > hg commit -m 'CRLF commit'
38 38 >
39 39 > cd ..
40 40 > }
41 41
42 42 $ dotest () {
43 43 > seteol $1
44 44 >
45 45 > echo
46 46 > echo "% hg clone repo repo-$1"
47 47 > hg clone --noupdate repo repo-$1
48 48 > cd repo-$1
49 49 >
50 50 > cat > .hg/hgrc <<EOF
51 51 > [extensions]
52 52 > eol =
53 53 > EOF
54 54 >
55 55 > hg update
56 56 >
57 > echo '% printrepr.py a.txt (before)'
58 > python $TESTDIR/printrepr.py < a.txt
57 > echo '% a.txt (before)'
58 > cat a.txt
59 59 >
60 60 > printf "first${EOL}third${EOL}" > a.txt
61 61 >
62 > echo '% printrepr.py a.txt (after)'
63 > python $TESTDIR/printrepr.py < a.txt
62 > echo '% a.txt (after)'
63 > cat a.txt
64 64 > echo '% hg diff'
65 > hg diff | python $TESTDIR/printrepr.py
65 > hg diff
66 66 >
67 67 > echo '% hg update 0'
68 68 > hg update 0
69 69 >
70 > echo '% printrepr.py a.txt'
71 > python $TESTDIR/printrepr.py < a.txt
70 > echo '% a.txt'
71 > cat a.txt
72 72 > echo '% hg diff'
73 > hg diff | python $TESTDIR/printrepr.py
73 > hg diff
74 74 >
75 75 >
76 76 > cd ..
77 77 > rm -r repo-$1
78 78 > }
79 79
80 80 $ makerepo
81 81
82 82 # ==== setup repository ====
83 83 % hg init
84 84 adding .hgeol
85 85 adding a.txt
86 86 $ dotest LF
87 87
88 88 % hg clone repo repo-LF
89 89 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 % printrepr.py a.txt (before)
91 first\r
92 second\r
93 third\r
94 % printrepr.py a.txt (after)
90 % a.txt (before)
91 first\r (esc)
92 second\r (esc)
93 third\r (esc)
94 % a.txt (after)
95 95 first
96 96 third
97 97 % hg diff
98 98 diff --git a/a.txt b/a.txt
99 99 --- a/a.txt
100 100 +++ b/a.txt
101 101 @@ -1,3 +1,2 @@
102 first\r
103 -second\r
104 third\r
102 first\r (esc)
103 -second\r (esc)
104 third\r (esc)
105 105 % hg update 0
106 106 merging a.txt
107 107 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
108 % printrepr.py a.txt
108 % a.txt
109 109 first
110 110 third
111 111 % hg diff
112 112 diff --git a/a.txt b/a.txt
113 113 --- a/a.txt
114 114 +++ b/a.txt
115 115 @@ -1,3 +1,2 @@
116 116 first
117 117 -second
118 118 third
119 119 $ dotest CRLF
120 120
121 121 % hg clone repo repo-CRLF
122 122 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 % printrepr.py a.txt (before)
124 first\r
125 second\r
126 third\r
127 % printrepr.py a.txt (after)
128 first\r
129 third\r
123 % a.txt (before)
124 first\r (esc)
125 second\r (esc)
126 third\r (esc)
127 % a.txt (after)
128 first\r (esc)
129 third\r (esc)
130 130 % hg diff
131 131 diff --git a/a.txt b/a.txt
132 132 --- a/a.txt
133 133 +++ b/a.txt
134 134 @@ -1,3 +1,2 @@
135 first\r
136 -second\r
137 third\r
135 first\r (esc)
136 -second\r (esc)
137 third\r (esc)
138 138 % hg update 0
139 139 merging a.txt
140 140 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
141 % printrepr.py a.txt
141 % a.txt
142 142 first
143 143 third
144 144 % hg diff
145 145 diff --git a/a.txt b/a.txt
146 146 --- a/a.txt
147 147 +++ b/a.txt
148 148 @@ -1,3 +1,2 @@
149 149 first
150 150 -second
151 151 third
152 152 $ rm -r repo
@@ -1,385 +1,385 b''
1 1 Test EOL extension
2 2
3 3 $ cat > $HGRCPATH <<EOF
4 4 > [diff]
5 5 > git = True
6 6 > EOF
7 7
8 8 Set up helpers
9 9
10 10 $ cat > switch-eol.py <<EOF
11 11 > import sys
12 12 > try:
13 13 > import os, msvcrt
14 14 > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
15 15 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
16 16 > except ImportError:
17 17 > pass
18 18 > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n')
19 19 > print "%% switching encoding from %r to %r" % (old, new)
20 20 > for path in sys.argv[2:]:
21 21 > data = file(path, 'rb').read()
22 22 > data = data.replace(old, new)
23 23 > file(path, 'wb').write(data)
24 24 > EOF
25 25
26 26 $ seteol () {
27 27 > if [ $1 = "LF" ]; then
28 28 > EOL='\n'
29 29 > else
30 30 > EOL='\r\n'
31 31 > fi
32 32 > }
33 33
34 34 $ makerepo () {
35 35 > seteol $1
36 36 > echo "% setup $1 repository"
37 37 > hg init repo
38 38 > cd repo
39 39 > cat > .hgeol <<EOF
40 40 > [repository]
41 41 > native = $1
42 42 > [patterns]
43 43 > mixed.txt = BIN
44 44 > **.txt = native
45 45 > EOF
46 46 > printf "first${EOL}second${EOL}third${EOL}" > a.txt
47 47 > hg commit --addremove -m 'checkin'
48 48 > echo
49 49 > cd ..
50 50 > }
51 51
52 52 $ dotest () {
53 53 > seteol $1
54 54 > echo "% hg clone repo repo-$1"
55 55 > hg clone --noupdate repo repo-$1
56 56 > cd repo-$1
57 57 > cat > .hg/hgrc <<EOF
58 58 > [extensions]
59 59 > eol =
60 60 > [eol]
61 61 > native = $1
62 62 > EOF
63 63 > hg update
64 > echo '% printrepr.py a.txt'
65 > python $TESTDIR/printrepr.py < a.txt
64 > echo '% a.txt'
65 > cat a.txt
66 66 > echo '% hg cat a.txt'
67 > hg cat a.txt | python $TESTDIR/printrepr.py
67 > hg cat a.txt
68 68 > printf "fourth${EOL}" >> a.txt
69 > echo '% printrepr.py a.txt'
70 > python $TESTDIR/printrepr.py < a.txt
71 > hg diff | python $TESTDIR/printrepr.py
69 > echo '% a.txt'
70 > cat a.txt
71 > hg diff
72 72 > python ../switch-eol.py $1 a.txt
73 73 > echo '% hg diff only reports a single changed line:'
74 > hg diff | python $TESTDIR/printrepr.py
74 > hg diff
75 75 > echo "% reverting back to $1 format"
76 76 > hg revert a.txt
77 > python $TESTDIR/printrepr.py < a.txt
77 > cat a.txt
78 78 > printf "first\r\nsecond\n" > mixed.txt
79 79 > hg add mixed.txt
80 80 > echo "% hg commit of inconsistent .txt file marked as binary (should work)"
81 81 > hg commit -m 'binary file'
82 82 > echo "% hg commit of inconsistent .txt file marked as native (should fail)"
83 83 > printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt
84 84 > hg commit -m 'inconsistent file'
85 85 > echo "% hg commit --config eol.only-consistent=False (should work)"
86 86 > hg commit --config eol.only-consistent=False -m 'inconsistent file'
87 87 > echo "% hg commit of binary .txt file marked as native (binary files always okay)"
88 88 > printf "first${EOL}\0${EOL}third${EOL}" > a.txt
89 89 > hg commit -m 'binary file'
90 90 > cd ..
91 91 > rm -r repo-$1
92 92 > }
93 93
94 94 $ makemixedrepo () {
95 95 > echo
96 96 > echo "# setup $1 repository"
97 97 > hg init mixed
98 98 > cd mixed
99 99 > printf "foo\r\nbar\r\nbaz\r\n" > win.txt
100 100 > printf "foo\nbar\nbaz\n" > unix.txt
101 101 > #printf "foo\r\nbar\nbaz\r\n" > mixed.txt
102 102 > hg commit --addremove -m 'created mixed files'
103 103 > echo "# setting repository-native EOLs to $1"
104 104 > cat > .hgeol <<EOF
105 105 > [repository]
106 106 > native = $1
107 107 > [patterns]
108 108 > **.txt = native
109 109 > EOF
110 110 > hg commit --addremove -m 'added .hgeol'
111 111 > cd ..
112 112 > }
113 113
114 114 $ testmixed () {
115 115 > echo
116 116 > echo "% hg clone mixed mixed-$1"
117 117 > hg clone mixed mixed-$1
118 118 > cd mixed-$1
119 119 > echo '% hg status (eol extension not yet activated)'
120 120 > hg status
121 121 > cat > .hg/hgrc <<EOF
122 122 > [extensions]
123 123 > eol =
124 124 > [eol]
125 125 > native = $1
126 126 > EOF
127 127 > echo '% hg status (eol activated)'
128 128 > hg status
129 129 > echo '% hg commit'
130 130 > hg commit -m 'synchronized EOLs'
131 131 > echo '% hg status'
132 132 > hg status
133 133 > cd ..
134 134 > rm -r mixed-$1
135 135 > }
136 136
137 137 Basic tests
138 138
139 139 $ makerepo LF
140 140 % setup LF repository
141 141 adding .hgeol
142 142 adding a.txt
143 143
144 144 $ dotest LF
145 145 % hg clone repo repo-LF
146 146 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
147 % printrepr.py a.txt
147 % a.txt
148 148 first
149 149 second
150 150 third
151 151 % hg cat a.txt
152 152 first
153 153 second
154 154 third
155 % printrepr.py a.txt
155 % a.txt
156 156 first
157 157 second
158 158 third
159 159 fourth
160 160 diff --git a/a.txt b/a.txt
161 161 --- a/a.txt
162 162 +++ b/a.txt
163 163 @@ -1,3 +1,4 @@
164 164 first
165 165 second
166 166 third
167 167 +fourth
168 168 % switching encoding from '\n' to '\r\n'
169 169 % hg diff only reports a single changed line:
170 170 diff --git a/a.txt b/a.txt
171 171 --- a/a.txt
172 172 +++ b/a.txt
173 173 @@ -1,3 +1,4 @@
174 174 first
175 175 second
176 176 third
177 177 +fourth
178 178 % reverting back to LF format
179 179 first
180 180 second
181 181 third
182 182 % hg commit of inconsistent .txt file marked as binary (should work)
183 183 % hg commit of inconsistent .txt file marked as native (should fail)
184 184 abort: inconsistent newline style in a.txt
185 185
186 186 % hg commit --config eol.only-consistent=False (should work)
187 187 % hg commit of binary .txt file marked as native (binary files always okay)
188 188 $ dotest CRLF
189 189 % hg clone repo repo-CRLF
190 190 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 % printrepr.py a.txt
192 first\r
193 second\r
194 third\r
191 % a.txt
192 first\r (esc)
193 second\r (esc)
194 third\r (esc)
195 195 % hg cat a.txt
196 196 first
197 197 second
198 198 third
199 % printrepr.py a.txt
200 first\r
201 second\r
202 third\r
203 fourth\r
199 % a.txt
200 first\r (esc)
201 second\r (esc)
202 third\r (esc)
203 fourth\r (esc)
204 204 diff --git a/a.txt b/a.txt
205 205 --- a/a.txt
206 206 +++ b/a.txt
207 207 @@ -1,3 +1,4 @@
208 208 first
209 209 second
210 210 third
211 211 +fourth
212 212 % switching encoding from '\r\n' to '\n'
213 213 % hg diff only reports a single changed line:
214 214 diff --git a/a.txt b/a.txt
215 215 --- a/a.txt
216 216 +++ b/a.txt
217 217 @@ -1,3 +1,4 @@
218 218 first
219 219 second
220 220 third
221 221 +fourth
222 222 % reverting back to CRLF format
223 first\r
224 second\r
225 third\r
223 first\r (esc)
224 second\r (esc)
225 third\r (esc)
226 226 % hg commit of inconsistent .txt file marked as binary (should work)
227 227 % hg commit of inconsistent .txt file marked as native (should fail)
228 228 abort: inconsistent newline style in a.txt
229 229
230 230 % hg commit --config eol.only-consistent=False (should work)
231 231 % hg commit of binary .txt file marked as native (binary files always okay)
232 232 $ rm -r repo
233 233 $ makerepo CRLF
234 234 % setup CRLF repository
235 235 adding .hgeol
236 236 adding a.txt
237 237
238 238 $ dotest LF
239 239 % hg clone repo repo-LF
240 240 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 % printrepr.py a.txt
241 % a.txt
242 242 first
243 243 second
244 244 third
245 245 % hg cat a.txt
246 first\r
247 second\r
248 third\r
249 % printrepr.py a.txt
246 first\r (esc)
247 second\r (esc)
248 third\r (esc)
249 % a.txt
250 250 first
251 251 second
252 252 third
253 253 fourth
254 254 diff --git a/a.txt b/a.txt
255 255 --- a/a.txt
256 256 +++ b/a.txt
257 257 @@ -1,3 +1,4 @@
258 first\r
259 second\r
260 third\r
261 +fourth\r
258 first\r (esc)
259 second\r (esc)
260 third\r (esc)
261 +fourth\r (esc)
262 262 % switching encoding from '\n' to '\r\n'
263 263 % hg diff only reports a single changed line:
264 264 diff --git a/a.txt b/a.txt
265 265 --- a/a.txt
266 266 +++ b/a.txt
267 267 @@ -1,3 +1,4 @@
268 first\r
269 second\r
270 third\r
271 +fourth\r
268 first\r (esc)
269 second\r (esc)
270 third\r (esc)
271 +fourth\r (esc)
272 272 % reverting back to LF format
273 273 first
274 274 second
275 275 third
276 276 % hg commit of inconsistent .txt file marked as binary (should work)
277 277 % hg commit of inconsistent .txt file marked as native (should fail)
278 278 abort: inconsistent newline style in a.txt
279 279
280 280 % hg commit --config eol.only-consistent=False (should work)
281 281 % hg commit of binary .txt file marked as native (binary files always okay)
282 282 $ dotest CRLF
283 283 % hg clone repo repo-CRLF
284 284 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
285 % printrepr.py a.txt
286 first\r
287 second\r
288 third\r
285 % a.txt
286 first\r (esc)
287 second\r (esc)
288 third\r (esc)
289 289 % hg cat a.txt
290 first\r
291 second\r
292 third\r
293 % printrepr.py a.txt
294 first\r
295 second\r
296 third\r
297 fourth\r
290 first\r (esc)
291 second\r (esc)
292 third\r (esc)
293 % a.txt
294 first\r (esc)
295 second\r (esc)
296 third\r (esc)
297 fourth\r (esc)
298 298 diff --git a/a.txt b/a.txt
299 299 --- a/a.txt
300 300 +++ b/a.txt
301 301 @@ -1,3 +1,4 @@
302 first\r
303 second\r
304 third\r
305 +fourth\r
302 first\r (esc)
303 second\r (esc)
304 third\r (esc)
305 +fourth\r (esc)
306 306 % switching encoding from '\r\n' to '\n'
307 307 % hg diff only reports a single changed line:
308 308 diff --git a/a.txt b/a.txt
309 309 --- a/a.txt
310 310 +++ b/a.txt
311 311 @@ -1,3 +1,4 @@
312 first\r
313 second\r
314 third\r
315 +fourth\r
312 first\r (esc)
313 second\r (esc)
314 third\r (esc)
315 +fourth\r (esc)
316 316 % reverting back to CRLF format
317 first\r
318 second\r
319 third\r
317 first\r (esc)
318 second\r (esc)
319 third\r (esc)
320 320 % hg commit of inconsistent .txt file marked as binary (should work)
321 321 % hg commit of inconsistent .txt file marked as native (should fail)
322 322 abort: inconsistent newline style in a.txt
323 323
324 324 % hg commit --config eol.only-consistent=False (should work)
325 325 % hg commit of binary .txt file marked as native (binary files always okay)
326 326 $ rm -r repo
327 327
328 328 Mixed tests
329 329
330 330 $ makemixedrepo LF
331 331
332 332 # setup LF repository
333 333 adding unix.txt
334 334 adding win.txt
335 335 # setting repository-native EOLs to LF
336 336 adding .hgeol
337 337 $ testmixed LF
338 338
339 339 % hg clone mixed mixed-LF
340 340 updating to branch default
341 341 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 342 % hg status (eol extension not yet activated)
343 343 % hg status (eol activated)
344 344 M win.txt
345 345 % hg commit
346 346 % hg status
347 347 $ testmixed CRLF
348 348
349 349 % hg clone mixed mixed-CRLF
350 350 updating to branch default
351 351 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 352 % hg status (eol extension not yet activated)
353 353 % hg status (eol activated)
354 354 M win.txt
355 355 % hg commit
356 356 % hg status
357 357 $ rm -r mixed
358 358 $ makemixedrepo CRLF
359 359
360 360 # setup CRLF repository
361 361 adding unix.txt
362 362 adding win.txt
363 363 # setting repository-native EOLs to CRLF
364 364 adding .hgeol
365 365 $ testmixed LF
366 366
367 367 % hg clone mixed mixed-LF
368 368 updating to branch default
369 369 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 370 % hg status (eol extension not yet activated)
371 371 % hg status (eol activated)
372 372 M unix.txt
373 373 % hg commit
374 374 % hg status
375 375 $ testmixed CRLF
376 376
377 377 % hg clone mixed mixed-CRLF
378 378 updating to branch default
379 379 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 380 % hg status (eol extension not yet activated)
381 381 % hg status (eol activated)
382 382 M unix.txt
383 383 % hg commit
384 384 % hg status
385 385 $ rm -r mixed
@@ -1,385 +1,385 b''
1 1
2 2 $ hg init
3 3
4 4 New file:
5 5
6 6 $ hg import -d "1000000 0" -mnew - <<EOF
7 7 > diff --git a/new b/new
8 8 > new file mode 100644
9 9 > index 0000000..7898192
10 10 > --- /dev/null
11 11 > +++ b/new
12 12 > @@ -0,0 +1 @@
13 13 > +a
14 14 > EOF
15 15 applying patch from stdin
16 16
17 17 $ hg tip -q
18 18 0:ae3ee40d2079
19 19
20 20 New empty file:
21 21
22 22 $ hg import -d "1000000 0" -mempty - <<EOF
23 23 > diff --git a/empty b/empty
24 24 > new file mode 100644
25 25 > EOF
26 26 applying patch from stdin
27 27
28 28 $ hg tip -q
29 29 1:ab199dc869b5
30 30
31 31 $ hg locate empty
32 32 empty
33 33
34 34 chmod +x:
35 35
36 36 $ hg import -d "1000000 0" -msetx - <<EOF
37 37 > diff --git a/new b/new
38 38 > old mode 100644
39 39 > new mode 100755
40 40 > EOF
41 41 applying patch from stdin
42 42
43 43 $ hg tip -q
44 44 2:3a34410f282e
45 45
46 46 $ test -x new
47 47
48 48 Copy:
49 49
50 50 $ hg import -d "1000000 0" -mcopy - <<EOF
51 51 > diff --git a/new b/copy
52 52 > old mode 100755
53 53 > new mode 100644
54 54 > similarity index 100%
55 55 > copy from new
56 56 > copy to copy
57 57 > diff --git a/new b/copyx
58 58 > similarity index 100%
59 59 > copy from new
60 60 > copy to copyx
61 61 > EOF
62 62 applying patch from stdin
63 63
64 64 $ hg tip -q
65 65 3:37bacb7ca14d
66 66
67 67 $ if "$TESTDIR/hghave" -q execbit; then
68 68 > test -f copy -a ! -x copy || echo bad
69 69 > test -x copyx || echo bad
70 70 > else
71 71 > test -f copy || echo bad
72 72 > fi
73 73
74 74 $ cat copy
75 75 a
76 76
77 77 $ hg cat copy
78 78 a
79 79
80 80 Rename:
81 81
82 82 $ hg import -d "1000000 0" -mrename - <<EOF
83 83 > diff --git a/copy b/rename
84 84 > similarity index 100%
85 85 > rename from copy
86 86 > rename to rename
87 87 > EOF
88 88 applying patch from stdin
89 89
90 90 $ hg tip -q
91 91 4:47b81a94361d
92 92
93 93 $ hg locate
94 94 copyx
95 95 empty
96 96 new
97 97 rename
98 98
99 99 Delete:
100 100
101 101 $ hg import -d "1000000 0" -mdelete - <<EOF
102 102 > diff --git a/copyx b/copyx
103 103 > deleted file mode 100755
104 104 > index 7898192..0000000
105 105 > --- a/copyx
106 106 > +++ /dev/null
107 107 > @@ -1 +0,0 @@
108 108 > -a
109 109 > EOF
110 110 applying patch from stdin
111 111
112 112 $ hg tip -q
113 113 5:d9b001d98336
114 114
115 115 $ hg locate
116 116 empty
117 117 new
118 118 rename
119 119
120 120 $ test -f copyx
121 121 [1]
122 122
123 123 Regular diff:
124 124
125 125 $ hg import -d "1000000 0" -mregular - <<EOF
126 126 > diff --git a/rename b/rename
127 127 > index 7898192..72e1fe3 100644
128 128 > --- a/rename
129 129 > +++ b/rename
130 130 > @@ -1 +1,5 @@
131 131 > a
132 132 > +a
133 133 > +a
134 134 > +a
135 135 > +a
136 136 > EOF
137 137 applying patch from stdin
138 138
139 139 $ hg tip -q
140 140 6:ebe901e7576b
141 141
142 142 Copy and modify:
143 143
144 144 $ hg import -d "1000000 0" -mcopymod - <<EOF
145 145 > diff --git a/rename b/copy2
146 146 > similarity index 80%
147 147 > copy from rename
148 148 > copy to copy2
149 149 > index 72e1fe3..b53c148 100644
150 150 > --- a/rename
151 151 > +++ b/copy2
152 152 > @@ -1,5 +1,5 @@
153 153 > a
154 154 > a
155 155 > -a
156 156 > +b
157 157 > a
158 158 > a
159 159 > EOF
160 160 applying patch from stdin
161 161
162 162 $ hg tip -q
163 163 7:18f368958ecd
164 164
165 165 $ hg cat copy2
166 166 a
167 167 a
168 168 b
169 169 a
170 170 a
171 171
172 172 Rename and modify:
173 173
174 174 $ hg import -d "1000000 0" -mrenamemod - <<EOF
175 175 > diff --git a/copy2 b/rename2
176 176 > similarity index 80%
177 177 > rename from copy2
178 178 > rename to rename2
179 179 > index b53c148..8f81e29 100644
180 180 > --- a/copy2
181 181 > +++ b/rename2
182 182 > @@ -1,5 +1,5 @@
183 183 > a
184 184 > a
185 185 > b
186 186 > -a
187 187 > +c
188 188 > a
189 189 > EOF
190 190 applying patch from stdin
191 191
192 192 $ hg tip -q
193 193 8:c32b0d7e6f44
194 194
195 195 $ hg locate copy2
196 196 [1]
197 197 $ hg cat rename2
198 198 a
199 199 a
200 200 b
201 201 c
202 202 a
203 203
204 204 One file renamed multiple times:
205 205
206 206 $ hg import -d "1000000 0" -mmultirenames - <<EOF
207 207 > diff --git a/rename2 b/rename3
208 208 > rename from rename2
209 209 > rename to rename3
210 210 > diff --git a/rename2 b/rename3-2
211 211 > rename from rename2
212 212 > rename to rename3-2
213 213 > EOF
214 214 applying patch from stdin
215 215
216 216 $ hg tip -q
217 217 9:034a6bf95330
218 218
219 219 $ hg log -vr. --template '{rev} {files} / {file_copies}\n'
220 220 9 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2)
221 221
222 222 $ hg locate rename2 rename3 rename3-2
223 223 rename3
224 224 rename3-2
225 225
226 226 $ hg cat rename3
227 227 a
228 228 a
229 229 b
230 230 c
231 231 a
232 232
233 233 $ hg cat rename3-2
234 234 a
235 235 a
236 236 b
237 237 c
238 238 a
239 239
240 240 $ echo foo > foo
241 241 $ hg add foo
242 242 $ hg ci -m 'add foo'
243 243
244 244 Binary files and regular patch hunks:
245 245
246 246 $ hg import -d "1000000 0" -m binaryregular - <<EOF
247 247 > diff --git a/binary b/binary
248 248 > new file mode 100644
249 249 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
250 250 > GIT binary patch
251 251 > literal 4
252 252 > Lc\${NkU|;|M00aO5
253 253 >
254 254 > diff --git a/foo b/foo2
255 255 > rename from foo
256 256 > rename to foo2
257 257 > EOF
258 258 applying patch from stdin
259 259
260 260 $ hg tip -q
261 261 11:c39bce63e786
262 262
263 263 $ cat foo2
264 264 foo
265 265
266 266 $ hg manifest --debug | grep binary
267 267 045c85ba38952325e126c70962cc0f9d9077bc67 644 binary
268 268
269 269 Multiple binary files:
270 270
271 271 $ hg import -d "1000000 0" -m multibinary - <<EOF
272 272 > diff --git a/mbinary1 b/mbinary1
273 273 > new file mode 100644
274 274 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
275 275 > GIT binary patch
276 276 > literal 4
277 277 > Lc\${NkU|;|M00aO5
278 278 >
279 279 > diff --git a/mbinary2 b/mbinary2
280 280 > new file mode 100644
281 281 > index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490
282 282 > GIT binary patch
283 283 > literal 5
284 284 > Mc\${NkU|\`?^000jF3jhEB
285 285 >
286 286 > EOF
287 287 applying patch from stdin
288 288
289 289 $ hg tip -q
290 290 12:30b530085242
291 291
292 292 $ hg manifest --debug | grep mbinary
293 293 045c85ba38952325e126c70962cc0f9d9077bc67 644 mbinary1
294 294 a874b471193996e7cb034bb301cac7bdaf3e3f46 644 mbinary2
295 295
296 296 Filenames with spaces:
297 297
298 298 $ hg import -d "1000000 0" -m spaces - <<EOF
299 299 > diff --git a/foo bar b/foo bar
300 300 > new file mode 100644
301 301 > index 0000000..257cc56
302 302 > --- /dev/null
303 303 > +++ b/foo bar
304 304 > @@ -0,0 +1 @@
305 305 > +foo
306 306 > EOF
307 307 applying patch from stdin
308 308
309 309 $ hg tip -q
310 310 13:04750ef42fb3
311 311
312 312 $ cat "foo bar"
313 313 foo
314 314
315 315 Copy then modify the original file:
316 316
317 317 $ hg import -d "1000000 0" -m copy-mod-orig - <<EOF
318 318 > diff --git a/foo2 b/foo2
319 319 > index 257cc56..fe08ec6 100644
320 320 > --- a/foo2
321 321 > +++ b/foo2
322 322 > @@ -1 +1,2 @@
323 323 > foo
324 324 > +new line
325 325 > diff --git a/foo2 b/foo3
326 326 > similarity index 100%
327 327 > copy from foo2
328 328 > copy to foo3
329 329 > EOF
330 330 applying patch from stdin
331 331
332 332 $ hg tip -q
333 333 14:c4cd9cdeaa74
334 334
335 335 $ cat foo3
336 336 foo
337 337
338 338 Move text file and patch as binary
339 339
340 340 $ echo a > text2
341 341 $ hg ci -Am0
342 342 adding text2
343 343 $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
344 344 > diff --git a/text2 b/binary2
345 345 > rename from text2
346 346 > rename to binary2
347 347 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
348 348 > GIT binary patch
349 349 > literal 5
350 350 > Mc$`b*O5$Pw00T?_*Z=?k
351 351 >
352 352 > EOF
353 353 applying patch from stdin
354 354
355 $ python $TESTDIR/printrepr.py < binary2
355 $ cat binary2
356 356 a
357 357 b
358 \x00
358 \x00 (no-eol) (esc)
359 359
360 360 $ hg st --copies --change .
361 361 A binary2
362 362 text2
363 363 R text2
364 364 $ cd ..
365 365
366 366 Consecutive import with renames (issue2459)
367 367
368 368 $ hg init issue2459
369 369 $ cd issue2459
370 370 $ hg import --no-commit --force - <<EOF
371 371 > diff --git a/a b/a
372 372 > new file mode 100644
373 373 > EOF
374 374 applying patch from stdin
375 375 $ hg import --no-commit --force - <<EOF
376 376 > diff --git a/a b/b
377 377 > rename from a
378 378 > rename to b
379 379 > EOF
380 380 applying patch from stdin
381 381 a has not been committed yet, so no copy data will be stored for b.
382 382 $ hg debugstate
383 383 a 0 -1 unset b
384 384 $ hg ci -m done
385 385 $ cd ..
@@ -1,1079 +1,1077 b''
1 1 An attempt at more fully testing the hgweb web interface.
2 2 The following things are tested elsewhere and are therefore omitted:
3 3 - archive, tested in test-archive
4 4 - unbundle, tested in test-push-http
5 5 - changegroupsubset, tested in test-pull
6 6
7 7 Set up the repo
8 8
9 9 $ hg init test
10 10 $ cd test
11 11 $ mkdir da
12 12 $ echo foo > da/foo
13 13 $ echo foo > foo
14 14 $ hg ci -Ambase
15 15 adding da/foo
16 16 adding foo
17 17 $ hg tag 1.0
18 18 $ echo another > foo
19 19 $ hg branch stable
20 20 marked working directory as branch stable
21 21 $ hg ci -Ambranch
22 22 $ hg serve --config server.uncompressed=False -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log
23 23 $ cat hg.pid >> $DAEMON_PIDS
24 24
25 25 Logs and changes
26 26
27 27 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/?style=atom'
28 28 200 Script output follows
29 29
30 30 <?xml version="1.0" encoding="ascii"?>
31 31 <feed xmlns="http://www.w3.org/2005/Atom">
32 32 <!-- Changelog -->
33 33 <id>http://*:$HGPORT/</id> (glob)
34 34 <link rel="self" href="http://*:$HGPORT/atom-log"/> (glob)
35 35 <link rel="alternate" href="http://*:$HGPORT/"/> (glob)
36 36 <title>test Changelog</title>
37 37 <updated>1970-01-01T00:00:00+00:00</updated>
38 38
39 39 <entry>
40 40 <title>branch</title>
41 41 <id>http://*:$HGPORT/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id> (glob)
42 42 <link href="http://*:$HGPORT/rev/1d22e65f027e"/> (glob)
43 43 <author>
44 44 <name>test</name>
45 45 <email>&#116;&#101;&#115;&#116;</email>
46 46 </author>
47 47 <updated>1970-01-01T00:00:00+00:00</updated>
48 48 <published>1970-01-01T00:00:00+00:00</published>
49 49 <content type="xhtml">
50 50 <div xmlns="http://www.w3.org/1999/xhtml">
51 51 <pre xml:space="preserve">branch</pre>
52 52 </div>
53 53 </content>
54 54 </entry>
55 55 <entry>
56 56 <title>Added tag 1.0 for changeset 2ef0ac749a14</title>
57 57 <id>http://*:$HGPORT/#changeset-a4f92ed23982be056b9852de5dfe873eaac7f0de</id> (glob)
58 58 <link href="http://*:$HGPORT/rev/a4f92ed23982"/> (glob)
59 59 <author>
60 60 <name>test</name>
61 61 <email>&#116;&#101;&#115;&#116;</email>
62 62 </author>
63 63 <updated>1970-01-01T00:00:00+00:00</updated>
64 64 <published>1970-01-01T00:00:00+00:00</published>
65 65 <content type="xhtml">
66 66 <div xmlns="http://www.w3.org/1999/xhtml">
67 67 <pre xml:space="preserve">Added tag 1.0 for changeset 2ef0ac749a14</pre>
68 68 </div>
69 69 </content>
70 70 </entry>
71 71 <entry>
72 72 <title>base</title>
73 73 <id>http://*:$HGPORT/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id> (glob)
74 74 <link href="http://*:$HGPORT/rev/2ef0ac749a14"/> (glob)
75 75 <author>
76 76 <name>test</name>
77 77 <email>&#116;&#101;&#115;&#116;</email>
78 78 </author>
79 79 <updated>1970-01-01T00:00:00+00:00</updated>
80 80 <published>1970-01-01T00:00:00+00:00</published>
81 81 <content type="xhtml">
82 82 <div xmlns="http://www.w3.org/1999/xhtml">
83 83 <pre xml:space="preserve">base</pre>
84 84 </div>
85 85 </content>
86 86 </entry>
87 87
88 88 </feed>
89 89 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/1/?style=atom'
90 90 200 Script output follows
91 91
92 92 <?xml version="1.0" encoding="ascii"?>
93 93 <feed xmlns="http://www.w3.org/2005/Atom">
94 94 <!-- Changelog -->
95 95 <id>http://*:$HGPORT/</id> (glob)
96 96 <link rel="self" href="http://*:$HGPORT/atom-log"/> (glob)
97 97 <link rel="alternate" href="http://*:$HGPORT/"/> (glob)
98 98 <title>test Changelog</title>
99 99 <updated>1970-01-01T00:00:00+00:00</updated>
100 100
101 101 <entry>
102 102 <title>branch</title>
103 103 <id>http://*:$HGPORT/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id> (glob)
104 104 <link href="http://*:$HGPORT/rev/1d22e65f027e"/> (glob)
105 105 <author>
106 106 <name>test</name>
107 107 <email>&#116;&#101;&#115;&#116;</email>
108 108 </author>
109 109 <updated>1970-01-01T00:00:00+00:00</updated>
110 110 <published>1970-01-01T00:00:00+00:00</published>
111 111 <content type="xhtml">
112 112 <div xmlns="http://www.w3.org/1999/xhtml">
113 113 <pre xml:space="preserve">branch</pre>
114 114 </div>
115 115 </content>
116 116 </entry>
117 117 <entry>
118 118 <title>Added tag 1.0 for changeset 2ef0ac749a14</title>
119 119 <id>http://*:$HGPORT/#changeset-a4f92ed23982be056b9852de5dfe873eaac7f0de</id> (glob)
120 120 <link href="http://*:$HGPORT/rev/a4f92ed23982"/> (glob)
121 121 <author>
122 122 <name>test</name>
123 123 <email>&#116;&#101;&#115;&#116;</email>
124 124 </author>
125 125 <updated>1970-01-01T00:00:00+00:00</updated>
126 126 <published>1970-01-01T00:00:00+00:00</published>
127 127 <content type="xhtml">
128 128 <div xmlns="http://www.w3.org/1999/xhtml">
129 129 <pre xml:space="preserve">Added tag 1.0 for changeset 2ef0ac749a14</pre>
130 130 </div>
131 131 </content>
132 132 </entry>
133 133 <entry>
134 134 <title>base</title>
135 135 <id>http://*:$HGPORT/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id> (glob)
136 136 <link href="http://*:$HGPORT/rev/2ef0ac749a14"/> (glob)
137 137 <author>
138 138 <name>test</name>
139 139 <email>&#116;&#101;&#115;&#116;</email>
140 140 </author>
141 141 <updated>1970-01-01T00:00:00+00:00</updated>
142 142 <published>1970-01-01T00:00:00+00:00</published>
143 143 <content type="xhtml">
144 144 <div xmlns="http://www.w3.org/1999/xhtml">
145 145 <pre xml:space="preserve">base</pre>
146 146 </div>
147 147 </content>
148 148 </entry>
149 149
150 150 </feed>
151 151 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/1/foo/?style=atom'
152 152 200 Script output follows
153 153
154 154 <?xml version="1.0" encoding="ascii"?>
155 155 <feed xmlns="http://www.w3.org/2005/Atom">
156 156 <id>http://*:$HGPORT/atom-log/tip/foo</id> (glob)
157 157 <link rel="self" href="http://*:$HGPORT/atom-log/tip/foo"/> (glob)
158 158 <title>test: foo history</title>
159 159 <updated>1970-01-01T00:00:00+00:00</updated>
160 160
161 161 <entry>
162 162 <title>base</title>
163 163 <id>http://*:$HGPORT/#changeset-2ef0ac749a14e4f57a5a822464a0902c6f7f448f</id> (glob)
164 164 <link href="http://*:$HGPORT/rev/2ef0ac749a14"/> (glob)
165 165 <author>
166 166 <name>test</name>
167 167 <email>&#116;&#101;&#115;&#116;</email>
168 168 </author>
169 169 <updated>1970-01-01T00:00:00+00:00</updated>
170 170 <published>1970-01-01T00:00:00+00:00</published>
171 171 <content type="xhtml">
172 172 <div xmlns="http://www.w3.org/1999/xhtml">
173 173 <pre xml:space="preserve">base</pre>
174 174 </div>
175 175 </content>
176 176 </entry>
177 177
178 178 </feed>
179 179 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/shortlog/'
180 180 200 Script output follows
181 181
182 182 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
183 183 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
184 184 <head>
185 185 <link rel="icon" href="/static/hgicon.png" type="image/png" />
186 186 <meta name="robots" content="index, nofollow" />
187 187 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
188 188
189 189 <title>test: log</title>
190 190 <link rel="alternate" type="application/atom+xml"
191 191 href="/atom-log" title="Atom feed for test" />
192 192 <link rel="alternate" type="application/rss+xml"
193 193 href="/rss-log" title="RSS feed for test" />
194 194 </head>
195 195 <body>
196 196
197 197 <div class="container">
198 198 <div class="menu">
199 199 <div class="logo">
200 200 <a href="http://mercurial.selenic.com/">
201 201 <img src="/static/hglogo.png" alt="mercurial" /></a>
202 202 </div>
203 203 <ul>
204 204 <li class="active">log</li>
205 205 <li><a href="/graph/1d22e65f027e">graph</a></li>
206 206 <li><a href="/tags">tags</a></li>
207 207 <li><a href="/branches">branches</a></li>
208 208 </ul>
209 209 <ul>
210 210 <li><a href="/rev/1d22e65f027e">changeset</a></li>
211 211 <li><a href="/file/1d22e65f027e">browse</a></li>
212 212 </ul>
213 213 <ul>
214 214
215 215 </ul>
216 216 <ul>
217 217 <li><a href="/help">help</a></li>
218 218 </ul>
219 219 </div>
220 220
221 221 <div class="main">
222 222 <h2><a href="/">test</a></h2>
223 223 <h3>log</h3>
224 224
225 225 <form class="search" action="/log">
226 226
227 227 <p><input name="rev" id="search1" type="text" size="30" /></p>
228 228 <div id="hint">find changesets by author, revision,
229 229 files, or words in the commit message</div>
230 230 </form>
231 231
232 232 <div class="navigate">
233 233 <a href="/shortlog/2?revcount=30">less</a>
234 234 <a href="/shortlog/2?revcount=120">more</a>
235 235 | rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a>
236 236 </div>
237 237
238 238 <table class="bigtable">
239 239 <tr>
240 240 <th class="age">age</th>
241 241 <th class="author">author</th>
242 242 <th class="description">description</th>
243 243 </tr>
244 244 <tr class="parity0">
245 245 <td class="age">1970-01-01</td>
246 246 <td class="author">test</td>
247 247 <td class="description"><a href="/rev/1d22e65f027e">branch</a><span class="branchhead">stable</span> <span class="tag">tip</span> </td>
248 248 </tr>
249 249 <tr class="parity1">
250 250 <td class="age">1970-01-01</td>
251 251 <td class="author">test</td>
252 252 <td class="description"><a href="/rev/a4f92ed23982">Added tag 1.0 for changeset 2ef0ac749a14</a><span class="branchhead">default</span> </td>
253 253 </tr>
254 254 <tr class="parity0">
255 255 <td class="age">1970-01-01</td>
256 256 <td class="author">test</td>
257 257 <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> </td>
258 258 </tr>
259 259
260 260 </table>
261 261
262 262 <div class="navigate">
263 263 <a href="/shortlog/2?revcount=30">less</a>
264 264 <a href="/shortlog/2?revcount=120">more</a>
265 265 | rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a>
266 266 </div>
267 267
268 268 </div>
269 269 </div>
270 270
271 271
272 272
273 273 </body>
274 274 </html>
275 275
276 276 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/rev/0/'
277 277 200 Script output follows
278 278
279 279 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
280 280 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
281 281 <head>
282 282 <link rel="icon" href="/static/hgicon.png" type="image/png" />
283 283 <meta name="robots" content="index, nofollow" />
284 284 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
285 285
286 286 <title>test: 2ef0ac749a14</title>
287 287 </head>
288 288 <body>
289 289 <div class="container">
290 290 <div class="menu">
291 291 <div class="logo">
292 292 <a href="http://mercurial.selenic.com/">
293 293 <img src="/static/hglogo.png" alt="mercurial" /></a>
294 294 </div>
295 295 <ul>
296 296 <li><a href="/shortlog/2ef0ac749a14">log</a></li>
297 297 <li><a href="/graph/2ef0ac749a14">graph</a></li>
298 298 <li><a href="/tags">tags</a></li>
299 299 <li><a href="/branches">branches</a></li>
300 300 </ul>
301 301 <ul>
302 302 <li class="active">changeset</li>
303 303 <li><a href="/raw-rev/2ef0ac749a14">raw</a></li>
304 304 <li><a href="/file/2ef0ac749a14">browse</a></li>
305 305 </ul>
306 306 <ul>
307 307
308 308 </ul>
309 309 <ul>
310 310 <li><a href="/help">help</a></li>
311 311 </ul>
312 312 </div>
313 313
314 314 <div class="main">
315 315
316 316 <h2><a href="/">test</a></h2>
317 317 <h3>changeset 0:2ef0ac749a14 <span class="tag">1.0</span> </h3>
318 318
319 319 <form class="search" action="/log">
320 320
321 321 <p><input name="rev" id="search1" type="text" size="30" /></p>
322 322 <div id="hint">find changesets by author, revision,
323 323 files, or words in the commit message</div>
324 324 </form>
325 325
326 326 <div class="description">base</div>
327 327
328 328 <table id="changesetEntry">
329 329 <tr>
330 330 <th class="author">author</th>
331 331 <td class="author">&#116;&#101;&#115;&#116;</td>
332 332 </tr>
333 333 <tr>
334 334 <th class="date">date</th>
335 335 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td></tr>
336 336 <tr>
337 337 <th class="author">parents</th>
338 338 <td class="author"></td>
339 339 </tr>
340 340 <tr>
341 341 <th class="author">children</th>
342 342 <td class="author"> <a href="/rev/a4f92ed23982">a4f92ed23982</a></td>
343 343 </tr>
344 344 <tr>
345 345 <th class="files">files</th>
346 346 <td class="files"><a href="/file/2ef0ac749a14/da/foo">da/foo</a> <a href="/file/2ef0ac749a14/foo">foo</a> </td>
347 347 </tr>
348 348 </table>
349 349
350 350 <div class="overflow">
351 351 <div class="sourcefirst"> line diff</div>
352 352
353 353 <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
354 354 </span><a href="#l1.2" id="l1.2"> 1.2</a> <span class="plusline">+++ b/da/foo Thu Jan 01 00:00:00 1970 +0000
355 355 </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="atline">@@ -0,0 +1,1 @@
356 356 </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="plusline">+foo
357 357 </span></pre></div><div class="source bottomline parity1"><pre><a href="#l2.1" id="l2.1"> 2.1</a> <span class="minusline">--- /dev/null Thu Jan 01 00:00:00 1970 +0000
358 358 </span><a href="#l2.2" id="l2.2"> 2.2</a> <span class="plusline">+++ b/foo Thu Jan 01 00:00:00 1970 +0000
359 359 </span><a href="#l2.3" id="l2.3"> 2.3</a> <span class="atline">@@ -0,0 +1,1 @@
360 360 </span><a href="#l2.4" id="l2.4"> 2.4</a> <span class="plusline">+foo
361 361 </span></pre></div>
362 362 </div>
363 363
364 364 </div>
365 365 </div>
366 366
367 367
368 368 </body>
369 369 </html>
370 370
371 371 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/rev/1/?style=raw'
372 372 200 Script output follows
373 373
374 374
375 375 # HG changeset patch
376 376 # User test
377 377 # Date 0 0
378 378 # Node ID a4f92ed23982be056b9852de5dfe873eaac7f0de
379 379 # Parent 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
380 380 Added tag 1.0 for changeset 2ef0ac749a14
381 381
382 382 diff -r 2ef0ac749a14 -r a4f92ed23982 .hgtags
383 383 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
384 384 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
385 385 @@ -0,0 +1,1 @@
386 386 +2ef0ac749a14e4f57a5a822464a0902c6f7f448f 1.0
387 387
388 388 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log?rev=base'
389 389 200 Script output follows
390 390
391 391 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
392 392 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
393 393 <head>
394 394 <link rel="icon" href="/static/hgicon.png" type="image/png" />
395 395 <meta name="robots" content="index, nofollow" />
396 396 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
397 397
398 398 <title>test: searching for base</title>
399 399 </head>
400 400 <body>
401 401
402 402 <div class="container">
403 403 <div class="menu">
404 404 <div class="logo">
405 405 <a href="http://mercurial.selenic.com/">
406 406 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
407 407 </div>
408 408 <ul>
409 409 <li><a href="/shortlog">log</a></li>
410 410 <li><a href="/graph">graph</a></li>
411 411 <li><a href="/tags">tags</a></li>
412 412 <li><a href="/branches">branches</a></li>
413 413 <li><a href="/help">help</a></li>
414 414 </ul>
415 415 </div>
416 416
417 417 <div class="main">
418 418 <h2><a href="/">test</a></h2>
419 419 <h3>searching for 'base'</h3>
420 420
421 421 <form class="search" action="/log">
422 422
423 423 <p><input name="rev" id="search1" type="text" size="30"></p>
424 424 <div id="hint">find changesets by author, revision,
425 425 files, or words in the commit message</div>
426 426 </form>
427 427
428 428 <div class="navigate">
429 429 <a href="/search/?rev=base&revcount=5">less</a>
430 430 <a href="/search/?rev=base&revcount=20">more</a>
431 431 </div>
432 432
433 433 <table class="bigtable">
434 434 <tr>
435 435 <th class="age">age</th>
436 436 <th class="author">author</th>
437 437 <th class="description">description</th>
438 438 </tr>
439 439 <tr class="parity0">
440 440 <td class="age">1970-01-01</td>
441 441 <td class="author">test</td>
442 442 <td class="description"><a href="/rev/2ef0ac749a14">base</a><span class="tag">1.0</span> </td>
443 443 </tr>
444 444
445 445 </table>
446 446
447 447 <div class="navigate">
448 448 <a href="/search/?rev=base&revcount=5">less</a>
449 449 <a href="/search/?rev=base&revcount=20">more</a>
450 450 </div>
451 451
452 452 </div>
453 453 </div>
454 454
455 455
456 456
457 457 </body>
458 458 </html>
459 459
460 460
461 461 File-related
462 462
463 463 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo/?style=raw'
464 464 200 Script output follows
465 465
466 466 foo
467 467 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/annotate/1/foo/?style=raw'
468 468 200 Script output follows
469 469
470 470
471 471 test@0: foo
472 472
473 473
474 474
475 475
476 476 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/?style=raw'
477 477 200 Script output follows
478 478
479 479
480 480 drwxr-xr-x da
481 481 -rw-r--r-- 45 .hgtags
482 482 -rw-r--r-- 4 foo
483 483
484 484
485 485 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo'
486 486 200 Script output follows
487 487
488 488 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
489 489 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
490 490 <head>
491 491 <link rel="icon" href="/static/hgicon.png" type="image/png" />
492 492 <meta name="robots" content="index, nofollow" />
493 493 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
494 494
495 495 <title>test: a4f92ed23982 foo</title>
496 496 </head>
497 497 <body>
498 498
499 499 <div class="container">
500 500 <div class="menu">
501 501 <div class="logo">
502 502 <a href="http://mercurial.selenic.com/">
503 503 <img src="/static/hglogo.png" alt="mercurial" /></a>
504 504 </div>
505 505 <ul>
506 506 <li><a href="/shortlog/a4f92ed23982">log</a></li>
507 507 <li><a href="/graph/a4f92ed23982">graph</a></li>
508 508 <li><a href="/tags">tags</a></li>
509 509 <li><a href="/branches">branches</a></li>
510 510 </ul>
511 511 <ul>
512 512 <li><a href="/rev/a4f92ed23982">changeset</a></li>
513 513 <li><a href="/file/a4f92ed23982/">browse</a></li>
514 514 </ul>
515 515 <ul>
516 516 <li class="active">file</li>
517 517 <li><a href="/file/tip/foo">latest</a></li>
518 518 <li><a href="/diff/a4f92ed23982/foo">diff</a></li>
519 519 <li><a href="/annotate/a4f92ed23982/foo">annotate</a></li>
520 520 <li><a href="/log/a4f92ed23982/foo">file log</a></li>
521 521 <li><a href="/raw-file/a4f92ed23982/foo">raw</a></li>
522 522 </ul>
523 523 <ul>
524 524 <li><a href="/help">help</a></li>
525 525 </ul>
526 526 </div>
527 527
528 528 <div class="main">
529 529 <h2><a href="/">test</a></h2>
530 530 <h3>view foo @ 1:a4f92ed23982</h3>
531 531
532 532 <form class="search" action="/log">
533 533
534 534 <p><input name="rev" id="search1" type="text" size="30" /></p>
535 535 <div id="hint">find changesets by author, revision,
536 536 files, or words in the commit message</div>
537 537 </form>
538 538
539 539 <div class="description">Added tag 1.0 for changeset 2ef0ac749a14</div>
540 540
541 541 <table id="changesetEntry">
542 542 <tr>
543 543 <th class="author">author</th>
544 544 <td class="author">&#116;&#101;&#115;&#116;</td>
545 545 </tr>
546 546 <tr>
547 547 <th class="date">date</th>
548 548 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td>
549 549 </tr>
550 550 <tr>
551 551 <th class="author">parents</th>
552 552 <td class="author"></td>
553 553 </tr>
554 554 <tr>
555 555 <th class="author">children</th>
556 556 <td class="author"><a href="/file/1d22e65f027e/foo">1d22e65f027e</a> </td>
557 557 </tr>
558 558
559 559 </table>
560 560
561 561 <div class="overflow">
562 562 <div class="sourcefirst"> line source</div>
563 563
564 564 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> foo
565 565 </div>
566 566 <div class="sourcelast"></div>
567 567 </div>
568 568 </div>
569 569 </div>
570 570
571 571
572 572
573 573 </body>
574 574 </html>
575 575
576 576 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/filediff/1/foo/?style=raw'
577 577 200 Script output follows
578 578
579 579
580 580 diff -r 000000000000 -r a4f92ed23982 foo
581 581 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
582 582 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
583 583 @@ -0,0 +1,1 @@
584 584 +foo
585 585
586 586
587 587
588 588
589 589
590 590 Overviews
591 591
592 592 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/raw-tags'
593 593 200 Script output follows
594 594
595 595 tip 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
596 596 1.0 2ef0ac749a14e4f57a5a822464a0902c6f7f448f
597 597 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/raw-branches'
598 598 200 Script output follows
599 599
600 600 stable 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe open
601 601 default a4f92ed23982be056b9852de5dfe873eaac7f0de inactive
602 602 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/summary/?style=gitweb'
603 603 200 Script output follows
604 604
605 605 <?xml version="1.0" encoding="ascii"?>
606 606 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
607 607 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
608 608 <head>
609 609 <link rel="icon" href="/static/hgicon.png" type="image/png" />
610 610 <meta name="robots" content="index, nofollow"/>
611 611 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
612 612
613 613
614 614 <title>test: Summary</title>
615 615 <link rel="alternate" type="application/atom+xml"
616 616 href="/atom-log" title="Atom feed for test"/>
617 617 <link rel="alternate" type="application/rss+xml"
618 618 href="/rss-log" title="RSS feed for test"/>
619 619 </head>
620 620 <body>
621 621
622 622 <div class="page_header">
623 623 <a href="http://mercurial.selenic.com/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / summary
624 624
625 625 <form action="/log">
626 626 <input type="hidden" name="style" value="gitweb" />
627 627 <div class="search">
628 628 <input type="text" name="rev" />
629 629 </div>
630 630 </form>
631 631 </div>
632 632
633 633 <div class="page_nav">
634 634 summary |
635 635 <a href="/shortlog?style=gitweb">shortlog</a> |
636 636 <a href="/log?style=gitweb">changelog</a> |
637 637 <a href="/graph?style=gitweb">graph</a> |
638 638 <a href="/tags?style=gitweb">tags</a> |
639 639 <a href="/branches?style=gitweb">branches</a> |
640 640 <a href="/file/1d22e65f027e?style=gitweb">files</a> |
641 641 <a href="/help?style=gitweb">help</a>
642 642 <br/>
643 643 </div>
644 644
645 645 <div class="title">&nbsp;</div>
646 646 <table cellspacing="0">
647 647 <tr><td>description</td><td>unknown</td></tr>
648 648 <tr><td>owner</td><td>&#70;&#111;&#111;&#32;&#66;&#97;&#114;&#32;&#60;&#102;&#111;&#111;&#46;&#98;&#97;&#114;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;&#62;</td></tr>
649 649 <tr><td>last change</td><td>Thu, 01 Jan 1970 00:00:00 +0000</td></tr>
650 650 </table>
651 651
652 652 <div><a class="title" href="/shortlog?style=gitweb">changes</a></div>
653 653 <table cellspacing="0">
654 654
655 655 <tr class="parity0">
656 656 <td class="age"><i>1970-01-01</i></td>
657 657 <td><i>test</i></td>
658 658 <td>
659 659 <a class="list" href="/rev/1d22e65f027e?style=gitweb">
660 660 <b>branch</b>
661 661 <span class="logtags"><span class="branchtag" title="stable">stable</span> <span class="tagtag" title="tip">tip</span> </span>
662 662 </a>
663 663 </td>
664 664 <td class="link" nowrap>
665 665 <a href="/rev/1d22e65f027e?style=gitweb">changeset</a> |
666 666 <a href="/file/1d22e65f027e?style=gitweb">files</a>
667 667 </td>
668 668 </tr>
669 669 <tr class="parity1">
670 670 <td class="age"><i>1970-01-01</i></td>
671 671 <td><i>test</i></td>
672 672 <td>
673 673 <a class="list" href="/rev/a4f92ed23982?style=gitweb">
674 674 <b>Added tag 1.0 for changeset 2ef0ac749a14</b>
675 675 <span class="logtags"><span class="branchtag" title="default">default</span> </span>
676 676 </a>
677 677 </td>
678 678 <td class="link" nowrap>
679 679 <a href="/rev/a4f92ed23982?style=gitweb">changeset</a> |
680 680 <a href="/file/a4f92ed23982?style=gitweb">files</a>
681 681 </td>
682 682 </tr>
683 683 <tr class="parity0">
684 684 <td class="age"><i>1970-01-01</i></td>
685 685 <td><i>test</i></td>
686 686 <td>
687 687 <a class="list" href="/rev/2ef0ac749a14?style=gitweb">
688 688 <b>base</b>
689 689 <span class="logtags"><span class="tagtag" title="1.0">1.0</span> </span>
690 690 </a>
691 691 </td>
692 692 <td class="link" nowrap>
693 693 <a href="/rev/2ef0ac749a14?style=gitweb">changeset</a> |
694 694 <a href="/file/2ef0ac749a14?style=gitweb">files</a>
695 695 </td>
696 696 </tr>
697 697 <tr class="light"><td colspan="4"><a class="list" href="/shortlog?style=gitweb">...</a></td></tr>
698 698 </table>
699 699
700 700 <div><a class="title" href="/tags?style=gitweb">tags</a></div>
701 701 <table cellspacing="0">
702 702
703 703 <tr class="parity0">
704 704 <td class="age"><i>1970-01-01</i></td>
705 705 <td><a class="list" href="/rev/2ef0ac749a14?style=gitweb"><b>1.0</b></a></td>
706 706 <td class="link">
707 707 <a href="/rev/2ef0ac749a14?style=gitweb">changeset</a> |
708 708 <a href="/log/2ef0ac749a14?style=gitweb">changelog</a> |
709 709 <a href="/file/2ef0ac749a14?style=gitweb">files</a>
710 710 </td>
711 711 </tr>
712 712 <tr class="light"><td colspan="3"><a class="list" href="/tags?style=gitweb">...</a></td></tr>
713 713 </table>
714 714
715 715 <div><a class="title" href="#">branches</a></div>
716 716 <table cellspacing="0">
717 717
718 718 <tr class="parity0">
719 719 <td class="age"><i>1970-01-01</i></td>
720 720 <td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
721 721 <td class="">stable</td>
722 722 <td class="link">
723 723 <a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
724 724 <a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
725 725 <a href="/file/1d22e65f027e?style=gitweb">files</a>
726 726 </td>
727 727 </tr>
728 728 <tr class="parity1">
729 729 <td class="age"><i>1970-01-01</i></td>
730 730 <td><a class="list" href="/shortlog/a4f92ed23982?style=gitweb"><b>a4f92ed23982</b></a></td>
731 731 <td class="">default</td>
732 732 <td class="link">
733 733 <a href="/changeset/a4f92ed23982?style=gitweb">changeset</a> |
734 734 <a href="/log/a4f92ed23982?style=gitweb">changelog</a> |
735 735 <a href="/file/a4f92ed23982?style=gitweb">files</a>
736 736 </td>
737 737 </tr>
738 738 <tr class="light">
739 739 <td colspan="4"><a class="list" href="#">...</a></td>
740 740 </tr>
741 741 </table>
742 742 <div class="page_footer">
743 743 <div class="page_footer_text">test</div>
744 744 <div class="rss_logo">
745 745 <a href="/rss-log">RSS</a>
746 746 <a href="/atom-log">Atom</a>
747 747 </div>
748 748 <br />
749 749
750 750 </div>
751 751 </body>
752 752 </html>
753 753
754 754 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/?style=gitweb'
755 755 200 Script output follows
756 756
757 757 <?xml version="1.0" encoding="ascii"?>
758 758 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
759 759 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
760 760 <head>
761 761 <link rel="icon" href="/static/hgicon.png" type="image/png" />
762 762 <meta name="robots" content="index, nofollow"/>
763 763 <link rel="stylesheet" href="/static/style-gitweb.css" type="text/css" />
764 764
765 765
766 766 <title>test: Graph</title>
767 767 <link rel="alternate" type="application/atom+xml"
768 768 href="/atom-log" title="Atom feed for test"/>
769 769 <link rel="alternate" type="application/rss+xml"
770 770 href="/rss-log" title="RSS feed for test"/>
771 771 <!--[if IE]><script type="text/javascript" src="/static/excanvas.js"></script><![endif]-->
772 772 </head>
773 773 <body>
774 774
775 775 <div class="page_header">
776 776 <a href="http://mercurial.selenic.com/" title="Mercurial" style="float: right;">Mercurial</a><a href="/summary?style=gitweb">test</a> / graph
777 777 </div>
778 778
779 779 <form action="/log">
780 780 <input type="hidden" name="style" value="gitweb" />
781 781 <div class="search">
782 782 <input type="text" name="rev" />
783 783 </div>
784 784 </form>
785 785 <div class="page_nav">
786 786 <a href="/summary?style=gitweb">summary</a> |
787 787 <a href="/shortlog?style=gitweb">shortlog</a> |
788 788 <a href="/log/2?style=gitweb">changelog</a> |
789 789 graph |
790 790 <a href="/tags?style=gitweb">tags</a> |
791 791 <a href="/branches?style=gitweb">branches</a> |
792 792 <a href="/file/1d22e65f027e?style=gitweb">files</a> |
793 793 <a href="/help?style=gitweb">help</a>
794 794 <br/>
795 795 <a href="/graph/2?style=gitweb&revcount=30">less</a>
796 796 <a href="/graph/2?style=gitweb&revcount=120">more</a>
797 797 | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/2ef0ac749a14?style=gitweb">-2</a> <a href="/graph/tip?style=gitweb">tip</a> <br/>
798 798 </div>
799 799
800 800 <div class="title">&nbsp;</div>
801 801
802 802 <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
803 803
804 804 <div id="wrapper">
805 805 <ul id="nodebgs"></ul>
806 806 <canvas id="graph" width="224" height="129"></canvas>
807 807 <ul id="graphnodes"></ul>
808 808 </div>
809 809
810 810 <script type="text/javascript" src="/static/graph.js"></script>
811 811 <script>
812 812 <!-- hide script content
813 813
814 814 var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"]]];
815 815 var graph = new Graph();
816 816 graph.scale(39);
817 817
818 818 graph.edge = function(x0, y0, x1, y1, color) {
819 819
820 820 this.setColor(color, 0.0, 0.65);
821 821 this.ctx.beginPath();
822 822 this.ctx.moveTo(x0, y0);
823 823 this.ctx.lineTo(x1, y1);
824 824 this.ctx.stroke();
825 825
826 826 }
827 827
828 828 var revlink = '<li style="_STYLE"><span class="desc">';
829 829 revlink += '<a class="list" href="/rev/_NODEID?style=gitweb" title="_NODEID"><b>_DESC</b></a>';
830 830 revlink += '</span> _TAGS';
831 831 revlink += '<span class="info">_DATE, by _USER</span></li>';
832 832
833 833 graph.vertex = function(x, y, color, parity, cur) {
834 834
835 835 this.ctx.beginPath();
836 836 color = this.setColor(color, 0.25, 0.75);
837 837 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
838 838 this.ctx.fill();
839 839
840 840 var bg = '<li class="bg parity' + parity + '"></li>';
841 841 var left = (this.columns + 1) * this.bg_height;
842 842 var nstyle = 'padding-left: ' + left + 'px;';
843 843 var item = revlink.replace(/_STYLE/, nstyle);
844 844 item = item.replace(/_PARITY/, 'parity' + parity);
845 845 item = item.replace(/_NODEID/, cur[0]);
846 846 item = item.replace(/_NODEID/, cur[0]);
847 847 item = item.replace(/_DESC/, cur[3]);
848 848 item = item.replace(/_USER/, cur[4]);
849 849 item = item.replace(/_DATE/, cur[5]);
850 850
851 851 var tagspan = '';
852 852 if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
853 853 tagspan = '<span class="logtags">';
854 854 if (cur[6][1]) {
855 855 tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
856 856 tagspan += cur[6][0] + '</span> ';
857 857 } else if (!cur[6][1] && cur[6][0] != 'default') {
858 858 tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
859 859 tagspan += cur[6][0] + '</span> ';
860 860 }
861 861 if (cur[7].length) {
862 862 for (var t in cur[7]) {
863 863 var tag = cur[7][t];
864 864 tagspan += '<span class="tagtag">' + tag + '</span> ';
865 865 }
866 866 }
867 867 tagspan += '</span>';
868 868 }
869 869
870 870 item = item.replace(/_TAGS/, tagspan);
871 871 return [bg, item];
872 872
873 873 }
874 874
875 875 graph.render(data);
876 876
877 877 // stop hiding script -->
878 878 </script>
879 879
880 880 <div class="page_nav">
881 881 <a href="/graph/2?style=gitweb&revcount=30">less</a>
882 882 <a href="/graph/2?style=gitweb&revcount=120">more</a>
883 883 | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/2ef0ac749a14?style=gitweb">-2</a> <a href="/graph/tip?style=gitweb">tip</a>
884 884 </div>
885 885
886 886 <div class="page_footer">
887 887 <div class="page_footer_text">test</div>
888 888 <div class="rss_logo">
889 889 <a href="/rss-log">RSS</a>
890 890 <a href="/atom-log">Atom</a>
891 891 </div>
892 892 <br />
893 893
894 894 </div>
895 895 </body>
896 896 </html>
897 897
898 898
899 899 capabilities
900 900
901 901 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'; echo
902 902 200 Script output follows
903 903
904 904 lookup changegroupsubset branchmap pushkey unbundle=HG10GZ,HG10BZ,HG10UN
905 905
906 906 heads
907 907
908 908 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=heads'
909 909 200 Script output follows
910 910
911 911 1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
912 912
913 913 branches
914 914
915 915 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=branches&nodes=0000000000000000000000000000000000000000'
916 916 200 Script output follows
917 917
918 918 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
919 919
920 920 changegroup
921 921
922 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=changegroup&roots=0000000000000000000000000000000000000000' \
923 > | $TESTDIR/printrepr.py
922 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=changegroup&roots=0000000000000000000000000000000000000000'
924 923 200 Script output follows
925 924
926 x\x9c\xbdTMHUA\x14\xbe\xa8\xf9\xec\xda&\x10\x11*\xb8\x88\x81\x99\xbef\xe6\xce\xbdw\xc6\xf2a\x16E\x1b\x11[%\x98\xcc\xaf\x8f\x8c\xf7\xc0\xf7\x82
927 4\x11KP2m\x95\xad*\xabE\x05AP\xd0\xc22Z\x14\xf9\x03\xb9j\xa3\x9b$\xa4MJ\xb4\x90\xc0\x9a\x9bO0\x10\xdf\x13\xa2\x81\x0f\x869g\xe6|\xe7\x9c\xef\x8ceY\xf7\xa2KO\xd2\xb7K\x16~\
928 \xe9\xad\x90w\x86\xab\x93W\x8e\xdf\xb0r\\Y\xee6(\xa2)\xf6\x95\xc6\x01\xe4\x1az\x80R\xe8kN\x98\xe7R\xa4\xa9K@\xe0!A\xb4k\xa7U*m\x03\x07\xd8\x92\x1d\xd2\xc9\xa4\x1d\xc2\xe6,\xa5\xcc+\x1f\xef\xafDgi\xef\xab\x1d\x1d\xb7\x9a\xe7[W\xfbc\x8f\xde-\xcd\xe7\xcaz\xb3\xbb\x19\xd3\x81\x10>c>\x08\x00"X\x11\xc2\x84@\xd2\xe7B*L\x00\x01P\x04R\xc3@\xbaB0\xdb8#\x83:\x83\xa2h\xbc=\xcd\xdaS\xe1Y,L\xd3\xa0\xf2\xa8\x94J:\xe6\xd8\x81Q\xe0\xe8d\xa7#\xe2,\xd1\xaeR*\xed \xa5\x01\x13\x01\xa6\x0cb\xe3;\xbe\xaf\xfcK[^wK\xe1N\xaf\xbbk\xe8B\xd1\xf4\xc1\x07\xb3\xab[\x10\xfdkmvwcB\xa6\xa4\xd4G\xc4D\xc2\x141\xad\x91\x10\x00\x08J\x81\xcb}\xee\t\xee+W\xba\x8a\x80\x90|\xd4\xa0\xd6\xa0\xd4T\xde\xe1\x9d,!\xe2\xb5\xa94\xe3\xe7\xd5\x9f\x06\x18\xcba\x03aP\xb8f\xcd\x04\x1a_\\9\xf1\xed\xe4\x9e\xe5\xa6\xd1\xd2\x9f\x03\xa7o\xae\x90H\xf3\xfb\xef\xffH3\xadk
929 \xb0\x90\x92\x88\xb9\x14"\x068\xc2\x1e@\x00\xbb\x8a)\xd3\'\x859
930 \xa8\x80\x84S \xa5\xbd-g\x13`\xe4\xdc\xc3H^\xdf\xe2\xc0TM\xc7\xf4BO\xcf\xde\xae\xe5\xae#\x1frM(K\x97`F\x19\x16s\x05GD\xb9\x01\xc1\x00+\x8c|\x9fp\xc11\xf0\x14\x00\x9cJ\x82<\xe0\x12\x9f\xc1\x90\xd0\xf5\xc8\x19>Pr\xaa\xeaW\xf5\xc4\xae\xd1\xfc\x17\xcf\'\x13u\xb1\x9e\xcdHnC\x0e\xcc`\xc8\xa0&\xac\x0e\xf1|\x8c\x10$\xc4\x8c\xa2p\x05`\xdc\x08 \x80\xc4\xd7Rr-\x94\x10\x102\xedi;\xf3f\xf1z\x16\x86\xdb\xd8d\xe5\xe7\x8b\xf5\x8d\rzp\xb2\xfe\xac\xf5\xf2\xd3\xfe\xfckws\xedt\x96b\xd5l\x1c\x0b\x85\xb5\x170\x8f\x11\x84\xb0\x8f\x19\xa0\x00\t_\x07\x1ac\xa2\xc3\x89Z\xe7\x96\xf9 \xccNFg\xc7F\xaa\x8a+\x9a\x9cc_\x17\x1b\x17\x9e]z38<\x97+\xb5,",\xc8\xc8?\\\x91\xff\x17.~U\x96\x97\xf5%\xdeN<\x8e\xf5\x97%\xe7^\xcfL\xed~\xda\x96k\xdc->\x86\x02\x83"\x96H\xa6\xe3\xaas=-\xeb7\xe5\xda\x8f\xbc
925 x\x9c\xbdTMHUA\x14\xbe\xa8\xf9\xec\xda&\x10\x11*\xb8\x88\x81\x99\xbef\xe6\xce\xbdw\xc6\xf2a\x16E\x1b\x11[%\x98\xcc\xaf\x8f\x8c\xf7\xc0\xf7\x82 (esc)
926 4\x11KP2m\x95\xad*\xabE\x05AP\xd0\xc22Z\x14\xf9\x03\xb9j\xa3\x9b$\xa4MJ\xb4\x90\xc0\x9a\x9bO0\x10\xdf\x13\xa2\x81\x0f\x869g\xe6|\xe7\x9c\xef\x8ceY\xf7\xa2KO\xd2\xb7K\x16~\\n\xe9\xad\x90w\x86\xab\x93W\x8e\xdf\xb0r\\Y\xee6(\xa2)\xf6\x95\xc6\x01\xe4\x1az\x80R\xe8kN\x98\xe7R\xa4\xa9K@\xe0!A\xb4k\xa7U*m\x03\x07\xd8\x92\x1d\xd2\xc9\xa4\x1d\xc2\xe6,\xa5\xcc+\x1f\xef\xafDgi\xef\xab\x1d\x1d\xb7\x9a\xe7[W\xfbc\x8f\xde-\xcd\xe7\xcaz\xb3\xbb\x19\xd3\x81\x10>c>\x08\x00"X\x11\xc2\x84@\xd2\xe7B*L\x00\x01P\x04R\xc3@\xbaB0\xdb8#\x83:\x83\xa2h\xbc=\xcd\xdaS\xe1Y,L\xd3\xa0\xf2\xa8\x94J:\xe6\xd8\x81Q\xe0\xe8d\xa7#\xe2,\xd1\xaeR*\xed \xa5\x01\x13\x01\xa6\x0cb\xe3;\xbe\xaf\xfcK[^wK\xe1N\xaf\xbbk\xe8B\xd1\xf4\xc1\x07\xb3\xab[\x10\xfdkmvwcB\xa6\xa4\xd4G\xc4D\xc2\x141\xad\x91\x10\x00\x08J\x81\xcb}\xee \xee+W\xba\x8a\x80\x90|\xd4\xa0\xd6\xa0\xd4T\xde\xe1\x9d,!\xe2\xb5\xa94\xe3\xe7\xd5\x9f\x06\x18\xcba\x03aP\xb8f\xcd\x04\x1a_\\9\xf1\xed\xe4\x9e\xe5\xa6\xd1\xd2\x9f\x03\xa7o\xae\x90H\xf3\xfb\xef\xffH3\xadk (esc)
927 \xb0\x90\x92\x88\xb9\x14"\x068\xc2\x1e@\x00\xbb\x8a)\xd3'\x859 (esc)
928 \xa8\x80\x84S \xa5\xbd-g\x13`\xe4\xdc\xc3H^\xdf\xe2\xc0TM\xc7\xf4BO\xcf\xde\xae\xe5\xae#\x1frM(K\x97`F\x19\x16s\x05GD\xb9\x01\xc1\x00+\x8c|\x9fp\xc11\xf0\x14\x00\x9cJ\x82<\xe0\x12\x9f\xc1\x90\xd0\xf5\xc8\x19>Pr\xaa\xeaW\xf5\xc4\xae\xd1\xfc\x17\xcf'\x13u\xb1\x9e\xcdHnC\x0e\xcc`\xc8\xa0&\xac\x0e\xf1|\x8c\x10$\xc4\x8c\xa2p\x05`\xdc\x08 \x80\xc4\xd7Rr-\x94\x10\x102\xedi;\xf3f\xf1z\x16\x86\xdb\xd8d\xe5\xe7\x8b\xf5\x8d\rzp\xb2\xfe\xac\xf5\xf2\xd3\xfe\xfckws\xedt\x96b\xd5l\x1c\x0b\x85\xb5\x170\x8f\x11\x84\xb0\x8f\x19\xa0\x00 _\x07\x1ac\xa2\xc3\x89Z\xe7\x96\xf9 \xccNFg\xc7F\xaa\x8a+\x9a\x9cc_\x17\x1b\x17\x9e]z38<\x97+\xb5,",\xc8\xc8?\\\x91\xff\x17.~U\x96\x97\xf5%\xdeN<\x8e\xf5\x97%\xe7^\xcfL\xed~\xda\x96k\xdc->\x86\x02\x83"\x96H\xa6\xe3\xaas=-\xeb7\xe5\xda\x8f\xbc (no-eol) (esc)
931 929
932 930 stream_out
933 931
934 932 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=stream_out'
935 933 200 Script output follows
936 934
937 935 1
938 936
939 937 failing unbundle, requires POST request
940 938
941 939 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=unbundle'
942 940 405 push requires POST request
943 941
944 942 0
945 943 push requires POST request
946 944 [1]
947 945
948 946 Static files
949 947
950 948 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/static/style.css'
951 949 200 Script output follows
952 950
953 951 a { text-decoration:none; }
954 952 .age { white-space:nowrap; }
955 953 .date { white-space:nowrap; }
956 954 .indexlinks { white-space:nowrap; }
957 955 .parity0 { background-color: #ddd; }
958 956 .parity1 { background-color: #eee; }
959 957 .lineno { width: 60px; color: #aaa; font-size: smaller;
960 958 text-align: right; }
961 959 .plusline { color: green; }
962 960 .minusline { color: red; }
963 961 .atline { color: purple; }
964 962 .annotate { font-size: smaller; text-align: right; padding-right: 1em; }
965 963 .buttons a {
966 964 background-color: #666;
967 965 padding: 2pt;
968 966 color: white;
969 967 font-family: sans;
970 968 font-weight: bold;
971 969 }
972 970 .navigate a {
973 971 background-color: #ccc;
974 972 padding: 2pt;
975 973 font-family: sans;
976 974 color: black;
977 975 }
978 976
979 977 .metatag {
980 978 background-color: #888;
981 979 color: white;
982 980 text-align: right;
983 981 }
984 982
985 983 /* Common */
986 984 pre { margin: 0; }
987 985
988 986 .logo {
989 987 float: right;
990 988 clear: right;
991 989 }
992 990
993 991 /* Changelog/Filelog entries */
994 992 .logEntry { width: 100%; }
995 993 .logEntry .age { width: 15%; }
996 994 .logEntry th { font-weight: normal; text-align: right; vertical-align: top; }
997 995 .logEntry th.age, .logEntry th.firstline { font-weight: bold; }
998 996 .logEntry th.firstline { text-align: left; width: inherit; }
999 997
1000 998 /* Shortlog entries */
1001 999 .slogEntry { width: 100%; }
1002 1000 .slogEntry .age { width: 8em; }
1003 1001 .slogEntry td { font-weight: normal; text-align: left; vertical-align: top; }
1004 1002 .slogEntry td.author { width: 15em; }
1005 1003
1006 1004 /* Tag entries */
1007 1005 #tagEntries { list-style: none; margin: 0; padding: 0; }
1008 1006 #tagEntries .tagEntry { list-style: none; margin: 0; padding: 0; }
1009 1007
1010 1008 /* Changeset entry */
1011 1009 #changesetEntry { }
1012 1010 #changesetEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; }
1013 1011 #changesetEntry th.files, #changesetEntry th.description { vertical-align: top; }
1014 1012
1015 1013 /* File diff view */
1016 1014 #filediffEntry { }
1017 1015 #filediffEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; }
1018 1016
1019 1017 /* Graph */
1020 1018 div#wrapper {
1021 1019 position: relative;
1022 1020 margin: 0;
1023 1021 padding: 0;
1024 1022 }
1025 1023
1026 1024 canvas {
1027 1025 position: absolute;
1028 1026 z-index: 5;
1029 1027 top: -0.6em;
1030 1028 margin: 0;
1031 1029 }
1032 1030
1033 1031 ul#nodebgs {
1034 1032 list-style: none inside none;
1035 1033 padding: 0;
1036 1034 margin: 0;
1037 1035 top: -0.7em;
1038 1036 }
1039 1037
1040 1038 ul#graphnodes li, ul#nodebgs li {
1041 1039 height: 39px;
1042 1040 }
1043 1041
1044 1042 ul#graphnodes {
1045 1043 position: absolute;
1046 1044 z-index: 10;
1047 1045 top: -0.85em;
1048 1046 list-style: none inside none;
1049 1047 padding: 0;
1050 1048 }
1051 1049
1052 1050 ul#graphnodes li .info {
1053 1051 display: block;
1054 1052 font-size: 70%;
1055 1053 position: relative;
1056 1054 top: -1px;
1057 1055 }
1058 1056
1059 1057 Stop and restart with HGENCODING=cp932
1060 1058
1061 1059 $ "$TESTDIR/killdaemons.py"
1062 1060 $ HGENCODING=cp932 hg serve --config server.uncompressed=False -n test \
1063 1061 > -p $HGPORT -d --pid-file=hg.pid -E errors.log
1064 1062 $ cat hg.pid >> $DAEMON_PIDS
1065 1063
1066 1064 commit message with Japanese Kanji 'Noh', which ends with '\x5c'
1067 1065
1068 1066 $ echo foo >> foo
1069 1067 $ HGENCODING=cp932 hg ci -m `python -c 'print("\x94\x5c")'`
1070 1068
1071 1069 Graph json escape of multibyte character
1072 1070
1073 1071 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/' \
1074 1072 > | grep '^var data ='
1075 1073 var data = [["40b4d6888e92", [0, 1], [[0, 0, 1]], "\u80fd", "test", "1970-01-01", ["stable", true], ["tip"]], ["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "1970-01-01", ["stable", false], []], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"]]];
1076 1074
1077 1075 ERRORS ENCOUNTERED
1078 1076
1079 1077 $ cat errors.log
@@ -1,604 +1,604 b''
1 1
2 2 $ "$TESTDIR/hghave" pygments || exit 80
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [extensions]
5 5 > highlight =
6 6 > [web]
7 7 > pygments_style = friendly
8 8 > EOF
9 9 $ hg init test
10 10 $ cd test
11 11
12 12 create random Python file to exercise Pygments
13 13
14 14 $ cat <<EOF > primes.py
15 15 > #!/usr/bin/env python
16 16 >
17 17 > """Fun with generators. Corresponding Haskell implementation:
18 18 >
19 19 > primes = 2 : sieve [3, 5..]
20 20 > where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
21 21 > """
22 22 >
23 23 > from itertools import dropwhile, ifilter, islice, count, chain
24 24 >
25 25 > def primes():
26 26 > """Generate all primes."""
27 27 > def sieve(ns):
28 28 > p = ns.next()
29 29 > # It is important to yield *here* in order to stop the
30 30 > # infinite recursion.
31 31 > yield p
32 32 > ns = ifilter(lambda n: n % p != 0, ns)
33 33 > for n in sieve(ns):
34 34 > yield n
35 35 >
36 36 > odds = ifilter(lambda i: i % 2 == 1, count())
37 37 > return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
38 38 >
39 39 > if __name__ == "__main__":
40 40 > import sys
41 41 > try:
42 42 > n = int(sys.argv[1])
43 43 > except (ValueError, IndexError):
44 44 > n = 10
45 45 > p = primes()
46 46 > print "The first %d primes: %s" % (n, list(islice(p, n)))
47 47 > EOF
48 48 $ hg ci -Ama
49 49 adding primes.py
50 50
51 51 hg serve
52 52
53 53 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
54 54 $ cat hg.pid >> $DAEMON_PIDS
55 55
56 56 hgweb filerevision, html
57 57
58 58 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py') \
59 59 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g"
60 60 200 Script output follows
61 61
62 62 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
63 63 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
64 64 <head>
65 65 <link rel="icon" href="/static/hgicon.png" type="image/png" />
66 66 <meta name="robots" content="index, nofollow" />
67 67 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
68 68
69 69 <link rel="stylesheet" href="/highlightcss" type="text/css" />
70 70 <title>test: 853dcd4de2a6 primes.py</title>
71 71 </head>
72 72 <body>
73 73
74 74 <div class="container">
75 75 <div class="menu">
76 76 <div class="logo">
77 77 <a href="http://mercurial.selenic.com/">
78 78 <img src="/static/hglogo.png" alt="mercurial" /></a>
79 79 </div>
80 80 <ul>
81 81 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
82 82 <li><a href="/graph/853dcd4de2a6">graph</a></li>
83 83 <li><a href="/tags">tags</a></li>
84 84 <li><a href="/branches">branches</a></li>
85 85 </ul>
86 86 <ul>
87 87 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
88 88 <li><a href="/file/853dcd4de2a6/">browse</a></li>
89 89 </ul>
90 90 <ul>
91 91 <li class="active">file</li>
92 92 <li><a href="/file/tip/primes.py">latest</a></li>
93 93 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
94 94 <li><a href="/annotate/853dcd4de2a6/primes.py">annotate</a></li>
95 95 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
96 96 <li><a href="/raw-file/853dcd4de2a6/primes.py">raw</a></li>
97 97 </ul>
98 98 <ul>
99 99 <li><a href="/help">help</a></li>
100 100 </ul>
101 101 </div>
102 102
103 103 <div class="main">
104 104 <h2><a href="/">test</a></h2>
105 105 <h3>view primes.py @ 0:853dcd4de2a6</h3>
106 106
107 107 <form class="search" action="/log">
108 108
109 109 <p><input name="rev" id="search1" type="text" size="30" /></p>
110 110 <div id="hint">find changesets by author, revision,
111 111 files, or words in the commit message</div>
112 112 </form>
113 113
114 114 <div class="description">a</div>
115 115
116 116 <table id="changesetEntry">
117 117 <tr>
118 118 <th class="author">author</th>
119 119 <td class="author">&#116;&#101;&#115;&#116;</td>
120 120 </tr>
121 121 <tr>
122 122 <th class="date">date</th>
123 123 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td>
124 124 </tr>
125 125 <tr>
126 126 <th class="author">parents</th>
127 127 <td class="author"></td>
128 128 </tr>
129 129 <tr>
130 130 <th class="author">children</th>
131 131 <td class="author"></td>
132 132 </tr>
133 133
134 134 </table>
135 135
136 136 <div class="overflow">
137 137 <div class="sourcefirst"> line source</div>
138 138
139 139 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></div>
140 140 <div class="parity1 source"><a href="#l2" id="l2"> 2</a> </div>
141 141 <div class="parity0 source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></div>
142 142 <div class="parity1 source"><a href="#l4" id="l4"> 4</a> </div>
143 143 <div class="parity0 source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div>
144 144 <div class="parity1 source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></div>
145 145 <div class="parity0 source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></div>
146 146 <div class="parity1 source"><a href="#l8" id="l8"> 8</a> </div>
147 147 <div class="parity0 source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div>
148 148 <div class="parity1 source"><a href="#l10" id="l10"> 10</a> </div>
149 149 <div class="parity0 source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div>
150 150 <div class="parity1 source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></div>
151 151 <div class="parity0 source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
152 152 <div class="parity1 source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div>
153 153 <div class="parity0 source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></div>
154 154 <div class="parity1 source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></div>
155 155 <div class="parity0 source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></div>
156 156 <div class="parity1 source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div>
157 157 <div class="parity0 source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div>
158 158 <div class="parity1 source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></div>
159 159 <div class="parity0 source"><a href="#l21" id="l21"> 21</a> </div>
160 160 <div class="parity1 source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div>
161 161 <div class="parity0 source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div>
162 162 <div class="parity1 source"><a href="#l24" id="l24"> 24</a> </div>
163 163 <div class="parity0 source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div>
164 164 <div class="parity1 source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></div>
165 165 <div class="parity0 source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></div>
166 166 <div class="parity1 source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div>
167 167 <div class="parity0 source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div>
168 168 <div class="parity1 source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div>
169 169 <div class="parity0 source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div>
170 170 <div class="parity1 source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div>
171 171 <div class="sourcelast"></div>
172 172 </div>
173 173 </div>
174 174 </div>
175 175
176 176
177 177
178 178 </body>
179 179 </html>
180 180
181 181
182 182 hgweb fileannotate, html
183 183
184 184 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py') \
185 185 > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mi\"/class=\"mf\"/g"
186 186 200 Script output follows
187 187
188 188 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
189 189 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
190 190 <head>
191 191 <link rel="icon" href="/static/hgicon.png" type="image/png" />
192 192 <meta name="robots" content="index, nofollow" />
193 193 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
194 194
195 195 <link rel="stylesheet" href="/highlightcss" type="text/css" />
196 196 <title>test: primes.py annotate</title>
197 197 </head>
198 198 <body>
199 199
200 200 <div class="container">
201 201 <div class="menu">
202 202 <div class="logo">
203 203 <a href="http://mercurial.selenic.com/">
204 204 <img src="/static/hglogo.png" alt="mercurial" /></a>
205 205 </div>
206 206 <ul>
207 207 <li><a href="/shortlog/853dcd4de2a6">log</a></li>
208 208 <li><a href="/graph/853dcd4de2a6">graph</a></li>
209 209 <li><a href="/tags">tags</a></li>
210 210 <li><a href="/branches">branches</a></li>
211 211 </ul>
212 212
213 213 <ul>
214 214 <li><a href="/rev/853dcd4de2a6">changeset</a></li>
215 215 <li><a href="/file/853dcd4de2a6/">browse</a></li>
216 216 </ul>
217 217 <ul>
218 218 <li><a href="/file/853dcd4de2a6/primes.py">file</a></li>
219 219 <li><a href="/file/tip/primes.py">latest</a></li>
220 220 <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li>
221 221 <li class="active">annotate</li>
222 222 <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li>
223 223 <li><a href="/raw-annotate/853dcd4de2a6/primes.py">raw</a></li>
224 224 </ul>
225 225 <ul>
226 226 <li><a href="/help">help</a></li>
227 227 </ul>
228 228 </div>
229 229
230 230 <div class="main">
231 231 <h2><a href="/">test</a></h2>
232 232 <h3>annotate primes.py @ 0:853dcd4de2a6</h3>
233 233
234 234 <form class="search" action="/log">
235 235
236 236 <p><input name="rev" id="search1" type="text" size="30" /></p>
237 237 <div id="hint">find changesets by author, revision,
238 238 files, or words in the commit message</div>
239 239 </form>
240 240
241 241 <div class="description">a</div>
242 242
243 243 <table id="changesetEntry">
244 244 <tr>
245 245 <th class="author">author</th>
246 246 <td class="author">&#116;&#101;&#115;&#116;</td>
247 247 </tr>
248 248 <tr>
249 249 <th class="date">date</th>
250 250 <td class="date">Thu Jan 01 00:00:00 1970 +0000 (1970-01-01)</td>
251 251 </tr>
252 252 <tr>
253 253 <th class="author">parents</th>
254 254 <td class="author"></td>
255 255 </tr>
256 256 <tr>
257 257 <th class="author">children</th>
258 258 <td class="author"></td>
259 259 </tr>
260 260
261 261 </table>
262 262
263 263 <div class="overflow">
264 264 <table class="bigtable">
265 265 <tr>
266 266 <th class="annotate">rev</th>
267 267 <th class="line">&nbsp;&nbsp;line source</th>
268 268 </tr>
269 269
270 270 <tr class="parity0">
271 271 <td class="annotate">
272 272 <a href="/annotate/853dcd4de2a6/primes.py#1"
273 273 title="853dcd4de2a6: a">test@0</a>
274 274 </td>
275 275 <td class="source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td>
276 276 </tr>
277 277 <tr class="parity1">
278 278 <td class="annotate">
279 279 <a href="/annotate/853dcd4de2a6/primes.py#2"
280 280 title="853dcd4de2a6: a">test@0</a>
281 281 </td>
282 282 <td class="source"><a href="#l2" id="l2"> 2</a> </td>
283 283 </tr>
284 284 <tr class="parity0">
285 285 <td class="annotate">
286 286 <a href="/annotate/853dcd4de2a6/primes.py#3"
287 287 title="853dcd4de2a6: a">test@0</a>
288 288 </td>
289 289 <td class="source"><a href="#l3" id="l3"> 3</a> <span class="sd">&quot;&quot;&quot;Fun with generators. Corresponding Haskell implementation:</span></td>
290 290 </tr>
291 291 <tr class="parity1">
292 292 <td class="annotate">
293 293 <a href="/annotate/853dcd4de2a6/primes.py#4"
294 294 title="853dcd4de2a6: a">test@0</a>
295 295 </td>
296 296 <td class="source"><a href="#l4" id="l4"> 4</a> </td>
297 297 </tr>
298 298 <tr class="parity0">
299 299 <td class="annotate">
300 300 <a href="/annotate/853dcd4de2a6/primes.py#5"
301 301 title="853dcd4de2a6: a">test@0</a>
302 302 </td>
303 303 <td class="source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td>
304 304 </tr>
305 305 <tr class="parity1">
306 306 <td class="annotate">
307 307 <a href="/annotate/853dcd4de2a6/primes.py#6"
308 308 title="853dcd4de2a6: a">test@0</a>
309 309 </td>
310 310 <td class="source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n &lt;- ns, mod n p /= 0]</span></td>
311 311 </tr>
312 312 <tr class="parity0">
313 313 <td class="annotate">
314 314 <a href="/annotate/853dcd4de2a6/primes.py#7"
315 315 title="853dcd4de2a6: a">test@0</a>
316 316 </td>
317 317 <td class="source"><a href="#l7" id="l7"> 7</a> <span class="sd">&quot;&quot;&quot;</span></td>
318 318 </tr>
319 319 <tr class="parity1">
320 320 <td class="annotate">
321 321 <a href="/annotate/853dcd4de2a6/primes.py#8"
322 322 title="853dcd4de2a6: a">test@0</a>
323 323 </td>
324 324 <td class="source"><a href="#l8" id="l8"> 8</a> </td>
325 325 </tr>
326 326 <tr class="parity0">
327 327 <td class="annotate">
328 328 <a href="/annotate/853dcd4de2a6/primes.py#9"
329 329 title="853dcd4de2a6: a">test@0</a>
330 330 </td>
331 331 <td class="source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td>
332 332 </tr>
333 333 <tr class="parity1">
334 334 <td class="annotate">
335 335 <a href="/annotate/853dcd4de2a6/primes.py#10"
336 336 title="853dcd4de2a6: a">test@0</a>
337 337 </td>
338 338 <td class="source"><a href="#l10" id="l10"> 10</a> </td>
339 339 </tr>
340 340 <tr class="parity0">
341 341 <td class="annotate">
342 342 <a href="/annotate/853dcd4de2a6/primes.py#11"
343 343 title="853dcd4de2a6: a">test@0</a>
344 344 </td>
345 345 <td class="source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td>
346 346 </tr>
347 347 <tr class="parity1">
348 348 <td class="annotate">
349 349 <a href="/annotate/853dcd4de2a6/primes.py#12"
350 350 title="853dcd4de2a6: a">test@0</a>
351 351 </td>
352 352 <td class="source"><a href="#l12" id="l12"> 12</a> <span class="sd">&quot;&quot;&quot;Generate all primes.&quot;&quot;&quot;</span></td>
353 353 </tr>
354 354 <tr class="parity0">
355 355 <td class="annotate">
356 356 <a href="/annotate/853dcd4de2a6/primes.py#13"
357 357 title="853dcd4de2a6: a">test@0</a>
358 358 </td>
359 359 <td class="source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
360 360 </tr>
361 361 <tr class="parity1">
362 362 <td class="annotate">
363 363 <a href="/annotate/853dcd4de2a6/primes.py#14"
364 364 title="853dcd4de2a6: a">test@0</a>
365 365 </td>
366 366 <td class="source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td>
367 367 </tr>
368 368 <tr class="parity0">
369 369 <td class="annotate">
370 370 <a href="/annotate/853dcd4de2a6/primes.py#15"
371 371 title="853dcd4de2a6: a">test@0</a>
372 372 </td>
373 373 <td class="source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td>
374 374 </tr>
375 375 <tr class="parity1">
376 376 <td class="annotate">
377 377 <a href="/annotate/853dcd4de2a6/primes.py#16"
378 378 title="853dcd4de2a6: a">test@0</a>
379 379 </td>
380 380 <td class="source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></td>
381 381 </tr>
382 382 <tr class="parity0">
383 383 <td class="annotate">
384 384 <a href="/annotate/853dcd4de2a6/primes.py#17"
385 385 title="853dcd4de2a6: a">test@0</a>
386 386 </td>
387 387 <td class="source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td>
388 388 </tr>
389 389 <tr class="parity1">
390 390 <td class="annotate">
391 391 <a href="/annotate/853dcd4de2a6/primes.py#18"
392 392 title="853dcd4de2a6: a">test@0</a>
393 393 </td>
394 394 <td class="source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mf">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td>
395 395 </tr>
396 396 <tr class="parity0">
397 397 <td class="annotate">
398 398 <a href="/annotate/853dcd4de2a6/primes.py#19"
399 399 title="853dcd4de2a6: a">test@0</a>
400 400 </td>
401 401 <td class="source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td>
402 402 </tr>
403 403 <tr class="parity1">
404 404 <td class="annotate">
405 405 <a href="/annotate/853dcd4de2a6/primes.py#20"
406 406 title="853dcd4de2a6: a">test@0</a>
407 407 </td>
408 408 <td class="source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td>
409 409 </tr>
410 410 <tr class="parity0">
411 411 <td class="annotate">
412 412 <a href="/annotate/853dcd4de2a6/primes.py#21"
413 413 title="853dcd4de2a6: a">test@0</a>
414 414 </td>
415 415 <td class="source"><a href="#l21" id="l21"> 21</a> </td>
416 416 </tr>
417 417 <tr class="parity1">
418 418 <td class="annotate">
419 419 <a href="/annotate/853dcd4de2a6/primes.py#22"
420 420 title="853dcd4de2a6: a">test@0</a>
421 421 </td>
422 422 <td class="source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mf">2</span> <span class="o">==</span> <span class="mf">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td>
423 423 </tr>
424 424 <tr class="parity0">
425 425 <td class="annotate">
426 426 <a href="/annotate/853dcd4de2a6/primes.py#23"
427 427 title="853dcd4de2a6: a">test@0</a>
428 428 </td>
429 429 <td class="source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mf">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">&lt;</span> <span class="mf">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td>
430 430 </tr>
431 431 <tr class="parity1">
432 432 <td class="annotate">
433 433 <a href="/annotate/853dcd4de2a6/primes.py#24"
434 434 title="853dcd4de2a6: a">test@0</a>
435 435 </td>
436 436 <td class="source"><a href="#l24" id="l24"> 24</a> </td>
437 437 </tr>
438 438 <tr class="parity0">
439 439 <td class="annotate">
440 440 <a href="/annotate/853dcd4de2a6/primes.py#25"
441 441 title="853dcd4de2a6: a">test@0</a>
442 442 </td>
443 443 <td class="source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></td>
444 444 </tr>
445 445 <tr class="parity1">
446 446 <td class="annotate">
447 447 <a href="/annotate/853dcd4de2a6/primes.py#26"
448 448 title="853dcd4de2a6: a">test@0</a>
449 449 </td>
450 450 <td class="source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td>
451 451 </tr>
452 452 <tr class="parity0">
453 453 <td class="annotate">
454 454 <a href="/annotate/853dcd4de2a6/primes.py#27"
455 455 title="853dcd4de2a6: a">test@0</a>
456 456 </td>
457 457 <td class="source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td>
458 458 </tr>
459 459 <tr class="parity1">
460 460 <td class="annotate">
461 461 <a href="/annotate/853dcd4de2a6/primes.py#28"
462 462 title="853dcd4de2a6: a">test@0</a>
463 463 </td>
464 464 <td class="source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></td>
465 465 </tr>
466 466 <tr class="parity0">
467 467 <td class="annotate">
468 468 <a href="/annotate/853dcd4de2a6/primes.py#29"
469 469 title="853dcd4de2a6: a">test@0</a>
470 470 </td>
471 471 <td class="source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td>
472 472 </tr>
473 473 <tr class="parity1">
474 474 <td class="annotate">
475 475 <a href="/annotate/853dcd4de2a6/primes.py#30"
476 476 title="853dcd4de2a6: a">test@0</a>
477 477 </td>
478 478 <td class="source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mf">10</span></td>
479 479 </tr>
480 480 <tr class="parity0">
481 481 <td class="annotate">
482 482 <a href="/annotate/853dcd4de2a6/primes.py#31"
483 483 title="853dcd4de2a6: a">test@0</a>
484 484 </td>
485 485 <td class="source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td>
486 486 </tr>
487 487 <tr class="parity1">
488 488 <td class="annotate">
489 489 <a href="/annotate/853dcd4de2a6/primes.py#32"
490 490 title="853dcd4de2a6: a">test@0</a>
491 491 </td>
492 492 <td class="source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">&quot;The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td>
493 493 </tr>
494 494 </table>
495 495 </div>
496 496 </div>
497 497 </div>
498 498
499 499
500 500
501 501 </body>
502 502 </html>
503 503
504 504
505 505 hgweb fileannotate, raw
506 506
507 507 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py?style=raw') \
508 508 > | sed "s/test@//" > a
509 509 $ echo "200 Script output follows" > b
510 510 $ echo "" >> b
511 511 $ echo "" >> b
512 512 $ hg annotate "primes.py" >> b
513 513 $ echo "" >> b
514 514 $ echo "" >> b
515 515 $ echo "" >> b
516 516 $ echo "" >> b
517 517 $ diff -u b a
518 518 $ echo
519 519
520 520
521 521 hgweb filerevision, raw
522 522
523 523 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py?style=raw') \
524 524 > > a
525 525 $ echo "200 Script output follows" > b
526 526 $ echo "" >> b
527 527 $ hg cat primes.py >> b
528 528 $ diff -u b a
529 529 $ echo
530 530
531 531
532 532 hgweb highlightcss friendly
533 533
534 534 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
535 535 $ head -n 4 out
536 536 200 Script output follows
537 537
538 538 /* pygments_style = friendly */
539 539
540 540 $ rm out
541 541
542 542 errors encountered
543 543
544 544 $ cat errors.log
545 545 $ "$TESTDIR/killdaemons.py"
546 546
547 547 Change the pygments style
548 548
549 549 $ cat > .hg/hgrc <<EOF
550 550 > [web]
551 551 > pygments_style = fruity
552 552 > EOF
553 553
554 554 hg serve again
555 555
556 556 $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log
557 557 $ cat hg.pid >> $DAEMON_PIDS
558 558
559 559 hgweb highlightcss fruity
560 560
561 561 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out
562 562 $ head -n 4 out
563 563 200 Script output follows
564 564
565 565 /* pygments_style = fruity */
566 566
567 567 $ rm out
568 568
569 569 errors encountered
570 570
571 571 $ cat errors.log
572 572 $ cd ..
573 573 $ hg init eucjp
574 574 $ cd eucjp
575 575 $ python -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo"
576 576 $ hg ci -Ama
577 577 adding eucjp.txt
578 578 $ hgserveget () {
579 579 > "$TESTDIR/killdaemons.py"
580 580 > echo % HGENCODING="$1" hg serve
581 581 > HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log
582 582 > cat hg.pid >> $DAEMON_PIDS
583 583 >
584 584 > echo % hgweb filerevision, html
585 585 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/file/tip/$2" \
586 > | grep '<div class="parity0 source">' | $TESTDIR/printrepr.py
586 > | grep '<div class="parity0 source">'
587 587 > echo % errors encountered
588 588 > cat errors.log
589 589 > }
590 590 $ hgserveget euc-jp eucjp.txt
591 591 % HGENCODING=euc-jp hg serve
592 592 % hgweb filerevision, html
593 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xb5\xfe</div>
593 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xb5\xfe</div> (esc)
594 594 % errors encountered
595 595 $ hgserveget utf-8 eucjp.txt
596 596 % HGENCODING=utf-8 hg serve
597 597 % hgweb filerevision, html
598 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xef\xbf\xbd\xef\xbf\xbd</div>
598 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc)
599 599 % errors encountered
600 600 $ hgserveget us-ascii eucjp.txt
601 601 % HGENCODING=us-ascii hg serve
602 602 % hgweb filerevision, html
603 603 <div class="parity0 source"><a href="#l1" id="l1"> 1</a> ??</div>
604 604 % errors encountered
@@ -1,122 +1,146 b''
1 1 $ cat > makepatch.py <<EOF
2 2 > f = file('eol.diff', 'wb')
3 3 > w = f.write
4 4 > w('test message\n')
5 5 > w('diff --git a/a b/a\n')
6 6 > w('--- a/a\n')
7 7 > w('+++ b/a\n')
8 8 > w('@@ -1,5 +1,5 @@\n')
9 9 > w(' a\n')
10 10 > w('-bbb\r\n')
11 11 > w('+yyyy\r\n')
12 12 > w(' cc\r\n')
13 13 > w(' \n')
14 14 > w(' d\n')
15 15 > w('-e\n')
16 16 > w('\ No newline at end of file\n')
17 17 > w('+z\r\n')
18 18 > w('\ No newline at end of file\r\n')
19 19 > EOF
20 20
21 21 $ hg init repo
22 22 $ cd repo
23 23 $ echo '\.diff' > .hgignore
24 24
25 25
26 26 Test different --eol values
27 27
28 28 $ python -c 'file("a", "wb").write("a\nbbb\ncc\n\nd\ne")'
29 29 $ hg ci -Am adda
30 30 adding .hgignore
31 31 adding a
32 32 $ python ../makepatch.py
33 33
34 34
35 35 invalid eol
36 36
37 37 $ hg --config patch.eol='LFCR' import eol.diff
38 38 applying eol.diff
39 39 abort: unsupported line endings type: LFCR
40 40 [255]
41 41 $ hg revert -a
42 42
43 43
44 44 force LF
45 45
46 46 $ hg --traceback --config patch.eol='LF' import eol.diff
47 47 applying eol.diff
48 $ python -c 'print repr(file("a","rb").read())'
49 'a\nyyyy\ncc\n\nd\ne'
48 $ cat a
49 a
50 yyyy
51 cc
52
53 d
54 e (no-eol)
50 55 $ hg st
51 56
52 57
53 58 force CRLF
54 59
55 60 $ hg up -C 0
56 61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 62 $ hg --traceback --config patch.eol='CRLF' import eol.diff
58 63 applying eol.diff
59 $ python -c 'print repr(file("a","rb").read())'
60 'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne'
64 $ cat a
65 a\r (esc)
66 yyyy\r (esc)
67 cc\r (esc)
68 \r (esc)
69 d\r (esc)
70 e (no-eol)
61 71 $ hg st
62 72
63 73
64 74 auto EOL on LF file
65 75
66 76 $ hg up -C 0
67 77 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 78 $ hg --traceback --config patch.eol='auto' import eol.diff
69 79 applying eol.diff
70 $ python -c 'print repr(file("a","rb").read())'
71 'a\nyyyy\ncc\n\nd\ne'
80 $ cat a
81 a
82 yyyy
83 cc
84
85 d
86 e (no-eol)
72 87 $ hg st
73 88
74 89
75 90 auto EOL on CRLF file
76 91
77 92 $ python -c 'file("a", "wb").write("a\r\nbbb\r\ncc\r\n\r\nd\r\ne")'
78 93 $ hg commit -m 'switch EOLs in a'
79 94 $ hg --traceback --config patch.eol='auto' import eol.diff
80 95 applying eol.diff
81 $ python -c 'print repr(file("a","rb").read())'
82 'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne'
96 $ cat a
97 a\r (esc)
98 yyyy\r (esc)
99 cc\r (esc)
100 \r (esc)
101 d\r (esc)
102 e (no-eol)
83 103 $ hg st
84 104
85 105
86 106 auto EOL on new file or source without any EOL
87 107
88 108 $ python -c 'file("noeol", "wb").write("noeol")'
89 109 $ hg add noeol
90 110 $ hg commit -m 'add noeol'
91 111 $ python -c 'file("noeol", "wb").write("noeol\r\nnoeol\n")'
92 112 $ python -c 'file("neweol", "wb").write("neweol\nneweol\r\n")'
93 113 $ hg add neweol
94 114 $ hg diff --git > noeol.diff
95 115 $ hg revert --no-backup noeol neweol
96 116 $ rm neweol
97 117 $ hg --traceback --config patch.eol='auto' import -m noeol noeol.diff
98 118 applying noeol.diff
99 $ python -c 'print repr(file("noeol","rb").read())'
100 'noeol\r\nnoeol\n'
101 $ python -c 'print repr(file("neweol","rb").read())'
102 'neweol\nneweol\r\n'
119 $ cat noeol
120 noeol\r (esc)
121 noeol
122 $ cat neweol
123 neweol
124 neweol\r (esc)
103 125 $ hg st
104 126
105 127
106 128 Test --eol and binary patches
107 129
108 130 $ python -c 'file("b", "wb").write("a\x00\nb\r\nd")'
109 131 $ hg ci -Am addb
110 132 adding b
111 133 $ python -c 'file("b", "wb").write("a\x00\nc\r\nd")'
112 134 $ hg diff --git > bin.diff
113 135 $ hg revert --no-backup b
114 136
115 137 binary patch with --eol
116 138
117 139 $ hg import --config patch.eol='CRLF' -m changeb bin.diff
118 140 applying bin.diff
119 $ python -c 'print repr(file("b","rb").read())'
120 'a\x00\nc\r\nd'
141 $ cat b
142 a\x00 (esc)
143 c\r (esc)
144 d (no-eol)
121 145 $ hg st
122 146 $ cd ..
@@ -1,172 +1,172 b''
1 1
2 2 $ cp "$TESTDIR"/../contrib/simplemerge .
3 3 $ echo base > base
4 4 $ echo local > local
5 5 $ cat base >> local
6 6 $ cp local orig
7 7 $ cat base > other
8 8 $ echo other >> other
9 9
10 10 changing local directly
11 11
12 12 $ python simplemerge local base other && echo "merge succeeded"
13 13 merge succeeded
14 14 $ cat local
15 15 local
16 16 base
17 17 other
18 18 $ cp orig local
19 19
20 20 printing to stdout
21 21
22 22 $ python simplemerge -p local base other
23 23 local
24 24 base
25 25 other
26 26
27 27 local:
28 28
29 29 $ cat local
30 30 local
31 31 base
32 32
33 33 conflicts
34 34
35 35 $ cp base conflict-local
36 36 $ cp other conflict-other
37 37 $ echo not other >> conflict-local
38 38 $ echo end >> conflict-local
39 39 $ echo end >> conflict-other
40 40 $ python simplemerge -p conflict-local base conflict-other
41 41 base
42 42 <<<<<<< conflict-local
43 43 not other
44 44 =======
45 45 other
46 46 >>>>>>> conflict-other
47 47 end
48 48 warning: conflicts during merge.
49 49 [1]
50 50
51 51 --no-minimal
52 52
53 53 $ python simplemerge -p --no-minimal conflict-local base conflict-other
54 54 base
55 55 <<<<<<< conflict-local
56 56 not other
57 57 end
58 58 =======
59 59 other
60 60 end
61 61 >>>>>>> conflict-other
62 62 warning: conflicts during merge.
63 63 [1]
64 64
65 65 1 label
66 66
67 67 $ python simplemerge -p -L foo conflict-local base conflict-other
68 68 base
69 69 <<<<<<< foo
70 70 not other
71 71 =======
72 72 other
73 73 >>>>>>> conflict-other
74 74 end
75 75 warning: conflicts during merge.
76 76 [1]
77 77
78 78 2 labels
79 79
80 80 $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
81 81 base
82 82 <<<<<<< foo
83 83 not other
84 84 =======
85 85 other
86 86 >>>>>>> bar
87 87 end
88 88 warning: conflicts during merge.
89 89 [1]
90 90
91 91 too many labels
92 92
93 93 $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
94 94 abort: can only specify two labels.
95 95 [255]
96 96
97 97 binary file
98 98
99 99 $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
100 100 $ cat orig >> binary-local
101 101 $ python simplemerge -p binary-local base other
102 102 abort: binary-local looks like a binary file.
103 103 [255]
104 104
105 105 binary file --text
106 106
107 $ python simplemerge -a -p binary-local base other 2>&1 | $TESTDIR/printrepr.py
107 $ python simplemerge -a -p binary-local base other 2>&1
108 108 warning: binary-local looks like a binary file.
109 \x00local
109 \x00local (esc)
110 110 base
111 111 other
112 112
113 113 help
114 114
115 115 $ python simplemerge --help
116 116 simplemerge [OPTS] LOCAL BASE OTHER
117 117
118 118 Simple three-way file merge utility with a minimal feature set.
119 119
120 120 Apply to LOCAL the changes necessary to go from BASE to OTHER.
121 121
122 122 By default, LOCAL is overwritten with the results of this operation.
123 123
124 124 options:
125 125 -L --label labels to use on conflict markers
126 126 -a --text treat all files as text
127 127 -p --print print results instead of overwriting LOCAL
128 128 --no-minimal do not try to minimize conflict regions
129 129 -h --help display help and exit
130 130 -q --quiet suppress output
131 131
132 132 wrong number of arguments
133 133
134 134 $ python simplemerge
135 135 simplemerge: wrong number of arguments
136 136 simplemerge [OPTS] LOCAL BASE OTHER
137 137
138 138 Simple three-way file merge utility with a minimal feature set.
139 139
140 140 Apply to LOCAL the changes necessary to go from BASE to OTHER.
141 141
142 142 By default, LOCAL is overwritten with the results of this operation.
143 143
144 144 options:
145 145 -L --label labels to use on conflict markers
146 146 -a --text treat all files as text
147 147 -p --print print results instead of overwriting LOCAL
148 148 --no-minimal do not try to minimize conflict regions
149 149 -h --help display help and exit
150 150 -q --quiet suppress output
151 151 [1]
152 152
153 153 bad option
154 154
155 155 $ python simplemerge --foo -p local base other
156 156 simplemerge: option --foo not recognized
157 157 simplemerge [OPTS] LOCAL BASE OTHER
158 158
159 159 Simple three-way file merge utility with a minimal feature set.
160 160
161 161 Apply to LOCAL the changes necessary to go from BASE to OTHER.
162 162
163 163 By default, LOCAL is overwritten with the results of this operation.
164 164
165 165 options:
166 166 -L --label labels to use on conflict markers
167 167 -a --text treat all files as text
168 168 -p --print print results instead of overwriting LOCAL
169 169 --no-minimal do not try to minimize conflict regions
170 170 -h --help display help and exit
171 171 -q --quiet suppress output
172 172 [1]
@@ -1,362 +1,363 b''
1 1 $ cat <<EOF >> $HGRCPATH
2 2 > [extensions]
3 3 > transplant=
4 4 > EOF
5 5
6 6 $ hg init t
7 7 $ cd t
8 8 $ echo r1 > r1
9 9 $ hg ci -Amr1 -d'0 0'
10 10 adding r1
11 11 $ echo r2 > r2
12 12 $ hg ci -Amr2 -d'1 0'
13 13 adding r2
14 14 $ hg up 0
15 15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
16 16
17 17 $ echo b1 > b1
18 18 $ hg ci -Amb1 -d '0 0'
19 19 adding b1
20 20 created new head
21 21 $ echo b2 > b2
22 22 $ hg ci -Amb2 -d '1 0'
23 23 adding b2
24 24 $ echo b3 > b3
25 25 $ hg ci -Amb3 -d '2 0'
26 26 adding b3
27 27
28 28 $ hg log --template '{rev} {parents} {desc}\n'
29 29 4 b3
30 30 3 b2
31 31 2 0:17ab29e464c6 b1
32 32 1 r2
33 33 0 r1
34 34
35 35 $ hg clone . ../rebase
36 36 updating to branch default
37 37 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 38 $ cd ../rebase
39 39
40 40 $ hg up -C 1
41 41 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
42 42
43 43 rebase b onto r1
44 44
45 45 $ hg transplant -a -b tip
46 46 applying 37a1297eb21b
47 47 37a1297eb21b transplanted to e234d668f844
48 48 applying 722f4667af76
49 49 722f4667af76 transplanted to 539f377d78df
50 50 applying a53251cdf717
51 51 a53251cdf717 transplanted to ffd6818a3975
52 52 $ hg log --template '{rev} {parents} {desc}\n'
53 53 7 b3
54 54 6 b2
55 55 5 1:d11e3596cc1a b1
56 56 4 b3
57 57 3 b2
58 58 2 0:17ab29e464c6 b1
59 59 1 r2
60 60 0 r1
61 61
62 62 test transplanted revset
63 63
64 64 $ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n'
65 65 5 1:d11e3596cc1a b1
66 66 6 b2
67 67 7 b3
68 68 $ hg help revsets | grep transplanted
69 69 "transplanted(set)"
70 70
71 71 $ hg clone ../t ../prune
72 72 updating to branch default
73 73 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 74 $ cd ../prune
75 75
76 76 $ hg up -C 1
77 77 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
78 78
79 79 rebase b onto r1, skipping b2
80 80
81 81 $ hg transplant -a -b tip -p 3
82 82 applying 37a1297eb21b
83 83 37a1297eb21b transplanted to e234d668f844
84 84 applying a53251cdf717
85 85 a53251cdf717 transplanted to 7275fda4d04f
86 86 $ hg log --template '{rev} {parents} {desc}\n'
87 87 6 b3
88 88 5 1:d11e3596cc1a b1
89 89 4 b3
90 90 3 b2
91 91 2 0:17ab29e464c6 b1
92 92 1 r2
93 93 0 r1
94 94
95 95
96 96 remote transplant
97 97
98 98 $ hg clone -r 1 ../t ../remote
99 99 adding changesets
100 100 adding manifests
101 101 adding file changes
102 102 added 2 changesets with 2 changes to 2 files
103 103 updating to branch default
104 104 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 105 $ cd ../remote
106 106 $ hg transplant --log -s ../t 2 4
107 107 searching for changes
108 108 applying 37a1297eb21b
109 109 37a1297eb21b transplanted to c19cf0ccb069
110 110 applying a53251cdf717
111 111 a53251cdf717 transplanted to f7fe5bf98525
112 112 $ hg log --template '{rev} {parents} {desc}\n'
113 113 3 b3
114 114 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
115 115 2 b1
116 116 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
117 117 1 r2
118 118 0 r1
119 119
120 120 skip previous transplants
121 121
122 122 $ hg transplant -s ../t -a -b 4
123 123 searching for changes
124 124 applying 722f4667af76
125 125 722f4667af76 transplanted to 47156cd86c0b
126 126 $ hg log --template '{rev} {parents} {desc}\n'
127 127 4 b2
128 128 3 b3
129 129 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
130 130 2 b1
131 131 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
132 132 1 r2
133 133 0 r1
134 134
135 135 skip local changes transplanted to the source
136 136
137 137 $ echo b4 > b4
138 138 $ hg ci -Amb4 -d '3 0'
139 139 adding b4
140 140 $ hg clone ../t ../pullback
141 141 updating to branch default
142 142 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 143 $ cd ../pullback
144 144 $ hg transplant -s ../remote -a -b tip
145 145 searching for changes
146 146 applying 4333daefcb15
147 147 4333daefcb15 transplanted to 5f42c04e07cc
148 148
149 149
150 150 remote transplant with pull
151 151
152 152 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
153 153 $ cat ../t.pid >> $DAEMON_PIDS
154 154
155 155 $ hg clone -r 0 ../t ../rp
156 156 adding changesets
157 157 adding manifests
158 158 adding file changes
159 159 added 1 changesets with 1 changes to 1 files
160 160 updating to branch default
161 161 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 162 $ cd ../rp
163 163 $ hg transplant -s http://localhost:$HGPORT/ 2 4
164 164 searching for changes
165 165 searching for changes
166 166 adding changesets
167 167 adding manifests
168 168 adding file changes
169 169 added 1 changesets with 1 changes to 1 files
170 170 applying a53251cdf717
171 171 a53251cdf717 transplanted to 8d9279348abb
172 172 $ hg log --template '{rev} {parents} {desc}\n'
173 173 2 b3
174 174 1 b1
175 175 0 r1
176 176
177 177 transplant --continue
178 178
179 179 $ hg init ../tc
180 180 $ cd ../tc
181 181 $ cat <<EOF > foo
182 182 > foo
183 183 > bar
184 184 > baz
185 185 > EOF
186 186 $ echo toremove > toremove
187 187 $ hg ci -Amfoo
188 188 adding foo
189 189 adding toremove
190 190 $ cat <<EOF > foo
191 191 > foo2
192 192 > bar2
193 193 > baz2
194 194 > EOF
195 195 $ rm toremove
196 196 $ echo added > added
197 197 $ hg ci -Amfoo2
198 198 adding added
199 199 removing toremove
200 200 $ echo bar > bar
201 201 $ hg ci -Ambar
202 202 adding bar
203 203 $ echo bar2 >> bar
204 204 $ hg ci -mbar2
205 205 $ hg up 0
206 206 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
207 207 $ echo foobar > foo
208 208 $ hg ci -mfoobar
209 209 created new head
210 210 $ hg transplant 1:3
211 211 applying a1e30dd1b8e7
212 212 patching file foo
213 213 Hunk #1 FAILED at 0
214 214 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
215 215 patch failed to apply
216 216 abort: fix up the merge and run hg transplant --continue
217 217 [255]
218 218
219 219 transplant -c shouldn't use an old changeset
220 220
221 221 $ hg up -C
222 222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 223 $ rm added
224 224 $ hg transplant 1
225 225 applying a1e30dd1b8e7
226 226 patching file foo
227 227 Hunk #1 FAILED at 0
228 228 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
229 229 patch failed to apply
230 230 abort: fix up the merge and run hg transplant --continue
231 231 [255]
232 232 $ hg transplant --continue
233 233 a1e30dd1b8e7 transplanted as f1563cf27039
234 234 $ hg transplant 1:3
235 235 skipping already applied revision 1:a1e30dd1b8e7
236 236 applying 1739ac5f6139
237 237 1739ac5f6139 transplanted to d649c221319f
238 238 applying 0282d5fbbe02
239 239 0282d5fbbe02 transplanted to 77418277ccb3
240 240 $ hg locate
241 241 added
242 242 bar
243 243 foo
244 244 $ cd ..
245 245
246 246 Issue1111: Test transplant --merge
247 247
248 248 $ hg init t1111
249 249 $ cd t1111
250 250 $ echo a > a
251 251 $ hg ci -Am adda
252 252 adding a
253 253 $ echo b >> a
254 254 $ hg ci -m appendb
255 255 $ echo c >> a
256 256 $ hg ci -m appendc
257 257 $ hg up -C 0
258 258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 259 $ echo d >> a
260 260 $ hg ci -m appendd
261 261 created new head
262 262
263 263 tranplant
264 264
265 265 $ hg transplant -m 1
266 266 applying 42dc4432fd35
267 267 1:42dc4432fd35 merged at a9f4acbac129
268 268 $ cd ..
269 269
270 270 test transplant into empty repository
271 271
272 272 $ hg init empty
273 273 $ cd empty
274 274 $ hg transplant -s ../t -b tip -a
275 275 adding changesets
276 276 adding manifests
277 277 adding file changes
278 278 added 4 changesets with 4 changes to 4 files
279 279 $ cd ..
280 280
281 281
282 282 test filter
283 283
284 284 $ hg init filter
285 285 $ cd filter
286 286 $ cat <<'EOF' >test-filter
287 287 > #!/bin/sh
288 288 > sed 's/r1/r2/' $1 > $1.new
289 289 > mv $1.new $1
290 290 > EOF
291 291 $ chmod +x test-filter
292 292 $ hg transplant -s ../t -b tip -a --filter ./test-filter
293 293 filtering * (glob)
294 294 applying 17ab29e464c6
295 295 17ab29e464c6 transplanted to e9ffc54ea104
296 296 filtering * (glob)
297 297 applying 37a1297eb21b
298 298 37a1297eb21b transplanted to 348b36d0b6a5
299 299 filtering * (glob)
300 300 applying 722f4667af76
301 301 722f4667af76 transplanted to 0aa6979afb95
302 302 filtering * (glob)
303 303 applying a53251cdf717
304 304 a53251cdf717 transplanted to 14f8512272b5
305 305 $ hg log --template '{rev} {parents} {desc}\n'
306 306 3 b3
307 307 2 b2
308 308 1 b1
309 309 0 r2
310 310 $ cd ..
311 311
312 312
313 313 test filter with failed patch
314 314
315 315 $ cd filter
316 316 $ hg up 0
317 317 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
318 318 $ echo foo > b1
319 319 $ hg ci -Am foo
320 320 adding b1
321 321 adding test-filter
322 322 created new head
323 323 $ hg transplant 1 --filter ./test-filter
324 324 filtering * (glob)
325 325 applying 348b36d0b6a5
326 326 file b1 already exists
327 327 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
328 328 patch failed to apply
329 329 abort: fix up the merge and run hg transplant --continue
330 330 [255]
331 331 $ cd ..
332 332
333 333
334 334 test with a win32ext like setup (differing EOLs)
335 335
336 336 $ hg init twin1
337 337 $ cd twin1
338 338 $ echo a > a
339 339 $ echo b > b
340 340 $ echo b >> b
341 341 $ hg ci -Am t
342 342 adding a
343 343 adding b
344 344 $ echo a > b
345 345 $ echo b >> b
346 346 $ hg ci -m changeb
347 347 $ cd ..
348 348
349 349 $ hg init twin2
350 350 $ cd twin2
351 351 $ echo '[patch]' >> .hg/hgrc
352 352 $ echo 'eol = crlf' >> .hg/hgrc
353 353 $ python -c "file('b', 'wb').write('b\r\nb\r\n')"
354 354 $ hg ci -m addb
355 355 nothing changed
356 356 [1]
357 357 $ hg transplant -s ../twin1 tip
358 358 applying 2e849d776c17
359 359 2e849d776c17 transplanted to 589cea8ba85b
360 $ python -c "print repr(file('b', 'rb').read())"
361 'a\r\nb\r\n'
360 $ cat b
361 a\r (esc)
362 b\r (esc)
362 363 $ cd ..
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now