当前位置: 首页>>代码示例>>Java>>正文


Java DiffEntry.getOldPath方法代码示例

本文整理汇总了Java中org.eclipse.jgit.diff.DiffEntry.getOldPath方法的典型用法代码示例。如果您正苦于以下问题:Java DiffEntry.getOldPath方法的具体用法?Java DiffEntry.getOldPath怎么用?Java DiffEntry.getOldPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.diff.DiffEntry的用法示例。


在下文中一共展示了DiffEntry.getOldPath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasMatchingChanges

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
private boolean hasMatchingChanges(Revision from, Revision to, PathPatternFilter filter) {
    try (RevWalk revWalk = new RevWalk(jGitRepository)) {
        final List<DiffEntry> diff =
                compareTrees(toTreeId(revWalk, from), toTreeId(revWalk, to), TreeFilter.ALL);
        for (DiffEntry e : diff) {
            final String path;
            switch (e.getChangeType()) {
            case ADD:
                path = e.getNewPath();
                break;
            case MODIFY:
            case DELETE:
                path = e.getOldPath();
                break;
            default:
                throw new Error();
            }

            if (filter.matches(path)) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:line,项目名称:centraldogma,代码行数:27,代码来源:GitRepository.java

示例2: removeSpec

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
/**
 * remove a {@link FlowSpec} for a deleted or renamed flow config
 * @param change
 */
private void removeSpec(DiffEntry change) {
  if (checkConfigFilePath(change.getOldPath())) {
    Path configFilePath = new Path(this.repositoryDir, change.getOldPath());
    String flowName = FSSpecStore.getSpecName(configFilePath);
    String flowGroup = FSSpecStore.getSpecGroup(configFilePath);

    // build a dummy config to get the proper URI for delete
    Config dummyConfig = ConfigBuilder.create()
        .addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowGroup)
        .addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowName)
        .build();

    FlowSpec spec = FlowSpec.builder()
        .withConfig(dummyConfig)
        .withVersion(SPEC_VERSION)
        .withDescription(SPEC_DESCRIPTION)
        .build();

      this.flowCatalog.remove(spec.getUri());
  }
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:26,代码来源:GitConfigMonitor.java

示例3: addCommitParents

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
private void addCommitParents(final RevWalk rw, final DiffFormatter df, final RevCommit revCommit, final GitCommit gitCommit) throws IOException {
    for (int i = 0; i < revCommit.getParentCount(); i++) {
        ObjectId parentId = revCommit.getParent(i).getId();
        RevCommit parent = rw.parseCommit(parentId);

        List<DiffEntry> diffs = df.scan(parent.getTree(), revCommit.getTree());
        for (DiffEntry diff : diffs) {
            final GitChange gitChange = new GitChange(
                    diff.getChangeType().name(),
                    diff.getOldPath(),
                    diff.getNewPath()
            );
            logger.debug(gitChange.toString());
            gitCommit.getGitChanges().add(gitChange);
        }

        String parentSha = ObjectId.toString(parentId);
        final GitCommit parentCommit = retrieveCommit(parentSha);
        gitCommit.getParents().add(parentCommit);
    }
}
 
开发者ID:kontext-e,项目名称:jqassistant-plugins,代码行数:22,代码来源:JGitScanner.java

示例4: getOldBlobIdent

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public static BlobIdent getOldBlobIdent(DiffEntry diffEntry, String oldRev) {
  	BlobIdent blobIdent;
if (diffEntry.getChangeType() != ChangeType.ADD) {
	blobIdent = new BlobIdent(oldRev, diffEntry.getOldPath(), diffEntry.getOldMode().getBits());
} else {
	blobIdent = new BlobIdent(oldRev, null, null);
}
return blobIdent;
  }
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:10,代码来源:GitUtils.java

示例5: isTouched

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
private static boolean isTouched(Set<String> touchedFilePaths, DiffEntry diffEntry) {
  String oldFilePath = diffEntry.getOldPath();
  String newFilePath = diffEntry.getNewPath();
  // One of the above file paths could be /dev/null but we need not explicitly check for this
  // value as the set of file paths shouldn't contain it.
  return touchedFilePaths.contains(oldFilePath) || touchedFilePaths.contains(newFilePath);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:PatchListLoader.java

示例6: getEditsDueToRebase

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
private static Set<ContextAwareEdit> getEditsDueToRebase(
    Multimap<String, ContextAwareEdit> editsDueToRebasePerFilePath, DiffEntry diffEntry) {
  if (editsDueToRebasePerFilePath.isEmpty()) {
    return ImmutableSet.of();
  }

  String filePath = diffEntry.getNewPath();
  if (diffEntry.getChangeType() == ChangeType.DELETE) {
    filePath = diffEntry.getOldPath();
  }
  return ImmutableSet.copyOf(editsDueToRebasePerFilePath.get(filePath));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:13,代码来源:PatchListLoader.java

示例7: updateViewFor

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
public void updateViewFor(FileDiff fileDiff) {
    DiffEntry diffEntry = fileDiff.getDiffEntry();
    int changeTypeIcon = diff_changetype_modify;
    String filename = diffEntry.getNewPath();
    switch (diffEntry.getChangeType()) {
        case ADD:
            changeTypeIcon = diff_changetype_add;
            break;
        case DELETE:
            changeTypeIcon = diff_changetype_delete;
            filename = diffEntry.getOldPath();
            break;
        case MODIFY:
            changeTypeIcon = diff_changetype_modify;
            break;
        case RENAME:
            changeTypeIcon = diff_changetype_rename;
            filename = filePathDiffer.diff(diffEntry.getOldPath(), diffEntry.getNewPath());
            break;
        case COPY:
            changeTypeIcon = diff_changetype_add;
            break;
    }

    filePathTextView.setText(filename);
    changeTypeImageView.setImageResource(changeTypeIcon);
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:28,代码来源:FileHeaderViewHolder.java

示例8: getChangesForCommitedFiles

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
private List<Change> getChangesForCommitedFiles(String hash) throws IOException {
	RevWalk revWalk = new RevWalk(git.getRepository());
	RevCommit commit = revWalk.parseCommit(ObjectId.fromString(hash));

	if (commit.getParentCount() > 1) {
		revWalk.close();
		return new ArrayList<Change>();
	}

	RevCommit parentCommit = commit.getParentCount() > 0
			? revWalk.parseCommit(ObjectId.fromString(commit.getParent(0).getName()))
					: null;

			DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
			df.setBinaryFileThreshold(2048);
			df.setRepository(git.getRepository());
			df.setDiffComparator(RawTextComparator.DEFAULT);
			df.setDetectRenames(true);

			List<DiffEntry> diffEntries = df.scan(parentCommit, commit);
			df.close();
			revWalk.close();

			List<Change> changes = new ArrayList<Change>();
			for (DiffEntry entry : diffEntries) {
				Change change = new Change(entry.getNewPath(), entry.getOldPath(), 0, 0,
						ChangeType.valueOf(entry.getChangeType().name()));
				analyzeDiff(change, entry);
				changes.add(change);
			}

			return changes;
}
 
开发者ID:visminer,项目名称:repositoryminer,代码行数:34,代码来源:GitSCM.java

示例9: getRenamedPath

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
/**
 *
 * Based on http://stackoverflow.com/a/11504177/2246865 by OneWorld
 *
 * @param follow
 * @param start
 * @param path
 * @return
 * @throws IOException
 * @throws GitAPIException
 */
private String getRenamedPath(
        boolean follow,
        RevCommit start,
        String path)
        throws IOException, GitAPIException {
    if (!follow) {
        return null;
    }

    Iterable<RevCommit> allCommitsLater = git.log().add(start).call();

    for (RevCommit commit : allCommitsLater) {
        TreeWalk tw = new TreeWalk(repository);
        tw.addTree(commit.getTree());
        tw.addTree(start.getTree());
        tw.setRecursive(true);
        RenameDetector rd = new RenameDetector(repository);
        rd.addAll(DiffEntry.scan(tw));
        List<DiffEntry> files = rd.compute();

        for (DiffEntry deffE : files) {
            if ((deffE.getChangeType() == DiffEntry.ChangeType.RENAME
                    || deffE.getChangeType() == DiffEntry.ChangeType.COPY)
                    && deffE.getNewPath().contains(path)) {
                return deffE.getOldPath();
            }
        }
    }

    return null;
}
 
开发者ID:hurik,项目名称:JGeagle,代码行数:43,代码来源:JGit.java

示例10: createDiffInfo

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
protected DiffInfo createDiffInfo(DiffEntry diffEntry, String diff) {
    return new DiffInfo(diffEntry.getChangeType(), diffEntry.getNewPath(), toInt(diffEntry.getNewMode()), diffEntry.getOldPath(), toInt(diffEntry.getOldMode()), diff);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:4,代码来源:RepositoryResource.java

示例11: format

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
@Override
public void format(DiffEntry ent) throws IOException {
	currentPath = diffStat.addPath(ent);
	nofLinesCurrent = 0;
	isOff = false;
	entry = ent;
	if (!truncated) {
		totalNofLinesPrevious = totalNofLinesCurrent;
		if (globalDiffLimit > 0 && totalNofLinesPrevious > globalDiffLimit) {
			truncated = true;
			isOff = true;
		}
		truncateTo = os.size();
	} else {
		isOff = true;
	}
	if (truncated) {
		skipped.add(ent);
	} else {
		// Produce a header here and now
		String path;
		String id;
		if (ChangeType.DELETE.equals(ent.getChangeType())) {
			path = ent.getOldPath();
			id = ent.getOldId().name();
		} else {
			path = ent.getNewPath();
			id = ent.getNewId().name();
		}
		StringBuilder sb = new StringBuilder(MessageFormat.format(
				"<div class='header'><div class=\"diffHeader\" id=\"n{0}\"><i class=\"icon-file\"></i> ", id));
		sb.append(StringUtils.escapeForHtml(path, false)).append("</div></div>");
		sb.append("<div class=\"diff\"><table cellpadding='0'><tbody>\n");
		os.write(sb.toString().getBytes());
	}
	// Keep formatting, but if off, don't produce anything anymore. We just keep on counting.
	super.format(ent);
	if (!truncated) {
		// Close the table
		os.write("</tbody></table></div>\n".getBytes());
	}
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:43,代码来源:GitBlitDiffFormatter.java

示例12: getOldPath

import org.eclipse.jgit.diff.DiffEntry; //导入方法依赖的package包/类
@JavascriptInterface
public String getOldPath(int index) {
    DiffEntry diff = mDiffEntries.get(index);
    String op = diff.getOldPath();
    return op;
}
 
开发者ID:sheimi,项目名称:SGit,代码行数:7,代码来源:CommitDiffActivity.java


注:本文中的org.eclipse.jgit.diff.DiffEntry.getOldPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。