88	"context" 
99	"fmt" 
1010	"net/url" 
11+ 	"strings" 
1112
1213	"github.com/drone/go-scm/scm" 
1314)
@@ -28,7 +29,7 @@ func (s *RepositoryService) Find(ctx context.Context, repo string) (*scm.Reposit
2829
2930	out  :=  new (repository )
3031	res , err  :=  s .client .do (ctx , "GET" , endpoint , nil , & out )
31- 	return  convertRepository (out ), res , err 
32+ 	return  convertRepository (out ,  s . client . owner ), res , err 
3233}
3334
3435// FindHook returns a repository hook. 
@@ -53,7 +54,7 @@ func (s *RepositoryService) List(ctx context.Context, opts scm.ListOptions) ([]*
5354
5455	out  :=  new (repositories )
5556	res , err  :=  s .client .do (ctx , "GET" , endpoint , nil , & out )
56- 	return  convertRepositoryList (out ), res , err 
57+ 	return  convertRepositoryList (out ,  s . client . owner ), res , err 
5758}
5859
5960// ListV2 returns the user repository list. 
@@ -261,25 +262,27 @@ type subscription struct {
261262	URL              string  `json:"url"` 
262263}
263264
264- // helper function to convert from the gogs  repository list to 
265+ // helper function to convert from the azure devops  repository list to 
265266// the common repository structure. 
266- func  convertRepositoryList (from  * repositories ) []* scm.Repository  {
267+ func  convertRepositoryList (from  * repositories ,  owner   string ) []* scm.Repository  {
267268	to  :=  []* scm.Repository {}
268269	for  _ , v  :=  range  from .Value  {
269- 		to  =  append (to , convertRepository (v ))
270+ 		to  =  append (to , convertRepository (v ,  owner ))
270271	}
271272	return  to 
272273}
273274
274- // helper function to convert from the gogs  repository structure 
275+ // helper function to convert from the azure devops  repository structure 
275276// to the common repository structure. 
276- func  convertRepository (from  * repository ) * scm.Repository  {
277+ func  convertRepository (from  * repository , owner  string ) * scm.Repository  {
278+ 	namespace  :=  []string {owner , from .Project .Name }
277279	return  & scm.Repository {
278- 		ID :     from .ID ,
279- 		Name :   from .Name ,
280- 		Link :   from .URL ,
281- 		Branch : scm .TrimRef (from .DefaultBranch ),
282- 		Clone :  from .RemoteURL ,
280+ 		ID :        from .ID ,
281+ 		Name :      from .Name ,
282+ 		Namespace : strings .Join (namespace , "/" ),
283+ 		Link :      from .URL ,
284+ 		Branch :    scm .TrimRef (from .DefaultBranch ),
285+ 		Clone :     from .RemoteURL ,
283286	}
284287}
285288
0 commit comments