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
-
Method Summary
Modifier and TypeMethodDescriptionGets theSCMHead
that the migration applies to.Gets theSCMRevision
that the migration applies to.Gets theSCMSource
that the migration applies to.abstract SCMHead
Perform a migration.Perform a migration.static SCMHead
readResolveSCMHead
(SCMSource source, SCMHead head) Perform a migration.static SCMRevision
readResolveSCMRevision
(SCMSource source, SCMRevision revision) Perform a migration.
-
Constructor Details
-
SCMHeadMigration
Constructor.- Parameters:
sourceClass
- theSCMSource
that the migration applies to.headClass
- theSCMHead
that the migration applies to.revisionClass
- theSCMRevision
that the migration applies to.
-
-
Method Details
-
getSCMSourceClass
Gets theSCMSource
that the migration applies to.- Returns:
- the
SCMSource
that the migration applies to.
-
getSCMHeadClass
Gets theSCMHead
that the migration applies to.- Returns:
- the
SCMHead
that the migration applies to.
-
getSCMRevisionClass
Gets theSCMRevision
that the migration applies to.- Returns:
- the
SCMRevision
that the migration applies to.
-
migrate
Perform a migration.Note: if you migrate a
SCMHead
then most likely you will also want to migrate theSCMRevision
instances associated with thatSCMHead
- at the very least to updateSCMRevision.getHead()
.- Parameters:
source
- the source instance.head
- the candidate head.- Returns:
- the migrated head or
null
if the migration was not appropriate.
-
migrate
Perform a migration.- Parameters:
source
- the source instance.revision
- the candidate revision.- Returns:
- the migrated revision or
null
if 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.
-