Class RefTreeUpdate
- java.lang.Object
-
- org.eclipse.jgit.lib.RefUpdate
-
- org.eclipse.jgit.internal.storage.reftree.RefTreeUpdate
-
class RefTreeUpdate extends RefUpdate
Single reference update toRefTreeDatabase
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.lib.RefUpdate
RefUpdate.Result
-
-
Field Summary
Fields Modifier and Type Field Description private RefTreeBatch
batch
private Ref
oldRef
private RefTreeDatabase
refdb
private RevWalk
rw
-
Constructor Summary
Constructors Constructor Description RefTreeUpdate(RefTreeDatabase refdb, Ref ref)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RefUpdate.Result
doDelete(RefUpdate.Result desiredResult)
Do deleteprotected RefUpdate.Result
doLink(java.lang.String target)
Do linkprotected RefUpdate.Result
doUpdate(RefUpdate.Result desiredResult)
Do updateprotected RefDatabase
getRefDatabase()
Get the reference database this update modifies.protected Repository
getRepository()
Get the repository storing the database's objects.private Ref
newRef(java.lang.String name, ObjectId id)
private RefUpdate.Result
run(Ref newRef, RefUpdate.Result desiredResult)
(package private) static RefUpdate.Result
translate(ReceiveCommand.Result r, RefUpdate.Result desiredResult)
protected boolean
tryLock(boolean deref)
Try to acquire the lock on the reference.protected void
unlock()
Releases the lock taken byRefUpdate.tryLock(boolean)
if it succeeded.-
Methods inherited from class org.eclipse.jgit.lib.RefUpdate
delete, delete, disableRefLog, forceUpdate, getExpectedOldObjectId, getName, getNewObjectId, getOldObjectId, getPushCertificate, getRef, getRefLogIdent, getRefLogMessage, getResult, isDetachingSymbolicRef, isForceRefLog, isForceUpdate, isRefLogIncludingResult, link, setCheckConflicting, setDetachingSymbolicRef, setExpectedOldObjectId, setForceRefLog, setForceUpdate, setNewObjectId, setOldObjectId, setPushCertificate, setRefLogIdent, setRefLogMessage, update, update
-
-
-
-
Field Detail
-
refdb
private final RefTreeDatabase refdb
-
rw
private RevWalk rw
-
batch
private RefTreeBatch batch
-
oldRef
private Ref oldRef
-
-
Constructor Detail
-
RefTreeUpdate
RefTreeUpdate(RefTreeDatabase refdb, Ref ref)
-
-
Method Detail
-
getRefDatabase
protected RefDatabase getRefDatabase()
Get the reference database this update modifies.- Specified by:
getRefDatabase
in classRefUpdate
- Returns:
- the reference database this update modifies.
-
getRepository
protected Repository getRepository()
Get the repository storing the database's objects.- Specified by:
getRepository
in classRefUpdate
- Returns:
- the repository storing the database's objects.
-
tryLock
protected boolean tryLock(boolean deref) throws java.io.IOException
Try to acquire the lock on the reference.If the locking was successful the implementor must set the current identity value by calling
RefUpdate.setOldObjectId(ObjectId)
.- Specified by:
tryLock
in classRefUpdate
- Parameters:
deref
- true if the lock should be taken against the leaf level reference; false if it should be taken exactly against the current reference.- Returns:
- true if the lock was acquired and the reference is likely protected from concurrent modification; false if it failed.
- Throws:
java.io.IOException
- the lock couldn't be taken due to an unexpected storage failure, and not because of a concurrent update.
-
unlock
protected void unlock()
Releases the lock taken byRefUpdate.tryLock(boolean)
if it succeeded.
-
doUpdate
protected RefUpdate.Result doUpdate(RefUpdate.Result desiredResult) throws java.io.IOException
Do update- Specified by:
doUpdate
in classRefUpdate
- Parameters:
desiredResult
- aRefUpdate.Result
object.- Returns:
result
- Throws:
java.io.IOException
-
newRef
private Ref newRef(java.lang.String name, ObjectId id) throws MissingObjectException, java.io.IOException
- Throws:
MissingObjectException
java.io.IOException
-
doDelete
protected RefUpdate.Result doDelete(RefUpdate.Result desiredResult) throws java.io.IOException
Do delete- Specified by:
doDelete
in classRefUpdate
- Parameters:
desiredResult
- aRefUpdate.Result
object.- Returns:
result
- Throws:
java.io.IOException
-
doLink
protected RefUpdate.Result doLink(java.lang.String target) throws java.io.IOException
Do link- Specified by:
doLink
in classRefUpdate
- Parameters:
target
- aString
object.- Returns:
RefUpdate.Result.NEW
on success.- Throws:
java.io.IOException
-
run
private RefUpdate.Result run(@Nullable Ref newRef, RefUpdate.Result desiredResult) throws java.io.IOException
- Throws:
java.io.IOException
-
translate
static RefUpdate.Result translate(ReceiveCommand.Result r, RefUpdate.Result desiredResult)
-
-