File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -267,12 +267,17 @@ export default class Git {
267267 Logger . logInfo ( `no local branch ${ toBranch } ` ) ;
268268 }
269269
270- await Git . fetch ( upstreamBranch ) ;
271- Logger . logInfo ( `git checkout ${ Git . remote } /${ upstreamBranch } ` ) ;
272- await Git . git . checkout ( `${ Git . remote } /${ upstreamBranch } ` ) ;
273- Logger . logInfo ( `git checkout -b ${ toBranch } ` ) ;
274- await Git . git . checkout ( [ '-b' , `${ toBranch } ` ] ) ;
275- Logger . logInfo ( `now at branch: ${ await Git . getBranchName ( ) } ` ) ;
270+ try {
271+ await Git . fetch ( upstreamBranch ) ;
272+ Logger . logInfo ( `git checkout ${ Git . remote } /${ upstreamBranch } ` ) ;
273+ await Git . git . checkout ( `${ Git . remote } /${ upstreamBranch } ` ) ;
274+ Logger . logInfo ( `git checkout -b ${ toBranch } ` ) ;
275+ await Git . git . checkout ( [ '-b' , `${ toBranch } ` ] ) ;
276+ Logger . logInfo ( `now at branch: ${ await Git . getBranchName ( ) } ` ) ;
277+ } catch ( e ) {
278+ Logger . showNotStagedChangesFoundError ( e . message . slice ( 7 ) ) ;
279+ throw e ;
280+ }
276281 }
277282
278283 private static async cherryPick ( firstCommit : string , lastCommit : string ) {
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ const ERRORS = {
1111 NoFirstCommitError : 'No first commit found. Check that a git repository is opened.' ,
1212 IncorrectBranchNameError : '"$" is not correct branch name. Name your branch as *branch__upstream*' ,
1313 NoCommitInBranchError : 'There is no new commits in "$" branch' ,
14- NoLocalBranchError : 'Branch "$"does not exist. Did you forget to cherry-pick?'
14+ NoLocalBranchError : 'Branch "$"does not exist. Did you forget to cherry-pick?' ,
15+ NotStagedChangesFoundError : 'Not staged changes are found. $'
1516} ;
1617
1718const WARNINGS = {
You can’t perform that action at this time.
0 commit comments