From 20808ff4b0651eb32d2bb125a7554b3d686336b4 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 11 Apr 2011 16:30:20 +0400 Subject: [PATCH] IDEA-65309 Supply filename to 'hg status' command. It is a quickfix: better to supply all dirty files. --- .../zmlx/hg4idea/command/HgStatusCommand.java | 10 +++++----- .../zmlx/hg4idea/provider/HgChangeProvider.java | 17 ++++++++--------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java index b4a1cae8ea0a..b71bd7149536 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgStatusCommand.java @@ -86,10 +86,10 @@ public class HgStatusCommand { } public Set execute(VirtualFile repo) { - return doExecute(repo, null); + return execute(repo, null); } - private Set doExecute(VirtualFile repo, String file) { + public Set 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 changes = new HashSet(); HgChange previous = null; diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java index 335eea912b0b..87d45cd10486 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java @@ -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 processedRoots = new LinkedHashSet(); final Collection changes = new HashSet(); + 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 process(ChangelistBuilder builder, - FilePath filePath, Set processedRoots) { + FilePath filePath) { VirtualFile repo = VcsUtil.getVcsRootFor(myProject, filePath); - if (repo == null || processedRoots.contains(repo)) { + if (repo == null) { return new HashSet(); } - Set hgChanges = new HgStatusCommand(myProject).execute(repo); + Set hgChanges = new HgStatusCommand(myProject).execute(repo, filePath.getPath()); if (hgChanges == null || hgChanges.isEmpty()) { return new HashSet(); } @@ -92,7 +92,6 @@ public class HgChangeProvider implements ChangeProvider { new HgWorkingCopyRevisionsCommand(myProject).identify(repo), new HgWorkingCopyRevisionsCommand(myProject).firstParent(repo) ); - processedRoots.add(repo); return hgChanges; }