@@ -22,7 +22,7 @@ import { Svn, Status, SvnErrorCodes } from "./svn";
2222import { Model } from "./model" ;
2323import { Repository } from "./repository" ;
2424import { Resource } from "./resource" ;
25- import { toSvnUri , fromSvnUri } from "./uri" ;
25+ import { toSvnUri , fromSvnUri , SvnUriAction } from "./uri" ;
2626import * as fs from "fs" ;
2727import * as path from "path" ;
2828import { start } from "repl" ;
@@ -377,7 +377,7 @@ export class SvnCommands implements IDisposable {
377377
378378 if ( arg instanceof Uri ) {
379379 if ( arg . scheme === "svn" ) {
380- uris = [ Uri . file ( fromSvnUri ( arg ) . path ) ] ;
380+ uris = [ Uri . file ( fromSvnUri ( arg ) . fsPath ) ] ;
381381 } else if ( arg . scheme === "file" ) {
382382 uris = [ arg ] ;
383383 }
@@ -444,15 +444,23 @@ export class SvnCommands implements IDisposable {
444444
445445 const HEAD = this . getLeftResource ( resource , "HEAD" ) ;
446446
447+ const basename = path . basename ( resource . resourceUri . fsPath ) ;
447448 if ( ! HEAD ) {
448- const basename = path . basename ( resource . resourceUri . fsPath ) ;
449449 window . showWarningMessage (
450450 `"HEAD version of '${ basename } ' is not available."`
451451 ) ;
452452 return ;
453453 }
454454
455- return await commands . executeCommand < void > ( "vscode.open" , HEAD ) ;
455+ const basedir = path . dirname ( resource . resourceUri . fsPath ) ;
456+
457+ const uri = HEAD . with ( {
458+ path : path . join ( basedir , `(HEAD) ${ basename } ` ) // change document title
459+ } ) ;
460+
461+ return await commands . executeCommand < void > ( "vscode.open" , uri , {
462+ preview : true
463+ } ) ;
456464 }
457465
458466 @command ( "svn.openChangeBase" )
@@ -572,13 +580,17 @@ export class SvnCommands implements IDisposable {
572580 against : string = ""
573581 ) : Uri | undefined {
574582 if ( resource . type === Status . ADDED && resource . renameResourceUri ) {
575- return toSvnUri ( resource . renameResourceUri , against ) ;
583+ return toSvnUri ( resource . renameResourceUri , SvnUriAction . SHOW , {
584+ ref : against
585+ } ) ;
576586 }
577587
578588 switch ( resource . type ) {
579589 case Status . MODIFIED :
580590 case Status . REPLACED :
581- return toSvnUri ( resource . resourceUri , against ) ;
591+ return toSvnUri ( resource . resourceUri , SvnUriAction . SHOW , {
592+ ref : against
593+ } ) ;
582594 }
583595 }
584596
@@ -595,7 +607,9 @@ export class SvnCommands implements IDisposable {
595607 return resource . resourceUri ;
596608 case Status . DELETED :
597609 case Status . MISSING :
598- return toSvnUri ( resource . resourceUri , against ) ;
610+ return toSvnUri ( resource . resourceUri , SvnUriAction . SHOW , {
611+ ref : against
612+ } ) ;
599613 }
600614 }
601615
@@ -714,14 +728,17 @@ export class SvnCommands implements IDisposable {
714728 @command ( "svn.patch" , { repository : true } )
715729 async patch ( repository : Repository ) {
716730 try {
717- const result = await repository . patch ( ) ;
718- // send the patch results to a new tab
719- workspace
720- . openTextDocument ( { language : "diff" , content : result } )
721- . then ( doc => {
722- window . showTextDocument ( doc ) ;
723- } ) ;
724- window . showInformationMessage ( "Files Patched" ) ;
731+ const resource = toSvnUri (
732+ Uri . file ( repository . workspaceRoot ) ,
733+ SvnUriAction . PATCH
734+ ) ;
735+ const uri = resource . with ( {
736+ path : path . join ( resource . path , "svn.patch" ) // change document title
737+ } ) ;
738+
739+ await commands . executeCommand < void > ( "vscode.open" , uri , {
740+ preview : true
741+ } ) ;
725742 } catch ( error ) {
726743 console . error ( error ) ;
727744 window . showErrorMessage ( "Unable to patch" ) ;
@@ -806,15 +823,16 @@ export class SvnCommands implements IDisposable {
806823 @command ( "svn.log" , { repository : true } )
807824 async log ( repository : Repository ) {
808825 try {
809- const logPromise = repository . log ( ) ;
810- window . withProgress (
811- { location : ProgressLocation . Window , title : "Fetching logs" } ,
812- ( ) => logPromise
826+ const resource = toSvnUri (
827+ Uri . file ( repository . workspaceRoot ) ,
828+ SvnUriAction . LOG
813829 ) ;
814- const result = await logPromise ;
815- // send the log results to a new tab
816- workspace . openTextDocument ( { content : result } ) . then ( doc => {
817- window . showTextDocument ( doc ) ;
830+ const uri = resource . with ( {
831+ path : path . join ( resource . path , "svn.log" ) // change document title
832+ } ) ;
833+
834+ await commands . executeCommand < void > ( "vscode.open" , uri , {
835+ preview : true
818836 } ) ;
819837 } catch ( error ) {
820838 console . error ( error ) ;
@@ -833,7 +851,9 @@ export class SvnCommands implements IDisposable {
833851 return ;
834852 }
835853
836- const originalUri = toSvnUri ( modifiedUri , "BASE" ) ;
854+ const originalUri = toSvnUri ( modifiedUri , SvnUriAction . SHOW , {
855+ ref : "BASE"
856+ } ) ;
837857 const originalDocument = await workspace . openTextDocument ( originalUri ) ;
838858 const basename = path . basename ( modifiedUri . fsPath ) ;
839859 const message = `Are you sure you want to revert the selected changes in ${ basename } ?` ;
@@ -934,8 +954,8 @@ export class SvnCommands implements IDisposable {
934954 }
935955
936956 if ( uri . scheme === "svn" ) {
937- const { path } = fromSvnUri ( uri ) ;
938- uri = Uri . file ( path ) ;
957+ const { fsPath } = fromSvnUri ( uri ) ;
958+ uri = Uri . file ( fsPath ) ;
939959 }
940960
941961 if ( uri . scheme === "file" ) {
0 commit comments