com.aragost.javahg
Class Repository

java.lang.Object
  extended by com.aragost.javahg.Repository
Direct Known Subclasses:
BaseRepository

public abstract class Repository
extends Object

A Mercurial repository.


Constructor Summary
protected Repository(RepositoryConfiguration.CachePolicy cachePolicy)
           
 
Method Summary
 void addToCommandLine(List<String> commandLine)
          Add repository specific arguments to the hg command line for command execution
protected  Changeset basicChangeset(String node)
           
 Changeset changeset(String node)
          Return a Changeset object for the specified node id.
 Changeset changeSet(String node)
          Deprecated. Use changeset instead.
static BaseRepository clone(File directory, String otherRepoUrl)
          Clone an existing Mercurial repository.
static BaseRepository clone(RepositoryConfiguration conf, File directory, String otherRepoUrl)
          Clone an existing Mercurial repository.
 void close()
          Close the repository.
static BaseRepository create(File directory)
          Create a new Mercurial repository.
static BaseRepository create(RepositoryConfiguration conf, File directory)
          Create a new Mercurial repository and open a javahg Repository on it.
 File file(String name)
          Return a File object for the file name specified in this repository.
abstract  BaseRepository getBaseRepository()
           
 com.google.common.cache.CacheStats getCacheStats()
           
protected  com.google.common.cache.LoadingCache<String,Changeset> getChangesetCache()
           
protected  Changeset getChangesetIfInCache(String node)
           
abstract  File getDirectory()
           
 HgVersion getHgVersion()
           
abstract  ServerPool getServerPool()
           
 List<Changeset> heads()
           
 void lock()
           
abstract  CharsetDecoder newDecoder()
           
static BaseRepository open(File mercurialRepository)
          Open an existing Mercurial repository.
static BaseRepository open(RepositoryConfiguration conf, File mercurialRepository)
          Open an existing Mercurial repository.
 Map<Changeset,Phase> phases(String... revs)
          Return the phases of the specified revisions
 Map<Changeset,Phase> readPhases(String... revs)
          Deprecated. use phases instead
 File relativeFile(File file)
          Convert the specified file object to a file object that is relative to the root of this repository.
 Changeset tip()
           
 String toString()
           
 void unlock()
           
 WorkingCopy workingCopy()
          Create a new WorkingCopy object for this repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Repository

protected Repository(RepositoryConfiguration.CachePolicy cachePolicy)
Method Detail

open

public static BaseRepository open(RepositoryConfiguration conf,
                                  File mercurialRepository)
Open an existing Mercurial repository.

Parameters:
mercurialRepository - path to the local repository.
Returns:
the repository.

create

public static BaseRepository create(RepositoryConfiguration conf,
                                    File directory)
Create a new Mercurial repository and open a javahg Repository on it.

Parameters:
directory - the local destination path of the clone
Returns:
the newly created repository.

clone

public static BaseRepository clone(RepositoryConfiguration conf,
                                   File directory,
                                   String otherRepoUrl)
Clone an existing Mercurial repository.

Parameters:
directory - the local destination path of the clone
otherRepoUrl - the (possible remote) repository to clone.
Returns:
the newly cloned repository.

open

public static BaseRepository open(File mercurialRepository)
Open an existing Mercurial repository. This uses the default Mercurial binary from RepositoryConfiguration.DEFAULT.

Parameters:
mercurialRepository - the local path to the repository.
Returns:
the repository.

create

public static BaseRepository create(File directory)
Create a new Mercurial repository. This uses the default Mercurial binary from RepositoryConfiguration.DEFAULT.

Parameters:
directory - the local destination path of the clone
Returns:
the newly created repository.

clone

public static BaseRepository clone(File directory,
                                   String otherRepoUrl)
Clone an existing Mercurial repository. This uses the default Mercurial binary from RepositoryConfiguration.DEFAULT.

Parameters:
directory - the local destination path of the clone
otherRepoUrl - the (possible remote) repository to clone.
Returns:
the newly cloned repository.

changeSet

@Deprecated
public final Changeset changeSet(String node)
Deprecated. Use changeset instead.

Parameters:
node - a changeset ID, must be 40 hexadecimal characters.
Returns:
the changeset

changeset

public final Changeset changeset(String node)
Return a Changeset object for the specified node id.

The changeset is not actually loaded, but will be loaded on demand when a getter is called.

null is used to represent the null changeset.

Parameters:
node - a changeset ID, must be 40 hexadecimal characters.
Returns:
the changeset

basicChangeset

protected Changeset basicChangeset(String node)
                            throws ExecutionException
Parameters:
node - a changeset node id, that is assume not to be the null id
Returns:
Changeset object with the specified id
Throws:
ExecutionException

getServerPool

public abstract ServerPool getServerPool()
Returns:
the command server pool associated with this repository.

newDecoder

public abstract CharsetDecoder newDecoder()
Returns:
Get a new decoder for data in this repository

close

public void close()
Close the repository. This also stops the command server associated with the repository.


getDirectory

public abstract File getDirectory()
Returns:
the root directory of this repository.

getBaseRepository

public abstract BaseRepository getBaseRepository()

toString

public String toString()
Overrides:
toString in class Object

addToCommandLine

public void addToCommandLine(List<String> commandLine)
Add repository specific arguments to the hg command line for command execution

Parameters:
commandLine -

getHgVersion

public HgVersion getHgVersion()
Returns:
The version string for the Mercurial server

workingCopy

public WorkingCopy workingCopy()
Create a new WorkingCopy object for this repository.

Returns:
a working copy object for this repository

heads

public List<Changeset> heads()
Returns:
heads for the repository

readPhases

@Deprecated
public Map<Changeset,Phase> readPhases(String... revs)
Deprecated. use phases instead

Parameters:
revs -
Returns:
mapping from Changeset to Phase

phases

public Map<Changeset,Phase> phases(String... revs)
Return the phases of the specified revisions

Parameters:
revs -
Returns:
Map mapping a Changeset to a Phase

tip

public Changeset tip()
Returns:
the tip Changeset for the repository

relativeFile

public File relativeFile(File file)
Convert the specified file object to a file object that is relative to the root of this repository.

If the file argument is not absolute it is returned as it is.

Parameters:
file -
Returns:

file

public File file(String name)
Return a File object for the file name specified in this repository.

Parameters:
name -
Returns:
the File

lock

public void lock()

unlock

public void unlock()

getChangesetCache

protected com.google.common.cache.LoadingCache<String,Changeset> getChangesetCache()

getChangesetIfInCache

protected Changeset getChangesetIfInCache(String node)

getCacheStats

public com.google.common.cache.CacheStats getCacheStats()


Copyright © 2011-2013 aragost Trifork ag. All Rights Reserved.