Search in sources :

Example 1 with SubmoduleFetchException

use of jetbrains.buildServer.buildTriggers.vcs.git.submodules.SubmoduleFetchException in project teamcity-git by JetBrains.

the class GitPatchProcess method main.

public static void main(String... args) throws Exception {
    Map<String, String> properties = VcsUtil.stringToProperties(GitServerUtil.readInput());
    GitPatchProcessSettings settings = new GitPatchProcessSettings(properties);
    GitServerUtil.configureInternalProperties(settings.getInternalProperties());
    GitServerUtil.configureStreamFileThreshold(Integer.MAX_VALUE);
    GitServerUtil.configureExternalProcessLogger(settings.isDebugEnabled());
    GitServerUtil.setupMemoryMappedIndexReading();
    JSchConfigInitializer.initJSchConfig(JSch.class);
    PluginConfigImpl config = new PluginConfigImpl(new ConstantCachePaths(settings.getGitCachesDir()));
    RepositoryManager repositoryManager = new RepositoryManagerImpl(config, new MirrorManagerImpl(config, new HashCalculatorImpl(), new RemoteRepositoryUrlInvestigatorImpl()));
    GitMapFullPath mapFullPath = new GitMapFullPath(config, new RevisionsCache(config));
    VcsRootSshKeyManager sshKeyManager = new ConstantSshKeyManager(settings.getKeyBytes());
    TransportFactory transportFactory = new TransportFactoryImpl(config, sshKeyManager, settings.getGitTrustStoreProvider());
    FetcherProperties fetcherProperties = new FetcherProperties(config);
    FetchCommand fetchCommand = new FetchCommandImpl(config, transportFactory, fetcherProperties, sshKeyManager, settings.getGitTrustStoreProvider());
    GitRepoOperations repoOperations = new GitRepoOperationsImpl(config, transportFactory, sshKeyManager, fetchCommand);
    CommitLoader commitLoader = new CommitLoaderImpl(repositoryManager, repoOperations, mapFullPath, config);
    OperationContext context = new OperationContext(commitLoader, repositoryManager, settings.getRoot(), "build patch", GitProgress.NO_OP, config, null);
    OutputStream fos = new BufferedOutputStream(new FileOutputStream(settings.getPatchFile()));
    try {
        PatchBuilderImpl patchBuilder = new PatchBuilderImpl(fos);
        new GitPatchBuilder(context, patchBuilder, settings.getFromRevision(), settings.getToRevision(), settings.getCheckoutRules(), settings.isVerboseTreeWalkLog(), new PrintFile(), transportFactory).buildPatch();
        patchBuilder.close();
    } catch (Throwable t) {
        if (settings.isDebugEnabled() || isImportant(t)) {
            System.err.println(t.getMessage());
            t.printStackTrace(System.err);
        } else {
            String msg = t.getMessage();
            boolean printStackTrace = false;
            if (t instanceof SubmoduleFetchException) {
                Throwable cause = t.getCause();
                printStackTrace = cause != null && isImportant(cause);
            }
            System.err.println(msg);
            if (printStackTrace)
                t.printStackTrace(System.err);
        }
        System.exit(1);
    } finally {
        fos.close();
    }
}
Also used : SubmoduleFetchException(jetbrains.buildServer.buildTriggers.vcs.git.submodules.SubmoduleFetchException) PatchBuilderImpl(jetbrains.buildServer.vcs.patches.PatchBuilderImpl) GitRepoOperationsImpl(jetbrains.buildServer.buildTriggers.vcs.git.command.impl.GitRepoOperationsImpl) VcsRootSshKeyManager(jetbrains.buildServer.ssh.VcsRootSshKeyManager)

Aggregations

GitRepoOperationsImpl (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.GitRepoOperationsImpl)1 SubmoduleFetchException (jetbrains.buildServer.buildTriggers.vcs.git.submodules.SubmoduleFetchException)1 VcsRootSshKeyManager (jetbrains.buildServer.ssh.VcsRootSshKeyManager)1 PatchBuilderImpl (jetbrains.buildServer.vcs.patches.PatchBuilderImpl)1