當前位置: 首頁>>代碼示例>>Java>>正文


Java MissingObjectException類代碼示例

本文整理匯總了Java中org.eclipse.jgit.errors.MissingObjectException的典型用法代碼示例。如果您正苦於以下問題:Java MissingObjectException類的具體用法?Java MissingObjectException怎麽用?Java MissingObjectException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MissingObjectException類屬於org.eclipse.jgit.errors包,在下文中一共展示了MissingObjectException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPaths

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private List<DiffEntry> getPaths(Repository repository, RevCommit rev)
		throws MissingObjectException, IncorrectObjectTypeException,
		IOException {
	RevCommit parent = null;
	List<DiffEntry> diffs = null;
	RevWalk rw = new RevWalk(repository);
	DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);

	df.setRepository(repository);
	df.setDiffComparator(RawTextComparator.DEFAULT);
	df.setDetectRenames(true);

	if (rev.getParentCount() > 0 && rev.getParent(0) != null) {
		parent = rw.parseCommit(rev.getParent(0).getId());
		diffs = df.scan(parent.getTree(), rev.getTree());
	} else {
		diffs = df.scan(new EmptyTreeIterator(), new CanonicalTreeParser(
				null, rw.getObjectReader(), rev.getTree()));
	}

	return diffs;
}
 
開發者ID:aserg-ufmg,項目名稱:ModularityCheck,代碼行數:23,代碼來源:GITLogHandler.java

示例2: DepthGenerator

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
/**
 * @param w
 * @param s Parent generator
 * @throws MissingObjectException
 * @throws IncorrectObjectTypeException
 * @throws IOException
 */
