@@ -100,6 +100,7 @@ class RepositoryManager : IRepositoryManager
100
100
private readonly IGitClient gitClient ;
101
101
private readonly IProcessManager processManager ;
102
102
private readonly IRepositoryPathConfiguration repositoryPaths ;
103
+ private readonly IFileSystem fileSystem ;
103
104
private readonly IRepositoryWatcher watcher ;
104
105
105
106
private bool isBusy ;
@@ -116,9 +117,11 @@ class RepositoryManager : IRepositoryManager
116
117
public RepositoryManager ( IGitConfig gitConfig ,
117
118
IRepositoryWatcher repositoryWatcher , IGitClient gitClient ,
118
119
IProcessManager processManager ,
119
- IRepositoryPathConfiguration repositoryPaths )
120
+ IRepositoryPathConfiguration repositoryPaths ,
121
+ IFileSystem fileSystem )
120
122
{
121
123
this . repositoryPaths = repositoryPaths ;
124
+ this . fileSystem = fileSystem ;
122
125
this . gitClient = gitClient ;
123
126
this . processManager = processManager ;
124
127
this . watcher = repositoryWatcher ;
@@ -127,7 +130,7 @@ public RepositoryManager(IGitConfig gitConfig,
127
130
SetupWatcher ( ) ;
128
131
}
129
132
130
- public static RepositoryManager CreateInstance ( IPlatform platform , ITaskManager taskManager , IGitClient gitClient , IProcessManager processManager , NPath repositoryRoot )
133
+ public static RepositoryManager CreateInstance ( IPlatform platform , ITaskManager taskManager , IGitClient gitClient , IProcessManager processManager , NPath repositoryRoot , IFileSystem fileSystem )
131
134
{
132
135
var repositoryPathConfiguration = new RepositoryPathConfiguration ( repositoryRoot ) ;
133
136
string filePath = repositoryPathConfiguration . DotGitConfig ;
@@ -136,7 +139,7 @@ public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager
136
139
var repositoryWatcher = new RepositoryWatcher ( platform , repositoryPathConfiguration , taskManager . Token ) ;
137
140
138
141
return new RepositoryManager ( gitConfig , repositoryWatcher ,
139
- gitClient , processManager , repositoryPathConfiguration ) ;
142
+ gitClient , processManager , repositoryPathConfiguration , fileSystem ) ;
140
143
}
141
144
142
145
public void Initialize ( )
@@ -298,17 +301,16 @@ public ITask CheckoutFiles(List<string> files)
298
301
299
302
public ITask DeleteFiles ( List < string > list )
300
303
{
301
- ITask < List < string > > task = new DeleteFilesExecTask ( list . ToArray ( ) , CancellationToken . None )
302
- . Configure ( processManager ) ;
303
-
304
- task = HookupHandlers ( task , true , true ) ;
305
-
306
- var @finally = task . Finally ( ( b , exception , arg3 ) => {
307
- Logger . Trace ( "Delete Files success:{0} output: {1}" , b , arg3 != null ? string . Join ( "," , arg3 . ToArray ( ) ) : "[NULL]" ) ;
304
+ var delete = new ActionTask ( CancellationToken . None , ( ) => {
305
+ for ( var index = 0 ; index < list . Count ; index ++ )
306
+ {
307
+ fileSystem . FileDelete ( list [ index ] ) ;
308
+ }
308
309
} ) ;
309
310
310
- return @finally
311
- . Start ( ) ;
311
+ delete . OnStart += t => IsBusy = true ;
312
+
313
+ return delete . Finally ( ( ) => IsBusy = false ) ;
312
314
}
313
315
314
316
public void UpdateGitAheadBehindStatus ( )
0 commit comments