From b0d3732177d73ca18fa5f84e865ced8b8b00d7aa Mon Sep 17 00:00:00 2001 From: Edgard Lorraine Messias Date: Mon, 19 Mar 2018 13:50:13 -0300 Subject: [PATCH] Fixed commit when message is a existent file (Close #221) --- src/svn.ts | 3 ++- src/svnRepository.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/svn.ts b/src/svn.ts index 4c59272d..9a7f833b 100644 --- a/src/svn.ts +++ b/src/svn.ts @@ -177,8 +177,9 @@ export class Svn { } if (options.log !== false) { + const argsOut = args.map(arg => (/ /.test(arg) ? `'${arg}'` : arg)); this.logOutput( - `[${this.lastCwd.split(/[\\\/]+/).pop()}]$ svn ${args.join(" ")}\n` + `[${this.lastCwd.split(/[\\\/]+/).pop()}]$ svn ${argsOut.join(" ")}\n` ); } diff --git a/src/svnRepository.ts b/src/svnRepository.ts index 297664a3..dc323f39 100644 --- a/src/svnRepository.ts +++ b/src/svnRepository.ts @@ -4,6 +4,7 @@ import { IFileStatus, parseStatusXml } from "./statusParser"; import { parseInfoXml, ISvnInfo } from "./infoParser"; import { sequentialize } from "./decorators"; import * as path from "path"; +import * as fs from "fs"; import { fixPathSeparator } from "./util"; import { configuration } from "./helpers/configuration"; import { parseSvnList } from "./listParser"; @@ -115,7 +116,14 @@ export class Repository { async commitFiles(message: string, files: string[]) { files = files.map(file => this.removeAbsolutePath(file)); - const result = await this.exec(["commit", "-m", message, ...files]); + const args = ["commit", ...files]; + + if (fs.existsSync(path.join(this.workspaceRoot, message))) { + args.push("--force-log"); + } + args.push("-m", message); + + const result = await this.exec(args); const matches = result.stdout.match(/Committed revision (.*)\./i); if (matches && matches[0]) {