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 Details

    • ADDED_PATTERN

      private static final Pattern ADDED_PATTERN
      The pattern used to match added file lines
    • MODIFIED_PATTERN

      private static final Pattern MODIFIED_PATTERN
      The pattern used to match modified file lines
    • DELETED_PATTERN

      private static final Pattern DELETED_PATTERN
      The pattern used to match deleted file lines
    • RENAMED_PATTERN

      private static final Pattern RENAMED_PATTERN
      The pattern used to match renamed file lines
    • logger

      private ScmLogger logger
    • workingDirectory

      private File workingDirectory
    • scmFileSet

      private ScmFileSet scmFileSet
    • changedFiles

      private List<ScmFile> changedFiles
      Entries are relative to working directory, not to the repositoryroot
    • relativeRepositoryPath

      private URI relativeRepositoryPath
  • Constructor Details

    • GitStatusConsumer

      public GitStatusConsumer(ScmLogger logger, File workingDirectory)
      Consumer when workingDirectory and repositoryRootDirectory are the same
      Parameters:
      logger - the logger
      workingDirectory - the working directory
    • GitStatusConsumer

      public GitStatusConsumer(ScmLogger logger, File workingDirectory, URI relativeRepositoryPath)
      Assuming that you have to discover the repositoryRoot, this is how you can get the relativeRepositoryPath
       URI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
       
      Parameters:
      logger - the logger
      workingDirectory - the working directory
      relativeRepositoryPath - the working directory relative to the repository root
      Since:
      1.9
      See Also:
    • GitStatusConsumer

      public GitStatusConsumer(ScmLogger logger, File workingDirectory, ScmFileSet scmFileSet)
      Assuming that you have to discover the repositoryRoot, this is how you can get the relativeRepositoryPath
       URI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
       
      Parameters:
      logger - the logger
      workingDirectory - the working directory
      scmFileSet - 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 the relativeRepositoryPath
       URI.create( repositoryRoot ).relativize( fileSet.getBasedir().toURI() )
       
      Parameters:
      logger - the logger
      workingDirectory - the working directory
      relativeRepositoryPath - the working directory relative to the repository root
      scmFileSet - fileset with includes and excludes
      Since:
      1.11.0
      See Also:
      • GitStatusCommand#createRevparseShowToplevelCommand(org.apache.maven.scm.ScmFileSet)
  • Method Details

    • consumeLine

      public void consumeLine(String line)
      Specified by:
      consumeLine in interface org.codehaus.plexus.util.cli.StreamConsumer
    • isFileNameInFileList

      private boolean isFileNameInFileList(List<File> fileList, String fileName)
    • isFile

      private boolean isFile(String file)
    • resolvePath

      protected static String resolvePath(String fileEntry, URI path)
    • resolveURI

      public static URI resolveURI(String fileEntry, URI path)
      Parameters:
      fileEntry - the fileEntry, must not be null
      path - the path, must not be null
      Returns:
    • uriFromPath

      public static URI uriFromPath(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 List<ScmFile> getChangedFiles()
    • stripQuotes

      private static String stripQuotes(String str)
      Parameters:
      str - the (potentially quoted) string, must not be null
      Returns:
      the string with a pair of double quotes removed (if they existed)
    • unescape

      private static String unescape(String fileEntry)
      Dequote a quoted string generated by git status --porcelain. The leading and trailing quotes have already been removed.
      Parameters:
      fileEntry -
      Returns: