public boolean isUpToDate(final Change change) { final List<File> files = ChangesUtil.getIoFilesFromChanges(Collections.singletonList(change)); synchronized (myLock) { for (File file : files) { final String path = file.getAbsolutePath(); final Pair<Boolean, VcsRoot> data = myChanged.get(path); if (data != null && Boolean.TRUE.equals(data.getFirst())) return false; } } return true; }
private boolean getAddedFilesPlaceOption() { final SvnConfiguration configuration = SvnConfiguration.getInstance(myVcs.getProject()); boolean add = Boolean.TRUE.equals(configuration.isKeepNewFilesAsIsForTreeConflictMerge()); if (configuration.isKeepNewFilesAsIsForTreeConflictMerge() != null) { return add; } if (!containAdditions(myTheirsChanges) && !containAdditions(myTheirsBinaryChanges)) { return false; } return Messages.YES == MessageDialogBuilder.yesNo( TreeConflictRefreshablePanel.TITLE, "Keep newly created file(s) in their original place?") .yesText("Keep") .noText("Move") .doNotAsk( new DialogWrapper.DoNotAskOption() { @Override public boolean isToBeShown() { return true; } @Override public void setToBeShown(boolean value, int exitCode) { if (!value) { if (exitCode == 0) { // yes configuration.setKeepNewFilesAsIsForTreeConflictMerge(true); } else { configuration.setKeepNewFilesAsIsForTreeConflictMerge(false); } } } @Override public boolean canBeHidden() { return true; } @Override public boolean shouldSaveOptionsOnCancel() { return true; } @NotNull @Override public String getDoNotShowMessage() { return CommonBundle.message("dialog.options.do.not.ask"); } }) .show(); }
public void readDirectoryMappings(final Element element) { myMappings.clear(); final List<VcsDirectoryMapping> mappingsList = new ArrayList<VcsDirectoryMapping>(); boolean haveNonEmptyMappings = false; for (Element child : element.getChildren(ELEMENT_MAPPING)) { final String vcs = child.getAttributeValue(ATTRIBUTE_VCS); if (vcs != null && !vcs.isEmpty()) { haveNonEmptyMappings = true; } VcsDirectoryMapping mapping = new VcsDirectoryMapping(child.getAttributeValue(ATTRIBUTE_DIRECTORY), vcs); mappingsList.add(mapping); Element rootSettingsElement = child.getChild(ELEMENT_ROOT_SETTINGS); if (rootSettingsElement != null) { String className = rootSettingsElement.getAttributeValue(ATTRIBUTE_CLASS); AbstractVcs vcsInstance = findVcsByName(mapping.getVcs()); if (vcsInstance != null && className != null) { final VcsRootSettings rootSettings = vcsInstance.createEmptyVcsRootSettings(); if (rootSettings != null) { try { rootSettings.readExternal(rootSettingsElement); mapping.setRootSettings(rootSettings); } catch (InvalidDataException e) { LOG.error( "Failed to load VCS root settings class " + className + " for VCS " + vcsInstance.getClass().getName(), e); } } } } } boolean defaultProject = Boolean.TRUE.toString().equals(element.getAttributeValue(ATTRIBUTE_DEFAULT_PROJECT)); // run autodetection if there's no VCS in default project and if (haveNonEmptyMappings || !defaultProject) { myMappingsLoaded = true; } myMappings.setDirectoryMappings(mappingsList); }
public void writeDirectoryMappings(final Element element) { if (myProject.isDefault()) { element.setAttribute(ATTRIBUTE_DEFAULT_PROJECT, Boolean.TRUE.toString()); } for (VcsDirectoryMapping mapping : getDirectoryMappings()) { Element child = new Element(ELEMENT_MAPPING); child.setAttribute(ATTRIBUTE_DIRECTORY, mapping.getDirectory()); child.setAttribute(ATTRIBUTE_VCS, mapping.getVcs()); final VcsRootSettings rootSettings = mapping.getRootSettings(); if (rootSettings != null) { Element rootSettingsElement = new Element(ELEMENT_ROOT_SETTINGS); rootSettingsElement.setAttribute(ATTRIBUTE_CLASS, rootSettings.getClass().getName()); try { rootSettings.writeExternal(rootSettingsElement); child.addContent(rootSettingsElement); } catch (WriteExternalException e) { // don't add element } } element.addContent(child); } }