godock: github.com/sqp/godock/libs/packages/versions Index | Files

package versions

import "github.com/sqp/godock/libs/packages/versions"

Package versions checks and updates vcs packages. Only git supported.

Index

Package Files

sources.go versions.go

Variables

var (
    ArgsFetch        = "fetch"
    ArgsRev          = "rev-parse {location}"        // HEAD  or origin
    ArgsCountCommits = "rev-list --count {location}" //
    ArgsDeltaLog     = "log {format} {location}"     // -n {limit}
    ArgsUpdate       = "pull --ff-only"
)

Git commands args.

var (
    // LogFormat defines the format for ShowVersions: just show commits title (one line).
    LogFormat = "--pretty=format:%s"
)

type Repo Uses

type Repo struct {
    Name    string // Repository name.
    Dir     string // Location of repo on the filesystem.
    GotData bool   // true if data was successfully pulled.

    Log   string // Commit messages for new commits.
    Delta int    // Delta of revisions between server and local.

    // template display fields.
    NewLocal int  //  Number of unmerged patch in local dir.
    Zero     bool // True if revisions are the same.
    // contains filtered or unexported fields
}

Repo checks and updates a VCS sources repository.

func NewRepo Uses

func NewRepo(log cdtype.Logger, repo, dir string) *Repo

NewRepo creates a source repo with name and dir.

func (*Repo) Update Uses

func (repo *Repo) Update() (delta int, logstr string, e error)

Update updates the local repo to server version, returns the count and log.

type VCS Uses

type VCS struct {
    Cmd string
    Dir string
}

VCS get informations and acts on a git repository.

func New Uses

func New(repoRoot string) (*VCS, error)

New creates a git client for the repo.

func NewFetched Uses

func NewFetched(repoRoot string) (*VCS, error)

NewFetched creates a git client for the repo and updates server info.

func (*VCS) CountCommits Uses

func (v *VCS) CountCommits(location string) (int, error)

CountCommits gives the total number of commits of the branch at location.

func (*VCS) DeltaLog Uses

func (v *VCS) DeltaLog(location string) (string, error)

DeltaLog shows logs for location (or query).

func (*VCS) Fetch Uses

func (v *VCS) Fetch() error

Fetch downloads server informations (apt-get update).

func (*VCS) Rev Uses

func (v *VCS) Rev(location string) (rev string, e error)

Rev returns the current commit ID for location.

func (*VCS) RunOutput Uses

func (v *VCS) RunOutput(dir string, cmd string, keyval ...string) ([]byte, error)

RunOutput is like run but returns the output of the command.

func (*VCS) Update Uses

func (v *VCS) Update() (new int, e error)

Update updates the local branch and returns the number of new commmits.

type Versions Uses

type Versions struct {
    // contains filtered or unexported fields
}

Versions handles version checking on multiple VCS repositories.

func NewVersions Uses

func NewVersions(callResult func(int, error), repos ...*Repo) *Versions

NewVersions creates a multiple versions checker with some repos.

func (*Versions) AddSources Uses

func (ver *Versions) AddSources(repos ...*Repo) *Versions

AddSources adds repositories to the managed list.

func (*Versions) Check Uses

func (ver *Versions) Check()

Check is the callback for poller. TODO: need to better handle errors.

func (*Versions) Clear Uses

func (ver *Versions) Clear(repos ...*Repo) *Versions

Clear clears the repositories list.

func (*Versions) CountNew Uses

func (ver *Versions) CountNew() int

CountNew returns the number of new commits.

func (*Versions) SetCountNew Uses

func (ver *Versions) SetCountNew(countNew int)

SetCountNew sets the number of new commits.

func (*Versions) Sources Uses

func (ver *Versions) Sources() []*Repo

Sources lists managed repositories.

Package versions imports 10 packages (graph) and is imported by 2 packages. Updated 2016-07-21. Refresh now. Tools for package owners.