comparison hgext/mq.py @ 27533:a801d331a022

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 28 Dec 2015 10:11:48 -0600
parents c07a2fd31970 707cdf2c3700
children 42910f9fffeb
comparison
equal deleted inserted replaced
27527:dbfaf361c062 27533:a801d331a022
394 repo.ui.restoreconfig(phasebackup) 394 repo.ui.restoreconfig(phasebackup)
395 395
396 class AbortNoCleanup(error.Abort): 396 class AbortNoCleanup(error.Abort):
397 pass 397 pass
398 398
399 def makepatchname(existing, title): 399 def makepatchname(existing, title, fallbackname):
400 """Return a suitable filename for title, adding a suffix to make 400 """Return a suitable filename for title, adding a suffix to make
401 it unique in the existing list""" 401 it unique in the existing list"""
402 namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_') 402 namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_')
403 if not namebase:
404 namebase = fallbackname
403 name = namebase 405 name = namebase
404 i = 0 406 i = 0
405 while name in existing: 407 while name in existing:
406 i += 1 408 i += 1
407 name = '%s__%s' % (namebase, i) 409 name = '%s__%s' % (namebase, i)
2109 % (r, lastparent)) 2111 % (r, lastparent))
2110 lastparent = p1 2112 lastparent = p1
2111 2113
2112 if not patchname: 2114 if not patchname:
2113 patchname = makepatchname(self.fullseries, 2115 patchname = makepatchname(self.fullseries,
2114 repo[r].description().split('\n', 1)[0]) 2116 repo[r].description().split('\n', 1)[0],
2117 '%d.diff' % r)
2115 checkseries(patchname) 2118 checkseries(patchname)
2116 self.checkpatchname(patchname, force) 2119 self.checkpatchname(patchname, force)
2117 self.fullseries.insert(0, patchname) 2120 self.fullseries.insert(0, patchname)
2118 2121
2119 patchf = self.opener(patchname, "w") 2122 patchf = self.opener(patchname, "w")