comparison tests/test-record @ 5037:b2607267236d

Add record extension, giving darcs-like interactive hunk picking
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 31 Jul 2007 16:28:05 -0700
parents
children c9126c24e098
comparison
equal deleted inserted replaced
5036:ca0d02222d6a 5037:b2607267236d
1 #!/bin/sh
2
3 echo "[ui]" >> $HGRCPATH
4 echo "interactive=true" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "record=" >> $HGRCPATH
7
8 echo % help
9
10 hg help record
11
12 hg init a
13 cd a
14
15 echo % select no files
16
17 touch empty-rw
18 hg add empty-rw
19 hg record empty-rw<<EOF
20 n
21 EOF
22 echo; hg tip -p
23
24 echo % select files but no hunks
25
26 hg record empty-rw<<EOF
27 y
28 n
29 EOF
30 echo; hg tip -p
31
32 echo % record empty file
33
34 hg record -d '0 0' -m empty empty-rw<<EOF
35 y
36 y
37 EOF
38 echo; hg tip -p
39
40 echo % rename empty file
41
42 hg mv empty-rw empty-rename
43 hg record -d '1 0' -m rename<<EOF
44 y
45 EOF
46 echo; hg tip -p
47
48 echo % copy empty file
49
50 hg cp empty-rename empty-copy
51 hg record -d '2 0' -m copy<<EOF
52 y
53 EOF
54 echo; hg tip -p
55
56 echo % delete empty file
57
58 hg rm empty-copy
59 hg record -d '3 0' -m delete<<EOF
60 y
61 EOF
62 echo; hg tip -p
63
64 echo % add binary file
65
66 hg bundle --base -2 tip.bundle
67 hg add tip.bundle
68 hg record -d '4 0' -m binary<<EOF
69 y
70 EOF
71 echo; hg tip -p
72
73 echo % change binary file
74
75 hg bundle --base -2 tip.bundle
76 hg record -d '5 0' -m binary-change<<EOF
77 y
78 EOF
79 echo; hg tip -p
80
81 echo % rename and change binary file
82
83 hg mv tip.bundle top.bundle
84 hg bundle --base -2 top.bundle
85 hg record -d '6 0' -m binary-change-rename<<EOF
86 y
87 EOF
88 echo; hg tip -p
89
90 echo % add plain file
91
92 for i in 1 2 3 4 5 6 7 8 9 10; do
93 echo $i >> plain
94 done
95
96 hg add plain
97 hg record -d '7 0' -m plain plain<<EOF
98 y
99 y
100 EOF
101 echo; hg tip -p
102
103 echo % modify end of plain file
104
105 echo 11 >> plain
106 hg record -d '8 0' -m end plain <<EOF
107 y
108 y
109 EOF
110
111 echo % modify end of plain file, no EOL
112
113 hg tip --template '{node}' >> plain
114 hg record -d '9 0' -m noeol plain <<EOF
115 y
116 y
117 EOF
118
119 echo % modify end of plain file, add EOL
120
121 echo >> plain
122 hg record -d '10 0' -m eol plain <<EOF
123 y
124 y
125 y
126 EOF
127
128 echo % modify beginning, trim end, record both
129
130 rm plain
131 for i in 2 2 3 4 5 6 7 8 9 10; do
132 echo $i >> plain
133 done
134
135 hg record -d '10 0' -m begin-and-end plain <<EOF
136 y
137 y
138 y
139 EOF
140 echo; hg tip -p
141
142 echo % trim beginning, modify end
143
144 rm plain
145 for i in 4 5 6 7 8 9 10.new; do
146 echo $i >> plain
147 done
148
149 echo % record end
150
151 hg record -d '11 0' -m end-only plain <<EOF
152 y
153 n
154 y
155 EOF
156 echo; hg tip -p
157
158 echo % record beginning
159
160 hg record -d '12 0' -m begin-only plain <<EOF
161 y
162 y
163 EOF
164 echo; hg tip -p
165
166 echo % add to beginning, trim from end
167
168 rm plain
169 for i in 1 2 3 4 5 6 7 8 9; do
170 echo $i >> plain
171 done
172
173 echo % record end
174
175 hg record --traceback -d '13 0' -m end-again plain<<EOF
176 y
177 n
178 y
179 EOF
180
181 echo % add to beginning, middle, end
182
183 rm plain
184 for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
185 echo $i >> plain
186 done
187
188 echo % record beginning, middle
189
190 hg record -d '14 0' -m middle-only plain <<EOF
191 y
192 y
193 y
194 n
195 EOF
196 echo; hg tip -p
197
198 echo % record end
199
200 hg record -d '15 0' -m end-only plain <<EOF
201 y
202 y
203 EOF
204 echo; hg tip -p