changeset 8054:79ca7a9fdb6e

vcs: refactor processing of run_git_command output for GitChangeset.children
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 26 Dec 2019 06:02:37 +0100
parents 39ba3ee88c7c
children 8f4bf8b9db51
files kallithea/lib/vcs/backends/git/changeset.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/git/changeset.py	Tue Dec 31 15:39:17 2019 +0100
+++ b/kallithea/lib/vcs/backends/git/changeset.py	Thu Dec 26 06:02:37 2019 +0100
@@ -197,14 +197,12 @@
         so, se = self.repository.run_git_command(
             ['rev-list', rev_filter, '--children']
         )
-
-        children = []
-        pat = re.compile(r'^%s' % self.raw_id)
-        for l in so.splitlines():
-            if pat.match(l):
-                childs = l.split(' ')[1:]
-                children.extend(childs)
-        return [self.repository.get_changeset(cs) for cs in children]
+        return [
+            self.repository.get_changeset(cs)
+            for parts in (l.split(' ') for l in so.splitlines())
+            if parts[0] == self.raw_id
+            for cs in parts[1:]
+        ]
 
     def next(self, branch=None):
         if branch and self.branch != branch: