本文整理汇总了Java中org.tmatesoft.svn.core.wc2.SvnTarget类的典型用法代码示例。如果您正苦于以下问题:Java SvnTarget类的具体用法?Java SvnTarget怎么用?Java SvnTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SvnTarget类属于org.tmatesoft.svn.core.wc2包,在下文中一共展示了SvnTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copy
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void copy(@NotNull SvnTarget source,
@NotNull File destination,
@Nullable SVNRevision revision,
boolean makeParents,
@Nullable ProgressTracker handler) throws VcsException {
SVNCopyClient client = myVcs.getSvnKitManager().createCopyClient();
client.setEventHandler(toEventHandler(handler));
try {
client.doCopy(new SVNCopySource[]{createCopySource(source, revision)}, destination, false, makeParents, true);
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例2: upgrade
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ProgressTracker handler) throws VcsException {
validateFormat(format, getSupportedFormats());
// fake event indicating upgrade start
callHandler(handler, createEvent(path, EventAction.UPDATE_COMPLETED));
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, path);
// TODO: Add general possibility to invoke "handler.checkCancelled" (process should be killed). But currently upgrade process is not
// TODO: cancellable from UI - and this makes sense.
// for 1.8 - no output
// for 1.7 - output in format "Upgraded '<path>'"
FileStatusResultParser parser = new FileStatusResultParser(CHANGED_PATH, handler, new UpgradeStatusConvertor());
UpgradeLineCommandListener listener = new UpgradeLineCommandListener(parser);
execute(myVcs, SvnTarget.fromFile(path), SvnCommandName.upgrade, parameters, listener);
listener.throwIfException();
}
示例3: runCommit
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@NotNull
private CommitInfo[] runCommit(@NotNull List<File> paths, @NotNull String message) throws VcsException {
if (ContainerUtil.isEmpty(paths)) return new CommitInfo[]{CommitInfo.EMPTY};
Command command = newCommand(SvnCommandName.ci);
command.put(Depth.EMPTY);
command.put("-m", message);
// TODO: seems that sort is not necessary here
ContainerUtil.sort(paths);
command.setTargets(paths);
IdeaCommitHandler handler = new IdeaCommitHandler(ProgressManager.getInstance().getProgressIndicator());
CmdCheckinClient.CommandListener listener = new CommandListener(handler);
listener.setBaseDirectory(CommandUtil.requireExistingParent(paths.get(0)));
execute(myVcs, SvnTarget.fromFile(paths.get(0)), null, command, listener);
listener.throwExceptionIfOccurred();
long revision = validateRevisionNumber(listener.getCommittedRevision());
return new CommitInfo[]{new CommitInfo.Builder().setRevision(revision).build()};
}
示例4: doStatus
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public long doStatus(@NotNull final File path,
@Nullable final SVNRevision revision,
@NotNull final Depth depth,
boolean remote,
boolean reportAll,
boolean includeIgnored,
boolean collectParentExternals,
@NotNull final StatusConsumer handler,
@Nullable final Collection changeLists) throws SvnBindException {
File base = CommandUtil.requireExistingParent(path);
final Info infoBase = myFactory.createInfoClient().doInfo(base, revision);
List<String> parameters = new ArrayList<String>();
putParameters(parameters, path, depth, remote, reportAll, includeIgnored, changeLists);
CommandExecutor command = execute(myVcs, SvnTarget.fromFile(path), SvnCommandName.st, parameters, null);
parseResult(path, revision, handler, base, infoBase, command);
return 0;
}
示例5: annotate
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void annotate(@NotNull SvnTarget target,
@NotNull SVNRevision startRevision,
@NotNull SVNRevision endRevision,
boolean includeMergedRevisions,
@Nullable DiffOptions diffOptions,
@Nullable AnnotationConsumer handler) throws VcsException {
try {
SVNLogClient client = myVcs.getSvnKitManager().createLogClient();
client.setDiffOptions(toDiffOptions(diffOptions));
if (target.isFile()) {
client
.doAnnotate(target.getFile(), target.getPegRevision(), startRevision, endRevision, true, includeMergedRevisions,
toAnnotateHandler(handler), null);
}
else {
client
.doAnnotate(target.getURL(), target.getPegRevision(), startRevision, endRevision, true, includeMergedRevisions,
toAnnotateHandler(handler), null);
}
}
catch (SVNException e) {
throw new VcsException(e);
}
}
示例6: annotate
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void annotate(@NotNull SvnTarget target,
@NotNull SVNRevision startRevision,
@NotNull SVNRevision endRevision,
boolean includeMergedRevisions,
@Nullable DiffOptions diffOptions,
@Nullable final AnnotationConsumer handler) throws VcsException {
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, target);
CommandUtil.put(parameters, startRevision, endRevision);
CommandUtil.put(parameters, includeMergedRevisions, "--use-merge-history");
CommandUtil.put(parameters, diffOptions);
parameters.add("--xml");
CommandExecutor command = execute(myVcs, target, SvnCommandName.blame, parameters, null);
parseOutput(command.getOutput(), handler);
}
示例7: doLog
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
private void doLog(final boolean includeMerged, final SVNRevision truncateTo, final int max) throws VcsException {
myClient.doLog(SvnTarget.fromFile(myIoFile), myEndRevision, truncateTo == null ? SVNRevision.create(1L) : truncateTo,
false, false, includeMerged, max, null,
new LogEntryConsumer() {
@Override
public void consume(LogEntry logEntry) {
if (SVNRevision.UNDEFINED.getNumber() == logEntry.getRevision()) {
return;
}
if (myProgress != null) {
myProgress.checkCanceled();
myProgress.setText2(SvnBundle.message("progress.text2.revision.processed", logEntry.getRevision()));
}
myResult.setRevision(logEntry.getRevision(), new SvnFileRevision(myVcs, SVNRevision.UNDEFINED, logEntry, myUrl, ""));
}
});
}
示例8: editFiles
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
public void editFiles(VirtualFile[] files) throws VcsException {
File[] ioFiles = new File[files.length];
for (int i = 0; i < files.length; i++) {
ioFiles[i] = new File(files[i].getPath());
PropertyClient client = myVCS.getFactory(ioFiles[i]).createPropertyClient();
PropertyValue property = client.getProperty(SvnTarget.fromFile(ioFiles[i], SVNRevision.WORKING), SvnPropertyKeys.SVN_NEEDS_LOCK,
false, SVNRevision.WORKING);
if (property == null) {
throw new VcsException(SvnBundle.message("exception.text.file.miss.svn", ioFiles[i].getName()));
}
}
SvnUtil.doLockFiles(myVCS.getProject(), myVCS, ioFiles);
}
示例9: revert
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void revert(@NotNull Collection<File> paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException {
if (!ContainerUtil.isEmpty(paths)) {
Command command = newCommand(SvnCommandName.revert);
command.put(depth);
command.setTargets(paths);
// 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
// TODO: add possibility to invoke "handler.checkCancelled" - process should be killed
SvnTarget target = SvnTarget.fromFile(ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(paths)));
CommandExecutor executor = execute(myVcs, target, CommandUtil.getHomeDirectory(), command, null);
FileStatusResultParser parser = new FileStatusResultParser(CHANGED_PATH, handler, new RevertStatusConvertor());
parser.parse(executor.getOutput());
}
}
示例10: copy
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void copy(@NotNull SvnTarget source,
@NotNull File destination,
@Nullable SVNRevision revision,
boolean makeParents,
@Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, source);
CommandUtil.put(parameters, destination);
CommandUtil.put(parameters, revision);
CommandUtil.put(parameters, makeParents, "--parents");
File workingDirectory = CommandUtil.getHomeDirectory();
BaseUpdateCommandListener listener = new BaseUpdateCommandListener(workingDirectory, handler);
execute(myVcs, source, workingDirectory, SvnCommandName.copy, parameters, listener);
listener.throwWrappedIfException();
}
示例11: export
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void export(@NotNull SvnTarget from,
@NotNull File to,
@Nullable SVNRevision revision,
@Nullable Depth depth,
@Nullable String nativeLineEnd,
boolean force,
boolean ignoreExternals,
@Nullable ProgressTracker handler) throws VcsException {
SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();
client.setEventHandler(toEventHandler(handler));
client.setIgnoreExternals(ignoreExternals);
try {
if (from.isFile()) {
client.doExport(from.getFile(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
}
else {
client.doExport(from.getURL(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
}
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例12: list
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void list(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
@Nullable Depth depth,
@Nullable DirectoryEntryConsumer handler) throws VcsException {
assertUrl(target);
SVNLogClient client = getLogClient();
ISVNDirEntryHandler wrappedHandler = wrapHandler(handler);
client.setIgnoreExternals(true);
try {
if (target.isFile()) {
client.doList(target.getFile(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
}
else {
client.doList(target.getURL(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
}
}
catch (SVNException e) {
throw new SvnBindException(e);
}
}
示例13: merge
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Override
public void merge(@NotNull SvnTarget source1,
@NotNull SvnTarget source2,
@NotNull File destination,
@Nullable Depth depth,
boolean useAncestry,
boolean dryRun,
boolean recordOnly,
boolean force,
@Nullable DiffOptions diffOptions,
@Nullable ProgressTracker handler) throws VcsException {
assertUrl(source1);
assertUrl(source2);
List<String> parameters = new ArrayList<String>();
CommandUtil.put(parameters, source1);
CommandUtil.put(parameters, source2);
fillParameters(parameters, destination, depth, dryRun, recordOnly, force, false, diffOptions);
CommandUtil.put(parameters, !useAncestry, "--ignore-ancestry");
run(destination, handler, parameters);
}
示例14: getCommitMessage
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
@Nullable
private String getCommitMessage(@NotNull File path, @NotNull Info info) {
String result;
try {
PropertyValue property =
myVcs.getFactory(path).createPropertyClient()
.getProperty(SvnTarget.fromFile(path), COMMIT_MESSAGE, true, info.getCommittedRevision());
result = PropertyValue.toString(property);
}
catch (VcsException e) {
LOG.info("Failed to get commit message for file " + path + ", " + info.getCommittedRevision() + ", " + info.getRevision(), e);
result = "";
}
return result;
}
示例15: remoteFolderIsEmpty
import org.tmatesoft.svn.core.wc2.SvnTarget; //导入依赖的package包/类
public static boolean remoteFolderIsEmpty(final SvnVcs vcs, final String url) throws VcsException {
SvnTarget target = SvnTarget.fromURL(createUrl(url));
final Ref<Boolean> result = new Ref<Boolean>(true);
DirectoryEntryConsumer handler = new DirectoryEntryConsumer() {
@Override
public void consume(final DirectoryEntry entry) throws SVNException {
if (entry != null) {
result.set(false);
}
}
};
vcs.getFactory(target).createBrowseClient().list(target, null, Depth.IMMEDIATES, handler);
return result.get();
}