hudson.plugins.git
Class GitAPI

java.lang.Object
  extended by hudson.plugins.git.GitAPI
All Implemented Interfaces:
IGitAPI

public class GitAPI
extends java.lang.Object
implements IGitAPI


Constructor Summary
GitAPI(java.lang.String gitExe, hudson.FilePath workspace, hudson.model.TaskListener listener, hudson.EnvVars environment)
           
 
Method Summary
 void add(java.lang.String filePattern)
           
 void branch(java.lang.String name)
           
 void changelog(java.lang.String revFrom, java.lang.String revTo, java.io.OutputStream outputStream)
           
 void checkout(java.lang.String ref)
           
 void clean()
           
 void clone(org.spearce.jgit.transport.RemoteConfig remoteConfig)
          Start from scratch and clone the whole repository.
 void commit(java.io.File f)
           
 void deleteTag(java.lang.String tagName)
           
 java.lang.String describe(java.lang.String commitIsh)
           
 void fetch()
           
 void fetch(org.spearce.jgit.transport.RemoteConfig remoteRepository)
           
 void fetch(java.lang.String repository, java.lang.String refspec)
           
 java.lang.String getAllLogEntries(java.lang.String branch)
           
 java.util.List<Branch> getBranches()
           
 java.util.List<Branch> getBranchesContaining(java.lang.String revspec)
           
 hudson.EnvVars getEnvironment()
           
 java.lang.String getGitExe()
           
 java.util.List<Branch> getRemoteBranches()
           
 java.util.Set<java.lang.String> getTagNames(java.lang.String tagPattern)
           
 java.util.List<org.spearce.jgit.lib.Tag> getTagsOnCommit(java.lang.String revName)
           
 boolean hasGitModules()
           
 boolean hasGitRepo()
           
 void init()
           
 java.lang.String launchCommand(hudson.util.ArgumentListBuilder args)
          Launch command using the workspace as working directory
 java.lang.String launchCommand(java.lang.String... args)
          Launch command using the workspace as working directory
 java.util.List<IndexEntry> lsTree(java.lang.String treeIsh)
           
 void merge(java.lang.String revSpec)
          Merge any changes into the head.
 org.spearce.jgit.lib.ObjectId mergeBase(org.spearce.jgit.lib.ObjectId id1, org.spearce.jgit.lib.ObjectId id2)
           
 void push(org.spearce.jgit.transport.RemoteConfig repository, java.lang.String refspec)
           
 java.util.List<org.spearce.jgit.lib.ObjectId> revList(java.lang.String... extraArgs)
           
 java.util.List<org.spearce.jgit.lib.ObjectId> revListAll()
           
 java.util.List<org.spearce.jgit.lib.ObjectId> revListBranch(java.lang.String branchId)
           
 org.spearce.jgit.lib.ObjectId revParse(java.lang.String revName)
           
 void submoduleInit()
          Init submodules.
 void submoduleSync()
          Sync submodule URLs
 void submoduleUpdate()
          Update submodules.
 void tag(java.lang.String tagName, java.lang.String comment)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GitAPI

public GitAPI(java.lang.String gitExe,
              hudson.FilePath workspace,
              hudson.model.TaskListener listener,
              hudson.EnvVars environment)
Method Detail

getGitExe

public java.lang.String getGitExe()
Specified by:
getGitExe in interface IGitAPI

getEnvironment

public hudson.EnvVars getEnvironment()
Specified by:
getEnvironment in interface IGitAPI

init

public void init()
          throws GitException
Specified by:
init in interface IGitAPI
Throws:
GitException

hasGitRepo

public boolean hasGitRepo()
                   throws GitException
Specified by:
hasGitRepo in interface IGitAPI
Throws:
GitException

hasGitModules

public boolean hasGitModules()
                      throws GitException
Specified by:
hasGitModules in interface IGitAPI
Throws:
GitException

fetch

public void fetch(java.lang.String repository,
                  java.lang.String refspec)
           throws GitException
Specified by:
fetch in interface IGitAPI
Throws:
GitException

fetch

public void fetch()
           throws GitException
Specified by:
fetch in interface IGitAPI
Throws:
GitException

clone

public void clone(org.spearce.jgit.transport.RemoteConfig remoteConfig)
           throws GitException
Start from scratch and clone the whole repository. Cloning into an existing directory is not allowed, so the workspace is first deleted entirely, then git clone is performed.

Specified by:
clone in interface IGitAPI
Parameters:
remoteConfig - remote config
Throws:
GitException - if deleting or cloning the workspace fails

clean

public void clean()
           throws GitException
Specified by:
clean in interface IGitAPI
Throws:
GitException

revParse

public org.spearce.jgit.lib.ObjectId revParse(java.lang.String revName)
                                       throws GitException
Specified by:
revParse in interface IGitAPI
Throws:
GitException

describe

public java.lang.String describe(java.lang.String commitIsh)
                          throws GitException
