public class GitStatusConsumer
extends java.lang.Object
implements org.codehaus.plexus.util.cli.StreamConsumer
| Modifier and Type | Field and Description |
|---|---|
private static java.util.regex.Pattern |
ADDED_PATTERN
The pattern used to match added file lines
|
private java.util.List<ScmFile> |
changedFiles
Entries are relative to working directory, not to the repositoryroot
|
private static java.util.regex.Pattern |
DELETED_PATTERN
The pattern used to match deleted file lines
|
private ScmLogger |
logger |
private static java.util.regex.Pattern |
MODIFIED_PATTERN
The pattern used to match modified file lines
|
private java.net.URI |
relativeRepositoryPath |
private static java.util.regex.Pattern |
RENAMED_PATTERN
The pattern used to match renamed file lines
|
private java.io.File |
workingDirectory |
| Constructor and Description |
|---|
GitStatusConsumer(ScmLogger logger,
java.io.File workingDirectory)
Consumer when workingDirectory and repositoryRootDirectory are the same
|
GitStatusConsumer(ScmLogger logger,
java.io.File workingDirectory,
java.net.URI relativeRepositoryPath)
Assuming that you have to discover the repositoryRoot, this is how you can get the
relativeRepositoryPath |
| Modifier and Type | Method and Description |
|---|---|
void |
consumeLine(java.lang.String line) |
java.util.List<ScmFile> |
getChangedFiles() |
private boolean |
isFile(java.lang.String file) |
protected static java.lang.String |
resolvePath(java.lang.String fileEntry,
java.net.URI path) |
static java.net.URI |
resolveURI(java.lang.String fileEntry,
java.net.URI path) |
private static java.lang.String |
stripQuotes(java.lang.String str) |
private static java.lang.String |
unescape(java.lang.String fileEntry)
Dequote a quoted string generated by git status --porcelain.
|
static java.net.URI |
uriFromPath(java.lang.String path)
Create an URI whose getPath() returns the given path and getScheme() returns null.
|
private static final java.util.regex.Pattern ADDED_PATTERN
private static final java.util.regex.Pattern MODIFIED_PATTERN
private static final java.util.regex.Pattern DELETED_PATTERN
private static final java.util.regex.Pattern RENAMED_PATTERN
private ScmLogger logger
private java.io.File workingDirectory
private java.util.List<ScmFile> changedFiles
private java.net.URI relativeRepositoryPath
public GitStatusConsumer(ScmLogger logger, java.io.File workingDirectory)
logger - the loggerworkingDirectory - the working directorypublic GitStatusConsumer(ScmLogger logger, java.io.File workingDirectory, java.net.URI relativeRepositoryPath)
relativeRepositoryPath
URI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
logger - the loggerworkingDirectory - the working directoryrelativeRepositoryPath - the working directory relative to the repository rootGitStatusCommand.createRevparseShowPrefix(org.apache.maven.scm.ScmFileSet)public void consumeLine(java.lang.String line)
consumeLine in interface org.codehaus.plexus.util.cli.StreamConsumerprivate boolean isFile(java.lang.String file)
protected static java.lang.String resolvePath(java.lang.String fileEntry,
java.net.URI path)
public static java.net.URI resolveURI(java.lang.String fileEntry,
java.net.URI path)
fileEntry - the fileEntry, must not be nullpath - the path, must not be nullpublic static java.net.URI uriFromPath(java.lang.String path)
path - the path.public java.util.List<ScmFile> getChangedFiles()
private static java.lang.String stripQuotes(java.lang.String str)
str - the (potentially quoted) string, must not be nullprivate static java.lang.String unescape(java.lang.String fileEntry)
fileEntry -