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
    • Field Detail

      • COMMIT_TIME_SLOP

        private static final int COMMIT_TIME_SLOP
        Amount of slop to allow walking past the earliest requested commit.
        See Also:
        Constant Field Values
      • MERGE_COST

        private static final int MERGE_COST
        Cost of traversing a merge commit compared to a linear history.
        See Also:
        Constant Field Values
      • prefixes

        private final java.util.List<java.lang.String> prefixes
      • revs

        private final java.util.List<ObjectId> revs
      • refs

        private java.util.List<Ref> refs
      • mergeCost

        private int mergeCost
    • Constructor Detail

      • NameRevCommand

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

      • 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; the prefix must end with a slash
        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
      • addPrefixes

        private void addPrefixes​(java.util.Map<ObjectId,​java.lang.String> nonCommits,
                                 FIFORevQueue pending)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • addPrefix

        private void addPrefix​(java.lang.String prefix,
                               java.util.Map<ObjectId,​java.lang.String> nonCommits,
                               FIFORevQueue pending)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • addRef

        private void addRef​(Ref ref,
                            java.util.Map<ObjectId,​java.lang.String> nonCommits,
                            FIFORevQueue pending)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • minCommitTime

        private int minCommitTime()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • compare

        private long compare​(java.lang.String leftTip,
                             long leftCost,
                             java.lang.String rightTip,
                             long rightCost)
      • simplify

        private static java.lang.String simplify​(java.lang.String refName)