##// 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
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 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
5 $ echo "[diff]" >> $HGRCPATH
5 $ echo "[diff]" >> $HGRCPATH
6 $ echo "nodates=1" >> $HGRCPATH
6 $ echo "nodates=1" >> $HGRCPATH
7
7
8 init:
8 init:
9
9
10 $ hg init repo
10 $ hg init repo
11 $ cd repo
11 $ cd repo
12 $ echo a > a
12 $ echo a > a
13 $ hg ci -Am adda
13 $ hg ci -Am adda
14 adding a
14 adding a
15 $ echo a >> a
15 $ echo a >> a
16 $ hg qnew -f p1
16 $ hg qnew -f p1
17 $ echo b >> a
17 $ echo b >> a
18 $ hg qnew -f p2
18 $ hg qnew -f p2
19 $ echo c >> a
19 $ echo c >> a
20 $ hg qnew -f p3
20 $ hg qnew -f p3
21
21
22 Fold in the middle of the queue:
22 Fold in the middle of the queue:
23
23
24 $ hg qpop p1
24 $ hg qpop p1
25 popping p3
25 popping p3
26 popping p2
26 popping p2
27 now at: p1
27 now at: p1
28
28
29 $ hg qdiff
29 $ hg qdiff
30 diff -r 07f494440405 a
30 diff -r 07f494440405 a
31 --- a/a
31 --- a/a
32 +++ b/a
32 +++ b/a
33 @@ -1,1 +1,2 @@
33 @@ -1,1 +1,2 @@
34 a
34 a
35 +a
35 +a
36
36
37 $ hg qfold p2
37 $ hg qfold p2
38 $ grep git .hg/patches/p1 && echo 'git patch found!'
38 $ grep git .hg/patches/p1 && echo 'git patch found!'
39 [1]
39 [1]
40
40
41 $ hg qser
41 $ hg qser
42 p1
42 p1
43 p3
43 p3
44
44
45 $ hg qdiff
45 $ hg qdiff
46 diff -r 07f494440405 a
46 diff -r 07f494440405 a
47 --- a/a
47 --- a/a
48 +++ b/a
48 +++ b/a
49 @@ -1,1 +1,3 @@
49 @@ -1,1 +1,3 @@
50 a
50 a
51 +a
51 +a
52 +b
52 +b
53
53
54 Fold with local changes:
54 Fold with local changes:
55
55
56 $ echo d >> a
56 $ echo d >> a
57 $ hg qfold p3
57 $ hg qfold p3
58 abort: local changes found, refresh first
58 abort: local changes found, refresh first
59 [255]
59 [255]
60
60
61 $ hg diff -c .
61 $ hg diff -c .
62 diff -r 07f494440405 -r ???????????? a (glob)
62 diff -r 07f494440405 -r ???????????? a (glob)
63 --- a/a
63 --- a/a
64 +++ b/a
64 +++ b/a
65 @@ -1,1 +1,3 @@
65 @@ -1,1 +1,3 @@
66 a
66 a
67 +a
67 +a
68 +b
68 +b
69
69
70 $ hg revert -a --no-backup
70 $ hg revert -a --no-backup
71 reverting a
71 reverting a
72
72
73 Fold git patch into a regular patch, expect git patch:
73 Fold git patch into a regular patch, expect git patch:
74
74
75 $ echo a >> a
75 $ echo a >> a
76 $ hg qnew -f regular
76 $ hg qnew -f regular
77 $ hg cp a aa
77 $ hg cp a aa
78 $ hg qnew --git -f git
78 $ hg qnew --git -f git
79
79
80 $ hg qpop
80 $ hg qpop
81 popping git
81 popping git
82 now at: regular
82 now at: regular
83
83
84 $ hg qfold git
84 $ hg qfold git
85
85
86 $ cat .hg/patches/regular
86 $ cat .hg/patches/regular
87 # HG changeset patch
87 # HG changeset patch
88 # Parent ???????????????????????????????????????? (glob)
88 # Parent ???????????????????????????????????????? (glob)
89
89
90 diff --git a/a b/a
90 diff --git a/a b/a
91 --- a/a
91 --- a/a
92 +++ b/a
92 +++ b/a
93 @@ -1,3 +1,4 @@
93 @@ -1,3 +1,4 @@
94 a
94 a
95 a
95 a
96 b
96 b
97 +a
97 +a
98 diff --git a/a b/aa
98 diff --git a/a b/aa
99 copy from a
99 copy from a
100 copy to aa
100 copy to aa
101 --- a/a
101 --- a/a
102 +++ b/aa
102 +++ b/aa
103 @@ -1,3 +1,4 @@
103 @@ -1,3 +1,4 @@
104 a
104 a
105 a
105 a
106 b
106 b
107 +a
107 +a
108
108
109 $ hg qpop
109 $ hg qpop
110 popping regular
110 popping regular
111 now at: p1
111 now at: p1
112
112
113 $ hg qdel regular
113 $ hg qdel regular
114
114
115 Fold regular patch into a git patch, expect git patch:
115 Fold regular patch into a git patch, expect git patch:
116
116
117 $ hg cp a aa
117 $ hg cp a aa
118 $ hg qnew --git -f git
118 $ hg qnew --git -f git
119 $ echo b >> aa
119 $ echo b >> aa
120 $ hg qnew -f regular
120 $ hg qnew -f regular
121
121
122 $ hg qpop
122 $ hg qpop
123 popping regular
123 popping regular
124 now at: git
124 now at: git
125
125
126 $ hg qfold regular
126 $ hg qfold regular
127
127
128 $ cat .hg/patches/git
128 $ cat .hg/patches/git
129 # HG changeset patch
129 # HG changeset patch
130 # Parent ???????????????????????????????????????? (glob)
130 # Parent ???????????????????????????????????????? (glob)
131
131
132 diff --git a/a b/aa
132 diff --git a/a b/aa
133 copy from a
133 copy from a
134 copy to aa
134 copy to aa
135 --- a/a
135 --- a/a
136 +++ b/aa
136 +++ b/aa
137 @@ -1,3 +1,4 @@
137 @@ -1,3 +1,4 @@
138 a
138 a
139 a
139 a
140 b
140 b
141 +b
141 +b
142
142
143 Test saving last-message.txt:
143 Test saving last-message.txt:
144
144
145 $ hg qrefresh -m "original message"
145 $ hg qrefresh -m "original message"
146
146
147 $ cat > $TESTTMP/commitfailure.py <<EOF
147 $ cat > $TESTTMP/commitfailure.py <<EOF
148 > from mercurial import util
148 > from mercurial import util
149 > def reposetup(ui, repo):
149 > def reposetup(ui, repo):
150 > class commitfailure(repo.__class__):
150 > class commitfailure(repo.__class__):
151 > def commit(self, *args, **kwargs):
151 > def commit(self, *args, **kwargs):
152 > raise util.Abort('emulating unexpected abort')
152 > raise util.Abort('emulating unexpected abort')
153 > repo.__class__ = commitfailure
153 > repo.__class__ = commitfailure
154 > EOF
154 > EOF
155
155
156 $ cat > .hg/hgrc <<EOF
156 $ cat >> .hg/hgrc <<EOF
157 > [extensions]
157 > [extensions]
158 > # this failure occurs before editor invocation
158 > commitfailure = $TESTTMP/commitfailure.py
159 > commitfailure = $TESTTMP/commitfailure.py
159 > EOF
160 > EOF
160
161
161 $ cat > $TESTTMP/editor.sh << EOF
162 $ cat > $TESTTMP/editor.sh << EOF
162 > echo "==== before editing"
163 > echo "==== before editing"
163 > cat \$1
164 > cat \$1
164 > echo "===="
165 > echo "===="
165 > (echo; echo "test saving last-message.txt") >> \$1
166 > (echo; echo "test saving last-message.txt") >> \$1
166 > EOF
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 $ rm -f .hg/last-message.txt
177 $ rm -f .hg/last-message.txt
169 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
178 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
170 ==== before editing
171 original message====
172 refresh interrupted while patch was popped! (revert --all, qpush to recover)
179 refresh interrupted while patch was popped! (revert --all, qpush to recover)
173 abort: emulating unexpected abort
180 abort: emulating unexpected abort
174 [255]
181 [255]
175 $ cat .hg/last-message.txt
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 original message
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 test saving last-message.txt
228 test saving last-message.txt
178
229
179 $ cd ..
230 $ cd ..
180
231
@@ -1,61 +1,144 b''
1 Environment setup for MQ
1 Environment setup for MQ
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5 $ hg init
5 $ hg init
6 $ hg qinit
6 $ hg qinit
7
7
8 Should fail if no patches applied
8 Should fail if no patches applied
9
9
10 $ hg qrefresh
10 $ hg qrefresh
11 no patches applied
11 no patches applied
12 [1]
12 [1]
13 $ hg qrefresh -e
13 $ hg qrefresh -e
14 no patches applied
14 no patches applied
15 [1]
15 [1]
16 $ hg qnew -m "First commit message" first-patch
16 $ hg qnew -m "First commit message" first-patch
17 $ echo aaaa > file
17 $ echo aaaa > file
18 $ hg add file
18 $ hg add file
19 $ hg qrefresh
19 $ hg qrefresh
20
20
21 Should display 'First commit message'
21 Should display 'First commit message'
22
22
23 $ hg log -l1 --template "{desc}\n"
23 $ hg log -l1 --template "{desc}\n"
24 First commit message
24 First commit message
25
25
26 Testing changing message with -m
26 Testing changing message with -m
27
27
28 $ echo bbbb > file
28 $ echo bbbb > file
29 $ hg qrefresh -m "Second commit message"
29 $ hg qrefresh -m "Second commit message"
30
30
31 Should display 'Second commit message'
31 Should display 'Second commit message'
32
32
33 $ hg log -l1 --template "{desc}\n"
33 $ hg log -l1 --template "{desc}\n"
34 Second commit message
34 Second commit message
35
35
36 Testing changing message with -l
36 Testing changing message with -l
37
37
38 $ echo "Third commit message" > logfile
38 $ echo "Third commit message" > logfile
39 $ echo " This is the 3rd log message" >> logfile
39 $ echo " This is the 3rd log message" >> logfile
40 $ echo bbbb > file
40 $ echo bbbb > file
41 $ hg qrefresh -l logfile
41 $ hg qrefresh -l logfile
42
42
43 Should display 'Third commit message\\\n This is the 3rd log message'
43 Should display 'Third commit message\\\n This is the 3rd log message'
44
44
45 $ hg log -l1 --template "{desc}\n"
45 $ hg log -l1 --template "{desc}\n"
46 Third commit message
46 Third commit message
47 This is the 3rd log message
47 This is the 3rd log message
48
48
49 Testing changing message with -l-
49 Testing changing message with -l-
50
50
51 $ hg qnew -m "First commit message" second-patch
51 $ hg qnew -m "First commit message" second-patch
52 $ echo aaaa > file2
52 $ echo aaaa > file2
53 $ hg add file2
53 $ hg add file2
54 $ echo bbbb > file2
54 $ echo bbbb > file2
55 $ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l-
55 $ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l-
56
56
57 Should display 'Fifth commit message\\\n This is the 5th log message'
57 Should display 'Fifth commit message\\\n This is the 5th log message'
58
58
59 $ hg log -l1 --template "{desc}\n"
59 $ hg log -l1 --template "{desc}\n"
60 Fifth commit message
60 Fifth commit message
61 This is the 5th log message
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