Specified by:
describe in interface IGitAPI
Throws:
GitException

changelog

public void changelog(java.lang.String revFrom,
                      java.lang.String revTo,
                      java.io.OutputStream outputStream)
               throws GitException
Specified by:
changelog in interface IGitAPI
Throws:
GitException

merge

public void merge(java.lang.String revSpec)
           throws GitException
Merge any changes into the head.

Specified by:
merge in interface IGitAPI
Parameters:
revSpec - the revision
Throws:
GitException - if the emrge fails

submoduleInit

public void submoduleInit()
                   throws GitException
Init submodules.

Specified by:
submoduleInit in interface IGitAPI
Throws:
GitException - if executing the Git command fails

submoduleSync

public void submoduleSync()
                   throws GitException
Sync submodule URLs

Specified by:
submoduleSync in interface IGitAPI
Throws:
GitException

submoduleUpdate

public void submoduleUpdate()
                     throws GitException
Update submodules.

Specified by:
submoduleUpdate in interface IGitAPI
Throws:
GitException - if executing the Git command fails

tag

public void tag(java.lang.String tagName,
                java.lang.String comment)
         throws GitException
Specified by:
tag in interface IGitAPI
Throws:
GitException

launchCommand

public java.lang.String launchCommand(hudson.util.ArgumentListBuilder args)
                               throws GitException
Launch command using the workspace as working directory

Parameters:
args -
Returns:
command output
Throws:
GitException

launchCommand

public java.lang.String launchCommand(java.lang.String... args)
                               throws GitException
Launch command using the workspace as working directory

Parameters:
args -
Returns:
command output
Throws:
GitException

push

public void push(org.spearce.jgit.transport.RemoteConfig repository,
                 java.lang.String refspec)
          throws GitException
Specified by:
push in interface IGitAPI
Throws:
GitException

getBranches

public java.util.List<Branch> getBranches()
                                   throws GitException
Specified by:
getBranches in interface IGitAPI
Throws:
GitException

getRemoteBranches

public java.util.List<Branch> getRemoteBranches()
                                         throws GitException,
                                                java.io.IOException
Specified by:
getRemoteBranches in interface IGitAPI
Throws:
GitException
java.io.IOException

getBranchesContaining

public java.util.List<Branch> getBranchesContaining(java.lang.String revspec)
                                             throws GitException
Specified by:
getBranchesContaining in interface IGitAPI
Throws:
GitException

checkout

public void checkout(java.lang.String ref)
              throws GitException
Specified by:
checkout in interface IGitAPI
Throws:
GitException

deleteTag

public void deleteTag(java.lang.String tagName)
               throws GitException
Specified by:
deleteTag in interface IGitAPI
Throws:
GitException

lsTree

public java.util.List<IndexEntry> lsTree(java.lang.String treeIsh)
                                  throws GitException
Specified by:
lsTree in interface IGitAPI
Throws:
GitException

revListAll

public java.util.List<org.spearce.jgit.lib.ObjectId> revListAll()
                                                         throws GitException
Specified by:
revListAll in interface IGitAPI
Throws:
GitException

revListBranch

public java.util.List<org.spearce.jgit.lib.ObjectId> revListBranch(java.lang.String branchId)
                                                            throws GitException
Specified by:
revListBranch in interface IGitAPI
Throws:
GitException

revList

public java.util.List<org.spearce.jgit.lib.ObjectId> revList(java.lang.String... extraArgs)
                                                      throws GitException
Throws:
GitException

add

public void add(java.lang.String filePattern)
         throws GitException
Specified by:
add in interface IGitAPI
Throws:
GitException

branch

public void branch(java.lang.String name)
            throws GitException
Specified by:
branch in interface IGitAPI
Throws:
GitException

commit

public void commit(java.io.File f)
            throws GitException
Specified by:
commit in interface IGitAPI
Throws:
GitException

fetch

public void fetch(org.spearce.jgit.transport.RemoteConfig remoteRepository)
           throws GitException
Specified by:
fetch in interface IGitAPI
Throws:
GitException

mergeBase

public org.spearce.jgit.lib.ObjectId mergeBase(org.spearce.jgit.lib.ObjectId id1,
                                               org.spearce.jgit.lib.ObjectId id2)
Specified by:
mergeBase in interface IGitAPI

getAllLogEntries

public java.lang.String getAllLogEntries(java.lang.String branch)
Specified by:
getAllLogEntries in interface IGitAPI

getTagsOnCommit

public java.util.List<org.spearce.jgit.lib.Tag> getTagsOnCommit(java.lang.String revName)
                                                         throws GitException,
                                                                java.io.IOException
Specified by:
getTagsOnCommit in interface IGitAPI
Throws:
GitException
java.io.IOException

getTagNames

public java.util.Set<java.lang.String> getTagNames(java.lang.String tagPattern)
                                            throws GitException
Specified by:
getTagNames in interface IGitAPI
Throws:
GitException


Copyright © 2010. All Rights Reserved.