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 Object
implements org.codehaus.plexus.util.cli.StreamConsumer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Pattern
The pattern used to match added file linesEntries are relative to working directory, not to the repositoryrootprivate static final Pattern
The pattern used to match deleted file linesprivate ScmLogger
private static final Pattern
The pattern used to match modified file linesprivate URI
private static final Pattern
The pattern used to match renamed file linesprivate ScmFileSet
private File
-
Constructor Summary
ConstructorsConstructorDescriptionGitStatusConsumer
(ScmLogger logger, File workingDirectory) Consumer when workingDirectory and repositoryRootDirectory are the sameGitStatusConsumer
(ScmLogger logger, File workingDirectory, URI relativeRepositoryPath) Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPath
GitStatusConsumer
(ScmLogger logger, File workingDirectory, URI relativeRepositoryPath, ScmFileSet scmFileSet) Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPath
GitStatusConsumer
(ScmLogger logger, File workingDirectory, ScmFileSet scmFileSet) Assuming that you have to discover the repositoryRoot, this is how you can get therelativeRepositoryPath
-
Method Summary
Modifier and TypeMethodDescriptionvoid
consumeLine
(String line) private boolean
private boolean
isFileNameInFileList
(List<File> fileList, String fileName) protected static String
resolvePath
(String fileEntry, URI path) static URI
resolveURI
(String fileEntry, URI path) private static String
stripQuotes
(String str) private static String
Dequote a quoted string generated by git status --porcelain.static URI
uriFromPath
(String path) Create an URI whose getPath() returns the given path and getScheme() returns null.
-
Field Details
-
ADDED_PATTERN
The pattern used to match added file lines -
MODIFIED_PATTERN
The pattern used to match modified file lines -
DELETED_PATTERN
The pattern used to match deleted file lines -
RENAMED_PATTERN
The pattern used to match renamed file lines -
logger
-
workingDirectory
-
scmFileSet
-
changedFiles
Entries are relative to working directory, not to the repositoryroot -
relativeRepositoryPath
-
-
Constructor Details
-
GitStatusConsumer
Consumer when workingDirectory and repositoryRootDirectory are the same- Parameters:
logger
- the loggerworkingDirectory
- the working directory
-
GitStatusConsumer
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:
-
GitStatusConsumer
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 directoryscmFileSet
- fileset with includes and excludes- Since:
- 1.11.0
- See Also:
-
GitStatusCommand#createRevparseShowToplevelCommand(org.apache.maven.scm.ScmFileSet)
-
GitStatusConsumer
public GitStatusConsumer(ScmLogger logger, File workingDirectory, URI relativeRepositoryPath, ScmFileSet scmFileSet) 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 rootscmFileSet
- fileset with includes and excludes- Since:
- 1.11.0
- See Also:
-
GitStatusCommand#createRevparseShowToplevelCommand(org.apache.maven.scm.ScmFileSet)
-
-
Method Details
-
consumeLine
- Specified by:
consumeLine
in interfaceorg.codehaus.plexus.util.cli.StreamConsumer
-
isFileNameInFileList
-
isFile
-
resolvePath
-
resolveURI
- Parameters:
fileEntry
- the fileEntry, must not benull
path
- the path, must not benull
- Returns:
-
uriFromPath
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
-
stripQuotes
- Parameters:
str
- the (potentially quoted) string, must not benull
- Returns:
- the string with a pair of double quotes removed (if they existed)
-
unescape
Dequote a quoted string generated by git status --porcelain. The leading and trailing quotes have already been removed.- Parameters:
fileEntry
-- Returns:
-