public class ReceiveCommand extends Object
BaseReceivePack
.
This command instance roughly translates to the server side representation of
the RemoteRefUpdate
created by the client.
Modifier and Type | Class and Description |
---|---|
static class |
ReceiveCommand.Result
Result of the update command.
|
static class |
ReceiveCommand.Type
Type of operation requested.
|
Constructor and Description |
---|
ReceiveCommand(ObjectId oldId,
ObjectId newId,
String name)
Create a new command for
BaseReceivePack . |
ReceiveCommand(ObjectId oldId,
ObjectId newId,
String name,
ReceiveCommand.Type type)
Create a new command for
BaseReceivePack . |
Modifier and Type | Method and Description |
---|---|
void |
execute(BaseReceivePack rp)
Execute this command during a receive-pack session.
|
static List<ReceiveCommand> |
filter(List<ReceiveCommand> commands,
ReceiveCommand.Result want)
Filter a list of commands according to result.
|
String |
getMessage() |
ObjectId |
getNewId() |
ObjectId |
getOldId() |
Ref |
getRef() |
String |
getRefName() |
ReceiveCommand.Result |
getResult() |
ReceiveCommand.Type |
getType() |
void |
setResult(ReceiveCommand.Result s)
Set the status of this command.
|
void |
setResult(ReceiveCommand.Result s,
String m)
Set the status of this command.
|
void |
setResult(RefUpdate.Result r)
Set the result of this command.
|
String |
toString() |
void |
updateType(RevWalk walk)
Update the type of this command by checking for fast-forward.
|
public ReceiveCommand(ObjectId oldId, ObjectId newId, String name)
BaseReceivePack
.oldId
- the old object id; must not be null. Use
ObjectId.zeroId()
to indicate a ref creation.newId
- the new object id; must not be null. Use
ObjectId.zeroId()
to indicate a ref deletion.name
- name of the ref being affected.public ReceiveCommand(ObjectId oldId, ObjectId newId, String name, ReceiveCommand.Type type)
BaseReceivePack
.oldId
- the old object id; must not be null. Use
ObjectId.zeroId()
to indicate a ref creation.newId
- the new object id; must not be null. Use
ObjectId.zeroId()
to indicate a ref deletion.name
- name of the ref being affected.type
- type of the command.public static List<ReceiveCommand> filter(List<ReceiveCommand> commands, ReceiveCommand.Result want)
commands
- commands to filter.want
- desired status to filter by.public ObjectId getOldId()
public ObjectId getNewId()
public String getRefName()
public ReceiveCommand.Type getType()
ReceiveCommand.Type
.public Ref getRef()
public ReceiveCommand.Result getResult()
public String getMessage()
public void setResult(ReceiveCommand.Result s)
s
- the new status code for this command.public void setResult(ReceiveCommand.Result s, String m)
s
- new status code for this command.m
- optional message explaining the new status.public void updateType(RevWalk walk) throws IOException
If the command's current type is UPDATE, a merge test will be performed
using the supplied RevWalk to determine if getOldId()
is fully
merged into getNewId()
. If some commits are not merged the
update type is changed to ReceiveCommand.Type.UPDATE_NONFASTFORWARD
.
walk
- an instance to perform the merge test with. The caller must
allocate and release this object.IOException
- either oldId or newId is not accessible in the repository
used by the RevWalk. This usually indicates data corruption,
and the command cannot be processed.public void execute(BaseReceivePack rp)
Sets the status of the command as a side effect.
rp
- receive-pack session.public void setResult(RefUpdate.Result r)
r
- the new result code for this command.Copyright © 2013. All rights reserved.