Java成员方法getinfo_Java SvnVcs.getInfo方法代碼示例

import org.jetbrains.idea.svn.SvnVcs; //導入方法依賴的package包/類

@NotNull

public MergeData loadRevisions(@NotNull final VirtualFile file) throws VcsException {

final MergeData data = new MergeData();

VcsRunnable runnable = new VcsRunnable() {

public void run() throws VcsException {

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(new File(file.getPath()));

}

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;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值