Documentation
¶
Index ¶
- Variables
- func Changelist(cl int64) oChangelist
- func EscapePath(path string) string
- func ParseSpec(spec string) map[string]string
- func Type(t string) oType
- func UnescapePath(path string) (string, error)
- func WriteTempFile(filepattern, contents string) (fnCleanup func(), filename string, err error)
- type CaseType
- type DepotFile
- type DepotFileCaseInsensitive
- type Info
- type Option
- type P4
- func (p *P4) Add(paths []string, opts ...Option) error
- func (p *P4) CreateEmptyChangelist(description string) (int64, error)
- func (p *P4) CreateMainlineStream(depot, name string) error
- func (p *P4) CreateStreamClient(clientname string, root string, stream string) error
- func (p *P4) CreateStreamDepot(name string) error
- func (p *P4) Delete(paths []string, opts ...Option) error
- func (p *P4) DeleteClient(clientname string) error
- func (p *P4) DisplayName() string
- func (p *P4) Edit(paths []string, opts ...Option) error
- func (p *P4) GetClientSpec() (map[string]string, error)
- func (p *P4) Info() (Info, error)
- func (p *P4) ListClients() ([]string, error)
- func (p *P4) ListDepotFiles() ([]DepotFile, error)
- func (p *P4) Move(from string, to string, opts ...Option) error
- func (p *P4) NeedsLogin() (bool, error)
- func (p *P4) RevertUnchanged(path string, opts ...Option) error
- func (p *P4) SetStreamName(stream string) error
- func (p *P4) StreamInfo() (string, int, error)
- func (p *P4) SubmitChangelist(cl int64) error
- func (p *P4) SyncLatest() error
- func (p *P4) SyncLatestNoDownload() error
Constants ¶
This section is empty.
Variables ¶
var AllowWildcards oAllowWildcards
var DoNotIgnore oDoNotIgnore
var Keep oKeep
Functions ¶
func Changelist ¶
func Changelist(cl int64) oChangelist
func EscapePath ¶
func ParseSpec ¶
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 UnescapePath ¶
func WriteTempFile ¶
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 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 P4 ¶
type P4 struct { Port string User string Charset string Client string // contains filtered or unexported fields }
func (*P4) Add ¶
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 ¶
CreateEmptyChangelist creates a new changelist
func (*P4) CreateMainlineStream ¶
CreateMainlineStream creates a new stream with type mainline and whose full stream path is //depot/name
func (*P4) CreateStreamClient ¶
CreateStreamClient creates a new client for the given stream
func (*P4) CreateStreamDepot ¶
CreateStreamDepot creates a depot with type "stream".
func (*P4) Delete ¶
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 ¶
DeleteClient deletes an existing client spec that has no changelists or open files
func (*P4) DisplayName ¶
DisplayName just returns the Port at the moment. Should it do anything fancier?
func (*P4) Edit ¶
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 ¶
GetClientSpec requests the current client spec, and returns the resulting spec as a map of key/value pairs.
func (*P4) ListClients ¶
ListClients returns a list of client names for the current user
func (*P4) ListDepotFiles ¶
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 ¶
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 ¶
NeedsLogin determines if we have a valid ticket or not.
func (*P4) RevertUnchanged ¶
RevertUnchanged reverts checked out files that have not been changed.
func (*P4) SetStreamName ¶
func (*P4) SubmitChangelist ¶
SubmitChangelist submits the given changelist
func (*P4) SyncLatestNoDownload ¶
SyncLatestNoDownload runs "p4 sync -k ...#head" which will: "Keep existing workspace files; update the have list without updating the client workspace"