Class NameRevCommand

  • All Implemented Interfaces:
    java.util.concurrent.Callable<java.util.Map<ObjectId,​java.lang.String>>

    public class NameRevCommand
    extends GitCommand<java.util.Map<ObjectId,​java.lang.String>>
    Command to find human-readable names of revisions.
    Since:
    3.0
    See Also:
    Git documentation about name-rev
    • Constructor Detail

      • NameRevCommand

        protected NameRevCommand​(Repository repo)
        Create a new name-rev command.
        Parameters:
        repo -
    • Method Detail

      • call

        public java.util.Map<ObjectId,​java.lang.String> call()
                                                            throws GitAPIException
        Description copied from class: GitCommand
        Executes the command
        Specified by:
        call in interface java.util.concurrent.Callable<java.util.Map<ObjectId,​java.lang.String>>
        Specified by:
        call in class GitCommand<java.util.Map<ObjectId,​java.lang.String>>
        Returns:
        T a result. Each command has its own return type
        Throws:
        GitAPIException - or subclass thereof when an error occurs
      • addPrefix

        public NameRevCommand addPrefix​(java.lang.String prefix)
        Add a ref prefix to the set that results must match.

        If an object matches multiple refs equally well, the first matching ref added with addRef(Ref) is preferred, or else the first matching prefix added by addPrefix(String).

        Parameters:
        prefix - prefix to add; see RefDatabase.getRefs(String)
        Returns:
        this
      • addAnnotatedTags

        public NameRevCommand addAnnotatedTags()
        Add all annotated tags under refs/tags/ to the set that all results must match.

        Calls addRef(Ref); see that method for a note on matching priority.

        Returns:
        this
        Throws:
        JGitInternalException - a low-level exception of JGit has occurred. The original exception can be retrieved by calling Throwable.getCause().
      • addRef

        public NameRevCommand addRef​(Ref ref)
        Add a ref to the set that all results must match.

        If an object matches multiple refs equally well, the first matching ref added with addRef(Ref) is preferred, or else the first matching prefix added by addPrefix(String).

        Parameters:
        ref - ref to add.
        Returns:
        this