Package hudson.plugins.mercurial
Class HgExe
java.lang.Object
hudson.plugins.mercurial.HgExe
- All Implemented Interfaces:
AutoCloseable
Encapsulates the invocation of the Mercurial command.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHgExe
(MercurialInstallation inst, com.cloudbees.plugins.credentials.common.StandardUsernameCredentials credentials, Launcher launcher, Node node, TaskListener listener, EnvVars env) Creates a new launcher.HgExe
(MercurialSCM scm, Launcher launcher, AbstractBuild build, TaskListener listener) Deprecated.HgExe
(MercurialSCM scm, Launcher launcher, Node node, TaskListener listener, EnvVars env) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionGets the branch name of given revision number or of the current workspace.bundle
(Collection<String> bases, String file) cleanAll()
Deprecated.Unused, since we need more control over the argument list in order to support credentials.void
close()
Gets the current value of a specified config item.Obtains the heads of the repository.static int
joinWithPossibleTimeout
(Launcher.ProcStarter proc, boolean useTimeout, TaskListener listener) For use withlaunch(hudson.util.ArgumentListBuilder)
(or similar) when running commands not inside a build and which therefore might not be easily killed.launch
(ArgumentListBuilder args) Prepares to start the Mercurial command.popen
(FilePath repository, TaskListener listener, boolean useTimeout, ArgumentListBuilder args) Runs the command and captures the output.pull()
Deprecated.Unused, since we need more control over the argument list in order to support credentials.run
(ArgumentListBuilder args) Deprecated.Useseed(boolean)
andlaunch(hudson.util.ArgumentListBuilder)
instead.Runs arbitrary command.seed
(boolean allowDebug) Starts creating an argument list.Gets the revision ID or node of the tip of the workspace.Gets the revision number of the tip of the workspace.version()
Gets the version of used Mercurial installation.
-
Field Details
-
launcher
-
node
-
listener
-
-
Constructor Details
-
HgExe
@Deprecated public HgExe(MercurialSCM scm, Launcher launcher, AbstractBuild build, TaskListener listener) throws IOException, InterruptedException Deprecated.- Throws:
IOException
InterruptedException
-
HgExe
@Deprecated public HgExe(MercurialSCM scm, Launcher launcher, Node node, TaskListener listener, EnvVars env) throws IOException, InterruptedException Deprecated.- Throws:
IOException
InterruptedException
-
HgExe
public HgExe(@CheckForNull MercurialInstallation inst, @CheckForNull com.cloudbees.plugins.credentials.common.StandardUsernameCredentials credentials, Launcher launcher, Node node, TaskListener listener, EnvVars env) throws IOException, InterruptedException Creates a new launcher. You must callclose()
in afinally
block or use try-with-resources.- Parameters:
inst
- a particular Mercurial installation to use (optional)credentials
- username/password or SSH private key credentials (optional)launcher
- a way to run commandsnode
- the machine to run commands onlistener
- a place to print errorsenv
- environment variables to pass to the command- Throws:
IOException
- for various reasonsInterruptedException
- for various reasons
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
InterruptedException
-
launch
Prepares to start the Mercurial command.- Parameters:
args
- some arguments as created byseed(boolean)
and then appended to- Returns:
- a process starter with the correct launcher, arguments, listener, and environment variables configured
-
joinWithPossibleTimeout
public static int joinWithPossibleTimeout(Launcher.ProcStarter proc, boolean useTimeout, TaskListener listener) throws IOException, InterruptedException For use withlaunch(hudson.util.ArgumentListBuilder)
(or similar) when running commands not inside a build and which therefore might not be easily killed.- Throws:
IOException
InterruptedException
-
seed
Starts creating an argument list. Initially adds only the Mercurial executable itself, possibly with a debug flag.- Parameters:
allowDebug
- whether to add a debug flag if the configured installation requested it- Returns:
- a builder
-
pull
Deprecated.Unused, since we need more control over the argument list in order to support credentials. -
clone
Deprecated.Unused, since we need more control over the argument list in order to support credentials. -
bundleAll
-
bundle
-
init
-
unbundle
-
cleanAll
-
run
Runs arbitrary command. -
run
Deprecated.Useseed(boolean)
andlaunch(hudson.util.ArgumentListBuilder)
instead. -
heads
public Set<String> heads(FilePath repo, boolean useTimeout) throws IOException, InterruptedException Obtains the heads of the repository.- Throws:
IOException
InterruptedException
-
tip
@CheckForNull public String tip(FilePath repository, @Nullable String rev) throws IOException, InterruptedException Gets the revision ID or node of the tip of the workspace. A 40-character hexadecimal string- Parameters:
rev
- the revision to identify; defaults to.
, i.e. working copy- Throws:
IOException
InterruptedException
-
tipNumber
@CheckForNull public String tipNumber(FilePath repository, @Nullable String rev) throws IOException, InterruptedException Gets the revision number of the tip of the workspace.- Parameters:
rev
- the revision to identify; defaults to.
, i.e. working copy- Throws:
IOException
InterruptedException
-
branch
@CheckForNull public String branch(FilePath repository, @CheckForNull String rev) throws IOException, InterruptedException Gets the branch name of given revision number or of the current workspace.- Parameters:
rev
- the revision to identify; defaults to current working copy- Throws:
IOException
InterruptedException
-
version
Gets the version of used Mercurial installation.- Throws:
IOException
InterruptedException
-
config
Gets the current value of a specified config item.- Throws:
IOException
InterruptedException
-
popen
@NonNull public String popen(FilePath repository, TaskListener listener, boolean useTimeout, ArgumentListBuilder args) throws IOException, InterruptedException Runs the command and captures the output.- Throws:
IOException
InterruptedException
-