p4

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowWildcards oAllowWildcards
View Source
var DoNotIgnore oDoNotIgnore
View Source
var Keep oKeep

Functions

func Changelist

func Changelist(cl int64) oChangelist

func EscapePath

func EscapePath(path string) string

func ParseSpec

func ParseSpec(spec string) map[string]string

ParseSpec takes in a string with a single spec formatted using -ztag, and returns a map with the key/value pairs in that spec For example:

... Client super_client
... Update 2021/09/16 22:30:29
... Description first line

... Root C:\Users\Super\Perforce

Becomes:

map[string]string{
  "Client": "super_client",
  "Description": "first line\n",
  "Root": "C:\\Users\\Super\\Perforce",
  "Update": "2021/09/16 22:30:29",
}

func Type

func Type(t string) oType

func UnescapePath

func UnescapePath(path string) (string, error)

func WriteTempFile

func WriteTempFile(filepattern, contents string) (fnCleanup func(), filename string, err error)

WriteTempFile creates a temporary file then writes the passed contents to that file. To understand "filepattern", see the os.CreateTemp() documentation for the "pattern" argument. If there is no error in creating the file, then the returned func must be called when it is safe to delete the created temporary file.

Types

type CaseType

type CaseType uint8
const (
	CaseUnknown     CaseType = iota
	CaseInsensitive CaseType = iota
	CaseSensitive   CaseType = iota
)

type DepotFile

type DepotFile struct {
	Path   string // relative to depot, ie 'Engine/foo', not '//UE4/Release/Engine/foo'
	Action string
	CL     string
	Type   string
	Digest string
}

type DepotFileCaseInsensitive

type DepotFileCaseInsensitive []DepotFile

DepotFileCaseInsensitive allows sorting slices of DepotFile by path, but ignoring case.

func (DepotFileCaseInsensitive) Len

func (x DepotFileCaseInsensitive) Len() int

func (DepotFileCaseInsensitive) Less

func (x DepotFileCaseInsensitive) Less(i, j int) bool

func (DepotFileCaseInsensitive) Swap

func (x DepotFileCaseInsensitive) Swap(i, j int)

type Info

type Info struct {
	CaseHandling CaseType
}

type Option

type Option interface {
	String() string
	// contains filtered or unexported methods
}

type P4

type P4 struct {
	Port    string
	User    string
	Charset string
	Client  string
	// contains filtered or unexported fields
}

func New

func New(sh *bsh.Bsh, port, user, charset, client string) *P4

func (*P4) Add

func (p *P4) Add(paths []string, opts ...Option) error

Add adds new files to the depot. Unlike other p4 commands, file paths passed into Add must not escape the reserved characters #, @, %, and *. You can override this behavior by passing the AllowWildcards option.

func (*P4) CreateEmptyChangelist

func (p *P4) CreateEmptyChangelist(description string) (int64, error)

CreateEmptyChangelist creates a new changelist

func (*P4) CreateMainlineStream

func (p *P4) CreateMainlineStream(depot, name string) error

CreateMainlineStream creates a new stream with type mainline and whose full stream path is //depot/name

func (*P4) CreateStreamClient

func (p *P4) CreateStreamClient(clientname string, root string, stream string) error

CreateStreamClient creates a new client for the given stream

func (*P4) CreateStreamDepot

func (p *P4) CreateStreamDepot(name string) error

CreateStreamDepot creates a depot with type "stream".

func (*P4) Delete

func (p *P4) Delete(paths []string, opts ...Option) error

Delete marks one or more files for delete. Note that this will call `p4 delete`, which will immediately delete the local copy of the file.

func (*P4) DeleteClient

func (p *P4) DeleteClient(clientname string) error

DeleteClient deletes an existing client spec that has no changelists or open files

func (*P4) DisplayName

func (p *P4) DisplayName() string

DisplayName just returns the Port at the moment. Should it do anything fancier?

func (*P4) Edit

func (p *P4) Edit(paths []string, opts ...Option) error

Edit checks out one or more existing file(s) from the depot. If your path includes any reserved characters (@#%*), you need to first escape your path with EscapePath.

func (*P4) GetClientSpec

func (p *P4) GetClientSpec() (map[string]string, error)

GetClientSpec requests the current client spec, and returns the resulting spec as a map of key/value pairs.

func (*P4) Info

func (p *P4) Info() (Info, error)

Info runs the info command against the server.

func (*P4) ListClients

func (p *P4) ListClients() ([]string, error)

ListClients returns a list of client names for the current user

func (*P4) ListDepotFiles

func (p *P4) ListDepotFiles() ([]DepotFile, error)

ListDepotFiles runs "p4 fstat" and parses the results into a slice of DepotFile structs. Order of resulting slice is alphabetical by Path, ignoring case.

func (*P4) Move

func (p *P4) Move(from string, to string, opts ...Option) error

Move changes the path (including capitalization changes) and filetype of a file in the depot. If your path includes any reserved characters (@#%*), you need to first escape your path with EscapePath.

func (*P4) NeedsLogin

func (p *P4) NeedsLogin() (bool, error)

NeedsLogin determines if we have a valid ticket or not.

func (*P4) RevertUnchanged

func (p *P4) RevertUnchanged(path string, opts ...Option) error

RevertUnchanged reverts checked out files that have not been changed.

func (*P4) SetStreamName

func (p *P4) SetStreamName(stream string) error

func (*P4) StreamInfo

func (p *P4) StreamInfo() (string, int, error)

func (*P4) SubmitChangelist

func (p *P4) SubmitChangelist(cl int64) error

SubmitChangelist submits the given changelist

func (*P4) SyncLatest

func (p *P4) SyncLatest() error

SyncLatest runs p4 sync ...#head

func (*P4) SyncLatestNoDownload

func (p *P4) SyncLatestNoDownload() error

SyncLatestNoDownload runs "p4 sync -k ...#head" which will: "Keep existing workspace files; update the have list without updating the client workspace"

Jump to

Keyboard shortcuts

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