public class RemoteRefUpdate extends Object
PushProcess
class, being read-only for
client.
Client can create instances of this class directly, basing on user
specification and advertised refs
(Connection
or through
Transport
helper methods. Apply this
specification on remote repository using
Transport.push(org.eclipse.jgit.lib.ProgressMonitor, java.util.Collection)
method.
Modifier and Type | Class and Description |
---|---|
static class |
RemoteRefUpdate.Status
Represent current status of a remote ref update.
|
Constructor and Description |
---|
RemoteRefUpdate(RemoteRefUpdate base,
ObjectId newExpectedOldObjectId)
Create a new instance of this object basing on existing instance for
configuration.
|
RemoteRefUpdate(Repository localDb,
Ref srcRef,
String remoteName,
boolean forceUpdate,
String localName,
ObjectId expectedOldObjectId)
Construct remote ref update request by providing an update specification.
|
RemoteRefUpdate(Repository localDb,
String srcRef,
ObjectId srcId,
String remoteName,
boolean forceUpdate,
String localName,
ObjectId expectedOldObjectId)
Construct remote ref update request by providing an update specification.
|
RemoteRefUpdate(Repository localDb,
String srcRef,
String remoteName,
boolean forceUpdate,
String localName,
ObjectId expectedOldObjectId)
Construct remote ref update request by providing an update specification.
|
Modifier and Type | Method and Description |
---|---|
ObjectId |
getExpectedOldObjectId()
Get expected old object id
|
String |
getMessage()
Get message describing reasons of status when needed/possible; may be
null.
|
ObjectId |
getNewObjectId()
Get new object id
|
String |
getRemoteName()
Get name of remote ref to update
|
String |
getSrcRef()
Get source revision as specified by user (in constructor)
|
RemoteRefUpdate.Status |
getStatus()
Get status of remote ref update operation.
|
TrackingRefUpdate |
getTrackingRefUpdate()
Get tracking branch update if localName was set in constructor.
|
boolean |
hasTrackingRefUpdate()
Whether user specified a local tracking branch for remote update
|
boolean |
isDelete()
Whether this update is a deleting update
|
boolean |
isExpectingOldObjectId()
Whether some object is required to be advertised by remote side, as set
in constructor
|
boolean |
isFastForward()
Check whether update was fast-forward.
|
boolean |
isForceUpdate()
Whether this update is forced regardless of old remote ref object
|
String |
toString() |
protected void |
updateTrackingRef(RevWalk walk)
Update locally stored tracking branch with the new object.
|
public RemoteRefUpdate(Repository localDb, String srcRef, String remoteName, boolean forceUpdate, String localName, ObjectId expectedOldObjectId) throws IOException
RemoteRefUpdate.Status.NOT_ATTEMPTED
status and no message.localDb
- local repository to push from.srcRef
- source revision - any string resolvable by
Repository.resolve(String)
. This
resolves to the new object that the caller want remote ref to
be after update. Use null or
ObjectId.zeroId()
string for
delete request.remoteName
- full name of a remote ref to update, e.g. "refs/heads/master"
(no wildcard, no short name).forceUpdate
- true when caller want remote ref to be updated regardless
whether it is fast-forward update (old object is ancestor of
new object).localName
- optional full name of a local stored tracking branch, to
update after push, e.g. "refs/remotes/zawir/dirty" (no
wildcard, no short name); null if no local tracking branch
should be updated.expectedOldObjectId
- optional object id that caller is expecting, requiring to be
advertised by remote side before update; update will take
place ONLY if remote side advertise exactly this expected id;
null if caller doesn't care what object id remote side
advertise. Use ObjectId.zeroId()
when expecting no remote ref with this name.IOException
- when I/O error occurred during creating
TrackingRefUpdate
for
local tracking branch or srcRef can't be resolved to any
object.IllegalArgumentException
- if some required parameter was nullpublic RemoteRefUpdate(Repository localDb, Ref srcRef, String remoteName, boolean forceUpdate, String localName, ObjectId expectedOldObjectId) throws IOException
RemoteRefUpdate.Status.NOT_ATTEMPTED
status and no message.localDb
- local repository to push from.srcRef
- source revision. Use null to delete.remoteName
- full name of a remote ref to update, e.g. "refs/heads/master"
(no wildcard, no short name).forceUpdate
- true when caller want remote ref to be updated regardless
whether it is fast-forward update (old object is ancestor of
new object).localName
- optional full name of a local stored tracking branch, to
update after push, e.g. "refs/remotes/zawir/dirty" (no
wildcard, no short name); null if no local tracking branch
should be updated.expectedOldObjectId
- optional object id that caller is expecting, requiring to be
advertised by remote side before update; update will take
place ONLY if remote side advertise exactly this expected id;
null if caller doesn't care what object id remote side
advertise. Use ObjectId.zeroId()
when expecting no remote ref with this name.IOException
- when I/O error occurred during creating
TrackingRefUpdate
for
local tracking branch or srcRef can't be resolved to any
object.IllegalArgumentException
- if some required parameter was nullpublic RemoteRefUpdate(Repository localDb, String srcRef, ObjectId srcId, String remoteName, boolean forceUpdate, String localName, ObjectId expectedOldObjectId) throws IOException
RemoteRefUpdate.Status.NOT_ATTEMPTED
status and no message.localDb
- local repository to push from.srcRef
- source revision to label srcId with. If null srcId.name() will
be used instead.srcId
- The new object that the caller wants remote ref to be after
update. Use null or
ObjectId.zeroId()
for delete
request.remoteName
- full name of a remote ref to update, e.g. "refs/heads/master"
(no wildcard, no short name).forceUpdate
- true when caller want remote ref to be updated regardless
whether it is fast-forward update (old object is ancestor of
new object).localName
- optional full name of a local stored tracking branch, to
update after push, e.g. "refs/remotes/zawir/dirty" (no
wildcard, no short name); null if no local tracking branch
should be updated.expectedOldObjectId
- optional object id that caller is expecting, requiring to be
advertised by remote side before update; update will take
place ONLY if remote side advertise exactly this expected id;
null if caller doesn't care what object id remote side
advertise. Use ObjectId.zeroId()
when expecting no remote ref with this name.IOException
- when I/O error occurred during creating
TrackingRefUpdate
for
local tracking branch or srcRef can't be resolved to any
object.IllegalArgumentException
- if some required parameter was nullpublic RemoteRefUpdate(RemoteRefUpdate base, ObjectId newExpectedOldObjectId) throws IOException
getMessage()
, getStatus()
)
of base object is not shared. Expected old object id is set up from
scratch, as this constructor may be used for 2-stage push: first one
being dry run, second one being actual push.base
- configuration base.newExpectedOldObjectId
- new expected object id value.IOException
- when I/O error occurred during creating
TrackingRefUpdate
for
local tracking branch or srcRef of base object no longer can
be resolved to any object.public ObjectId getExpectedOldObjectId()
public boolean isExpectingOldObjectId()
public ObjectId getNewObjectId()
public boolean isDelete()
public String getRemoteName()
public TrackingRefUpdate getTrackingRefUpdate()
public String getSrcRef()
Repository.resolve(String)
; can be
null if specified that way in constructor - this stands for
delete request.public boolean hasTrackingRefUpdate()
public boolean isForceUpdate()
public RemoteRefUpdate.Status getStatus()
public boolean isFastForward()
RemoteRefUpdate.Status.OK
).public String getMessage()
protected void updateTrackingRef(RevWalk walk) throws IOException
walk
- walker used for checking update properties.IOException
- when I/O error occurred during updateCopyright © 2019 Eclipse JGit Project. All rights reserved.