當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。