[PATCH] Handle pull requests with random trailing space

Konstantin Ryabitsev konstantin at linuxfoundation.org
Tue Jan 28 04:56:19 AEDT 2020


Another fix for copy-pasted pull requests, this time for cases
when something is copy-pasted from a terminal and retains all
the bogus trailing whitespace.

Example:
https://lore.kernel.org/r/043eb5b2-a302-4de6-a3e8-8238e49483b1@ti.com

Signed-off-by: Konstantin Ryabitsev <konstantin at linuxfoundation.org>
---
 patchwork/parser.py                           |  2 +-
 .../0024-git-pull-request-trailing-space.mbox | 60 +++++++++++++++++++
 patchwork/tests/test_parser.py                |  9 +++
 3 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 patchwork/tests/mail/0024-git-pull-request-trailing-space.mbox

diff --git a/patchwork/parser.py b/patchwork/parser.py
index 45dd8db..5d86426 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -937,7 +937,7 @@ def parse_patch(content):
 def parse_pull_request(content):
     git_re = re.compile(
         r'^The following changes since commit.*'
-        r'^are available in the git repository at:\n'
+        r'^are available in the git repository at:\s*\n'
         r'^\s*([\w+-]+(?:://|@)[\w/.@:~-]+[\s\\]*[\w/._-]*)\s*$',
         re.DOTALL | re.MULTILINE | re.IGNORECASE)
     match = git_re.search(content)
diff --git a/patchwork/tests/mail/0024-git-pull-request-trailing-space.mbox b/patchwork/tests/mail/0024-git-pull-request-trailing-space.mbox
new file mode 100644
index 0000000..d62d070
--- /dev/null
+++ b/patchwork/tests/mail/0024-git-pull-request-trailing-space.mbox
@@ -0,0 +1,60 @@
+From mboxrd at z Thu Jan  1 00:00:00 1970
+To: Linux ARM Kernel List <linux-arm-kernel at lists.infradead.org>
+From: XXX XXX <xxx at example.com>
+Subject: [GIT PULL] DaVinci SoC updates for v5.6
+Message-ID: <043eb5b2-a302-4de6-a3e8-8238e49483b1 at ti.com>
+Date: Tue, 14 Jan 2020 23:48:54 +0530
+Content-Type: text/plain; charset="us-ascii"
+Content-Transfer-Encoding: 7bit
+
+The following changes since commit e42617b825f8073569da76dc4510bfa019b1c35a:    
+                                                                                
+  Linux 5.5-rc1 (2019-12-08 14:57:55 -0800)                                     
+                                                                                
+are available in the Git repository at:                                         
+                                                                                
+  git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git tags/davinci-for-v5.6/soc
+                                                                                
+for you to fetch changes up to 5e06d19694a463a012c2589e29078196eb209448:        
+                                                                                
+  ARM: davinci: dm644x-evm: Add Fixed regulators needed for tlv320aic33 (2020-01-13 17:36:26 +0530)
+                                                                                
+----------------------------------------------------------------                
+DaVinci SoC updates for v5.6 include migrating DM365 SoC to use                 
+drivers/clocksource based driver for timer. This leads to removal               
+of machine specific timer driver.                                               
+                                                                                
+There are two patches adding missing fixed regulators for audio codecs          
+on DM365 and DM644x EVMs.                                                       
+                                                                                
+----------------------------------------------------------------                
+Bartosz Golaszewski (3):                                                        
+      clocksource: davinci: only enable clockevents once tim34 is initialized   
+      ARM: davinci: dm365: switch to using the clocksource driver               
+      ARM: davinci: remove legacy timer support                                 
+                                                                                
+Peter Ujfalusi (2):                                                             
+      ARM: davinci: dm365-evm: Add Fixed regulators needed for tlv320aic3101    
+      ARM: davinci: dm644x-evm: Add Fixed regulators needed for tlv320aic33     
+                                                                                
+ arch/arm/mach-davinci/Makefile              |   3 +-                           
+ arch/arm/mach-davinci/board-dm365-evm.c     |  20 ++                           
+ arch/arm/mach-davinci/board-dm644x-evm.c    |  20 ++                           
+ arch/arm/mach-davinci/devices-da8xx.c       |   1 -                            
+ arch/arm/mach-davinci/devices.c             |  19 --                           
+ arch/arm/mach-davinci/dm365.c               |  22 +-                           
+ arch/arm/mach-davinci/include/mach/common.h |  17 --                           
+ arch/arm/mach-davinci/include/mach/time.h   |  33 ---                          
+ arch/arm/mach-davinci/time.c                | 400 ---------------------------- 
+ drivers/clocksource/timer-davinci.c         |   8 +-                           
+ 10 files changed, 60 insertions(+), 483 deletions(-)                           
+ delete mode 100644 arch/arm/mach-davinci/include/mach/time.h                   
+ delete mode 100644 arch/arm/mach-davinci/time.c                                
+~                                                                                                                                                                                                         
+~                                                                                           
+
+_______________________________________________
+linux-arm-kernel mailing list
+linux-arm-kernel at lists.infradead.org
+http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
+
diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py
index 4a85fd4..6fbc9da 100644
--- a/patchwork/tests/test_parser.py
+++ b/patchwork/tests/test_parser.py
@@ -642,6 +642,15 @@ class PatchParseTest(PatchTest):
             'linux.git/ tags/v5.4-next-soc',
             pull_url)
 
+    def test_git_pull_trailing_space(self):
+        diff, message = self._find_content(
+            '0024-git-pull-request-trailing-space.mbox')
+        pull_url = parse_pull_request(message)
+        self.assertEqual(
+            'git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/'
+            'linux-davinci.git tags/davinci-for-v5.6/soc',
+            pull_url)
+
     def test_git_rename(self):
         diff, _ = self._find_content('0008-git-rename.mbox')
         self.assertTrue(diff is not None)

base-commit: f45ebc99b5393447125ba544d76fb5c26b735166
-- 
2.17.1



More information about the Patchwork mailing list