From 9937a5d5b7e404ac0d6a1ba06612f9e4427b4cb3 Mon Sep 17 00:00:00 2001 From: OBKoro1 <1677593011@qq.com> Date: Wed, 20 May 2020 15:27:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8D=95=E8=AF=8Dcommit=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E6=9C=80=E5=A4=A7=E5=80=BC=E8=AE=BE=E4=B8=BA88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/autoCommit.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/autoCommit.html b/src/views/autoCommit.html index fd882c7..32b8db3 100644 --- a/src/views/autoCommit.html +++ b/src/views/autoCommit.html @@ -62,7 +62,7 @@ 随机commit次数 : - + - + + 删除 From 6a40dd776f1ac32dba8656cb0cb24933716e9297 Mon Sep 17 00:00:00 2001 From: OBKoro1 <1677593011@qq.com> Date: Wed, 20 May 2020 15:28:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dwindow=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=B8=8B=E8=BF=9B=E5=85=A5=E5=85=B6=E4=BB=96=E7=A3=81=E7=9B=98?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/commitHandle.ts | 42 ++++++++------------------------------ 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/models/commitHandle.ts b/src/models/commitHandle.ts index 6578837..d3520e5 100644 --- a/src/models/commitHandle.ts +++ b/src/models/commitHandle.ts @@ -1,13 +1,3 @@ -/* - * Author : OBKoro1 - * Date : 2019-12-30 16:59:30 - * @LastEditors : OBKoro1 - * @LastEditTime : 2020-01-15 11:46:52 - * FilePath : /autoCommit/src/models/commitHandle.ts - * Description : commit 具体操作 - * https://github.com/OBKoro1 - */ - import { webviewMsg } from '../util/dataStatement'; import * as moment from 'moment'; import * as fs from 'fs'; @@ -40,7 +30,6 @@ class CommitHandle { constructor(message: webviewMsg) { this.paramsObj = message.data; this.timeArr = []; - console.log('seb',sep) this.timeHandle(); this.autoCommitView = getPanelWebview(); this.userCancel = false; @@ -114,10 +103,10 @@ class CommitHandle { try { // 异步执行命令 让出线程 打印日志 等 commitMsg = await new Promise((resolve, reject) => { - let cmd = `cd ${this.paramsObj.itemSrc} && git add . && git commit -m '${this.paramsObj.commitMsg}' --date='${time}'`; + const cmd = `git add . && git commit -m '${this.paramsObj.commitMsg}' --date='${time}'`; exec(cmd, { encoding: 'utf8', - // cwd: this.paramsObj.itemSrc, + cwd: this.paramsObj.itemSrc, env: undefined },(error, stdout, stderr) => { if (error) { @@ -170,10 +159,10 @@ class CommitHandle { outputLog('提交中...'); this.autoCommitView.postMessage('提交中...', '提交中'); const res = await new Promise((resolve, reject) => { - let cmd = `cd ${this.paramsObj.itemSrc} && git pull && git push`; + const cmd = `git pull && git push`; exec(cmd,{ encoding: 'utf8', - // cwd: this.paramsObj.itemSrc, + cwd: this.paramsObj.itemSrc, env: undefined },(error, stdout, stderr) => { if (error) { @@ -196,8 +185,11 @@ class CommitHandle { this.autoCommitView.postMessage('回滚', '回滚'); outputLog('回滚中...'); return await new Promise((resolve, reject) => { - let cmd = `cd ${this.paramsObj.itemSrc} && git reset --hard HEAD~${totalNum}`; - exec(cmd, (error, stdout, stderr) => { + const cmd = `git reset --hard HEAD~${totalNum}`; + exec(cmd,{ + encoding: 'utf8', + cwd: this.paramsObj.itemSrc, + }, (error, stdout, stderr) => { if (error) { outputLog(`执行命令出错:${cmd}`); outputLog(`回滚失败:${error}`, stderr); @@ -292,22 +284,6 @@ class CommitHandle { } return timeArr; } - // 同步执行命令 - myExecSync(cmd: string) { - // 除了该方法直到子进程完全关闭后才返回 执行完毕 返回 - try { - const res = execSync(cmd, { - encoding: 'utf8', - cwd: undefined, - env: undefined - }); - return res; - } catch (err) { - outputLog(`执行命令出错:${cmd}`); - outputLog(`错误信息:${err}`); - return err; - } - } } export default CommitHandle; From 70fd7effdccfdd73c09076170986d9e77d0fb440 Mon Sep 17 00:00:00 2001 From: OBKoro1 <1677593011@qq.com> Date: Wed, 20 May 2020 16:28:53 +0800 Subject: [PATCH 3/3] V1.0.4 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0d93fe..f425e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ + +### [V1.0.4] + +* 设置最大单次commit次数为88 +* 修复window系统下进入其他磁盘报错的问题 + ### [V1.0.3] * 修复window系统下无法使用的问题。 diff --git a/package.json b/package.json index f69a335..5ae8042 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Auto Commit", "description": "自动提交commit到github", "publisher": "OBKoro1", - "version": "1.0.3", + "version": "1.0.4", "scripts": { "build": "vsce package", "vscode:prepublish": "webpack --mode production",