python - 在单独的行中创建提交、作者、时间戳、文件日志的列
问题描述
我有一个 git 日志,其中提交哈希、作者、时间戳、提交消息和文件日志(在行的情况下是动态的)在单独的行中。我可以单独提取数据(但不能提取文件日志和消息)但不能创建列。
这是示例文件
commit 2232asdfeafdadssc0a63d3ded7e95e894bb735c121f
Author: John Shahi
Date: Thu Jun 10 05:10:31 2021 +0000
Feature/bill overview
70 0 src/components/pages/abc.tsx
commit 18asdfasd9104c7fb59d9027f48csdfss8b61776e21d0
Author: rashi.coder
Date: Wed Jun 9 12:39:33 2021 +0545
disable other call, refine disabled styles
13 1 src/components/organisms/contact/detail/card/ContactDetailCard.tsx
11 2 src/components/organisms/contact/list/ActionsColumn.tsx
commit 65adfadfc2090e299bf9c514735eb1a2779a12ed9
Author: Ritesh Poudel
Date: Wed Jun 9 05:08:00 2021 +0000
commit 04afdad56f5136da10c87d5181dab8afdsfs29e57a5
Author: rashi.coder
Date: Wed Jun 9 10:22:29 2021 +0545
fix multiple contacts selection overflow
1 0 src/components/organisms/contact/list/ContactTable.tsx
8 1 src/components/organisms/contact/list/Styles.tsx
这就是我试图做的
commits = pd.read_csv(
COMMIT_LOG,
sep="\n",
header=None,
names=["raw"]
# names=[
# "sha",
# "author",
# "timestamp",
# "message",
# "additions",
# "deletions",
# "filename",
# ],
)
commit_marker = commits[commits["raw"].str.startswith("commit")]
author_marker = commits[commits["raw"].str.startswith("Author")]
date_marker = commits[commits["raw"].str.startswith("Date:")]
print(commit_marker.head())
print(author_marker.head())
print(date_marker.head())
解决方案
推荐阅读
- php - 如何使 mysql "num_rows" 在 "SELECT TABLE_NAME FROM information_schema.TABLES" 中工作?
- java - Android Studio:从任何 java 类中获取资产文件
- java - 弃用最终的超类方法?
- cassandra - Cassandra 增量备份
- c# - 我怎样才能编写一个自适应方法以正确的方式使用我的库?
- javascript - 如何使选定的文本具有黄色
- mysql - MySQL - UNION 先选择排序
- html - 如何在空白处制作居中下划线?
- java - 自定义倒数计时器 Android Studio
- java - 使用 powermockito 在 Utils 类中存根静态私有方法