Documentation
¶
Index ¶
- Constants
- Variables
- func Add(args ...string) error
- func Branch(args ...string) error
- func Checkout(args ...string) error
- func CherryPick(args ...string) error
- func CreateOrResetBranch(branch, target string) (action.Action, error)
- func CreateTrackingBranchUnlessExists(branch string, remote string) error
- func CurrentBranch() (branch string, err error)
- func DeleteTag(tag string) error
- func EnsureBranchNotExist(branch string, remote string) error
- func EnsureBranchSynchronized(branch, remote string) error
- func EnsureCleanWorkingTree(includeUntracked bool) error
- func EnsureFileClean(relativePath string) error
- func FixCommitSources(commits []*Commit) error
- func GetConfigString(key string) (value string, err error)
- func Hexsha(ref string) (hexsha string, err error)
- func LocalBranchExists(branch string) (exists bool, err error)
- func Log(args ...string) (stdout *bytes.Buffer, err error)
- func Push(remote string, args ...string) error
- func PushForce(remote string, args ...string) error
- func Rebase(args ...string) error
- func RefExists(ref string) (exists bool, err error)
- func RefExistsStrict(ref string) (exists bool, err error)
- func RemoteBranchExists(branch string, remote string) (exists bool, err error)
- func Reset(args ...string) error
- func ResetKeep(branch, ref string) (err error)
- func Run(args ...string) (stdout *bytes.Buffer, err error)
- func RunCommand(command string, args ...string) (stdout *bytes.Buffer, err error)
- func SetConfigString(key string, value string) error
- func Status(args ...string) (stdout *bytes.Buffer, err error)
- func Tag(args ...string) error
- func UpdateRemotes(remotes ...string) error
- type Commit
- type Config
- type ErrDirtyFile
- type LocalConfig
Constants ¶
const ( DefaultRemoteName = "origin" DefaultTrunkBranchName = "develop" DefaultReleaseBranchName = "release" DefaultStageBranchName = "client" DefaultStableBranchName = "master" )
const ConfigKeyRemote = "salsaflow.remote"
const StoryIdUnassignedTagValue = "unassigned"
Variables ¶
var ( ChangeIdTagPattern = regexp.MustCompile("^(?i)[ \t]*Change-Id:[ \t]+([^ \t]+)") StoryIdTagPattern = regexp.MustCompile("^(?i)[ \t]*Story-Id:[ \t]+([^ \t]+)") )
var ErrDirtyRepository = errors.New("the repository is dirty")
Functions ¶
func CherryPick ¶
func CurrentBranch ¶
func EnsureBranchNotExist ¶
func EnsureCleanWorkingTree ¶
func EnsureFileClean ¶
func FixCommitSources ¶
FixCommitSources can be used to set the Source field for the given commits to the right value in respect to the branching model.
We need this function becase using git log --all --source actually does not always yield the source values we want. It can set the source for the commits on the trunk branch and on the release branch to one of the feature branches that are branched off the given branch. That is not what we want, we want to have the Source field set to the trunk branch or the release branch in case the commit is reachable from one of these branches.
More precisely, the Source field is set in the following way:
commits on trunk -> refs/heads/trunk commits on trunk..origin/trunk -> refs/remotes/origin/trunk commits on trunk..release -> refs/heads/release commits on release..origin/release -> refs/remotes/origin/release
func GetConfigString ¶
func LocalBranchExists ¶
func RefExistsStrict ¶
RefExistsStrict requires the whole ref path to be specified, e.g. refs/remotes/origin/master.
func RemoteBranchExists ¶
func SetConfigString ¶
func UpdateRemotes ¶
Types ¶
type Commit ¶
type Commit struct {
SHA string
Source string
Merge string
Author string
AuthorDate time.Time
Committer string
CommitDate time.Time
MessageTitle string
Message string
ChangeIdTag string
StoryIdTag string
}
func ParseCommits ¶
Parse git log output, which is a sequence of Git commits looking like
commit $hexsha $source Author: $author Date: $date
$title $body Change-Id: $changeId Story-Id: $storyId
The reason why we are parsing the regular output (not using --pretty=format:) is that not all formatting options are supported. For example, log --all --source contains some information that cannot be easily taken by using --pretty=format:
func ShowCommitRange ¶
ShowCommitRange returns the list of commits specified by the given Git revision range.
func ShowCommits ¶
ShowCommits returns the list of commits associated with the given revisions.
type Config ¶
type Config interface {
RemoteName() string
TrunkBranchName() string
ReleaseBranchName() string
StagingBranchName() string
StableBranchName() string
}
func LoadConfig ¶
type ErrDirtyFile ¶
type ErrDirtyFile struct {
// contains filtered or unexported fields
}
func (*ErrDirtyFile) Error ¶
func (err *ErrDirtyFile) Error() string