##// END OF EJS Templates
mq: generate patch names from first line of description...
Mads Kiilerich -
r26736:143b52fc default
parent child Browse files
Show More
@@ -395,6 +395,17 b' def newcommit(repo, phase, *args, **kwar'
395 class AbortNoCleanup(error.Abort):
395 class AbortNoCleanup(error.Abort):
396 pass
396 pass
397
397
398 def makepatchname(existing, title):
399 """Return a suitable filename for title, adding a suffix to make
400 it unique in the existing list"""
401 namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_')
402 name = namebase
403 i = 0
404 while name in existing:
405 i += 1
406 name = '%s__%s' % (namebase, i)
407 return name
408
398 class queue(object):
409 class queue(object):
399 def __init__(self, ui, baseui, path, patchdir=None):
410 def __init__(self, ui, baseui, path, patchdir=None):
400 self.basepath = path
411 self.basepath = path
@@ -2090,7 +2101,8 b' class queue(object):'
2090 lastparent = p1
2101 lastparent = p1
2091
2102
2092 if not patchname:
2103 if not patchname:
2093 patchname = normname('%d.diff' % r)
2104 patchname = makepatchname(self.fullseries,
2105 repo[r].description().split('\n', 1)[0])
2094 checkseries(patchname)
2106 checkseries(patchname)
2095 self.checkpatchname(patchname, force)
2107 self.checkpatchname(patchname, force)
2096 self.fullseries.insert(0, patchname)
2108 self.fullseries.insert(0, patchname)
@@ -155,11 +155,11 b' qdel -k X && hg qimp -e X used to trigge'
155 $ hg init --mq
155 $ hg init --mq
156 $ hg qimport -r 3
156 $ hg qimport -r 3
157 $ hg qpop
157 $ hg qpop
158 popping 3.diff
158 popping imported_patch_pc
159 patch queue now empty
159 patch queue now empty
160 $ hg qdel -k 3.diff
160 $ hg qdel -k imported_patch_pc
161 $ hg qimp -e 3.diff
161 $ hg qimp -e imported_patch_pc
162 adding 3.diff to series file
162 adding imported_patch_pc to series file
163 $ hg qfinish -a
163 $ hg qfinish -a
164 no patches applied
164 no patches applied
165
165
@@ -167,17 +167,17 b' qdel -k X && hg qimp -e X used to trigge'
167 resilience to inconsistency: qfinish -a with applied patches not in series
167 resilience to inconsistency: qfinish -a with applied patches not in series
168
168
169 $ hg qser
169 $ hg qser
170 3.diff
170 imported_patch_pc
171 $ hg qapplied
171 $ hg qapplied
172 $ hg qpush
172 $ hg qpush
173 applying 3.diff
173 applying imported_patch_pc
174 patch 3.diff is empty
174 patch imported_patch_pc is empty
175 now at: 3.diff
175 now at: imported_patch_pc
176 $ echo next >> base
176 $ echo next >> base
177 $ hg qrefresh -d '1 0'
177 $ hg qrefresh -d '1 0'
178 $ echo > .hg/patches/series # remove 3.diff from series to confuse mq
178 $ echo > .hg/patches/series # remove 3.diff from series to confuse mq
179 $ hg qfinish -a
179 $ hg qfinish -a
180 revision 47dfa8501675 refers to unknown patches: 3.diff
180 revision 47dfa8501675 refers to unknown patches: imported_patch_pc
181
181
182 more complex state 'both known and unknown patches
182 more complex state 'both known and unknown patches
183
183
@@ -198,32 +198,32 b' try to import --push'
198 now at: appendbar.diff
198 now at: appendbar.diff
199 $ hg qfin -a
199 $ hg qfin -a
200 patch b.diff finalized without changeset message
200 patch b.diff finalized without changeset message
201 $ touch .hg/patches/2.diff
201 $ touch .hg/patches/append_foo
202 $ hg qimport -r 'p1(.)::'
202 $ hg qimport -r 'p1(.)::'
203 abort: patch "2.diff" already exists
203 abort: patch "append_foo" already exists
204 [255]
204 [255]
205 $ hg qapplied
205 $ hg qapplied
206 3.diff
206 append_bar
207 $ hg qfin -a
207 $ hg qfin -a
208 $ rm .hg/patches/2.diff
208 $ rm .hg/patches/append_foo
209 $ hg qimport -r 'p1(.)::' -P
209 $ hg qimport -r 'p1(.)::' -P
210 $ hg qpop -a
210 $ hg qpop -a
211 popping 3.diff
211 popping append_bar
212 popping 2.diff
212 popping append_foo
213 patch queue now empty
213 patch queue now empty
214 $ hg qdel 3.diff
214 $ hg qdel append_foo
215 $ hg qdel -k 2.diff
215 $ hg qdel -k append_bar
216
216
217 qimport -e
217 qimport -e
218
218
219 $ hg qimport -e 2.diff
219 $ hg qimport -e append_bar
220 adding 2.diff to series file
220 adding append_bar to series file
221 $ hg qdel -k 2.diff
221 $ hg qdel -k append_bar
222
222
223 qimport -e --name newname oldexisitingpatch
223 qimport -e --name newname oldexisitingpatch
224
224
225 $ hg qimport -e --name this-name-is-better 2.diff
225 $ hg qimport -e --name this-name-is-better append_bar
226 renaming 2.diff to this-name-is-better
226 renaming append_bar to this-name-is-better
227 adding this-name-is-better to series file
227 adding this-name-is-better to series file
228 $ hg qser
228 $ hg qser
229 this-name-is-better
229 this-name-is-better
@@ -249,8 +249,8 b' qpop'
249 reverting subrepo sub
249 reverting subrepo sub
250 adding sub/a (glob)
250 adding sub/a (glob)
251 $ hg qpop
251 $ hg qpop
252 popping 1.diff
252 popping 1
253 now at: 0.diff
253 now at: 0
254 $ hg status -AS
254 $ hg status -AS
255 C .hgsub
255 C .hgsub
256 C .hgsubstate
256 C .hgsubstate
@@ -268,11 +268,11 b' qpush'
268 reverting subrepo sub
268 reverting subrepo sub
269 adding sub/a (glob)
269 adding sub/a (glob)
270 $ hg qpush
270 $ hg qpush
271 applying 1.diff
271 applying 1
272 subrepository sub diverged (local revision: b2fdb12cd82b, remote revision: aa037b301eba)
272 subrepository sub diverged (local revision: b2fdb12cd82b, remote revision: aa037b301eba)
273 (M)erge, keep (l)ocal or keep (r)emote? m
273 (M)erge, keep (l)ocal or keep (r)emote? m
274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 now at: 1.diff
275 now at: 1
276 $ hg status -AS
276 $ hg status -AS
277 C .hgsub
277 C .hgsub
278 C .hgsubstate
278 C .hgsubstate
@@ -142,12 +142,12 b' already has one local mq patch'
142 $ hg up -q qtip
142 $ hg up -q qtip
143
143
144 $ HGMERGE=internal:fail hg rebase
144 $ HGMERGE=internal:fail hg rebase
145 rebasing 1:b4bffa6e4776 "r1" (1.diff qbase)
145 rebasing 1:b4bffa6e4776 "r1" (qbase r1)
146 note: rebase of 1:b4bffa6e4776 created no changes to commit
146 note: rebase of 1:b4bffa6e4776 created no changes to commit
147 rebasing 2:c0fd129beb01 "r2" (2.diff)
147 rebasing 2:c0fd129beb01 "r2" (r2)
148 rebasing 3:6ff5b8feed8e "r3" (3.diff)
148 rebasing 3:6ff5b8feed8e "r3" (r3)
149 note: rebase of 3:6ff5b8feed8e created no changes to commit
149 note: rebase of 3:6ff5b8feed8e created no changes to commit
150 rebasing 4:094320fec554 "r4" (4.diff)
150 rebasing 4:094320fec554 "r4" (r4)
151 unresolved conflicts (see hg resolve, then hg rebase --continue)
151 unresolved conflicts (see hg resolve, then hg rebase --continue)
152 [1]
152 [1]
153
153
@@ -155,20 +155,20 b' already has one local mq patch'
155 (no more unresolved files)
155 (no more unresolved files)
156
156
157 $ hg rebase --continue
157 $ hg rebase --continue
158 already rebased 1:b4bffa6e4776 "r1" (1.diff qbase) as 057f55ff8f44
158 already rebased 1:b4bffa6e4776 "r1" (qbase r1) as 057f55ff8f44
159 already rebased 2:c0fd129beb01 "r2" (2.diff) as 1660ab13ce9a
159 already rebased 2:c0fd129beb01 "r2" (r2) as 1660ab13ce9a
160 already rebased 3:6ff5b8feed8e "r3" (3.diff) as 1660ab13ce9a
160 already rebased 3:6ff5b8feed8e "r3" (r3) as 1660ab13ce9a
161 rebasing 4:094320fec554 "r4" (4.diff)
161 rebasing 4:094320fec554 "r4" (r4)
162 note: rebase of 4:094320fec554 created no changes to commit
162 note: rebase of 4:094320fec554 created no changes to commit
163 rebasing 5:681a378595ba "r5" (5.diff)
163 rebasing 5:681a378595ba "r5" (r5)
164 rebasing 6:512a1f24768b "r6" (6.diff qtip)
164 rebasing 6:512a1f24768b "r6" (qtip r6)
165 note: rebase of 6:512a1f24768b created no changes to commit
165 note: rebase of 6:512a1f24768b created no changes to commit
166 saved backup bundle to $TESTTMP/b/.hg/strip-backup/b4bffa6e4776-b9bfb84d-backup.hg (glob)
166 saved backup bundle to $TESTTMP/b/.hg/strip-backup/b4bffa6e4776-b9bfb84d-backup.hg (glob)
167
167
168 $ hg tglog
168 $ hg tglog
169 @ 8: 'r5' tags: 5.diff qtip tip
169 @ 8: 'r5' tags: qtip r5 tip
170 |
170 |
171 o 7: 'r2' tags: 2.diff qbase
171 o 7: 'r2' tags: qbase r2
172 |
172 |
173 o 6: 'branch2-r6' tags: qparent
173 o 6: 'branch2-r6' tags: qparent
174 |
174 |
@@ -431,9 +431,9 b' strip of applied mq should cleanup statu'
431 applied patches before strip
431 applied patches before strip
432
432
433 $ hg qapplied
433 $ hg qapplied
434 2.diff
434 d
435 3.diff
435 e
436 4.diff
436 f
437
437
438 stripping revision in queue
438 stripping revision in queue
439
439
@@ -444,7 +444,7 b' stripping revision in queue'
444 applied patches after stripping rev in queue
444 applied patches after stripping rev in queue
445
445
446 $ hg qapplied
446 $ hg qapplied
447 2.diff
447 d
448
448
449 stripping ancestor of queue
449 stripping ancestor of queue
450
450
General Comments 0
You need to be logged in to leave comments. Login now