about summary refs log tree commit diff
path: root/gerrit/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit/client.go')
-rw-r--r--gerrit/client.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/gerrit/client.go b/gerrit/client.go
index 5a13befe5463..c65b5016c1ff 100644
--- a/gerrit/client.go
+++ b/gerrit/client.go
@@ -17,13 +17,15 @@ type IClient interface {
 	SubmitChangeset(changeset *Changeset) (*Changeset, error)
 	RebaseChangeset(changeset *Changeset, ref string) (*Changeset, error)
 	RemoveTag(changeset *Changeset, tag string) (*Changeset, error)
+	GetBaseURL() string
 }
 
 var _ IClient = &Client{}
 
 // Client provides some ways to interact with a gerrit instance
 type Client struct {
-	client *goGerrit.Client
+	client  *goGerrit.Client
+	baseURL string
 }
 
 // NewClient initializes a new gerrit client
@@ -38,7 +40,10 @@ func NewClient(URL, username, password string) (*Client, error) {
 	if err != nil {
 		return nil, err
 	}
-	return &Client{client: goGerritClient}, nil
+	return &Client{
+		client:  goGerritClient,
+		baseURL: URL,
+	}, nil
 }
 
 // SearchChangesets fetches a list of changesets matching a passed query string
@@ -117,3 +122,8 @@ func (gerrit *Client) RemoveTag(changeset *Changeset, tag string) (*Changeset, e
 	// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-hashtags
 	return changeset, nil
 }
+
+// GetBaseURL returns the gerrit base URL
+func (gerrit *Client) GetBaseURL() string {
+	return gerrit.baseURL
+}