summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Engestrom <eric@engestrom.ch>2021-08-09 21:44:21 +0100
committerEric Engestrom <eric@engestrom.ch>2021-08-10 22:40:38 +0100
commit84af142679a775076a3ed6de271320e553741732 (patch)
tree0111b3aac76a6f1c661c7ec7a1fda9d35ea19258
parent62c44560ff73f6b290144fea072560c377d7c28e (diff)
pick-ui: show commit date
With our ff-only merge setup, the commit date ends up being when the commit actually landed (as opposed to when it was first written). Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12289> (cherry picked from commit 4128acdee32eadfef1fb8c3c3ce2e512a267cdf4)
-rw-r--r--.pick_status.json2
-rw-r--r--bin/pick/core.py8
-rw-r--r--bin/pick/ui.py2
3 files changed, 10 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 15bc960922f..3b2376e257e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
"description": "pick-ui: show commit date",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/bin/pick/core.py b/bin/pick/core.py
index de5d0715cee..766749c471f 100644
--- a/bin/pick/core.py
+++ b/bin/pick/core.py
@@ -138,6 +138,14 @@ class Commit:
c.resolution = Resolution(data['resolution'])
return c
+ def date(self) -> str:
+ # Show commit date, ie. when the commit actually landed
+ # (as opposed to when it was first written)
+ return subprocess.check_output(
+ ['git', 'show', '--no-patch', '--format=%cs', self.sha],
+ stderr=subprocess.DEVNULL
+ ).decode("ascii").strip()
+
async def apply(self, ui: 'UI') -> typing.Tuple[bool, str]:
# FIXME: This isn't really enough if we fail to cherry-pick because the
# git tree will still be dirty
diff --git a/bin/pick/ui.py b/bin/pick/ui.py
index 9f0d739c336..3fc5e1e4fb6 100644
--- a/bin/pick/ui.py
+++ b/bin/pick/ui.py
@@ -67,7 +67,7 @@ class CommitWidget(urwid.Text):
def __init__(self, ui: 'UI', commit: 'core.Commit'):
reason = commit.nomination_type.name.ljust(6)
- super().__init__(f'{reason} {commit.sha[:10]} {commit.description}')
+ super().__init__(f'{commit.date()} {reason} {commit.sha[:10]} {commit.description}')
self.ui = ui
self.commit = commit