public class BatchRefUpdate extends Object
The batch update is primarily useful in the transport code, where a client or server is making changes to more than one reference at a time.
Modifier | Constructor and Description |
---|---|
protected |
BatchRefUpdate(RefDatabase refdb)
Initialize a new batch update.
|
Modifier and Type | Method and Description |
---|---|
BatchRefUpdate |
addCommand(Collection<ReceiveCommand> cmd)
Add commands to this batch update.
|
BatchRefUpdate |
addCommand(ReceiveCommand... cmd)
Add commands to this batch update.
|
BatchRefUpdate |
addCommand(ReceiveCommand cmd)
Add a single command to this batch update.
|
BatchRefUpdate |
disableRefLog()
Don't record this update in the ref's associated reflog.
|
void |
execute(RevWalk walk,
ProgressMonitor monitor)
Execute this batch update.
|
List<ReceiveCommand> |
getCommands() |
PersonIdent |
getRefLogIdent() |
String |
getRefLogMessage()
Get the message to include in the reflog.
|
boolean |
isAllowNonFastForwards() |
boolean |
isRefLogDisabled() |
boolean |
isRefLogIncludingResult() |
protected RefUpdate |
newUpdate(ReceiveCommand cmd)
Create a new RefUpdate copying the batch settings.
|
BatchRefUpdate |
setAllowNonFastForwards(boolean allow)
Set if this update wants to permit a forced update.
|
BatchRefUpdate |
setRefLogIdent(PersonIdent pi)
Set the identity of the user appearing in the reflog.
|
BatchRefUpdate |
setRefLogMessage(String msg,
boolean appendStatus)
Set the message to include in the reflog.
|
protected BatchRefUpdate(RefDatabase refdb)
refdb
- the reference database of the repository to be updated.public boolean isAllowNonFastForwards()
public BatchRefUpdate setAllowNonFastForwards(boolean allow)
allow
- true if this update batch should ignore merge tests.this
.public PersonIdent getRefLogIdent()
public BatchRefUpdate setRefLogIdent(PersonIdent pi)
The timestamp portion of the identity is ignored. A new identity with the current timestamp will be created automatically when the update occurs and the log record is written.
pi
- identity of the user. If null the identity will be
automatically determined based on the repository
configuration.this
.public String getRefLogMessage()
public boolean isRefLogIncludingResult()
true
if the ref log message should show the result.public BatchRefUpdate setRefLogMessage(String msg, boolean appendStatus)
msg
- the message to describe this change. It may be null if
appendStatus is null in order not to append to the reflogappendStatus
- true if the status of the ref change (fast-forward or
forced-update) should be appended to the user supplied
message.this
.public BatchRefUpdate disableRefLog()
this
.public boolean isRefLogDisabled()
disableRefLog()
.public List<ReceiveCommand> getCommands()
public BatchRefUpdate addCommand(ReceiveCommand cmd)
cmd
- the command to add, must not be null.this
.public BatchRefUpdate addCommand(ReceiveCommand... cmd)
cmd
- the commands to add, must not be null.this
.public BatchRefUpdate addCommand(Collection<ReceiveCommand> cmd)
cmd
- the commands to add, must not be null.this
.public void execute(RevWalk walk, ProgressMonitor monitor) throws IOException
The default implementation of this method performs a sequential reference update over each reference.
walk
- a RevWalk to parse tags in case the storage system wants to
store them pre-peeled, a common performance optimization.monitor
- progress monitor to receive update status on.IOException
- the database is unable to accept the update. Individual
command status must be tested to determine if there is a
partial failure, or a total failure.protected RefUpdate newUpdate(ReceiveCommand cmd) throws IOException
cmd
- specific command the update should be created to copy.IOException
- the reference database cannot make a new update object for
the given reference.Copyright © 2015. All rights reserved.