Search in sources :

Example 1 with RepositoryMapping

use of gen.core.project.RepositoryMapping in project omegat by omegat-org.

the class RepositoriesMappingController method getData.

List<RepositoryDefinition> getData() {
    List<RepositoryDefinition> result = new ArrayList<RepositoryDefinition>();
    for (RowRepo r : listRepo) {
        RepositoryDefinition rd = new RepositoryDefinition();
        rd.setType(r.type.name().toLowerCase(Locale.ENGLISH));
        rd.setUrl(r.url);
        result.add(rd);
        for (RowMapping m : listMapping) {
            if (r.url.equals(m.repoUrl)) {
                RepositoryMapping rm = new RepositoryMapping();
                rm.setLocal(normalizeMapping(m.local));
                rm.setRepository(normalizeMapping(m.remote));
                if (!StringUtil.isEmpty(m.excludes)) {
                    rm.getExcludes().addAll(Arrays.asList(m.excludes.trim().split(";")));
                }
                if (!StringUtil.isEmpty(m.includes)) {
                    rm.getIncludes().addAll(Arrays.asList(m.includes.trim().split(";")));
                }
                rd.getMapping().add(rm);
            }
        }
    }
    return result;
}
Also used : RepositoryDefinition(gen.core.project.RepositoryDefinition) ArrayList(java.util.ArrayList) RepositoryMapping(gen.core.project.RepositoryMapping)

Example 2 with RepositoryMapping

use of gen.core.project.RepositoryMapping in project omegat by omegat-org.

the class RepositoriesMappingController method putData.

void putData(List<RepositoryDefinition> data) {
    if (data == null) {
        return;
    }
    for (RepositoryDefinition rd : data) {
        RowRepo r = new RowRepo();
        r.type = RepoType.valueOf(rd.getType().toUpperCase(Locale.ENGLISH));
        r.url = rd.getUrl();
        listRepo.add(r);
        for (RepositoryMapping rm : rd.getMapping()) {
            RowMapping m = new RowMapping();
            m.repoUrl = rd.getUrl();
            m.local = normalizeMapping(rm.getLocal());
            m.remote = normalizeMapping(rm.getRepository());
            m.excludes = String.join(";", rm.getExcludes());
            m.includes = String.join(";", rm.getIncludes());
            listMapping.add(m);
        }
    }
}
Also used : RepositoryDefinition(gen.core.project.RepositoryDefinition) RepositoryMapping(gen.core.project.RepositoryMapping)

Example 3 with RepositoryMapping

use of gen.core.project.RepositoryMapping in project omegat by omegat-org.

the class TestTeamIntegration method createConfig.

static ProjectProperties createConfig(String repoUrl, File dir) throws Exception {
    ProjectProperties config = new ProjectProperties(dir);
    config.setSourceLanguage(SRC_LANG);
    config.setTargetLanguage(TRG_LANG);
    RepositoryDefinition def = new RepositoryDefinition();
    if (repoUrl.startsWith("git") || repoUrl.endsWith(".git")) {
        def.setType("git");
    } else if (repoUrl.startsWith("svn") || repoUrl.startsWith("http") || repoUrl.endsWith(".svn")) {
        def.setType("svn");
    } else {
        throw new RuntimeException("Unknown repo");
    }
    def.setUrl(repoUrl);
    RepositoryMapping m = new RepositoryMapping();
    m.setLocal("");
    m.setRepository("");
    def.getMapping().add(m);
    config.setRepositories(new ArrayList<RepositoryDefinition>());
    config.getRepositories().add(def);
    return config;
}
Also used : RepositoryDefinition(gen.core.project.RepositoryDefinition) RepositoryMapping(gen.core.project.RepositoryMapping)

Example 4 with RepositoryMapping

use of gen.core.project.RepositoryMapping in project omegat by omegat-org.

the class RemoteRepositoryProviderTest method addRepo.

void addRepo(String localPath, String repoPath, String... excludes) {
    RepositoryMapping m = new RepositoryMapping();
    m.setLocal(localPath);
    m.setRepository(repoPath);
    m.getExcludes().addAll(Arrays.asList(excludes));
    RepositoryDefinition def = new RepositoryDefinition();
    def.setUrl("url");
    def.getMapping().add(m);
    repos.add(def);
    provider.repositories.add(null);
}
Also used : RepositoryDefinition(gen.core.project.RepositoryDefinition) RepositoryMapping(gen.core.project.RepositoryMapping)

Example 5 with RepositoryMapping

use of gen.core.project.RepositoryMapping in project omegat by omegat-org.

the class HTTPRemoteRepository method switchToVersion.

@Override
public void switchToVersion(String version) throws Exception {
    if (version != null) {
        throw new RuntimeException("Not supported");
    }
    Log.logDebug(LOGGER, "Update to latest");
    // retrieve all mapped files
    Properties etags = loadETags();
    for (RepositoryMapping m : config.getMapping()) {
        String url = config.getUrl() + m.getRepository();
        File out = new File(baseDirectory, m.getRepository());
        retrieve(etags, m.getRepository(), url, out);
    }
    saveETags(etags);
}
Also used : RepositoryMapping(gen.core.project.RepositoryMapping) Properties(java.util.Properties) File(java.io.File)

Aggregations

RepositoryMapping (gen.core.project.RepositoryMapping)7 RepositoryDefinition (gen.core.project.RepositoryDefinition)6 File (java.io.File)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 ProjectProperties (org.omegat.core.data.ProjectProperties)2 Cursor (java.awt.Cursor)1 List (java.util.List)1 Properties (java.util.Properties)1 ExecutionException (java.util.concurrent.ExecutionException)1 KnownException (org.omegat.core.KnownException)1 RemoteRepositoryProvider (org.omegat.core.team2.RemoteRepositoryProvider)1 NewTeamProject (org.omegat.gui.dialogs.NewTeamProject)1