revision

package
v5.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package revision extracts git revision from string More information about revision : https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtCheckout

type AtCheckout struct {
	Depth int
}

AtCheckout represents @{-n}

type AtDate

type AtDate struct {
	Date time.Time
}

AtDate represents @{"2006-01-02T15:04:05Z"}

type AtPush

type AtPush struct {
	BranchName string
}

AtPush represents @{push}

type AtReflog

type AtReflog struct {
	Depth int
}

AtReflog represents @{n}

type AtUpstream

type AtUpstream struct {
	BranchName string
}

AtUpstream represents @{upstream}, @{u}

type CaretPath

type CaretPath struct {
	Depth int
}

CaretPath represents ^, ^{n}

type CaretReg

type CaretReg struct {
	Regexp *regexp.Regexp
	Negate bool
}

CaretReg represents ^{/foo bar}

type CaretType

type CaretType struct {
	ObjectType string
}

CaretType represents ^{commit}

type ColonPath

type ColonPath struct {
	Path string
}

ColonPath represents :./<path> :<path>

type ColonReg

type ColonReg struct {
	Regexp *regexp.Regexp
	Negate bool
}

ColonReg represents :/foo bar

type ColonStagePath

type ColonStagePath struct {
	Path  string
	Stage int
}

ColonStagePath represents :<n>:/<path>

type ErrInvalidRevision

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

ErrInvalidRevision is emitted if string doesn't match valid revision

func (*ErrInvalidRevision) Error

func (e *ErrInvalidRevision) Error() string

type Parser

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

Parser represents a parser use to tokenize and transform to revisioner chunks a given string

func NewParser

func NewParser(r io.Reader) *Parser

NewParser returns a new instance of parser.

func NewParserFromString

func NewParserFromString(s string) *Parser

NewParserFromString returns a new instance of parser from a string.

func (*Parser) Parse

func (p *Parser) Parse() ([]Revisioner, error)

Parse explode a revision string into revisioner chunks

type Ref

type Ref string

Ref represents a reference name : HEAD, master, <hash>

type Revisioner

type Revisioner interface {
}

Revisioner represents a revision component. A revision is made of multiple revision components obtained after parsing a revision string, for instance revision "master~" will be converted in two revision components Ref and TildePath

type TildePath

type TildePath struct {
	Depth int
}

TildePath represents ~, ~{n}

Jump to

Keyboard shortcuts

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