@@ -6,6 +6,7 @@ import * as jschardet from "jschardet";
66import * as path from "path" ;
77import { Repository } from "./svnRepository" ;
88import { parseInfoXml } from "./infoParser" ;
9+ import { SpawnOptions } from "child_process" ;
910
1011// List: https://github.com/apache/subversion/blob/1.6.x/subversion/svn/schema/status.rnc#L33
1112export enum Status {
@@ -50,7 +51,7 @@ function getSvnErrorCode(stderr: string): string | undefined {
5051 return void 0 ;
5152}
5253
53- export interface CpOptions {
54+ export interface CpOptions extends SpawnOptions {
5455 cwd ?: string ;
5556 encoding ?: string ;
5657 log ?: boolean ;
@@ -251,130 +252,4 @@ export class Svn {
251252 open ( repositoryRoot : string , workspaceRoot : string ) : Repository {
252253 return new Repository ( this , repositoryRoot , workspaceRoot ) ;
253254 }
254-
255- add ( filePaths : string | string [ ] ) {
256- if ( ! Array . isArray ( filePaths ) ) {
257- filePaths = [ filePaths ] ;
258- }
259-
260- filePaths = filePaths . map ( path => path . replace ( / \\ / g, "/" ) ) ;
261- return this . exec ( "" , [ "add" , ...filePaths ] ) ;
262- }
263-
264- addChangelist ( filePaths : string | string [ ] , changelist : string ) {
265- if ( ! Array . isArray ( filePaths ) ) {
266- filePaths = [ filePaths ] ;
267- }
268-
269- filePaths = filePaths . map ( path => path . replace ( / \\ / g, "/" ) ) ;
270-
271- return this . exec ( "" , [ "changelist" , changelist , ...filePaths ] ) ;
272- }
273-
274- removeChangelist ( filePaths : string | string [ ] ) {
275- if ( ! Array . isArray ( filePaths ) ) {
276- filePaths = [ filePaths ] ;
277- }
278-
279- filePaths = filePaths . map ( path => path . replace ( / \\ / g, "/" ) ) ;
280- return this . exec ( "" , [ "changelist" , ...filePaths , "--remove" ] ) ;
281- }
282-
283- show ( path : string , revision ?: string , options : CpOptions = { } ) {
284- const args = [ "cat" , path ] ;
285-
286- if ( revision ) {
287- args . push ( "-r" , revision ) ;
288- }
289-
290- return this . exec ( "" , args , options ) ;
291- }
292-
293- list ( path : string ) {
294- return this . exec ( "" , [ "ls" , path ] ) ;
295- }
296-
297- commit ( message : string , files : any [ ] ) {
298- let args = [ "commit" , "-m" , message ] ;
299-
300- for ( let file of files ) {
301- args . push ( file ) ;
302- }
303-
304- return this . exec ( "" , args ) ;
305- }
306-
307- ls ( filePath : string ) {
308- return this . exec ( "" , [ "ls" , "--xml" , filePath ] ) ;
309- }
310-
311- info ( path : string , revision : string = "BASE" ) {
312- return this . exec ( path , [ "info" , "--xml" , "-r" , revision ] ) ;
313- }
314-
315- copy ( rootPath : string , branchPath : string , name : string ) {
316- return this . exec ( "" , [
317- "copy" ,
318- rootPath ,
319- branchPath ,
320- "-m" ,
321- `Created new branch ${ name } `
322- ] ) ;
323- }
324-
325- checkout ( root : string , branchPath : string ) {
326- return this . exec ( root , [ "checkout" , branchPath ] ) ;
327- }
328-
329- switchBranch ( root : string , path : string ) {
330- return this . exec ( root , [ "switch" , path ] ) ;
331- }
332-
333- revert ( files : Uri [ ] | string [ ] ) {
334- let args = [ "revert" ] ;
335-
336- for ( let file of files ) {
337- if ( file instanceof Uri ) {
338- args . push ( file . fsPath ) ;
339- } else {
340- args . push ( file ) ;
341- }
342- }
343-
344- return this . exec ( "" , args ) ;
345- }
346-
347- update ( root : string ) {
348- return this . exec ( root , [ "update" ] ) ;
349- }
350-
351- patch ( root : string ) {
352- return this . exec ( root , [ "diff" ] ) ;
353- }
354-
355- remove ( files : any [ ] , keepLocal : boolean ) {
356- let args = [ "remove" ] ;
357-
358- if ( keepLocal ) {
359- args . push ( "--keep-local" ) ;
360- }
361-
362- for ( let file of files ) {
363- if ( file instanceof Uri ) {
364- args . push ( file . fsPath ) ;
365- } else {
366- args . push ( file ) ;
367- }
368- }
369-
370- return this . exec ( "" , args ) ;
371- }
372-
373- resolve ( file : string , action : string ) {
374- return this . exec ( "" , [ "resolve" , "--accept" , action , file ] ) ;
375- }
376-
377- log ( rootPath : string , length : string ) {
378- return this . exec ( rootPath , [ "log" , "--limit" , length ] ) ;
379- }
380255}
0 commit comments