use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.
the class CmdBrowseClient method list.
@Override
public void list(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable Depth depth, @Nullable DirectoryEntryConsumer handler) throws VcsException {
assertUrl(target);
List<String> parameters = new ArrayList<>();
CommandUtil.put(parameters, target);
CommandUtil.put(parameters, revision);
CommandUtil.put(parameters, depth);
parameters.add("--xml");
CommandExecutor command = execute(myVcs, target, SvnCommandName.list, parameters, null);
Info info = myFactory.createInfoClient().doInfo(target, revision);
try {
parseOutput(target.getURL(), command, handler, info != null ? info.getRepositoryRootURL() : null);
} catch (SVNException e) {
throw new SvnBindException(e);
}
}
use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.
the class SvnAnnotationProvider method annotateNonExisting.
private SvnRemoteFileAnnotation annotateNonExisting(Pair<SvnChangeList, FilePath> pair, VcsFileRevision revision, Info info, Charset charset, final VirtualFile current) throws VcsException, SVNException, IOException {
final File wasFile = pair.getSecond().getIOFile();
final File root = getCommonAncestor(wasFile, info.getFile());
if (root == null) {
throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
}
final String relativePath = FileUtil.getRelativePath(root.getPath(), wasFile.getPath(), File.separatorChar);
if (relativePath == null) {
throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
}
Info wcRootInfo = myVcs.getInfo(root);
if (wcRootInfo == null || wcRootInfo.getURL() == null) {
throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
}
SVNURL wasUrl = wcRootInfo.getURL();
final String[] strings = relativePath.replace('\\', '/').split("/");
for (String string : strings) {
wasUrl = wasUrl.appendPath(string, true);
}
final SVNRevision svnRevision = ((SvnRevisionNumber) revision.getRevisionNumber()).getRevision();
byte[] data = SvnUtil.getFileContents(myVcs, SvnTarget.fromURL(wasUrl), svnRevision, svnRevision);
final String contents = LoadTextUtil.getTextByBinaryPresentation(data, charset == null ? CharsetToolkit.UTF8_CHARSET : charset).toString();
final SvnRemoteFileAnnotation result = new SvnRemoteFileAnnotation(myVcs, contents, revision.getRevisionNumber(), current);
final AnnotationConsumer annotateHandler = createAnnotationHandler(ProgressManager.getInstance().getProgressIndicator(), result);
boolean calculateMergeinfo = myVcs.getSvnConfiguration().isShowMergeSourcesInAnnotate() && SvnUtil.checkRepositoryVersion15(myVcs, wasUrl.toString());
AnnotateClient client = myVcs.getFactory().createAnnotateClient();
client.annotate(SvnTarget.fromURL(wasUrl, svnRevision), SVNRevision.create(1), svnRevision, calculateMergeinfo, getLogClientOptions(myVcs), annotateHandler);
return result;
}
use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.
the class InfoCommandRepositoryProvider method get.
@Nullable
@Override
public Repository get() {
Repository result;
if (myTarget.isURL()) {
// TODO: Also could still execute info when target is url - either to use info for authentication or to just get correct repository
// TODO: url in case of "read" operations are allowed anonymously.
result = new Repository(myTarget.getURL());
} else {
Info info = myVcs.getInfo(myTarget.getFile());
result = info != null ? new Repository(info.getRepositoryRootURL()) : null;
}
return result;
}
use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.
the class SvnMergeProvider method loadRevisions.
@NotNull
public MergeData loadRevisions(@NotNull final VirtualFile file) throws VcsException {
final MergeData data = new MergeData();
VcsRunnable runnable = () -> {
File oldFile = null;
File newFile = null;
File workingFile = null;
boolean mergeCase = false;
SvnVcs vcs = SvnVcs.getInstance(myProject);
Info info = vcs.getInfo(file);
if (info != null) {
oldFile = info.getConflictOldFile();
newFile = info.getConflictNewFile();
workingFile = info.getConflictWrkFile();
mergeCase = workingFile == null || workingFile.getName().contains("working");
// for debug
if (workingFile == null) {
LOG.info("Null working file when merging text conflict for " + file.getPath() + " old file: " + oldFile + " new file: " + newFile);
}
if (mergeCase) {
// this is merge case
oldFile = info.getConflictNewFile();
newFile = info.getConflictOldFile();
workingFile = info.getConflictWrkFile();
}
data.LAST_REVISION_NUMBER = new SvnRevisionNumber(info.getRevision());
} else {
throw new VcsException("Could not get info for " + file.getPath());
}
if (oldFile == null || newFile == null || workingFile == null) {
ByteArrayOutputStream bos = getBaseRevisionContents(vcs, file);
data.ORIGINAL = bos.toByteArray();
data.LAST = bos.toByteArray();
data.CURRENT = readFile(virtualToIoFile(file));
} else {
data.ORIGINAL = readFile(oldFile);
data.LAST = readFile(newFile);
data.CURRENT = readFile(workingFile);
}
if (mergeCase) {
final ByteArrayOutputStream contents = getBaseRevisionContents(vcs, file);
if (!Arrays.equals(contents.toByteArray(), data.ORIGINAL)) {
// swap base and server: another order of merge arguments
byte[] original = data.ORIGINAL;
data.ORIGINAL = data.LAST;
data.LAST = original;
}
}
};
VcsUtil.runVcsProcessWithProgress(runnable, VcsBundle.message("multiple.file.merge.loading.progress.title"), false, myProject);
return data;
}
use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.
the class CreateBranchOrTagDialog method init.
protected void init() {
super.init();
SvnVcs vcs = SvnVcs.getInstance(myProject);
String revStr = "";
Info info = vcs.getInfo(mySrcFile);
if (info != null) {
mySrcURL = info.getURL() == null ? null : info.getURL().toString();
revStr = String.valueOf(info.getRevision());
myURL = mySrcURL;
}
if (myURL == null) {
return;
}
myWorkingCopyField.setText(mySrcFile.toString());
myRepositoryField.setText(mySrcURL);
myToURLText.setText(myURL);
myRevisionPanel.setRevisionText(revStr);
updateControls();
myWorkingCopyRadioButton.setSelected(true);
}
Aggregations