##// END OF EJS Templates
tests: removed redundant "-d '0 0'" from test scripts...
Martin Geisler -
r8167:6c82beaa default
parent child Browse files
Show More
@@ -1,159 +1,159 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 HGMERGE=true; export HGMERGE
3 HGMERGE=true; export HGMERGE
4
4
5 hg init basic
5 hg init basic
6 cd basic
6 cd basic
7
7
8 echo '# should complain'
8 echo '# should complain'
9 hg backout
9 hg backout
10 hg backout -r 0 0
10 hg backout -r 0 0
11
11
12 echo '# basic operation'
12 echo '# basic operation'
13 echo a > a
13 echo a > a
14 hg commit -d '0 0' -A -m a
14 hg commit -d '0 0' -A -m a
15 echo b >> a
15 echo b >> a
16 hg commit -d '1 0' -m b
16 hg commit -d '1 0' -m b
17
17
18 hg backout -d '2 0' tip
18 hg backout -d '2 0' tip
19 cat a
19 cat a
20
20
21 echo '# file that was removed is recreated'
21 echo '# file that was removed is recreated'
22 cd ..
22 cd ..
23 hg init remove
23 hg init remove
24 cd remove
24 cd remove
25
25
26 echo content > a
26 echo content > a
27 hg commit -d '0 0' -A -m a
27 hg commit -d '0 0' -A -m a
28
28
29 hg rm a
29 hg rm a
30 hg commit -d '1 0' -m b
30 hg commit -d '1 0' -m b
31
31
32 hg backout -d '2 0' --merge tip
32 hg backout -d '2 0' --merge tip
33 cat a
33 cat a
34
34
35 echo '# backout of backout is as if nothing happened'
35 echo '# backout of backout is as if nothing happened'
36
36
37 hg backout -d '3 0' --merge tip
37 hg backout -d '3 0' --merge tip
38 cat a 2>/dev/null || echo cat: a: No such file or directory
38 cat a 2>/dev/null || echo cat: a: No such file or directory
39
39
40 echo '# across branch'
40 echo '# across branch'
41 cd ..
41 cd ..
42 hg init branch
42 hg init branch
43 cd branch
43 cd branch
44 echo a > a
44 echo a > a
45 hg ci -Am0 -d '0 0'
45 hg ci -Am0
46 echo b > b
46 echo b > b
47 hg ci -Am1 -d '0 0'
47 hg ci -Am1
48 hg co -C 0
48 hg co -C 0
49 # should fail
49 # should fail
50 hg backout -d '0 0' 1
50 hg backout 1
51 echo c > c
51 echo c > c
52 hg ci -Am2 -d '0 0'
52 hg ci -Am2
53 # should fail
53 # should fail
54 hg backout -d '0 0' 1
54 hg backout 1
55
55
56 echo '# backout with merge'
56 echo '# backout with merge'
57 cd ..
57 cd ..
58 hg init merge
58 hg init merge
59 cd merge
59 cd merge
60
60
61 echo line 1 > a
61 echo line 1 > a
62 echo line 2 >> a
62 echo line 2 >> a
63 hg commit -d '0 0' -A -m a
63 hg commit -d '0 0' -A -m a
64 # remove line 1
64 # remove line 1
65 echo line 2 > a
65 echo line 2 > a
66 hg commit -d '1 0' -m b
66 hg commit -d '1 0' -m b
67
67
68 echo line 3 >> a
68 echo line 3 >> a
69 hg commit -d '2 0' -m c
69 hg commit -d '2 0' -m c
70
70
71 hg backout --merge -d '3 0' 1
71 hg backout --merge -d '3 0' 1
72 hg commit -d '4 0' -m d
72 hg commit -d '4 0' -m d
73 # check line 1 is back
73 # check line 1 is back
74 cat a
74 cat a
75
75
76 echo '# backout should not back out subsequent changesets'
76 echo '# backout should not back out subsequent changesets'
77 hg init onecs
77 hg init onecs
78 cd onecs
78 cd onecs
79 echo 1 > a
79 echo 1 > a
80 hg commit -d '0 0' -A -m a
80 hg commit -d '0 0' -A -m a
81 echo 2 >> a
81 echo 2 >> a
82 hg commit -d '1 0' -m b
82 hg commit -d '1 0' -m b
83 echo 1 > b
83 echo 1 > b
84 hg commit -d '2 0' -A -m c
84 hg commit -d '2 0' -A -m c
85 hg backout -d '3 0' 1
85 hg backout -d '3 0' 1
86 hg locate b
86 hg locate b
87 hg update -C tip
87 hg update -C tip
88 hg locate b
88 hg locate b
89
89
90 cd ..
90 cd ..
91 hg init m
91 hg init m
92 cd m
92 cd m
93 echo a > a
93 echo a > a
94 hg commit -d '0 0' -A -m a
94 hg commit -d '0 0' -A -m a
95 echo b > b
95 echo b > b
96 hg commit -d '1 0' -A -m b
96 hg commit -d '1 0' -A -m b
97 echo c > c
97 echo c > c
98 hg commit -d '2 0' -A -m b
98 hg commit -d '2 0' -A -m b
99 hg update 1
99 hg update 1
100 echo d > d
100 echo d > d
101 hg commit -d '3 0' -A -m c
101 hg commit -d '3 0' -A -m c
102 hg merge 2
102 hg merge 2
103 hg commit -d '4 0' -A -m d
103 hg commit -d '4 0' -A -m d
104
104
105 echo '# backout of merge should fail'
105 echo '# backout of merge should fail'
106
106
107 hg backout 4
107 hg backout 4
108
108
109 echo '# backout of merge with bad parent should fail'
109 echo '# backout of merge with bad parent should fail'
110
110
111 hg backout --parent 0 4
111 hg backout --parent 0 4
112
112
113 echo '# backout of non-merge with parent should fail'
113 echo '# backout of non-merge with parent should fail'
114
114
115 hg backout --parent 0 3
115 hg backout --parent 0 3
116
116
117 echo '# backout with valid parent should be ok'
117 echo '# backout with valid parent should be ok'
118
118
119 hg backout -d '5 0' --parent 2 4
119 hg backout -d '5 0' --parent 2 4
120
120
121 hg rollback
121 hg rollback
122 hg update -C
122 hg update -C
123
123
124 hg backout -d '6 0' --parent 3 4
124 hg backout -d '6 0' --parent 3 4
125
125
126 cd ..
126 cd ..
127
127
128 echo '# named branches'
128 echo '# named branches'
129
129
130 hg init named_branches
130 hg init named_branches
131 cd named_branches
131 cd named_branches
132
132
133 echo default > default
133 echo default > default
134 hg ci -d '0 0' -Am default
134 hg ci -d '0 0' -Am default
135 hg branch branch1
135 hg branch branch1
136 echo branch1 > file1
136 echo branch1 > file1
137 hg ci -d '1 0' -Am file1
137 hg ci -d '1 0' -Am file1
138 hg branch branch2
138 hg branch branch2
139 echo branch2 > file2
139 echo branch2 > file2
140 hg ci -d '2 0' -Am file2
140 hg ci -d '2 0' -Am file2
141 hg backout -d '3 0' -r 1 -m 'backout on branch1'
141 hg backout -d '3 0' -r 1 -m 'backout on branch1'
142 # XXX maybe backout shouldn't suggest a merge here as it is a different branch?
142 # XXX maybe backout shouldn't suggest a merge here as it is a different branch?
143
143
144 echo '% on branch2 with branch1 not merged, so file1 should still exist:'
144 echo '% on branch2 with branch1 not merged, so file1 should still exist:'
145 hg id
145 hg id
146 hg st -A
146 hg st -A
147
147
148 echo '% on branch2 with branch1 merged, so file1 should be gone:'
148 echo '% on branch2 with branch1 merged, so file1 should be gone:'
149 hg merge
149 hg merge
150 hg ci -d '4 0' -m 'merge backout of branch1'
150 hg ci -d '4 0' -m 'merge backout of branch1'
151 hg id
151 hg id
152 hg st -A
152 hg st -A
153
153
154 echo '% on branch1, so no file1 and file2:'
154 echo '% on branch1, so no file1 and file2:'
155 hg co -C branch1
155 hg co -C branch1
156 hg id
156 hg id
157 hg st -A
157 hg st -A
158
158
159 exit 0
159 exit 0
@@ -1,38 +1,38 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[extensions]" >> $HGRCPATH
3 echo "[extensions]" >> $HGRCPATH
4 echo "rebase=" >> $HGRCPATH
4 echo "rebase=" >> $HGRCPATH
5 echo "bookmarks=" >> $HGRCPATH
5 echo "bookmarks=" >> $HGRCPATH
6
6
7 cleanoutput () {
7 cleanoutput () {
8 sed -e 's/\(Rebase status stored to\).*/\1/' \
8 sed -e 's/\(Rebase status stored to\).*/\1/' \
9 -e 's/\(Rebase status restored from\).*/\1/' \
9 -e 's/\(Rebase status restored from\).*/\1/' \
10 -e 's/\(saving bundle to \).*/\1/'
10 -e 's/\(saving bundle to \).*/\1/'
11 }
11 }
12
12
13 echo % initialize repository
13 echo % initialize repository
14 hg init
14 hg init
15
15
16 echo 'a' > a
16 echo 'a' > a
17 hg ci -A -d '0 0' -u test -m "0"
17 hg ci -A -u test -m "0"
18
18
19 echo 'b' > b
19 echo 'b' > b
20 hg ci -A -d '0 0' -u test -m "1"
20 hg ci -A -u test -m "1"
21
21
22 hg up 0
22 hg up 0
23 echo 'c' > c
23 echo 'c' > c
24 hg ci -A -d '0 0' -u test -m "2"
24 hg ci -A -u test -m "2"
25
25
26 echo 'd' > d
26 echo 'd' > d
27 hg ci -A -d '0 0' -u test -m "3"
27 hg ci -A -u test -m "3"
28
28
29 hg bookmark -r 1 one
29 hg bookmark -r 1 one
30 hg bookmark -r 3 two
30 hg bookmark -r 3 two
31
31
32 echo % bookmark list
32 echo % bookmark list
33 hg bookmark
33 hg bookmark
34
34
35 echo % rebase
35 echo % rebase
36 hg rebase -s two -d one 2>&1 | cleanoutput
36 hg rebase -s two -d one 2>&1 | cleanoutput
37
37
38 hg log No newline at end of file
38 hg log
@@ -1,149 +1,149 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cp "$TESTDIR"/printenv.py .
3 cp "$TESTDIR"/printenv.py .
4
4
5 echo "====== Setting up test"
5 echo "====== Setting up test"
6 hg init test
6 hg init test
7 cd test
7 cd test
8 echo 0 > afile
8 echo 0 > afile
9 hg add afile
9 hg add afile
10 hg commit -m "0.0" -d "1000000 0"
10 hg commit -m "0.0" -d "1000000 0"
11 echo 1 >> afile
11 echo 1 >> afile
12 hg commit -m "0.1" -d "1000000 0"
12 hg commit -m "0.1" -d "1000000 0"
13 echo 2 >> afile
13 echo 2 >> afile
14 hg commit -m "0.2" -d "1000000 0"
14 hg commit -m "0.2" -d "1000000 0"
15 echo 3 >> afile
15 echo 3 >> afile
16 hg commit -m "0.3" -d "1000000 0"
16 hg commit -m "0.3" -d "1000000 0"
17 hg update -C 0
17 hg update -C 0
18 echo 1 >> afile
18 echo 1 >> afile
19 hg commit -m "1.1" -d "1000000 0"
19 hg commit -m "1.1" -d "1000000 0"
20 echo 2 >> afile
20 echo 2 >> afile
21 hg commit -m "1.2" -d "1000000 0"
21 hg commit -m "1.2" -d "1000000 0"
22 echo "a line" > fred
22 echo "a line" > fred
23 echo 3 >> afile
23 echo 3 >> afile
24 hg add fred
24 hg add fred
25 hg commit -m "1.3" -d "1000000 0"
25 hg commit -m "1.3" -d "1000000 0"
26 hg mv afile adifferentfile
26 hg mv afile adifferentfile
27 hg commit -m "1.3m" -d "1000000 0"
27 hg commit -m "1.3m" -d "1000000 0"
28 hg update -C 3
28 hg update -C 3
29 hg mv afile anotherfile
29 hg mv afile anotherfile
30 hg commit -m "0.3m" -d "1000000 0"
30 hg commit -m "0.3m" -d "1000000 0"
31 hg verify
31 hg verify
32 cd ..
32 cd ..
33 hg init empty
33 hg init empty
34
34
35 echo "====== Bundle --all"
35 echo "====== Bundle --all"
36 hg -R test bundle --all all.hg
36 hg -R test bundle --all all.hg
37
37
38 echo "====== Bundle test to full.hg"
38 echo "====== Bundle test to full.hg"
39 hg -R test bundle full.hg empty
39 hg -R test bundle full.hg empty
40 echo "====== Unbundle full.hg in test"
40 echo "====== Unbundle full.hg in test"
41 hg -R test unbundle full.hg
41 hg -R test unbundle full.hg
42 echo "====== Verify empty"
42 echo "====== Verify empty"
43 hg -R empty heads
43 hg -R empty heads
44 hg -R empty verify
44 hg -R empty verify
45
45
46 echo "====== Pull full.hg into test (using --cwd)"
46 echo "====== Pull full.hg into test (using --cwd)"
47 hg --cwd test pull ../full.hg
47 hg --cwd test pull ../full.hg
48 echo "====== Pull full.hg into empty (using --cwd)"
48 echo "====== Pull full.hg into empty (using --cwd)"
49 hg --cwd empty pull ../full.hg
49 hg --cwd empty pull ../full.hg
50 echo "====== Rollback empty"
50 echo "====== Rollback empty"
51 hg -R empty rollback
51 hg -R empty rollback
52 echo "====== Pull full.hg into empty again (using --cwd)"
52 echo "====== Pull full.hg into empty again (using --cwd)"
53 hg --cwd empty pull ../full.hg
53 hg --cwd empty pull ../full.hg
54
54
55 echo "====== Pull full.hg into test (using -R)"
55 echo "====== Pull full.hg into test (using -R)"
56 hg -R test pull full.hg
56 hg -R test pull full.hg
57 echo "====== Pull full.hg into empty (using -R)"
57 echo "====== Pull full.hg into empty (using -R)"
58 hg -R empty pull full.hg
58 hg -R empty pull full.hg
59 echo "====== Rollback empty"
59 echo "====== Rollback empty"
60 hg -R empty rollback
60 hg -R empty rollback
61 echo "====== Pull full.hg into empty again (using -R)"
61 echo "====== Pull full.hg into empty again (using -R)"
62 hg -R empty pull full.hg
62 hg -R empty pull full.hg
63
63
64 echo "====== Log -R full.hg in fresh empty"
64 echo "====== Log -R full.hg in fresh empty"
65 rm -r empty
65 rm -r empty
66 hg init empty
66 hg init empty
67 cd empty
67 cd empty
68 hg -R bundle://../full.hg log
68 hg -R bundle://../full.hg log
69
69
70 echo "====== Pull ../full.hg into empty (with hook)"
70 echo "====== Pull ../full.hg into empty (with hook)"
71 echo '[hooks]' >> .hg/hgrc
71 echo '[hooks]' >> .hg/hgrc
72 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
72 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
73 #doesn't work (yet ?)
73 #doesn't work (yet ?)
74 #hg -R bundle://../full.hg verify
74 #hg -R bundle://../full.hg verify
75 hg pull bundle://../full.hg
75 hg pull bundle://../full.hg
76 echo "====== Rollback empty"
76 echo "====== Rollback empty"
77 hg rollback
77 hg rollback
78 cd ..
78 cd ..
79 echo "====== Log -R bundle:empty+full.hg"
79 echo "====== Log -R bundle:empty+full.hg"
80 hg -R bundle:empty+full.hg log --template="{rev} "
80 hg -R bundle:empty+full.hg log --template="{rev} "
81 echo ""
81 echo ""
82 echo "====== Pull full.hg into empty again (using -R; with hook)"
82 echo "====== Pull full.hg into empty again (using -R; with hook)"
83 hg -R empty pull full.hg
83 hg -R empty pull full.hg
84
84
85 echo "====== Create partial clones"
85 echo "====== Create partial clones"
86 rm -r empty
86 rm -r empty
87 hg init empty
87 hg init empty
88 hg clone -r 3 test partial
88 hg clone -r 3 test partial
89 hg clone partial partial2
89 hg clone partial partial2
90 cd partial
90 cd partial
91 echo "====== Log -R full.hg in partial"
91 echo "====== Log -R full.hg in partial"
92 hg -R bundle://../full.hg log
92 hg -R bundle://../full.hg log
93 echo "====== Incoming full.hg in partial"
93 echo "====== Incoming full.hg in partial"
94 hg incoming bundle://../full.hg
94 hg incoming bundle://../full.hg
95 echo "====== Outgoing -R full.hg vs partial2 in partial"
95 echo "====== Outgoing -R full.hg vs partial2 in partial"
96 hg -R bundle://../full.hg outgoing ../partial2
96 hg -R bundle://../full.hg outgoing ../partial2
97 echo "====== Outgoing -R does-not-exist.hg vs partial2 in partial"
97 echo "====== Outgoing -R does-not-exist.hg vs partial2 in partial"
98 hg -R bundle://../does-not-exist.hg outgoing ../partial2
98 hg -R bundle://../does-not-exist.hg outgoing ../partial2
99 cd ..
99 cd ..
100
100
101 echo "====== Direct clone from bundle (all-history)"
101 echo "====== Direct clone from bundle (all-history)"
102 hg clone full.hg full-clone
102 hg clone full.hg full-clone
103 hg -R full-clone heads
103 hg -R full-clone heads
104 rm -r full-clone
104 rm -r full-clone
105
105
106 # test for http://www.selenic.com/mercurial/bts/issue216
106 # test for http://www.selenic.com/mercurial/bts/issue216
107 echo "====== Unbundle incremental bundles into fresh empty in one go"
107 echo "====== Unbundle incremental bundles into fresh empty in one go"
108 rm -r empty
108 rm -r empty
109 hg init empty
109 hg init empty
110 hg -R test bundle --base null -r 0 ../0.hg
110 hg -R test bundle --base null -r 0 ../0.hg
111 hg -R test bundle --base 0 -r 1 ../1.hg
111 hg -R test bundle --base 0 -r 1 ../1.hg
112 hg -R empty unbundle -u ../0.hg ../1.hg
112 hg -R empty unbundle -u ../0.hg ../1.hg
113
113
114 # test for 540d1059c802
114 # test for 540d1059c802
115 echo "====== test for 540d1059c802"
115 echo "====== test for 540d1059c802"
116 hg init orig
116 hg init orig
117 cd orig
117 cd orig
118 echo foo > foo
118 echo foo > foo
119 hg add foo
119 hg add foo
120 hg ci -m 'add foo' -d '0 0'
120 hg ci -m 'add foo'
121
121
122 hg clone . ../copy
122 hg clone . ../copy
123 hg tag -d '0 0' foo
123 hg tag foo
124
124
125 cd ../copy
125 cd ../copy
126 echo >> foo
126 echo >> foo
127 hg ci -m 'change foo' -d '0 0'
127 hg ci -m 'change foo'
128 hg bundle ../bundle.hg ../orig
128 hg bundle ../bundle.hg ../orig
129
129
130 cd ../orig
130 cd ../orig
131 hg incoming ../bundle.hg
131 hg incoming ../bundle.hg
132 cd ..
132 cd ..
133
133
134 # test for http://www.selenic.com/mercurial/bts/issue1144
134 # test for http://www.selenic.com/mercurial/bts/issue1144
135 echo "===== test that verify bundle does not traceback"
135 echo "===== test that verify bundle does not traceback"
136 # partial history bundle, fails w/ unkown parent
136 # partial history bundle, fails w/ unkown parent
137 hg -R bundle.hg verify
137 hg -R bundle.hg verify
138 # full history bundle, refuses to verify non-local repo
138 # full history bundle, refuses to verify non-local repo
139 hg -R all.hg verify
139 hg -R all.hg verify
140 # but, regular verify must continue to work
140 # but, regular verify must continue to work
141 hg -R orig verify
141 hg -R orig verify
142
142
143 echo "====== diff against bundle"
143 echo "====== diff against bundle"
144 hg init b
144 hg init b
145 cd b
145 cd b
146 hg -R ../all.hg diff -r tip
146 hg -R ../all.hg diff -r tip
147 cd ..
147 cd ..
148
148
149
149
@@ -1,32 +1,32 b''
1 #!/bin/sh
1 #!/bin/sh
2 # b51a8138292a introduced a regression where we would mention in the
2 # b51a8138292a introduced a regression where we would mention in the
3 # changelog executable files added by the second parent of a merge.
3 # changelog executable files added by the second parent of a merge.
4 # Test that that doesn't happen anymore
4 # Test that that doesn't happen anymore
5
5
6 "$TESTDIR/hghave" execbit || exit 80
6 "$TESTDIR/hghave" execbit || exit 80
7
7
8 hg init repo
8 hg init repo
9 cd repo
9 cd repo
10 echo foo > foo
10 echo foo > foo
11 hg ci -qAm 'add foo' -d '0 0'
11 hg ci -qAm 'add foo'
12
12
13 echo bar > bar
13 echo bar > bar
14 chmod +x bar
14 chmod +x bar
15 hg ci -qAm 'add bar' -d '0 0'
15 hg ci -qAm 'add bar'
16 echo '% manifest of p2:'
16 echo '% manifest of p2:'
17 hg manifest
17 hg manifest
18 echo
18 echo
19
19
20 hg up -qC 0
20 hg up -qC 0
21 echo >> foo
21 echo >> foo
22 hg ci -m 'change foo' -d '0 0'
22 hg ci -m 'change foo'
23 echo '% manifest of p1:'
23 echo '% manifest of p1:'
24 hg manifest
24 hg manifest
25
25
26 hg merge
26 hg merge
27 hg ci -m 'merge' -d '0 0'
27 hg ci -m 'merge'
28
28
29 echo '% this should not mention bar:'
29 echo '% this should not mention bar:'
30 hg tip -v
30 hg tip -v
31
31
32 hg debugindex .hg/store/data/bar.i
32 hg debugindex .hg/store/data/bar.i
@@ -1,70 +1,70 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo
3 echo
4 echo % prepare repo a
4 echo % prepare repo a
5 mkdir a
5 mkdir a
6 cd a
6 cd a
7 hg init
7 hg init
8 echo a > a
8 echo a > a
9 hg add a
9 hg add a
10 hg commit -m test -d '0 0'
10 hg commit -m test
11 echo first line > b
11 echo first line > b
12 hg add b
12 hg add b
13 # create a non-inlined filelog
13 # create a non-inlined filelog
14 python -c 'for x in range(10000): print x' >> data1
14 python -c 'for x in range(10000): print x' >> data1
15 for j in 0 1 2 3 4 5 6 7 8 9; do
15 for j in 0 1 2 3 4 5 6 7 8 9; do
16 cat data1 >> b
16 cat data1 >> b
17 hg commit -m test -d '0 0'
17 hg commit -m test
18 done
18 done
19 echo % "list files in store/data (should show a 'b.d')"
19 echo % "list files in store/data (should show a 'b.d')"
20 for i in .hg/store/data/*; do
20 for i in .hg/store/data/*; do
21 echo $i
21 echo $i
22 done
22 done
23
23
24 echo
24 echo
25 echo % default operation
25 echo % default operation
26 hg clone . ../b
26 hg clone . ../b
27 cd ../b
27 cd ../b
28 cat a
28 cat a
29 hg verify
29 hg verify
30
30
31 echo
31 echo
32 echo % no update
32 echo % no update
33 hg clone -U . ../c
33 hg clone -U . ../c
34 cd ../c
34 cd ../c
35 cat a 2>/dev/null || echo "a not present"
35 cat a 2>/dev/null || echo "a not present"
36 hg verify
36 hg verify
37
37
38 echo
38 echo
39 echo % default destination
39 echo % default destination
40 mkdir ../d
40 mkdir ../d
41 cd ../d
41 cd ../d
42 hg clone ../a
42 hg clone ../a
43 cd a
43 cd a
44 hg cat a
44 hg cat a
45
45
46 echo
46 echo
47 echo % "check that we drop the file:// from the path before"
47 echo % "check that we drop the file:// from the path before"
48 echo % "writing the .hgrc"
48 echo % "writing the .hgrc"
49 cd ../..
49 cd ../..
50 hg clone file://a e
50 hg clone file://a e
51 grep 'file:' e/.hg/hgrc
51 grep 'file:' e/.hg/hgrc
52
52
53 echo
53 echo
54 echo % check that path aliases are expanded
54 echo % check that path aliases are expanded
55 hg clone -q -U --config 'paths.foobar=a#0' foobar f
55 hg clone -q -U --config 'paths.foobar=a#0' foobar f
56 hg -R f showconfig paths.default | sed -e 's,.*/,,'
56 hg -R f showconfig paths.default | sed -e 's,.*/,,'
57
57
58 echo
58 echo
59 echo % use --pull
59 echo % use --pull
60 hg clone --pull a g
60 hg clone --pull a g
61 hg -R g verify
61 hg -R g verify
62
62
63 echo
63 echo
64 echo % clone to '.'
64 echo % clone to '.'
65 mkdir h
65 mkdir h
66 cd h
66 cd h
67 hg clone ../a .
67 hg clone ../a .
68 cd ..
68 cd ..
69
69
70 exit 0
70 exit 0
@@ -1,65 +1,65 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # No local source
3 # No local source
4 hg clone a b
4 hg clone a b
5 echo $?
5 echo $?
6
6
7 # No remote source
7 # No remote source
8 hg clone http://127.0.0.1:3121/a b
8 hg clone http://127.0.0.1:3121/a b
9 echo $?
9 echo $?
10 rm -rf b # work around bug with http clone
10 rm -rf b # work around bug with http clone
11
11
12 # Inaccessible source
12 # Inaccessible source
13 mkdir a
13 mkdir a
14 chmod 000 a
14 chmod 000 a
15 hg clone a b
15 hg clone a b
16 echo $?
16 echo $?
17
17
18 # Inaccessible destination
18 # Inaccessible destination
19 mkdir b
19 mkdir b
20 cd b
20 cd b
21 hg init
21 hg init
22 hg clone . ../a
22 hg clone . ../a
23 echo $?
23 echo $?
24 cd ..
24 cd ..
25 chmod 700 a
25 chmod 700 a
26 rm -r a b
26 rm -r a b
27
27
28 # Source of wrong type
28 # Source of wrong type
29 if "$TESTDIR/hghave" -q fifo; then
29 if "$TESTDIR/hghave" -q fifo; then
30 mkfifo a
30 mkfifo a
31 hg clone a b
31 hg clone a b
32 echo $?
32 echo $?
33 rm a
33 rm a
34 else
34 else
35 echo "abort: repository a not found!"
35 echo "abort: repository a not found!"
36 echo 255
36 echo 255
37 fi
37 fi
38
38
39 # Default destination, same directory
39 # Default destination, same directory
40 mkdir q
40 mkdir q
41 cd q
41 cd q
42 hg init
42 hg init
43 cd ..
43 cd ..
44 hg clone q
44 hg clone q
45
45
46 # destination directory not empty
46 # destination directory not empty
47 mkdir a
47 mkdir a
48 echo stuff > a/a
48 echo stuff > a/a
49 hg clone q a
49 hg clone q a
50 echo $?
50 echo $?
51
51
52 # leave existing directory in place after clone failure
52 # leave existing directory in place after clone failure
53 hg init c
53 hg init c
54 cd c
54 cd c
55 echo c > c
55 echo c > c
56 hg commit -A -m test -d '0 0'
56 hg commit -A -m test
57 chmod -rx .hg/store/data
57 chmod -rx .hg/store/data
58 cd ..
58 cd ..
59 mkdir d
59 mkdir d
60 hg clone c d 2> err
60 hg clone c d 2> err
61 echo $?
61 echo $?
62 test -d d && echo "dir is still here" || echo "dir is gone"
62 test -d d && echo "dir is still here" || echo "dir is gone"
63 test -d d/.hg && echo "repo is still here" || echo "repo is gone"
63 test -d d/.hg && echo "repo is still here" || echo "repo is gone"
64
64
65 true
65 true
@@ -1,126 +1,126 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo % commit date test
3 echo % commit date test
4 hg init test
4 hg init test
5 cd test
5 cd test
6 echo foo > foo
6 echo foo > foo
7 hg add foo
7 hg add foo
8 HGEDITOR=true hg commit -m ""
8 HGEDITOR=true hg commit -m ""
9 hg commit -d '0 0' -m commit-1
9 hg commit -d '0 0' -m commit-1
10 echo foo >> foo
10 echo foo >> foo
11 hg commit -d '1 4444444' -m commit-3
11 hg commit -d '1 4444444' -m commit-3
12 hg commit -d '1 15.1' -m commit-4
12 hg commit -d '1 15.1' -m commit-4
13 hg commit -d 'foo bar' -m commit-5
13 hg commit -d 'foo bar' -m commit-5
14 hg commit -d ' 1 4444' -m commit-6
14 hg commit -d ' 1 4444' -m commit-6
15 hg commit -d '111111111111 0' -m commit-7
15 hg commit -d '111111111111 0' -m commit-7
16
16
17 echo % commit added file that has been deleted
17 echo % commit added file that has been deleted
18 echo bar > bar
18 echo bar > bar
19 hg add bar
19 hg add bar
20 rm bar
20 rm bar
21 hg commit -d "1000000 0" -m commit-8
21 hg commit -d "1000000 0" -m commit-8
22 hg commit -d "1000000 0" -m commit-8-2 bar
22 hg commit -d "1000000 0" -m commit-8-2 bar
23
23
24 hg -q revert -a --no-backup
24 hg -q revert -a --no-backup
25
25
26 mkdir dir
26 mkdir dir
27 echo boo > dir/file
27 echo boo > dir/file
28 hg add
28 hg add
29 hg -v commit -d '0 0' -m commit-9 dir
29 hg -v commit -m commit-9 dir
30
30
31 echo > dir.file
31 echo > dir.file
32 hg add
32 hg add
33 hg commit -d '0 0' -m commit-10 dir dir.file
33 hg commit -m commit-10 dir dir.file
34
34
35 echo >> dir/file
35 echo >> dir/file
36 mkdir bleh
36 mkdir bleh
37 mkdir dir2
37 mkdir dir2
38 cd bleh
38 cd bleh
39 hg commit -d '0 0' -m commit-11 .
39 hg commit -m commit-11 .
40 hg commit -d '0 0' -m commit-12 ../dir ../dir2
40 hg commit -m commit-12 ../dir ../dir2
41 hg -v commit -d '0 0' -m commit-13 ../dir
41 hg -v commit -m commit-13 ../dir
42 cd ..
42 cd ..
43
43
44 hg commit -d '0 0' -m commit-14 does-not-exist
44 hg commit -m commit-14 does-not-exist
45 ln -s foo baz
45 ln -s foo baz
46 hg commit -d '0 0' -m commit-15 baz
46 hg commit -m commit-15 baz
47 touch quux
47 touch quux
48 hg commit -d '0 0' -m commit-16 quux
48 hg commit -m commit-16 quux
49 echo >> dir/file
49 echo >> dir/file
50 hg -v commit -d '0 0' -m commit-17 dir/file
50 hg -v commit -m commit-17 dir/file
51 # An empty date was interpreted as epoch origin
51 # An empty date was interpreted as epoch origin
52 echo foo >> foo
52 echo foo >> foo
53 hg commit -d '' -m commit-no-date
53 hg commit -d '' -m commit-no-date
54 hg tip --template '{date|isodate}\n' | grep '1970'
54 hg tip --template '{date|isodate}\n' | grep '1970'
55 cd ..
55 cd ..
56
56
57 echo % partial subdir commit test
57 echo % partial subdir commit test
58 hg init test2
58 hg init test2
59 cd test2
59 cd test2
60 mkdir foo
60 mkdir foo
61 echo foo > foo/foo
61 echo foo > foo/foo
62 mkdir bar
62 mkdir bar
63 echo bar > bar/bar
63 echo bar > bar/bar
64 hg add
64 hg add
65 hg ci -d '1000000 0' -u test -m commit-subdir-1 foo
65 hg ci -d '1000000 0' -u test -m commit-subdir-1 foo
66 hg ci -d '1000001 0' -u test -m commit-subdir-2 bar
66 hg ci -d '1000001 0' -u test -m commit-subdir-2 bar
67 echo % subdir log 1
67 echo % subdir log 1
68 hg log -v foo
68 hg log -v foo
69 echo % subdir log 2
69 echo % subdir log 2
70 hg log -v bar
70 hg log -v bar
71 echo % full log
71 echo % full log
72 hg log -v
72 hg log -v
73 cd ..
73 cd ..
74
74
75 echo % dot and subdir commit test
75 echo % dot and subdir commit test
76 hg init test3
76 hg init test3
77 cd test3
77 cd test3
78 mkdir foo
78 mkdir foo
79 echo foo content > foo/plain-file
79 echo foo content > foo/plain-file
80 hg add foo/plain-file
80 hg add foo/plain-file
81 hg ci -d '1000000 0' -u test -m commit-foo-subdir foo
81 hg ci -d '1000000 0' -u test -m commit-foo-subdir foo
82 echo modified foo content > foo/plain-file
82 echo modified foo content > foo/plain-file
83 hg ci -d '2000000 0' -u test -m commit-foo-dot .
83 hg ci -d '2000000 0' -u test -m commit-foo-dot .
84 echo % full log
84 echo % full log
85 hg log -v
85 hg log -v
86 echo % subdir log
86 echo % subdir log
87 cd foo
87 cd foo
88 hg log .
88 hg log .
89 cd ..
89 cd ..
90 cd ..
90 cd ..
91
91
92 cd ..
92 cd ..
93 hg init issue1049
93 hg init issue1049
94 cd issue1049
94 cd issue1049
95 echo a > a
95 echo a > a
96 hg ci -Ama
96 hg ci -Ama
97 echo a >> a
97 echo a >> a
98 hg ci -mb
98 hg ci -mb
99 hg up 0
99 hg up 0
100 echo b >> a
100 echo b >> a
101 hg ci -mc
101 hg ci -mc
102 HGMERGE=true hg merge
102 HGMERGE=true hg merge
103 echo % should fail because we are specifying a file name
103 echo % should fail because we are specifying a file name
104 hg ci -mmerge a
104 hg ci -mmerge a
105 echo % should fail because we are specifying a pattern
105 echo % should fail because we are specifying a pattern
106 hg ci -mmerge -I a
106 hg ci -mmerge -I a
107 echo % should succeed
107 echo % should succeed
108 hg ci -mmerge
108 hg ci -mmerge
109 cd ..
109 cd ..
110
110
111
111
112 echo % test commit message content
112 echo % test commit message content
113 hg init commitmsg
113 hg init commitmsg
114 cd commitmsg
114 cd commitmsg
115 echo changed > changed
115 echo changed > changed
116 echo removed > removed
116 echo removed > removed
117 hg ci -qAm init
117 hg ci -qAm init
118
118
119 hg rm removed
119 hg rm removed
120 echo changed >> changed
120 echo changed >> changed
121 echo added > added
121 echo added > added
122 hg add added
122 hg add added
123 HGEDITOR=cat hg ci -A
123 HGEDITOR=cat hg ci -A
124 cd ..
124 cd ..
125
125
126 exit 0
126 exit 0
@@ -1,37 +1,37 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat >> $HGRCPATH <<EOF
3 cat >> $HGRCPATH <<EOF
4 [extensions]
4 [extensions]
5 convert=
5 convert=
6 EOF
6 EOF
7
7
8 # Prepare orig repo
8 # Prepare orig repo
9 hg init orig
9 hg init orig
10 cd orig
10 cd orig
11 echo foo > foo
11 echo foo > foo
12 HGUSER='user name' hg ci -qAm 'foo' -d '0 0'
12 HGUSER='user name' hg ci -qAm 'foo'
13 cd ..
13 cd ..
14
14
15 # Explicit --authors
15 # Explicit --authors
16 cat > authormap.txt <<EOF
16 cat > authormap.txt <<EOF
17 user name = Long User Name
17 user name = Long User Name
18
18
19 # comment
19 # comment
20 this line is ignored
20 this line is ignored
21 EOF
21 EOF
22
22
23 hg convert --authors authormap.txt orig new
23 hg convert --authors authormap.txt orig new
24 echo $?
24 echo $?
25 cat new/.hg/authormap
25 cat new/.hg/authormap
26
26
27 hg -Rnew log
27 hg -Rnew log
28 rm -rf new
28 rm -rf new
29
29
30 # Implicit .hg/authormap
30 # Implicit .hg/authormap
31 hg init new
31 hg init new
32 mv authormap.txt new/.hg/authormap
32 mv authormap.txt new/.hg/authormap
33
33
34 hg convert orig new
34 hg convert orig new
35 echo $?
35 echo $?
36
36
37 hg -Rnew log
37 hg -Rnew log
@@ -1,57 +1,57 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat >> $HGRCPATH <<EOF
3 cat >> $HGRCPATH <<EOF
4 [extensions]
4 [extensions]
5 convert=
5 convert=
6 [convert]
6 [convert]
7 hg.saverev=False
7 hg.saverev=False
8 EOF
8 EOF
9
9
10 hg init orig
10 hg init orig
11 cd orig
11 cd orig
12 echo foo > foo
12 echo foo > foo
13 echo bar > bar
13 echo bar > bar
14 hg ci -qAm 'add foo and bar' -d '0 0'
14 hg ci -qAm 'add foo and bar'
15
15
16 hg rm foo
16 hg rm foo
17 hg ci -m 'remove foo' -d '0 0'
17 hg ci -m 'remove foo'
18
18
19 mkdir foo
19 mkdir foo
20 echo file > foo/file
20 echo file > foo/file
21 hg ci -qAm 'add foo/file' -d '0 0'
21 hg ci -qAm 'add foo/file'
22
22
23 hg tag -d '0 0' some-tag
23 hg tag some-tag
24
24
25 hg log
25 hg log
26 cd ..
26 cd ..
27
27
28 hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
28 hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
29 cd new
29 cd new
30 hg out ../orig
30 hg out ../orig
31
31
32 echo '% dirstate should be empty:'
32 echo '% dirstate should be empty:'
33 hg debugstate
33 hg debugstate
34 hg parents -q
34 hg parents -q
35
35
36 hg up -C
36 hg up -C
37 hg copy bar baz
37 hg copy bar baz
38 echo '% put something in the dirstate:'
38 echo '% put something in the dirstate:'
39 hg debugstate > debugstate
39 hg debugstate > debugstate
40 grep baz debugstate
40 grep baz debugstate
41
41
42 echo '% add a new revision in the original repo'
42 echo '% add a new revision in the original repo'
43 cd ../orig
43 cd ../orig
44 echo baz > baz
44 echo baz > baz
45 hg ci -qAm 'add baz'
45 hg ci -qAm 'add baz'
46
46
47 cd ..
47 cd ..
48 hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
48 hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
49 cd new
49 cd new
50 hg out ../orig
50 hg out ../orig
51 echo '% dirstate should be the same (no output below):'
51 echo '% dirstate should be the same (no output below):'
52 hg debugstate > new-debugstate
52 hg debugstate > new-debugstate
53 diff debugstate new-debugstate
53 diff debugstate new-debugstate
54
54
55 echo '% no copies'
55 echo '% no copies'
56 hg up -C
56 hg up -C
57 hg debugrename baz
57 hg debugrename baz
@@ -1,70 +1,70 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init
3 hg init
4 echo foo > foo
4 echo foo > foo
5 echo "# should fail - foo is not managed"
5 echo "# should fail - foo is not managed"
6 hg mv foo bar
6 hg mv foo bar
7 hg st -A
7 hg st -A
8 hg add foo
8 hg add foo
9 echo "# dry-run; print a warning that this is not a real copy; foo is added"
9 echo "# dry-run; print a warning that this is not a real copy; foo is added"
10 hg mv --dry-run foo bar
10 hg mv --dry-run foo bar
11 hg st -A
11 hg st -A
12 echo "# should print a warning that this is not a real copy; bar is added"
12 echo "# should print a warning that this is not a real copy; bar is added"
13 hg mv foo bar
13 hg mv foo bar
14 hg st -A
14 hg st -A
15 echo "# should print a warning that this is not a real copy; foo is added"
15 echo "# should print a warning that this is not a real copy; foo is added"
16 hg cp bar foo
16 hg cp bar foo
17 hg rm -f bar
17 hg rm -f bar
18 rm bar
18 rm bar
19 hg st -A
19 hg st -A
20 hg commit -m1 -d"0 0"
20 hg commit -m1
21
21
22 echo "# dry-run; should show that foo is clean"
22 echo "# dry-run; should show that foo is clean"
23 hg copy --dry-run foo bar
23 hg copy --dry-run foo bar
24 hg st -A
24 hg st -A
25 echo "# should show copy"
25 echo "# should show copy"
26 hg copy foo bar
26 hg copy foo bar
27 hg st -C
27 hg st -C
28
28
29 echo "# shouldn't show copy"
29 echo "# shouldn't show copy"
30 hg commit -m2 -d"0 0"
30 hg commit -m2
31 hg st -C
31 hg st -C
32
32
33 echo "# should match"
33 echo "# should match"
34 hg debugindex .hg/store/data/foo.i
34 hg debugindex .hg/store/data/foo.i
35 hg debugrename bar
35 hg debugrename bar
36
36
37 echo bleah > foo
37 echo bleah > foo
38 echo quux > bar
38 echo quux > bar
39 hg commit -m3 -d"0 0"
39 hg commit -m3
40
40
41 echo "# should not be renamed"
41 echo "# should not be renamed"
42 hg debugrename bar
42 hg debugrename bar
43
43
44 hg copy -f foo bar
44 hg copy -f foo bar
45 echo "# should show copy"
45 echo "# should show copy"
46 hg st -C
46 hg st -C
47 hg commit -m3 -d"0 0"
47 hg commit -m3
48
48
49 echo "# should show no parents for tip"
49 echo "# should show no parents for tip"
50 hg debugindex .hg/store/data/bar.i
50 hg debugindex .hg/store/data/bar.i
51 echo "# should match"
51 echo "# should match"
52 hg debugindex .hg/store/data/foo.i
52 hg debugindex .hg/store/data/foo.i
53 hg debugrename bar
53 hg debugrename bar
54
54
55 echo "# should show no copies"
55 echo "# should show no copies"
56 hg st -C
56 hg st -C
57
57
58 echo "# copy --after on an added file"
58 echo "# copy --after on an added file"
59 cp bar baz
59 cp bar baz
60 hg add baz
60 hg add baz
61 hg cp -A bar baz
61 hg cp -A bar baz
62 hg st -C
62 hg st -C
63
63
64 echo "# foo was clean:"
64 echo "# foo was clean:"
65 hg st -AC foo
65 hg st -AC foo
66 echo "# but it's considered modified after a copy --after --force"
66 echo "# but it's considered modified after a copy --after --force"
67 hg copy -Af bar foo
67 hg copy -Af bar foo
68 hg st -AC foo
68 hg st -AC foo
69
69
70 exit 0
70 exit 0
@@ -1,25 +1,25 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init a
3 hg init a
4 cd a
4 cd a
5 cp $TESTDIR/binfile.bin .
5 cp $TESTDIR/binfile.bin .
6 hg add binfile.bin
6 hg add binfile.bin
7 hg ci -m 'add binfile.bin' -d '0 0'
7 hg ci -m 'add binfile.bin'
8
8
9 echo >> binfile.bin
9 echo >> binfile.bin
10 hg ci -m 'change binfile.bin' -d '0 0'
10 hg ci -m 'change binfile.bin'
11
11
12 hg revert -r 0 binfile.bin
12 hg revert -r 0 binfile.bin
13 hg ci -m 'revert binfile.bin' -d '0 0'
13 hg ci -m 'revert binfile.bin'
14
14
15 echo % diff -r 0 -r 1
15 echo % diff -r 0 -r 1
16 hg diff --nodates -r 0 -r 1
16 hg diff --nodates -r 0 -r 1
17
17
18 echo % diff -r 0 -r 2
18 echo % diff -r 0 -r 2
19 hg diff --nodates -r 0 -r 2
19 hg diff --nodates -r 0 -r 2
20
20
21 echo % diff --git -r 0 -r 1
21 echo % diff --git -r 0 -r 1
22 hg diff --git -r 0 -r 1
22 hg diff --git -r 0 -r 1
23
23
24 echo % diff --git -r 0 -r 2
24 echo % diff --git -r 0 -r 2
25 hg diff --git -r 0 -r 2
25 hg diff --git -r 0 -r 2
@@ -1,121 +1,121 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # GNU diff is the reference for all of these results.
3 # GNU diff is the reference for all of these results.
4
4
5 hgdiff() {
5 hgdiff() {
6 echo hg diff $@
6 echo hg diff $@
7 hg diff --nodates "$@"
7 hg diff --nodates "$@"
8 }
8 }
9
9
10 test_added_blank_lines() {
10 test_added_blank_lines() {
11 printf '\nhello world\n\ngoodbye world\n\n' >foo
11 printf '\nhello world\n\ngoodbye world\n\n' >foo
12
12
13 echo '>>> two diffs showing three added lines <<<'
13 echo '>>> two diffs showing three added lines <<<'
14 hgdiff
14 hgdiff
15 hgdiff -b
15 hgdiff -b
16
16
17 echo '>>> no diffs <<<'
17 echo '>>> no diffs <<<'
18 hgdiff -B
18 hgdiff -B
19 hgdiff -Bb
19 hgdiff -Bb
20 }
20 }
21
21
22 test_added_horizontal_space_first_on_a_line() {
22 test_added_horizontal_space_first_on_a_line() {
23 printf '\t hello world\ngoodbye world\n' >foo
23 printf '\t hello world\ngoodbye world\n' >foo
24
24
25 echo '>>> four diffs showing added space first on the first line <<<'
25 echo '>>> four diffs showing added space first on the first line <<<'
26 hgdiff
26 hgdiff
27 hgdiff -b
27 hgdiff -b
28 hgdiff -B
28 hgdiff -B
29 hgdiff -Bb
29 hgdiff -Bb
30 }
30 }
31
31
32 test_added_horizontal_space_last_on_a_line() {
32 test_added_horizontal_space_last_on_a_line() {
33 printf 'hello world\t \ngoodbye world\n' >foo
33 printf 'hello world\t \ngoodbye world\n' >foo
34
34
35 echo '>>> two diffs showing space appended to the first line <<<'
35 echo '>>> two diffs showing space appended to the first line <<<'
36 hgdiff
36 hgdiff
37 hgdiff -B
37 hgdiff -B
38
38
39 echo '>>> no diffs <<<'
39 echo '>>> no diffs <<<'
40 hgdiff -b
40 hgdiff -b
41 hgdiff -Bb
41 hgdiff -Bb
42 }
42 }
43
43
44 test_added_horizontal_space_in_the_middle_of_a_word() {
44 test_added_horizontal_space_in_the_middle_of_a_word() {
45 printf 'hello world\ngood bye world\n' >foo
45 printf 'hello world\ngood bye world\n' >foo
46
46
47 echo '>>> four diffs showing space inserted into "goodbye" <<<'
47 echo '>>> four diffs showing space inserted into "goodbye" <<<'
48 hgdiff
48 hgdiff
49 hgdiff -B
49 hgdiff -B
50 hgdiff -b
50 hgdiff -b
51 hgdiff -Bb
51 hgdiff -Bb
52 }
52 }
53
53
54 test_increased_horizontal_whitespace_amount() {
54 test_increased_horizontal_whitespace_amount() {
55 printf 'hello world\ngoodbye\t\t \tworld\n' >foo
55 printf 'hello world\ngoodbye\t\t \tworld\n' >foo
56
56
57 echo '>>> two diffs showing changed whitespace amount in the last line <<<'
57 echo '>>> two diffs showing changed whitespace amount in the last line <<<'
58 hgdiff
58 hgdiff
59 hgdiff -B
59 hgdiff -B
60
60
61 echo '>>> no diffs <<<'
61 echo '>>> no diffs <<<'
62 hgdiff -b
62 hgdiff -b
63 hgdiff -Bb
63 hgdiff -Bb
64 }
64 }
65
65
66 test_added_blank_line_with_horizontal_whitespace() {
66 test_added_blank_line_with_horizontal_whitespace() {
67 printf 'hello world\n \t\ngoodbye world\n' >foo
67 printf 'hello world\n \t\ngoodbye world\n' >foo
68
68
69 echo '>>> four diffs showing added blank line w/horizontal space <<<'
69 echo '>>> four diffs showing added blank line w/horizontal space <<<'
70 hgdiff
70 hgdiff
71 hgdiff -B
71 hgdiff -B
72 hgdiff -b
72 hgdiff -b
73 hgdiff -Bb
73 hgdiff -Bb
74 }
74 }
75
75
76 test_added_blank_line_with_other_whitespace() {
76 test_added_blank_line_with_other_whitespace() {
77 printf 'hello world\n \t\ngoodbye world \n' >foo
77 printf 'hello world\n \t\ngoodbye world \n' >foo
78
78
79 echo '>>> three diffs showing added blank line w/other space <<<'
79 echo '>>> three diffs showing added blank line w/other space <<<'
80 hgdiff
80 hgdiff
81 hgdiff -B
81 hgdiff -B
82 hgdiff -b
82 hgdiff -b
83 hgdiff -Bb
83 hgdiff -Bb
84 }
84 }
85
85
86 test_whitespace_changes() {
86 test_whitespace_changes() {
87 printf 'helloworld\ngoodbye\tworld \n' >foo
87 printf 'helloworld\ngoodbye\tworld \n' >foo
88
88
89 echo '>>> four diffs showing changed whitespace <<<'
89 echo '>>> four diffs showing changed whitespace <<<'
90 hgdiff
90 hgdiff
91 hgdiff -B
91 hgdiff -B
92 hgdiff -b
92 hgdiff -b
93 hgdiff -Bb
93 hgdiff -Bb
94 hgdiff -w
94 hgdiff -w
95 }
95 }
96
96
97 test_whitespace_changes_and_blank_lines() {
97 test_whitespace_changes_and_blank_lines() {
98 printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo
98 printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo
99
99
100 echo '>>> five diffs showing changed whitespace <<<'
100 echo '>>> five diffs showing changed whitespace <<<'
101 hgdiff
101 hgdiff
102 hgdiff -B
102 hgdiff -B
103 hgdiff -b
103 hgdiff -b
104 hgdiff -Bb
104 hgdiff -Bb
105 hgdiff -w
105 hgdiff -w
106 hgdiff -wB
106 hgdiff -wB
107 }
107 }
108
108
109 hg init
109 hg init
110 printf 'hello world\ngoodbye world\n' >foo
110 printf 'hello world\ngoodbye world\n' >foo
111 hg ci -Amfoo -ufoo -d '0 0'
111 hg ci -Amfoo -ufoo
112
112
113 test_added_blank_lines
113 test_added_blank_lines
114 test_added_horizontal_space_first_on_a_line
114 test_added_horizontal_space_first_on_a_line
115 test_added_horizontal_space_last_on_a_line
115 test_added_horizontal_space_last_on_a_line
116 test_added_horizontal_space_in_the_middle_of_a_word
116 test_added_horizontal_space_in_the_middle_of_a_word
117 test_increased_horizontal_whitespace_amount
117 test_increased_horizontal_whitespace_amount
118 test_added_blank_line_with_horizontal_whitespace
118 test_added_blank_line_with_horizontal_whitespace
119 test_added_blank_line_with_other_whitespace
119 test_added_blank_line_with_other_whitespace
120 test_whitespace_changes
120 test_whitespace_changes
121 test_whitespace_changes_and_blank_lines
121 test_whitespace_changes_and_blank_lines
@@ -1,27 +1,27 b''
1 #!/bin/sh
1 #!/bin/sh
2 # test command parsing and dispatch
2 # test command parsing and dispatch
3
3
4 "$TESTDIR/hghave" no-outer-repo || exit 80
4 "$TESTDIR/hghave" no-outer-repo || exit 80
5
5
6 hg init a
6 hg init a
7 cd a
7 cd a
8 echo a > a
8 echo a > a
9 hg ci -Ama -d '0 0'
9 hg ci -Ama
10
10
11 echo "# missing arg"
11 echo "# missing arg"
12 hg cat
12 hg cat
13
13
14 echo '% [defaults]'
14 echo '% [defaults]'
15 hg cat a
15 hg cat a
16 cat >> $HGRCPATH <<EOF
16 cat >> $HGRCPATH <<EOF
17 [defaults]
17 [defaults]
18 cat = -v
18 cat = -v
19 EOF
19 EOF
20 hg cat a
20 hg cat a
21
21
22 echo '% no repo'
22 echo '% no repo'
23 cd ..
23 cd ..
24 hg cat
24 hg cat
25
25
26 exit 0
26 exit 0
27
27
@@ -1,61 +1,61 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 CONTRIBDIR=$TESTDIR/../contrib
3 CONTRIBDIR=$TESTDIR/../contrib
4
4
5 echo % prepare repo-a
5 echo % prepare repo-a
6 mkdir repo-a
6 mkdir repo-a
7 cd repo-a
7 cd repo-a
8 hg init
8 hg init
9
9
10 echo this is file a > a
10 echo this is file a > a
11 hg add a
11 hg add a
12 hg commit -m first -d '0 0'
12 hg commit -m first
13
13
14 echo adding to file a >> a
14 echo adding to file a >> a
15 hg commit -m second -d '0 0'
15 hg commit -m second
16
16
17 echo adding more to file a >> a
17 echo adding more to file a >> a
18 hg commit -m third -d '0 0'
18 hg commit -m third
19
19
20 hg verify
20 hg verify
21
21
22 echo
22 echo
23 echo % dumping revlog of file a to stdout
23 echo % dumping revlog of file a to stdout
24 python $CONTRIBDIR/dumprevlog .hg/store/data/a.i
24 python $CONTRIBDIR/dumprevlog .hg/store/data/a.i
25 echo % dumprevlog done
25 echo % dumprevlog done
26
26
27 echo
27 echo
28 echo % dump all revlogs to file repo.dump
28 echo % dump all revlogs to file repo.dump
29 find .hg/store -name "*.i" | sort | xargs python $CONTRIBDIR/dumprevlog > ../repo.dump
29 find .hg/store -name "*.i" | sort | xargs python $CONTRIBDIR/dumprevlog > ../repo.dump
30
30
31 cd ..
31 cd ..
32
32
33 mkdir repo-b
33 mkdir repo-b
34 cd repo-b
34 cd repo-b
35 hg init
35 hg init
36
36
37 echo
37 echo
38 echo % undumping into repo-b
38 echo % undumping into repo-b
39 python $CONTRIBDIR/undumprevlog < ../repo.dump
39 python $CONTRIBDIR/undumprevlog < ../repo.dump
40 echo % undumping done
40 echo % undumping done
41
41
42 cd ..
42 cd ..
43
43
44 echo
44 echo
45 echo % clone --pull repo-b repo-c to rebuild fncache
45 echo % clone --pull repo-b repo-c to rebuild fncache
46 hg clone --pull -U repo-b repo-c
46 hg clone --pull -U repo-b repo-c
47
47
48 cd repo-c
48 cd repo-c
49
49
50 echo
50 echo
51 echo % verify repo-c
51 echo % verify repo-c
52 hg verify
52 hg verify
53
53
54 cd ..
54 cd ..
55
55
56 echo
56 echo
57 echo % comparing repos
57 echo % comparing repos
58 hg -R repo-c incoming repo-a
58 hg -R repo-c incoming repo-a
59 hg -R repo-a incoming repo-c
59 hg -R repo-a incoming repo-c
60
60
61 exit 0
61 exit 0
@@ -1,23 +1,23 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init repo
3 hg init repo
4 cd repo
4 cd repo
5 touch foo
5 touch foo
6 hg add foo
6 hg add foo
7 for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
7 for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
8 echo "foo-$i" >> foo
8 echo "foo-$i" >> foo
9 hg ci -m "foo-$i" -d "0 0"
9 hg ci -m "foo-$i"
10 done
10 done
11
11
12 for out in "%nof%N" "%%%H" "%b-%R" "%h" "%r"; do
12 for out in "%nof%N" "%%%H" "%b-%R" "%h" "%r"; do
13 echo "# foo-$out.patch"
13 echo "# foo-$out.patch"
14 hg export -v -o "foo-$out.patch" 2:tip
14 hg export -v -o "foo-$out.patch" 2:tip
15 done
15 done
16
16
17 echo "# exporting 4 changesets to a file"
17 echo "# exporting 4 changesets to a file"
18 hg export -o export_internal 1 2 3 4
18 hg export -o export_internal 1 2 3 4
19 grep HG export_internal | wc -l | sed -e 's/^ *//'
19 grep HG export_internal | wc -l | sed -e 's/^ *//'
20 echo "# exporting 4 changesets to a file"
20 echo "# exporting 4 changesets to a file"
21 hg export 1 2 3 4 | grep HG | wc -l | sed -e 's/^ *//'
21 hg export 1 2 3 4 | grep HG | wc -l | sed -e 's/^ *//'
22 echo "# exporting revision -2 to a file"
22 echo "# exporting revision -2 to a file"
23 hg export -- -2
23 hg export -- -2
@@ -1,51 +1,51 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "% init repo1"
3 echo "% init repo1"
4 hg init repo1
4 hg init repo1
5 cd repo1
5 cd repo1
6
6
7 echo
7 echo
8 echo "% add a; ci"
8 echo "% add a; ci"
9 echo "some text" > a
9 echo "some text" > a
10 hg add
10 hg add
11 hg ci -d '0 0' -m first
11 hg ci -m first
12
12
13 echo
13 echo
14 echo "% cat .hg/store/fncache"
14 echo "% cat .hg/store/fncache"
15 cat .hg/store/fncache
15 cat .hg/store/fncache
16
16
17 echo
17 echo
18 echo "% add a.i/b; ci"
18 echo "% add a.i/b; ci"
19 mkdir a.i
19 mkdir a.i
20 echo "some other text" > a.i/b
20 echo "some other text" > a.i/b
21 hg add
21 hg add
22 hg ci -d '0 0' -m second
22 hg ci -m second
23
23
24 echo
24 echo
25 echo "% cat .hg/store/fncache"
25 echo "% cat .hg/store/fncache"
26 cat .hg/store/fncache
26 cat .hg/store/fncache
27
27
28 echo
28 echo
29 echo "% add a.i.hg/c; ci"
29 echo "% add a.i.hg/c; ci"
30 mkdir a.i.hg
30 mkdir a.i.hg
31 echo "yet another text" > a.i.hg/c
31 echo "yet another text" > a.i.hg/c
32 hg add
32 hg add
33 hg ci -d '0 0' -m third
33 hg ci -m third
34
34
35 echo
35 echo
36 echo "% cat .hg/store/fncache"
36 echo "% cat .hg/store/fncache"
37 cat .hg/store/fncache
37 cat .hg/store/fncache
38
38
39 echo
39 echo
40 echo "% hg verify"
40 echo "% hg verify"
41 hg verify
41 hg verify
42
42
43 echo
43 echo
44 echo "% rm .hg/store/fncache"
44 echo "% rm .hg/store/fncache"
45 rm .hg/store/fncache
45 rm .hg/store/fncache
46
46
47 echo
47 echo
48 echo "% hg verify"
48 echo "% hg verify"
49 hg verify
49 hg verify
50
50
51 exit 0
51 exit 0
@@ -1,158 +1,158 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init a
3 hg init a
4 cd a
4 cd a
5
5
6 echo start > start
6 echo start > start
7 hg ci -Amstart -d '0 0'
7 hg ci -Amstart
8 echo new > new
8 echo new > new
9 hg ci -Amnew -d '0 0'
9 hg ci -Amnew
10 echo '% new file'
10 echo '% new file'
11 hg diff --git -r 0
11 hg diff --git -r 0
12
12
13 hg cp new copy
13 hg cp new copy
14 hg ci -mcopy -d '0 0'
14 hg ci -mcopy
15 echo '% copy'
15 echo '% copy'
16 hg diff --git -r 1:tip
16 hg diff --git -r 1:tip
17
17
18 hg mv copy rename
18 hg mv copy rename
19 hg ci -mrename -d '0 0'
19 hg ci -mrename
20 echo '% rename'
20 echo '% rename'
21 hg diff --git -r 2:tip
21 hg diff --git -r 2:tip
22
22
23 hg rm rename
23 hg rm rename
24 hg ci -mdelete -d '0 0'
24 hg ci -mdelete
25 echo '% delete'
25 echo '% delete'
26 hg diff --git -r 3:tip
26 hg diff --git -r 3:tip
27
27
28 cat > src <<EOF
28 cat > src <<EOF
29 1
29 1
30 2
30 2
31 3
31 3
32 4
32 4
33 5
33 5
34 EOF
34 EOF
35 hg ci -Amsrc -d '0 0'
35 hg ci -Amsrc
36 chmod +x src
36 chmod +x src
37 hg ci -munexec -d '0 0'
37 hg ci -munexec
38 echo '% chmod 644'
38 echo '% chmod 644'
39 hg diff --git -r 5:tip
39 hg diff --git -r 5:tip
40
40
41 hg mv src dst
41 hg mv src dst
42 chmod -x dst
42 chmod -x dst
43 echo a >> dst
43 echo a >> dst
44 hg ci -mrenamemod -d '0 0'
44 hg ci -mrenamemod
45 echo '% rename+mod+chmod'
45 echo '% rename+mod+chmod'
46 hg diff --git -r 6:tip
46 hg diff --git -r 6:tip
47
47
48 echo '% nonexistent in tip+chmod'
48 echo '% nonexistent in tip+chmod'
49 hg diff --git -r 5:6
49 hg diff --git -r 5:6
50
50
51 echo '% binary diff'
51 echo '% binary diff'
52 cp $TESTDIR/binfile.bin .
52 cp $TESTDIR/binfile.bin .
53 hg add binfile.bin
53 hg add binfile.bin
54 hg diff --git > b.diff
54 hg diff --git > b.diff
55 cat b.diff
55 cat b.diff
56
56
57 echo '% import binary diff'
57 echo '% import binary diff'
58 hg revert binfile.bin
58 hg revert binfile.bin
59 rm binfile.bin
59 rm binfile.bin
60 hg import -mfoo b.diff
60 hg import -mfoo b.diff
61 cmp binfile.bin $TESTDIR/binfile.bin
61 cmp binfile.bin $TESTDIR/binfile.bin
62
62
63 echo
63 echo
64 echo '% rename binary file'
64 echo '% rename binary file'
65 hg mv binfile.bin renamed.bin
65 hg mv binfile.bin renamed.bin
66 hg diff --git
66 hg diff --git
67
67
68 echo
68 echo
69 echo '% diff across many revisions'
69 echo '% diff across many revisions'
70 hg mv dst dst2
70 hg mv dst dst2
71 hg ci -m 'mv dst dst2' -d '0 0'
71 hg ci -m 'mv dst dst2'
72
72
73 echo >> start
73 echo >> start
74 hg ci -m 'change start' -d '0 0'
74 hg ci -m 'change start'
75
75
76 hg revert -r -2 start
76 hg revert -r -2 start
77 hg mv dst2 dst3
77 hg mv dst2 dst3
78 hg ci -m 'mv dst2 dst3; revert start' -d '0 0'
78 hg ci -m 'mv dst2 dst3; revert start'
79
79
80 hg diff --git -r 9:11
80 hg diff --git -r 9:11
81 echo '% reversed'
81 echo '% reversed'
82 hg diff --git -r 11:9
82 hg diff --git -r 11:9
83
83
84 echo a >> foo
84 echo a >> foo
85 hg add foo
85 hg add foo
86 hg ci -m 'add foo'
86 hg ci -m 'add foo'
87 echo b >> foo
87 echo b >> foo
88 hg ci -m 'change foo'
88 hg ci -m 'change foo'
89 hg mv foo bar
89 hg mv foo bar
90 hg ci -m 'mv foo bar'
90 hg ci -m 'mv foo bar'
91 echo c >> bar
91 echo c >> bar
92 hg ci -m 'change bar'
92 hg ci -m 'change bar'
93
93
94 echo
94 echo
95 echo '% file created before r1 and renamed before r2'
95 echo '% file created before r1 and renamed before r2'
96 hg diff --git -r -3:-1
96 hg diff --git -r -3:-1
97 echo '% reversed'
97 echo '% reversed'
98 hg diff --git -r -1:-3
98 hg diff --git -r -1:-3
99 echo
99 echo
100 echo '% file created in r1 and renamed before r2'
100 echo '% file created in r1 and renamed before r2'
101 hg diff --git -r -4:-1
101 hg diff --git -r -4:-1
102 echo '% reversed'
102 echo '% reversed'
103 hg diff --git -r -1:-4
103 hg diff --git -r -1:-4
104 echo
104 echo
105 echo '% file created after r1 and renamed before r2'
105 echo '% file created after r1 and renamed before r2'
106 hg diff --git -r -5:-1
106 hg diff --git -r -5:-1
107 echo '% reversed'
107 echo '% reversed'
108 hg diff --git -r -1:-5
108 hg diff --git -r -1:-5
109
109
110 echo
110 echo
111 echo '% comparing with the working dir'
111 echo '% comparing with the working dir'
112 echo >> start
112 echo >> start
113 hg ci -m 'change start again' -d '0 0'
113 hg ci -m 'change start again'
114
114
115 echo > created
115 echo > created
116 hg add created
116 hg add created
117 hg ci -m 'add created'
117 hg ci -m 'add created'
118
118
119 hg mv created created2
119 hg mv created created2
120 hg ci -m 'mv created created2'
120 hg ci -m 'mv created created2'
121
121
122 hg mv created2 created3
122 hg mv created2 created3
123 echo "% there's a copy in the working dir..."
123 echo "% there's a copy in the working dir..."
124 hg diff --git
124 hg diff --git
125 echo
125 echo
126 echo "% ...but there's another copy between the original rev and the wd"
126 echo "% ...but there's another copy between the original rev and the wd"
127 hg diff --git -r -2
127 hg diff --git -r -2
128 echo
128 echo
129 echo "% ...but the source of the copy was created after the original rev"
129 echo "% ...but the source of the copy was created after the original rev"
130 hg diff --git -r -3
130 hg diff --git -r -3
131 hg ci -m 'mv created2 created3'
131 hg ci -m 'mv created2 created3'
132
132
133 echo > brand-new
133 echo > brand-new
134 hg add brand-new
134 hg add brand-new
135 hg ci -m 'add brand-new'
135 hg ci -m 'add brand-new'
136 hg mv brand-new brand-new2
136 hg mv brand-new brand-new2
137 echo '% created in parent of wd; renamed in the wd'
137 echo '% created in parent of wd; renamed in the wd'
138 hg diff --git
138 hg diff --git
139
139
140 echo
140 echo
141 echo '% created between r1 and parent of wd; renamed in the wd'
141 echo '% created between r1 and parent of wd; renamed in the wd'
142 hg diff --git -r -2
142 hg diff --git -r -2
143 hg ci -m 'mv brand-new brand-new2'
143 hg ci -m 'mv brand-new brand-new2'
144
144
145 echo '% one file is copied to many destinations and removed'
145 echo '% one file is copied to many destinations and removed'
146 hg cp brand-new2 brand-new3
146 hg cp brand-new2 brand-new3
147 hg mv brand-new2 brand-new3-2
147 hg mv brand-new2 brand-new3-2
148 hg ci -m 'multiple renames/copies'
148 hg ci -m 'multiple renames/copies'
149 hg diff --git -r -2 -r -1
149 hg diff --git -r -2 -r -1
150 echo '% reversed'
150 echo '% reversed'
151 hg diff --git -r -1 -r -2
151 hg diff --git -r -1 -r -2
152
152
153 echo '% there should be a trailing TAB if there are spaces in the file name'
153 echo '% there should be a trailing TAB if there are spaces in the file name'
154 echo foo > 'with spaces'
154 echo foo > 'with spaces'
155 hg add 'with spaces'
155 hg add 'with spaces'
156 hg diff --git
156 hg diff --git
157 hg ci -m 'add filename with spaces'
157 hg ci -m 'add filename with spaces'
158
158
@@ -1,75 +1,75 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 mkdir t
3 mkdir t
4 cd t
4 cd t
5 hg init
5 hg init
6 echo import > port
6 echo import > port
7 hg add port
7 hg add port
8 hg commit -m 0 -u spam -d '0 0'
8 hg commit -m 0 -u spam -d '0 0'
9 echo export >> port
9 echo export >> port
10 hg commit -m 1 -u eggs -d '1 0'
10 hg commit -m 1 -u eggs -d '1 0'
11 echo export > port
11 echo export > port
12 echo vaportight >> port
12 echo vaportight >> port
13 echo 'import/export' >> port
13 echo 'import/export' >> port
14 hg commit -m 2 -u spam -d '2 0'
14 hg commit -m 2 -u spam -d '2 0'
15 echo 'import/export' >> port
15 echo 'import/export' >> port
16 hg commit -m 3 -u eggs -d '3 0'
16 hg commit -m 3 -u eggs -d '3 0'
17 head -n 3 port > port1
17 head -n 3 port > port1
18 mv port1 port
18 mv port1 port
19 hg commit -m 4 -u spam -d '4 0'
19 hg commit -m 4 -u spam -d '4 0'
20 echo % pattern error
20 echo % pattern error
21 hg grep '**test**'
21 hg grep '**test**'
22 echo % simple
22 echo % simple
23 hg grep port port
23 hg grep port port
24 echo % all
24 echo % all
25 hg grep --all -nu port port
25 hg grep --all -nu port port
26 echo % other
26 echo % other
27 hg grep import port
27 hg grep import port
28
28
29 hg cp port port2
29 hg cp port port2
30 hg commit -m 4 -u spam -d '5 0'
30 hg commit -m 4 -u spam -d '5 0'
31 echo '% follow'
31 echo '% follow'
32 hg grep -f 'import$' port2
32 hg grep -f 'import$' port2
33 echo deport >> port2
33 echo deport >> port2
34 hg commit -m 5 -u eggs -d '6 0'
34 hg commit -m 5 -u eggs -d '6 0'
35 hg grep -f --all -nu port port2
35 hg grep -f --all -nu port port2
36
36
37 cd ..
37 cd ..
38 hg init t2
38 hg init t2
39 cd t2
39 cd t2
40 hg grep foobar foo
40 hg grep foobar foo
41 hg grep foobar
41 hg grep foobar
42 echo blue >> color
42 echo blue >> color
43 echo black >> color
43 echo black >> color
44 hg add color
44 hg add color
45 hg ci -m 0 -d '0 0'
45 hg ci -m 0
46 echo orange >> color
46 echo orange >> color
47 hg ci -m 1 -d '0 0'
47 hg ci -m 1
48 echo black > color
48 echo black > color
49 hg ci -m 2 -d '0 0'
49 hg ci -m 2
50 echo orange >> color
50 echo orange >> color
51 echo blue >> color
51 echo blue >> color
52 hg ci -m 3 -d '0 0'
52 hg ci -m 3
53 hg grep orange
53 hg grep orange
54 hg grep --all orange
54 hg grep --all orange
55
55
56 echo % match in last "line" without newline
56 echo % match in last "line" without newline
57 python -c 'fp = open("noeol", "wb"); fp.write("no infinite loop"); fp.close();'
57 python -c 'fp = open("noeol", "wb"); fp.write("no infinite loop"); fp.close();'
58 hg ci -Amnoeol
58 hg ci -Amnoeol
59 echo % last character omitted in output to avoid infinite loop
59 echo % last character omitted in output to avoid infinite loop
60 hg grep loop
60 hg grep loop
61
61
62 # Got a traceback when using grep on a single
62 # Got a traceback when using grep on a single
63 # revision with renamed files.
63 # revision with renamed files.
64 cd ..
64 cd ..
65 echo % issue 685
65 echo % issue 685
66 hg init issue685
66 hg init issue685
67 cd issue685
67 cd issue685
68 echo octarine > color
68 echo octarine > color
69 hg ci -Amcolor
69 hg ci -Amcolor
70 hg rename color colour
70 hg rename color colour
71 hg ci -Am rename
71 hg ci -Am rename
72 hg grep octarine
72 hg grep octarine
73 # Used to crash here
73 # Used to crash here
74 hg grep -r 1 octarine
74 hg grep -r 1 octarine
75
75
@@ -1,44 +1,44 b''
1 #!/bin/sh
1 #!/bin/sh
2 # Some tests for hgweb. Tests static files, plain files and different 404's.
2 # Some tests for hgweb. Tests static files, plain files and different 404's.
3
3
4 hg init test
4 hg init test
5 cd test
5 cd test
6 mkdir da
6 mkdir da
7 echo foo > da/foo
7 echo foo > da/foo
8 echo foo > foo
8 echo foo > foo
9 hg ci -Ambase -d '0 0'
9 hg ci -Ambase
10 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
10 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
11 cat hg.pid >> $DAEMON_PIDS
11 cat hg.pid >> $DAEMON_PIDS
12 echo % manifest
12 echo % manifest
13 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
13 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
14 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw')
14 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw')
15
15
16 echo % plain file
16 echo % plain file
17 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw'
17 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw'
18
18
19 echo % should give a 404 - static file that does not exist
19 echo % should give a 404 - static file that does not exist
20 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus'
20 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus'
21
21
22 echo % should give a 404 - bad revision
22 echo % should give a 404 - bad revision
23 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw'
23 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw'
24
24
25 echo % should give a 400 - bad command
25 echo % should give a 400 - bad command
26 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/'
26 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/'
27
27
28 echo % should give a 404 - file does not exist
28 echo % should give a 404 - file does not exist
29 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw'
29 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw'
30 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork'
30 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork'
31 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw'
31 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw'
32
32
33 echo % stop and restart
33 echo % stop and restart
34 "$TESTDIR/killdaemons.py"
34 "$TESTDIR/killdaemons.py"
35 hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
35 hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
36 cat hg.pid >> $DAEMON_PIDS
36 cat hg.pid >> $DAEMON_PIDS
37 # Test the access/error files are opened in append mode
37 # Test the access/error files are opened in append mode
38 python -c "print len(file('access.log').readlines()), 'log lines written'"
38 python -c "print len(file('access.log').readlines()), 'log lines written'"
39
39
40 echo % static file
40 echo % static file
41 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css'
41 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css'
42
42
43 echo % errors
43 echo % errors
44 cat errors.log
44 cat errors.log
@@ -1,58 +1,58 b''
1 #!/bin/sh
1 #!/bin/sh
2 # An attempt at more fully testing the hgweb web interface.
2 # An attempt at more fully testing the hgweb web interface.
3 # The following things are tested elsewhere and are therefore omitted:
3 # The following things are tested elsewhere and are therefore omitted:
4 # - archive, tested in test-archive
4 # - archive, tested in test-archive
5 # - unbundle, tested in test-push-http
5 # - unbundle, tested in test-push-http
6 # - changegroupsubset, tested in test-pull
6 # - changegroupsubset, tested in test-pull
7
7
8 echo % Set up the repo
8 echo % Set up the repo
9 hg init test
9 hg init test
10 cd test
10 cd test
11 mkdir da
11 mkdir da
12 echo foo > da/foo
12 echo foo > da/foo
13 echo foo > foo
13 echo foo > foo
14 hg ci -d'0 0' -Ambase
14 hg ci -Ambase
15 hg tag 1.0
15 hg tag 1.0
16 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log
16 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 cat hg.pid >> $DAEMON_PIDS
17 cat hg.pid >> $DAEMON_PIDS
18
18
19 echo % Logs and changes
19 echo % Logs and changes
20 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
20 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
21 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/1/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
21 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/1/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
22 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/1/foo/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
22 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/log/1/foo/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
23 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/shortlog/'
23 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/shortlog/'
24 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/rev/0/'
24 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/rev/0/'
25 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/rev/1/?style=raw'
25 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/rev/1/?style=raw'
26
26
27 echo % File-related
27 echo % File-related
28 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo/?style=raw'
28 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo/?style=raw'
29 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/annotate/1/foo/?style=raw'
29 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/annotate/1/foo/?style=raw'
30 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/?style=raw'
30 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/?style=raw'
31 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo'
31 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo'
32 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/filediff/1/foo/?style=raw'
32 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/filediff/1/foo/?style=raw'
33
33
34 echo % Overviews
34 echo % Overviews
35 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/tags/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
35 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/tags/?style=atom' | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
36 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/summary/?style=gitweb'
36 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/summary/?style=gitweb'
37 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/?style=gitweb'
37 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/graph/?style=gitweb'
38
38
39 echo % capabilities
39 echo % capabilities
40 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'
40 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=capabilities'
41 echo % heads
41 echo % heads
42 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=heads'
42 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=heads'
43 echo % lookup
43 echo % lookup
44 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=lookup&node=1'
44 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=lookup&node=1'
45 echo % branches
45 echo % branches
46 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=branches'
46 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=branches'
47 echo % changegroup
47 echo % changegroup
48 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=changegroup'
48 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=changegroup'
49 echo % stream_out
49 echo % stream_out
50 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=stream_out'
50 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=stream_out'
51 echo % failing unbundle, requires POST request
51 echo % failing unbundle, requires POST request
52 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=unbundle'
52 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '?cmd=unbundle'
53
53
54 echo % Static files
54 echo % Static files
55 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/static/style.css'
55 "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/static/style.css'
56
56
57 echo % ERRORS ENCOUNTERED
57 echo % ERRORS ENCOUNTERED
58 cat errors.log
58 cat errors.log
@@ -1,60 +1,60 b''
1 #!/bin/sh
1 #!/bin/sh
2 # This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is
2 # This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is
3 # no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO
3 # no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO
4 # should be used from d74fc8dec2b4 onward to route the request.
4 # should be used from d74fc8dec2b4 onward to route the request.
5
5
6 mkdir repo
6 mkdir repo
7 cd repo
7 cd repo
8 hg init
8 hg init
9 echo foo > bar
9 echo foo > bar
10 hg add bar
10 hg add bar
11 hg commit -m "test" -d "0 0" -u "Testing"
11 hg commit -m "test" -u "Testing"
12 hg tip
12 hg tip
13
13
14 cat > request.py <<EOF
14 cat > request.py <<EOF
15 from mercurial.hgweb import hgweb, hgwebdir
15 from mercurial.hgweb import hgweb, hgwebdir
16 from StringIO import StringIO
16 from StringIO import StringIO
17 import os, sys
17 import os, sys
18
18
19 errors = StringIO()
19 errors = StringIO()
20 input = StringIO()
20 input = StringIO()
21
21
22 def startrsp(headers, data):
22 def startrsp(headers, data):
23 print '---- HEADERS'
23 print '---- HEADERS'
24 print headers
24 print headers
25 print '---- DATA'
25 print '---- DATA'
26 print data
26 print data
27 return output.write
27 return output.write
28
28
29 env = {
29 env = {
30 'wsgi.version': (1, 0),
30 'wsgi.version': (1, 0),
31 'wsgi.url_scheme': 'http',
31 'wsgi.url_scheme': 'http',
32 'wsgi.errors': errors,
32 'wsgi.errors': errors,
33 'wsgi.input': input,
33 'wsgi.input': input,
34 'wsgi.multithread': False,
34 'wsgi.multithread': False,
35 'wsgi.multiprocess': False,
35 'wsgi.multiprocess': False,
36 'wsgi.run_once': False,
36 'wsgi.run_once': False,
37 'REQUEST_METHOD': 'GET',
37 'REQUEST_METHOD': 'GET',
38 'SCRIPT_NAME': '',
38 'SCRIPT_NAME': '',
39 'SERVER_NAME': '127.0.0.1',
39 'SERVER_NAME': '127.0.0.1',
40 'SERVER_PORT': os.environ['HGPORT'],
40 'SERVER_PORT': os.environ['HGPORT'],
41 'SERVER_PROTOCOL': 'HTTP/1.0'
41 'SERVER_PROTOCOL': 'HTTP/1.0'
42 }
42 }
43
43
44 def process(app):
44 def process(app):
45 content = app(env, startrsp)
45 content = app(env, startrsp)
46 sys.stdout.write(output.getvalue())
46 sys.stdout.write(output.getvalue())
47 sys.stdout.write(''.join(content))
47 sys.stdout.write(''.join(content))
48 print '---- ERRORS'
48 print '---- ERRORS'
49 print errors.getvalue()
49 print errors.getvalue()
50
50
51 output = StringIO()
51 output = StringIO()
52 env['QUERY_STRING'] = 'style=atom'
52 env['QUERY_STRING'] = 'style=atom'
53 process(hgweb('.', name='repo'))
53 process(hgweb('.', name='repo'))
54
54
55 output = StringIO()
55 output = StringIO()
56 env['QUERY_STRING'] = 'style=raw'
56 env['QUERY_STRING'] = 'style=raw'
57 process(hgwebdir({'repo': '.'}))
57 process(hgwebdir({'repo': '.'}))
58 EOF
58 EOF
59
59
60 python request.py | sed "s/http:\/\/127\.0\.0\.1:[0-9]*\//http:\/\/127.0.0.1\//"
60 python request.py | sed "s/http:\/\/127\.0\.0\.1:[0-9]*\//http:\/\/127.0.0.1\//"
@@ -1,73 +1,73 b''
1 #!/bin/sh
1 #!/bin/sh
2 # This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is
2 # This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is
3 # no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO
3 # no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO
4 # should be used from d74fc8dec2b4 onward to route the request.
4 # should be used from d74fc8dec2b4 onward to route the request.
5
5
6 mkdir repo
6 mkdir repo
7 cd repo
7 cd repo
8 hg init
8 hg init
9 echo foo > bar
9 echo foo > bar
10 hg add bar
10 hg add bar
11 hg commit -m "test" -d "0 0" -u "Testing"
11 hg commit -m "test" -u "Testing"
12 hg tip
12 hg tip
13
13
14 cat > request.py <<EOF
14 cat > request.py <<EOF
15 from mercurial.hgweb import hgweb, hgwebdir
15 from mercurial.hgweb import hgweb, hgwebdir
16 from StringIO import StringIO
16 from StringIO import StringIO
17 import os, sys
17 import os, sys
18
18
19 errors = StringIO()
19 errors = StringIO()
20 input = StringIO()
20 input = StringIO()
21
21
22 def startrsp(headers, data):
22 def startrsp(headers, data):
23 print '---- HEADERS'
23 print '---- HEADERS'
24 print headers
24 print headers
25 print '---- DATA'
25 print '---- DATA'
26 print data
26 print data
27 return output.write
27 return output.write
28
28
29 env = {
29 env = {
30 'wsgi.version': (1, 0),
30 'wsgi.version': (1, 0),
31 'wsgi.url_scheme': 'http',
31 'wsgi.url_scheme': 'http',
32 'wsgi.errors': errors,
32 'wsgi.errors': errors,
33 'wsgi.input': input,
33 'wsgi.input': input,
34 'wsgi.multithread': False,
34 'wsgi.multithread': False,
35 'wsgi.multiprocess': False,
35 'wsgi.multiprocess': False,
36 'wsgi.run_once': False,
36 'wsgi.run_once': False,
37 'REQUEST_METHOD': 'GET',
37 'REQUEST_METHOD': 'GET',
38 'SCRIPT_NAME': '',
38 'SCRIPT_NAME': '',
39 'SERVER_NAME': '127.0.0.1',
39 'SERVER_NAME': '127.0.0.1',
40 'SERVER_PORT': os.environ['HGPORT'],
40 'SERVER_PORT': os.environ['HGPORT'],
41 'SERVER_PROTOCOL': 'HTTP/1.0'
41 'SERVER_PROTOCOL': 'HTTP/1.0'
42 }
42 }
43
43
44 def process(app):
44 def process(app):
45 content = app(env, startrsp)
45 content = app(env, startrsp)
46 sys.stdout.write(output.getvalue())
46 sys.stdout.write(output.getvalue())
47 sys.stdout.write(''.join(content))
47 sys.stdout.write(''.join(content))
48 print '---- ERRORS'
48 print '---- ERRORS'
49 print errors.getvalue()
49 print errors.getvalue()
50
50
51
51
52 output = StringIO()
52 output = StringIO()
53 env['PATH_INFO'] = '/'
53 env['PATH_INFO'] = '/'
54 env['QUERY_STRING'] = 'style=atom'
54 env['QUERY_STRING'] = 'style=atom'
55 process(hgweb('.', name = 'repo'))
55 process(hgweb('.', name = 'repo'))
56
56
57 output = StringIO()
57 output = StringIO()
58 env['PATH_INFO'] = '/file/tip/'
58 env['PATH_INFO'] = '/file/tip/'
59 env['QUERY_STRING'] = 'style=raw'
59 env['QUERY_STRING'] = 'style=raw'
60 process(hgweb('.', name = 'repo'))
60 process(hgweb('.', name = 'repo'))
61
61
62 output = StringIO()
62 output = StringIO()
63 env['PATH_INFO'] = '/'
63 env['PATH_INFO'] = '/'
64 env['QUERY_STRING'] = 'style=raw'
64 env['QUERY_STRING'] = 'style=raw'
65 process(hgwebdir({'repo': '.'}))
65 process(hgwebdir({'repo': '.'}))
66
66
67 output = StringIO()
67 output = StringIO()
68 env['PATH_INFO'] = '/repo/file/tip/'
68 env['PATH_INFO'] = '/repo/file/tip/'
69 env['QUERY_STRING'] = 'style=raw'
69 env['QUERY_STRING'] = 'style=raw'
70 process(hgwebdir({'repo': '.'}))
70 process(hgwebdir({'repo': '.'}))
71 EOF
71 EOF
72
72
73 python request.py | sed "s/http:\/\/127\.0\.0\.1:[0-9]*\//http:\/\/127.0.0.1\//"
73 python request.py | sed "s/http:\/\/127\.0\.0\.1:[0-9]*\//http:\/\/127.0.0.1\//"
@@ -1,38 +1,38 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cp "$TESTDIR"/printenv.py .
3 cp "$TESTDIR"/printenv.py .
4
4
5 hg init test
5 hg init test
6 cd test
6 cd test
7 echo foo>foo
7 echo foo>foo
8 hg commit -A -d '0 0' -m 1
8 hg commit -A -m 1
9 hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=../hg1.pid
9 hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=../hg1.pid
10 hg serve -p $HGPORT1 -d --pid-file=../hg2.pid
10 hg serve -p $HGPORT1 -d --pid-file=../hg2.pid
11 # Test server address cannot be reused
11 # Test server address cannot be reused
12 hg serve -p $HGPORT1 2>&1 | sed -e "s/abort: cannot start server at ':$HGPORT1':.*/abort: cannot start server at ':20060':/"
12 hg serve -p $HGPORT1 2>&1 | sed -e "s/abort: cannot start server at ':$HGPORT1':.*/abort: cannot start server at ':20060':/"
13 cd ..
13 cd ..
14 cat hg1.pid hg2.pid >> $DAEMON_PIDS
14 cat hg1.pid hg2.pid >> $DAEMON_PIDS
15
15
16 echo % clone via stream
16 echo % clone via stream
17 http_proxy= hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | \
17 http_proxy= hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | \
18 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
18 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
19 hg verify -R copy
19 hg verify -R copy
20
20
21 echo % try to clone via stream, should use pull instead
21 echo % try to clone via stream, should use pull instead
22 http_proxy= hg clone --uncompressed http://localhost:$HGPORT1/ copy2
22 http_proxy= hg clone --uncompressed http://localhost:$HGPORT1/ copy2
23
23
24 echo % clone via pull
24 echo % clone via pull
25 http_proxy= hg clone http://localhost:$HGPORT1/ copy-pull
25 http_proxy= hg clone http://localhost:$HGPORT1/ copy-pull
26 hg verify -R copy-pull
26 hg verify -R copy-pull
27
27
28 cd test
28 cd test
29 echo bar > bar
29 echo bar > bar
30 hg commit -A -d '1 0' -m 2
30 hg commit -A -d '1 0' -m 2
31 cd ..
31 cd ..
32
32
33 echo % pull
33 echo % pull
34 cd copy-pull
34 cd copy-pull
35 echo '[hooks]' >> .hg/hgrc
35 echo '[hooks]' >> .hg/hgrc
36 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
36 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
37 hg pull | sed -e 's,:[0-9][0-9]*/,/,'
37 hg pull | sed -e 's,:[0-9][0-9]*/,/,'
38 cd ..
38 cd ..
@@ -1,334 +1,334 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init a
3 hg init a
4 mkdir a/d1
4 mkdir a/d1
5 mkdir a/d1/d2
5 mkdir a/d1/d2
6 echo line 1 > a/a
6 echo line 1 > a/a
7 echo line 1 > a/d1/d2/a
7 echo line 1 > a/d1/d2/a
8 hg --cwd a ci -d '0 0' -Ama
8 hg --cwd a ci -Ama
9
9
10 echo line 2 >> a/a
10 echo line 2 >> a/a
11 hg --cwd a ci -u someone -d '1 0' -m'second change'
11 hg --cwd a ci -u someone -d '1 0' -m'second change'
12
12
13 echo % import exported patch
13 echo % import exported patch
14 hg clone -r0 a b
14 hg clone -r0 a b
15 hg --cwd a export tip > tip.patch
15 hg --cwd a export tip > tip.patch
16 hg --cwd b import ../tip.patch
16 hg --cwd b import ../tip.patch
17 echo % message should be same
17 echo % message should be same
18 hg --cwd b tip | grep 'second change'
18 hg --cwd b tip | grep 'second change'
19 echo % committer should be same
19 echo % committer should be same
20 hg --cwd b tip | grep someone
20 hg --cwd b tip | grep someone
21 rm -r b
21 rm -r b
22
22
23 echo % import exported patch with external patcher
23 echo % import exported patch with external patcher
24 cat > dummypatch.py <<EOF
24 cat > dummypatch.py <<EOF
25 print 'patching file a'
25 print 'patching file a'
26 file('a', 'wb').write('line2\n')
26 file('a', 'wb').write('line2\n')
27 EOF
27 EOF
28 chmod +x dummypatch.py
28 chmod +x dummypatch.py
29 hg clone -r0 a b
29 hg clone -r0 a b
30 hg --cwd a export tip > tip.patch
30 hg --cwd a export tip > tip.patch
31 hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
31 hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
32 cat b/a
32 cat b/a
33 rm -r b
33 rm -r b
34
34
35 echo % import of plain diff should fail without message
35 echo % import of plain diff should fail without message
36 hg clone -r0 a b
36 hg clone -r0 a b
37 hg --cwd a diff -r0:1 > tip.patch
37 hg --cwd a diff -r0:1 > tip.patch
38 hg --cwd b import ../tip.patch
38 hg --cwd b import ../tip.patch
39 rm -r b
39 rm -r b
40
40
41 echo % import of plain diff should be ok with message
41 echo % import of plain diff should be ok with message
42 hg clone -r0 a b
42 hg clone -r0 a b
43 hg --cwd a diff -r0:1 > tip.patch
43 hg --cwd a diff -r0:1 > tip.patch
44 hg --cwd b import -mpatch ../tip.patch
44 hg --cwd b import -mpatch ../tip.patch
45 rm -r b
45 rm -r b
46
46
47 echo % import of plain diff with specific date and user
47 echo % import of plain diff with specific date and user
48 hg clone -r0 a b
48 hg clone -r0 a b
49 hg --cwd a diff -r0:1 > tip.patch
49 hg --cwd a diff -r0:1 > tip.patch
50 hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch
50 hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch
51 hg -R b tip -pv
51 hg -R b tip -pv
52 rm -r b
52 rm -r b
53
53
54 echo % import of plain diff should be ok with --no-commit
54 echo % import of plain diff should be ok with --no-commit
55 hg clone -r0 a b
55 hg clone -r0 a b
56 hg --cwd a diff -r0:1 > tip.patch
56 hg --cwd a diff -r0:1 > tip.patch
57 hg --cwd b import --no-commit ../tip.patch
57 hg --cwd b import --no-commit ../tip.patch
58 hg --cwd b diff --nodates
58 hg --cwd b diff --nodates
59 rm -r b
59 rm -r b
60
60
61 echo % hg -R repo import
61 echo % hg -R repo import
62 # put the clone in a subdir - having a directory named "a"
62 # put the clone in a subdir - having a directory named "a"
63 # used to hide a bug.
63 # used to hide a bug.
64 mkdir dir
64 mkdir dir
65 hg clone -r0 a dir/b
65 hg clone -r0 a dir/b
66 hg --cwd a export tip > dir/tip.patch
66 hg --cwd a export tip > dir/tip.patch
67 cd dir
67 cd dir
68 hg -R b import tip.patch
68 hg -R b import tip.patch
69 cd ..
69 cd ..
70 rm -r dir
70 rm -r dir
71
71
72 echo % import from stdin
72 echo % import from stdin
73 hg clone -r0 a b
73 hg clone -r0 a b
74 hg --cwd a export tip | hg --cwd b import -
74 hg --cwd a export tip | hg --cwd b import -
75 rm -r b
75 rm -r b
76
76
77 echo % override commit message
77 echo % override commit message
78 hg clone -r0 a b
78 hg clone -r0 a b
79 hg --cwd a export tip | hg --cwd b import -m 'override' -
79 hg --cwd a export tip | hg --cwd b import -m 'override' -
80 hg --cwd b tip | grep override
80 hg --cwd b tip | grep override
81 rm -r b
81 rm -r b
82
82
83 cat > mkmsg.py <<EOF
83 cat > mkmsg.py <<EOF
84 import email.Message, sys
84 import email.Message, sys
85 msg = email.Message.Message()
85 msg = email.Message.Message()
86 msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read())
86 msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read())
87 msg['Subject'] = 'email patch'
87 msg['Subject'] = 'email patch'
88 msg['From'] = 'email patcher'
88 msg['From'] = 'email patcher'
89 sys.stdout.write(msg.as_string())
89 sys.stdout.write(msg.as_string())
90 EOF
90 EOF
91
91
92 echo % plain diff in email, subject, message body
92 echo % plain diff in email, subject, message body
93 hg clone -r0 a b
93 hg clone -r0 a b
94 hg --cwd a diff -r0:1 > tip.patch
94 hg --cwd a diff -r0:1 > tip.patch
95 python mkmsg.py > msg.patch
95 python mkmsg.py > msg.patch
96 hg --cwd b import ../msg.patch
96 hg --cwd b import ../msg.patch
97 hg --cwd b tip | grep email
97 hg --cwd b tip | grep email
98 rm -r b
98 rm -r b
99
99
100 echo % plain diff in email, no subject, message body
100 echo % plain diff in email, no subject, message body
101 hg clone -r0 a b
101 hg clone -r0 a b
102 grep -v '^Subject:' msg.patch | hg --cwd b import -
102 grep -v '^Subject:' msg.patch | hg --cwd b import -
103 rm -r b
103 rm -r b
104
104
105 echo % plain diff in email, subject, no message body
105 echo % plain diff in email, subject, no message body
106 hg clone -r0 a b
106 hg clone -r0 a b
107 grep -v '^email ' msg.patch | hg --cwd b import -
107 grep -v '^email ' msg.patch | hg --cwd b import -
108 rm -r b
108 rm -r b
109
109
110 echo % plain diff in email, no subject, no message body, should fail
110 echo % plain diff in email, no subject, no message body, should fail
111 hg clone -r0 a b
111 hg clone -r0 a b
112 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
112 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
113 rm -r b
113 rm -r b
114
114
115 echo % hg export in email, should use patch header
115 echo % hg export in email, should use patch header
116 hg clone -r0 a b
116 hg clone -r0 a b
117 hg --cwd a export tip > tip.patch
117 hg --cwd a export tip > tip.patch
118 python mkmsg.py | hg --cwd b import -
118 python mkmsg.py | hg --cwd b import -
119 hg --cwd b tip | grep second
119 hg --cwd b tip | grep second
120 rm -r b
120 rm -r b
121
121
122 # subject: duplicate detection, removal of [PATCH]
122 # subject: duplicate detection, removal of [PATCH]
123 # The '---' tests the gitsendmail handling without proper mail headers
123 # The '---' tests the gitsendmail handling without proper mail headers
124 cat > mkmsg2.py <<EOF
124 cat > mkmsg2.py <<EOF
125 import email.Message, sys
125 import email.Message, sys
126 msg = email.Message.Message()
126 msg = email.Message.Message()
127 msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
127 msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
128 msg['Subject'] = '[PATCH] email patch'
128 msg['Subject'] = '[PATCH] email patch'
129 msg['From'] = 'email patcher'
129 msg['From'] = 'email patcher'
130 sys.stdout.write(msg.as_string())
130 sys.stdout.write(msg.as_string())
131 EOF
131 EOF
132
132
133 echo '% plain diff in email, [PATCH] subject, message body with subject'
133 echo '% plain diff in email, [PATCH] subject, message body with subject'
134 hg clone -r0 a b
134 hg clone -r0 a b
135 hg --cwd a diff -r0:1 > tip.patch
135 hg --cwd a diff -r0:1 > tip.patch
136 python mkmsg2.py | hg --cwd b import -
136 python mkmsg2.py | hg --cwd b import -
137 hg --cwd b tip --template '{desc}\n'
137 hg --cwd b tip --template '{desc}\n'
138 rm -r b
138 rm -r b
139
139
140 # We weren't backing up the correct dirstate file when importing many patches
140 # We weren't backing up the correct dirstate file when importing many patches
141 # (issue963)
141 # (issue963)
142 echo '% import patch1 patch2; rollback'
142 echo '% import patch1 patch2; rollback'
143 echo line 3 >> a/a
143 echo line 3 >> a/a
144 hg --cwd a ci -m'third change'
144 hg --cwd a ci -m'third change'
145 hg --cwd a export -o '../patch%R' 1 2
145 hg --cwd a export -o '../patch%R' 1 2
146 hg clone -qr0 a b
146 hg clone -qr0 a b
147 hg --cwd b parents --template 'parent: #rev#\n'
147 hg --cwd b parents --template 'parent: #rev#\n'
148 hg --cwd b import ../patch1 ../patch2
148 hg --cwd b import ../patch1 ../patch2
149 hg --cwd b rollback
149 hg --cwd b rollback
150 hg --cwd b parents --template 'parent: #rev#\n'
150 hg --cwd b parents --template 'parent: #rev#\n'
151 rm -r b
151 rm -r b
152
152
153 # bug non regression test
153 # bug non regression test
154 # importing a patch in a subdirectory failed at the commit stage
154 # importing a patch in a subdirectory failed at the commit stage
155 echo line 2 >> a/d1/d2/a
155 echo line 2 >> a/d1/d2/a
156 hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
156 hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
157 echo % hg import in a subdirectory
157 echo % hg import in a subdirectory
158 hg clone -r0 a b
158 hg clone -r0 a b
159 hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch
159 hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch
160 dir=`pwd`
160 dir=`pwd`
161 cd b/d1/d2 2>&1 > /dev/null
161 cd b/d1/d2 2>&1 > /dev/null
162 hg import ../../../tip.patch
162 hg import ../../../tip.patch
163 cd $dir
163 cd $dir
164 echo "% message should be 'subdir change'"
164 echo "% message should be 'subdir change'"
165 hg --cwd b tip | grep 'subdir change'
165 hg --cwd b tip | grep 'subdir change'
166 echo "% committer should be 'someoneelse'"
166 echo "% committer should be 'someoneelse'"
167 hg --cwd b tip | grep someoneelse
167 hg --cwd b tip | grep someoneelse
168 echo "% should be empty"
168 echo "% should be empty"
169 hg --cwd b status
169 hg --cwd b status
170
170
171
171
172 # Test fuzziness (ambiguous patch location, fuzz=2)
172 # Test fuzziness (ambiguous patch location, fuzz=2)
173 echo % test fuzziness
173 echo % test fuzziness
174 hg init fuzzy
174 hg init fuzzy
175 cd fuzzy
175 cd fuzzy
176 echo line1 > a
176 echo line1 > a
177 echo line0 >> a
177 echo line0 >> a
178 echo line3 >> a
178 echo line3 >> a
179 hg ci -Am adda
179 hg ci -Am adda
180 echo line1 > a
180 echo line1 > a
181 echo line2 >> a
181 echo line2 >> a
182 echo line0 >> a
182 echo line0 >> a
183 echo line3 >> a
183 echo line3 >> a
184 hg ci -m change a
184 hg ci -m change a
185 hg export tip > tip.patch
185 hg export tip > tip.patch
186 hg up -C 0
186 hg up -C 0
187 echo line1 > a
187 echo line1 > a
188 echo line0 >> a
188 echo line0 >> a
189 echo line1 >> a
189 echo line1 >> a
190 echo line0 >> a
190 echo line0 >> a
191 hg ci -m brancha
191 hg ci -m brancha
192 hg import -v tip.patch
192 hg import -v tip.patch
193 cd ..
193 cd ..
194
194
195 # Test hunk touching empty files (issue906)
195 # Test hunk touching empty files (issue906)
196 hg init empty
196 hg init empty
197 cd empty
197 cd empty
198 touch a
198 touch a
199 touch b1
199 touch b1
200 touch c1
200 touch c1
201 echo d > d
201 echo d > d
202 hg ci -Am init
202 hg ci -Am init
203 echo a > a
203 echo a > a
204 echo b > b1
204 echo b > b1
205 hg mv b1 b2
205 hg mv b1 b2
206 echo c > c1
206 echo c > c1
207 hg copy c1 c2
207 hg copy c1 c2
208 rm d
208 rm d
209 touch d
209 touch d
210 hg diff --git
210 hg diff --git
211 hg ci -m empty
211 hg ci -m empty
212 hg export --git tip > empty.diff
212 hg export --git tip > empty.diff
213 hg up -C 0
213 hg up -C 0
214 hg import empty.diff
214 hg import empty.diff
215 for name in a b1 b2 c1 c2 d;
215 for name in a b1 b2 c1 c2 d;
216 do
216 do
217 echo % $name file
217 echo % $name file
218 test -f $name && cat $name
218 test -f $name && cat $name
219 done
219 done
220 cd ..
220 cd ..
221
221
222 # Test importing a patch ending with a binary file removal
222 # Test importing a patch ending with a binary file removal
223 echo % test trailing binary removal
223 echo % test trailing binary removal
224 hg init binaryremoval
224 hg init binaryremoval
225 cd binaryremoval
225 cd binaryremoval
226 echo a > a
226 echo a > a
227 python -c "file('b', 'wb').write('a\x00b')"
227 python -c "file('b', 'wb').write('a\x00b')"
228 hg ci -Am addall
228 hg ci -Am addall
229 hg rm a
229 hg rm a
230 hg rm b
230 hg rm b
231 hg st
231 hg st
232 hg ci -m remove
232 hg ci -m remove
233 hg export --git . > remove.diff
233 hg export --git . > remove.diff
234 cat remove.diff | grep git
234 cat remove.diff | grep git
235 hg up -C 0
235 hg up -C 0
236 hg import remove.diff
236 hg import remove.diff
237 hg manifest
237 hg manifest
238 cd ..
238 cd ..
239
239
240 echo % 'test update+rename with common name (issue 927)'
240 echo % 'test update+rename with common name (issue 927)'
241 hg init t
241 hg init t
242 cd t
242 cd t
243 touch a
243 touch a
244 hg ci -Am t
244 hg ci -Am t
245 echo a > a
245 echo a > a
246 # Here, bfile.startswith(afile)
246 # Here, bfile.startswith(afile)
247 hg copy a a2
247 hg copy a a2
248 hg ci -m copya
248 hg ci -m copya
249 hg export --git tip > copy.diff
249 hg export --git tip > copy.diff
250 hg up -C 0
250 hg up -C 0
251 hg import copy.diff
251 hg import copy.diff
252 echo % view a
252 echo % view a
253 # a should contain an 'a'
253 # a should contain an 'a'
254 cat a
254 cat a
255 echo % view a2
255 echo % view a2
256 # and a2 should have duplicated it
256 # and a2 should have duplicated it
257 cat a2
257 cat a2
258 cd ..
258 cd ..
259
259
260 echo % 'test -p0'
260 echo % 'test -p0'
261 hg init p0
261 hg init p0
262 cd p0
262 cd p0
263 echo a > a
263 echo a > a
264 hg ci -Am t
264 hg ci -Am t
265 hg import -p0 - << EOF
265 hg import -p0 - << EOF
266 foobar
266 foobar
267 --- a Sat Apr 12 22:43:58 2008 -0400
267 --- a Sat Apr 12 22:43:58 2008 -0400
268 +++ a Sat Apr 12 22:44:05 2008 -0400
268 +++ a Sat Apr 12 22:44:05 2008 -0400
269 @@ -1,1 +1,1 @@
269 @@ -1,1 +1,1 @@
270 -a
270 -a
271 +bb
271 +bb
272 EOF
272 EOF
273 hg status
273 hg status
274 cat a
274 cat a
275 cd ..
275 cd ..
276
276
277 echo % 'test paths outside repo root'
277 echo % 'test paths outside repo root'
278 mkdir outside
278 mkdir outside
279 touch outside/foo
279 touch outside/foo
280 hg init inside
280 hg init inside
281 cd inside
281 cd inside
282 hg import - <<EOF
282 hg import - <<EOF
283 diff --git a/a b/b
283 diff --git a/a b/b
284 rename from ../outside/foo
284 rename from ../outside/foo
285 rename to bar
285 rename to bar
286 EOF
286 EOF
287 cd ..
287 cd ..
288
288
289 echo '% test import with similarity (issue295)'
289 echo '% test import with similarity (issue295)'
290 hg init sim
290 hg init sim
291 cd sim
291 cd sim
292 echo 'this is a test' > a
292 echo 'this is a test' > a
293 hg ci -Ama
293 hg ci -Ama
294 cat > ../rename.diff <<EOF
294 cat > ../rename.diff <<EOF
295 diff --git a/a b/a
295 diff --git a/a b/a
296 deleted file mode 100644
296 deleted file mode 100644
297 --- a/a
297 --- a/a
298 +++ /dev/null
298 +++ /dev/null
299 @@ -1,1 +0,0 @@
299 @@ -1,1 +0,0 @@
300 -this is a test
300 -this is a test
301 diff --git a/b b/b
301 diff --git a/b b/b
302 new file mode 100644
302 new file mode 100644
303 --- /dev/null
303 --- /dev/null
304 +++ b/b
304 +++ b/b
305 @@ -0,0 +1,2 @@
305 @@ -0,0 +1,2 @@
306 +this is a test
306 +this is a test
307 +foo
307 +foo
308 EOF
308 EOF
309 hg import --no-commit -v -s 1 ../rename.diff
309 hg import --no-commit -v -s 1 ../rename.diff
310 hg st -C
310 hg st -C
311 hg revert -a
311 hg revert -a
312 rm b
312 rm b
313 hg import --no-commit -v -s 100 ../rename.diff
313 hg import --no-commit -v -s 100 ../rename.diff
314 hg st -C
314 hg st -C
315 cd ..
315 cd ..
316
316
317
317
318 echo '% add empty file from the end of patch (issue 1495)'
318 echo '% add empty file from the end of patch (issue 1495)'
319 hg init addemptyend
319 hg init addemptyend
320 cd addemptyend
320 cd addemptyend
321 touch a
321 touch a
322 hg addremove
322 hg addremove
323 hg ci -m "commit"
323 hg ci -m "commit"
324 cat > a.patch <<EOF
324 cat > a.patch <<EOF
325 diff --git a/a b/a
325 diff --git a/a b/a
326 --- a/a
326 --- a/a
327 +++ b/a
327 +++ b/a
328 @@ -0,0 +1,1 @@
328 @@ -0,0 +1,1 @@
329 +a
329 +a
330 diff --git a/b b/b
330 diff --git a/b b/b
331 new file mode 100644
331 new file mode 100644
332 EOF
332 EOF
333 hg import --no-commit a.patch
333 hg import --no-commit a.patch
334 cd ..
334 cd ..
@@ -1,31 +1,31 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # In the merge below, the file "foo" has the same contents in both
3 # In the merge below, the file "foo" has the same contents in both
4 # parents, but if we look at the file-level history, we'll notice that
4 # parents, but if we look at the file-level history, we'll notice that
5 # the version in p1 is an ancestor of the version in p2. This test
5 # the version in p1 is an ancestor of the version in p2. This test
6 # makes sure that we'll use the version from p2 in the manifest of the
6 # makes sure that we'll use the version from p2 in the manifest of the
7 # merge revision.
7 # merge revision.
8
8
9 hg init repo
9 hg init repo
10 cd repo
10 cd repo
11
11
12 echo foo > foo
12 echo foo > foo
13 hg ci -d '0 0' -qAm 'add foo'
13 hg ci -qAm 'add foo'
14
14
15 echo bar >> foo
15 echo bar >> foo
16 hg ci -d '0 0' -m 'change foo'
16 hg ci -m 'change foo'
17
17
18 hg backout -d '0 0' -r tip -m 'backout changed foo'
18 hg backout -r tip -m 'backout changed foo'
19
19
20 hg up -C 0
20 hg up -C 0
21 touch bar
21 touch bar
22 hg ci -d '0 0' -qAm 'add bar'
22 hg ci -qAm 'add bar'
23
23
24 hg merge --debug
24 hg merge --debug
25 hg debugstate | grep foo
25 hg debugstate | grep foo
26 hg st -A foo
26 hg st -A foo
27 hg ci -d '0 0' -m 'merge'
27 hg ci -m 'merge'
28
28
29 hg manifest --debug | grep foo
29 hg manifest --debug | grep foo
30 hg debugindex .hg/store/data/foo.i
30 hg debugindex .hg/store/data/foo.i
31
31
@@ -1,35 +1,35 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # 0-2-4
3 # 0-2-4
4 # \ \ \
4 # \ \ \
5 # 1-3-5
5 # 1-3-5
6 #
6 #
7 # rename in #1, content change in #4.
7 # rename in #1, content change in #4.
8
8
9 hg init t
9 hg init t
10 cd t
10 cd t
11
11
12 touch 1
12 touch 1
13 touch 2
13 touch 2
14 hg commit -Am init -d "0 0" # 0
14 hg commit -Am init # 0
15
15
16 hg rename 1 1a
16 hg rename 1 1a
17 hg commit -m rename -d "0 0" # 1
17 hg commit -m rename # 1
18
18
19 hg co -C 0
19 hg co -C 0
20 echo unrelated >> 2
20 echo unrelated >> 2
21 hg ci -m unrelated1 -d "0 0" # 2
21 hg ci -m unrelated1 # 2
22
22
23 hg merge --debug 1
23 hg merge --debug 1
24 hg ci -m merge1 -d "0 0" # 3
24 hg ci -m merge1 # 3
25
25
26 hg co -C 2
26 hg co -C 2
27 echo hello >> 1
27 echo hello >> 1
28 hg ci -m unrelated2 -d "0 0" # 4
28 hg ci -m unrelated2 # 4
29
29
30 hg co -C 3
30 hg co -C 3
31 hg merge -y --debug 4
31 hg merge -y --debug 4
32
32
33 hg co -C 4
33 hg co -C 4
34 hg merge -y --debug 3
34 hg merge -y --debug 3
35
35
@@ -1,343 +1,343 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat <<EOF >> $HGRCPATH
3 cat <<EOF >> $HGRCPATH
4 [extensions]
4 [extensions]
5 hgext.keyword =
5 hgext.keyword =
6 hgext.mq =
6 hgext.mq =
7 hgext.notify =
7 hgext.notify =
8 [keyword]
8 [keyword]
9 * =
9 * =
10 b = ignore
10 b = ignore
11 [hooks]
11 [hooks]
12 commit=
12 commit=
13 commit.test=cp a hooktest
13 commit.test=cp a hooktest
14 EOF
14 EOF
15
15
16 echo % help
16 echo % help
17 hg help keyword
17 hg help keyword
18
18
19 echo % hg kwdemo
19 echo % hg kwdemo
20 hg --quiet kwdemo --default \
20 hg --quiet kwdemo --default \
21 | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
21 | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
22 -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
22 -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
23 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
23 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
24 -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'
24 -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'
25
25
26 hg --quiet kwdemo "Branch = {branches}"
26 hg --quiet kwdemo "Branch = {branches}"
27
27
28 hg init Test-bndl
28 hg init Test-bndl
29 cd Test-bndl
29 cd Test-bndl
30
30
31 echo % kwshrink should exit silently in empty/invalid repo
31 echo % kwshrink should exit silently in empty/invalid repo
32 hg kwshrink
32 hg kwshrink
33
33
34 # Symlinks cannot be created on Windows. The bundle was made with:
34 # Symlinks cannot be created on Windows. The bundle was made with:
35 #
35 #
36 # hg init t
36 # hg init t
37 # cd t
37 # cd t
38 # echo a > a
38 # echo a > a
39 # ln -s a sym
39 # ln -s a sym
40 # hg add sym
40 # hg add sym
41 # hg ci -m addsym -u mercurial
41 # hg ci -m addsym -u mercurial
42 # hg bundle --base null ../test-keyword.hg
42 # hg bundle --base null ../test-keyword.hg
43 #
43 #
44 hg pull -u "$TESTDIR/test-keyword.hg" \
44 hg pull -u "$TESTDIR/test-keyword.hg" \
45 | sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'
45 | sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'
46
46
47 echo 'expand $Id$' > a
47 echo 'expand $Id$' > a
48 echo 'do not process $Id:' >> a
48 echo 'do not process $Id:' >> a
49 echo 'xxx $' >> a
49 echo 'xxx $' >> a
50 echo 'ignore $Id$' > b
50 echo 'ignore $Id$' > b
51 echo % cat
51 echo % cat
52 cat a b
52 cat a b
53
53
54 echo % addremove
54 echo % addremove
55 hg addremove
55 hg addremove
56 echo % status
56 echo % status
57 hg status
57 hg status
58
58
59 echo % default keyword expansion including commit hook
59 echo % default keyword expansion including commit hook
60 echo % interrupted commit should not change state or run commit hook
60 echo % interrupted commit should not change state or run commit hook
61 hg --debug commit
61 hg --debug commit
62 echo % status
62 echo % status
63 hg status
63 hg status
64
64
65 echo % commit
65 echo % commit
66 hg --debug commit -mabsym -d '0 0' -u 'User Name <user@example.com>'
66 hg --debug commit -mabsym -u 'User Name <user@example.com>'
67 echo % status
67 echo % status
68 hg status
68 hg status
69 echo % identify
69 echo % identify
70 hg debugrebuildstate
70 hg debugrebuildstate
71 hg --quiet identify
71 hg --quiet identify
72 echo % cat
72 echo % cat
73 cat a b
73 cat a b
74 echo % hg cat
74 echo % hg cat
75 hg cat sym a b
75 hg cat sym a b
76
76
77 echo
77 echo
78 echo % diff a hooktest
78 echo % diff a hooktest
79 diff a hooktest
79 diff a hooktest
80
80
81 echo % removing commit hook from config
81 echo % removing commit hook from config
82 sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nohook
82 sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nohook
83 mv $HGRCPATH.nohook $HGRCPATH
83 mv $HGRCPATH.nohook $HGRCPATH
84 rm hooktest
84 rm hooktest
85
85
86 echo % bundle
86 echo % bundle
87 hg bundle --base null ../kw.hg
87 hg bundle --base null ../kw.hg
88
88
89 cd ..
89 cd ..
90 hg init Test
90 hg init Test
91 cd Test
91 cd Test
92
92
93 echo % notify on pull to check whether keywords stay as is in email
93 echo % notify on pull to check whether keywords stay as is in email
94 echo % ie. if patch.diff wrapper acts as it should
94 echo % ie. if patch.diff wrapper acts as it should
95
95
96 cat <<EOF >> $HGRCPATH
96 cat <<EOF >> $HGRCPATH
97 [hooks]
97 [hooks]
98 incoming.notify = python:hgext.notify.hook
98 incoming.notify = python:hgext.notify.hook
99 [notify]
99 [notify]
100 sources = pull
100 sources = pull
101 diffstat = False
101 diffstat = False
102 [reposubs]
102 [reposubs]
103 * = Test
103 * = Test
104 EOF
104 EOF
105
105
106 echo % pull from bundle
106 echo % pull from bundle
107 hg pull -u ../kw.hg 2>&1 | sed -e '/^Content-Type:/,/^diffs (/ d'
107 hg pull -u ../kw.hg 2>&1 | sed -e '/^Content-Type:/,/^diffs (/ d'
108
108
109 echo % remove notify config
109 echo % remove notify config
110 sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nonotify
110 sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nonotify
111 mv $HGRCPATH.nonotify $HGRCPATH
111 mv $HGRCPATH.nonotify $HGRCPATH
112
112
113 echo % touch
113 echo % touch
114 touch a b
114 touch a b
115 echo % status
115 echo % status
116 hg status
116 hg status
117
117
118 rm sym a b
118 rm sym a b
119 echo % update
119 echo % update
120 hg update
120 hg update
121 echo % cat
121 echo % cat
122 cat a b
122 cat a b
123
123
124 echo % check whether expansion is filewise
124 echo % check whether expansion is filewise
125 echo '$Id$' > c
125 echo '$Id$' > c
126 echo 'tests for different changenodes' >> c
126 echo 'tests for different changenodes' >> c
127 echo % commit c
127 echo % commit c
128 hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
128 hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
129 echo % force expansion
129 echo % force expansion
130 hg -v kwexpand
130 hg -v kwexpand
131 echo % compare changenodes in a c
131 echo % compare changenodes in a c
132 cat a c
132 cat a c
133
133
134 echo % qinit -c
134 echo % qinit -c
135 hg qinit -c
135 hg qinit -c
136 echo % qimport
136 echo % qimport
137 hg qimport -r tip -n mqtest.diff
137 hg qimport -r tip -n mqtest.diff
138 echo % qcommit
138 echo % qcommit
139 hg qcommit -mqtest
139 hg qcommit -mqtest
140 echo % keywords should not be expanded in patch
140 echo % keywords should not be expanded in patch
141 cat .hg/patches/mqtest.diff
141 cat .hg/patches/mqtest.diff
142 echo % qpop
142 echo % qpop
143 hg qpop
143 hg qpop
144 echo % qgoto - should imply qpush
144 echo % qgoto - should imply qpush
145 hg qgoto mqtest.diff
145 hg qgoto mqtest.diff
146 echo % cat
146 echo % cat
147 cat c
147 cat c
148 echo % qpop and move on
148 echo % qpop and move on
149 hg qpop
149 hg qpop
150
150
151 echo % copy
151 echo % copy
152 hg cp a c
152 hg cp a c
153
153
154 echo % kwfiles added
154 echo % kwfiles added
155 hg kwfiles
155 hg kwfiles
156
156
157 echo % commit
157 echo % commit
158 hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
158 hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
159 echo % cat a c
159 echo % cat a c
160 cat a c
160 cat a c
161 echo % touch copied c
161 echo % touch copied c
162 touch c
162 touch c
163 echo % status
163 echo % status
164 hg status
164 hg status
165
165
166 echo % kwfiles
166 echo % kwfiles
167 hg kwfiles
167 hg kwfiles
168
168
169 echo % diff --rev
169 echo % diff --rev
170 hg diff --rev 1 | grep -v 'b/c'
170 hg diff --rev 1 | grep -v 'b/c'
171
171
172 echo % rollback
172 echo % rollback
173 hg rollback
173 hg rollback
174 echo % status
174 echo % status
175 hg status
175 hg status
176 echo % update -C
176 echo % update -C
177 hg update --clean
177 hg update --clean
178
178
179 echo % custom keyword expansion
179 echo % custom keyword expansion
180 echo % try with kwdemo
180 echo % try with kwdemo
181 hg --quiet kwdemo "Xinfo = {author}: {desc}"
181 hg --quiet kwdemo "Xinfo = {author}: {desc}"
182
182
183 cat <<EOF >>$HGRCPATH
183 cat <<EOF >>$HGRCPATH
184 [keywordmaps]
184 [keywordmaps]
185 Id = {file} {node|short} {date|rfc822date} {author|user}
185 Id = {file} {node|short} {date|rfc822date} {author|user}
186 Xinfo = {author}: {desc}
186 Xinfo = {author}: {desc}
187 EOF
187 EOF
188
188
189 echo % cat
189 echo % cat
190 cat a b
190 cat a b
191 echo % hg cat
191 echo % hg cat
192 hg cat sym a b
192 hg cat sym a b
193
193
194 echo
194 echo
195 echo '$Xinfo$' >> a
195 echo '$Xinfo$' >> a
196 cat <<EOF >> log
196 cat <<EOF >> log
197 firstline
197 firstline
198 secondline
198 secondline
199 EOF
199 EOF
200
200
201 echo % interrupted commit should not change state
201 echo % interrupted commit should not change state
202 hg commit
202 hg commit
203 echo % status
203 echo % status
204 hg status
204 hg status
205
205
206 echo % commit
206 echo % commit
207 hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
207 hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
208 rm log
208 rm log
209 echo % status
209 echo % status
210 hg status
210 hg status
211 echo % verify
211 echo % verify
212 hg verify
212 hg verify
213
213
214 echo % cat
214 echo % cat
215 cat a b
215 cat a b
216 echo % hg cat
216 echo % hg cat
217 hg cat sym a b
217 hg cat sym a b
218 echo
218 echo
219 echo % annotate
219 echo % annotate
220 hg annotate a
220 hg annotate a
221
221
222 echo % remove
222 echo % remove
223 hg debugrebuildstate
223 hg debugrebuildstate
224 hg remove a
224 hg remove a
225 hg --debug commit -m rma
225 hg --debug commit -m rma
226 echo % status
226 echo % status
227 hg status
227 hg status
228 echo % rollback
228 echo % rollback
229 hg rollback
229 hg rollback
230 echo % status
230 echo % status
231 hg status
231 hg status
232 echo % revert a
232 echo % revert a
233 hg revert --no-backup --rev tip a
233 hg revert --no-backup --rev tip a
234 echo % cat a
234 echo % cat a
235 cat a
235 cat a
236
236
237 echo % clone to test incoming
237 echo % clone to test incoming
238 cd ..
238 cd ..
239 hg clone -r1 Test Test-a
239 hg clone -r1 Test Test-a
240 cd Test-a
240 cd Test-a
241 cat <<EOF >> .hg/hgrc
241 cat <<EOF >> .hg/hgrc
242 [paths]
242 [paths]
243 default = ../Test
243 default = ../Test
244 EOF
244 EOF
245 echo % incoming
245 echo % incoming
246 # remove path to temp dir
246 # remove path to temp dir
247 hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
247 hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
248
248
249 sed -e 's/Id.*/& rejecttest/' a > a.new
249 sed -e 's/Id.*/& rejecttest/' a > a.new
250 mv a.new a
250 mv a.new a
251 echo % commit rejecttest
251 echo % commit rejecttest
252 hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
252 hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
253 echo % export
253 echo % export
254 hg export -o ../rejecttest.diff tip
254 hg export -o ../rejecttest.diff tip
255
255
256 cd ../Test
256 cd ../Test
257 echo % import
257 echo % import
258 hg import ../rejecttest.diff
258 hg import ../rejecttest.diff
259 echo % cat
259 echo % cat
260 cat a b
260 cat a b
261 echo
261 echo
262 echo % rollback
262 echo % rollback
263 hg rollback
263 hg rollback
264 echo % clean update
264 echo % clean update
265 hg update --clean
265 hg update --clean
266
266
267 echo % kwexpand/kwshrink on selected files
267 echo % kwexpand/kwshrink on selected files
268 mkdir x
268 mkdir x
269 echo % copy a x/a
269 echo % copy a x/a
270 hg copy a x/a
270 hg copy a x/a
271 echo % kwexpand a
271 echo % kwexpand a
272 hg --verbose kwexpand a
272 hg --verbose kwexpand a
273 echo % kwexpand x/a should abort
273 echo % kwexpand x/a should abort
274 hg --verbose kwexpand x/a
274 hg --verbose kwexpand x/a
275 cd x
275 cd x
276 hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
276 hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
277 echo % cat a
277 echo % cat a
278 cat a
278 cat a
279 echo % kwshrink a inside directory x
279 echo % kwshrink a inside directory x
280 hg --verbose kwshrink a
280 hg --verbose kwshrink a
281 echo % cat a
281 echo % cat a
282 cat a
282 cat a
283 cd ..
283 cd ..
284
284
285 echo % kwexpand nonexistent
285 echo % kwexpand nonexistent
286 hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/'
286 hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/'
287
287
288 echo % hg serve
288 echo % hg serve
289 hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
289 hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
290 cat hg.pid >> $DAEMON_PIDS
290 cat hg.pid >> $DAEMON_PIDS
291 echo % expansion
291 echo % expansion
292 echo % hgweb file
292 echo % hgweb file
293 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw')
293 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw')
294 echo % no expansion
294 echo % no expansion
295 echo % hgweb annotate
295 echo % hgweb annotate
296 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw')
296 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw')
297 echo % hgweb changeset
297 echo % hgweb changeset
298 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw')
298 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw')
299 echo % hgweb filediff
299 echo % hgweb filediff
300 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw')
300 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw')
301 echo % errors encountered
301 echo % errors encountered
302 cat errors.log
302 cat errors.log
303
303
304 echo % merge/resolve
304 echo % merge/resolve
305 echo '$Id$' > m
305 echo '$Id$' > m
306 hg add m
306 hg add m
307 hg commit -m 4kw
307 hg commit -m 4kw
308 echo foo >> m
308 echo foo >> m
309 hg commit -m 5foo
309 hg commit -m 5foo
310 echo % simplemerge
310 echo % simplemerge
311 hg update 4
311 hg update 4
312 echo foo >> m
312 echo foo >> m
313 hg commit -m 6foo
313 hg commit -m 6foo
314 hg merge
314 hg merge
315 hg commit -m simplemerge
315 hg commit -m simplemerge
316 cat m
316 cat m
317 echo % conflict
317 echo % conflict
318 hg update 4
318 hg update 4
319 echo bar >> m
319 echo bar >> m
320 hg commit -m 8bar
320 hg commit -m 8bar
321 hg merge
321 hg merge
322 echo % keyword stays outside conflict zone
322 echo % keyword stays outside conflict zone
323 cat m
323 cat m
324 echo % resolve to local
324 echo % resolve to local
325 HGMERGE=internal:local hg resolve -a
325 HGMERGE=internal:local hg resolve -a
326 hg commit -m localresolve
326 hg commit -m localresolve
327 cat m
327 cat m
328
328
329 echo % switch off expansion
329 echo % switch off expansion
330 echo % kwshrink with unknown file u
330 echo % kwshrink with unknown file u
331 cp a u
331 cp a u
332 hg --verbose kwshrink
332 hg --verbose kwshrink
333 echo % cat
333 echo % cat
334 cat a b
334 cat a b
335 echo % hg cat
335 echo % hg cat
336 hg cat sym a b
336 hg cat sym a b
337 echo
337 echo
338 rm $HGRCPATH
338 rm $HGRCPATH
339 echo % cat
339 echo % cat
340 cat a b
340 cat a b
341 echo % hg cat
341 echo % hg cat
342 hg cat sym a b
342 hg cat sym a b
343 echo
343 echo
@@ -1,32 +1,32 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat > unix2mac.py <<EOF
3 cat > unix2mac.py <<EOF
4 import sys
4 import sys
5
5
6 for path in sys.argv[1:]:
6 for path in sys.argv[1:]:
7 data = file(path, 'rb').read()
7 data = file(path, 'rb').read()
8 data = data.replace('\n', '\r')
8 data = data.replace('\n', '\r')
9 file(path, 'wb').write(data)
9 file(path, 'wb').write(data)
10 EOF
10 EOF
11
11
12 cat > print.py <<EOF
12 cat > print.py <<EOF
13 import sys
13 import sys
14 print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
14 print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
15 EOF
15 EOF
16
16
17 hg init
17 hg init
18 echo '[hooks]' >> .hg/hgrc
18 echo '[hooks]' >> .hg/hgrc
19 echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
19 echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
20 echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
20 echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
21 cat .hg/hgrc
21 cat .hg/hgrc
22 echo
22 echo
23
23
24 echo hello > f
24 echo hello > f
25 hg add f
25 hg add f
26 hg ci -m 1 -d'0 0'
26 hg ci -m 1
27 echo
27 echo
28
28
29 python unix2mac.py f
29 python unix2mac.py f
30 hg ci -m 2 -d'0 0'
30 hg ci -m 2
31 hg cat f | python print.py
31 hg cat f | python print.py
32 cat f | python print.py
32 cat f | python print.py
@@ -1,74 +1,74 b''
1 #!/bin/sh
1 #!/bin/sh
2 # check that renames are correctly saved by a commit after a merge
2 # check that renames are correctly saved by a commit after a merge
3
3
4 # test with the merge on 3 having the rename on the local parent
4 # test with the merge on 3 having the rename on the local parent
5 hg init a
5 hg init a
6 cd a
6 cd a
7
7
8 echo line1 > foo
8 echo line1 > foo
9 hg add foo
9 hg add foo
10 hg ci -m '0: add foo' -d '0 0'
10 hg ci -m '0: add foo'
11
11
12 echo line2 >> foo
12 echo line2 >> foo
13 hg ci -m '1: change foo' -d '0 0'
13 hg ci -m '1: change foo'
14
14
15 hg up -C 0
15 hg up -C 0
16 hg mv foo bar
16 hg mv foo bar
17 rm bar
17 rm bar
18 echo line0 > bar
18 echo line0 > bar
19 echo line1 >> bar
19 echo line1 >> bar
20 hg ci -m '2: mv foo bar; change bar' -d '0 0'
20 hg ci -m '2: mv foo bar; change bar'
21
21
22 hg merge 1
22 hg merge 1
23 echo '% contents of bar should be line0 line1 line2'
23 echo '% contents of bar should be line0 line1 line2'
24 cat bar
24 cat bar
25 hg ci -m '3: merge with local rename' -d '0 0'
25 hg ci -m '3: merge with local rename'
26 hg debugindex .hg/store/data/bar.i
26 hg debugindex .hg/store/data/bar.i
27 hg debugrename bar
27 hg debugrename bar
28 hg debugindex .hg/store/data/foo.i
28 hg debugindex .hg/store/data/foo.i
29
29
30 # revert the content change from rev 2
30 # revert the content change from rev 2
31 hg up -C 2
31 hg up -C 2
32 rm bar
32 rm bar
33 echo line1 > bar
33 echo line1 > bar
34 hg ci -m '4: revert content change from rev 2' -d '0 0'
34 hg ci -m '4: revert content change from rev 2'
35
35
36 hg log --template '#rev#:#node|short# #parents#\n'
36 hg log --template '#rev#:#node|short# #parents#\n'
37 echo '% this should use bar@rev2 as the ancestor'
37 echo '% this should use bar@rev2 as the ancestor'
38 hg --debug merge 3
38 hg --debug merge 3
39 echo '% contents of bar should be line1 line2'
39 echo '% contents of bar should be line1 line2'
40 cat bar
40 cat bar
41 hg ci -m '5: merge' -d '0 0'
41 hg ci -m '5: merge'
42 hg debugindex .hg/store/data/bar.i
42 hg debugindex .hg/store/data/bar.i
43
43
44
44
45 # same thing, but with the merge on 3 having the rename on the remote parent
45 # same thing, but with the merge on 3 having the rename on the remote parent
46 echo
46 echo
47 echo
47 echo
48 cd ..
48 cd ..
49 hg clone -U -r 1 -r 2 a b
49 hg clone -U -r 1 -r 2 a b
50 cd b
50 cd b
51
51
52 hg up -C 1
52 hg up -C 1
53 hg merge 2
53 hg merge 2
54 echo '% contents of bar should be line0 line1 line2'
54 echo '% contents of bar should be line0 line1 line2'
55 cat bar
55 cat bar
56 hg ci -m '3: merge with remote rename' -d '0 0'
56 hg ci -m '3: merge with remote rename'
57 hg debugindex .hg/store/data/bar.i
57 hg debugindex .hg/store/data/bar.i
58 hg debugrename bar
58 hg debugrename bar
59 hg debugindex .hg/store/data/foo.i
59 hg debugindex .hg/store/data/foo.i
60
60
61 # revert the content change from rev 2
61 # revert the content change from rev 2
62 hg up -C 2
62 hg up -C 2
63 rm bar
63 rm bar
64 echo line1 > bar
64 echo line1 > bar
65 hg ci -m '4: revert content change from rev 2' -d '0 0'
65 hg ci -m '4: revert content change from rev 2'
66
66
67 hg log --template '#rev#:#node|short# #parents#\n'
67 hg log --template '#rev#:#node|short# #parents#\n'
68 echo '% this should use bar@rev2 as the ancestor'
68 echo '% this should use bar@rev2 as the ancestor'
69 hg --debug merge 3
69 hg --debug merge 3
70 echo '% contents of bar should be line1 line2'
70 echo '% contents of bar should be line1 line2'
71 cat bar
71 cat bar
72 hg ci -m '5: merge' -d '0 0'
72 hg ci -m '5: merge'
73 hg debugindex .hg/store/data/bar.i
73 hg debugindex .hg/store/data/bar.i
74
74
@@ -1,57 +1,57 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # test that we don't interrupt the merge session if
3 # test that we don't interrupt the merge session if
4 # a file-level merge failed
4 # a file-level merge failed
5
5
6 hg init repo
6 hg init repo
7 cd repo
7 cd repo
8
8
9 echo foo > foo
9 echo foo > foo
10 echo a > bar
10 echo a > bar
11 hg ci -Am 'add foo' -d '0 0'
11 hg ci -Am 'add foo'
12
12
13 hg mv foo baz
13 hg mv foo baz
14 echo b >> bar
14 echo b >> bar
15 echo quux > quux1
15 echo quux > quux1
16 hg ci -Am 'mv foo baz' -d '0 0'
16 hg ci -Am 'mv foo baz'
17
17
18 hg up -qC 0
18 hg up -qC 0
19 echo >> foo
19 echo >> foo
20 echo c >> bar
20 echo c >> bar
21 echo quux > quux2
21 echo quux > quux2
22 hg ci -Am 'change foo' -d '0 0'
22 hg ci -Am 'change foo'
23
23
24 # test with the rename on the remote side
24 # test with the rename on the remote side
25 HGMERGE=false hg merge
25 HGMERGE=false hg merge
26 hg resolve -l
26 hg resolve -l
27
27
28 # test with the rename on the local side
28 # test with the rename on the local side
29 hg up -C 1
29 hg up -C 1
30 HGMERGE=false hg merge
30 HGMERGE=false hg merge
31
31
32 echo % show unresolved
32 echo % show unresolved
33 hg resolve -l
33 hg resolve -l
34
34
35 echo % unmark baz
35 echo % unmark baz
36 hg resolve -u baz
36 hg resolve -u baz
37
37
38 echo % show
38 echo % show
39 hg resolve -l
39 hg resolve -l
40 hg st
40 hg st
41
41
42 echo % re-resolve baz
42 echo % re-resolve baz
43 hg resolve baz
43 hg resolve baz
44
44
45 echo % after
45 echo % after
46 hg resolve -l
46 hg resolve -l
47
47
48 echo % resolve all warning
48 echo % resolve all warning
49 hg resolve
49 hg resolve
50
50
51 echo % resolve all
51 echo % resolve all
52 hg resolve -a
52 hg resolve -a
53
53
54 echo % after
54 echo % after
55 hg resolve -l
55 hg resolve -l
56
56
57 true
57 true
@@ -1,517 +1,517 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 checkundo()
3 checkundo()
4 {
4 {
5 if [ -f .hg/store/undo ]; then
5 if [ -f .hg/store/undo ]; then
6 echo ".hg/store/undo still exists after $1"
6 echo ".hg/store/undo still exists after $1"
7 fi
7 fi
8 }
8 }
9
9
10 echo "[extensions]" >> $HGRCPATH
10 echo "[extensions]" >> $HGRCPATH
11 echo "mq=" >> $HGRCPATH
11 echo "mq=" >> $HGRCPATH
12
12
13 echo % help
13 echo % help
14 hg help mq
14 hg help mq
15
15
16 hg init a
16 hg init a
17 cd a
17 cd a
18 echo a > a
18 echo a > a
19 hg ci -Ama
19 hg ci -Ama
20
20
21 hg clone . ../k
21 hg clone . ../k
22
22
23 mkdir b
23 mkdir b
24 echo z > b/z
24 echo z > b/z
25 hg ci -Ama
25 hg ci -Ama
26
26
27 echo % qinit
27 echo % qinit
28
28
29 hg qinit
29 hg qinit
30
30
31 cd ..
31 cd ..
32 hg init b
32 hg init b
33
33
34 echo % -R qinit
34 echo % -R qinit
35
35
36 hg -R b qinit
36 hg -R b qinit
37
37
38 hg init c
38 hg init c
39
39
40 echo % qinit -c
40 echo % qinit -c
41
41
42 hg --cwd c qinit -c
42 hg --cwd c qinit -c
43 hg -R c/.hg/patches st
43 hg -R c/.hg/patches st
44
44
45 echo '% qinit; qinit -c'
45 echo '% qinit; qinit -c'
46 hg init d
46 hg init d
47 cd d
47 cd d
48 hg qinit
48 hg qinit
49 hg qinit -c
49 hg qinit -c
50 # qinit -c should create both files if they don't exist
50 # qinit -c should create both files if they don't exist
51 echo ' .hgignore:'
51 echo ' .hgignore:'
52 cat .hg/patches/.hgignore
52 cat .hg/patches/.hgignore
53 echo ' series:'
53 echo ' series:'
54 cat .hg/patches/series
54 cat .hg/patches/series
55 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
55 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
56 cd ..
56 cd ..
57
57
58 echo '% qinit; <stuff>; qinit -c'
58 echo '% qinit; <stuff>; qinit -c'
59 hg init e
59 hg init e
60 cd e
60 cd e
61 hg qnew A
61 hg qnew A
62 checkundo qnew
62 checkundo qnew
63 echo foo > foo
63 echo foo > foo
64 hg add foo
64 hg add foo
65 hg qrefresh
65 hg qrefresh
66 hg qnew B
66 hg qnew B
67 echo >> foo
67 echo >> foo
68 hg qrefresh
68 hg qrefresh
69 echo status >> .hg/patches/.hgignore
69 echo status >> .hg/patches/.hgignore
70 echo bleh >> .hg/patches/.hgignore
70 echo bleh >> .hg/patches/.hgignore
71 hg qinit -c
71 hg qinit -c
72 hg -R .hg/patches status
72 hg -R .hg/patches status
73 # qinit -c shouldn't touch these files if they already exist
73 # qinit -c shouldn't touch these files if they already exist
74 echo ' .hgignore:'
74 echo ' .hgignore:'
75 cat .hg/patches/.hgignore
75 cat .hg/patches/.hgignore
76 echo ' series:'
76 echo ' series:'
77 cat .hg/patches/series
77 cat .hg/patches/series
78 cd ..
78 cd ..
79
79
80 cd a
80 cd a
81
81
82 hg qnew -m 'foo bar' test.patch
82 hg qnew -m 'foo bar' test.patch
83
83
84 echo % qrefresh
84 echo % qrefresh
85
85
86 echo a >> a
86 echo a >> a
87 hg qrefresh
87 hg qrefresh
88 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
88 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
89 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
89 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
90 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
90 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
91
91
92 echo % empty qrefresh
92 echo % empty qrefresh
93
93
94 hg qrefresh -X a
94 hg qrefresh -X a
95 echo 'revision:'
95 echo 'revision:'
96 hg diff -r -2 -r -1
96 hg diff -r -2 -r -1
97 echo 'patch:'
97 echo 'patch:'
98 cat .hg/patches/test.patch
98 cat .hg/patches/test.patch
99 echo 'working dir diff:'
99 echo 'working dir diff:'
100 hg diff --nodates -q
100 hg diff --nodates -q
101 # restore things
101 # restore things
102 hg qrefresh
102 hg qrefresh
103 checkundo qrefresh
103 checkundo qrefresh
104
104
105 echo % qpop
105 echo % qpop
106
106
107 hg qpop
107 hg qpop
108 checkundo qpop
108 checkundo qpop
109
109
110 echo % qpush
110 echo % qpush
111
111
112 hg qpush
112 hg qpush
113 checkundo qpush
113 checkundo qpush
114
114
115 cd ..
115 cd ..
116
116
117 echo % pop/push outside repo
117 echo % pop/push outside repo
118
118
119 hg -R a qpop
119 hg -R a qpop
120 hg -R a qpush
120 hg -R a qpush
121
121
122 cd a
122 cd a
123 hg qnew test2.patch
123 hg qnew test2.patch
124
124
125 echo % qrefresh in subdir
125 echo % qrefresh in subdir
126
126
127 cd b
127 cd b
128 echo a > a
128 echo a > a
129 hg add a
129 hg add a
130 hg qrefresh
130 hg qrefresh
131
131
132 echo % pop/push -a in subdir
132 echo % pop/push -a in subdir
133
133
134 hg qpop -a
134 hg qpop -a
135 hg --traceback qpush -a
135 hg --traceback qpush -a
136
136
137 echo % qseries
137 echo % qseries
138 hg qseries
138 hg qseries
139 hg qpop
139 hg qpop
140 hg qseries -vs
140 hg qseries -vs
141 hg qpush
141 hg qpush
142
142
143 echo % qapplied
143 echo % qapplied
144 hg qapplied
144 hg qapplied
145
145
146 echo % qtop
146 echo % qtop
147 hg qtop
147 hg qtop
148
148
149 echo % qprev
149 echo % qprev
150 hg qprev
150 hg qprev
151
151
152 echo % qnext
152 echo % qnext
153 hg qnext
153 hg qnext
154
154
155 echo % pop, qnext, qprev, qapplied
155 echo % pop, qnext, qprev, qapplied
156 hg qpop
156 hg qpop
157 hg qnext
157 hg qnext
158 hg qprev
158 hg qprev
159 hg qapplied
159 hg qapplied
160
160
161 echo % commit should fail
161 echo % commit should fail
162 hg commit
162 hg commit
163
163
164 echo % push should fail
164 echo % push should fail
165 hg push ../../k
165 hg push ../../k
166
166
167 echo % import should fail
167 echo % import should fail
168 hg st .
168 hg st .
169 echo foo >> ../a
169 echo foo >> ../a
170 hg diff > ../../import.diff
170 hg diff > ../../import.diff
171 hg revert --no-backup ../a
171 hg revert --no-backup ../a
172 hg import ../../import.diff
172 hg import ../../import.diff
173 hg st
173 hg st
174
174
175 echo % qunapplied
175 echo % qunapplied
176 hg qunapplied
176 hg qunapplied
177
177
178 echo % qpush/qpop with index
178 echo % qpush/qpop with index
179 hg qnew test1b.patch
179 hg qnew test1b.patch
180 echo 1b > 1b
180 echo 1b > 1b
181 hg add 1b
181 hg add 1b
182 hg qrefresh
182 hg qrefresh
183 hg qpush 2
183 hg qpush 2
184 hg qpop 0
184 hg qpop 0
185 hg qpush test.patch+1
185 hg qpush test.patch+1
186 hg qpush test.patch+2
186 hg qpush test.patch+2
187 hg qpop test2.patch-1
187 hg qpop test2.patch-1
188 hg qpop test2.patch-2
188 hg qpop test2.patch-2
189 hg qpush test1b.patch+1
189 hg qpush test1b.patch+1
190
190
191 echo % push should succeed
191 echo % push should succeed
192 hg qpop -a
192 hg qpop -a
193 hg push ../../k
193 hg push ../../k
194
194
195 echo % qpush/qpop error codes
195 echo % qpush/qpop error codes
196 errorcode()
196 errorcode()
197 {
197 {
198 hg "$@" && echo " $@ succeeds" || echo " $@ fails"
198 hg "$@" && echo " $@ succeeds" || echo " $@ fails"
199 }
199 }
200
200
201 # we want to start with some patches applied
201 # we want to start with some patches applied
202 hg qpush -a
202 hg qpush -a
203 echo " % pops all patches and succeeds"
203 echo " % pops all patches and succeeds"
204 errorcode qpop -a
204 errorcode qpop -a
205 echo " % does nothing and succeeds"
205 echo " % does nothing and succeeds"
206 errorcode qpop -a
206 errorcode qpop -a
207 echo " % fails - nothing else to pop"
207 echo " % fails - nothing else to pop"
208 errorcode qpop
208 errorcode qpop
209 echo " % pushes a patch and succeeds"
209 echo " % pushes a patch and succeeds"
210 errorcode qpush
210 errorcode qpush
211 echo " % pops a patch and succeeds"
211 echo " % pops a patch and succeeds"
212 errorcode qpop
212 errorcode qpop
213 echo " % pushes up to test1b.patch and succeeds"
213 echo " % pushes up to test1b.patch and succeeds"
214 errorcode qpush test1b.patch
214 errorcode qpush test1b.patch
215 echo " % does nothing and succeeds"
215 echo " % does nothing and succeeds"
216 errorcode qpush test1b.patch
216 errorcode qpush test1b.patch
217 echo " % does nothing and succeeds"
217 echo " % does nothing and succeeds"
218 errorcode qpop test1b.patch
218 errorcode qpop test1b.patch
219 echo " % fails - can't push to this patch"
219 echo " % fails - can't push to this patch"
220 errorcode qpush test.patch
220 errorcode qpush test.patch
221 echo " % fails - can't pop to this patch"
221 echo " % fails - can't pop to this patch"
222 errorcode qpop test2.patch
222 errorcode qpop test2.patch
223 echo " % pops up to test.patch and succeeds"
223 echo " % pops up to test.patch and succeeds"
224 errorcode qpop test.patch
224 errorcode qpop test.patch
225 echo " % pushes all patches and succeeds"
225 echo " % pushes all patches and succeeds"
226 errorcode qpush -a
226 errorcode qpush -a
227 echo " % does nothing and succeeds"
227 echo " % does nothing and succeeds"
228 errorcode qpush -a
228 errorcode qpush -a
229 echo " % fails - nothing else to push"
229 echo " % fails - nothing else to push"
230 errorcode qpush
230 errorcode qpush
231 echo " % does nothing and succeeds"
231 echo " % does nothing and succeeds"
232 errorcode qpush test2.patch
232 errorcode qpush test2.patch
233
233
234
234
235 echo % strip
235 echo % strip
236 cd ../../b
236 cd ../../b
237 echo x>x
237 echo x>x
238 hg ci -Ama
238 hg ci -Ama
239 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
239 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
240 hg unbundle .hg/strip-backup/*
240 hg unbundle .hg/strip-backup/*
241
241
242 echo % strip with local changes, should complain
242 echo % strip with local changes, should complain
243 hg up
243 hg up
244 echo y>y
244 echo y>y
245 hg add y
245 hg add y
246 hg strip tip | sed 's/\(saving bundle to \).*/\1/'
246 hg strip tip | sed 's/\(saving bundle to \).*/\1/'
247 echo % --force strip with local changes
247 echo % --force strip with local changes
248 hg strip -f tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
248 hg strip -f tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
249
249
250 echo '% cd b; hg qrefresh'
250 echo '% cd b; hg qrefresh'
251 hg init refresh
251 hg init refresh
252 cd refresh
252 cd refresh
253 echo a > a
253 echo a > a
254 hg ci -Ama -d'0 0'
254 hg ci -Ama
255 hg qnew -mfoo foo
255 hg qnew -mfoo foo
256 echo a >> a
256 echo a >> a
257 hg qrefresh
257 hg qrefresh
258 mkdir b
258 mkdir b
259 cd b
259 cd b
260 echo f > f
260 echo f > f
261 hg add f
261 hg add f
262 hg qrefresh
262 hg qrefresh
263 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
263 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
264 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
264 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
265 echo % hg qrefresh .
265 echo % hg qrefresh .
266 hg qrefresh .
266 hg qrefresh .
267 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
267 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
268 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
268 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
269 hg status
269 hg status
270
270
271 echo % qpush failure
271 echo % qpush failure
272 cd ..
272 cd ..
273 hg qrefresh
273 hg qrefresh
274 hg qnew -mbar bar
274 hg qnew -mbar bar
275 echo foo > foo
275 echo foo > foo
276 echo bar > bar
276 echo bar > bar
277 hg add foo bar
277 hg add foo bar
278 hg qrefresh
278 hg qrefresh
279 hg qpop -a
279 hg qpop -a
280 echo bar > foo
280 echo bar > foo
281 hg qpush -a
281 hg qpush -a
282 hg st
282 hg st
283
283
284 echo % mq tags
284 echo % mq tags
285 hg log --template '{rev} {tags}\n' -r qparent:qtip
285 hg log --template '{rev} {tags}\n' -r qparent:qtip
286
286
287 echo % bad node in status
287 echo % bad node in status
288 hg qpop
288 hg qpop
289 hg strip -qn tip
289 hg strip -qn tip
290 hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/'
290 hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/'
291 hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/'
291 hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/'
292 hg qpop 2>&1 | sed -e 's/unknown node .*/unknown node/'
292 hg qpop 2>&1 | sed -e 's/unknown node .*/unknown node/'
293
293
294 cat >>$HGRCPATH <<EOF
294 cat >>$HGRCPATH <<EOF
295 [diff]
295 [diff]
296 git = True
296 git = True
297 EOF
297 EOF
298 cd ..
298 cd ..
299 hg init git
299 hg init git
300 cd git
300 cd git
301 hg qinit
301 hg qinit
302
302
303 hg qnew -m'new file' new
303 hg qnew -m'new file' new
304 echo foo > new
304 echo foo > new
305 chmod +x new
305 chmod +x new
306 hg add new
306 hg add new
307 hg qrefresh
307 hg qrefresh
308 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
308 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
309 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
309 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
310
310
311 hg qnew -m'copy file' copy
311 hg qnew -m'copy file' copy
312 hg cp new copy
312 hg cp new copy
313 hg qrefresh
313 hg qrefresh
314 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
314 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
315 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
315 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
316
316
317 hg qpop
317 hg qpop
318 hg qpush
318 hg qpush
319 hg qdiff
319 hg qdiff
320 cat >>$HGRCPATH <<EOF
320 cat >>$HGRCPATH <<EOF
321 [diff]
321 [diff]
322 git = False
322 git = False
323 EOF
323 EOF
324 hg qdiff --git
324 hg qdiff --git
325
325
326 cd ..
326 cd ..
327 hg init slow
327 hg init slow
328 cd slow
328 cd slow
329 hg qinit
329 hg qinit
330 echo foo > foo
330 echo foo > foo
331 hg add foo
331 hg add foo
332 hg ci -m 'add foo'
332 hg ci -m 'add foo'
333 hg qnew bar
333 hg qnew bar
334 echo bar > bar
334 echo bar > bar
335 hg add bar
335 hg add bar
336 hg mv foo baz
336 hg mv foo baz
337 hg qrefresh --git
337 hg qrefresh --git
338 hg up -C 0
338 hg up -C 0
339 echo >> foo
339 echo >> foo
340 hg ci -m 'change foo'
340 hg ci -m 'change foo'
341 hg up -C 1
341 hg up -C 1
342 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
342 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
343 cat .hg/patches/bar
343 cat .hg/patches/bar
344 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
344 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
345 hg qrefresh --git
345 hg qrefresh --git
346 cat .hg/patches/bar
346 cat .hg/patches/bar
347 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
347 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
348 hg qrefresh
348 hg qrefresh
349 grep 'diff --git' .hg/patches/bar
349 grep 'diff --git' .hg/patches/bar
350
350
351 echo
351 echo
352 hg up -C 1
352 hg up -C 1
353 echo >> foo
353 echo >> foo
354 hg ci -m 'change foo again'
354 hg ci -m 'change foo again'
355 hg up -C 2
355 hg up -C 2
356 hg mv bar quux
356 hg mv bar quux
357 hg mv baz bleh
357 hg mv baz bleh
358 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
358 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
359 cat .hg/patches/bar
359 cat .hg/patches/bar
360 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
360 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
361 hg mv quux fred
361 hg mv quux fred
362 hg mv bleh barney
362 hg mv bleh barney
363 hg qrefresh --git
363 hg qrefresh --git
364 cat .hg/patches/bar
364 cat .hg/patches/bar
365 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
365 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
366
366
367 echo % refresh omitting an added file
367 echo % refresh omitting an added file
368 hg qnew baz
368 hg qnew baz
369 echo newfile > newfile
369 echo newfile > newfile
370 hg add newfile
370 hg add newfile
371 hg qrefresh
371 hg qrefresh
372 hg st -A newfile
372 hg st -A newfile
373 hg qrefresh -X newfile
373 hg qrefresh -X newfile
374 hg st -A newfile
374 hg st -A newfile
375 hg revert newfile
375 hg revert newfile
376 rm newfile
376 rm newfile
377 hg qpop
377 hg qpop
378 hg qdel baz
378 hg qdel baz
379
379
380 echo % create a git patch
380 echo % create a git patch
381 echo a > alexander
381 echo a > alexander
382 hg add alexander
382 hg add alexander
383 hg qnew -f --git addalexander
383 hg qnew -f --git addalexander
384 grep diff .hg/patches/addalexander
384 grep diff .hg/patches/addalexander
385
385
386 echo % create a git binary patch
386 echo % create a git binary patch
387 cat > writebin.py <<EOF
387 cat > writebin.py <<EOF
388 import sys
388 import sys
389 path = sys.argv[1]
389 path = sys.argv[1]
390 open(path, 'wb').write('BIN\x00ARY')
390 open(path, 'wb').write('BIN\x00ARY')
391 EOF
391 EOF
392 python writebin.py bucephalus
392 python writebin.py bucephalus
393
393
394 python "$TESTDIR/md5sum.py" bucephalus
394 python "$TESTDIR/md5sum.py" bucephalus
395 hg add bucephalus
395 hg add bucephalus
396 hg qnew -f --git addbucephalus
396 hg qnew -f --git addbucephalus
397 grep diff .hg/patches/addbucephalus
397 grep diff .hg/patches/addbucephalus
398
398
399 echo % check binary patches can be popped and pushed
399 echo % check binary patches can be popped and pushed
400 hg qpop
400 hg qpop
401 test -f bucephalus && echo % bucephalus should not be there
401 test -f bucephalus && echo % bucephalus should not be there
402 hg qpush
402 hg qpush
403 test -f bucephalus || echo % bucephalus should be there
403 test -f bucephalus || echo % bucephalus should be there
404 python "$TESTDIR/md5sum.py" bucephalus
404 python "$TESTDIR/md5sum.py" bucephalus
405
405
406
406
407 echo '% strip again'
407 echo '% strip again'
408 cd ..
408 cd ..
409 hg init strip
409 hg init strip
410 cd strip
410 cd strip
411 touch foo
411 touch foo
412 hg add foo
412 hg add foo
413 hg ci -m 'add foo' -d '0 0'
413 hg ci -m 'add foo'
414 echo >> foo
414 echo >> foo
415 hg ci -m 'change foo 1' -d '0 0'
415 hg ci -m 'change foo 1'
416 hg up -C 0
416 hg up -C 0
417 echo 1 >> foo
417 echo 1 >> foo
418 hg ci -m 'change foo 2' -d '0 0'
418 hg ci -m 'change foo 2'
419 HGMERGE=true hg merge
419 HGMERGE=true hg merge
420 hg ci -m merge -d '0 0'
420 hg ci -m merge
421 hg log
421 hg log
422 hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
422 hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
423 checkundo strip
423 checkundo strip
424 hg log
424 hg log
425 cd ..
425 cd ..
426
426
427 echo '% qclone'
427 echo '% qclone'
428 qlog()
428 qlog()
429 {
429 {
430 echo 'main repo:'
430 echo 'main repo:'
431 hg log --template ' rev {rev}: {desc}\n'
431 hg log --template ' rev {rev}: {desc}\n'
432 echo 'patch repo:'
432 echo 'patch repo:'
433 hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
433 hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
434 }
434 }
435 hg init qclonesource
435 hg init qclonesource
436 cd qclonesource
436 cd qclonesource
437 echo foo > foo
437 echo foo > foo
438 hg add foo
438 hg add foo
439 hg ci -m 'add foo'
439 hg ci -m 'add foo'
440 hg qinit
440 hg qinit
441 hg qnew patch1
441 hg qnew patch1
442 echo bar >> foo
442 echo bar >> foo
443 hg qrefresh -m 'change foo'
443 hg qrefresh -m 'change foo'
444 cd ..
444 cd ..
445
445
446 # repo with unversioned patch dir
446 # repo with unversioned patch dir
447 hg qclone qclonesource failure
447 hg qclone qclonesource failure
448
448
449 cd qclonesource
449 cd qclonesource
450 hg qinit -c
450 hg qinit -c
451 hg qci -m checkpoint
451 hg qci -m checkpoint
452 qlog
452 qlog
453 cd ..
453 cd ..
454
454
455 # repo with patches applied
455 # repo with patches applied
456 hg qclone qclonesource qclonedest
456 hg qclone qclonesource qclonedest
457 cd qclonedest
457 cd qclonedest
458 qlog
458 qlog
459 cd ..
459 cd ..
460
460
461 # repo with patches unapplied
461 # repo with patches unapplied
462 cd qclonesource
462 cd qclonesource
463 hg qpop -a
463 hg qpop -a
464 qlog
464 qlog
465 cd ..
465 cd ..
466 hg qclone qclonesource qclonedest2
466 hg qclone qclonesource qclonedest2
467 cd qclonedest2
467 cd qclonedest2
468 qlog
468 qlog
469 cd ..
469 cd ..
470
470
471 echo % 'test applying on an empty file (issue 1033)'
471 echo % 'test applying on an empty file (issue 1033)'
472 hg init empty
472 hg init empty
473 cd empty
473 cd empty
474 touch a
474 touch a
475 hg ci -Am addempty
475 hg ci -Am addempty
476 echo a > a
476 echo a > a
477 hg qnew -f -e changea
477 hg qnew -f -e changea
478 hg qpop
478 hg qpop
479 hg qpush
479 hg qpush
480 cd ..
480 cd ..
481
481
482 echo % test qpush with --force, issue1087
482 echo % test qpush with --force, issue1087
483 hg init forcepush
483 hg init forcepush
484 cd forcepush
484 cd forcepush
485 echo hello > hello.txt
485 echo hello > hello.txt
486 echo bye > bye.txt
486 echo bye > bye.txt
487 hg ci -Ama
487 hg ci -Ama
488 hg qnew -d '0 0' empty
488 hg qnew -d '0 0' empty
489 hg qpop
489 hg qpop
490 echo world >> hello.txt
490 echo world >> hello.txt
491
491
492 echo % qpush should fail, local changes
492 echo % qpush should fail, local changes
493 hg qpush
493 hg qpush
494
494
495 echo % apply force, should not discard changes with empty patch
495 echo % apply force, should not discard changes with empty patch
496 hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g'
496 hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g'
497 hg diff --config diff.nodates=True
497 hg diff --config diff.nodates=True
498 hg qdiff --config diff.nodates=True
498 hg qdiff --config diff.nodates=True
499 hg log -l1 -p
499 hg log -l1 -p
500 hg qref -d '0 0'
500 hg qref -d '0 0'
501 hg qpop
501 hg qpop
502 echo universe >> hello.txt
502 echo universe >> hello.txt
503 echo universe >> bye.txt
503 echo universe >> bye.txt
504
504
505 echo % qpush should fail, local changes
505 echo % qpush should fail, local changes
506 hg qpush
506 hg qpush
507
507
508 echo % apply force, should discard changes in hello, but not bye
508 echo % apply force, should discard changes in hello, but not bye
509 hg qpush -f
509 hg qpush -f
510 hg st
510 hg st
511 hg diff --config diff.nodates=True
511 hg diff --config diff.nodates=True
512 hg qdiff --config diff.nodates=True
512 hg qdiff --config diff.nodates=True
513
513
514 echo % test popping revisions not in working dir ancestry
514 echo % test popping revisions not in working dir ancestry
515 hg qseries -v
515 hg qseries -v
516 hg up qparent
516 hg up qparent
517 hg qpop
517 hg qpop
@@ -1,43 +1,43 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # Test that qpush cleans things up if it doesn't complete
3 # Test that qpush cleans things up if it doesn't complete
4
4
5 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "mq=" >> $HGRCPATH
6 echo "mq=" >> $HGRCPATH
7
7
8 hg init repo
8 hg init repo
9 cd repo
9 cd repo
10
10
11 echo foo > foo
11 echo foo > foo
12 hg ci -Am 'add foo' -d '0 0'
12 hg ci -Am 'add foo'
13
13
14 touch untracked-file
14 touch untracked-file
15 echo 'syntax: glob' > .hgignore
15 echo 'syntax: glob' > .hgignore
16 echo '.hgignore' >> .hgignore
16 echo '.hgignore' >> .hgignore
17
17
18 hg qinit
18 hg qinit
19 hg qnew patch1
19 hg qnew patch1
20 echo >> foo
20 echo >> foo
21 hg qrefresh -m 'patch 1'
21 hg qrefresh -m 'patch 1'
22
22
23 hg qnew patch2
23 hg qnew patch2
24 echo bar > bar
24 echo bar > bar
25 hg add bar
25 hg add bar
26 hg qrefresh -m 'patch 2'
26 hg qrefresh -m 'patch 2'
27
27
28 hg qnew bad-patch
28 hg qnew bad-patch
29 echo >> foo
29 echo >> foo
30 hg qrefresh
30 hg qrefresh
31
31
32 hg qpop -a
32 hg qpop -a
33
33
34 python -c 'print "\xe9"' > message
34 python -c 'print "\xe9"' > message
35 cat .hg/patches/bad-patch >> message
35 cat .hg/patches/bad-patch >> message
36 mv message .hg/patches/bad-patch
36 mv message .hg/patches/bad-patch
37
37
38 hg qpush -a && echo 'qpush succeded?!'
38 hg qpush -a && echo 'qpush succeded?!'
39
39
40 hg parents
40 hg parents
41
41
42 echo '% bar should be gone; other unknown/ignored files should still be around'
42 echo '% bar should be gone; other unknown/ignored files should still be around'
43 hg status -A
43 hg status -A
@@ -1,68 +1,68 b''
1 #!/bin/sh
1 #!/bin/sh
2 # Tests if hgweb can run without touching sys.stdin, as is required
2 # Tests if hgweb can run without touching sys.stdin, as is required
3 # by the WSGI standard and strictly implemented by mod_wsgi.
3 # by the WSGI standard and strictly implemented by mod_wsgi.
4
4
5 mkdir repo
5 mkdir repo
6 cd repo
6 cd repo
7 hg init
7 hg init
8 echo foo > bar
8 echo foo > bar
9 hg add bar
9 hg add bar
10 hg commit -m "test" -d "0 0"
10 hg commit -m "test"
11 hg tip
11 hg tip
12
12
13 cat > request.py <<EOF
13 cat > request.py <<EOF
14 from mercurial import dispatch
14 from mercurial import dispatch
15 from mercurial.hgweb.hgweb_mod import hgweb
15 from mercurial.hgweb.hgweb_mod import hgweb
16 from mercurial.ui import ui
16 from mercurial.ui import ui
17 from mercurial import hg
17 from mercurial import hg
18 from StringIO import StringIO
18 from StringIO import StringIO
19 import os, sys
19 import os, sys
20
20
21 class FileLike(object):
21 class FileLike(object):
22 def __init__(self, real):
22 def __init__(self, real):
23 self.real = real
23 self.real = real
24 def fileno(self):
24 def fileno(self):
25 print >> sys.__stdout__, 'FILENO'
25 print >> sys.__stdout__, 'FILENO'
26 return self.real.fileno()
26 return self.real.fileno()
27 def read(self):
27 def read(self):
28 print >> sys.__stdout__, 'READ'
28 print >> sys.__stdout__, 'READ'
29 return self.real.read()
29 return self.real.read()
30 def readline(self):
30 def readline(self):
31 print >> sys.__stdout__, 'READLINE'
31 print >> sys.__stdout__, 'READLINE'
32 return self.real.readline()
32 return self.real.readline()
33
33
34 sys.stdin = FileLike(sys.stdin)
34 sys.stdin = FileLike(sys.stdin)
35 errors = StringIO()
35 errors = StringIO()
36 input = StringIO()
36 input = StringIO()
37 output = StringIO()
37 output = StringIO()
38
38
39 def startrsp(headers, data):
39 def startrsp(headers, data):
40 print '---- HEADERS'
40 print '---- HEADERS'
41 print headers
41 print headers
42 print '---- DATA'
42 print '---- DATA'
43 print data
43 print data
44 return output.write
44 return output.write
45
45
46 env = {
46 env = {
47 'wsgi.version': (1, 0),
47 'wsgi.version': (1, 0),
48 'wsgi.url_scheme': 'http',
48 'wsgi.url_scheme': 'http',
49 'wsgi.errors': errors,
49 'wsgi.errors': errors,
50 'wsgi.input': input,
50 'wsgi.input': input,
51 'wsgi.multithread': False,
51 'wsgi.multithread': False,
52 'wsgi.multiprocess': False,
52 'wsgi.multiprocess': False,
53 'wsgi.run_once': False,
53 'wsgi.run_once': False,
54 'REQUEST_METHOD': 'GET',
54 'REQUEST_METHOD': 'GET',
55 'SCRIPT_NAME': '',
55 'SCRIPT_NAME': '',
56 'PATH_INFO': '',
56 'PATH_INFO': '',
57 'QUERY_STRING': '',
57 'QUERY_STRING': '',
58 'SERVER_NAME': '127.0.0.1',
58 'SERVER_NAME': '127.0.0.1',
59 'SERVER_PORT': os.environ['HGPORT'],
59 'SERVER_PORT': os.environ['HGPORT'],
60 'SERVER_PROTOCOL': 'HTTP/1.0'
60 'SERVER_PROTOCOL': 'HTTP/1.0'
61 }
61 }
62
62
63 hgweb('.')(env, startrsp)
63 hgweb('.')(env, startrsp)
64 print '---- ERRORS'
64 print '---- ERRORS'
65 print errors.getvalue()
65 print errors.getvalue()
66 EOF
66 EOF
67
67
68 python request.py
68 python request.py
@@ -1,69 +1,69 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 commit()
3 commit()
4 {
4 {
5 msg=$1
5 msg=$1
6 p1=$2
6 p1=$2
7 p2=$3
7 p2=$3
8
8
9 if [ "$p1" ]; then
9 if [ "$p1" ]; then
10 hg up -qC $p1
10 hg up -qC $p1
11 fi
11 fi
12
12
13 if [ "$p2" ]; then
13 if [ "$p2" ]; then
14 HGMERGE=true hg merge -q $p2
14 HGMERGE=true hg merge -q $p2
15 fi
15 fi
16
16
17 echo >> foo
17 echo >> foo
18
18
19 hg commit -d '0 0' -qAm "$msg"
19 hg commit -qAm "$msg"
20 }
20 }
21
21
22 hg init repo
22 hg init repo
23 cd repo
23 cd repo
24
24
25 echo '[extensions]' > .hg/hgrc
25 echo '[extensions]' > .hg/hgrc
26 echo 'hgext.parentrevspec =' >> .hg/hgrc
26 echo 'hgext.parentrevspec =' >> .hg/hgrc
27
27
28 commit '0: add foo'
28 commit '0: add foo'
29 commit '1: change foo 1'
29 commit '1: change foo 1'
30 commit '2: change foo 2a'
30 commit '2: change foo 2a'
31 commit '3: change foo 3a'
31 commit '3: change foo 3a'
32 commit '4: change foo 2b' 1
32 commit '4: change foo 2b' 1
33 commit '5: merge' 3 4
33 commit '5: merge' 3 4
34 commit '6: change foo again'
34 commit '6: change foo again'
35
35
36 hg log --template '#rev#:#node|short# #parents#\n'
36 hg log --template '#rev#:#node|short# #parents#\n'
37 echo
37 echo
38
38
39 lookup()
39 lookup()
40 {
40 {
41 for rev in "$@"; do
41 for rev in "$@"; do
42 printf "$rev: "
42 printf "$rev: "
43 hg id -nr $rev
43 hg id -nr $rev
44 done
44 done
45 true
45 true
46 }
46 }
47
47
48 tipnode=`hg id -ir tip`
48 tipnode=`hg id -ir tip`
49
49
50 echo 'should work with tag/branch/node/rev'
50 echo 'should work with tag/branch/node/rev'
51 for r in tip default $tipnode 6; do
51 for r in tip default $tipnode 6; do
52 lookup "$r^"
52 lookup "$r^"
53 done
53 done
54 echo
54 echo
55
55
56 echo 'some random lookups'
56 echo 'some random lookups'
57 lookup "6^^" "6^^^" "6^^^^" "6^^^^^" "6^^^^^^" "6^1" "6^2" "6^^2" "6^1^2" "6^^3"
57 lookup "6^^" "6^^^" "6^^^^" "6^^^^^" "6^^^^^^" "6^1" "6^2" "6^^2" "6^1^2" "6^^3"
58 lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2"
58 lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2"
59 echo
59 echo
60
60
61 echo 'with a tag "6^" pointing to rev 1'
61 echo 'with a tag "6^" pointing to rev 1'
62 hg tag -l -r 1 "6^"
62 hg tag -l -r 1 "6^"
63 lookup "6^" "6^1" "6~1" "6^^"
63 lookup "6^" "6^1" "6~1" "6^^"
64 echo
64 echo
65
65
66 echo 'with a tag "foo^bar" pointing to rev 2'
66 echo 'with a tag "foo^bar" pointing to rev 2'
67 hg tag -l -r 2 "foo^bar"
67 hg tag -l -r 2 "foo^bar"
68 lookup "foo^bar" "foo^bar^"
68 lookup "foo^bar" "foo^bar^"
69
69
@@ -1,36 +1,36 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cp "$TESTDIR"/printenv.py .
3 cp "$TESTDIR"/printenv.py .
4
4
5 hg init test
5 hg init test
6 cd test
6 cd test
7 echo a > a
7 echo a > a
8 hg ci -Ama -d '0 0'
8 hg ci -Ama
9
9
10 cd ..
10 cd ..
11 hg clone test test2
11 hg clone test test2
12 cd test2
12 cd test2
13 echo a >> a
13 echo a >> a
14 hg ci -mb -d '0 0'
14 hg ci -mb
15
15
16 echo % expect error, cloning not allowed
16 echo % expect error, cloning not allowed
17 echo '[web]' > .hg/hgrc
17 echo '[web]' > .hg/hgrc
18 echo 'allowpull = false' >> .hg/hgrc
18 echo 'allowpull = false' >> .hg/hgrc
19 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
19 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
20 cat hg.pid >> $DAEMON_PIDS
20 cat hg.pid >> $DAEMON_PIDS
21 hg clone http://localhost:$HGPORT/ test3 | sed -e 's,:[0-9][0-9]*/,/,'
21 hg clone http://localhost:$HGPORT/ test3 | sed -e 's,:[0-9][0-9]*/,/,'
22 "$TESTDIR/killdaemons.py"
22 "$TESTDIR/killdaemons.py"
23 echo % serve errors
23 echo % serve errors
24 cat errors.log
24 cat errors.log
25
25
26 req() {
26 req() {
27 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
27 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
28 cat hg.pid >> $DAEMON_PIDS
28 cat hg.pid >> $DAEMON_PIDS
29 hg --cwd ../test pull http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
29 hg --cwd ../test pull http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
30 kill `cat hg.pid`
30 kill `cat hg.pid`
31 echo % serve errors
31 echo % serve errors
32 cat errors.log
32 cat errors.log
33 }
33 }
34
34
35 echo % expect error, pulling not allowed
35 echo % expect error, pulling not allowed
36 req
36 req
@@ -1,30 +1,30 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init repo
3 hg init repo
4 cd repo
4 cd repo
5 echo foo > foo
5 echo foo > foo
6 hg ci -qAm 'add foo' -d '0 0'
6 hg ci -qAm 'add foo'
7 echo >> foo
7 echo >> foo
8 hg ci -m 'change foo' -d '0 0'
8 hg ci -m 'change foo'
9 hg up -qC 0
9 hg up -qC 0
10 echo bar > bar
10 echo bar > bar
11 hg ci -qAm 'add bar' -d '0 0'
11 hg ci -qAm 'add bar'
12 hg log
12 hg log
13 cd ..
13 cd ..
14 hg init copy
14 hg init copy
15 cd copy
15 cd copy
16
16
17 echo '% pull a missing revision'
17 echo '% pull a missing revision'
18 hg pull -qr missing ../repo
18 hg pull -qr missing ../repo
19
19
20 echo '% pull -r 0'
20 echo '% pull -r 0'
21 hg pull -qr 0 ../repo
21 hg pull -qr 0 ../repo
22 hg log
22 hg log
23
23
24 echo '% pull -r 1'
24 echo '% pull -r 1'
25 hg pull -qr 1 ../repo
25 hg pull -qr 1 ../repo
26 hg log
26 hg log
27
27
28 # this used to abort: received changelog group is empty
28 # this used to abort: received changelog group is empty
29 echo '% pull -r 1 again'
29 echo '% pull -r 1 again'
30 hg pull -qr 1 ../repo
30 hg pull -qr 1 ../repo
@@ -1,56 +1,56 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cp "$TESTDIR"/printenv.py .
3 cp "$TESTDIR"/printenv.py .
4
4
5 hg init test
5 hg init test
6 cd test
6 cd test
7 echo a > a
7 echo a > a
8 hg ci -Ama -d '0 0'
8 hg ci -Ama
9
9
10 cd ..
10 cd ..
11 hg clone test test2
11 hg clone test test2
12 cd test2
12 cd test2
13 echo a >> a
13 echo a >> a
14 hg ci -mb -d '0 0'
14 hg ci -mb
15
15
16 req() {
16 req() {
17 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
18 cat hg.pid >> $DAEMON_PIDS
18 cat hg.pid >> $DAEMON_PIDS
19 hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
19 hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
20 kill `cat hg.pid`
20 kill `cat hg.pid`
21 echo % serve errors
21 echo % serve errors
22 cat errors.log
22 cat errors.log
23 }
23 }
24
24
25 cd ../test
25 cd ../test
26
26
27 echo % expect ssl error
27 echo % expect ssl error
28 req
28 req
29
29
30 echo % expect authorization error
30 echo % expect authorization error
31 echo '[web]' > .hg/hgrc
31 echo '[web]' > .hg/hgrc
32 echo 'push_ssl = false' >> .hg/hgrc
32 echo 'push_ssl = false' >> .hg/hgrc
33 req
33 req
34
34
35 echo % expect authorization error: must have authorized user
35 echo % expect authorization error: must have authorized user
36 echo 'allow_push = unperson' >> .hg/hgrc
36 echo 'allow_push = unperson' >> .hg/hgrc
37 req
37 req
38
38
39 echo % expect success
39 echo % expect success
40 echo 'allow_push = *' >> .hg/hgrc
40 echo 'allow_push = *' >> .hg/hgrc
41 echo '[hooks]' >> .hg/hgrc
41 echo '[hooks]' >> .hg/hgrc
42 echo 'changegroup = python ../printenv.py changegroup 0 ../urls' >> .hg/hgrc
42 echo 'changegroup = python ../printenv.py changegroup 0 ../urls' >> .hg/hgrc
43 req
43 req
44
44
45 cat ../urls
45 cat ../urls
46
46
47 hg rollback
47 hg rollback
48 echo % expect authorization error: all users denied
48 echo % expect authorization error: all users denied
49 echo '[web]' > .hg/hgrc
49 echo '[web]' > .hg/hgrc
50 echo 'push_ssl = false' >> .hg/hgrc
50 echo 'push_ssl = false' >> .hg/hgrc
51 echo 'deny_push = *' >> .hg/hgrc
51 echo 'deny_push = *' >> .hg/hgrc
52 req
52 req
53
53
54 echo % expect authorization error: some users denied, users must be authenticated
54 echo % expect authorization error: some users denied, users must be authenticated
55 echo 'deny_push = unperson' >> .hg/hgrc
55 echo 'deny_push = unperson' >> .hg/hgrc
56 req
56 req
@@ -1,100 +1,100 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[ui]" >> $HGRCPATH
3 echo "[ui]" >> $HGRCPATH
4 echo "interactive=true" >> $HGRCPATH
4 echo "interactive=true" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "record=" >> $HGRCPATH
6 echo "record=" >> $HGRCPATH
7
7
8 echo "% help (no mq, so no qrecord)"
8 echo "% help (no mq, so no qrecord)"
9
9
10 hg help qrecord
10 hg help qrecord
11
11
12 echo "mq=" >> $HGRCPATH
12 echo "mq=" >> $HGRCPATH
13
13
14 echo "% help (mq present)"
14 echo "% help (mq present)"
15
15
16 hg help qrecord
16 hg help qrecord
17
17
18 hg init a
18 hg init a
19 cd a
19 cd a
20
20
21 echo % base commit
21 echo % base commit
22
22
23 cat > 1.txt <<EOF
23 cat > 1.txt <<EOF
24 1
24 1
25 2
25 2
26 3
26 3
27 4
27 4
28 5
28 5
29 EOF
29 EOF
30 cat > 2.txt <<EOF
30 cat > 2.txt <<EOF
31 a
31 a
32 b
32 b
33 c
33 c
34 d
34 d
35 e
35 e
36 f
36 f
37 EOF
37 EOF
38 mkdir dir
38 mkdir dir
39 cat > dir/a.txt <<EOF
39 cat > dir/a.txt <<EOF
40 hello world
40 hello world
41
41
42 someone
42 someone
43 up
43 up
44 there
44 there
45 loves
45 loves
46 me
46 me
47 EOF
47 EOF
48
48
49 hg add 1.txt 2.txt dir/a.txt
49 hg add 1.txt 2.txt dir/a.txt
50 hg commit -d '0 0' -m 'initial checkin'
50 hg commit -m 'initial checkin'
51
51
52 echo % changing files
52 echo % changing files
53
53
54 sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
54 sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
55 sed -e 's/b/b b/' 2.txt > 2.txt.new
55 sed -e 's/b/b b/' 2.txt > 2.txt.new
56 sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
56 sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
57
57
58 mv -f 1.txt.new 1.txt
58 mv -f 1.txt.new 1.txt
59 mv -f 2.txt.new 2.txt
59 mv -f 2.txt.new 2.txt
60 mv -f dir/a.txt.new dir/a.txt
60 mv -f dir/a.txt.new dir/a.txt
61
61
62 echo % whole diff
62 echo % whole diff
63
63
64 hg diff --nodates
64 hg diff --nodates
65
65
66 echo % qrecord a.patch
66 echo % qrecord a.patch
67
67
68 hg qrecord -d '0 0' -m aaa a.patch <<EOF
68 hg qrecord -d '0 0' -m aaa a.patch <<EOF
69 y
69 y
70 y
70 y
71 n
71 n
72 y
72 y
73 y
73 y
74 n
74 n
75 EOF
75 EOF
76
76
77 echo
77 echo
78 echo % "after qrecord a.patch 'tip'"
78 echo % "after qrecord a.patch 'tip'"
79 hg tip -p
79 hg tip -p
80 echo
80 echo
81 echo % "after qrecord a.patch 'diff'"
81 echo % "after qrecord a.patch 'diff'"
82 hg diff --nodates
82 hg diff --nodates
83
83
84 echo % qrecord b.patch
84 echo % qrecord b.patch
85 hg qrecord -d '0 0' -m bbb b.patch <<EOF
85 hg qrecord -d '0 0' -m bbb b.patch <<EOF
86 y
86 y
87 y
87 y
88 y
88 y
89 y
89 y
90 EOF
90 EOF
91
91
92 echo
92 echo
93 echo % "after qrecord b.patch 'tip'"
93 echo % "after qrecord b.patch 'tip'"
94 hg tip -p
94 hg tip -p
95 echo
95 echo
96 echo % "after qrecord b.patch 'diff'"
96 echo % "after qrecord b.patch 'diff'"
97 hg diff --nodates
97 hg diff --nodates
98
98
99 echo
99 echo
100 echo % --- end ---
100 echo % --- end ---
@@ -1,33 +1,33 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 mkdir t
3 mkdir t
4 cd t
4 cd t
5 hg init
5 hg init
6
6
7 mkdir a
7 mkdir a
8 echo foo > a/a
8 echo foo > a/a
9 echo bar > a/b
9 echo bar > a/b
10 hg ci -Am "0" -d "0 0"
10 hg ci -Am "0"
11
11
12 hg co -C 0
12 hg co -C 0
13 hg mv a b
13 hg mv a b
14 hg ci -m "1 mv a/ b/" -d "0 0"
14 hg ci -m "1 mv a/ b/"
15
15
16 hg co -C 0
16 hg co -C 0
17 echo baz > a/c
17 echo baz > a/c
18 echo quux > a/d
18 echo quux > a/d
19 hg add a/c
19 hg add a/c
20 hg ci -m "2 add a/c" -d "0 0"
20 hg ci -m "2 add a/c"
21
21
22 hg merge --debug 1
22 hg merge --debug 1
23 echo a/* b/*
23 echo a/* b/*
24 hg st -C
24 hg st -C
25 hg ci -m "3 merge 2+1" -d "0 0"
25 hg ci -m "3 merge 2+1"
26 hg debugrename b/c
26 hg debugrename b/c
27
27
28 hg co -C 1
28 hg co -C 1
29 hg merge --debug 2
29 hg merge --debug 2
30 echo a/* b/*
30 echo a/* b/*
31 hg st -C
31 hg st -C
32 hg ci -m "4 merge 1+2" -d "0 0"
32 hg ci -m "4 merge 1+2"
33 hg debugrename b/c
33 hg debugrename b/c
@@ -1,27 +1,27 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 mkdir t
3 mkdir t
4 cd t
4 cd t
5 hg init
5 hg init
6 echo "[merge]" >> .hg/hgrc
6 echo "[merge]" >> .hg/hgrc
7 echo "followcopies = 1" >> .hg/hgrc
7 echo "followcopies = 1" >> .hg/hgrc
8 echo foo > a
8 echo foo > a
9 echo foo > a2
9 echo foo > a2
10 hg add a a2
10 hg add a a2
11 hg ci -m "start" -d "0 0"
11 hg ci -m "start"
12 hg mv a b
12 hg mv a b
13 hg mv a2 b2
13 hg mv a2 b2
14 hg ci -m "rename" -d "0 0"
14 hg ci -m "rename"
15 echo "checkout"
15 echo "checkout"
16 hg co 0
16 hg co 0
17 echo blahblah > a
17 echo blahblah > a
18 echo blahblah > a2
18 echo blahblah > a2
19 hg mv a2 c2
19 hg mv a2 c2
20 hg ci -m "modify" -d "0 0"
20 hg ci -m "modify"
21 echo "merge"
21 echo "merge"
22 hg merge -y --debug
22 hg merge -y --debug
23 hg status -AC
23 hg status -AC
24 cat b
24 cat b
25 hg ci -m "merge" -d "0 0"
25 hg ci -m "merge"
26 hg debugindex .hg/store/data/b.i
26 hg debugindex .hg/store/data/b.i
27 hg debugrename b No newline at end of file
27 hg debugrename b
@@ -1,104 +1,104 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 mkdir -p t
3 mkdir -p t
4 cd t
4 cd t
5
5
6 cat <<EOF > merge
6 cat <<EOF > merge
7 import sys, os
7 import sys, os
8 f = open(sys.argv[1], "wb")
8 f = open(sys.argv[1], "wb")
9 f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3]))
9 f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3]))
10 f.close()
10 f.close()
11 EOF
11 EOF
12 HGMERGE="python ../merge"; export HGMERGE
12 HGMERGE="python ../merge"; export HGMERGE
13
13
14 # perform a test merge with possible renaming
14 # perform a test merge with possible renaming
15 #
15 #
16 # args:
16 # args:
17 # $1 = action in local branch
17 # $1 = action in local branch
18 # $2 = action in remote branch
18 # $2 = action in remote branch
19 # $3 = action in working dir
19 # $3 = action in working dir
20 # $4 = expected result
20 # $4 = expected result
21 tm()
21 tm()
22 {
22 {
23 mkdir t
23 mkdir t
24 cd t
24 cd t
25 hg init
25 hg init
26 echo "[merge]" >> .hg/hgrc
26 echo "[merge]" >> .hg/hgrc
27 echo "followcopies = 1" >> .hg/hgrc
27 echo "followcopies = 1" >> .hg/hgrc
28
28
29 # base
29 # base
30 echo base > a
30 echo base > a
31 echo base > rev # used to force commits
31 echo base > rev # used to force commits
32 hg add a rev
32 hg add a rev
33 hg ci -m "base" -d "0 0"
33 hg ci -m "base"
34
34
35 # remote
35 # remote
36 echo remote > rev
36 echo remote > rev
37 if [ "$2" != "" ] ; then $2 ; fi
37 if [ "$2" != "" ] ; then $2 ; fi
38 hg ci -m "remote" -d "0 0"
38 hg ci -m "remote"
39
39
40 # local
40 # local
41 hg co -q 0
41 hg co -q 0
42 echo local > rev
42 echo local > rev
43 if [ "$1" != "" ] ; then $1 ; fi
43 if [ "$1" != "" ] ; then $1 ; fi
44 hg ci -m "local" -d "0 0"
44 hg ci -m "local"
45
45
46 # working dir
46 # working dir
47 echo local > rev
47 echo local > rev
48 if [ "$3" != "" ] ; then $3 ; fi
48 if [ "$3" != "" ] ; then $3 ; fi
49
49
50 # merge
50 # merge
51 echo "--------------"
51 echo "--------------"
52 echo "test L:$1 R:$2 W:$3 - $4"
52 echo "test L:$1 R:$2 W:$3 - $4"
53 echo "--------------"
53 echo "--------------"
54 hg merge -y --debug --traceback
54 hg merge -y --debug --traceback
55
55
56 echo "--------------"
56 echo "--------------"
57 hg status -camC -X rev
57 hg status -camC -X rev
58
58
59 hg ci -m "merge" -d "0 0"
59 hg ci -m "merge"
60
60
61 echo "--------------"
61 echo "--------------"
62 echo
62 echo
63
63
64 cd ..
64 cd ..
65 rm -r t
65 rm -r t
66 }
66 }
67
67
68 up() {
68 up() {
69 cp rev $1
69 cp rev $1
70 hg add $1 2> /dev/null
70 hg add $1 2> /dev/null
71 if [ "$2" != "" ] ; then
71 if [ "$2" != "" ] ; then
72 cp rev $2
72 cp rev $2
73 hg add $2 2> /dev/null
73 hg add $2 2> /dev/null
74 fi
74 fi
75 }
75 }
76
76
77 uc() { up $1; hg cp $1 $2; } # update + copy
77 uc() { up $1; hg cp $1 $2; } # update + copy
78 um() { up $1; hg mv $1 $2; }
78 um() { up $1; hg mv $1 $2; }
79 nc() { hg cp $1 $2; } # just copy
79 nc() { hg cp $1 $2; } # just copy
80 nm() { hg mv $1 $2; } # just move
80 nm() { hg mv $1 $2; } # just move
81
81
82 tm "up a " "nc a b" " " "1 get local a to b"
82 tm "up a " "nc a b" " " "1 get local a to b"
83 tm "nc a b" "up a " " " "2 get rem change to a and b"
83 tm "nc a b" "up a " " " "2 get rem change to a and b"
84 tm "up a " "nm a b" " " "3 get local a change to b, remove a"
84 tm "up a " "nm a b" " " "3 get local a change to b, remove a"
85 tm "nm a b" "up a " " " "4 get remote change to b"
85 tm "nm a b" "up a " " " "4 get remote change to b"
86 tm " " "nc a b" " " "5 get b"
86 tm " " "nc a b" " " "5 get b"
87 tm "nc a b" " " " " "6 nothing"
87 tm "nc a b" " " " " "6 nothing"
88 tm " " "nm a b" " " "7 get b"
88 tm " " "nm a b" " " "7 get b"
89 tm "nm a b" " " " " "8 nothing"
89 tm "nm a b" " " " " "8 nothing"
90 tm "um a b" "um a b" " " "9 do merge with ancestor in a"
90 tm "um a b" "um a b" " " "9 do merge with ancestor in a"
91 #tm "um a c" "um x c" " " "10 do merge with no ancestor"
91 #tm "um a c" "um x c" " " "10 do merge with no ancestor"
92 tm "nm a b" "nm a c" " " "11 get c, keep b"
92 tm "nm a b" "nm a c" " " "11 get c, keep b"
93 tm "nc a b" "up b " " " "12 merge b no ancestor"
93 tm "nc a b" "up b " " " "12 merge b no ancestor"
94 tm "up b " "nm a b" " " "13 merge b no ancestor"
94 tm "up b " "nm a b" " " "13 merge b no ancestor"
95 tm "nc a b" "up a b" " " "14 merge b no ancestor"
95 tm "nc a b" "up a b" " " "14 merge b no ancestor"
96 tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
96 tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
97 tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
97 tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
98 tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
98 tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
99 tm "nm a b" "up a b" " " "18 merge b no ancestor"
99 tm "nm a b" "up a b" " " "18 merge b no ancestor"
100 tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
100 tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
101 tm "up a " "um a b" " " "20 merge a and b to b, remove a"
101 tm "up a " "um a b" " " "20 merge a and b to b, remove a"
102 tm "um a b" "up a " " " "21 merge a and b to b"
102 tm "um a b" "up a " " " "21 merge a and b to b"
103 #tm "nm a b" "um x a" " " "22 get a, keep b"
103 #tm "nm a b" "um x a" " " "22 get a, keep b"
104 tm "nm a b" "up a c" " " "23 get c, keep b"
104 tm "nm a b" "up a c" " " "23 get c, keep b"
@@ -1,27 +1,27 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # test that a commit clears the merge state.
3 # test that a commit clears the merge state.
4
4
5 hg init repo
5 hg init repo
6 cd repo
6 cd repo
7
7
8 echo foo > file
8 echo foo > file
9 hg commit -Am 'add file' -d '0 0'
9 hg commit -Am 'add file'
10
10
11 echo bar >> file
11 echo bar >> file
12 hg commit -Am 'append bar' -d '0 0'
12 hg commit -Am 'append bar'
13
13
14 echo % create a second head
14 echo % create a second head
15 hg up -C 0
15 hg up -C 0
16 echo baz >> file
16 echo baz >> file
17 hg commit -Am 'append baz' -d '0 0'
17 hg commit -Am 'append baz'
18
18
19 echo % failing merge
19 echo % failing merge
20 HGMERGE=internal:fail hg merge
20 HGMERGE=internal:fail hg merge
21
21
22 echo resolved > file
22 echo resolved > file
23 hg resolve -m file
23 hg resolve -m file
24 hg commit -m 'resolved' -d '0 0'
24 hg commit -m 'resolved'
25
25
26 echo % resolve -l, should be empty
26 echo % resolve -l, should be empty
27 hg resolve -l
27 hg resolve -l
@@ -1,18 +1,18 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init
3 hg init
4
4
5 echo a > a
5 echo a > a
6 hg ci -d '0 0' -Ama
6 hg ci -Ama
7
7
8 hg an a
8 hg an a
9
9
10 echo "[ui]" >> $HGRCPATH
10 echo "[ui]" >> $HGRCPATH
11 echo "strict=True" >> $HGRCPATH
11 echo "strict=True" >> $HGRCPATH
12
12
13 hg an a
13 hg an a
14 hg annotate a
14 hg annotate a
15
15
16 echo % should succeed - up is an alias, not an abbreviation
16 echo % should succeed - up is an alias, not an abbreviation
17
17
18 hg up
18 hg up
@@ -1,116 +1,116 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat <<EOF >> $HGRCPATH
3 cat <<EOF >> $HGRCPATH
4 [extensions]
4 [extensions]
5 transplant=
5 transplant=
6 EOF
6 EOF
7
7
8 hg init t
8 hg init t
9 cd t
9 cd t
10 echo r1 > r1
10 echo r1 > r1
11 hg ci -Amr1 -d'0 0'
11 hg ci -Amr1 -d'0 0'
12 echo r2 > r2
12 echo r2 > r2
13 hg ci -Amr2 -d'1 0'
13 hg ci -Amr2 -d'1 0'
14 hg up 0
14 hg up 0
15
15
16 echo b1 > b1
16 echo b1 > b1
17 hg ci -Amb1 -d '0 0'
17 hg ci -Amb1 -d '0 0'
18 echo b2 > b2
18 echo b2 > b2
19 hg ci -Amb2 -d '1 0'
19 hg ci -Amb2 -d '1 0'
20 echo b3 > b3
20 echo b3 > b3
21 hg ci -Amb3 -d '2 0'
21 hg ci -Amb3 -d '2 0'
22
22
23 hg log --template '{rev} {parents} {desc}\n'
23 hg log --template '{rev} {parents} {desc}\n'
24
24
25 hg clone . ../rebase
25 hg clone . ../rebase
26 cd ../rebase
26 cd ../rebase
27
27
28 hg up -C 1
28 hg up -C 1
29 echo '% rebase b onto r1'
29 echo '% rebase b onto r1'
30 hg transplant -a -b tip
30 hg transplant -a -b tip
31 hg log --template '{rev} {parents} {desc}\n'
31 hg log --template '{rev} {parents} {desc}\n'
32
32
33 hg clone ../t ../prune
33 hg clone ../t ../prune
34 cd ../prune
34 cd ../prune
35
35
36 hg up -C 1
36 hg up -C 1
37 echo '% rebase b onto r1, skipping b2'
37 echo '% rebase b onto r1, skipping b2'
38 hg transplant -a -b tip -p 3
38 hg transplant -a -b tip -p 3
39 hg log --template '{rev} {parents} {desc}\n'
39 hg log --template '{rev} {parents} {desc}\n'
40
40
41 echo '% remote transplant'
41 echo '% remote transplant'
42 hg clone -r 1 ../t ../remote
42 hg clone -r 1 ../t ../remote
43 cd ../remote
43 cd ../remote
44 hg transplant --log -s ../t 2 4
44 hg transplant --log -s ../t 2 4
45 hg log --template '{rev} {parents} {desc}\n'
45 hg log --template '{rev} {parents} {desc}\n'
46
46
47 echo '% skip previous transplants'
47 echo '% skip previous transplants'
48 hg transplant -s ../t -a -b 4
48 hg transplant -s ../t -a -b 4
49 hg log --template '{rev} {parents} {desc}\n'
49 hg log --template '{rev} {parents} {desc}\n'
50
50
51 echo '% skip local changes transplanted to the source'
51 echo '% skip local changes transplanted to the source'
52 echo b4 > b4
52 echo b4 > b4
53 hg ci -Amb4 -d '3 0'
53 hg ci -Amb4 -d '3 0'
54 hg clone ../t ../pullback
54 hg clone ../t ../pullback
55 cd ../pullback
55 cd ../pullback
56 hg transplant -s ../remote -a -b tip
56 hg transplant -s ../remote -a -b tip
57
57
58 echo '% remote transplant with pull'
58 echo '% remote transplant with pull'
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
60 cat ../t.pid >> $DAEMON_PIDS
60 cat ../t.pid >> $DAEMON_PIDS
61
61
62 hg clone -r 0 ../t ../rp
62 hg clone -r 0 ../t ../rp
63 cd ../rp
63 cd ../rp
64 hg transplant -s http://localhost:$HGPORT/ 2 4
64 hg transplant -s http://localhost:$HGPORT/ 2 4
65 hg log --template '{rev} {parents} {desc}\n'
65 hg log --template '{rev} {parents} {desc}\n'
66
66
67 echo '% transplant --continue'
67 echo '% transplant --continue'
68 hg init ../tc
68 hg init ../tc
69 cd ../tc
69 cd ../tc
70 cat <<EOF > foo
70 cat <<EOF > foo
71 foo
71 foo
72 bar
72 bar
73 baz
73 baz
74 EOF
74 EOF
75 echo toremove > toremove
75 echo toremove > toremove
76 hg ci -Amfoo -d '0 0'
76 hg ci -Amfoo
77 cat <<EOF > foo
77 cat <<EOF > foo
78 foo2
78 foo2
79 bar2
79 bar2
80 baz2
80 baz2
81 EOF
81 EOF
82 rm toremove
82 rm toremove
83 echo added > added
83 echo added > added
84 hg ci -Amfoo2 -d '0 0'
84 hg ci -Amfoo2
85 echo bar > bar
85 echo bar > bar
86 hg ci -Ambar -d '0 0'
86 hg ci -Ambar
87 echo bar2 >> bar
87 echo bar2 >> bar
88 hg ci -mbar2 -d '0 0'
88 hg ci -mbar2
89 hg up 0
89 hg up 0
90 echo foobar > foo
90 echo foobar > foo
91 hg ci -mfoobar -d '0 0'
91 hg ci -mfoobar
92 hg transplant 1:3
92 hg transplant 1:3
93 # transplant -c shouldn't use an old changeset
93 # transplant -c shouldn't use an old changeset
94 hg up -C
94 hg up -C
95 hg transplant 1
95 hg transplant 1
96 hg transplant --continue
96 hg transplant --continue
97 hg transplant 1:3
97 hg transplant 1:3
98 hg locate
98 hg locate
99 cd ..
99 cd ..
100
100
101 # Test transplant --merge (issue 1111)
101 # Test transplant --merge (issue 1111)
102 echo % test transplant merge
102 echo % test transplant merge
103 hg init t1111
103 hg init t1111
104 cd t1111
104 cd t1111
105 echo a > a
105 echo a > a
106 hg ci -Am adda
106 hg ci -Am adda
107 echo b >> a
107 echo b >> a
108 hg ci -m appendb
108 hg ci -m appendb
109 echo c >> a
109 echo c >> a
110 hg ci -m appendc
110 hg ci -m appendc
111 hg up -C 0
111 hg up -C 0
112 echo d >> a
112 echo d >> a
113 hg ci -m appendd
113 hg ci -m appendd
114 echo % tranplant
114 echo % tranplant
115 hg transplant -m 1
115 hg transplant -m 1
116 cd ..
116 cd ..
@@ -1,83 +1,83 b''
1 #!/bin/sh
1 #!/bin/sh
2 # test basic functionality of url#rev syntax
2 # test basic functionality of url#rev syntax
3
3
4 hg init repo
4 hg init repo
5 cd repo
5 cd repo
6 echo a > a
6 echo a > a
7 hg ci -qAm 'add a' -d '0 0'
7 hg ci -qAm 'add a'
8 hg branch foo
8 hg branch foo
9 echo >> a
9 echo >> a
10 hg ci -m 'change a' -d '0 0'
10 hg ci -m 'change a'
11 cd ..
11 cd ..
12
12
13 echo '% clone repo#foo'
13 echo '% clone repo#foo'
14 hg clone 'repo#foo' clone
14 hg clone 'repo#foo' clone
15 echo '% heads'
15 echo '% heads'
16 hg --cwd clone heads
16 hg --cwd clone heads
17 echo '% parents'
17 echo '% parents'
18 hg --cwd clone parents
18 hg --cwd clone parents
19 sed -e 's/default.*#/default = #/' clone/.hg/hgrc
19 sed -e 's/default.*#/default = #/' clone/.hg/hgrc
20 echo
20 echo
21
21
22 echo '% changing original repo'
22 echo '% changing original repo'
23 cd repo
23 cd repo
24 echo >> a
24 echo >> a
25 hg ci -m 'new head of branch foo' -d '0 0'
25 hg ci -m 'new head of branch foo'
26 hg up -qC default
26 hg up -qC default
27 echo bar > bar
27 echo bar > bar
28 hg ci -qAm 'add bar' -d '0 0'
28 hg ci -qAm 'add bar'
29 hg log
29 hg log
30 echo
30 echo
31
31
32 echo '% outgoing'
32 echo '% outgoing'
33 hg -q outgoing '../clone#foo'
33 hg -q outgoing '../clone#foo'
34 echo
34 echo
35
35
36 echo '% push'
36 echo '% push'
37 hg -q push '../clone#foo'
37 hg -q push '../clone#foo'
38 hg --cwd ../clone heads
38 hg --cwd ../clone heads
39 cd ..
39 cd ..
40 echo
40 echo
41
41
42 echo '% rolling back'
42 echo '% rolling back'
43 cd clone
43 cd clone
44 hg rollback
44 hg rollback
45
45
46 echo '% incoming'
46 echo '% incoming'
47 hg -q incoming
47 hg -q incoming
48
48
49 echo '% pull'
49 echo '% pull'
50 hg -q pull
50 hg -q pull
51 hg heads
51 hg heads
52 echo
52 echo
53
53
54 echo '% pull should not have updated'
54 echo '% pull should not have updated'
55 hg parents -q
55 hg parents -q
56 echo '% going back to the default branch'
56 echo '% going back to the default branch'
57 hg up -C 0
57 hg up -C 0
58 hg parents
58 hg parents
59 echo '% no new revs, no update'
59 echo '% no new revs, no update'
60 hg pull -qu
60 hg pull -qu
61 hg parents -q
61 hg parents -q
62 echo '% rollback'
62 echo '% rollback'
63 hg rollback
63 hg rollback
64 hg up -C 0
64 hg up -C 0
65 hg parents -q
65 hg parents -q
66 echo '% pull -u takes us back to branch foo'
66 echo '% pull -u takes us back to branch foo'
67 hg pull -qu
67 hg pull -qu
68 hg parents
68 hg parents
69
69
70 echo '% rollback'
70 echo '% rollback'
71 hg rollback
71 hg rollback
72 hg up -C 0
72 hg up -C 0
73 echo '% parents'
73 echo '% parents'
74 hg parents -q
74 hg parents -q
75 echo '% heads'
75 echo '% heads'
76 hg heads -q
76 hg heads -q
77 echo '% pull -u -r otherrev url#rev updates to rev'
77 echo '% pull -u -r otherrev url#rev updates to rev'
78 hg pull -qur default default
78 hg pull -qur default default
79 echo '% parents'
79 echo '% parents'
80 hg parents
80 hg parents
81 echo '% heads'
81 echo '% heads'
82 hg heads
82 hg heads
83
83
@@ -1,45 +1,45 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo % prepare repo
3 echo % prepare repo
4 hg init a
4 hg init a
5 cd a
5 cd a
6 echo "some text" > FOO.txt
6 echo "some text" > FOO.txt
7 echo "another text" > bar.txt
7 echo "another text" > bar.txt
8 echo "more text" > QUICK.txt
8 echo "more text" > QUICK.txt
9 hg add
9 hg add
10 hg ci -d '0 0' -mtest1
10 hg ci -mtest1
11
11
12 echo
12 echo
13 echo % verify
13 echo % verify
14 hg verify
14 hg verify
15
15
16 echo
16 echo
17 echo % introduce some bugs in repo
17 echo % introduce some bugs in repo
18 cd .hg/store/data
18 cd .hg/store/data
19 mv _f_o_o.txt.i X_f_o_o.txt.i
19 mv _f_o_o.txt.i X_f_o_o.txt.i
20 mv bar.txt.i xbar.txt.i
20 mv bar.txt.i xbar.txt.i
21 rm _q_u_i_c_k.txt.i
21 rm _q_u_i_c_k.txt.i
22
22
23 echo
23 echo
24 echo % verify
24 echo % verify
25 hg verify
25 hg verify
26
26
27 cd ..
27 cd ..
28
28
29 echo % test revlog corruption
29 echo % test revlog corruption
30 hg init b
30 hg init b
31 cd b
31 cd b
32
32
33 touch a
33 touch a
34 hg add a
34 hg add a
35 hg ci -m a
35 hg ci -m a
36
36
37 echo 'corrupted' > b
37 echo 'corrupted' > b
38 head -c 20 .hg/store/data/a.i > start
38 head -c 20 .hg/store/data/a.i > start
39 cat start b > .hg/store/data/a.i
39 cat start b > .hg/store/data/a.i
40
40
41 echo
41 echo
42 echo % verify
42 echo % verify
43 hg verify
43 hg verify
44
44
45 exit 0
45 exit 0
@@ -1,160 +1,160 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init t
3 hg init t
4 cd t
4 cd t
5
5
6 cat > unix2dos.py <<EOF
6 cat > unix2dos.py <<EOF
7 import sys
7 import sys
8
8
9 for path in sys.argv[1:]:
9 for path in sys.argv[1:]:
10 data = file(path, 'rb').read()
10 data = file(path, 'rb').read()
11 data = data.replace('\n', '\r\n')
11 data = data.replace('\n', '\r\n')
12 file(path, 'wb').write(data)
12 file(path, 'wb').write(data)
13 EOF
13 EOF
14
14
15 cat > print.py <<EOF
15 cat > print.py <<EOF
16 import sys
16 import sys
17 print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
17 print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
18 EOF
18 EOF
19
19
20 echo '[hooks]' >> .hg/hgrc
20 echo '[hooks]' >> .hg/hgrc
21 echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
21 echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
22 echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
22 echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc
23 cat .hg/hgrc
23 cat .hg/hgrc
24 echo
24 echo
25
25
26 echo hello > f
26 echo hello > f
27 hg add f
27 hg add f
28 echo commit should succeed
28 echo commit should succeed
29 hg ci -m 1 -d'0 0'
29 hg ci -m 1
30 echo
30 echo
31
31
32 hg clone . ../zoz
32 hg clone . ../zoz
33 cp .hg/hgrc ../zoz/.hg
33 cp .hg/hgrc ../zoz/.hg
34
34
35 python unix2dos.py f
35 python unix2dos.py f
36 echo commit should fail
36 echo commit should fail
37 hg ci -m 2.1 -d'0 0'
37 hg ci -m 2.1
38 echo
38 echo
39
39
40 mv .hg/hgrc .hg/hgrc.bak
40 mv .hg/hgrc .hg/hgrc.bak
41 echo commits should succeed
41 echo commits should succeed
42 hg ci -m 2 -d'0 0'
42 hg ci -m 2
43 hg cp f g
43 hg cp f g
44 hg ci -m 2.2 -d'0 0'
44 hg ci -m 2.2
45 echo
45 echo
46
46
47 echo push should fail
47 echo push should fail
48 hg push ../zoz
48 hg push ../zoz
49 echo
49 echo
50
50
51 mv .hg/hgrc.bak .hg/hgrc
51 mv .hg/hgrc.bak .hg/hgrc
52 echo hello > f
52 echo hello > f
53 hg rm g
53 hg rm g
54 echo commit should succeed
54 echo commit should succeed
55 hg ci -m 2.3 -d'0 0'
55 hg ci -m 2.3
56 echo
56 echo
57
57
58 echo push should succeed
58 echo push should succeed
59 hg push ../zoz
59 hg push ../zoz
60 echo
60 echo
61
61
62 echo and now for something completely different
62 echo and now for something completely different
63 mkdir d
63 mkdir d
64 echo hello > d/f2
64 echo hello > d/f2
65 python unix2dos.py d/f2
65 python unix2dos.py d/f2
66 hg add d/f2
66 hg add d/f2
67 hg ci -m 3 -d'0 0'
67 hg ci -m 3
68 hg revert -a
68 hg revert -a
69 rm d/f2
69 rm d/f2
70 echo
70 echo
71
71
72 hg rem f
72 hg rem f
73 hg ci -m 4 -d'0 0'
73 hg ci -m 4
74 echo
74 echo
75
75
76 python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")'
76 python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")'
77 hg add bin
77 hg add bin
78 hg ci -m 5 -d'0 0'
78 hg ci -m 5
79 hg log -v
79 hg log -v
80 echo
80 echo
81
81
82 hg clone . dupe
82 hg clone . dupe
83 echo
83 echo
84 for x in a b c d; do echo content > dupe/$x; done
84 for x in a b c d; do echo content > dupe/$x; done
85 hg -R dupe add
85 hg -R dupe add
86 python unix2dos.py dupe/b dupe/c dupe/d
86 python unix2dos.py dupe/b dupe/c dupe/d
87 hg -R dupe ci -m a -d'0 0' dupe/a
87 hg -R dupe ci -m a dupe/a
88 hg -R dupe ci -m b/c -d'0 0' dupe/[bc]
88 hg -R dupe ci -m b/c dupe/[bc]
89 hg -R dupe ci -m d -d'0 0' dupe/d
89 hg -R dupe ci -m d dupe/d
90 hg -R dupe log -v
90 hg -R dupe log -v
91 echo
91 echo
92
92
93 hg pull dupe
93 hg pull dupe
94 echo
94 echo
95
95
96 hg log -v
96 hg log -v
97 echo
97 echo
98
98
99 rm .hg/hgrc
99 rm .hg/hgrc
100 (echo some; echo text) > f3
100 (echo some; echo text) > f3
101 python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
101 python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")'
102 hg add f3 f4.bat
102 hg add f3 f4.bat
103 hg ci -m 6 -d'0 0'
103 hg ci -m 6
104
104
105 python print.py < bin
105 python print.py < bin
106 python print.py < f3
106 python print.py < f3
107 python print.py < f4.bat
107 python print.py < f4.bat
108 echo
108 echo
109
109
110 echo '[extensions]' >> .hg/hgrc
110 echo '[extensions]' >> .hg/hgrc
111 echo 'win32text = ' >> .hg/hgrc
111 echo 'win32text = ' >> .hg/hgrc
112 echo '[decode]' >> .hg/hgrc
112 echo '[decode]' >> .hg/hgrc
113 echo '** = cleverdecode:' >> .hg/hgrc
113 echo '** = cleverdecode:' >> .hg/hgrc
114 echo '[encode]' >> .hg/hgrc
114 echo '[encode]' >> .hg/hgrc
115 echo '** = cleverencode:' >> .hg/hgrc
115 echo '** = cleverencode:' >> .hg/hgrc
116 cat .hg/hgrc
116 cat .hg/hgrc
117 echo
117 echo
118
118
119 rm f3 f4.bat bin
119 rm f3 f4.bat bin
120 hg co 2>&1 | python -c 'import sys, os; sys.stdout.write(sys.stdin.read().replace(os.getcwd(), "...."))'
120 hg co 2>&1 | python -c 'import sys, os; sys.stdout.write(sys.stdin.read().replace(os.getcwd(), "...."))'
121 python print.py < bin
121 python print.py < bin
122 python print.py < f3
122 python print.py < f3
123 python print.py < f4.bat
123 python print.py < f4.bat
124 echo
124 echo
125
125
126 python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
126 python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")'
127 hg add f5.sh
127 hg add f5.sh
128 hg ci -m 7 -d'0 0'
128 hg ci -m 7
129 python print.py < f5.sh
129 python print.py < f5.sh
130 hg cat f5.sh | python print.py
130 hg cat f5.sh | python print.py
131
131
132 echo '% just linefeed' > linefeed
132 echo '% just linefeed' > linefeed
133 hg ci -qAm 8 linefeed
133 hg ci -qAm 8 linefeed
134 python print.py < linefeed
134 python print.py < linefeed
135 hg cat linefeed | python print.py
135 hg cat linefeed | python print.py
136 hg st -q
136 hg st -q
137 hg revert -a linefeed
137 hg revert -a linefeed
138 python print.py < linefeed
138 python print.py < linefeed
139 hg st -q
139 hg st -q
140 echo modified >> linefeed
140 echo modified >> linefeed
141 hg st -q
141 hg st -q
142 hg revert -a
142 hg revert -a
143 hg st -q
143 hg st -q
144 python print.py < linefeed
144 python print.py < linefeed
145
145
146 echo "# disable extension again"
146 echo "# disable extension again"
147 echo '[decode]' >> .hg/hgrc
147 echo '[decode]' >> .hg/hgrc
148 echo '** = !' >> .hg/hgrc
148 echo '** = !' >> .hg/hgrc
149 echo '[encode]' >> .hg/hgrc
149 echo '[encode]' >> .hg/hgrc
150 echo '** = !' >> .hg/hgrc
150 echo '** = !' >> .hg/hgrc
151 cat .hg/hgrc
151 cat .hg/hgrc
152 echo
152 echo
153
153
154 rm f3 f4.bat bin
154 rm f3 f4.bat bin
155 hg co 2>&1 | python -c 'import sys, os; sys.stdout.write(sys.stdin.read().replace(os.getcwd(), "...."))'
155 hg co 2>&1 | python -c 'import sys, os; sys.stdout.write(sys.stdin.read().replace(os.getcwd(), "...."))'
156 python print.py < bin
156 python print.py < bin
157 python print.py < f3
157 python print.py < f3
158 python print.py < f4.bat
158 python print.py < f4.bat
159 echo
159 echo
160
160
General Comments 0
You need to be logged in to leave comments. Login now