File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,18 @@ class SwitchBranchItem implements QuickPickItem {
7777 }
7878
7979 async run ( repository : Repository ) : Promise < void > {
80- await repository . switchBranch ( this . ref ) ;
80+ try {
81+ await repository . switchBranch ( this . ref ) ;
82+ } catch ( error ) {
83+ if ( / E 1 9 5 0 1 2 / . test ( error ) ) {
84+ window . showErrorMessage (
85+ "Path '.' does not share common version control ancestry with the requested switch location."
86+ ) ;
87+ return ;
88+ }
89+
90+ window . showErrorMessage ( "Unable to switch branch" ) ;
91+ }
8192 }
8293}
8394
@@ -367,7 +378,7 @@ export class SvnCommands {
367378 const repository = this . model . getRepository ( resource ) ;
368379
369380 if ( ! repository ) {
370- console . warn ( "Could not find git repository for " , resource ) ;
381+ console . warn ( "Could not find Svn repository for " , resource ) ;
371382 return result ;
372383 }
373384
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ export class Svn {
9696 private svnPath : string ;
9797 private version : string ;
9898 private lastCwd : string = "" ;
99-
99+
100100 private _onOutput = new EventEmitter ( ) ;
101101 get onOutput ( ) : EventEmitter {
102102 return this . _onOutput ;
@@ -118,7 +118,9 @@ export class Svn {
118118 }
119119
120120 if ( options . log !== false ) {
121- this . log ( `[${ this . lastCwd . split ( / [ \\ \/ ] + / ) . pop ( ) } ]$ svn ${ args . join ( " " ) } \n` ) ;
121+ this . log (
122+ `[${ this . lastCwd . split ( / [ \\ \/ ] + / ) . pop ( ) } ]$ svn ${ args . join ( " " ) } \n`
123+ ) ;
122124 }
123125
124126 let process = cp . spawn ( this . svnPath , args , options ) ;
@@ -224,14 +226,14 @@ export class Svn {
224226 }
225227
226228 switchBranch ( root : string , path : string ) {
227- return this . exec ( root , [ "switch" , path , "--ignore-ancestry" ] ) ;
229+ return this . exec ( root , [ "switch" , path ] ) ;
228230 }
229231
230232 revert ( files : any [ ] ) {
231233 let args = [ "revert" ] ;
232234
233235 for ( let file of files ) {
234- if ( file instanceof Uri ) {
236+ if ( file instanceof Uri ) {
235237 args . push ( file . fsPath ) ;
236238 } else {
237239 args . push ( file ) ;
Original file line number Diff line number Diff line change @@ -200,7 +200,10 @@ export class Repository {
200200
201201 var branchUrl = repoUrl + "/" + ref ;
202202
203- const switchBranch = await this . svn . switchBranch ( this . root , branchUrl ) ;
203+ const switchBranch = await this . svn . switchBranch (
204+ this . workspaceRoot ,
205+ branchUrl
206+ ) ;
204207
205208 if ( switchBranch . exitCode !== 0 ) {
206209 throw new Error ( switchBranch . stderr ) ;
You can’t perform that action at this time.
0 commit comments