use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class CopyOptionsDialog method update.
private void update() {
RepositoryTreeNode baseNode = myBrowser.getSelectedNode();
if (baseNode == null) {
myTargetURL.setText("");
getOKAction().setEnabled(false);
return;
}
SVNURL baseURL = baseNode.getURL();
String name = myNameField.getText();
if (name == null || "".equals(name)) {
getOKAction().setEnabled(false);
return;
}
try {
baseURL = baseURL.appendPath(myNameField.getText(), false);
} catch (SVNException e) {
//
getOKAction().setEnabled(false);
return;
}
myTargetURL.setText(baseURL.toString());
getOKAction().setEnabled(!myURL.toString().equals(myTargetURL.getText()));
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class CmdHistoryClient method doLog.
@Override
public void doLog(@NotNull SvnTarget target, @NotNull SVNRevision startRevision, @NotNull SVNRevision endRevision, boolean stopOnCopy, boolean discoverChangedPaths, boolean includeMergedRevisions, long limit, @Nullable String[] revisionProperties, @Nullable LogEntryConsumer handler) throws VcsException {
// TODO: add revision properties parameter if necessary
List<String> parameters = prepareCommand(target, startRevision, endRevision, stopOnCopy, discoverChangedPaths, includeMergedRevisions, limit);
try {
CommandExecutor command = execute(myVcs, target, SvnCommandName.log, parameters, null);
// TODO: handler should be called in parallel with command execution, but this will be in other thread
// TODO: check if that is ok for current handler implementation
parseOutput(command, handler);
} catch (SVNException e) {
throw new SvnBindException(e);
}
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SyntheticWorker method removeSelf.
public void removeSelf() {
final String parentUrl;
try {
parentUrl = myUrl.removePathTail().toString();
} catch (SVNException e) {
return;
}
final List<DirectoryEntry> children = myCache.getChildren(parentUrl);
if (children == null) {
return;
}
for (Iterator<DirectoryEntry> iterator = children.iterator(); iterator.hasNext(); ) {
final DirectoryEntry entry = iterator.next();
if (myUrl.equals(entry.getUrl())) {
iterator.remove();
}
}
myCache.put(parentUrl, children);
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class CmdStatusClient method parseResult.
private void parseResult(final File path, SVNRevision revision, StatusConsumer handler, File base, Info infoBase, CommandExecutor command) throws SvnBindException {
String result = command.getOutput();
if (StringUtil.isEmptyOrSpaces(result)) {
throw new SvnBindException("Status request returned nothing for command: " + command.getCommandText());
}
try {
final SvnStatusHandler[] svnHandl = new SvnStatusHandler[1];
svnHandl[0] = createStatusHandler(revision, handler, base, infoBase, svnHandl);
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(new ByteArrayInputStream(result.trim().getBytes(CharsetToolkit.UTF8_CHARSET)), svnHandl[0]);
if (!svnHandl[0].isAnythingReported()) {
if (!SvnUtil.isSvnVersioned(myVcs, path)) {
throw new SvnBindException(SVNErrorCode.WC_NOT_DIRECTORY, "Command - " + command.getCommandText() + ". Result - " + result);
} else {
// return status indicating "NORMAL" state
// typical output would be like
// <status>
// <target path="1.txt"></target>
// </status>
// so it does not contain any <entry> element and current parsing logic returns null
PortableStatus status = new PortableStatus();
status.setFile(path);
status.setPath(path.getAbsolutePath());
status.setContentsStatus(StatusType.STATUS_NORMAL);
status.setInfoGetter(() -> createInfoGetter(null).convert(path));
try {
handler.consume(status);
} catch (SVNException e) {
throw new SvnBindException(e);
}
}
}
} catch (SvnExceptionWrapper e) {
throw new SvnBindException(e.getCause());
} catch (IOException | ParserConfigurationException e) {
throw new SvnBindException(e);
} catch (SAXException e) {
// status parsing errors are logged separately as sometimes there are parsing errors connected to terminal output handling.
// these errors primarily occur when status output is rather large.
// and status output could be large, for instance, when working copy is locked (seems that each file is listed in status output).
command.logCommand();
throw new SvnBindException(e);
}
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class ChangesChecker method gather.
public void gather(final List<Change> changes) {
final TreeMap<String, File> renames = new TreeMap<>();
final Set<String> alsoReverted = new HashSet<>();
final Map<String, FilePath> files = new HashMap<>();
for (Change change : changes) {
final ContentRevision beforeRevision = change.getBeforeRevision();
final ContentRevision afterRevision = change.getAfterRevision();
final String key = afterRevision == null ? null : FilePathsHelper.convertWithLastSeparator(afterRevision.getFile());
if (SvnRollbackEnvironment.isMoveRenameReplace(change)) {
final File beforeFile = beforeRevision.getFile().getIOFile();
renames.put(key, beforeFile);
files.put(key, afterRevision.getFile());
myCollector.markRename(beforeFile, afterRevision.getFile().getIOFile());
} else if (afterRevision != null) {
alsoReverted.add(key);
}
}
if (!renames.isEmpty()) {
final ArrayList<String> paths = new ArrayList<>(renames.keySet());
if (paths.size() > 1) {
FilterFilePathStrings.getInstance().doFilter(paths);
}
myCollector.setRenamesMap(renames);
myCollector.setAlsoReverted(alsoReverted);
for (String path : paths) {
try {
myChangeProvider.getChanges(files.get(path), true, myCollector);
} catch (SVNException e) {
myExceptions.add(new VcsException(e));
} catch (SvnBindException e) {
myExceptions.add(e);
}
}
}
for (Change change : changes) {
final ContentRevision afterRevision = change.getAfterRevision();
boolean checked = myForAdds.accept(change);
checked |= myForDeletes.accept(change);
if (!checked) {
myForEdits.add(afterRevision.getFile().getIOFile());
}
}
}
Aggregations