Package org.apache.maven.scm.provider.hg
Class HgUtils
- java.lang.Object
-
- org.apache.maven.scm.provider.hg.HgUtils
-
public final class HgUtils extends java.lang.ObjectCommon code for executing hg commands.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classHgUtils.HgBranchnameConsumerGet current (working) branch name.private static classHgUtils.HgRevNoConsumerGet current (working) revision.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULTprivate static java.util.List<java.lang.Integer>DEFAULT_EXIT_CODESDefault exit codes for entries not in exitCodeMap.private static java.util.Map<java.lang.String,java.util.List<java.lang.Integer>>EXIT_CODE_MAPMap between command and its valid exit codes.private static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Modifier Constructor Description privateHgUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static org.codehaus.plexus.util.cli.CommandlinebuildCmd(java.io.File workingDir, java.lang.String[] cmdAndArgs)static booleandifferentOutgoingBranchFound(java.io.File workingDir, java.lang.String workingbranchName)Check if there are outgoing changes on a different branch.static ScmResultexecute(java.io.File workingDir, java.lang.String[] cmdAndArgs)static ScmResultexecute(HgConsumer consumer, java.io.File workingDir, java.lang.String[] cmdAndArgs)(package private) static intexecuteCmd(HgConsumer consumer, org.codehaus.plexus.util.cli.Commandline cmd)static java.lang.String[]expandCommandLine(java.lang.String[] cmdAndArgs, ScmFileSet additionalFiles)private static java.lang.StringgetBranchName(java.lang.String branch)static java.lang.StringgetCurrentBranchName(java.io.File workingDir)static intgetCurrentRevisionNumber(java.io.File workingDir)static java.lang.StringmaskPassword(org.codehaus.plexus.util.cli.Commandline cl)
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
DEFAULT
public static final java.lang.String DEFAULT
- See Also:
- Constant Field Values
-
EXIT_CODE_MAP
private static final java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> EXIT_CODE_MAP
Map between command and its valid exit codes.
-
DEFAULT_EXIT_CODES
private static final java.util.List<java.lang.Integer> DEFAULT_EXIT_CODES
Default exit codes for entries not in exitCodeMap.
-
-
Method Detail
-
execute
public static ScmResult execute(HgConsumer consumer, java.io.File workingDir, java.lang.String[] cmdAndArgs) throws ScmException
- Throws:
ScmException
-
buildCmd
static org.codehaus.plexus.util.cli.Commandline buildCmd(java.io.File workingDir, java.lang.String[] cmdAndArgs) throws ScmException- Throws:
ScmException
-
executeCmd
static int executeCmd(HgConsumer consumer, org.codehaus.plexus.util.cli.Commandline cmd) throws ScmException
- Throws:
ScmException
-
execute
public static ScmResult execute(java.io.File workingDir, java.lang.String[] cmdAndArgs) throws ScmException
- Throws:
ScmException
-
expandCommandLine
public static java.lang.String[] expandCommandLine(java.lang.String[] cmdAndArgs, ScmFileSet additionalFiles)
-
getCurrentRevisionNumber
public static int getCurrentRevisionNumber(java.io.File workingDir) throws ScmException- Throws:
ScmException
-
getCurrentBranchName
public static java.lang.String getCurrentBranchName(java.io.File workingDir) throws ScmException- Throws:
ScmException
-
differentOutgoingBranchFound
public static boolean differentOutgoingBranchFound(java.io.File workingDir, java.lang.String workingbranchName) throws ScmExceptionCheck if there are outgoing changes on a different branch. If so, Mercurial default behaviour is to block the push and warn using a 'push creates new remote branch !' message. We also warn, and return true if a different outgoing branch was foundMethod users should not stop the push on a negative return, instead, they should hg push -r(branch being released)
- Parameters:
workingDir- the working dirworkingbranchName- the working branch name- Returns:
- true if a different outgoing branch was found
- Throws:
ScmException- on outgoing command error
-
getBranchName
private static java.lang.String getBranchName(java.lang.String branch)
-
maskPassword
public static java.lang.String maskPassword(org.codehaus.plexus.util.cli.Commandline cl)
-
-