public class HgExe extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
Launcher |
launcher |
TaskListener |
listener |
Node |
node |
Constructor and Description |
---|
HgExe(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.
|
Modifier and Type | Method and Description |
---|---|
String |
branch(FilePath repository,
String rev)
Gets the branch name of given revision number or of the current workspace.
|
Launcher.ProcStarter |
bundle(Collection<String> bases,
String file) |
Launcher.ProcStarter |
bundleAll(String file) |
Launcher.ProcStarter |
cleanAll() |
Launcher.ProcStarter |
clone(String... args)
Deprecated.
Unused, since we need more control over the argument list in order to support credentials.
|
void |
close() |
String |
config(FilePath repository,
String name)
Gets the current value of a specified config item.
|
Set<String> |
heads(FilePath repo,
boolean useTimeout)
Obtains the heads of the repository.
|
Launcher.ProcStarter |
init(FilePath path) |
static int |
joinWithPossibleTimeout(Launcher.ProcStarter proc,
boolean useTimeout,
TaskListener listener)
For use with
launch(hudson.util.ArgumentListBuilder) (or similar) when running commands not inside a build and which therefore might not be easily killed. |
Launcher.ProcStarter |
launch(ArgumentListBuilder args)
Prepares to start the Mercurial command.
|
String |
popen(FilePath repository,
TaskListener listener,
boolean useTimeout,
ArgumentListBuilder args)
Runs the command and captures the output.
|
Launcher.ProcStarter |
pull()
Deprecated.
Unused, since we need more control over the argument list in order to support credentials.
|
Launcher.ProcStarter |
run(ArgumentListBuilder args)
Deprecated.
Use
seed(boolean) and launch(hudson.util.ArgumentListBuilder) instead. |
Launcher.ProcStarter |
run(String... args)
Runs arbitrary command.
|
ArgumentListBuilder |
seed(boolean allowDebug)
Starts creating an argument list.
|
String |
tip(FilePath repository,
String rev)
Gets the revision ID or node of the tip of the workspace.
|
String |
tipNumber(FilePath repository,
String rev)
Gets the revision number of the tip of the workspace.
|
Launcher.ProcStarter |
unbundle(String bundleFile) |
String |
version()
Gets the version of used Mercurial installation.
|
public final Launcher launcher
public final Node node
public final TaskListener listener
@Deprecated public HgExe(MercurialSCM scm, Launcher launcher, AbstractBuild build, TaskListener listener) throws IOException, InterruptedException
IOException
InterruptedException
@Deprecated public HgExe(MercurialSCM scm, Launcher launcher, Node node, TaskListener listener, EnvVars env) throws IOException, InterruptedException
IOException
InterruptedException
public HgExe(@CheckForNull MercurialInstallation inst, @CheckForNull com.cloudbees.plugins.credentials.common.StandardUsernameCredentials credentials, Launcher launcher, Node node, TaskListener listener, EnvVars env) throws IOException, InterruptedException
close()
in a finally
block
or use try-with-resources.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 commandIOException
- for various reasonsInterruptedException
- for various reasonspublic void close() throws IOException, InterruptedException
close
in interface AutoCloseable
IOException
InterruptedException
public Launcher.ProcStarter launch(ArgumentListBuilder args)
args
- some arguments as created by seed(boolean)
and then appended topublic static int joinWithPossibleTimeout(Launcher.ProcStarter proc, boolean useTimeout, TaskListener listener) throws IOException, InterruptedException
launch(hudson.util.ArgumentListBuilder)
(or similar) when running commands not inside a build and which therefore might not be easily killed.IOException
InterruptedException
public ArgumentListBuilder seed(boolean allowDebug)
allowDebug
- whether to add a debug flag if the configured installation requested it@Deprecated public Launcher.ProcStarter pull()
@Deprecated public Launcher.ProcStarter clone(String... args)
public Launcher.ProcStarter bundleAll(String file)
public Launcher.ProcStarter bundle(Collection<String> bases, String file)
public Launcher.ProcStarter init(FilePath path)
public Launcher.ProcStarter unbundle(String bundleFile)
public Launcher.ProcStarter cleanAll()
public Launcher.ProcStarter run(String... args)
@Deprecated public Launcher.ProcStarter run(ArgumentListBuilder args)
seed(boolean)
and launch(hudson.util.ArgumentListBuilder)
instead.public Set<String> heads(FilePath repo, boolean useTimeout) throws IOException, InterruptedException
IOException
InterruptedException
@CheckForNull public String tip(FilePath repository, @Nullable String rev) throws IOException, InterruptedException
rev
- the revision to identify; defaults to .
, i.e. working copyIOException
InterruptedException
@CheckForNull public String tipNumber(FilePath repository, @Nullable String rev) throws IOException, InterruptedException
rev
- the revision to identify; defaults to .
, i.e. working copyIOException
InterruptedException
@CheckForNull public String branch(FilePath repository, @CheckForNull String rev) throws IOException, InterruptedException
rev
- the revision to identify; defaults to current working copyIOException
InterruptedException
@CheckForNull public String version() throws IOException, InterruptedException
IOException
InterruptedException
public String config(FilePath repository, String name) throws IOException, InterruptedException
IOException
InterruptedException
@NonNull public String popen(FilePath repository, TaskListener listener, boolean useTimeout, ArgumentListBuilder args) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2016–2022. All rights reserved.