org.eclipse.jgit.submodule
Class SubmoduleWalk

java.lang.Object
  extended by org.eclipse.jgit.submodule.SubmoduleWalk

public class SubmoduleWalk
extends Object

Walker that visits all submodule entries found in a tree


Constructor Summary
SubmoduleWalk(Repository repository)
          Create submodule generator
 
Method Summary
static SubmoduleWalk forIndex(Repository repository)
          Create a generator to walk over the submodule entries currently in the index
static SubmoduleWalk forPath(Repository repository, AbstractTreeIterator iterator, String path)
          Create a generator and advance it to the submodule entry at the given path
static SubmoduleWalk forPath(Repository repository, AnyObjectId treeId, String path)
          Create a generator and advance it to the submodule entry at the given path
 String getConfigUpdate()
          Get the configured update field for current entry.
 String getConfigUrl()
          Get the configured remote URL for current entry.
 File getDirectory()
          Get directory that will be the root of the submodule's local repository
 File getGitDirectory()
          Get the .git directory for the current submodule entry
 ObjectId getHead()
          Get commit id that HEAD points to in the current submodule's repository
 String getHeadRef()
          Get ref that HEAD points to in the current submodule's repository
 String getModulesPath()
          Get the configured path for current entry.
 String getModulesUpdate()
          Get the configured update field for current entry.
 String getModulesUrl()
          Get the configured remote URL for current entry.
 ObjectId getObjectId()
          Get object id of current submodule entry
 String getPath()
          Get path of current submodule entry
 Repository getRepository()
          Get repository for current submodule entry
static File getSubmoduleDirectory(Repository parent, String path)
          Get submodule directory
static File getSubmoduleGitDirectory(Repository parent, String path)
          Get the .git directory for a repository submodule path
static Repository getSubmoduleRepository(Repository parent, String path)
          Get submodule repository
 boolean hasGitDirectory()
          Does the current submodule entry have a .git directory in the parent repository's working tree?
 boolean next()
          Advance to next submodule in the index tree.
 SubmoduleWalk reset()
          Reset generator and start new submodule walk
 SubmoduleWalk setFilter(TreeFilter filter)
          Set tree filter
 SubmoduleWalk setTree(AbstractTreeIterator iterator)
          Set the tree iterator used for finding submodule entries
 SubmoduleWalk setTree(AnyObjectId treeId)
          Set the tree used for finding submodule entries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubmoduleWalk

public SubmoduleWalk(Repository repository)
              throws IOException
Create submodule generator

Parameters:
repository -
Throws:
IOException
Method Detail

forIndex

public static SubmoduleWalk forIndex(Repository repository)
                              throws IOException
Create a generator to walk over the submodule entries currently in the index

Parameters:
repository -
Returns:
generator over submodule index entries
Throws:
IOException

forPath

public static SubmoduleWalk forPath(Repository repository,
                                    AnyObjectId treeId,
                                    String path)
                             throws IOException
Create a generator and advance it to the submodule entry at the given path

Parameters:
repository -
treeId -
path -
Returns:
generator at given path, null if no submodule at given path
Throws:
IOException

forPath

public static SubmoduleWalk forPath(Repository repository,
                                    AbstractTreeIterator iterator,
                                    String path)
                             throws IOException
Create a generator and advance it to the submodule entry at the given path

Parameters:
repository -
iterator -
path -
Returns:
generator at given path, null if no submodule at given path
Throws:
IOException

getSubmoduleDirectory

public static File getSubmoduleDirectory(Repository parent,
                                         String path)
Get submodule directory

Parameters:
parent -
path -
Returns:
directory

getSubmoduleRepository

public static Repository getSubmoduleRepository(Repository parent,
                                                String path)
                                         throws IOException
Get submodule repository

Parameters:
parent -
path -
Returns:
repository or null if repository doesn't exist
Throws:
IOException

getSubmoduleGitDirectory

public static File getSubmoduleGitDirectory(Repository parent,
                                            String path)
Get the .git directory for a repository submodule path

Parameters:
parent -
path -
Returns:
.git for submodule repository

setFilter

public SubmoduleWalk setFilter(TreeFilter filter)
Set tree filter

Parameters:
filter -
Returns:
this generator

setTree

public SubmoduleWalk setTree(AbstractTreeIterator iterator)
                      throws CorruptObjectException
Set the tree iterator used for finding submodule entries

Parameters:
iterator -
Returns:
this generator
Throws:
CorruptObjectException

setTree

public SubmoduleWalk setTree(AnyObjectId treeId)
                      throws IOException
Set the tree used for finding submodule entries

Parameters:
treeId -
Returns:
this generator
Throws:
IOException
IncorrectObjectTypeException
MissingObjectException

reset

public SubmoduleWalk reset()
Reset generator and start new submodule walk

Returns:
this generator

getDirectory

public File getDirectory()
Get directory that will be the root of the submodule's local repository

Returns:
submodule repository directory

getGitDirectory

public File getGitDirectory()
Get the .git directory for the current submodule entry

Returns:
.git for submodule repository

next

public boolean next()
             throws IOException
Advance to next submodule in the index tree. The object id and path of the next entry can be obtained by calling getObjectId() and getPath().

Returns:
true if entry found, false otherwise
Throws:
IOException

getPath

public String getPath()
Get path of current submodule entry

Returns:
path

getObjectId

public ObjectId getObjectId()
Get object id of current submodule entry

Returns:
object id

getModulesPath

public String getModulesPath()
                      throws IOException,
                             ConfigInvalidException
Get the configured path for current entry. This will be the value from the .gitmodules file in the current repository's working tree.

Returns:
configured path
Throws:
ConfigInvalidException
IOException

getConfigUrl

public String getConfigUrl()
                    throws IOException,
                           ConfigInvalidException
Get the configured remote URL for current entry. This will be the value from the repository's config.

Returns:
configured URL
Throws:
ConfigInvalidException
IOException

getModulesUrl

public String getModulesUrl()
                     throws IOException,
                            ConfigInvalidException
Get the configured remote URL for current entry. This will be the value from the .gitmodules file in the current repository's working tree.

Returns:
configured URL
Throws:
ConfigInvalidException
IOException

getConfigUpdate

public String getConfigUpdate()
                       throws IOException,
                              ConfigInvalidException
Get the configured update field for current entry. This will be the value from the repository's config.

Returns:
update value
Throws:
ConfigInvalidException
IOException

getModulesUpdate

public String getModulesUpdate()
                        throws IOException,
                               ConfigInvalidException
Get the configured update field for current entry. This will be the value from the .gitmodules file in the current repository's working tree.

Returns:
update value
Throws:
ConfigInvalidException
IOException

hasGitDirectory

public boolean hasGitDirectory()
Does the current submodule entry have a .git directory in the parent repository's working tree?

Returns:
true if .git directory exists, false otherwise

getRepository

public Repository getRepository()
                         throws IOException
Get repository for current submodule entry

Returns:
repository or null if non-existent
Throws:
IOException
See Also:
hasGitDirectory()

getHead

public ObjectId getHead()
                 throws IOException
Get commit id that HEAD points to in the current submodule's repository

Returns:
object id of HEAD reference
Throws:
IOException

getHeadRef

public String getHeadRef()
                  throws IOException
Get ref that HEAD points to in the current submodule's repository

Returns:
ref name, null on failures
Throws:
IOException


Copyright © 2011. All Rights Reserved.