@@ -28,7 +28,7 @@ interface Context {
28
28
repos : Repository [ ] ;
29
29
associatedView : ViewsWithRepositoryFolders ;
30
30
cache : Map < string , Promise < GitLog | undefined > > ;
31
- destination : GitBranch ;
31
+ branch : GitBranch ;
32
32
pickCommit : boolean ;
33
33
pickCommitForItem : boolean ;
34
34
selectedBranchOrTag : GitReference | undefined ;
@@ -40,7 +40,7 @@ type Flags = '--interactive';
40
40
41
41
interface State {
42
42
repo : string | Repository ;
43
- reference : GitReference ;
43
+ destination : GitReference ;
44
44
flags : Flags [ ] ;
45
45
}
46
46
@@ -63,7 +63,7 @@ export class RebaseGitCommand extends QuickCommand<State> {
63
63
counter ++ ;
64
64
}
65
65
66
- if ( args ?. state ?. reference != null ) {
66
+ if ( args ?. state ?. destination != null ) {
67
67
counter ++ ;
68
68
}
69
69
@@ -87,15 +87,15 @@ export class RebaseGitCommand extends QuickCommand<State> {
87
87
configs = [ '-c' , `"sequence.editor=${ editor } "` ] ;
88
88
}
89
89
90
- state . repo . rebase ( configs , ...state . flags , state . reference . ref ) ;
90
+ state . repo . rebase ( configs , ...state . flags , state . destination . ref ) ;
91
91
}
92
92
93
93
protected async * steps ( state : PartialStepState < State > ) : StepGenerator {
94
94
const context : Context = {
95
95
repos : this . container . git . openRepositories ,
96
96
associatedView : this . container . views . commits ,
97
97
cache : new Map < string , Promise < GitLog | undefined > > ( ) ,
98
- destination : undefined ! ,
98
+ branch : undefined ! ,
99
99
pickCommit : false ,
100
100
pickCommitForItem : false ,
101
101
selectedBranchOrTag : undefined ,
@@ -130,29 +130,29 @@ export class RebaseGitCommand extends QuickCommand<State> {
130
130
}
131
131
}
132
132
133
- if ( context . destination == null ) {
133
+ if ( context . branch == null ) {
134
134
const branch = await state . repo . git . getBranch ( ) ;
135
135
if ( branch == null ) break ;
136
136
137
- context . destination = branch ;
137
+ context . branch = branch ;
138
138
}
139
139
140
- context . title = `${ this . title } ${ getReferenceLabel ( context . destination , {
140
+ context . title = `${ this . title } ${ getReferenceLabel ( context . branch , {
141
141
icon : false ,
142
142
label : false ,
143
143
} ) } onto`;
144
144
context . pickCommitForItem = false ;
145
145
146
- if ( state . counter < 2 || state . reference == null ) {
146
+ if ( state . counter < 2 || state . destination == null ) {
147
147
const pickCommitToggle = new PickCommitToggleQuickInputButton ( context . pickCommit , context , ( ) => {
148
148
context . pickCommit = ! context . pickCommit ;
149
149
pickCommitToggle . on = context . pickCommit ;
150
150
} ) ;
151
151
152
152
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 ` ,
154
154
picked : context . selectedBranchOrTag ?. ref ,
155
- value : context . selectedBranchOrTag == null ? state . reference ?. ref : undefined ,
155
+ value : context . selectedBranchOrTag == null ? state . destination ?. ref : undefined ,
156
156
additionalButtons : [ pickCommitToggle ] ,
157
157
} ) ;
158
158
if ( result === StepResultBreak ) {
@@ -164,18 +164,18 @@ export class RebaseGitCommand extends QuickCommand<State> {
164
164
continue ;
165
165
}
166
166
167
- state . reference = result ;
167
+ state . destination = result ;
168
168
context . selectedBranchOrTag = undefined ;
169
169
}
170
170
171
- if ( ! isRevisionReference ( state . reference ) ) {
172
- context . selectedBranchOrTag = state . reference ;
171
+ if ( ! isRevisionReference ( state . destination ) ) {
172
+ context . selectedBranchOrTag = state . destination ;
173
173
}
174
174
175
175
if (
176
176
state . counter < 3 &&
177
177
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 )
179
179
) {
180
180
const ref = context . selectedBranchOrTag . ref ;
181
181
@@ -194,14 +194,14 @@ export class RebaseGitCommand extends QuickCommand<State> {
194
194
? `No commits found on ${ getReferenceLabel ( context . selectedBranchOrTag , {
195
195
icon : false ,
196
196
} ) } `
197
- : `Choose a commit to rebase ${ getReferenceLabel ( context . destination , {
197
+ : `Choose a commit to rebase ${ getReferenceLabel ( context . branch , {
198
198
icon : false ,
199
199
} ) } onto`,
200
- picked : state . reference ?. ref ,
200
+ picked : state . destination ?. ref ,
201
201
} ) ;
202
202
if ( result === StepResultBreak ) continue ;
203
203
204
- state . reference = result ;
204
+ state . destination = result ;
205
205
}
206
206
207
207
const result = yield * this . confirmStep ( state as RebaseStepState , context ) ;
@@ -219,24 +219,25 @@ export class RebaseGitCommand extends QuickCommand<State> {
219
219
private async * confirmStep ( state : RebaseStepState , context : Context ) : AsyncStepResultGenerator < Flags [ ] > {
220
220
const counts = await this . container . git . getLeftRightCommitCount (
221
221
state . repo . path ,
222
- createRevisionRange ( context . destination . ref , state . reference . ref , '...' ) ,
222
+ createRevisionRange ( state . destination . ref , context . branch . ref , '...' ) ,
223
223
{ excludeMerges : true } ,
224
224
) ;
225
225
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 ) {
229
230
const step : QuickPickStep < DirectiveQuickPickItem > = this . createConfirmStep (
230
231
appendReposToTitle ( title , state , context ) ,
231
232
[ ] ,
232
233
createDirectiveQuickPickItem ( Directive . Cancel , true , {
233
234
label : 'OK' ,
234
- detail : `${ getReferenceLabel ( context . destination , {
235
+ detail : `${ getReferenceLabel ( context . branch , {
235
236
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 } ) } `,
237
238
} ) ,
238
239
{
239
- placeholder : `Nothing to rebase; ${ getReferenceLabel ( context . destination , {
240
+ placeholder : `Nothing to rebase; ${ getReferenceLabel ( context . branch , {
240
241
label : false ,
241
242
icon : false ,
242
243
} ) } is already up to date`,
@@ -252,18 +253,18 @@ export class RebaseGitCommand extends QuickCommand<State> {
252
253
[
253
254
createFlagsQuickPickItem < Flags > ( state . flags , [ ] , {
254
255
label : this . title ,
255
- detail : `Will update ${ getReferenceLabel ( context . destination , {
256
+ detail : `Will update ${ getReferenceLabel ( context . branch , {
256
257
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 , {
258
259
label : false ,
259
260
} ) } `,
260
261
} ) ,
261
262
createFlagsQuickPickItem < Flags > ( state . flags , [ '--interactive' ] , {
262
263
label : `Interactive ${ this . title } ` ,
263
264
description : '--interactive' ,
264
- detail : `Will interactively update ${ getReferenceLabel ( context . destination , {
265
+ detail : `Will interactively update ${ getReferenceLabel ( context . branch , {
265
266
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 , {
267
268
label : false ,
268
269
} ) } `,
269
270
} ) ,
0 commit comments