aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@gmail.com>2009-09-02 18:01:26 +0100
committerCatalin Marinas <catalin.marinas@gmail.com>2009-09-02 18:01:26 +0100
commitef8871fd6c5a8cc249d0f2cd51e0b8d57e125ed8 (patch)
treebb2b6273985acf3ace19ba2115d153b64002672a
parent5ab0897e67b0203470690a11885b61ca1cb4ab8a (diff)
downloadstgit-ef8871fd6c5a8cc249d0f2cd51e0b8d57e125ed8.tar.gz
Import git show output easily
This patch modifies the import command to check for standard 'git show' output and parse it accordingly. Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
-rw-r--r--stgit/commands/common.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index d38d263..0d39148 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -355,6 +355,7 @@ def __parse_description(descr):
lasthdr = 0
end = len(descr_lines)
+ descr_strip = 0
# Parse the patch header
for pos in range(0, end):
@@ -374,12 +375,16 @@ def __parse_description(descr):
if subject:
break
# get the subject
- subject = descr_lines[pos]
+ subject = descr_lines[pos][descr_strip:]
+ if re.match('commit [\da-f]{40}$', subject):
+ # 'git show' output, look for the real subject
+ subject = ''
+ descr_strip = 4
lasthdr = pos + 1
# get the body
if lasthdr < end:
- body = reduce(lambda x, y: x + '\n' + y, descr_lines[lasthdr:], '')
+ body = '\n' + '\n'.join(l[descr_strip:] for l in descr_lines[lasthdr:])
return (subject + body, authname, authemail, authdate)