Class TransitionFilteredIntegrationStrategy

  • All Implemented Interfaces:
    IGitIntegrationStrategy

    public class TransitionFilteredIntegrationStrategy
    extends Object
    Implementation of IGitIntegrationStrategy based on branch transition filtering.

    A branch transition filter defines a set of branch transitions for which a particular snapshot task is enabled. The strategy permits a snapshot task if all conditions apply:

    • The snapshot task is enabled for the given transition.
    • (For creation) A snapshot for source branch does not exist.
    • (For restoration) A snapshot for target branch exists.
    • The task is meaningful, e.g. source and target branches have different heads.
    • Repository is in a safe state.
    • There are no uncommitted or untracked changes in working tree.
    • Constructor Detail

      • TransitionFilteredIntegrationStrategy

        public TransitionFilteredIntegrationStrategy​(IBranchTransitionFilter branchTransitionFilter,
                                                     ISnapshotUserApprovalCallback userApprovalCallback)
        Constructs a new strategy with the given branch transition filter and user approval callback.
        Parameters:
        branchTransitionFilter - the transition branch filter, cannot be null
        userApprovalCallback - the user approval callback, cannot be null
    • Method Detail

      • shallKeepSnapshot

        public boolean shallKeepSnapshot​(org.eclipse.core.resources.IProject project,
                                         org.eclipse.jgit.lib.Repository repo,
                                         org.eclipse.jgit.lib.ObjectId revision)
        Description copied from interface: IGitIntegrationStrategy
        Tests whether a snapshot may be required in future. The snapshot is referred to by a project and commit.

        This method is used for garbage collection purposes and does not affect snapshot creation or restoration.

        Parameters:
        project - the project, never null
        repo - the repository, associated with the project, never null
        revision - SHA-1 of the commit, never null
        Returns:
        true if the snapshot shall be kept, false otherwise
      • requestUserApproval

        public boolean requestUserApproval​(SnapshotGitRequest[] requests)
        Description copied from interface: IGitIntegrationStrategy
        Requests user approval of a snapshot operation consisting of the given requests.
        Specified by:
        requestUserApproval in interface IGitIntegrationStrategy
        Parameters:
        requests - the requests, never null
        Returns:
        true if a user approved the operation, false otherwise