##// END OF EJS Templates
record: add tests for the curses recording interface
Laurent Charignon -
r24344:6b43baac default
parent child Browse files
Show More
@@ -0,0 +1,184 b''
1 Set up a repo
2
3 $ cat <<EOF >> $HGRCPATH
4 > [ui]
5 > interactive = true
6 > [experimental]
7 > crecord = true
8 > crecordtest = testModeCommands
9 > EOF
10
11 $ hg init a
12 $ cd a
13
14 Committing some changes but stopping on the way
15
16 $ echo "a" > a
17 $ hg add a
18 $ cat <<EOF >testModeCommands
19 > TOGGLE
20 > X
21 > EOF
22 $ hg commit -i -m "a" -d "0 0"
23 no changes to record
24 $ hg tip
25 changeset: -1:000000000000
26 tag: tip
27 user:
28 date: Thu Jan 01 00:00:00 1970 +0000
29
30
31 Committing some changes
32
33 $ cat <<EOF >testModeCommands
34 > X
35 > EOF
36 $ hg commit -i -m "a" -d "0 0"
37 $ hg tip
38 changeset: 0:cb9a9f314b8b
39 tag: tip
40 user: test
41 date: Thu Jan 01 00:00:00 1970 +0000
42 summary: a
43
44 Committing only one file
45
46 $ echo "a" >> a
47 $ seq 1 10 > b
48 $ hg add b
49 $ cat <<EOF >testModeCommands
50 > TOGGLE
51 > KEY_DOWN
52 > X
53 > EOF
54 $ hg commit -i -m "one file" -d "0 0"
55 $ hg tip
56 changeset: 1:fb2705a663ea
57 tag: tip
58 user: test
59 date: Thu Jan 01 00:00:00 1970 +0000
60 summary: one file
61
62 $ hg cat -r tip a
63 a
64 $ cat a
65 a
66 a
67
68 Committing only one hunk
69
70 - Untoggle all the hunks, go down to the second file
71 - unfold it
72 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
73 - toggle the second hunk
74 - commit
75
76 $ echo "x" > c
77 $ cat b >> c
78 $ echo "y" >> c
79 $ mv c b
80 $ cat <<EOF >testModeCommands
81 > A
82 > KEY_DOWN
83 > f
84 > KEY_DOWN
85 > KEY_DOWN
86 > KEY_DOWN
87 > KEY_DOWN
88 > TOGGLE
89 > X
90 > EOF
91 $ hg commit -i -m "one hunk" -d "0 0"
92 $ hg tip
93 changeset: 2:7d10dfe755a8
94 tag: tip
95 user: test
96 date: Thu Jan 01 00:00:00 1970 +0000
97 summary: one hunk
98
99 $ hg cat -r tip b
100 1
101 2
102 3
103 4
104 5
105 6
106 7
107 8
108 9
109 10
110 y
111 $ cat b
112 x
113 1
114 2
115 3
116 4
117 5
118 6
119 7
120 8
121 9
122 10
123 y
124 $ hg commit -m "other hunks"
125 $ hg tip
126 changeset: 3:a6735021574d
127 tag: tip
128 user: test
129 date: Thu Jan 01 00:00:00 1970 +0000
130 summary: other hunks
131
132 $ hg cat -r tip b
133 x
134 1
135 2
136 3
137 4
138 5
139 6
140 7
141 8
142 9
143 10
144 y
145
146 Editing patch of newly added file
147
148 $ cat > editor.sh << '__EOF__'
149 > cat "$1" | sed "s/first/very/g" > tt
150 > mv tt "$1"
151 > __EOF__
152 $ cat > newfile << '__EOF__'
153 > This is the first line
154 > This is the second line
155 > This is the third line
156 > __EOF__
157 $ hg add newfile
158 $ cat <<EOF >testModeCommands
159 > f
160 > KEY_DOWN
161 > KEY_DOWN
162 > KEY_DOWN
163 > e
164 > X
165 > EOF
166 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-new
167 $ hg tip
168 changeset: 4:6a0a43e9eff5
169 tag: tip
170 user: test
171 date: Thu Jan 01 00:00:23 1970 +0000
172 summary: edit-patch-new
173
174 $ hg cat -r tip newfile
175 This is the very line
176 This is the second line
177 This is the third line
178
179 $ cat newfile
180 This is the first line
181 This is the second line
182 This is the third line
183
184
General Comments 0
You need to be logged in to leave comments. Login now