##// END OF EJS Templates
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
FUJIWARA Katsunori -
r21236:49148d78 default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,180 +1,231 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "mq=" >> $HGRCPATH
3 3 $ echo "[mq]" >> $HGRCPATH
4 4 $ echo "git=keep" >> $HGRCPATH
5 5 $ echo "[diff]" >> $HGRCPATH
6 6 $ echo "nodates=1" >> $HGRCPATH
7 7
8 8 init:
9 9
10 10 $ hg init repo
11 11 $ cd repo
12 12 $ echo a > a
13 13 $ hg ci -Am adda
14 14 adding a
15 15 $ echo a >> a
16 16 $ hg qnew -f p1
17 17 $ echo b >> a
18 18 $ hg qnew -f p2
19 19 $ echo c >> a
20 20 $ hg qnew -f p3
21 21
22 22 Fold in the middle of the queue:
23 23
24 24 $ hg qpop p1
25 25 popping p3
26 26 popping p2
27 27 now at: p1
28 28
29 29 $ hg qdiff
30 30 diff -r 07f494440405 a
31 31 --- a/a
32 32 +++ b/a
33 33 @@ -1,1 +1,2 @@
34 34 a
35 35 +a
36 36
37 37 $ hg qfold p2
38 38 $ grep git .hg/patches/p1 && echo 'git patch found!'
39 39 [1]
40 40
41 41 $ hg qser
42 42 p1
43 43 p3
44 44
45 45 $ hg qdiff
46 46 diff -r 07f494440405 a
47 47 --- a/a
48 48 +++ b/a
49 49 @@ -1,1 +1,3 @@
50 50 a
51 51 +a
52 52 +b
53 53
54 54 Fold with local changes:
55 55
56 56 $ echo d >> a
57 57 $ hg qfold p3
58 58 abort: local changes found, refresh first
59 59 [255]
60 60
61 61 $ hg diff -c .
62 62 diff -r 07f494440405 -r ???????????? a (glob)
63 63 --- a/a
64 64 +++ b/a
65 65 @@ -1,1 +1,3 @@
66 66 a
67 67 +a
68 68 +b
69 69
70 70 $ hg revert -a --no-backup
71 71 reverting a
72 72
73 73 Fold git patch into a regular patch, expect git patch:
74 74
75 75 $ echo a >> a
76 76 $ hg qnew -f regular
77 77 $ hg cp a aa
78 78 $ hg qnew --git -f git
79 79
80 80 $ hg qpop
81 81 popping git
82 82 now at: regular
83 83
84 84 $ hg qfold git
85 85
86 86 $ cat .hg/patches/regular
87 87 # HG changeset patch
88 88 # Parent ???????????????????????????????????????? (glob)
89 89
90 90 diff --git a/a b/a
91 91 --- a/a
92 92 +++ b/a
93 93 @@ -1,3 +1,4 @@
94 94 a
95 95 a
96 96 b
97 97 +a
98 98 diff --git a/a b/aa
99 99 copy from a
100 100 copy to aa
101 101 --- a/a
102 102 +++ b/aa
103 103 @@ -1,3 +1,4 @@
104 104 a
105 105 a
106 106 b
107 107 +a
108 108
109 109 $ hg qpop
110 110 popping regular
111 111 now at: p1
112 112
113 113 $ hg qdel regular
114 114
115 115 Fold regular patch into a git patch, expect git patch:
116 116
117 117 $ hg cp a aa
118 118 $ hg qnew --git -f git
119 119 $ echo b >> aa
120 120 $ hg qnew -f regular
121 121
122 122 $ hg qpop
123 123 popping regular
124 124 now at: git
125 125
126 126 $ hg qfold regular
127 127
128 128 $ cat .hg/patches/git
129 129 # HG changeset patch
130 130 # Parent ???????????????????????????????????????? (glob)
131 131
132 132 diff --git a/a b/aa
133 133 copy from a
134 134 copy to aa
135 135 --- a/a
136 136 +++ b/aa
137 137 @@ -1,3 +1,4 @@
138 138 a
139 139 a
140 140 b
141 141 +b
142 142
143 143 Test saving last-message.txt:
144 144
145 145 $ hg qrefresh -m "original message"
146 146
147 147 $ cat > $TESTTMP/commitfailure.py <<EOF
148 148 > from mercurial import util
149 149 > def reposetup(ui, repo):
150 150 > class commitfailure(repo.__class__):
151 151 > def commit(self, *args, **kwargs):
152 152 > raise util.Abort('emulating unexpected abort')
153 153 > repo.__class__ = commitfailure
154 154 > EOF
155 155
156 $ cat > .hg/hgrc <<EOF
156 $ cat >> .hg/hgrc <<EOF
157 157 > [extensions]
158 > # this failure occurs before editor invocation
158 159 > commitfailure = $TESTTMP/commitfailure.py
159 160 > EOF
160 161
161 162 $ cat > $TESTTMP/editor.sh << EOF
162 163 > echo "==== before editing"
163 164 > cat \$1
164 165 > echo "===="
165 166 > (echo; echo "test saving last-message.txt") >> \$1
166 167 > EOF
167 168
169 $ hg qapplied
170 p1
171 git
172 $ hg tip --template "{files}\n"
173 aa
174
175 (test that editor is not invoked before transaction starting)
176
168 177 $ rm -f .hg/last-message.txt
169 178 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
170 ==== before editing
171 original message====
172 179 refresh interrupted while patch was popped! (revert --all, qpush to recover)
173 180 abort: emulating unexpected abort
174 181 [255]
175 182 $ cat .hg/last-message.txt
183 cat: .hg/last-message.txt: No such file or directory
184 [1]
185
186 (reset applied patches and directory status)
187
188 $ cat >> .hg/hgrc <<EOF
189 > [extensions]
190 > # this failure occurs after editor invocation
191 > commitfailure = !
192 > EOF
193
194 $ hg qapplied
195 p1
196 $ hg status -A aa
197 ? aa
198 $ rm aa
199 $ hg status -m
200 M a
201 $ hg revert --no-backup -q a
202 $ hg qpush -q git
203 now at: git
204
205 (test that editor is invoked and commit message is saved into
206 "last-message.txt")
207
208 $ cat >> .hg/hgrc <<EOF
209 > [hooks]
210 > # this failure occurs after editor invocation
211 > pretxncommit.unexpectedabort = false
212 > EOF
213
214 $ rm -f .hg/last-message.txt
215 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
216 ==== before editing
176 217 original message
218 ====
219 transaction abort!
220 rollback completed
221 note: commit message saved in .hg/last-message.txt
222 refresh interrupted while patch was popped! (revert --all, qpush to recover)
223 abort: pretxncommit.unexpectedabort hook exited with status 1
224 [255]
225 $ cat .hg/last-message.txt
226 original message
227
177 228 test saving last-message.txt
178 229
179 230 $ cd ..
180 231
@@ -1,61 +1,144 b''
1 1 Environment setup for MQ
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "mq=" >> $HGRCPATH
5 5 $ hg init
6 6 $ hg qinit
7 7
8 8 Should fail if no patches applied
9 9
10 10 $ hg qrefresh
11 11 no patches applied
12 12 [1]
13 13 $ hg qrefresh -e
14 14 no patches applied
15 15 [1]
16 16 $ hg qnew -m "First commit message" first-patch
17 17 $ echo aaaa > file
18 18 $ hg add file
19 19 $ hg qrefresh
20 20
21 21 Should display 'First commit message'
22 22
23 23 $ hg log -l1 --template "{desc}\n"
24 24 First commit message
25 25
26 26 Testing changing message with -m
27 27
28 28 $ echo bbbb > file
29 29 $ hg qrefresh -m "Second commit message"
30 30
31 31 Should display 'Second commit message'
32 32
33 33 $ hg log -l1 --template "{desc}\n"
34 34 Second commit message
35 35
36 36 Testing changing message with -l
37 37
38 38 $ echo "Third commit message" > logfile
39 39 $ echo " This is the 3rd log message" >> logfile
40 40 $ echo bbbb > file
41 41 $ hg qrefresh -l logfile
42 42
43 43 Should display 'Third commit message\\\n This is the 3rd log message'
44 44
45 45 $ hg log -l1 --template "{desc}\n"
46 46 Third commit message
47 47 This is the 3rd log message
48 48
49 49 Testing changing message with -l-
50 50
51 51 $ hg qnew -m "First commit message" second-patch
52 52 $ echo aaaa > file2
53 53 $ hg add file2
54 54 $ echo bbbb > file2
55 55 $ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l-
56 56
57 57 Should display 'Fifth commit message\\\n This is the 5th log message'
58 58
59 59 $ hg log -l1 --template "{desc}\n"
60 60 Fifth commit message
61 61 This is the 5th log message
62
63 Test saving last-message.txt:
64
65 $ cat > $TESTTMP/editor.sh << EOF
66 > echo "==== before editing"
67 > cat \$1
68 > echo "===="
69 > (echo; echo "test saving last-message.txt") >> \$1
70 > EOF
71
72 $ cat > $TESTTMP/commitfailure.py <<EOF
73 > from mercurial import util
74 > def reposetup(ui, repo):
75 > class commitfailure(repo.__class__):
76 > def commit(self, *args, **kwargs):
77 > raise util.Abort('emulating unexpected abort')
78 > repo.__class__ = commitfailure
79 > EOF
80
81 $ cat >> .hg/hgrc <<EOF
82 > [extensions]
83 > # this failure occurs before editor invocation
84 > commitfailure = $TESTTMP/commitfailure.py
85 > EOF
86
87 $ hg qapplied
88 first-patch
89 second-patch
90 $ hg tip --template "{files}\n"
91 file2
92
93 (test that editor is not invoked before transaction starting)
94
95 $ rm -f .hg/last-message.txt
96 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
97 refresh interrupted while patch was popped! (revert --all, qpush to recover)
98 abort: emulating unexpected abort
99 [255]
100 $ cat .hg/last-message.txt
101 cat: .hg/last-message.txt: No such file or directory
102 [1]
103
104 (reset applied patches and directory status)
105
106 $ cat >> .hg/hgrc <<EOF
107 > [extensions]
108 > commitfailure = !
109 > EOF
110
111 $ hg qapplied
112 first-patch
113 $ hg status -A file2
114 ? file2
115 $ rm file2
116 $ hg qpush -q second-patch
117 now at: second-patch
118
119 (test that editor is invoked and commit message is saved into
120 "last-message.txt")
121
122 $ cat >> .hg/hgrc <<EOF
123 > [hooks]
124 > # this failure occurs after editor invocation
125 > pretxncommit.unexpectedabort = false
126 > EOF
127
128 $ rm -f .hg/last-message.txt
129 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
130 ==== before editing
131 Fifth commit message
132 This is the 5th log message
133 ====
134 transaction abort!
135 rollback completed
136 note: commit message saved in .hg/last-message.txt
137 refresh interrupted while patch was popped! (revert --all, qpush to recover)
138 abort: pretxncommit.unexpectedabort hook exited with status 1
139 [255]
140 $ cat .hg/last-message.txt
141 Fifth commit message
142 This is the 5th log message
143
144 test saving last-message.txt
General Comments 0
You need to be logged in to leave comments. Login now