IDEA-65309 Supply filename to 'hg status' command.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Mon, 11 Apr 2011 12:30:20 +0000 (16:30 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Mon, 11 Apr 2011 12:30:20 +0000 (16:30 +0400)
It is a quickfix: better to supply all dirty files.

plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java

index b4a1cae8ea0a385231c002533e7b324da09b77eb..b71bd7149536db64014700b3f431eb10a84f2af3 100644 (file)
@@ -86,10 +86,10 @@ public class HgStatusCommand {
   }
 
   public Set<HgChange> execute(VirtualFile repo) {
-    return doExecute(repo, null);
+    return execute(repo, null);
   }
 
-  private Set<HgChange> doExecute(VirtualFile repo, String file) {
+  public Set<HgChange> execute(VirtualFile repo, String relativePath) {
     if (repo == null) {
       return Collections.emptySet();
     }
@@ -127,11 +127,11 @@ public class HgStatusCommand {
       }
     }
 
-    if (file != null) {
-      arguments.add(file);
+    if (relativePath != null) {
+      arguments.add(relativePath);
     }
 
-    executor.setSilent(true);
+    //executor.setSilent(true);
     HgCommandResult result = executor.executeInCurrentThread(repo, "status", arguments);
     Set<HgChange> changes = new HashSet<HgChange>();
     HgChange previous = null;
index 335eea912b0bdcb2463cb7dadd8537ef4e48e2f0..87d45cd10486a4d92752d82a4373b5881e833d37 100644 (file)
@@ -52,19 +52,19 @@ public class HgChangeProvider implements ChangeProvider {
   }
 
   public HgChangeProvider(Project project, VcsKey vcsKey) {
-    this.myProject = project;
-    this.myVcsKey = vcsKey;
+    myProject = project;
+    myVcsKey = vcsKey;
   }
 
   public void getChanges(VcsDirtyScope dirtyScope, ChangelistBuilder builder,
                          ProgressIndicator progress, ChangeListManagerGate addGate) throws VcsException {
-    final Set<VirtualFile> processedRoots = new LinkedHashSet<VirtualFile>();
     final Collection<HgChange> changes = new HashSet<HgChange>();
+
     for (FilePath filePath : dirtyScope.getRecursivelyDirtyDirectories()) {
-      changes.addAll(process(builder, filePath, processedRoots));
+      changes.addAll(process(builder, filePath));
     }
     for (FilePath filePath : dirtyScope.getDirtyFiles()) {
-      changes.addAll(process(builder, filePath, processedRoots));
+      changes.addAll(process(builder, filePath));
     }
 
     processUnsavedChanges(builder, dirtyScope.getDirtyFilesNoExpand(), changes);
@@ -78,12 +78,12 @@ public class HgChangeProvider implements ChangeProvider {
   }
 
   private Collection<HgChange> process(ChangelistBuilder builder,
-    FilePath filePath, Set<VirtualFile> processedRoots) {
+    FilePath filePath) {
     VirtualFile repo = VcsUtil.getVcsRootFor(myProject, filePath);
-    if (repo == null || processedRoots.contains(repo)) {
+    if (repo == null) {
       return new HashSet<HgChange>();
     }
-    Set<HgChange> hgChanges = new HgStatusCommand(myProject).execute(repo);
+    Set<HgChange> hgChanges = new HgStatusCommand(myProject).execute(repo, filePath.getPath());
     if (hgChanges == null || hgChanges.isEmpty()) {
       return new HashSet<HgChange>();
     }
@@ -92,7 +92,6 @@ public class HgChangeProvider implements ChangeProvider {
       new HgWorkingCopyRevisionsCommand(myProject).identify(repo),
       new HgWorkingCopyRevisionsCommand(myProject).firstParent(repo)
     );
-    processedRoots.add(repo);
     return hgChanges;
   }