|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.transport.RefSpec
public class RefSpec
Describes how refs in one repository copy into another repository.
A ref specification provides matching support and limited rules to rewrite a reference in one repository to another reference in another repository.
Field Summary | |
---|---|
static String |
WILDCARD_SUFFIX
Suffix for wildcard ref spec component, that indicate matching all refs with specified prefix. |
Constructor Summary | |
---|---|
RefSpec()
Construct an empty RefSpec. |
|
RefSpec(String spec)
Parse a ref specification for use during transport operations. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
RefSpec |
expandFromDestination(Ref r)
Expand this specification to exactly match a ref. |
RefSpec |
expandFromDestination(String r)
Expand this specification to exactly match a ref name. |
RefSpec |
expandFromSource(Ref r)
Expand this specification to exactly match a ref. |
RefSpec |
expandFromSource(String r)
Expand this specification to exactly match a ref name. |
String |
getDestination()
Get the destination ref description. |
String |
getSource()
Get the source ref description. |
int |
hashCode()
|
boolean |
isForceUpdate()
Check if this specification wants to forcefully update the destination. |
boolean |
isWildcard()
Check if this specification is actually a wildcard pattern. |
static boolean |
isWildcard(String s)
Check whether provided string is a wildcard ref spec component. |
boolean |
matchDestination(Ref r)
Does this specification's destination description match the ref? |
boolean |
matchDestination(String r)
Does this specification's destination description match the ref name? |
boolean |
matchSource(Ref r)
Does this specification's source description match the ref? |
boolean |
matchSource(String r)
Does this specification's source description match the ref name? |
RefSpec |
setDestination(String destination)
Create a new RefSpec with a different destination name setting. |
RefSpec |
setForceUpdate(boolean forceUpdate)
Create a new RefSpec with a different force update setting. |
RefSpec |
setSource(String source)
Create a new RefSpec with a different source name setting. |
RefSpec |
setSourceDestination(String source,
String destination)
Create a new RefSpec with a different source/destination name setting. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String WILDCARD_SUFFIX
Constructor Detail |
---|
public RefSpec()
A newly created empty RefSpec is not suitable for use in most applications, as at least one field must be set to match a source name.
public RefSpec(String spec)
Specifications are typically one of the following forms:
refs/head/master
refs/head/master:refs/remotes/origin/master
refs/head/*:refs/remotes/origin/*
+refs/head/master
+refs/head/master:refs/remotes/origin/master
+refs/head/*:refs/remotes/origin/*
:refs/head/master
spec
- string describing the specification.
IllegalArgumentException
- the specification is invalid.Method Detail |
---|
public static boolean isWildcard(String s)
s
- ref spec component - string to test. Can be null.
public boolean isForceUpdate()
public RefSpec setForceUpdate(boolean forceUpdate)
forceUpdate
- new value for force update in the returned instance.
public boolean isWildcard()
If this is a wildcard pattern then the source and destination names
returned by getSource()
and getDestination()
will not
be actual ref names, but instead will be patterns.
public String getSource()
During a fetch this is the name of the ref on the remote repository we are fetching from. During a push this is the name of the ref on the local repository we are pushing out from.
public RefSpec setSource(String source)
source
- new value for source in the returned instance.
IllegalStateException
- There is already a destination configured, and the wildcard
status of the existing destination disagrees with the
wildcard status of the new source.public String getDestination()
During a fetch this is the local tracking branch that will be updated with the new ObjectId after fetching is complete. During a push this is the remote ref that will be updated by the remote's receive-pack process.
If null during a fetch no tracking branch should be updated and the ObjectId should be stored transiently in order to prepare a merge.
If null during a push, use getSource()
instead.
public RefSpec setDestination(String destination)
destination
- new value for destination in the returned instance.
IllegalStateException
- There is already a source configured, and the wildcard status
of the existing source disagrees with the wildcard status of
the new destination.public RefSpec setSourceDestination(String source, String destination)
source
- new value for source in the returned instance.destination
- new value for destination in the returned instance.
IllegalArgumentException
- The wildcard status of the new source disagrees with the
wildcard status of the new destination.public boolean matchSource(String r)
r
- ref name that should be tested.
public boolean matchSource(Ref r)
r
- ref whose name should be tested.
public boolean matchDestination(String r)
r
- ref name that should be tested.
public boolean matchDestination(Ref r)
r
- ref whose name should be tested.
public RefSpec expandFromSource(String r)
Callers must first verify the passed ref name matches this specification, otherwise expansion results may be unpredictable.
r
- a ref name that matched our source specification. Could be a
wildcard also.
public RefSpec expandFromSource(Ref r)
Callers must first verify the passed ref matches this specification, otherwise expansion results may be unpredictable.
r
- a ref that matched our source specification. Could be a
wildcard also.
public RefSpec expandFromDestination(String r)
Callers must first verify the passed ref name matches this specification, otherwise expansion results may be unpredictable.
r
- a ref name that matched our destination specification. Could
be a wildcard also.
public RefSpec expandFromDestination(Ref r)
Callers must first verify the passed ref matches this specification, otherwise expansion results may be unpredictable.
r
- a ref that matched our destination specification.
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |