Search in sources :

Example 1 with LabelsAwareModule

use of com.google.copybara.config.LabelsAwareModule in project copybara by google.

the class MigrateCmd method updateEnvironment.

private void updateEnvironment(String migrationName) {
    for (Object module : moduleSet.getModules().values()) {
        // We mutate the module per file loaded. Not ideal but it is the best we can do.
        if (module instanceof LabelsAwareModule) {
            LabelsAwareModule m = (LabelsAwareModule) module;
            m.setWorkflowName(migrationName);
        }
    }
}
Also used : LabelsAwareModule(com.google.copybara.config.LabelsAwareModule)

Example 2 with LabelsAwareModule

use of com.google.copybara.config.LabelsAwareModule in project copybara by google.

the class GitOriginTest method checkPartialFetchGitRepoName.

@Test
public void checkPartialFetchGitRepoName() throws Exception {
    String migrationName = "test_name";
    ModuleSet moduleSet = skylark.createModuleSet();
    for (Object module : moduleSet.getModules().values()) {
        // We mutate the module per file loaded. Not ideal but it is the best we can do.
        if (module instanceof LabelsAwareModule) {
            LabelsAwareModule m = (LabelsAwareModule) module;
            m.setWorkflowName(migrationName);
        }
    }
    origin = skylark.evalWithModuleSet("result", "result = git.origin(\n" + "    url = 'https://my-server.org/copybara',\n" + "    partial_fetch = True" + ")", moduleSet);
    Path gitDir = origin.getRepository().getGitDir();
    assertThat(gitDir.getFileName().toString()).isEqualTo("copy%2Ebara%2Esky%3A" + migrationName + "https%3A%2F%2Fmy-server%2Eorg%2Fcopybara");
}
Also used : Path(java.nio.file.Path) FileSubjects.assertThatPath(com.google.copybara.testing.FileSubjects.assertThatPath) ModuleSet(com.google.copybara.ModuleSet) LabelsAwareModule(com.google.copybara.config.LabelsAwareModule) Test(org.junit.Test)

Aggregations

LabelsAwareModule (com.google.copybara.config.LabelsAwareModule)2 ModuleSet (com.google.copybara.ModuleSet)1 FileSubjects.assertThatPath (com.google.copybara.testing.FileSubjects.assertThatPath)1 Path (java.nio.file.Path)1 Test (org.junit.Test)1