// convertRepo is a helper function used to convert a Bitbucket server repository // structure to the common Drone repository structure. func convertRepo(from *internal.Repo) *model.Repo { repo := model.Repo{ Name: from.Slug, Owner: from.Project.Key, Branch: "master", Kind: model.RepoGit, IsPrivate: true, // Since we have to use Netrc it has to always be private :/ FullName: fmt.Sprintf("%s/%s", from.Project.Key, from.Slug), } for _, item := range from.Links.Clone { if item.Name == "http" { uri, err := url.Parse(item.Href) if err != nil { return nil } uri.User = nil repo.Clone = uri.String() } } for _, item := range from.Links.Self { if item.Href != "" { repo.Link = item.Href } } return &repo }