patchseries: strip numbering when guessing subject from filename
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 24 Nov 2014 17:12:37 +0000 (19:12 +0200)
committerGuido Günther <agx@sigxcpu.org>
Wed, 18 Feb 2015 07:58:42 +0000 (08:58 +0100)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/patch_series.py

index 10fccfc623c5c5c06095f041a6d70e9e9efd6fd4..327997f58c02902fcb1b9b37c869bcb3f1a2f373 100644 (file)
@@ -95,6 +95,12 @@ class Patch(object):
         >>> p = Patch('debian/patches/foo')
         >>> p._get_subject_from_filename()
         'foo'
+        >>> Patch('0123-foo.patch')._get_subject_from_filename()
+        'foo'
+        >>> Patch('0123.patch')._get_subject_from_filename()
+        '0123'
+        >>> Patch('0123-foo-0123.patch')._get_subject_from_filename()
+        'foo-0123'
 
         @return: the patch's subject
         @rtype: C{str}
@@ -107,7 +113,7 @@ class Patch(object):
                 subject = base
         except ValueError:
                 pass # No ext so keep subject as is
-        return subject
+        return subject.lstrip('0123456789-') or subject
 
     def _get_info_field(self, key, get_val=None):
         """