1 package git4idea.changes;
3 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
4 * with the License. You may obtain a copy of the License at:
6 * http://www.apache.org/licenses/LICENSE-2.0
8 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
9 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
10 * the specific language governing permissions and limitations under the License.
12 * Copyright 2007 Decentrix Inc
13 * Copyright 2007 Aspiro AS
14 * Copyright 2008 MQSoftware
15 * Copyright 2008 JetBrains s.r.o.
16 * Authors: gevession, Erlend Simonsen & Mark Scott
18 * This code was originally derived from the MKS & Mercurial IDEA VCS plugins
21 import com.intellij.openapi.progress.ProgressIndicator;
22 import com.intellij.openapi.project.Project;
23 import com.intellij.openapi.vcs.VcsException;
24 import com.intellij.openapi.vcs.changes.*;
25 import com.intellij.openapi.vfs.VirtualFile;
26 import git4idea.GitUtil;
27 import git4idea.GitVcs;
28 import org.jetbrains.annotations.NotNull;
30 import java.util.Collection;
31 import java.util.List;
34 * Git repository change provider
36 public class GitChangeProvider implements ChangeProvider {
40 private final Project myProject;
45 * @param project a project
47 public GitChangeProvider(@NotNull Project project) {
54 public void getChanges(final VcsDirtyScope dirtyScope,
55 final ChangelistBuilder builder,
56 final ProgressIndicator progress,
57 final ChangeListManagerGate addGate) throws VcsException {
58 Collection<VirtualFile> roots = GitUtil.gitRootsForPaths(dirtyScope.getAffectedContentRoots());
59 for (VirtualFile root : roots) {
60 ChangeCollector c = new ChangeCollector(myProject, dirtyScope, root);
61 for (Change file : c.changes()) {
62 builder.processChange(file, GitVcs.getKey());
64 for (VirtualFile f : c.unversioned()) {
65 builder.processUnversionedFile(f);
73 public boolean isModifiedDocumentTrackingRequired() {
80 public void doCleanup(final List<VirtualFile> files) {