Class GitStatusConsumer
- java.lang.Object
-
- org.apache.maven.scm.util.AbstractConsumer
-
- org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer
-
- All Implemented Interfaces:
org.codehaus.plexus.util.cli.StreamConsumer
public class GitStatusConsumer extends AbstractConsumer
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatternADDED_PATTERNThe pattern used to match added file lines.private java.util.List<ScmFile>changedFilesEntries are relative to working directory, not to the repositoryroot.private static java.util.regex.PatternDELETED_PATTERNThe pattern used to match deleted file lines.private static java.util.regex.PatternMODIFIED_PATTERNThe pattern used to match modified file lines.private java.net.URIrelativeRepositoryPathprivate static java.util.regex.PatternRENAMED_PATTERNThe pattern used to match renamed file lines.private ScmFileSetscmFileSetprivate java.io.FileworkingDirectory-
Fields inherited from class org.apache.maven.scm.util.AbstractConsumer
logger
-
-
Constructor Summary
Constructors Constructor Description GitStatusConsumer(java.io.File workingDirectory)Consumer when workingDirectory and repositoryRootDirectory are the same.GitStatusConsumer(java.io.File workingDirectory, java.net.URI relativeRepositoryPath)Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPathGitStatusConsumer(java.io.File workingDirectory, java.net.URI relativeRepositoryPath, ScmFileSet scmFileSet)Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPathGitStatusConsumer(java.io.File workingDirectory, ScmFileSet scmFileSet)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 voidconsumeLine(java.lang.String line)java.util.List<ScmFile>getChangedFiles()private booleanisFile(java.lang.String file)private booleanisFileNameInFileList(java.util.List<java.io.File> fileList, java.lang.String fileName)static java.lang.StringresolvePath(java.lang.String fileEntry, java.net.URI path)static java.net.URIresolveURI(java.lang.String fileEntry, java.net.URI path)private static java.lang.StringstripQuotes(java.lang.String str)private static java.lang.Stringunescape(java.lang.String fileEntry)Dequote a quoted string generated by git status --porcelain.static java.net.URIuriFromPath(java.lang.String path)Create an URI whose getPath() returns the given path and getScheme() returns null.-
Methods inherited from class org.apache.maven.scm.util.AbstractConsumer
parseDate, parseDate
-
-
-
-
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.
-
workingDirectory
private final java.io.File workingDirectory
-
scmFileSet
private ScmFileSet scmFileSet
-
changedFiles
private final 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(java.io.File workingDirectory)
Consumer when workingDirectory and repositoryRootDirectory are the same.- Parameters:
workingDirectory- the working directory
-
GitStatusConsumer
public GitStatusConsumer(java.io.File workingDirectory, java.net.URI relativeRepositoryPath)Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPathURI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
- Parameters:
workingDirectory- the working directoryrelativeRepositoryPath- the working directory relative to the repository root- Since:
- 1.9
- See Also:
GitStatusCommand.createRevparseShowPrefix(ScmFileSet)
-
GitStatusConsumer
public GitStatusConsumer(java.io.File workingDirectory, ScmFileSet scmFileSet)Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPathURI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
- Parameters:
workingDirectory- the working directoryscmFileSet- fileset with includes and excludes- Since:
- 1.11.0
- See Also:
GitStatusCommand.createRevparseShowPrefix(ScmFileSet)
-
GitStatusConsumer
public GitStatusConsumer(java.io.File workingDirectory, java.net.URI relativeRepositoryPath, ScmFileSet scmFileSet)Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPathURI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
- Parameters:
workingDirectory- the working directoryrelativeRepositoryPath- the working directory relative to the repository rootscmFileSet- fileset with includes and excludes- Since:
- 1.11.0
- See Also:
GitStatusCommand.createRevparseShowPrefix(ScmFileSet)
-
-
Method Detail
-
consumeLine
public void consumeLine(java.lang.String line)
-
isFileNameInFileList
private boolean isFileNameInFileList(java.util.List<java.io.File> fileList, java.lang.String fileName)
-
isFile
private boolean isFile(java.lang.String file)
-
resolvePath
public 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 benullpath- the path, must not benull- Returns:
- TODO
-
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:
- TODO
-
-