SVN: repair SVN checkout, sorry
authorirengrig <Irina.Chernushina@jetbrains.com>
Fri, 26 Mar 2010 12:54:33 +0000 (15:54 +0300)
committerirengrig <Irina.Chernushina@jetbrains.com>
Fri, 26 Mar 2010 12:54:33 +0000 (15:54 +0300)
plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareProjectAction.java
plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java

index 478cd85bffcdaefb60dfd8c0b6c6b8113e760958..d7a21fc123121bd5820ddb4f947db1e4a0eae845 100644 (file)
@@ -20,8 +20,8 @@ import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.actionSystem.Presentation;
 import com.intellij.openapi.application.ApplicationNamesInfo;
-import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Ref;
@@ -114,7 +114,7 @@ public class ShareProjectAction extends BasicAction {
                 final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
 
                 final File path = new File(file.getPath());
-                if (! SvnCheckoutProvider.promptForWCopyFormat(path, project)) {
+                if (! SvnCheckoutProvider.promptForWCFormatAndSelect(path, project)) {
                   // action cancelled
                   actionStarted.set(Boolean.FALSE);
                   return;
index 07e187ddf113eefdee6b3ae4904ee3c988715445..a1847ee2b23cd0481f5918793cf7accd1bbdf585 100644 (file)
@@ -60,10 +60,12 @@ public class SvnCheckoutProvider implements CheckoutProvider {
       target.mkdirs();
     }
     final SVNException[] exception = new SVNException[1];
-
+    final String[] selectedFormat = new String[1];
     final Task.Backgroundable checkoutBackgroundTask = new Task.Backgroundable(project,
                      SvnBundle.message("message.title.check.out"), true, VcsConfiguration.getInstance(project).getCheckoutOption()) {
       public void run(@NotNull final ProgressIndicator indicator) {
+        SvnWorkingCopyFormatHolder.setPresetFormat(WorkingCopyFormat.getInstance(selectedFormat[0]));
+        
         final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
         final SVNUpdateClient client = SvnVcs.getInstance(project).createUpdateClient();
         client.setEventHandler(new CheckoutEventHandler(SvnVcs.getInstance(project), false, progressIndicator));
@@ -124,9 +126,9 @@ public class SvnCheckoutProvider implements CheckoutProvider {
     };
 
     // allow to select working copy format
-    if (! promptForWCopyFormat(target, project)) {
+    selectedFormat[0] = promptForWCopyFormat(target, project);
+    if (selectedFormat == null) {
       // cancelled
-      SvnWorkingCopyFormatHolder.setPresetFormat(null);
       return;
     }
     ProgressManager.getInstance().run(checkoutBackgroundTask);
@@ -152,14 +154,22 @@ public class SvnCheckoutProvider implements CheckoutProvider {
     }
   }
 
-  public static boolean promptForWCopyFormat(final File target, final Project project) {
+  public static boolean promptForWCFormatAndSelect(final File target, final Project project) {
+    final String result = promptForWCopyFormat(target, project);
+    if (result != null) {
+      SvnWorkingCopyFormatHolder.setPresetFormat(WorkingCopyFormat.getInstance(result));
+    }
+    return result != null;
+  }
+
+  @Nullable
+  private static String promptForWCopyFormat(final File target, final Project project) {
     String formatMode = null;
     final Ref<Boolean> wasOk = new Ref<Boolean>();
     while ((formatMode == null) && (! Boolean.FALSE.equals(wasOk.get()))) {
       formatMode = SvnFormatSelector.showUpgradeDialog(target, project, true, SvnConfiguration.UPGRADE_AUTO_16, wasOk);
-      SvnWorkingCopyFormatHolder.setPresetFormat(WorkingCopyFormat.getInstance(formatMode));
     }
-    return Boolean.TRUE.equals(wasOk.get());
+    return Boolean.TRUE.equals(wasOk.get()) ? formatMode : null;
   }
 
   public static void doExport(final Project project, final File target, final String url, final SVNDepth depth,