Perforce Vcs Root
Perforce VCS root
Example. Defines a Perforce VCS root for a Perforce stream with automatic monitoring of sub-streams.
object StreamBasedRootWithSubStreams : PerforceVcsRoot({
name = "Stream-based root with sub-streams"
port = "perforce:1666"
mode = stream {
streamName = "//streams/project/mainline"
enableFeatureBranches = true
branchSpec = """
+://streams/project/(*)
-://streams/project/release1.0
""".trimIndent()
}
// Create a non-stream workspace but allow using TeamCity checkout rules.
// When false (default), TeamCity creates a stream workspace which allows commit back to P4
nonStreamWorkspace = true
userName = "tcAdmin"
password = "credentialsJSON:******"
// Instead of polling, consider using commit hooks:
// https://www.jetbrains.com.cn/en-us/help/teamcity/configuring-vcs-post-commit-hooks-for-teamcity.html#Setting+up+post-commit+hook+on+Perforce+server
pollInterval = 120
})
Example. Defines a Perforce VCS root with some client mapping and some custom workspace options.
object MainRoot : PerforceVcsRoot({
name = "Main root"
port = "perforce:1666"
mode = clientMapping {
mapping = """
//depot/MyProject/... //team-city-agent/...
//depot/Library1/... //team-city-agent/lib1/...
//depot/Library2/... //team-city-agent/lib2/...
-//depot/Library2/xxx/... //team-city-agent/lib1/xxx/...
""".trimIndent()
}
workspaceOptions = """
Options: noallwrite clobber nocompress unlocked nomodtime rmdir
Host: %teamcity.agent.hostname%
SubmitOptions: revertunchanged
LineEnd: local
""".trimIndent()
userName = "tcAdmin"
password = "credentialsJSON:******"
})
Example. Defines a Perforce VCS root with checkout mapping based on a specific non-stream client. Also, an explicit p4 clean
will be run for each checkout, and utf8 encoding will be used when obtaining sources from the Perforce server.
object ClientBasedRoot : PerforceVcsRoot({
name = "Client-based root"
port = "perforce:1666"
mode = client {
clientName = "teamcityClient"
}
userName = "tcAdmin"
password = "credentialsJSON:******"
runP4Clean = true
charsetName = "utf8"
})
Properties
A charset to use on the client machine
Custom Perforce revision/label to checkout
VCS root id. It appears in the web UI and is used in urls. If the VCS root has a uuid specified, then the id can be changed at any time. If uuid is omitted, then TeamCity treats a VCS root with a changed id as a new VCS root, all data associated with the old root will be lost (e.g. a commits graph). Id can also be used by some settings, e.g. as a part of parameter reference. If you change the id, you should find all its occurrences in the current project and change them too. Id must be unique across all VCS roots on the server. If id is missing, it will be generated from the class name (if the class is not from the jetbrains.buildServer.configs.kotlin
package).
A mode of Perforce connection
When set, the created Perforce workspace on agent will not be stream-enabled. The option allows using arbitrary checkout rules, but prohibits commits from agent into the stream.
Helper for creating references to parameters of this VCS root
VCS root polling interval, in seconds
Whether TeamCity should run 'p4 clean' command before the build
Whether TeamCity should track files on the Perforce server on sync
Enables support for files with UTF-16 encoding
Additional options for the p4 sync command
Functions
Connect to to Perforce using the specified client name
Connect to Perforce using the specified client mapping
Copies parameters of this object to the specified target
Sets the id to the specified value. Type of the id depends on the context in which DSL is executed: it is RelativeId when DSL context is relative, otherwise it is AbsoluteId.
Connect to Perforce stream with specified name
Validates this object and reports found errors to the provided consumer