Tabnine Logo
Change
Code IndexAdd Tabnine to your IDE (free)

How to use
Change
in
com.intellij.openapi.vcs.changes

Best Java code snippets using com.intellij.openapi.vcs.changes.Change (Showing top 20 results out of 315)

origin: groboclown/p4ic4idea

  private void addChange(@Nullable String changeListName, @NotNull Change change) {
    addedChanges.put(changeListName, change);
    if (change.getBeforeRevision() != null) {
      addedChangedFiles.put(changeListName, change.getBeforeRevision().getFile());
    }
    if (change.getAfterRevision() != null) {
      addedChangedFiles.put(changeListName, change.getAfterRevision().getFile());
    }
  }
}
origin: uwolfer/gerrit-intellij-plugin

private Change buildCommitMsgChange() {
  Change baseChange = Iterables.find(changesProvider.provide(base), COMMIT_MSG_CHANGE_PREDICATE);
  ContentRevision baseRevision = baseChange.getAfterRevision();
  Change change = Iterables.find(changesProvider.provide(commit), COMMIT_MSG_CHANGE_PREDICATE);
  ContentRevision revision = change.getAfterRevision();
  return new Change(baseRevision, revision);
}
origin: jshiell/checkstyle-idea

private List<VirtualFile> filesFor(final LocalChangeList changeList) {
  if (changeList == null || changeList.getChanges() == null) {
    return Collections.emptyList();
  }
  final Collection<VirtualFile> filesInChanges = new HashSet<>();
  for (Change change : changeList.getChanges()) {
    if (change.getVirtualFile() != null) {
      filesInChanges.add(change.getVirtualFile());
    }
  }
  return new ArrayList<>(filesInChanges);
}
origin: Microsoft/azure-devops-intellij

  private void setupRollbackChanges() {
    Change change1 = mock(Change.class);
    Change change2 = mock(Change.class);
    Change change3 = mock(Change.class);
    changes = ImmutableList.of(change1, change2, change3);
    ContentRevision contentRevision1 = mock(ContentRevision.class);
    ContentRevision contentRevision2 = mock(ContentRevision.class);
    ContentRevision contentRevision3 = mock(ContentRevision.class);

    when(change1.getType()).thenReturn(Change.Type.DELETED);
    when(change2.getType()).thenReturn(Change.Type.MODIFICATION);
    when(change3.getType()).thenReturn(Change.Type.NEW);

    when(contentRevision1.getFile()).thenReturn(filePath1);
    when(contentRevision2.getFile()).thenReturn(filePath2);
    when(contentRevision3.getFile()).thenReturn(filePath3);

    when(change1.getBeforeRevision()).thenReturn(contentRevision1);
    when(change2.getAfterRevision()).thenReturn(contentRevision2);
    when(change3.getAfterRevision()).thenReturn(contentRevision3);
  }
}
origin: groboclown/p4ic4idea

changes.add(new Change(beforeRevision, afterRevision));
origin: Microsoft/azure-devops-intellij

assertEquals(Change.Type.NEW, changesList.get(0).getType());
assertNull(changesList.get(0).getBeforeRevision());
assertEquals(addedFilePath1, changesList.get(0).getAfterRevision().getFile());
assertEquals(Change.Type.NEW, changesList.get(1).getType());
assertNull(changesList.get(1).getBeforeRevision());
assertEquals(addedFilePath2, changesList.get(1).getAfterRevision().getFile());
assertEquals(Change.Type.NEW, changesList.get(2).getType());
assertNull(changesList.get(2).getBeforeRevision());
assertEquals(addedFilePath3, changesList.get(2).getAfterRevision().getFile());
assertEquals(Change.Type.DELETED, changesList.get(3).getType());
assertEquals(deletedFilePath1, changesList.get(3).getBeforeRevision().getFile());
assertNull(changesList.get(3).getAfterRevision());
assertEquals(Change.Type.DELETED, changesList.get(4).getType());
assertEquals(deletedFilePath2, changesList.get(4).getBeforeRevision().getFile());
assertNull(changesList.get(4).getAfterRevision());
assertEquals(Change.Type.NEW, changesList.get(5).getType());
assertNull(changesList.get(5).getBeforeRevision());
assertEquals(renamedFilePath1, changesList.get(5).getAfterRevision().getFile());
assertEquals(Change.Type.MODIFICATION, changesList.get(6).getType());
assertEquals(editedFilePath1, changesList.get(6).getBeforeRevision().getFile());
assertEquals(editedFilePath1, changesList.get(6).getAfterRevision().getFile());
assertEquals(Change.Type.MODIFICATION, changesList.get(7).getType());
origin: uwolfer/gerrit-intellij-plugin

  private Collection<Change> getChangesWithCommitMessage(GitCommit gitCommit) {
    Collection<Change> changes = gitCommit.getChanges();

    String content = new CommitMessageFormatter(gitCommit).getLongCommitMessage();
    VirtualFile root = VirtualFileManager.getInstance().findFileByUrl("file:///");
    assert root != null;
    FilePathImpl commitMsg = new FilePathImpl(new File("/COMMIT_MSG"), false) {
      @Override
      public FileType getFileType() {
        return PlainTextFileType.INSTANCE;
      }

      @Override
      public boolean isNonLocal() {
        return true;
      }
    };

    changes.add(new Change(null, new SimpleContentRevision(
        content,
        commitMsg,
      gitCommit.getId().asString()
    )));
    return changes;
  }
}
origin: groboclown/p4ic4idea

