Class ConnectionHelper

    • Method Detail

      • getDirs

        public List<com.perforce.p4java.core.file.IFileSpec> getDirs​(List<String> paths)
                                                              throws Exception
        Gets a list of Dirs given a path (multi-branch?)
        Parameters:
        paths - list of paths to look for dirs (only takes * as wildcard)
        Returns:
        list of dirs or empty list
        Throws:
        Exception - push up stack
      • getStreams

        public List<com.perforce.p4java.core.IStreamSummary> getStreams​(List<String> paths)
                                                                 throws Exception
        Gets a list of Dirs given a path (multi-stream?)
        Parameters:
        paths - list of path to look for streams (takes ... or * as wildcard)
        Returns:
        list of streams or empty list
        Throws:
        Exception - push up stack
      • getChangeSummary

        public com.perforce.p4java.core.IChangelistSummary getChangeSummary​(long id)
                                                                     throws com.perforce.p4java.exception.P4JavaException
        Throws:
        com.perforce.p4java.exception.P4JavaException
      • getJobs

        public List<com.perforce.p4java.core.IFix> getJobs​(int id)
                                                    throws com.perforce.p4java.exception.P4JavaException
        Throws:
        com.perforce.p4java.exception.P4JavaException
      • isCounter

        public boolean isCounter​(String name)
                          throws Exception
        Test if given name is a counter
        Parameters:
        name - Couner name
        Returns:
        true if counter
        Throws:
        Exception - push up stack
      • getCounter

        public String getCounter​(String id)
                          throws Exception
        Get Perforce Counter
        Parameters:
        id - Counter name
        Returns:
        Perforce Counter
        Throws:
        Exception - push up stack
      • isLabel

        public boolean isLabel​(String name)
                        throws Exception
        Test if given name is a label
        Parameters:
        name - Label name
        Returns:
        true if label.
        Throws:
        Exception - push up stack
      • labelToChange

        public String labelToChange​(String name)
        Look for a label and return a change or static label.
        Parameters:
        name - label
        Returns:
        change reference or null if no label found.
      • counterToChange

        public String counterToChange​(String name)
        Look for a counter and return a change or reference.
        Parameters:
        name - counter
        Returns:
        change reference or null if no counter found.
      • isClient

        public boolean isClient​(String name)
                         throws Exception
        Test if given name is a client
        Parameters:
        name - Client name
        Returns:
        true if client exists.
        Throws:
        Exception - push up stack
      • deleteClient

        public void deleteClient​(String name)
                          throws Exception
        Delete a client workspace
        Parameters:
        name - Client name
        Throws:
        Exception - push up stack
      • getLabel

        public com.perforce.p4java.impl.generic.core.Label getLabel​(String id)
                                                             throws Exception
        Get Perforce Label
        Parameters:
        id - Label name
        Returns:
        Perforce Label
        Throws:
        Exception - push up stack
      • setLabel

        public void setLabel​(com.perforce.p4java.impl.generic.core.Label label)
                      throws Exception
        Create/Update a Perforce Label
        Parameters:
        label - Label name
        Throws:
        Exception - push up stack
      • getLabelFiles

        public List<com.perforce.p4java.core.file.IFileSpec> getLabelFiles​(String id,
                                                                           int limit)
                                                                    throws Exception
        Find all files within a label or change. (Max results limited by limit)
        Parameters:
        id - Label name or change number (as string)
        limit - Max results (-m value)
        Returns:
        List of file specs
        Throws:
        Exception - push up stack
      • getChangeFiles

        public List<com.perforce.p4java.core.file.IFileSpec> getChangeFiles​(long id,
                                                                            int limit)
                                                                     throws Exception
        Throws:
        Exception
      • getShelvedFiles

        public List<com.perforce.p4java.core.file.IFileSpec> getShelvedFiles​(int id)
                                                                      throws Exception
        Find all files within a shelf.
        Parameters:
        id - Shelf ID
        Returns:
        List of file specs
        Throws:
        Exception - push up stack
      • getSwarm

        public String getSwarm()
                        throws com.perforce.p4java.exception.P4JavaException
        Throws:
        com.perforce.p4java.exception.P4JavaException
      • getHead

        public long getHead​(String path,
                            P4Ref from,
                            P4Ref to)
                     throws Exception
        Get the latest change on the given path
        Parameters:
        path - Perforce depot path //foo/...
        from - From revision (change or label)
        to - To revision (change or label)
        Returns:
        change number
        Throws:
        Exception - push up stack
      • buildRevisionLimit

        protected String buildRevisionLimit​(String path,
                                            P4Ref from,
                                            P4Ref to)
        Build a revision limit spec.
        Parameters:
        path - Perforce depot or client path //foo/...
        from - From revision (change or label)
        to - To revision (change or label)
        Returns:
        a Perforce Revision Spec
      • getLowestHead

        public long getLowestHead​(String path,
                                  P4Ref from,
                                  P4Ref to)
                           throws Exception
        Get the lowest change on the given path
        Parameters:
        path - Perforce depot path //foo/...
        from - revision specifier
        to - revision specifier
        Returns:
        change number
        Throws:
        Exception - push up stack
      • getGraphCommit

        public com.perforce.p4java.graph.ICommit getGraphCommit​(String sha,
                                                                String repo)
                                                         throws com.perforce.p4java.exception.P4JavaException
        Throws:
        com.perforce.p4java.exception.P4JavaException
      • getCommitFiles

        public List<com.perforce.p4java.core.file.IFileSpec> getCommitFiles​(String repo,
                                                                            String sha)
                                                                     throws com.perforce.p4java.exception.P4JavaException
        Throws:
        com.perforce.p4java.exception.P4JavaException
      • getGraphHead

        public P4Ref getGraphHead​(String repo)
        Get the last SHA commited to the specified repo.
        Parameters:
        repo - a graph repo
        Returns:
        a P4Ref of the last commit
      • listCommits

        public List<P4Ref> listCommits​(List<P4Ref> fromRefs,
                                       P4Ref to)
                                throws Exception
        List graph Commits with in range of SHAs
        Parameters:
        fromRefs - Array of potential SHAs (include other repos)
        to - The last SHA to list commits
        Returns:
        a List or Commits
        Throws:
        Exception - push up stack
      • listAllRepos

        public List<com.perforce.p4java.core.IRepo> listAllRepos()
                                                          throws Exception
        List all Graph Repos
        Returns:
        A list of Graph Repos
        Throws:
        Exception - push up stack
      • listRepos

        public List<com.perforce.p4java.core.IRepo> listRepos​(String path)
                                                       throws Exception
        List of Graph Repos based on a path
        Parameters:
        path - Path filter
        Returns:
        A list of Graph Repos
        Throws:
        Exception - push up stack
      • getMaxChangeLimit

        protected int getMaxChangeLimit()
      • getHeadLimit

        public long getHeadLimit()