Example #1
0
 public String testConnection(@NotNull VcsRoot vcsRoot) throws VcsException {
   OperationContext context = createContext(vcsRoot, "connection test");
   TestConnectionCommand command =
       new TestConnectionCommand(this, myTransportFactory, myRepositoryManager);
   try {
     return command.testConnection(context);
   } catch (Exception e) {
     throw context.wrapException(e);
   } finally {
     context.close();
   }
 }
Example #2
0
 public Collection<VcsClientMapping> getClientMapping(
     final @NotNull VcsRoot root, final @NotNull IncludeRule rule) throws VcsException {
   final OperationContext context = createContext(root, "client-mapping");
   try {
     GitVcsRoot gitRoot = context.getGitRoot();
     URIish uri = gitRoot.getRepositoryFetchURL();
     return Collections.singletonList(
         new VcsClientMapping(
             String.format("|%s|%s", uri.toString(), rule.getFrom()), rule.getTo()));
   } finally {
     context.close();
   }
 }
Example #3
0
 @NotNull
 public Map<String, Ref> getRemoteRefs(@NotNull final VcsRoot root) throws VcsException {
   OperationContext context = createContext(root, "list remote refs");
   GitVcsRoot gitRoot = context.getGitRoot();
   try {
     Repository db = context.getRepository();
     Map<String, Ref> remoteRefs = getRemoteRefs(db, gitRoot);
     if (LOG.isDebugEnabled())
       LOG.debug("Remote refs for VCS root " + LogUtil.describe(root) + ": " + remoteRefs);
     return remoteRefs;
   } catch (Exception e) {
     throw context.wrapException(e);
   } finally {
     context.close();
   }
 }
Example #4
0
 /**
  * Expected fullPath format:
  *
  * <p>"<git revision hash>|<repository url>|<file relative path>"
  *
  * @param rootEntry indicates the association between VCS root and build configuration
  * @param fullPath change path from IDE patch
  * @return the mapped path
  */
 @NotNull
 public Collection<String> mapFullPath(
     @NotNull final VcsRootEntry rootEntry, @NotNull final String fullPath) {
   OperationContext context = createContext(rootEntry.getVcsRoot(), "map full path");
   try {
     return myMapFullPath.mapFullPath(context, rootEntry, fullPath);
   } catch (VcsException e) {
     LOG.warnAndDebugDetails(
         "Error while mapping path for root " + LogUtil.describe(rootEntry.getVcsRoot()), e);
     return Collections.emptySet();
   } catch (Throwable t) {
     LOG.error("Error while mapping path for root " + LogUtil.describe(rootEntry.getVcsRoot()), t);
     return Collections.emptySet();
   } finally {
     context.close();
   }
 }
Example #5
0
 public void buildPatch(
     @NotNull VcsRoot root,
     @Nullable String fromVersion,
     @NotNull String toVersion,
     @NotNull PatchBuilder builder,
     @NotNull CheckoutRules checkoutRules)
     throws IOException, VcsException {
   OperationContext context = createContext(root, "patch building");
   String fromRevision = fromVersion != null ? GitUtils.versionRevision(fromVersion) : null;
   String toRevision = GitUtils.versionRevision(toVersion);
   logBuildPatch(root, fromRevision, toRevision);
   GitPatchBuilderDispatcher gitPatchBuilder =
       new GitPatchBuilderDispatcher(
           myConfig, mySshKeyManager, context, builder, fromRevision, toRevision, checkoutRules);
   try {
     myCommitLoader.loadCommit(context, context.getGitRoot(), toRevision);
     gitPatchBuilder.buildPatch();
   } catch (Exception e) {
     throw context.wrapException(e);
   } finally {
     context.close();
   }
 }