##// END OF EJS Templates
mq: add parent node IDs to MQ patches on qrefresh/qnew...
Steve Losh -
r10397:8cb81d75 default
parent child Browse files
Show More
@@ -68,7 +68,7 b' class statusentry(object):'
68 68 return self.rev + ':' + self.name
69 69
70 70 class patchheader(object):
71 def __init__(self, pf):
71 def __init__(self, pf, plainmode=False):
72 72 def eatdiff(lines):
73 73 while lines:
74 74 l = lines[-1]
@@ -90,6 +90,7 b' class patchheader(object):'
90 90 comments = []
91 91 user = None
92 92 date = None
93 parent = None
93 94 format = None
94 95 subject = None
95 96 diffstart = 0
@@ -112,6 +113,8 b' class patchheader(object):'
112 113 user = line[7:]
113 114 elif line.startswith("# Date "):
114 115 date = line[7:]
116 elif line.startswith("# Parent "):
117 parent = line[9:]
115 118 elif not line.startswith("# ") and line:
116 119 message.append(line)
117 120 format = None
@@ -126,6 +129,10 b' class patchheader(object):'
126 129 line.startswith("from: "))):
127 130 user = line[6:]
128 131 format = "tag"
132 elif (format != "tagdone" and (line.startswith("Date: ") or
133 line.startswith("date: "))):
134 date = line[6:]
135 format = "tag"
129 136 elif format == "tag" and line == "":
130 137 # when looking for tags (subject: from: etc) they
131 138 # end once you find a blank line in the source
@@ -148,7 +155,9 b' class patchheader(object):'
148 155 self.comments = comments
149 156 self.user = user
150 157 self.date = date
158 self.parent = parent
151 159 self.haspatch = diffstart > 1
160 self.plainmode = plainmode
152 161
153 162 def setuser(self, user):
154 163 if not self.updateheader(['From: ', '# User '], user):
@@ -156,7 +165,7 b' class patchheader(object):'
156 165 patchheaderat = self.comments.index('# HG changeset patch')
157 166 self.comments.insert(patchheaderat + 1, '# User ' + user)
158 167 except ValueError:
159 if self._hasheader(['Date: ']):
168 if self.plainmode or self._hasheader(['Date: ']):
160 169 self.comments = ['From: ' + user] + self.comments
161 170 else:
162 171 tmp = ['# HG changeset patch', '# User ' + user, '']
@@ -169,13 +178,22 b' class patchheader(object):'
169 178 patchheaderat = self.comments.index('# HG changeset patch')
170 179 self.comments.insert(patchheaderat + 1, '# Date ' + date)
171 180 except ValueError:
172 if self._hasheader(['From: ']):
181 if self.plainmode or self._hasheader(['From: ']):
173 182 self.comments = ['Date: ' + date] + self.comments
174 183 else:
175 184 tmp = ['# HG changeset patch', '# Date ' + date, '']
176 185 self.comments = tmp + self.comments
177 186 self.date = date
178 187
188 def setparent(self, parent):
189 if not self.updateheader(['# Parent '], parent):
190 try:
191 patchheaderat = self.comments.index('# HG changeset patch')
192 self.comments.insert(patchheaderat + 1, '# Parent ' + parent)
193 except ValueError:
194 pass
195 self.parent = parent
196
179 197 def setmessage(self, message):
180 198 if self.comments:
181 199 self._delmsg()
@@ -245,6 +263,7 b' class queue(object):'
245 263 self.gitmode = gitmode and 'yes' or 'no'
246 264 except error.ConfigError:
247 265 self.gitmode = ui.config('mq', 'git', 'auto').lower()
266 self.plainmode = ui.configbool('mq', 'plain', False)
248 267
249 268 @util.propertycache
250 269 def applied(self):
@@ -509,7 +528,7 b' class queue(object):'
509 528 if n is None:
510 529 raise util.Abort(_("repo commit failed"))
511 530 try:
512 ph = patchheader(mergeq.join(patch))
531 ph = patchheader(mergeq.join(patch), self.plainmode)
513 532 except:
514 533 raise util.Abort(_("unable to read %s") % patch)
515 534
@@ -639,7 +658,7 b' class queue(object):'
639 658 pf = os.path.join(patchdir, patchname)
640 659
641 660 try:
642 ph = patchheader(self.join(patchname))
661 ph = patchheader(self.join(patchname), self.plainmode)
643 662 except:
644 663 self.ui.warn(_("unable to read %s\n") % patchname)
645 664 err = 1
@@ -831,14 +850,20 b' class queue(object):'
831 850 # if patch file write fails, abort early
832 851 p = self.opener(patchfn, "w")
833 852 try:
853 if self.plainmode:
854 if user:
855 p.write("From: " + user + "\n")
856 if not date:
857 p.write("\n")
834 858 if date:
859 p.write("Date: %d %d\n\n" % date)
860 else:
835 861 p.write("# HG changeset patch\n")
862 p.write("# Parent " + hex(repo[None].parents()[0].node()) + "\n")
836 863 if user:
837 864 p.write("# User " + user + "\n")
838 p.write("# Date %d %d\n\n" % date)
839 elif user:
840 p.write("From: " + user + "\n\n")
841
865 if date:
866 p.write("# Date %s %s\n\n" % date)
842 867 if hasattr(msg, '__call__'):
843 868 msg = msg()
844 869 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
@@ -1214,7 +1239,7 b' class queue(object):'
1214 1239
1215 1240 cparents = repo.changelog.parents(top)
1216 1241 patchparent = self.qparents(repo, top)
1217 ph = patchheader(self.join(patchfn))
1242 ph = patchheader(self.join(patchfn), self.plainmode)
1218 1243 diffopts = self.diffopts({'git': opts.get('git')}, patchfn)
1219 1244 if msg:
1220 1245 ph.setmessage(msg)
@@ -1222,6 +1247,7 b' class queue(object):'
1222 1247 ph.setuser(newuser)
1223 1248 if newdate:
1224 1249 ph.setdate(newdate)
1250 ph.setparent(hex(patchparent))
1225 1251
1226 1252 # only commit new patch when write is complete
1227 1253 patchf = self.opener(patchfn, 'w', atomictemp=True)
@@ -1406,7 +1432,7 b' class queue(object):'
1406 1432 summary=False):
1407 1433 def displayname(pfx, patchname):
1408 1434 if summary:
1409 ph = patchheader(self.join(patchname))
1435 ph = patchheader(self.join(patchname), self.plainmode)
1410 1436 msg = ph.message and ph.message[0] or ''
1411 1437 if self.ui.interactive():
1412 1438 width = util.termwidth() - len(pfx) - len(patchname) - 2
@@ -2012,7 +2038,7 b' def refresh(ui, repo, *pats, **opts):'
2012 2038 if message:
2013 2039 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
2014 2040 patch = q.applied[-1].name
2015 ph = patchheader(q.join(patch))
2041 ph = patchheader(q.join(patch), q.plainmode)
2016 2042 message = ui.edit('\n'.join(ph.message), ph.user or ui.username())
2017 2043 setupheaderopts(ui, opts)
2018 2044 ret = q.refresh(repo, pats, msg=message, **opts)
@@ -2074,7 +2100,7 b' def fold(ui, repo, *files, **opts):'
2074 2100
2075 2101 for p in patches:
2076 2102 if not message:
2077 ph = patchheader(q.join(p))
2103 ph = patchheader(q.join(p), q.plainmode)
2078 2104 if ph.message:
2079 2105 messages.append(ph.message)
2080 2106 pf = q.join(p)
@@ -2084,7 +2110,7 b' def fold(ui, repo, *files, **opts):'
2084 2110 patch.updatedir(ui, repo, files)
2085 2111
2086 2112 if not message:
2087 ph = patchheader(q.join(parent))
2113 ph = patchheader(q.join(parent), q.plainmode)
2088 2114 message, user = ph.message, ph.user
2089 2115 for msg in messages:
2090 2116 message.append('* * *')
@@ -2167,7 +2193,7 b' def header(ui, repo, patch=None):'
2167 2193 ui.write('no patches applied\n')
2168 2194 return 1
2169 2195 patch = q.lookup('qtip')
2170 ph = patchheader(repo.mq.join(patch))
2196 ph = patchheader(q.join(patch), q.plainmode)
2171 2197
2172 2198 ui.write('\n'.join(ph.message) + '\n')
2173 2199
@@ -10,6 +10,9 b' checkundo()'
10 10 echo "[extensions]" >> $HGRCPATH
11 11 echo "mq=" >> $HGRCPATH
12 12
13 echo "[mq]" >> $HGRCPATH
14 echo "plain=true" >> $HGRCPATH
15
13 16 echo % help
14 17 hg help mq
15 18
@@ -1,5 +1,6 b''
1 1 % git=auto: regular patch creation
2 2 # HG changeset patch
3 # Parent 0000000000000000000000000000000000000000
3 4 # Date 0 0
4 5
5 6 diff -r 000000000000 -r ef8dafc9fa4c a
@@ -9,6 +10,7 b' diff -r 000000000000 -r ef8dafc9fa4c a'
9 10 +a
10 11 % git=auto: git patch creation with copy
11 12 # HG changeset patch
13 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
12 14 # Date 0 0
13 15
14 16 diff --git a/a b/b
@@ -16,6 +18,7 b' copy from a'
16 18 copy to b
17 19 % git=auto: git patch when using --git
18 20 # HG changeset patch
21 # Parent 2962f232b49d41ebc26c591ec8d556724be213ab
19 22 # Date 0 0
20 23
21 24 diff --git a/regular b/regular
@@ -26,6 +29,7 b' new file mode 100644'
26 29 +regular
27 30 % git=auto: regular patch after qrefresh without --git
28 31 # HG changeset patch
32 # Parent 2962f232b49d41ebc26c591ec8d556724be213ab
29 33 # Date 0 0
30 34
31 35 diff -r 2962f232b49d regular
@@ -35,6 +39,7 b' diff -r 2962f232b49d regular'
35 39 +regular
36 40 % git=keep: git patch with --git
37 41 # HG changeset patch
42 # Parent 0000000000000000000000000000000000000000
38 43 # Date 0 0
39 44
40 45 diff --git a/a b/a
@@ -45,6 +50,7 b' new file mode 100644'
45 50 +a
46 51 % git=keep: git patch after qrefresh without --git
47 52 # HG changeset patch
53 # Parent 0000000000000000000000000000000000000000
48 54 # Date 0 0
49 55
50 56 diff --git a/a b/a
@@ -56,6 +62,7 b' new file mode 100644'
56 62 +a
57 63 % git=yes: git patch
58 64 # HG changeset patch
65 # Parent 0000000000000000000000000000000000000000
59 66 # Date 0 0
60 67
61 68 diff --git a/a b/a
@@ -66,6 +73,7 b' new file mode 100644'
66 73 +a
67 74 % git=yes: git patch after qrefresh
68 75 # HG changeset patch
76 # Parent 0000000000000000000000000000000000000000
69 77 # Date 0 0
70 78
71 79 diff --git a/a b/a
@@ -77,6 +85,7 b' new file mode 100644'
77 85 +a
78 86 % git=no: regular patch with copy
79 87 # HG changeset patch
88 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
80 89 # Date 0 0
81 90
82 91 diff -r ef8dafc9fa4c -r 110cde11d262 b
@@ -86,6 +95,7 b' diff -r ef8dafc9fa4c -r 110cde11d262 b'
86 95 +a
87 96 % git=no: regular patch after qrefresh with copy
88 97 # HG changeset patch
98 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
89 99 # Date 0 0
90 100
91 101 diff -r ef8dafc9fa4c b
@@ -7,7 +7,8 b' echo "nodates=true" >> $HGRCPATH'
7 7
8 8
9 9 catpatch() {
10 cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /"
10 cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /" \
11 -e "s/^\(# Parent \).*/\1/"
11 12 }
12 13
13 14 catlog() {
@@ -25,7 +26,7 b' drop() {'
25 26 hg qdel $1.patch
26 27 }
27 28
28
29 runtest() {
29 30 echo ==== init
30 31 hg init a
31 32 cd a
@@ -99,7 +100,7 b' drop 4'
99 100
100 101
101 102 echo ==== qnew with HG header
102 hg qnew 5.patch
103 hg qnew --config 'mq.plain=true' 5.patch
103 104 hg qpop
104 105 echo "# HG changeset patch" >>.hg/patches/5.patch
105 106 echo "# Date 10 0" >>.hg/patches/5.patch
@@ -117,6 +118,25 b" hg qref -d '11 0'"
117 118 catlogd 5
118 119
119 120
121 echo ==== qnew with plain header
122 hg qnew --config 'mq.plain=true' -d '12 0' 6.patch
123 hg qpop
124 hg qpush 2>&1 | grep 'now at'
125 catlog 6
126
127 echo ==== hg qref
128 echo "6" >6
129 hg add
130 hg qref
131 catlogd 6
132
133 echo ==== hg qref -d
134 hg qref -d '13 0'
135 catlogd 6
136
137 drop 6
138
139
120 140 echo ==== qnew -u
121 141 hg qnew -u jane 6.patch
122 142 echo "6" >6
@@ -175,3 +195,23 b' echo ==== "qpop -a / qpush -a"'
175 195 hg qpop -a
176 196 hg qpush -a
177 197 hg log --template "{rev}: {desc} - {author} - {date}\n"
198 }
199
200
201 echo ======= plain headers
202
203 echo "[mq]" >> $HGRCPATH
204 echo "plain=true" >> $HGRCPATH
205
206 mkdir sandbox
207 (cd sandbox ; runtest)
208 rm -r sandbox
209
210
211 echo ======= hg headers
212
213 echo "plain=false" >> $HGRCPATH
214
215 mkdir sandbox
216 (cd sandbox ; runtest)
217 rm -r sandbox
@@ -1,13 +1,12 b''
1 ======= plain headers
1 2 ==== init
2 3 ==== qnew -d
3 # HG changeset patch
4 # Date 3 0
4 Date: 3 0
5 5
6 6 0: [mq]: 1.patch - test - 3.00
7 7 ==== qref
8 8 adding 1
9 # HG changeset patch
10 # Date 3 0
9 Date: 3 0
11 10
12 11 diff -r ... 1
13 12 --- /dev/null
@@ -16,8 +15,7 b' diff -r ... 1'
16 15 +1
17 16 0: [mq]: 1.patch - test - 3.00
18 17 ==== qref -d
19 # HG changeset patch
20 # Date 4 0
18 Date: 4 0
21 19
22 20 diff -r ... 1
23 21 --- /dev/null
@@ -35,9 +33,7 b' diff -r ... 2'
35 33 1: [mq]: 2.patch - test
36 34 0: [mq]: 1.patch - test
37 35 ==== qref -d
38 # HG changeset patch
39 # Date 5 0
40
36 Date: 5 0
41 37
42 38 diff -r ... 2
43 39 --- /dev/null
@@ -49,8 +45,7 b' 0: [mq]: 1.patch - test'
49 45 popping 2.patch
50 46 now at: 1.patch
51 47 ==== qnew -d -m
52 # HG changeset patch
53 # Date 6 0
48 Date: 6 0
54 49
55 50 Three
56 51
@@ -58,8 +53,7 b' 1: Three - test - 6.00'
58 53 0: [mq]: 1.patch - test - 4.00
59 54 ==== qref
60 55 adding 3
61 # HG changeset patch
62 # Date 6 0
56 Date: 6 0
63 57
64 58 Three
65 59
@@ -71,8 +65,7 b' diff -r ... 3'
71 65 1: Three - test - 6.00
72 66 0: [mq]: 1.patch - test - 4.00
73 67 ==== qref -m
74 # HG changeset patch
75 # Date 6 0
68 Date: 6 0
76 69
77 70 Drei
78 71
@@ -84,8 +77,7 b' diff -r ... 3'
84 77 1: Drei - test - 6.00
85 78 0: [mq]: 1.patch - test - 4.00
86 79 ==== qref -d
87 # HG changeset patch
88 # Date 7 0
80 Date: 7 0
89 81
90 82 Drei
91 83
@@ -97,8 +89,7 b' diff -r ... 3'
97 89 1: Drei - test - 7.00
98 90 0: [mq]: 1.patch - test - 4.00
99 91 ==== qref -d -m
100 # HG changeset patch
101 # Date 8 0
92 Date: 8 0
102 93
103 94 Three (again)
104 95
@@ -122,9 +113,7 b' 2: Four - test'
122 113 1: Three (again) - test
123 114 0: [mq]: 1.patch - test
124 115 ==== qref -d
125 # HG changeset patch
126 # Date 9 0
127
116 Date: 9 0
128 117 Four
129 118
130 119 diff -r ... 4
@@ -148,6 +137,7 b' 0: [mq]: 1.patch - test - 4.00'
148 137 ==== hg qref
149 138 adding 5
150 139 # HG changeset patch
140 # Parent
151 141 # Date 10 0
152 142
153 143 diff -r ... 5
@@ -160,6 +150,7 b' 1: Three (again) - test - 8.00'
160 150 0: [mq]: 1.patch - test - 4.00
161 151 ==== hg qref -d
162 152 # HG changeset patch
153 # Parent
163 154 # Date 11 0
164 155
165 156 diff -r ... 5
@@ -170,6 +161,43 b' diff -r ... 5'
170 161 2: [mq]: 5.patch - test - 11.00
171 162 1: Three (again) - test - 8.00
172 163 0: [mq]: 1.patch - test - 4.00
164 ==== qnew with plain header
165 popping 6.patch
166 now at: 5.patch
167 now at: 6.patch
168 Date: 12 0
169
170 3: imported patch 6.patch - test
171 2: [mq]: 5.patch - test
172 1: Three (again) - test
173 0: [mq]: 1.patch - test
174 ==== hg qref
175 adding 6
176 Date: 12 0
177
178 diff -r ... 6
179 --- /dev/null
180 +++ b/6
181 @@ -0,0 +1,1 @@
182 +6
183 3: [mq]: 6.patch - test - 12.00
184 2: [mq]: 5.patch - test - 11.00
185 1: Three (again) - test - 8.00
186 0: [mq]: 1.patch - test - 4.00
187 ==== hg qref -d
188 Date: 13 0
189
190 diff -r ... 6
191 --- /dev/null
192 +++ b/6
193 @@ -0,0 +1,1 @@
194 +6
195 3: [mq]: 6.patch - test - 13.00
196 2: [mq]: 5.patch - test - 11.00
197 1: Three (again) - test - 8.00
198 0: [mq]: 1.patch - test - 4.00
199 popping 6.patch
200 now at: 5.patch
173 201 ==== qnew -u
174 202 adding 6
175 203 From: jane
@@ -200,8 +228,7 b' popping 6.patch'
200 228 now at: 5.patch
201 229 ==== qnew -d
202 230 adding 7
203 # HG changeset patch
204 # Date 13 0
231 Date: 13 0
205 232
206 233 diff -r ... 7
207 234 --- /dev/null
@@ -213,9 +240,8 b' 2: [mq]: 5.patch - test'
213 240 1: Three (again) - test
214 241 0: [mq]: 1.patch - test
215 242 ==== qref -u
216 # HG changeset patch
217 # User john
218 # Date 13 0
243 From: john
244 Date: 13 0
219 245
220 246 diff -r ... 7
221 247 --- /dev/null
@@ -239,10 +265,8 b' 2: [mq]: 5.patch - test'
239 265 1: Three (again) - test
240 266 0: [mq]: 1.patch - test
241 267 ==== qref -u -d
242 # HG changeset patch
243 # Date 14 0
244 # User john
245
268 Date: 14 0
269 From: john
246 270
247 271 diff -r ... 8
248 272 --- /dev/null
@@ -271,10 +295,8 b' 2: [mq]: 5.patch - test'
271 295 1: Three (again) - test
272 296 0: [mq]: 1.patch - test
273 297 ==== qref -u -d
274 # HG changeset patch
275 # Date 15 0
276 # User john
277
298 Date: 15 0
299 From: john
278 300 Nine
279 301
280 302 diff -r ... 9
@@ -304,3 +326,373 b' 3: imported patch 7.patch - john - 13.00'
304 326 2: imported patch 5.patch - test - 11.00
305 327 1: Three (again) - test - 8.00
306 328 0: imported patch 1.patch - test - 4.00
329 ======= hg headers
330 ==== init
331 ==== qnew -d
332 # HG changeset patch
333 # Parent
334 # Date 3 0
335
336 0: [mq]: 1.patch - test - 3.00
337 ==== qref
338 adding 1
339 # HG changeset patch
340 # Parent
341 # Date 3 0
342
343 diff -r ... 1
344 --- /dev/null
345 +++ b/1
346 @@ -0,0 +1,1 @@
347 +1
348 0: [mq]: 1.patch - test - 3.00
349 ==== qref -d
350 # HG changeset patch
351 # Parent
352 # Date 4 0
353
354 diff -r ... 1
355 --- /dev/null
356 +++ b/1
357 @@ -0,0 +1,1 @@
358 +1
359 0: [mq]: 1.patch - test - 4.00
360 ==== qnew
361 adding 2
362 # HG changeset patch
363 # Parent
364
365 diff -r ... 2
366 --- /dev/null
367 +++ b/2
368 @@ -0,0 +1,1 @@
369 +2
370 1: [mq]: 2.patch - test
371 0: [mq]: 1.patch - test
372 ==== qref -d
373 # HG changeset patch
374 # Date 5 0
375 # Parent
376
377 diff -r ... 2
378 --- /dev/null
379 +++ b/2
380 @@ -0,0 +1,1 @@
381 +2
382 1: [mq]: 2.patch - test
383 0: [mq]: 1.patch - test
384 popping 2.patch
385 now at: 1.patch
386 ==== qnew -d -m
387 # HG changeset patch
388 # Parent
389 # Date 6 0
390
391 Three
392
393 1: Three - test - 6.00
394 0: [mq]: 1.patch - test - 4.00
395 ==== qref
396 adding 3
397 # HG changeset patch
398 # Parent
399 # Date 6 0
400
401 Three
402
403 diff -r ... 3
404 --- /dev/null
405 +++ b/3
406 @@ -0,0 +1,1 @@
407 +3
408 1: Three - test - 6.00
409 0: [mq]: 1.patch - test - 4.00
410 ==== qref -m
411 # HG changeset patch
412 # Parent
413 # Date 6 0
414
415 Drei
416
417 diff -r ... 3
418 --- /dev/null
419 +++ b/3
420 @@ -0,0 +1,1 @@
421 +3
422 1: Drei - test - 6.00
423 0: [mq]: 1.patch - test - 4.00
424 ==== qref -d
425 # HG changeset patch
426 # Parent
427 # Date 7 0
428
429 Drei
430
431 diff -r ... 3
432 --- /dev/null
433 +++ b/3
434 @@ -0,0 +1,1 @@
435 +3
436 1: Drei - test - 7.00
437 0: [mq]: 1.patch - test - 4.00
438 ==== qref -d -m
439 # HG changeset patch
440 # Parent
441 # Date 8 0
442
443 Three (again)
444
445 diff -r ... 3
446 --- /dev/null
447 +++ b/3
448 @@ -0,0 +1,1 @@
449 +3
450 1: Three (again) - test - 8.00
451 0: [mq]: 1.patch - test - 4.00
452 ==== qnew -m
453 adding 4
454 # HG changeset patch
455 # Parent
456 Four
457
458 diff -r ... 4
459 --- /dev/null
460 +++ b/4
461 @@ -0,0 +1,1 @@
462 +4
463 2: Four - test
464 1: Three (again) - test
465 0: [mq]: 1.patch - test
466 ==== qref -d
467 # HG changeset patch
468 # Date 9 0
469 # Parent
470 Four
471
472 diff -r ... 4
473 --- /dev/null
474 +++ b/4
475 @@ -0,0 +1,1 @@
476 +4
477 2: Four - test
478 1: Three (again) - test
479 0: [mq]: 1.patch - test
480 popping 4.patch
481 now at: 3.patch
482 ==== qnew with HG header
483 popping 5.patch
484 now at: 3.patch
485 # HG changeset patch
486 # Date 10 0
487 2: imported patch 5.patch - test - 10.00
488 1: Three (again) - test - 8.00
489 0: [mq]: 1.patch - test - 4.00
490 ==== hg qref
491 adding 5
492 # HG changeset patch
493 # Parent
494 # Date 10 0
495
496 diff -r ... 5
497 --- /dev/null
498 +++ b/5
499 @@ -0,0 +1,1 @@
500 +5
501 2: [mq]: 5.patch - test - 10.00
502 1: Three (again) - test - 8.00
503 0: [mq]: 1.patch - test - 4.00
504 ==== hg qref -d
505 # HG changeset patch
506 # Parent
507 # Date 11 0
508
509 diff -r ... 5
510 --- /dev/null
511 +++ b/5
512 @@ -0,0 +1,1 @@
513 +5
514 2: [mq]: 5.patch - test - 11.00
515 1: Three (again) - test - 8.00
516 0: [mq]: 1.patch - test - 4.00
517 ==== qnew with plain header
518 popping 6.patch
519 now at: 5.patch
520 now at: 6.patch
521 Date: 12 0
522
523 3: imported patch 6.patch - test
524 2: [mq]: 5.patch - test
525 1: Three (again) - test
526 0: [mq]: 1.patch - test
527 ==== hg qref
528 adding 6
529 Date: 12 0
530
531 diff -r ... 6
532 --- /dev/null
533 +++ b/6
534 @@ -0,0 +1,1 @@
535 +6
536 3: [mq]: 6.patch - test - 12.00
537 2: [mq]: 5.patch - test - 11.00
538 1: Three (again) - test - 8.00
539 0: [mq]: 1.patch - test - 4.00
540 ==== hg qref -d
541 Date: 13 0
542
543 diff -r ... 6
544 --- /dev/null
545 +++ b/6
546 @@ -0,0 +1,1 @@
547 +6
548 3: [mq]: 6.patch - test - 13.00
549 2: [mq]: 5.patch - test - 11.00
550 1: Three (again) - test - 8.00
551 0: [mq]: 1.patch - test - 4.00
552 popping 6.patch
553 now at: 5.patch
554 ==== qnew -u
555 adding 6
556 # HG changeset patch
557 # Parent
558 # User jane
559
560 diff -r ... 6
561 --- /dev/null
562 +++ b/6
563 @@ -0,0 +1,1 @@
564 +6
565 3: [mq]: 6.patch - jane
566 2: [mq]: 5.patch - test
567 1: Three (again) - test
568 0: [mq]: 1.patch - test
569 ==== qref -d
570 # HG changeset patch
571 # Date 12 0
572 # Parent
573 # User jane
574
575 diff -r ... 6
576 --- /dev/null
577 +++ b/6
578 @@ -0,0 +1,1 @@
579 +6
580 3: [mq]: 6.patch - jane
581 2: [mq]: 5.patch - test
582 1: Three (again) - test
583 0: [mq]: 1.patch - test
584 popping 6.patch
585 now at: 5.patch
586 ==== qnew -d
587 adding 7
588 # HG changeset patch
589 # Parent
590 # Date 13 0
591
592 diff -r ... 7
593 --- /dev/null
594 +++ b/7
595 @@ -0,0 +1,1 @@
596 +7
597 3: [mq]: 7.patch - test
598 2: [mq]: 5.patch - test
599 1: Three (again) - test
600 0: [mq]: 1.patch - test
601 ==== qref -u
602 # HG changeset patch
603 # User john
604 # Parent
605 # Date 13 0
606
607 diff -r ... 7
608 --- /dev/null
609 +++ b/7
610 @@ -0,0 +1,1 @@
611 +7
612 3: [mq]: 7.patch - john - 13.00
613 2: [mq]: 5.patch - test - 11.00
614 1: Three (again) - test - 8.00
615 0: [mq]: 1.patch - test - 4.00
616 ==== qnew
617 adding 8
618 # HG changeset patch
619 # Parent
620
621 diff -r ... 8
622 --- /dev/null
623 +++ b/8
624 @@ -0,0 +1,1 @@
625 +8
626 4: [mq]: 8.patch - test
627 3: [mq]: 7.patch - john
628 2: [mq]: 5.patch - test
629 1: Three (again) - test
630 0: [mq]: 1.patch - test
631 ==== qref -u -d
632 # HG changeset patch
633 # Date 14 0
634 # User john
635 # Parent
636
637 diff -r ... 8
638 --- /dev/null
639 +++ b/8
640 @@ -0,0 +1,1 @@
641 +8
642 4: [mq]: 8.patch - john
643 3: [mq]: 7.patch - john
644 2: [mq]: 5.patch - test
645 1: Three (again) - test
646 0: [mq]: 1.patch - test
647 popping 8.patch
648 now at: 7.patch
649 ==== qnew -m
650 adding 9
651 # HG changeset patch
652 # Parent
653 Nine
654
655 diff -r ... 9
656 --- /dev/null
657 +++ b/9
658 @@ -0,0 +1,1 @@
659 +9
660 4: Nine - test
661 3: [mq]: 7.patch - john
662 2: [mq]: 5.patch - test
663 1: Three (again) - test
664 0: [mq]: 1.patch - test
665 ==== qref -u -d
666 # HG changeset patch
667 # Date 15 0
668 # User john
669 # Parent
670 Nine
671
672 diff -r ... 9
673 --- /dev/null
674 +++ b/9
675 @@ -0,0 +1,1 @@
676 +9
677 4: Nine - john
678 3: [mq]: 7.patch - john
679 2: [mq]: 5.patch - test
680 1: Three (again) - test
681 0: [mq]: 1.patch - test
682 popping 9.patch
683 now at: 7.patch
684 ==== qpop -a / qpush -a
685 popping 7.patch
686 popping 5.patch
687 popping 3.patch
688 popping 1.patch
689 patch queue now empty
690 applying 1.patch
691 applying 3.patch
692 applying 5.patch
693 applying 7.patch
694 now at: 7.patch
695 3: imported patch 7.patch - john - 13.00
696 2: imported patch 5.patch - test - 11.00
697 1: Three (again) - test - 8.00
698 0: imported patch 1.patch - test - 4.00
@@ -7,11 +7,12 b' echo "nodates=true" >> $HGRCPATH'
7 7
8 8
9 9 catlog() {
10 cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /"
10 cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /" \
11 -e "s/^\(# Parent \).*/\1/"
11 12 hg log --template "{rev}: {desc} - {author}\n"
12 13 }
13 14
14
15 runtest() {
15 16 echo ==== init
16 17 hg init a
17 18 cd a
@@ -68,7 +69,7 b' catlog 3'
68 69
69 70 echo ==== qnew -m
70 71 hg qnew -m "Four" 4.patch
71 echo "4" >4
72 echo "4" >4of t
72 73 hg add
73 74 hg qref
74 75 catlog 4
@@ -79,7 +80,7 b' catlog 4'
79 80
80 81
81 82 echo ==== qnew with HG header
82 hg qnew 5.patch
83 hg qnew --config 'mq.plain=true' 5.patch
83 84 hg qpop
84 85 echo "# HG changeset patch" >>.hg/patches/5.patch
85 86 echo "# User johndoe" >>.hg/patches/5.patch
@@ -101,7 +102,50 b' hg qref -u johndeere'
101 102 catlog 5
102 103
103 104
105 echo ==== qnew with plain header
106 hg qnew --config 'mq.plain=true' -U 6.patch
107 hg qpop
108 hg qpush 2>&1 | grep 'now at'
109 catlog 6
110
111 echo ==== hg qref
112 echo "6" >6
113 hg add
114 hg qref
115 catlog 6
116
117 echo ==== hg qref -U
118 hg qref -U
119 catlog 6
120
121 echo ==== hg qref -u
122 hg qref -u johndeere
123 catlog 6
124
125
104 126 echo ==== "qpop -a / qpush -a"
105 127 hg qpop -a
106 128 hg qpush -a
107 129 hg log --template "{rev}: {desc} - {author}\n"
130 }
131
132
133 echo ======= plain headers
134
135 echo "[mq]" >> $HGRCPATH
136 echo "plain=true" >> $HGRCPATH
137
138 mkdir sandbox
139 (cd sandbox ; runtest)
140 rm -r sandbox
141
142
143 echo ======= hg headers
144
145 echo "plain=false" >> $HGRCPATH
146
147 mkdir sandbox
148 (cd sandbox ; runtest)
149 rm -r sandbox
150
151 runtest No newline at end of file
This diff has been collapsed as it changes many lines, (647 lines changed) Show them Hide them
@@ -1,3 +1,4 b''
1 ======= plain headers
1 2 ==== init
2 3 ==== qnew -U
3 4 From: test
@@ -32,9 +33,7 b' diff -r ... 2'
32 33 1: [mq]: 2.patch - test
33 34 0: [mq]: 1.patch - mary
34 35 ==== qref -u
35 # HG changeset patch
36 # User jane
37
36 From: jane
38 37
39 38 diff -r ... 2
40 39 --- /dev/null
@@ -105,14 +104,295 b' 2: Three (again) - maria'
105 104 1: [mq]: 2.patch - jane
106 105 0: [mq]: 1.patch - mary
107 106 ==== qnew -m
108 adding 4
107 adding 4of
108 Four
109
110 diff -r ... 4of
111 --- /dev/null
112 +++ b/4of
113 @@ -0,0 +1,1 @@
114 +4 t
115 3: Four - test
116 2: Three (again) - maria
117 1: [mq]: 2.patch - jane
118 0: [mq]: 1.patch - mary
119 ==== qref -u
120 From: jane
109 121 Four
110 122
111 diff -r ... 4
123 diff -r ... 4of
124 --- /dev/null
125 +++ b/4of
126 @@ -0,0 +1,1 @@
127 +4 t
128 3: Four - jane
129 2: Three (again) - maria
130 1: [mq]: 2.patch - jane
131 0: [mq]: 1.patch - mary
132 ==== qnew with HG header
133 popping 5.patch
134 now at: 4.patch
135 now at: 5.patch
136 # HG changeset patch
137 # User johndoe
138 4: imported patch 5.patch - johndoe
139 3: Four - jane
140 2: Three (again) - maria
141 1: [mq]: 2.patch - jane
142 0: [mq]: 1.patch - mary
143 ==== hg qref
144 adding 5
145 # HG changeset patch
146 # Parent
147 # User johndoe
148
149 diff -r ... 5
150 --- /dev/null
151 +++ b/5
152 @@ -0,0 +1,1 @@
153 +5
154 4: [mq]: 5.patch - johndoe
155 3: Four - jane
156 2: Three (again) - maria
157 1: [mq]: 2.patch - jane
158 0: [mq]: 1.patch - mary
159 ==== hg qref -U
160 # HG changeset patch
161 # Parent
162 # User test
163
164 diff -r ... 5
165 --- /dev/null
166 +++ b/5
167 @@ -0,0 +1,1 @@
168 +5
169 4: [mq]: 5.patch - test
170 3: Four - jane
171 2: Three (again) - maria
172 1: [mq]: 2.patch - jane
173 0: [mq]: 1.patch - mary
174 ==== hg qref -u
175 # HG changeset patch
176 # Parent
177 # User johndeere
178
179 diff -r ... 5
180 --- /dev/null
181 +++ b/5
182 @@ -0,0 +1,1 @@
183 +5
184 4: [mq]: 5.patch - johndeere
185 3: Four - jane
186 2: Three (again) - maria
187 1: [mq]: 2.patch - jane
188 0: [mq]: 1.patch - mary
189 ==== qnew with plain header
190 popping 6.patch
191 now at: 5.patch
192 now at: 6.patch
193 From: test
194
195 5: imported patch 6.patch - test
196 4: [mq]: 5.patch - johndeere
197 3: Four - jane
198 2: Three (again) - maria
199 1: [mq]: 2.patch - jane
200 0: [mq]: 1.patch - mary
201 ==== hg qref
202 adding 6
203 From: test
204
205 diff -r ... 6
206 --- /dev/null
207 +++ b/6
208 @@ -0,0 +1,1 @@
209 +6
210 5: [mq]: 6.patch - test
211 4: [mq]: 5.patch - johndeere
212 3: Four - jane
213 2: Three (again) - maria
214 1: [mq]: 2.patch - jane
215 0: [mq]: 1.patch - mary
216 ==== hg qref -U
217 From: test
218
219 diff -r ... 6
220 --- /dev/null
221 +++ b/6
222 @@ -0,0 +1,1 @@
223 +6
224 5: [mq]: 6.patch - test
225 4: [mq]: 5.patch - johndeere
226 3: Four - jane
227 2: Three (again) - maria
228 1: [mq]: 2.patch - jane
229 0: [mq]: 1.patch - mary
230 ==== hg qref -u
231 From: johndeere
232
233 diff -r ... 6
112 234 --- /dev/null
113 +++ b/4
235 +++ b/6
236 @@ -0,0 +1,1 @@
237 +6
238 5: [mq]: 6.patch - johndeere
239 4: [mq]: 5.patch - johndeere
240 3: Four - jane
241 2: Three (again) - maria
242 1: [mq]: 2.patch - jane
243 0: [mq]: 1.patch - mary
244 ==== qpop -a / qpush -a
245 popping 6.patch
246 popping 5.patch
247 popping 4.patch
248 popping 3.patch
249 popping 2.patch
250 popping 1.patch
251 patch queue now empty
252 applying 1.patch
253 applying 2.patch
254 applying 3.patch
255 applying 4.patch
256 applying 5.patch
257 applying 6.patch
258 now at: 6.patch
259 5: imported patch 6.patch - johndeere
260 4: imported patch 5.patch - johndeere
261 3: Four - jane
262 2: Three (again) - maria
263 1: imported patch 2.patch - jane
264 0: imported patch 1.patch - mary
265 ======= hg headers
266 ==== init
267 ==== qnew -U
268 # HG changeset patch
269 # Parent
270 # User test
271 0: [mq]: 1.patch - test
272 ==== qref
273 adding 1
274 # HG changeset patch
275 # Parent
276 # User test
277
278 diff -r ... 1
279 --- /dev/null
280 +++ b/1
281 @@ -0,0 +1,1 @@
282 +1
283 0: [mq]: 1.patch - test
284 ==== qref -u
285 # HG changeset patch
286 # Parent
287 # User mary
288
289 diff -r ... 1
290 --- /dev/null
291 +++ b/1
292 @@ -0,0 +1,1 @@
293 +1
294 0: [mq]: 1.patch - mary
295 ==== qnew
296 adding 2
297 # HG changeset patch
298 # Parent
299
300 diff -r ... 2
301 --- /dev/null
302 +++ b/2
303 @@ -0,0 +1,1 @@
304 +2
305 1: [mq]: 2.patch - test
306 0: [mq]: 1.patch - mary
307 ==== qref -u
308 # HG changeset patch
309 # User jane
310 # Parent
311
312 diff -r ... 2
313 --- /dev/null
314 +++ b/2
114 315 @@ -0,0 +1,1 @@
115 +4
316 +2
317 1: [mq]: 2.patch - jane
318 0: [mq]: 1.patch - mary
319 ==== qnew -U -m
320 # HG changeset patch
321 # Parent
322 # User test
323 Three
324
325 2: Three - test
326 1: [mq]: 2.patch - jane
327 0: [mq]: 1.patch - mary
328 ==== qref
329 adding 3
330 # HG changeset patch
331 # Parent
332 # User test
333 Three
334
335 diff -r ... 3
336 --- /dev/null
337 +++ b/3
338 @@ -0,0 +1,1 @@
339 +3
340 2: Three - test
341 1: [mq]: 2.patch - jane
342 0: [mq]: 1.patch - mary
343 ==== qref -m
344 # HG changeset patch
345 # Parent
346 # User test
347 Drei
348
349 diff -r ... 3
350 --- /dev/null
351 +++ b/3
352 @@ -0,0 +1,1 @@
353 +3
354 2: Drei - test
355 1: [mq]: 2.patch - jane
356 0: [mq]: 1.patch - mary
357 ==== qref -u
358 # HG changeset patch
359 # Parent
360 # User mary
361 Drei
362
363 diff -r ... 3
364 --- /dev/null
365 +++ b/3
366 @@ -0,0 +1,1 @@
367 +3
368 2: Drei - mary
369 1: [mq]: 2.patch - jane
370 0: [mq]: 1.patch - mary
371 ==== qref -u -m
372 # HG changeset patch
373 # Parent
374 # User maria
375 Three (again)
376
377 diff -r ... 3
378 --- /dev/null
379 +++ b/3
380 @@ -0,0 +1,1 @@
381 +3
382 2: Three (again) - maria
383 1: [mq]: 2.patch - jane
384 0: [mq]: 1.patch - mary
385 ==== qnew -m
386 adding 4of
387 # HG changeset patch
388 # Parent
389 Four
390
391 diff -r ... 4of
392 --- /dev/null
393 +++ b/4of
394 @@ -0,0 +1,1 @@
395 +4 t
116 396 3: Four - test
117 397 2: Three (again) - maria
118 398 1: [mq]: 2.patch - jane
@@ -120,14 +400,14 b' 0: [mq]: 1.patch - mary'
120 400 ==== qref -u
121 401 # HG changeset patch
122 402 # User jane
123
403 # Parent
124 404 Four
125 405
126 diff -r ... 4
406 diff -r ... 4of
127 407 --- /dev/null
128 +++ b/4
408 +++ b/4of
129 409 @@ -0,0 +1,1 @@
130 +4
410 +4 t
131 411 3: Four - jane
132 412 2: Three (again) - maria
133 413 1: [mq]: 2.patch - jane
@@ -146,6 +426,7 b' 0: [mq]: 1.patch - mary'
146 426 ==== hg qref
147 427 adding 5
148 428 # HG changeset patch
429 # Parent
149 430 # User johndoe
150 431
151 432 diff -r ... 5
@@ -160,6 +441,7 b' 1: [mq]: 2.patch - jane'
160 441 0: [mq]: 1.patch - mary
161 442 ==== hg qref -U
162 443 # HG changeset patch
444 # Parent
163 445 # User test
164 446
165 447 diff -r ... 5
@@ -174,6 +456,7 b' 1: [mq]: 2.patch - jane'
174 456 0: [mq]: 1.patch - mary
175 457 ==== hg qref -u
176 458 # HG changeset patch
459 # Parent
177 460 # User johndeere
178 461
179 462 diff -r ... 5
@@ -186,7 +469,63 b' 3: Four - jane'
186 469 2: Three (again) - maria
187 470 1: [mq]: 2.patch - jane
188 471 0: [mq]: 1.patch - mary
472 ==== qnew with plain header
473 popping 6.patch
474 now at: 5.patch
475 now at: 6.patch
476 From: test
477
478 5: imported patch 6.patch - test
479 4: [mq]: 5.patch - johndeere
480 3: Four - jane
481 2: Three (again) - maria
482 1: [mq]: 2.patch - jane
483 0: [mq]: 1.patch - mary
484 ==== hg qref
485 adding 6
486 From: test
487
488 diff -r ... 6
489 --- /dev/null
490 +++ b/6
491 @@ -0,0 +1,1 @@
492 +6
493 5: [mq]: 6.patch - test
494 4: [mq]: 5.patch - johndeere
495 3: Four - jane
496 2: Three (again) - maria
497 1: [mq]: 2.patch - jane
498 0: [mq]: 1.patch - mary
499 ==== hg qref -U
500 From: test
501
502 diff -r ... 6
503 --- /dev/null
504 +++ b/6
505 @@ -0,0 +1,1 @@
506 +6
507 5: [mq]: 6.patch - test
508 4: [mq]: 5.patch - johndeere
509 3: Four - jane
510 2: Three (again) - maria
511 1: [mq]: 2.patch - jane
512 0: [mq]: 1.patch - mary
513 ==== hg qref -u
514 From: johndeere
515
516 diff -r ... 6
517 --- /dev/null
518 +++ b/6
519 @@ -0,0 +1,1 @@
520 +6
521 5: [mq]: 6.patch - johndeere
522 4: [mq]: 5.patch - johndeere
523 3: Four - jane
524 2: Three (again) - maria
525 1: [mq]: 2.patch - jane
526 0: [mq]: 1.patch - mary
189 527 ==== qpop -a / qpush -a
528 popping 6.patch
190 529 popping 5.patch
191 530 popping 4.patch
192 531 popping 3.patch
@@ -198,9 +537,293 b' applying 2.patch'
198 537 applying 3.patch
199 538 applying 4.patch
200 539 applying 5.patch
201 now at: 5.patch
540 applying 6.patch
541 now at: 6.patch
542 5: imported patch 6.patch - johndeere
202 543 4: imported patch 5.patch - johndeere
203 544 3: Four - jane
204 545 2: Three (again) - maria
205 546 1: imported patch 2.patch - jane
206 547 0: imported patch 1.patch - mary
548 ==== init
549 ==== qnew -U
550 # HG changeset patch
551 # Parent
552 # User test
553 0: [mq]: 1.patch - test
554 ==== qref
555 adding 1
556 # HG changeset patch
557 # Parent
558 # User test
559
560 diff -r ... 1
561 --- /dev/null
562 +++ b/1
563 @@ -0,0 +1,1 @@
564 +1
565 0: [mq]: 1.patch - test
566 ==== qref -u
567 # HG changeset patch
568 # Parent
569 # User mary
570
571 diff -r ... 1
572 --- /dev/null
573 +++ b/1
574 @@ -0,0 +1,1 @@
575 +1
576 0: [mq]: 1.patch - mary
577 ==== qnew
578 adding 2
579 # HG changeset patch
580 # Parent
581
582 diff -r ... 2
583 --- /dev/null
584 +++ b/2
585 @@ -0,0 +1,1 @@
586 +2
587 1: [mq]: 2.patch - test
588 0: [mq]: 1.patch - mary
589 ==== qref -u
590 # HG changeset patch
591 # User jane
592 # Parent
593
594 diff -r ... 2
595 --- /dev/null
596 +++ b/2
597 @@ -0,0 +1,1 @@
598 +2
599 1: [mq]: 2.patch - jane
600 0: [mq]: 1.patch - mary
601 ==== qnew -U -m
602 # HG changeset patch
603 # Parent
604 # User test
605 Three
606
607 2: Three - test
608 1: [mq]: 2.patch - jane
609 0: [mq]: 1.patch - mary
610 ==== qref
611 adding 3
612 # HG changeset patch
613 # Parent
614 # User test
615 Three
616
617 diff -r ... 3
618 --- /dev/null
619 +++ b/3
620 @@ -0,0 +1,1 @@
621 +3
622 2: Three - test
623 1: [mq]: 2.patch - jane
624 0: [mq]: 1.patch - mary
625 ==== qref -m
626 # HG changeset patch
627 # Parent
628 # User test
629 Drei
630
631 diff -r ... 3
632 --- /dev/null
633 +++ b/3
634 @@ -0,0 +1,1 @@
635 +3
636 2: Drei - test
637 1: [mq]: 2.patch - jane
638 0: [mq]: 1.patch - mary
639 ==== qref -u
640 # HG changeset patch
641 # Parent
642 # User mary
643 Drei
644
645 diff -r ... 3
646 --- /dev/null
647 +++ b/3
648 @@ -0,0 +1,1 @@
649 +3
650 2: Drei - mary
651 1: [mq]: 2.patch - jane
652 0: [mq]: 1.patch - mary
653 ==== qref -u -m
654 # HG changeset patch
655 # Parent
656 # User maria
657 Three (again)
658
659 diff -r ... 3
660 --- /dev/null
661 +++ b/3
662 @@ -0,0 +1,1 @@
663 +3
664 2: Three (again) - maria
665 1: [mq]: 2.patch - jane
666 0: [mq]: 1.patch - mary
667 ==== qnew -m
668 adding 4of
669 # HG changeset patch
670 # Parent
671 Four
672
673 diff -r ... 4of
674 --- /dev/null
675 +++ b/4of
676 @@ -0,0 +1,1 @@
677 +4 t
678 3: Four - test
679 2: Three (again) - maria
680 1: [mq]: 2.patch - jane
681 0: [mq]: 1.patch - mary
682 ==== qref -u
683 # HG changeset patch
684 # User jane
685 # Parent
686 Four
687
688 diff -r ... 4of
689 --- /dev/null
690 +++ b/4of
691 @@ -0,0 +1,1 @@
692 +4 t
693 3: Four - jane
694 2: Three (again) - maria
695 1: [mq]: 2.patch - jane
696 0: [mq]: 1.patch - mary
697 ==== qnew with HG header
698 popping 5.patch
699 now at: 4.patch
700 now at: 5.patch
701 # HG changeset patch
702 # User johndoe
703 4: imported patch 5.patch - johndoe
704 3: Four - jane
705 2: Three (again) - maria
706 1: [mq]: 2.patch - jane
707 0: [mq]: 1.patch - mary
708 ==== hg qref
709 adding 5
710 # HG changeset patch
711 # Parent
712 # User johndoe
713
714 diff -r ... 5
715 --- /dev/null
716 +++ b/5
717 @@ -0,0 +1,1 @@
718 +5
719 4: [mq]: 5.patch - johndoe
720 3: Four - jane
721 2: Three (again) - maria
722 1: [mq]: 2.patch - jane
723 0: [mq]: 1.patch - mary
724 ==== hg qref -U
725 # HG changeset patch
726 # Parent
727 # User test
728
729 diff -r ... 5
730 --- /dev/null
731 +++ b/5
732 @@ -0,0 +1,1 @@
733 +5
734 4: [mq]: 5.patch - test
735 3: Four - jane
736 2: Three (again) - maria
737 1: [mq]: 2.patch - jane
738 0: [mq]: 1.patch - mary
739 ==== hg qref -u
740 # HG changeset patch
741 # Parent
742 # User johndeere
743
744 diff -r ... 5
745 --- /dev/null
746 +++ b/5
747 @@ -0,0 +1,1 @@
748 +5
749 4: [mq]: 5.patch - johndeere
750 3: Four - jane
751 2: Three (again) - maria
752 1: [mq]: 2.patch - jane
753 0: [mq]: 1.patch - mary
754 ==== qnew with plain header
755 popping 6.patch
756 now at: 5.patch
757 now at: 6.patch
758 From: test
759
760 5: imported patch 6.patch - test
761 4: [mq]: 5.patch - johndeere
762 3: Four - jane
763 2: Three (again) - maria
764 1: [mq]: 2.patch - jane
765 0: [mq]: 1.patch - mary
766 ==== hg qref
767 adding 6
768 From: test
769
770 diff -r ... 6
771 --- /dev/null
772 +++ b/6
773 @@ -0,0 +1,1 @@
774 +6
775 5: [mq]: 6.patch - test
776 4: [mq]: 5.patch - johndeere
777 3: Four - jane
778 2: Three (again) - maria
779 1: [mq]: 2.patch - jane
780 0: [mq]: 1.patch - mary
781 ==== hg qref -U
782 From: test
783
784 diff -r ... 6
785 --- /dev/null
786 +++ b/6
787 @@ -0,0 +1,1 @@
788 +6
789 5: [mq]: 6.patch - test
790 4: [mq]: 5.patch - johndeere
791 3: Four - jane
792 2: Three (again) - maria
793 1: [mq]: 2.patch - jane
794 0: [mq]: 1.patch - mary
795 ==== hg qref -u
796 From: johndeere
797
798 diff -r ... 6
799 --- /dev/null
800 +++ b/6
801 @@ -0,0 +1,1 @@
802 +6
803 5: [mq]: 6.patch - johndeere
804 4: [mq]: 5.patch - johndeere
805 3: Four - jane
806 2: Three (again) - maria
807 1: [mq]: 2.patch - jane
808 0: [mq]: 1.patch - mary
809 ==== qpop -a / qpush -a
810 popping 6.patch
811 popping 5.patch
812 popping 4.patch
813 popping 3.patch
814 popping 2.patch
815 popping 1.patch
816 patch queue now empty
817 applying 1.patch
818 applying 2.patch
819 applying 3.patch
820 applying 4.patch
821 applying 5.patch
822 applying 6.patch
823 now at: 6.patch
824 5: imported patch 6.patch - johndeere
825 4: imported patch 5.patch - johndeere
826 3: Four - jane
827 2: Three (again) - maria
828 1: imported patch 2.patch - jane
829 0: imported patch 1.patch - mary
@@ -34,6 +34,9 b' 0 files updated, 2 files merged, 0 files'
34 34 applying patcha2
35 35 now at: patcha2
36 36 % check patcha is still a git patch
37 # HG changeset patch
38 # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
39
37 40 diff --git a/a b/a
38 41 --- a/a
39 42 +++ b/a
@@ -12,6 +12,11 b' filterdiff()'
12 12 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
13 13 }
14 14
15 filterpatch()
16 {
17 sed -e "s/\(# Parent \).*/\1/"
18 }
19
15 20 echo '% init'
16 21 hg init repo
17 22 cd repo
@@ -43,7 +48,7 b' hg cp a aa'
43 48 hg qnew --git -f git
44 49 hg qpop
45 50 hg qfold git
46 cat .hg/patches/regular
51 cat .hg/patches/regular | filterpatch
47 52 hg qpop
48 53 hg qdel regular
49 54
@@ -54,7 +59,7 b' echo b >> aa'
54 59 hg qnew -f regular
55 60 hg qpop
56 61 hg qfold regular
57 cat .hg/patches/git
62 cat .hg/patches/git | filterpatch
58 63
59 64 cd ..
60 65
@@ -29,6 +29,9 b' reverting a'
29 29 % fold git patch into a regular patch, expect git patch
30 30 popping git
31 31 now at: regular
32 # HG changeset patch
33 # Parent
34
32 35 diff --git a/a b/a
33 36 --- a/a
34 37 +++ b/a
@@ -52,6 +55,9 b' now at: p1'
52 55 % fold regular patch into a git patch, expect git patch
53 56 popping regular
54 57 now at: git
58 # HG changeset patch
59 # Parent
60
55 61 diff --git a/a b/aa
56 62 copy from a
57 63 copy to aa
@@ -1,8 +1,13 b''
1 1 #!/bin/sh
2 2
3 catpatch() {
4 cat $1 | sed -e "s/^\(# Parent \).*/\1/"
5 }
6
3 7 echo "[extensions]" >> $HGRCPATH
4 8 echo "mq=" >> $HGRCPATH
5 9
10 runtest() {
6 11 hg init mq
7 12 cd mq
8 13
@@ -32,7 +37,7 b' hg qnew missing.patch missing'
32 37
33 38 echo '% qnew -m'
34 39 hg qnew -m 'foo bar' mtest.patch
35 cat .hg/patches/mtest.patch
40 catpatch .hg/patches/mtest.patch
36 41
37 42 echo '% qnew twice'
38 43 hg qnew first.patch
@@ -50,11 +55,11 b' hg ci -Am t'
50 55 echo b >> b
51 56 hg st
52 57 hg qnew -g -f p
53 cat ../.hg/patches/p
58 catpatch ../.hg/patches/p
54 59
55 60 echo '% qnew -u with no username configured'
56 61 HGUSER= hg qnew -u blue red
57 cat ../.hg/patches/red
62 catpatch ../.hg/patches/red
58 63
59 64 echo '% fail when trying to import a merge'
60 65 hg init merge
@@ -70,4 +75,28 b' hg merge -f 1'
70 75 hg resolve --mark a
71 76 hg qnew -f merge
72 77
78 cd ../../..
79 rm -r mq
80 }
81
82
83 echo '%%% plain headers'
84
85 echo "[mq]" >> $HGRCPATH
86 echo "plain=true" >> $HGRCPATH
87
88 mkdir sandbox
89 (cd sandbox ; runtest)
90 rm -r sandbox
91
92
93 echo '%%% hg headers'
94
95 echo "plain=false" >> $HGRCPATH
96
97 mkdir sandbox
98 (cd sandbox ; runtest)
99 rm -r sandbox
100
101
73 102 exit 0
@@ -1,3 +1,4 b''
1 %%% plain headers
1 2 adding a
2 3 % qnew should refuse bad patch names
3 4 abort: "series" cannot be used as the name of a patch
@@ -44,3 +45,55 b' merging a failed!'
44 45 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
45 46 use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
46 47 abort: cannot manage merge changesets
48 %%% hg headers
49 adding a
50 % qnew should refuse bad patch names
51 abort: "series" cannot be used as the name of a patch
52 abort: "status" cannot be used as the name of a patch
53 abort: "guards" cannot be used as the name of a patch
54 abort: ".hgignore" cannot be used as the name of a patch
55 % qnew with uncommitted changes
56 uncommitted.patch
57 % qnew implies add
58 A .hgignore
59 A series
60 A uncommitted.patch
61 % qnew missing
62 abort: missing: No such file or directory
63 % qnew -m
64 # HG changeset patch
65 # Parent
66 foo bar
67
68 % qnew twice
69 abort: patch "first.patch" already exists
70 abort: patch "first.patch" already exists
71 % qnew -f from a subdirectory
72 popping first.patch
73 popping mtest.patch
74 popping uncommitted.patch
75 patch queue now empty
76 adding d/b
77 M d/b
78 # HG changeset patch
79 # Parent
80 diff --git a/d/b b/d/b
81 --- a/d/b
82 +++ b/d/b
83 @@ -1,1 +1,2 @@
84 b
85 +b
86 % qnew -u with no username configured
87 # HG changeset patch
88 # Parent
89 # User blue
90 % fail when trying to import a merge
91 adding a
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 created new head
94 merging a
95 warning: conflicts during merge.
96 merging a failed!
97 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
98 use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
99 abort: cannot manage merge changesets
@@ -29,7 +29,7 b' echo bar > bar'
29 29 hg add bar
30 30 hg qrefresh -m 'patch 2'
31 31
32 hg qnew bad-patch
32 hg qnew --config 'mq.plain=true' bad-patch
33 33 echo >> foo
34 34 hg qrefresh
35 35
@@ -3,6 +3,10 b''
3 3 echo "[extensions]" >> $HGRCPATH
4 4 echo "mq=" >> $HGRCPATH
5 5
6 catpatch() {
7 cat $1 | sed -e "s/^\(# Parent \).*/\1/"
8 }
9
6 10 echo % init
7 11 hg init a
8 12 cd a
@@ -30,7 +34,7 b' hg qdiff . | sed -e "s/\\(+++ [a-zA-Z0-9_'
30 34 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
31 35
32 36 echo % patch file contents
33 cat .hg/patches/mqbase | \
37 catpatch .hg/patches/mqbase | \
34 38 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
35 39 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
36 40
@@ -47,7 +51,7 b' hg qdiff . | sed -e "s/\\(+++ [a-zA-Z0-9_'
47 51 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
48 52
49 53 echo % patch file contents
50 cat .hg/patches/mqbase | \
54 catpatch .hg/patches/mqbase | \
51 55 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
52 56 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
53 57
@@ -63,7 +67,7 b' hg qdiff . | sed -e "s/\\(+++ [a-zA-Z0-9_'
63 67 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
64 68
65 69 echo % patch file contents
66 cat .hg/patches/mqbase | \
70 catpatch .hg/patches/mqbase | \
67 71 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
68 72 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
69 73
@@ -79,7 +83,7 b' hg qdiff . | sed -e "s/\\(+++ [a-zA-Z0-9_'
79 83 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
80 84
81 85 echo % patch file contents
82 cat .hg/patches/mqbase | \
86 catpatch .hg/patches/mqbase | \
83 87 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
84 88 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
85 89
@@ -98,7 +102,7 b' hg qdiff | sed -e "s/\\(+++ [a-zA-Z0-9_/.'
98 102 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
99 103
100 104 echo % -- patch file content
101 cat .hg/patches/mqbase | \
105 catpatch .hg/patches/mqbase | \
102 106 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
103 107 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
104 108 hg st
@@ -176,7 +180,7 b' hg st'
176 180 echo '% b after refresh'
177 181 cat b
178 182 echo '% patch file after refresh'
179 cat .hg/patches/patch
183 catpatch .hg/patches/patch
180 184 cd ..
181 185
182 186
@@ -31,6 +31,8 b' diff -r b55ecdccb5cf 2/base'
31 31 -base
32 32 +patched
33 33 % patch file contents
34 # HG changeset patch
35 # Parent
34 36 mqbase
35 37
36 38 diff -r b55ecdccb5cf 1/base
@@ -73,6 +75,8 b' diff -r b55ecdccb5cf 2/base'
73 75 -base
74 76 +patched
75 77 % patch file contents
78 # HG changeset patch
79 # Parent
76 80 mqbase
77 81
78 82 diff -r b55ecdccb5cf 1/base
@@ -109,6 +113,8 b' diff -r b55ecdccb5cf 2/base'
109 113 -base
110 114 +patched
111 115 % patch file contents
116 # HG changeset patch
117 # Parent
112 118 mqbase
113 119
114 120 diff -r b55ecdccb5cf 1/base
@@ -145,6 +151,8 b' diff -r b55ecdccb5cf 2/base'
145 151 -base
146 152 +patched
147 153 % patch file contents
154 # HG changeset patch
155 # Parent
148 156 mqbase
149 157
150 158 diff -r b55ecdccb5cf 1/base
@@ -181,6 +189,8 b' diff -r b55ecdccb5cf orphanchild'
181 189 @@ -0,0 +1,1 @@
182 190 +orphan
183 191 % -- patch file content
192 # HG changeset patch
193 # Parent
184 194 mqbase
185 195
186 196 diff -r b55ecdccb5cf 1/base
@@ -273,6 +283,9 b' M a'
273 283 b
274 284 b
275 285 % patch file after refresh
286 # HG changeset patch
287 # Parent
288
276 289 diff -r 1a60229be7ac b
277 290 --- a/b
278 291 +++ b/b
@@ -5,6 +5,9 b' echo "graphlog=" >> $HGRCPATH'
5 5 echo "rebase=" >> $HGRCPATH
6 6 echo "mq=" >> $HGRCPATH
7 7
8 echo "[mq]" >> $HGRCPATH
9 echo "plain=true" >> $HGRCPATH
10
8 11 filterpatch()
9 12 {
10 13 sed -e "s/^\(# Date\).*/\1/" \
General Comments 0
You need to be logged in to leave comments. Login now