Package jenkins.scm.api
Class SCMHeadMigration<S extends SCMSource,H extends SCMHead,R extends SCMRevision>
java.lang.Object
jenkins.scm.api.SCMHeadMigration<S,H,R>
- All Implemented Interfaces:
ExtensionPoint
public abstract class SCMHeadMigration<S extends SCMSource,H extends SCMHead,R extends SCMRevision>
extends Object
implements ExtensionPoint
If a
SCMSource plugin needs to migrate the implementation classes for SCMHead this extension
point allows the plugin to register type migrations. For speed of migration implementations should just jump directly
to the final end-point and not expect recursive chain walking.- Since:
- 2.0.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets theSCMHeadthat the migration applies to.Gets theSCMRevisionthat the migration applies to.Gets theSCMSourcethat the migration applies to.abstract SCMHeadPerform a migration.Perform a migration.static SCMHeadreadResolveSCMHead(SCMSource source, SCMHead head) Perform a migration.static SCMRevisionreadResolveSCMRevision(SCMSource source, SCMRevision revision) Perform a migration.
-
Constructor Details
-
SCMHeadMigration
Constructor.- Parameters:
sourceClass- theSCMSourcethat the migration applies to.headClass- theSCMHeadthat the migration applies to.revisionClass- theSCMRevisionthat the migration applies to.
-
-
Method Details
-
getSCMSourceClass
Gets theSCMSourcethat the migration applies to.- Returns:
- the
SCMSourcethat the migration applies to.
-
getSCMHeadClass
Gets theSCMHeadthat the migration applies to.- Returns:
- the
SCMHeadthat the migration applies to.
-
getSCMRevisionClass
Gets theSCMRevisionthat the migration applies to.- Returns:
- the
SCMRevisionthat the migration applies to.
-
migrate
Perform a migration.Note: if you migrate a
SCMHeadthen most likely you will also want to migrate theSCMRevisioninstances associated with thatSCMHead- at the very least to updateSCMRevision.getHead().- Parameters:
source- the source instance.head- the candidate head.- Returns:
- the migrated head or
nullif the migration was not appropriate.
-
migrate
Perform a migration.- Parameters:
source- the source instance.revision- the candidate revision.- Returns:
- the migrated revision or
nullif the migration was not appropriate.
-
readResolveSCMHead
Perform a migration.- Parameters:
source- the source instance.head- the candidate head.- Returns:
- the migrated head or the original head.
-
readResolveSCMRevision
@CheckForNull public static SCMRevision readResolveSCMRevision(@NonNull SCMSource source, @CheckForNull SCMRevision revision) Perform a migration.- Parameters:
source- the source instance.revision- the candidate revision.- Returns:
- the migrated revision or the original revision.
-