Package org.eclipse.jgit.lib
Class RefRename
- java.lang.Object
-
- org.eclipse.jgit.lib.RefRename
-
public abstract class RefRename extends Object
A RefUpdate combination for renaming a reference.If the source reference is currently pointed to by
HEAD, then the HEAD symbolic reference is updated to point to the new destination.
-
-
Field Summary
Fields Modifier and Type Field Description protected RefUpdatedestinationUpdate operation to create/overwrite the destination reference.protected RefUpdatesourceUpdate operation to read and delete the source reference.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddisableRefLog()Don't record this rename in the ref's associated reflog.protected abstract RefUpdate.ResultdoRename()PersonIdentgetRefLogIdent()StringgetRefLogMessage()Get the message to include in the reflog.RefUpdate.ResultgetResult()protected booleanneedToUpdateHEAD()RefUpdate.Resultrename()voidsetRefLogIdent(PersonIdent pi)Set the identity of the user appearing in the reflog.voidsetRefLogMessage(String msg)Set the message to include in the reflog.
-
-
-
Method Detail
-
getRefLogIdent
public PersonIdent getRefLogIdent()
- Returns:
- identity of the user making the change in the reflog.
-
setRefLogIdent
public void setRefLogIdent(PersonIdent pi)
Set the identity of the user appearing in the reflog.The timestamp portion of the identity is ignored. A new identity with the current timestamp will be created automatically when the rename occurs and the log record is written.
- Parameters:
pi- identity of the user. If null the identity will be automatically determined based on the repository configuration.
-
getRefLogMessage
public String getRefLogMessage()
Get the message to include in the reflog.- Returns:
- message the caller wants to include in the reflog; null if the rename should not be logged.
-
setRefLogMessage
public void setRefLogMessage(String msg)
Set the message to include in the reflog.- Parameters:
msg- the message to describe this change.
-
disableRefLog
public void disableRefLog()
Don't record this rename in the ref's associated reflog.
-
getResult
public RefUpdate.Result getResult()
- Returns:
- result of rename operation
-
rename
public RefUpdate.Result rename() throws IOException
- Returns:
- the result of the new ref update
- Throws:
IOException
-
doRename
protected abstract RefUpdate.Result doRename() throws IOException
- Returns:
- the result of the rename operation.
- Throws:
IOException
-
needToUpdateHEAD
protected boolean needToUpdateHEAD() throws IOException- Returns:
- true if the
Constants#HEADreference needs to be linked to the new destination name. - Throws:
IOException- the current value ofHEADcannot be read.
-
-