File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,11 @@ export function registerCommands(context: IContext) {
20
20
registerCommand ( 'codingPlugin.pickDepot' , async function ( ) {
21
21
const options : IQuickPickOption [ ] = [ ] ;
22
22
context . depots . forEach ( ( depot : IDepot ) => {
23
+ const { name, depotPath } = depot ;
24
+ const project = depotPath . match ( / \/ p \/ ( [ ^ / ] + ) \/ / ) ?. [ 1 ] ;
23
25
options . push ( {
24
- label : depot . name ,
26
+ label : name ,
27
+ description : `(project: ${ project } )` ,
25
28
depot,
26
29
} ) ;
27
30
} ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import fs from 'fs';
3
3
import qs from 'querystring' ;
4
4
import axios from '../utils/axios' ;
5
5
import git from 'isomorphic-git' ;
6
- import { IRepoInfo , ISessionData } from '../typings/common' ;
6
+ import { IDepot , IRepoInfo , ISessionData } from '../typings/common' ;
7
7
import { parseCloneUrl } from '../utils/repo' ;
8
8
import toast from '../utils/toast' ;
9
9
@@ -99,20 +99,20 @@ export default class CodingServer {
99
99
}
100
100
}
101
101
102
- async getDepotList ( team : string , project : string ) {
103
- // TODO: 使用新接口
102
+ async getDepotList ( team : string ) {
104
103
try {
105
104
const result = await axios ( {
106
105
method : 'get' ,
107
- url : `https://${ team } .coding.net/api/user/${ team } /project/ ${ project } /repos ` ,
106
+ url : `https://${ team } .coding.net/api/user/${ team } /depots ` ,
108
107
headers : this . getHeaders ( ) ,
109
108
} ) ;
110
109
111
110
if ( result . code ) {
112
111
return Promise . reject ( result ) ;
113
112
}
114
113
115
- return result ?. data ?. depots || [ ] ;
114
+ const depots = result ?. data || [ ] ;
115
+ return depots . filter ( ( depot : IDepot ) => depot . vcsType === 'git' ) ;
116
116
} catch ( err ) {
117
117
console . error ( err ) ;
118
118
}
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ class DepotMRTreeDataProvider extends hx.TreeDataProvider {
69
69
70
70
async getData ( repoInfo ?: IRepoInfo ) {
71
71
const { codingServer } = this . context ;
72
- const promises = [ codingServer . getDepotList ( this . user . team , this . context . repoInfo ?. project ) ] ;
72
+ const promises = [ codingServer . getDepotList ( this . user . team ) ] ;
73
73
if ( repoInfo ) {
74
74
promises . push ( codingServer . getMrList ( repoInfo ) ) ;
75
75
}
You can’t perform that action at this time.
0 commit comments