vcs: do not suggest to revert changes from current changelist if modifiedWithoutEditi... phpstorm/142.3916
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Mon, 10 Aug 2015 12:04:02 +0000 (15:04 +0300)
committerAleksey Pivovarov <AMPivovarov@gmail.com>
Mon, 10 Aug 2015 12:04:02 +0000 (15:04 +0300)
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RollbackAction.java

index ba057fede2abb1f37ef3c5066a15bbb8a469279a..ca07a1675a4f9c04c24f9c619f7bdab04c62f56b 100644 (file)
@@ -134,9 +134,13 @@ public class RollbackAction extends AnAction implements DumbAware {
       });
     }
 
-    if (!changes.isEmpty() || !hasChanges) {
+    if (!changes.isEmpty()) {
       RollbackChangesDialog.rollbackChanges(project, changes);
     }
+    else if (!hasChanges) {
+      List<Change> changelistChanges = getCurrentChangelistChanges(project);
+      RollbackChangesDialog.rollbackChanges(project, changelistChanges);
+    }
   }
 
   @NotNull
@@ -158,13 +162,16 @@ public class RollbackAction extends AnAction implements DumbAware {
     if (changes != null && changes.length > 0) {
       return ContainerUtil.newArrayList(changes);
     }
+    return Collections.emptyList();
+  }
 
+  @NotNull
+  private static List<Change> getCurrentChangelistChanges(final Project project) {
     final ChangeListManager clManager = ChangeListManager.getInstance(project);
     ChangeList list = clManager.getDefaultChangeList();
     if (list != null) {
       return ContainerUtil.newArrayList(list.getChanges());
     }
-
     return Collections.emptyList();
   }