1- import * as fs from "original-fs" ;
21import * as path from "path" ;
32import {
43 commands ,
@@ -16,6 +15,7 @@ import {
1615 WorkspaceEdit
1716} from "vscode" ;
1817import { ICommandOptions , Status , SvnUriAction } from "../common/types" ;
18+ import { exists , readFile , stat , unlink } from "../fs" ;
1919import { inputIgnoreList } from "../ignoreitems" ;
2020import { applyLineChanges } from "../lineChanges" ;
2121import { Model } from "../model" ;
@@ -194,7 +194,7 @@ export abstract class Command implements Disposable {
194194 preserveFocus ?: boolean ,
195195 preserveSelection ?: boolean
196196 ) : Promise < void > {
197- let left = this . getLeftResource ( resource , against ) ;
197+ let left = await this . getLeftResource ( resource , against ) ;
198198 let right = this . getRightResource ( resource , against ) ;
199199 const title = this . getTitle ( resource , against ) ;
200200
@@ -209,8 +209,8 @@ export abstract class Command implements Disposable {
209209 }
210210
211211 if (
212- fs . existsSync ( right . fsPath ) &&
213- fs . statSync ( right . fsPath ) . isDirectory ( )
212+ ( await exists ( right . fsPath ) ) &&
213+ ( await stat ( right . fsPath ) ) . isDirectory ( )
214214 ) {
215215 return ;
216216 }
@@ -244,10 +244,10 @@ export abstract class Command implements Disposable {
244244 ) ;
245245 }
246246
247- protected getLeftResource (
247+ protected async getLeftResource (
248248 resource : Resource ,
249249 against : string = ""
250- ) : Uri | undefined {
250+ ) : Promise < Uri | undefined > {
251251 if ( resource . remote ) {
252252 if ( resource . type !== Status . DELETED ) {
253253 return toSvnUri ( resource . resourceUri , SvnUriAction . SHOW , {
@@ -266,11 +266,11 @@ export abstract class Command implements Disposable {
266266 // Show file if has conflicts marks
267267 if (
268268 resource . type === Status . CONFLICTED &&
269- fs . existsSync ( resource . resourceUri . fsPath )
269+ ( await exists ( resource . resourceUri . fsPath ) )
270270 ) {
271- const text = fs . readFileSync ( resource . resourceUri . fsPath , {
271+ const text = ( await readFile ( resource . resourceUri . fsPath , {
272272 encoding : "utf8"
273- } ) ;
273+ } ) ) as string ;
274274
275275 // Check for lines begin with "<<<<<<", "=======", ">>>>>>>"
276276 if ( / ^ < { 7 } [ ^ ] + ^ = { 7 } [ ^ ] + ^ > { 7 } / m. test ( text ) ) {
@@ -394,8 +394,12 @@ export abstract class Command implements Disposable {
394394 try {
395395 const tempFile = path . join ( repository . root , ".svn" , "tmp" , "svn.patch" ) ;
396396
397- if ( fs . existsSync ( tempFile ) ) {
398- fs . unlinkSync ( tempFile ) ;
397+ if ( await exists ( tempFile ) ) {
398+ try {
399+ await unlink ( tempFile ) ;
400+ } catch ( err ) {
401+ // TODO(cjohnston)//log error
402+ }
399403 }
400404
401405 const uri = Uri . file ( tempFile ) . with ( {
0 commit comments