Skip to content

Commit 5e58460

Browse files
committed
Fixed commit for renamed files (#95);
1 parent 69c2584 commit 5e58460

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/commands.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import {
99
SourceControlResourceGroup
1010
} from "vscode";
1111
import { inputCommitMessage } from "./messages";
12-
import { Svn } from "./svn";
12+
import { Svn, Status } from "./svn";
1313
import { Model } from "./model";
1414
import { Repository } from "./repository";
1515
import { Resource } from "./resource";
1616
import { toSvnUri } from "./uri";
1717
import * as path from "path";
18+
import { start } from "repl";
1819

1920
interface CommandOptions {
2021
repository?: boolean;
@@ -200,6 +201,15 @@ export class SvnCommands {
200201
return state.resourceUri.fsPath;
201202
});
202203

204+
//If files is renamed, the commit need previous file
205+
choice.resourceGroup.resourceStates.forEach(state => {
206+
if (state instanceof Resource) {
207+
if (state.type === Status.ADDED && state.renameResourceUri) {
208+
filePaths.push(state.renameResourceUri.fsPath);
209+
}
210+
}
211+
});
212+
203213
try {
204214
const result = await repository.repository.commitFiles(
205215
message,
@@ -311,6 +321,14 @@ export class SvnCommands {
311321
const paths = resourceStates.map(state => {
312322
return state.resourceUri.fsPath;
313323
});
324+
325+
//If files is renamed, the commit need previous file
326+
resourceStates.forEach(state => {
327+
if (state.type === Status.ADDED && state.renameResourceUri) {
328+
paths.push(state.renameResourceUri.fsPath);
329+
}
330+
});
331+
314332
const message = await inputCommitMessage();
315333

316334
if (message === undefined) {

0 commit comments

Comments
 (0)