git

package
v0.31.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	// Dir is the location of the git repo.
	Dir string
}

Repo is a clone of a git repository. Create with Clone, and don't forget to clean it up after.

func Clone

func Clone(repo, dir, mirrorDir, primaryBranch, gitopsPath string) (*Repo, error)

Clone clones a repository. Pass the full repository name, such as "https://aleksey.pesternikov@bitbucket.tubemogul.info/scm/tm/repo.git" as the repo. Cloned directory will be clean of local changes with primaryBranch branch checked out. repo: https://aleksey.pesternikov@bitbucket.tubemogul.info/scm/tm/repo.git dir: /tmp/cloudrepo mirrorDir: optional (if not empty) local mirror of the repository

func (*Repo) Clean

func (r *Repo) Clean() error

Clean cleans up the repo

func (*Repo) Commit

func (r *Repo) Commit(message, gitopsPath string) bool

Commit all changes to the current branch. returns true if there were any changes

func (*Repo) GetLastCommitMessage

func (r *Repo) GetLastCommitMessage() (msg string)

GetLastCommitMessage fetches the commit message from the most recent change of the branch

func (*Repo) IsClean

func (r *Repo) IsClean() bool

IsClean returns true if there is no local changes (nothing to commit)

func (*Repo) Push

func (r *Repo) Push(branches []string)

Push pushes all local changes to the remote repository all changes should be already commited

func (*Repo) RecreateBranch

func (r *Repo) RecreateBranch(branch, primaryBranch string)

RecreateBranch discards a branch content and reset it from primaryBranch.

func (*Repo) SwitchToBranch

func (r *Repo) SwitchToBranch(branch, primaryBranch string) (new bool)

SwitchToBranch switch the repo to specified branch and checkout primaryBranch files over it. if branch does not exist it will be created

type Server

type Server interface {
	CreatePR(from, to, title, body string) error
}

type ServerFunc

type ServerFunc func(from, to, title, body string) error

func (ServerFunc) CreatePR

func (f ServerFunc) CreatePR(from, to, title, body string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL