@@ -733,16 +733,29 @@ export class SvnCommands implements IDisposable {
733733 @command ( "svn.patch" , { repository : true } )
734734 async patch ( repository : Repository ) {
735735 try {
736- const resource = toSvnUri (
737- Uri . file ( repository . workspaceRoot ) ,
738- SvnUriAction . PATCH
739- ) ;
740- const uri = resource . with ( {
741- path : path . join ( resource . path , "svn.patch" ) // change document title
736+ const tempFile = path . join ( repository . root , ".svn" , "tmp" , "svn.patch" ) ;
737+
738+ if ( fs . existsSync ( tempFile ) ) {
739+ fs . unlinkSync ( tempFile ) ;
740+ }
741+
742+ const uri = Uri . file ( tempFile ) . with ( {
743+ scheme : "untitled"
742744 } ) ;
743745
744- await commands . executeCommand < void > ( "vscode.open" , uri , {
745- preview : true
746+ const document = await workspace . openTextDocument ( uri ) ;
747+ const textEditor = await window . showTextDocument ( document ) ;
748+
749+ const content = await repository . patch ( ) ;
750+ await textEditor . edit ( e => {
751+ // if is opened, clear content
752+ e . delete (
753+ new Range (
754+ new Position ( 0 , 0 ) ,
755+ new Position ( Number . MAX_SAFE_INTEGER , 0 )
756+ )
757+ ) ;
758+ e . insert ( new Position ( 0 , 0 ) , content ) ;
746759 } ) ;
747760 } catch ( error ) {
748761 console . error ( error ) ;
@@ -836,9 +849,7 @@ export class SvnCommands implements IDisposable {
836849 path : path . join ( resource . path , "svn.log" ) // change document title
837850 } ) ;
838851
839- await commands . executeCommand < void > ( "vscode.open" , uri , {
840- preview : true
841- } ) ;
852+ await commands . executeCommand < void > ( "vscode.open" , uri ) ;
842853 } catch ( error ) {
843854 console . error ( error ) ;
844855 window . showErrorMessage ( "Unable to log" ) ;
0 commit comments