private List<FilePath> getPathsFromChanges(final Collection<Change> changes) {
  final List<FilePath> paths = new ArrayList<>();
  for (Change change : changes) {
    if ((change.getBeforeRevision() != null) && (isUnderVcs(change.getBeforeRevision().getFile()))) {
      FilePath path = change.getBeforeRevision().getFile();
      if (!paths.contains(path)) {
        paths.add(path);
      }
    }
    if ((change.getAfterRevision() != null) && (isUnderVcs(change.getAfterRevision().getFile()))) {
      final FilePath path = change.getAfterRevision().getFile();
      if (!paths.contains(path)) {
        paths.add(path);
      }
    }
  }
  return paths;
}
origin: Microsoft/azure-devops-intellij

assertEquals(Change.Type.NEW, changes.get(0).getType());
assertNull(changes.get(0).getBeforeRevision());
assertEquals(file1.getPath(), changes.get(0).getAfterRevision().getFile().getPath());
assertEquals(Change.Type.NEW, changes.get(1).getType());
assertNull(changes.get(1).getBeforeRevision());
assertEquals(file2.getPath(), changes.get(1).getAfterRevision().getFile().getPath());
assertEquals(Change.Type.NEW, changes.get(2).getType());
assertNull(changes.get(2).getBeforeRevision());
assertEquals(file3.getPath(), changes.get(2).getAfterRevision().getFile().getPath());
assertEquals(Change.Type.NEW, changes.get(3).getType());
assertNull(changes.get(3).getBeforeRevision());
assertEquals(file8.getPath(), changes.get(3).getAfterRevision().getFile().getPath());
assertEquals(Change.Type.DELETED, changes.get(4).getType());
assertEquals(file4.getPath(), changes.get(4).getBeforeRevision().getFile().getPath());
assertNull(changes.get(4).getAfterRevision());
assertEquals(Change.Type.DELETED, changes.get(5).getType());
assertEquals(file5.getPath(), changes.get(5).getBeforeRevision().getFile().getPath());
assertNull(changes.get(5).getAfterRevision());
assertEquals(Change.Type.NEW, changes.get(6).getType());
assertNull(changes.get(6).getBeforeRevision());
assertEquals(file6.getPath(), changes.get(6).getAfterRevision().getFile().getPath());
assertEquals(Change.Type.MODIFICATION, changes.get(7).getType());
origin: groboclown/p4ic4idea

    throw new IllegalArgumentException("Unknown file action " + file.getFileAction());
return Pair.create(new Change(before, after, status), usedMovedFrom);
origin: dboissier/jenkins-control-plugin

private void fillChangedFilesList() {
  DefaultListModel model = new DefaultListModel();
  if (changeLists != null && (changeLists.length > 0)) {
    StringBuilder builder = new StringBuilder();
    int count = 1;
    for(ChangeList changeList: changeLists) {
      builder.append(changeList.getName());
      if (count < changeLists.length) {
        builder.append(", ");
      }
      if (changeList.getChanges().size() > 0) {
        for(Change change: changeList.getChanges()) {
          VirtualFile virtualFile = change.getVirtualFile();
          if (null != virtualFile) {
            model.addElement(virtualFile.getPath());
          }
        }
      }
      count++;
    }
    changedFilesPane.setBorder(IdeBorderFactory.createTitledBorder(String.format("Changelists: %s", builder.toString()), true));
  }
  changedFilesList.setModel(model);
}
origin: groboclown/p4ic4idea

private Collection<FilePath> getAffectedFiles(ClientConfigRoot clientConfigRoot, Collection<Change> changes) {
  Set<FilePath> ret = new HashSet<>();
  for (Change change : changes) {
    for (ContentRevision cr : Arrays.asList(change.getBeforeRevision(), change.getAfterRevision())) {
      if (cr != null) {
        FilePath file = cr.getFile();
        if (!ret.contains(file) && FileTreeUtil.isSameOrUnder(clientConfigRoot.getClientRootDir(), file)) {
          ret.add(cr.getFile());
        }
      }
    }
  }
  return ret;
}
origin: groboclown/p4ic4idea

assertSize(1, vcs.cacheComponent.getState().pendingActions);
assertEquals(ADD_EDIT_FILE, vcs.cacheComponent.getState().pendingActions.get(0).clientActionCmd);
Change change = new Change(null,
    new CurrentContentRevision(addedFile));
origin: uwolfer/gerrit-intellij-plugin

