예제 #1
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();
   }
 }
예제 #2
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();
   }
 }
예제 #3
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();
   }
 }