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();
   }
 }
 @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();
   }
 }
 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();
   }
 }