private String getAffectedFilePath(Change change) {
  ContentRevision afterRevision = change.getAfterRevision();
  if (afterRevision != null) {
    return afterRevision.getFile().getPath();
  }
  ContentRevision beforeRevision = change.getBeforeRevision();
  if (beforeRevision != null) {
    return beforeRevision.getFile().getPath();
  }
  return null;
}
origin: uwolfer/gerrit-intellij-plugin

  @Override
  public boolean apply(Change change) {
    String commitMsgFile = "/COMMIT_MSG";
    ContentRevision afterRevision = change.getAfterRevision();
    if (afterRevision != null) {
      return commitMsgFile.equals(PathUtils.ensureSlashSeparators(afterRevision.getFile().getPath()));
    }
    ContentRevision beforeRevision = change.getBeforeRevision();
    if (beforeRevision != null) {
      return commitMsgFile.equals(PathUtils.ensureSlashSeparators(beforeRevision.getFile().getPath()));
    }
    throw new IllegalStateException("Change should have at least one ContentRevision set.");
  }
};
origin: groboclown/p4ic4idea

private List<ServerConfig> getConfigsForChanges(Collection<Change> changes) {
  ProjectConfigRegistry registry = ProjectConfigRegistry.getInstance(project);
  if (registry == null) {
    return Collections.emptyList();
  }
  List<FilePath> files = new ArrayList<>(changes.size() * 2);
  for (Change change : changes) {
    ContentRevision before = change.getBeforeRevision();
    if (before != null) {
      files.add(before.getFile());
    }
    ContentRevision after = change.getAfterRevision();
    if (after != null) {
      files.add(after.getFile());
    }
  }
  Set<ServerConfig> configs = new HashSet<>();
  for (FilePath file : files) {
    ClientConfigRoot config = registry.getClientFor(file);
    if (config != null) {
      configs.add(config.getServerConfig());
    }
  }
  return new ArrayList<>(configs);
}
origin: groboclown/p4ic4idea

@NotNull
private static Map<ClientConfigRoot, List<FilePath>> mapChangedFilesByRoot(@NotNull ProjectConfigRegistry registry,
    @NotNull Collection<Change> changes) {
  Map<ClientConfigRoot, List<FilePath>> ret = new HashMap<>();
  for (Change change : changes) {
    {
      ContentRevision before = change.getBeforeRevision();
      if (before != null) {
        ClientConfigRoot root = registry.getClientFor(before.getFile());
        List<FilePath> paths = ret.computeIfAbsent(root, k -> new ArrayList<>());
        paths.add(before.getFile());
      }
    }
    {
      ContentRevision after = change.getAfterRevision();
      if (after != null) {
        ClientConfigRoot root = registry.getClientFor(after.getFile());
        List<FilePath> paths = ret.computeIfAbsent(root, k -> new ArrayList<>());
        paths.add(after.getFile());
      }
    }
  }
  return ret;
}
origin: groboclown/p4ic4idea

.flatMap(c -> {
  List<FilePath> files = new ArrayList<>(2);
  if (c.getBeforeRevision() != null) {
    files.add(c.getBeforeRevision().getFile());
  if (c.getAfterRevision() != null) {
    files.add(c.getAfterRevision().getFile());
origin: Microsoft/azure-devops-intellij

private void setupCommit() {
  Change change1 = mock(Change.class);
  Change change2 = mock(Change.class);
  Change change3 = mock(Change.class);
  ContentRevision contentRevision1 = mock(ContentRevision.class);
  ContentRevision contentRevision2 = mock(ContentRevision.class);
  ContentRevision contentRevision3 = mock(ContentRevision.class);
  changes = ImmutableList.of(change1, change2, change3);
  FilePath filePath1 = mock(FilePath.class);
  when(filePath1.getPath()).thenReturn("/path/to/file1");
  when(contentRevision1.getFile()).thenReturn(filePath1);
  FilePath filePath2 = mock(FilePath.class);
  when(filePath2.getPath()).thenReturn("/path/to/file2");
  when(contentRevision2.getFile()).thenReturn(filePath2);
  FilePath filePath3 = mock(FilePath.class);
  when(filePath3.getPath()).thenReturn("/path/to/file3");
  when(contentRevision3.getFile()).thenReturn(filePath3);
  when(change1.getBeforeRevision()).thenReturn(contentRevision1);
  when(change2.getBeforeRevision()).thenReturn(null);
  when(change3.getBeforeRevision()).thenReturn(null);
  when(change1.getAfterRevision()).thenReturn(null);
  when(change2.getAfterRevision()).thenReturn(contentRevision2);
  when(change3.getAfterRevision()).thenReturn(contentRevision3);
}
origin: groboclown/p4ic4idea

for (Change change : changes) {
  writeContentRevision(change.getBeforeRevision(), dataOutput);
  writeContentRevision(change.getAfterRevision(), dataOutput);
com.intellij.openapi.vcs.changesChange

Most used methods

  • getAfterRevision
  • getBeforeRevision
  • <init>
  • getVirtualFile
  • getType

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • JTable (javax.swing)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now