Documentation
¶
Overview ¶
Package p4 wraps the Perforce Helix Core command line.
It assumes p4 or p4.exe is in the PATH. It uses the p4 -G global option which returns Python marshalled dictionary objects.
p4 Python parsing module is based on: https://github.com/hambster/gopymarshal
Index ¶
- Constants
- Variables
- func ParseError(res map[interface{}]interface{}) error
- func ParsedMapToDebugString(inMapArr []map[interface{}]interface{}) (string, error)
- func Unmarshal(buffer *bytes.Buffer) (ret interface{}, retErr error)
- func Unmarshal2(buffer *bytes.Buffer) (ret interface{}, remainder []byte, retErr error)
- type Describe
- type Fix
- type Fixes
- type JobDescription
- type P4
- func (p4 *P4) Run(args []string) ([]byte, error)
- func (p4 *P4) RunAndGetBytes(args []string) ([]byte, error)
- func (p4 *P4) RunAndGetString(args []string) (string, error)
- func (p4 *P4) RunAndParseFromJson(args []string) ([]map[interface{}]interface{}, error)
- func (p4 *P4) RunAndParseFromPython(args []string) ([]map[interface{}]interface{}, error)
- func (p4 *P4) Save(specName string, specContents map[string]string, args []string) ([]map[string]string, error)
- func (p4 *P4) SaveTxt(specName string, specContents map[string]string, args []string) (string, error)
- type Revision
- type Runner
Constants ¶
const ( RawBytes outputType = iota RawString ParsedPython ParsedJson )
Variables ¶
var ( ErrParse = errors.New("invalid data") ErrUnknownCode = errors.New("unknown code") )
Parse error
Functions ¶
func ParseError ¶
func ParseError(res map[interface{}]interface{}) error
ParseError - Turns p4 error messages into Go error's
func ParsedMapToDebugString ¶
ParsedMapToDebugString - Quick and dirty debug function to get parsed output as a printable string
Types ¶
type Describe ¶
type Describe struct { Code string Change string OldChange string ChangeType string Client string Desc string Path string Time string Status string User string Jobs []JobDescription Revisions []Revision }
Describe - Contains the output of a describe command
type Fix ¶
type Fix struct { Code string Change string Client string Date string // seconds since epoch Job string Status string User string }
Fix is a single fix from p4 fixes result
type JobDescription ¶
type P4 ¶
type P4 struct {
// contains filtered or unexported fields
}
P4 - Environment for P4
func NewP4 ¶
func NewP4() *P4
NewP4 - Create and initialise a default P4 instance. Any commands invoked with this P4 instance will use default Perforce environment variables.
func NewP4Params ¶
NewP4Params - Create and initialise with params. Any commands invoked with this P4 instance will override the default Perforce environment variables.
func (*P4) Run ¶
Run - The most basic Run() command. All this does is run p4 with the supplied arguments, and then blocks before returning the combined output.
func (*P4) RunAndGetBytes ¶
RunAndGetBytes - Runs a p4 command and returns its output as a []byte
func (*P4) RunAndGetString ¶
RunAndGetString - Runs a p4 command and returns its output as a string
func (*P4) RunAndParseFromJson ¶
RunAndParseFromJson - Runs a p4 command with the -Mj flag, parses the output, and returns the output as a map.
func (*P4) RunAndParseFromPython ¶
RunAndParseFromPython - Runs a p4 command with the -G flag, parses the output, and returns the output as a map.
func (*P4) Save ¶
func (p4 *P4) Save(specName string, specContents map[string]string, args []string) ([]map[string]string, error)
Save - Runs p4 -i for specified spec, then returns result
func (*P4) SaveTxt ¶
func (p4 *P4) SaveTxt(specName string, specContents map[string]string, args []string) (string, error)
SaveTxt - The Save() func doesn't work as it needs the data marshalled instead of map[string]string This is a quick fix, the real fix is writing a marshal() function or try using gopymarshal