hgext/mq.py
changeset 27533 a801d331a022
parent 27001 c07a2fd31970
parent 27513 707cdf2c3700
child 27586 42910f9fffeb
--- a/hgext/mq.py	Sun Dec 27 23:55:54 2015 +0900
+++ b/hgext/mq.py	Mon Dec 28 10:11:48 2015 -0600
@@ -396,10 +396,12 @@
 class AbortNoCleanup(error.Abort):
     pass
 
-def makepatchname(existing, title):
+def makepatchname(existing, title, fallbackname):
     """Return a suitable filename for title, adding a suffix to make
     it unique in the existing list"""
     namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_')
+    if not namebase:
+        namebase = fallbackname
     name = namebase
     i = 0
     while name in existing:
@@ -2111,7 +2113,8 @@
 
                     if not patchname:
                         patchname = makepatchname(self.fullseries,
-                            repo[r].description().split('\n', 1)[0])
+                            repo[r].description().split('\n', 1)[0],
+                            '%d.diff' % r)
                     checkseries(patchname)
                     self.checkpatchname(patchname, force)
                     self.fullseries.insert(0, patchname)