From 122188c35e38be70831255a22c66b38070d57aa1 Mon Sep 17 00:00:00 2001 From: vapao Date: Thu, 28 May 2020 09:49:46 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=94=B3=E8=AF=B7Tag=E6=8E=92=E5=BA=8F=E5=8F=8A=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/libs/gitlib.py | 10 ++++++++-- spug_web/src/pages/deploy/request/Ext1Form.js | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spug_api/libs/gitlib.py b/spug_api/libs/gitlib.py index 9fcf309..096d8a3 100644 --- a/spug_api/libs/gitlib.py +++ b/spug_api/libs/gitlib.py @@ -27,8 +27,14 @@ class Git: 'author': ref.tag.tagger.name, 'date': ref.tag.tagged_date, 'message': ref.tag.message.strip() - } if ref.tag else {} - return branches, tags + } if ref.tag else { + 'id': ref.commit.binsha.hex(), + 'author': ref.commit.author.name, + 'date': ref.commit.authored_date, + 'message': ref.commit.message.strip() + } + tags = sorted(tags.items(), key=lambda x: x[1]['date'], reverse=True) + return branches, dict(tags) def _get_repo(self, git_repo, repo_dir): if os.path.exists(repo_dir): diff --git a/spug_web/src/pages/deploy/request/Ext1Form.js b/spug_web/src/pages/deploy/request/Ext1Form.js index 42c7d8c..2d79876 100644 --- a/spug_web/src/pages/deploy/request/Ext1Form.js +++ b/spug_web/src/pages/deploy/request/Ext1Form.js @@ -79,7 +79,7 @@ class Ext1Form extends React.Component { }; switchType = (v) => { - this.setState({git_type: v, extra1: null}, this._initExtra1) + this.setState({git_type: v, extra1: undefined}, this._initExtra1) }; switchExtra1 = (v) => { @@ -157,7 +157,7 @@ class Ext1Form extends React.Component { Object.keys(branches || {}).map(b => {b}) ) : ( Object.entries(tags || {}).map(([tag, info]) => ( - {tag} {info.author} + {tag} {info.author} {info.message} )) )}