@@ -28,7 +28,7 @@ interface Context {
2828 repos : Repository [ ] ;
2929 associatedView : ViewsWithRepositoryFolders ;
3030 cache : Map < string , Promise < GitLog | undefined > > ;
31- destination : GitBranch ;
31+ branch : GitBranch ;
3232 pickCommit : boolean ;
3333 pickCommitForItem : boolean ;
3434 selectedBranchOrTag : GitReference | undefined ;
@@ -40,7 +40,7 @@ type Flags = '--interactive';
4040
4141interface State {
4242 repo : string | Repository ;
43- reference : GitReference ;
43+ destination : GitReference ;
4444 flags : Flags [ ] ;
4545}
4646
@@ -63,7 +63,7 @@ export class RebaseGitCommand extends QuickCommand<State> {
6363 counter ++ ;
6464 }
6565
66- if ( args ?. state ?. reference != null ) {
66+ if ( args ?. state ?. destination != null ) {
6767 counter ++ ;
6868 }
6969
@@ -87,15 +87,15 @@ export class RebaseGitCommand extends QuickCommand<State> {
8787 configs = [ '-c' , `"sequence.editor=${ editor } "` ] ;
8888 }
8989
90- state . repo . rebase ( configs , ...state . flags , state . reference . ref ) ;
90+ state . repo . rebase ( configs , ...state . flags , state . destination . ref ) ;
9191 }
9292
9393 protected async * steps ( state : PartialStepState < State > ) : StepGenerator {
9494 const context : Context = {
9595 repos : this . container . git . openRepositories ,
9696 associatedView : this . container . views . commits ,
9797 cache : new Map < string , Promise < GitLog | undefined > > ( ) ,
98- destination : undefined ! ,
98+ branch : undefined ! ,
9999 pickCommit : false ,
100100 pickCommitForItem : false ,
101101 selectedBranchOrTag : undefined ,
@@ -130,29 +130,29 @@ export class RebaseGitCommand extends QuickCommand<State> {
130130 }
131131 }
132132
133- if ( context . destination == null ) {
133+ if ( context . branch == null ) {
134134 const branch = await state . repo . git . getBranch ( ) ;
135135 if ( branch == null ) break ;
136136
137- context . destination = branch ;
137+ context . branch = branch ;
138138 }
139139
140- context . title = `${ this . title } ${ getReferenceLabel ( context . destination , {
140+ context . title = `${ this . title } ${ getReferenceLabel ( context . branch , {
141141 icon : false ,
142142 label : false ,
143143 } ) } onto`;
144144 context . pickCommitForItem = false ;
145145
146- if ( state . counter < 2 || state . reference == null ) {
146+ if ( state . counter < 2 || state . destination == null ) {
147147 const pickCommitToggle = new PickCommitToggleQuickInputButton ( context . pickCommit , context , ( ) => {
148148 context . pickCommit = ! context . pickCommit ;
149149 pickCommitToggle . on = context . pickCommit ;
150150 } ) ;
151151
152152 const result : StepResult < GitReference > = yield * pickBranchOrTagStep ( state as RebaseStepState , context , {
153- placeholder : context => `Choose a branch${ context . showTags ? ' or tag' : '' } to rebase` ,
153+ placeholder : context => `Choose a branch${ context . showTags ? ' or tag' : '' } to rebase onto ` ,
154154 picked : context . selectedBranchOrTag ?. ref ,
155- value : context . selectedBranchOrTag == null ? state . reference ?. ref : undefined ,
155+ value : context . selectedBranchOrTag == null ? state . destination ?. ref : undefined ,
156156 additionalButtons : [ pickCommitToggle ] ,
157157 } ) ;
158158 if ( result === StepResultBreak ) {
@@ -164,18 +164,18 @@ export class RebaseGitCommand extends QuickCommand<State> {
164164 continue ;
165165 }
166166
167- state . reference = result ;
167+ state . destination = result ;
168168 context . selectedBranchOrTag = undefined ;
169169 }
170170
171- if ( ! isRevisionReference ( state . reference ) ) {
172- context . selectedBranchOrTag = state . reference ;
171+ if ( ! isRevisionReference ( state . destination ) ) {
172+ context . selectedBranchOrTag = state . destination ;
173173 }
174174
175175 if (
176176 state . counter < 3 &&
177177 context . selectedBranchOrTag != null &&
178- ( context . pickCommit || context . pickCommitForItem || state . reference . ref === context . destination . ref )
178+ ( context . pickCommit || context . pickCommitForItem || state . destination . ref === context . branch . ref )
179179 ) {
180180 const ref = context . selectedBranchOrTag . ref ;
181181
@@ -194,14 +194,14 @@ export class RebaseGitCommand extends QuickCommand<State> {
194194 ? `No commits found on ${ getReferenceLabel ( context . selectedBranchOrTag , {
195195 icon : false ,
196196 } ) } `
197- : `Choose a commit to rebase ${ getReferenceLabel ( context . destination , {
197+ : `Choose a commit to rebase ${ getReferenceLabel ( context . branch , {
198198 icon : false ,
199199 } ) } onto`,
200- picked : state . reference ?. ref ,
200+ picked : state . destination ?. ref ,
201201 } ) ;
202202 if ( result === StepResultBreak ) continue ;
203203
204- state . reference = result ;
204+ state . destination = result ;
205205 }
206206
207207 const result = yield * this . confirmStep ( state as RebaseStepState , context ) ;
@@ -219,24 +219,25 @@ export class RebaseGitCommand extends QuickCommand<State> {
219219 private async * confirmStep ( state : RebaseStepState , context : Context ) : AsyncStepResultGenerator < Flags [ ] > {
220220 const counts = await this . container . git . getLeftRightCommitCount (
221221 state . repo . path ,
222- createRevisionRange ( context . destination . ref , state . reference . ref , '...' ) ,
222+ createRevisionRange ( state . destination . ref , context . branch . ref , '...' ) ,
223223 { excludeMerges : true } ,
224224 ) ;
225225
226- const title = `${ context . title } ${ getReferenceLabel ( state . reference , { icon : false , label : false } ) } ` ;
227- const count = counts != null ? counts . left : 0 ;
228- if ( count === 0 ) {
226+ const title = `${ context . title } ${ getReferenceLabel ( state . destination , { icon : false , label : false } ) } ` ;
227+ const ahead = counts != null ? counts . right : 0 ;
228+ const behind = counts != null ? counts . left : 0 ;
229+ if ( behind === 0 ) {
229230 const step : QuickPickStep < DirectiveQuickPickItem > = this . createConfirmStep (
230231 appendReposToTitle ( title , state , context ) ,
231232 [ ] ,
232233 createDirectiveQuickPickItem ( Directive . Cancel , true , {
233234 label : 'OK' ,
234- detail : `${ getReferenceLabel ( context . destination , {
235+ detail : `${ getReferenceLabel ( context . branch , {
235236 capitalize : true ,
236- } ) } is already up to date with ${ getReferenceLabel ( state . reference , { label : false } ) } `,
237+ } ) } is already up to date with ${ getReferenceLabel ( state . destination , { label : false } ) } `,
237238 } ) ,
238239 {
239- placeholder : `Nothing to rebase; ${ getReferenceLabel ( context . destination , {
240+ placeholder : `Nothing to rebase; ${ getReferenceLabel ( context . branch , {
240241 label : false ,
241242 icon : false ,
242243 } ) } is already up to date`,
@@ -252,18 +253,18 @@ export class RebaseGitCommand extends QuickCommand<State> {
252253 [
253254 createFlagsQuickPickItem < Flags > ( state . flags , [ ] , {
254255 label : this . title ,
255- detail : `Will update ${ getReferenceLabel ( context . destination , {
256+ detail : `Will update ${ getReferenceLabel ( context . branch , {
256257 label : false ,
257- } ) } by applying ${ pluralize ( 'commit' , count ) } on top of ${ getReferenceLabel ( state . reference , {
258+ } ) } by applying ${ pluralize ( 'commit' , ahead ) } on top of ${ getReferenceLabel ( state . destination , {
258259 label : false ,
259260 } ) } `,
260261 } ) ,
261262 createFlagsQuickPickItem < Flags > ( state . flags , [ '--interactive' ] , {
262263 label : `Interactive ${ this . title } ` ,
263264 description : '--interactive' ,
264- detail : `Will interactively update ${ getReferenceLabel ( context . destination , {
265+ detail : `Will interactively update ${ getReferenceLabel ( context . branch , {
265266 label : false ,
266- } ) } by applying ${ pluralize ( 'commit' , count ) } on top of ${ getReferenceLabel ( state . reference , {
267+ } ) } by applying ${ pluralize ( 'commit' , ahead ) } on top of ${ getReferenceLabel ( state . destination , {
267268 label : false ,
268269 } ) } `,
269270 } ) ,
0 commit comments