org.eclipse.jgit.storage.file
Class ReflogWriter

java.lang.Object
  extended by org.eclipse.jgit.storage.file.ReflogWriter

public class ReflogWriter
extends Object

Utility for writing reflog entries

Since:
2.0

Constructor Summary
ReflogWriter(Repository repository)
          Create write for repository
ReflogWriter(Repository repository, boolean forceWrite)
          Create write for repository
 
Method Summary
 ReflogWriter create()
          Create the log directories
 Repository getRepository()
          Get repository that reflog is being written for
 ReflogWriter log(RefUpdate update, String msg, boolean deref)
          Write the given ref update to the ref's log
 ReflogWriter log(String refName, ObjectId oldId, ObjectId newId, PersonIdent ident, String message)
          Write the given entry information to the ref's log
 ReflogWriter log(String refName, ReflogEntry entry)
          Write the given ReflogEntry entry to the ref's log
 File logFor(String name)
          Locate the log file on disk for a single reference name.
static String refLockFor(String name)
          Get the ref name to be used for when locking a ref's log for rewriting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflogWriter

public ReflogWriter(Repository repository)
Create write for repository

Parameters:
repository -

ReflogWriter

public ReflogWriter(Repository repository,
                    boolean forceWrite)
Create write for repository

Parameters:
repository -
forceWrite - true to write to disk all entries logged, false to respect the repository's config and current log file status
Method Detail

refLockFor

public static String refLockFor(String name)
Get the ref name to be used for when locking a ref's log for rewriting

Parameters:
name - name of the ref, relative to the Git repository top level directory (so typically starts with refs/).
Returns:
the name of the ref's lock ref

getRepository

public Repository getRepository()
Get repository that reflog is being written for

Returns:
file repository

create

public ReflogWriter create()
                    throws IOException
Create the log directories

Returns:
this writer
Throws:
IOException

logFor

public File logFor(String name)
Locate the log file on disk for a single reference name.

Parameters:
name - name of the ref, relative to the Git repository top level directory (so typically starts with refs/).
Returns:
the log file location.

log

public ReflogWriter log(String refName,
                        ReflogEntry entry)
                 throws IOException
Write the given ReflogEntry entry to the ref's log

Parameters:
refName -
entry -
Returns:
this writer
Throws:
IOException

log

public ReflogWriter log(String refName,
                        ObjectId oldId,
                        ObjectId newId,
                        PersonIdent ident,
                        String message)
                 throws IOException
Write the given entry information to the ref's log

Parameters:
refName -
oldId -
newId -
ident -
message -
Returns:
this writer
Throws:
IOException

log

public ReflogWriter log(RefUpdate update,
                        String msg,
                        boolean deref)
                 throws IOException
Write the given ref update to the ref's log

Parameters:
update -
msg -
deref -
Returns:
this writer
Throws:
IOException


Copyright © 2013. All Rights Reserved.