From 794ec5392b48a1e0ece381fcf1fec230f415511c Mon Sep 17 00:00:00 2001 From: Angus Williams Date: Thu, 9 Nov 2023 21:16:55 +1300 Subject: [PATCH 1/3] Adds option for project push mirrors --- project_mirror.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/project_mirror.go b/project_mirror.go index 129040ccb..b159a110c 100644 --- a/project_mirror.go +++ b/project_mirror.go @@ -40,6 +40,7 @@ type ProjectMirror struct { LastSuccessfulUpdateAt *time.Time `json:"last_successful_update_at"` LastUpdateAt *time.Time `json:"last_update_at"` LastUpdateStartedAt *time.Time `json:"last_update_started_at"` + MirrorBranchRegex string `json:"mirror_branch_regex"` OnlyProtectedBranches bool `json:"only_protected_branches"` KeepDivergentRefs bool `json:"keep_divergent_refs"` UpdateStatus string `json:"update_status"` @@ -107,6 +108,7 @@ func (s *ProjectMirrorService) GetProjectMirror(pid interface{}, mirror int, opt type AddProjectMirrorOptions struct { URL *string `url:"url,omitempty" json:"url,omitempty"` Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` } @@ -142,9 +144,10 @@ func (s *ProjectMirrorService) AddProjectMirror(pid interface{}, opt *AddProject // GitLab API docs: // https://docs.gitlab.com/ee/api/remote_mirrors.html#update-a-remote-mirrors-attributes type EditProjectMirrorOptions struct { - Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` - OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` - KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` + Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` + OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` + KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` } // EditProjectMirror updates a project team member to a specified access level.. From e0e265e57fc6ae990b48498e55f5ea3458d6dee9 Mon Sep 17 00:00:00 2001 From: Angus Williams Date: Fri, 10 Nov 2023 11:38:25 +1300 Subject: [PATCH 2/3] Allow mirror_branch_regex to be set when updating projects --- projects.go | 1 + 1 file changed, 1 insertion(+) diff --git a/projects.go b/projects.go index 9afa0682e..9bf0689dc 100644 --- a/projects.go +++ b/projects.go @@ -862,6 +862,7 @@ type EditProjectOptions struct { MergeRequestsTemplate *string `url:"merge_requests_template,omitempty" json:"merge_requests_template,omitempty"` MergeTrainsEnabled *bool `url:"merge_trains_enabled,omitempty" json:"merge_trains_enabled,omitempty"` Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` MirrorOverwritesDivergedBranches *bool `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"` MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"` MirrorUserID *int `url:"mirror_user_id,omitempty" json:"mirror_user_id,omitempty"` From fdf5310d61ce9145ce8fbc65473056300b9303a3 Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Mon, 13 Nov 2023 09:26:41 +0100 Subject: [PATCH 3/3] Update ordering to follow the docs --- project_mirror.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project_mirror.go b/project_mirror.go index b159a110c..16f030d39 100644 --- a/project_mirror.go +++ b/project_mirror.go @@ -108,9 +108,9 @@ func (s *ProjectMirrorService) GetProjectMirror(pid interface{}, mirror int, opt type AddProjectMirrorOptions struct { URL *string `url:"url,omitempty" json:"url,omitempty"` Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` - MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` - OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` + OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` } // AddProjectMirror creates a new mirror on the project. @@ -145,9 +145,9 @@ func (s *ProjectMirrorService) AddProjectMirror(pid interface{}, opt *AddProject // https://docs.gitlab.com/ee/api/remote_mirrors.html#update-a-remote-mirrors-attributes type EditProjectMirrorOptions struct { Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` - MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` - OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` KeepDivergentRefs *bool `url:"keep_divergent_refs,omitempty" json:"keep_divergent_refs,omitempty"` + OnlyProtectedBranches *bool `url:"only_protected_branches,omitempty" json:"only_protected_branches,omitempty"` + MirrorBranchRegex *string `url:"mirror_branch_regex,omitempty" json:"mirror_branch_regex,omitempty"` } // EditProjectMirror updates a project team member to a specified access level..