Class GitStatusConsumer
- java.lang.Object
-
- org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer
-
- All Implemented Interfaces:
org.codehaus.plexus.util.cli.StreamConsumer
public class GitStatusConsumer extends java.lang.Object implements org.codehaus.plexus.util.cli.StreamConsumer
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.Pattern
ADDED_PATTERN
The pattern used to match added file linesprivate java.util.List<ScmFile>
changedFiles
Entries are relative to working directory, not to the repositoryrootprivate static java.util.regex.Pattern
DELETED_PATTERN
The pattern used to match deleted file linesprivate ScmLogger
logger
private static java.util.regex.Pattern
MODIFIED_PATTERN
The pattern used to match modified file linesprivate java.net.URI
relativeRepositoryPath
private static java.util.regex.Pattern
RENAMED_PATTERN
The pattern used to match renamed file linesprivate java.io.File
workingDirectory
-
Constructor Summary
Constructors Constructor Description GitStatusConsumer(ScmLogger logger, java.io.File workingDirectory)
Consumer when workingDirectory and repositoryRootDirectory are the sameGitStatusConsumer(ScmLogger logger, java.io.File workingDirectory, java.net.URI relativeRepositoryPath)
Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPath
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
ADDED_PATTERN
private static final java.util.regex.Pattern ADDED_PATTERN
The pattern used to match added file lines
-
MODIFIED_PATTERN
private static final java.util.regex.Pattern MODIFIED_PATTERN
The pattern used to match modified file lines
-
DELETED_PATTERN
private static final java.util.regex.Pattern DELETED_PATTERN
The pattern used to match deleted file lines
-
RENAMED_PATTERN
private static final java.util.regex.Pattern RENAMED_PATTERN
The pattern used to match renamed file lines
-
logger
private ScmLogger logger
-
workingDirectory
private java.io.File workingDirectory
-
changedFiles
private java.util.List<ScmFile> changedFiles
Entries are relative to working directory, not to the repositoryroot
-
relativeRepositoryPath
private java.net.URI relativeRepositoryPath
-
-
Constructor Detail
-
GitStatusConsumer
public GitStatusConsumer(ScmLogger logger, java.io.File workingDirectory)
Consumer when workingDirectory and repositoryRootDirectory are the same- Parameters:
logger
- the loggerworkingDirectory
- the working directory
-
GitStatusConsumer
public 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 therelativeRepositoryPath
URI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
- Parameters:
logger
- the loggerworkingDirectory
- the working directoryrelativeRepositoryPath
- the working directory relative to the repository root- Since:
- 1.9
- See Also:
GitStatusCommand.createRevparseShowPrefix(org.apache.maven.scm.ScmFileSet)
-
-
Method Detail
-
consumeLine
public void consumeLine(java.lang.String line)
- Specified by:
consumeLine
in interfaceorg.codehaus.plexus.util.cli.StreamConsumer
-
isFile
private boolean isFile(java.lang.String file)
-
resolvePath
protected static java.lang.String resolvePath(java.lang.String fileEntry, java.net.URI path)
-
resolveURI
public static java.net.URI resolveURI(java.lang.String fileEntry, java.net.URI path)
- Parameters:
fileEntry
- the fileEntry, must not benull
path
- the path, must not benull
- Returns:
-
uriFromPath
public static java.net.URI uriFromPath(java.lang.String path)
Create an URI whose getPath() returns the given path and getScheme() returns null. The path may contain spaces, colons, and other special characters.- Parameters:
path
- the path.- Returns:
- the new URI
-
getChangedFiles
public java.util.List<ScmFile> getChangedFiles()
-
stripQuotes
private static java.lang.String stripQuotes(java.lang.String str)
- Parameters:
str
- the (potentially quoted) string, must not benull
- Returns:
- the string with a pair of double quotes removed (if they existed)
-
unescape
private static java.lang.String unescape(java.lang.String fileEntry)
Dequote a quoted string generated by git status --porcelain. The leading and trailing quotes have already been removed.- Parameters:
fileEntry
-- Returns:
-
-