本文整理汇总了Java中com.intellij.openapi.vcs.changes.Change类的典型用法代码示例。如果您正苦于以下问题:Java Change类的具体用法?Java Change怎么用?Java Change使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Change类属于com.intellij.openapi.vcs.changes包,在下文中一共展示了Change类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_force_checkout_in_case_of_local_changes_that_would_be_overwritten_by_checkout
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
public void test_force_checkout_in_case_of_local_changes_that_would_be_overwritten_by_checkout() {
// IDEA-99849
prepareLocalChangesOverwrittenBy(myUltimate);
GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, new TestUiHandler() {
@Override
public int showSmartOperationDialog(@NotNull Project project,
@NotNull List<Change> changes,
@NotNull Collection<String> paths,
@NotNull String operation,
@Nullable String forceButton) {
return GitSmartOperationDialog.FORCE_EXIT_CODE;
}
});
brancher.checkoutNewBranchStartingFrom("new_branch", "feature", myRepositories);
assertEquals("Notification about successful branch creation is incorrect",
"Checked out new branch <b><code>new_branch</code></b> from <b><code>feature</code></b>",
myVcsNotifier.getLastNotification().getContent());
assertCurrentBranch("new_branch");
}
示例2: findRowContainingFile
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private int findRowContainingFile(@NotNull TreeNode root, @NotNull final VirtualFile toSelect) {
final Ref<Integer> row = Ref.create(-1);
TreeUtil.traverse(root, new TreeUtil.Traverse() {
@Override
public boolean accept(Object node) {
if (node instanceof DefaultMutableTreeNode) {
Object userObject = ((DefaultMutableTreeNode)node).getUserObject();
if (userObject instanceof Change) {
if (matches((Change)userObject, toSelect)) {
TreeNode[] path = ((DefaultMutableTreeNode)node).getPath();
row.set(myTree.getRowForPath(new TreePath(path)));
}
}
}
return row.get() == -1;
}
});
return row.get();
}
示例3: checkFilesAreInList
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
/**
* Updates the change list manager and checks that the given files are in the default change list.
* @param only Set this to true if you want ONLY the specified files to be in the change list.
* If set to false, the change list may contain some other files apart from the given ones.
* @param files Files to be checked.
*/
public void checkFilesAreInList(boolean only, VirtualFile... files) {
ensureUpToDate();
final Collection<Change> changes = peer.getDefaultChangeList().getChanges();
if (only) {
Assert.assertEquals(changes.size(), files.length);
}
final Collection<VirtualFile> filesInChangeList = new HashSet<VirtualFile>();
for (Change c : changes) {
filesInChangeList.add(c.getVirtualFile());
}
for (VirtualFile f : files) {
Assert.assertTrue(filesInChangeList.contains(f));
}
}
示例4: showLocalCommit
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void showLocalCommit() {
final Collection<FilePath> files = gatherChangedPaths();
// for changes to be detected, we need switch to background change list manager update thread and back to dispatch thread
// so callback is used; ok to be called after VCS update markup closed: no remote operations
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
changeListManager.invokeAfterUpdate(new Runnable() {
public void run() {
Collection<Change> changes = new ArrayList<Change>();
for (FilePath file : files) {
ContainerUtil.addIfNotNull(changes, changeListManager.getChange(file));
}
CommitChangeListDialog.commitChanges(myProject, changes, null, null, myMerger.getComment());
prepareAndShowResults();
}
}, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, myTitle,
new Consumer<VcsDirtyScopeManager>() {
public void consume(final VcsDirtyScopeManager vcsDirtyScopeManager) {
vcsDirtyScopeManager.filePathsDirty(files, null);
}
}, null);
}
示例5: testRollbackRenameDir
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Test
public void testRollbackRenameDir() throws Exception {
final VirtualFile child = prepareDirectoriesForRename();
renameFileInCommand(child, "newchild");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
changeListManager.ensureUpToDate(false);
final Change change = changeListManager.getChange(myWorkingCopyDir.findChild("newchild"));
Assert.assertNotNull(change);
final List<VcsException> exceptions = new ArrayList<VcsException>();
SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(Collections.singletonList(change), exceptions,
RollbackProgressListener.EMPTY);
Assert.assertTrue(exceptions.isEmpty());
Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "newchild").exists());
Assert.assertTrue(new File(myWorkingCopyDir.getPath(), "child").exists());
}
示例6: valueChanged
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Override
public void valueChanged(@Nullable ListSelectionEvent event) {
if (event != null && event.getValueIsAdjusting()) return;
int rows = getGraphTable().getSelectedRowCount();
if (rows < 1 || rows > MAX_SELECTED_COMMITS) {
myChangesLoadingPane.stopLoading();
myChangesBrowser.getViewer().setEmptyText(rows < 1 ? "" : "Too many commits selected.");
myChangesBrowser.setChangesToDisplay(Collections.<Change>emptyList());
}
else {
List<Change> selectedChanges = getSelectedChanges();
if (selectedChanges != null) {
myChangesLoadingPane.stopLoading();
myChangesBrowser.setChangesToDisplay(selectedChanges);
}
else {
myChangesBrowser.setChangesToDisplay(Collections.<Change>emptyList());
setDefaultEmptyText(myChangesBrowser);
myChangesLoadingPane.startLoading();
}
}
}
示例7: insertPathsChanges
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void insertPathsChanges(Map<String, Long> paths, CommittedChangeList list, long listId) throws VcsException {
final PreparedStatement insert = myConnection.getOrCreatePreparedStatement(SqliteTables.PREPARED_INSERT_PATH_2_REVS,
new ThrowableConvertor<Connection, PreparedStatement, SQLException>() {
@Override
public PreparedStatement convert(Connection connection) throws SQLException {
return connection.prepareStatement("INSERT INTO " + SqliteTables.PATHS_2_REVS.TABLE_NAME +
" ( " + StringUtil.join(Arrays.asList(SqliteTables.PATHS_2_REVS.PATH_FK, SqliteTables.PATHS_2_REVS.REVISION_FK,
SqliteTables.PATHS_2_REVS.TYPE, SqliteTables.PATHS_2_REVS.COPY_PATH_ID, SqliteTables.PATHS_2_REVS.DELETE_PATH_ID,
SqliteTables.PATHS_2_REVS.VISIBLE), " , ") +
") VALUES (?,?,?,?,?,?)", Statement.RETURN_GENERATED_KEYS);
}
});
try {
insert.setLong(2, listId);
final Collection<Change> withMoved = list.getChangesWithMovedTrees();
final Set<Change> simple = new HashSet<Change>(list.getChanges());
for (Change change : withMoved) {
insertOneChange(paths, insert, change, simple.contains(change));
}
}
catch (SQLException e) {
throw new VcsException(e);
}
}
示例8: zip
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Override
public CommittedChangeList zip(final RepositoryLocationGroup group, final List<CommittedChangeList> lists) {
if (lists.size() == 1) {
return lists.get(0);
}
final CommittedChangeList victim = ReceivedChangeList.unwrap(lists.get(0));
final ReceivedChangeList result = new ReceivedChangeList(victim);
result.setForcePartial(false);
final Set<Change> baseChanges = new HashSet<Change>();
for (CommittedChangeList list : lists) {
baseChanges.addAll(ReceivedChangeList.unwrap(list).getChanges());
final Collection<Change> changes = list.getChanges();
for (Change change : changes) {
if (! result.getChanges().contains(change)) {
result.addChange(change);
}
}
}
result.setForcePartial(baseChanges.size() != result.getChanges().size());
return result;
}
示例9: zip
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
public CommittedChangeList zip(final RepositoryLocationGroup group, final List<CommittedChangeList> lists) {
if (lists.size() == 1) {
return lists.get(0);
}
final CommittedChangeList result = lists.get(0);
for (int i = 1; i < lists.size(); i++) {
final CommittedChangeList list = lists.get(i);
for (Change change : list.getChanges()) {
final Collection<Change> resultChanges = result.getChanges();
if (! resultChanges.contains(change)) {
resultChanges.add(change);
}
}
}
return result;
}
示例10: updateChangesImpl
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private static void updateChangesImpl(final Collection<Change> changes, final ChangeWrapper wrapper) {
Collection<File> deletedOrReplaced = ContainerUtil.newHashSet();
Collection<File> toRefresh = ContainerUtil.newHashSet();
for (Change change : changes) {
if ((! wrapper.beforeNull(change)) && (wrapper.movedOrRenamedOrReplaced(change) || (wrapper.afterNull(change)))) {
deletedOrReplaced.add(wrapper.getBeforeFile(change));
} else if (!wrapper.beforeNull(change)) {
toRefresh.add(wrapper.getBeforeFile(change));
}
if ((! wrapper.afterNull(change)) &&
(wrapper.beforeNull(change) || (! Comparing.equal(change.getAfterRevision().getFile(), change.getBeforeRevision().getFile())))
) {
toRefresh.add(wrapper.getAfterFile(change));
}
}
refreshFiles(toRefresh);
refreshDeletedOrReplaced(deletedOrReplaced);
}
示例11: processIntersection
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void processIntersection(@NotNull ContinuationContext context, @NotNull Intersection intersection) {
//noinspection EnumSwitchStatementWhichMissesCases
switch (myInteraction.selectLocalChangesAction(myMergeAll)) {
case shelve:
context.next(new ShelveLocalChangesTask(myMergeContext, myInteraction, intersection));
break;
case cancel:
context.cancelEverything();
break;
case inspect:
// here's cast is due to generic's bug
@SuppressWarnings("unchecked") Collection<Change> changes = (Collection<Change>)intersection.getChangesSubset().values();
myInteraction
.showIntersectedLocalPaths(ContainerUtil.sorted(ChangesUtil.getPaths(changes), FilePathByPathComparator.getInstance()));
context.cancelEverything();
break;
}
}
示例12: testDoubleMoveBack
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Test
public void testDoubleMoveBack() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
changeListManager.ensureUpToDate(false);
final LocalChangeList list = changeListManager.addChangeList("test", null);
final LocalChangeList target = changeListManager.addChangeList("target", null);
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
myScheme.doTest(new Runnable() {
@Override
public void run() {
changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file)});
checkFilesAreInList(new VirtualFile[] {file}, target.getName(), changeListManager);
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
checkFilesAreInList(new VirtualFile[] {file}, list.getName(), changeListManager);
}
});
checkFilesAreInList(new VirtualFile[] {file}, list.getName(), changeListManager);
changeListManager.ensureUpToDate(false);
checkFilesAreInList(new VirtualFile[] {file}, list.getName(), changeListManager);
}
示例13: calculate
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void calculate() throws VcsException {
// TODO: Seems that filePath detection could be replaced with "svn info -r <revisionBefore>" - and not call
// TODO: "svn log -r HEAD:<revisionBefore>" and track copies manually (which also is not correct for all cases).
if (!searchForUrl(svnRootUrl) && !(hasAccess(repositoryUrl) && searchForUrl(repositoryUrl))) {
filePath = searchFromHead(svnRootUrl);
}
else {
if (changeList[0].getChanges().size() == 1) {
final ContentRevision afterRevision = changeList[0].getChanges().iterator().next().getAfterRevision();
filePath = afterRevision != null ? afterRevision.getFile() : filePath;
}
else {
final Change targetChange = changeList[0].getByPath(repositoryRelativeUrl);
filePath = targetChange == null ? searchFromHead(svnRootUrl) : filePath;
}
}
}
示例14: testCommitImpl
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private File testCommitImpl(File wc1) throws IOException {
Assert.assertTrue(wc1.isDirectory());
final File file = FileUtil.createTempFile(wc1, "file", ".txt");
final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
Assert.assertNotNull(vf);
final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
files.add(vf);
final List<VcsException> exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files);
Assert.assertTrue(exceptions.isEmpty());
final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf)));
final List<VcsException> commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit");
Assert.assertTrue(commit.isEmpty());
++ myExpectedCreds;
++ myExpectedCert;
return file;
}
示例15: addOrReplaceChange
import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private static void addOrReplaceChange(final List<Change> changes, final Change c) {
final ContentRevision beforeRev = c.getBeforeRevision();
// todo!!! further improvements needed
if (beforeRev != null) {
final String beforeName = beforeRev.getFile().getName();
final String beforeAbsolutePath = beforeRev.getFile().getIOFile().getAbsolutePath();
for(Change oldChange: changes) {
ContentRevision rev = oldChange.getAfterRevision();
// first compare name, which is many times faster - to remove 99% not matching
if (rev != null && (rev.getFile().getName().equals(beforeName)) && rev.getFile().getIOFile().getAbsolutePath().equals(beforeAbsolutePath)) {
changes.remove(oldChange);
if (oldChange.getBeforeRevision() != null || c.getAfterRevision() != null) {
changes.add(new Change(oldChange.getBeforeRevision(), c.getAfterRevision()));
}
return;
}
}
}
changes.add(c);
}