DepthGenerator(DepthWalk w, Generator s) throws MissingObjectException,
		IncorrectObjectTypeException, IOException {
	pending = new FIFORevQueue();
	walk = (RevWalk)w;

	this.depth = w.getDepth();
	this.UNSHALLOW = w.getUnshallowFlag();
	this.REINTERESTING = w.getReinterestingFlag();

	s.shareFreeList(pending);

	// Begin by sucking out all of the source's commits, and
	// adding them to the pending queue
	for (;;) {
		RevCommit c = s.next();
		if (c == null)
			break;
		if (((DepthWalk.Commit) c).getDepth() == 0)
			pending.add(c);
	}
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:29,代碼來源:DepthGenerator.java

示例3: next

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
@Override
public RevCommit next() throws MissingObjectException,
		IncorrectObjectTypeException, IOException {
	for (;;) {
		final RevCommit r = super.next();
		if (r == null) {
			return null;
		}
		final RevTree t = r.getTree();
		if ((r.flags & UNINTERESTING) != 0) {
			if (objectFilter.include(this, t)) {
				markTreeUninteresting(t);
			}
			if (boundary) {
				return r;
			}
			continue;
		}
		if (objectFilter.include(this, t)) {
			pendingObjects.add(t);
		}
		return r;
	}
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:25,代碼來源:ObjectWalk.java

示例4: newTreeVisit

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private TreeVisit newTreeVisit(RevObject obj) throws LargeObjectException,
		MissingObjectException, IncorrectObjectTypeException, IOException {
	TreeVisit tv = freeVisit;
	if (tv != null) {
		freeVisit = tv.parent;
		tv.ptr = 0;
		tv.namePtr = 0;
		tv.nameEnd = 0;
		tv.pathLen = 0;
	} else {
		tv = new TreeVisit();
	}
	tv.obj = obj;
	tv.buf = reader.open(obj, OBJ_TREE).getCachedBytes();
	return tv;
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:17,代碼來源:ObjectWalk.java

示例5: next

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
@Override
RevCommit next() throws MissingObjectException,
		IncorrectObjectTypeException, IOException {
	for (;;) {
		final RevCommit c = source.next();
		if (c == null)
			return null;

		boolean rewrote = false;
		final RevCommit[] pList = c.parents;
		final int nParents = pList.length;
		for (int i = 0; i < nParents; i++) {
			final RevCommit oldp = pList[i];
			final RevCommit newp = rewrite(oldp);
			if (oldp != newp) {
				pList[i] = newp;
				rewrote = true;
			}
		}
		if (rewrote)
			c.parents = cleanup(pList);

		return c;
	}
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:26,代碼來源:RewriteGenerator.java

示例6: testRemoteRepositoryHasNoCommitst

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
@Test(expected = MissingObjectException.class)
public void testRemoteRepositoryHasNoCommitst()
		throws URISyntaxException, IOException, InvalidRemoteException, TransportException, GitAPIException, NoRepositorySelected {
	gitAccess.setRepository(LOCAL_TEST_REPOSITPRY);
	final StoredConfig config = gitAccess.getRepository().getConfig();
	RemoteConfig remoteConfig = new RemoteConfig(config, "origin");
	URIish uri = new URIish(db2.getDirectory().toURI().toURL());
	remoteConfig.addURI(uri);
	remoteConfig.update(config);
	config.save();

	gitAccess.add(new FileStatus(GitChangeType.ADD, "test.txt"));
	gitAccess.commit("file test added");

	// throws missingObjectException
	db2.resolve(gitAccess.getLastLocalCommit().getName() + "^{commit}");
}
 
開發者ID:oxygenxml,項目名稱:oxygen-git-plugin,代碼行數:18,代碼來源:GitAccessPushTest.java

示例7: getRevCommit

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private RevCommit getRevCommit(RevWalk revWalk, ObjectId objectId)
		throws MissingObjectException, IOException {
	RevCommit revCommit = null;
	RevObject revObject = revWalk.parseAny(objectId);
	int type = revObject.getType();

	// 'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]
	// <tagname> [<commit> | <object>]
	//
	// <commit> | <object>
	// The object that the new tag will refer to, usually a commit.
	// Defaults to HEAD.
	//
	if (Constants.OBJ_COMMIT == type) {
		revCommit = RevCommit.class.cast(revObject);
	}
	return revCommit;
}
 
開發者ID:link-intersystems,項目名稱:GitDirStat,代碼行數:19,代碼來源:CommitRangesRevWalkConfigurer.java

示例8: buildDirCache

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private void buildDirCache(TreeWalk walk, DirCacheBuilder builder)
		throws MissingObjectException, IncorrectObjectTypeException,
		CorruptObjectException, IOException {
	while (walk.next()) {
		AbstractTreeIterator cIter = walk.getTree(0,
				AbstractTreeIterator.class);
		if (cIter == null) {
			// Not in commit, don't add to new index
			continue;
		}

		final DirCacheEntry entry = new DirCacheEntry(walk.getRawPath());
		entry.setFileMode(cIter.getEntryFileMode());
		entry.setObjectIdFromRaw(cIter.idBuffer(), cIter.idOffset());

		DirCacheIterator dcIter = walk.getTree(1, DirCacheIterator.class);
		if (dcIter != null && dcIter.idEqual(cIter)) {
			DirCacheEntry indexEntry = dcIter.getDirCacheEntry();
			entry.setLastModified(indexEntry.getLastModified());
			entry.setLength(indexEntry.getLength());
		}

		builder.add(entry);
	}
}
 
開發者ID:link-intersystems,項目名稱:GitDirStat,代碼行數:26,代碼來源:IndexUpdate.java

示例9: createAllCommitsRevWalk

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private RevWalk createAllCommitsRevWalk(CommitSelection commitSelection)
		throws IOException, MissingObjectException,
		IncorrectObjectTypeException {
	RevWalk revWalk = new RevWalk(repository);
	RefDatabase refDatabase = repository.getRefDatabase();
	Map<String, org.eclipse.jgit.lib.Ref> refs = refDatabase.getRefs("");
	for (Entry<String, Ref> entryRef : refs.entrySet()) {
		ObjectId refObject = entryRef.getValue().getObjectId();
		RevObject revObject = revWalk.parseAny(refObject);
		if (revObject instanceof RevCommit) {
			revWalk.markStart((RevCommit) revObject);
		}
	}
	revWalk.setRevFilter(new CommitSelectionRevFilter(commitSelection));
	revWalk.sort(RevSort.REVERSE);
	revWalk.sort(RevSort.TOPO, true);
	return revWalk;
}
 
開發者ID:link-intersystems,項目名稱:GitDirStat,代碼行數:19,代碼來源:RepoAssertion.java

示例10: findLastCommitInComments

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
/**
 * Gets the chronologically-last commit from a set of review comments.
 */
private RevCommit findLastCommitInComments(
    Collection<ReviewComment> collection, RevCommit defaultCommit)
    throws MissingObjectException, IncorrectObjectTypeException, IOException {
  RevCommit lastCommit = defaultCommit;
  for (ReviewComment comment : collection) {
    if (comment.getLocation() == null || comment.getLocation().getCommit() == null
        || comment.getLocation().getCommit().isEmpty()) {
      continue;
    }
    RevCommit currentCommit = resolveRevCommit(comment.getLocation().getCommit());
    if (currentCommit != null && currentCommit.getCommitTime() > lastCommit.getCommitTime()) {
      lastCommit = currentCommit;
    }
  }
  return lastCommit;
}
 
開發者ID:google,項目名稱:git-appraise-eclipse,代碼行數:20,代碼來源:AppraiseGitReviewClient.java

示例11: load

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private Text load(ObjectId tree, String path)
    throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException,
        IOException {
  if (path == null) {
    return Text.EMPTY;
  }
  final TreeWalk tw = TreeWalk.forPath(repo, path, tree);
  if (tw == null) {
    return Text.EMPTY;
  }
  if (tw.getFileMode(0).getObjectType() == Constants.OBJ_BLOB) {
    return new Text(repo.open(tw.getObjectId(0), Constants.OBJ_BLOB));
  } else if (tw.getFileMode(0).getObjectType() == Constants.OBJ_COMMIT) {
    String str = "Subproject commit " + ObjectId.toString(tw.getObjectId(0));
    return new Text(str.getBytes(UTF_8));
  } else {
    return Text.EMPTY;
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:20,代碼來源:PatchFile.java

示例12: loadCommitData

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private boolean loadCommitData()
    throws OrmException, RepositoryNotFoundException, IOException, MissingObjectException,
        IncorrectObjectTypeException {
  PatchSet ps = currentPatchSet();
  if (ps == null) {
    return false;
  }
  String sha1 = ps.getRevision().get();
  try (Repository repo = repoManager.openRepository(project());
      RevWalk walk = new RevWalk(repo)) {
    RevCommit c = walk.parseCommit(ObjectId.fromString(sha1));
    commitMessage = c.getFullMessage();
    commitFooters = c.getFooterLines();
    author = c.getAuthorIdent();
    committer = c.getCommitterIdent();
    parentCount = c.getParentCount();
  }
  return true;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:20,代碼來源:ChangeData.java

示例13: includedIn

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
/** Resolves which tip refs include the target commit. */
private Set<String> includedIn(Collection<RevCommit> tips, int limit)
    throws IOException, MissingObjectException, IncorrectObjectTypeException {
  Set<String> result = new HashSet<>();
  for (RevCommit tip : tips) {
    boolean commitFound = false;
    rw.resetRetain(RevFlag.UNINTERESTING, containsTarget);
    rw.markStart(tip);
    for (RevCommit commit : rw) {
      if (commit.equals(target) || commit.has(containsTarget)) {
        commitFound = true;
        tip.add(containsTarget);
        result.addAll(commitToRef.get(tip));
        break;
      }
    }
    if (!commitFound) {
      rw.markUninteresting(tip);
    } else if (0 < limit && limit < result.size()) {
      break;
    }
  }
  return result;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:25,代碼來源:IncludedInResolver.java

示例14: checkIfCommitIsPresentAtBranch

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
/**
 * It checks if the commit is present on branch logs. If not it throws a {@link GitException}
 * @param git The git repository
 * @param branch The branch where it is going to do the search
 * @param startCommitString The commit it needs to find
 * @throws {@link GitException} when it cannot find the commit in that branch
 */
private RevCommit checkIfCommitIsPresentAtBranch(final GitImpl git,
                                                 final String branch,
                                                 final String startCommitString) {

    try {
        final ObjectId id = git.getRef(branch).getObjectId();
        final Spliterator<RevCommit> log = git._log().add(id).call().spliterator();
        return stream(log,
                      false)
                .filter((elem) -> elem.getName().equals(startCommitString))
                .findFirst().orElseThrow(() -> new GitException("Commit is not present at branch " + branch));
    } catch (GitAPIException | MissingObjectException | IncorrectObjectTypeException e) {
        throw new GitException("A problem occurred when trying to get commit list",
                               e);
    }
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:24,代碼來源:Squash.java

示例15: getFirstCommits

import org.eclipse.jgit.errors.MissingObjectException; //導入依賴的package包/類
private List<RevCommit> getFirstCommits(Git git, ObjectId objectId, String path, int length)
    throws MissingObjectException, IncorrectObjectTypeException, NoHeadException, GitAPIException {
  LogCommand command = git.log();
  if (objectId != null) {
    command.add(objectId);
  }
  if (StringUtils.isNotBlank(path)) {
    command.addPath(path);
  }
  Iterator<RevCommit> iterator = command.setMaxCount(length).call().iterator();
  List<RevCommit> list = new ArrayList<RevCommit>();
  for (int i = 0; i < length; i++) {
    if (iterator.hasNext()) {
      list.add(iterator.next());
    } else {
      break;
    }
  }
      
  return list;
}
 
開發者ID:kamegu,項目名稱:git-webapp,代碼行數:22,代碼來源:GitOperation.java


注:本文中的org.eclipse.jgit.errors.MissingObjectException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。