Skip to content

Commit

Permalink
Fix #144 Recreate persistent contexts after mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry Lacour committed Feb 7, 2019
1 parent 23e9ebd commit 126c8a9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/main/groovy/togit/ScriptBase.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ abstract class ScriptBase extends Script implements Context {
MigrationManager.instance.source = newSource

// Mix in specific criteria/extraction contexts
newSource.addCriteria()
newSource.addExtractions()
newSource.mixinCriteria()
newSource.mixinExtractions()
MigrationManager.instance.refreshContexts()
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/main/groovy/togit/migration/MigrationManager.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class MigrationManager {
source = null
targets.clear()
plan = new MigrationPlan()
refreshContexts()
}

void refreshContexts() {
criteriaContext = new CriteriaContext()
extractionsContext = new ExtractionsContext()
actionsContext = new ActionsContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ trait MigrationSource {
/**
* Adds source-specific contexts to the global CriteriaContext
*/
abstract void addCriteria()
abstract void mixinCriteria()

/**
* Adds source-specific contexts to the global ExtractionsContext
*/
abstract void addExtractions()
abstract void mixinExtractions()
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ class ClearCaseSource implements MigrationSource {
}

@Override
void addCriteria() {
void mixinCriteria() {
CriteriaContext.mixin(ClearCaseCriteriaContext)
}

@Override
void addExtractions() {
void mixinExtractions() {
ExtractionsContext.mixin(ClearCaseExtractionsContext)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ class CcucmSource implements MigrationSource {
}

@Override
void addCriteria() {
void mixinCriteria() {
CriteriaContext.mixin(CcucmCriteriaContext)
}

@Override
void addExtractions() {
void mixinExtractions() {
ExtractionsContext.mixin(CcucmExtractionsContext)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class DummySource implements MigrationSource {
}

@Override
void addCriteria() {
void mixinCriteria() {
CriteriaContext.mixin(DummyCriteriaContext)
}

@Override
void addExtractions() {
void mixinExtractions() {
ExtractionsContext.mixin(DummyExtractionsContext)
}
}

0 comments on commit 126c8a9

Please sign in to comment.