本文整理匯總了Java中org.eclipse.jgit.lib.Constants.HEAD屬性的典型用法代碼示例。如果您正苦於以下問題:Java Constants.HEAD屬性的具體用法?Java Constants.HEAD怎麽用?Java Constants.HEAD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jgit.lib.Constants
的用法示例。
在下文中一共展示了Constants.HEAD屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getIterator
private AbstractTreeIterator getIterator (String commit, ObjectReader or) throws IOException, GitException {
Repository repository = getRepository();
switch (commit) {
case Constants.HEAD:
return getHeadIterator(or);
case GitClient.INDEX:
return new DirCacheIterator(repository.readDirCache());
case GitClient.WORKING_TREE:
return new FileTreeIterator(repository);
default:
CanonicalTreeParser p = new CanonicalTreeParser();
p.reset(or, Utils.findCommit(repository, commit).getTree());
return p;
}
}
示例2: createResult
private GitRebaseResult createResult (RebaseResult res) {
String currHead;
Repository repository = getRepository();
File workTree = repository.getWorkTree();
try {
currHead = repository.resolve(Constants.HEAD).name();
} catch (IOException ex) {
currHead = Constants.HEAD;
}
List<File> conflicts;
if (res.getStatus() == RebaseResult.Status.STOPPED) {
conflicts = getConflicts(res.getCurrentCommit());
} else {
conflicts = Collections.<File>emptyList();
}
return getClassFactory().createRebaseResult(res, conflicts, getFailures(res), currHead);
}
示例3: getBranch
@Override
public String getBranch() {
try {
Ref head = git.getRepository().exactRef( Constants.HEAD );
String branch = git.getRepository().getBranch();
if ( head.getLeaf().getName().equals( Constants.HEAD ) ) { // if detached
return Constants.HEAD + " detached at " + branch.substring( 0, 7 );
} else {
return branch;
}
} catch ( Exception e ) {
return "";
}
}
示例4: ConflictCommand
public ConflictCommand (Repository repository, GitClassFactory gitFactory, File[] roots, ProgressMonitor monitor, StatusListener listener) {
super(repository, Constants.HEAD, roots, gitFactory, monitor, listener);
this.monitor = monitor;
this.listener = listener;
this.roots = roots;
}
示例5: getStatus
/**
* Compares working tree with a given revision and returns an array of
* statuses for files under given roots
*
* @param roots root folders or files to search under
* @param revision revision to compare with the working tree. If set
* to <code>null</code> HEAD will be used instead.
* @return status array
* @throws GitException an unexpected error occurs
* @since 1.9
*/
public Map<File, GitStatus> getStatus (File[] roots, String revision, ProgressMonitor monitor) throws GitException {
Repository repository = gitRepository.getRepository();
StatusCommand cmd = new StatusCommand(repository, revision == null ? Constants.HEAD : revision,
roots, getClassFactory(), monitor, delegateListener);
cmd.execute();
return cmd.getStatuses();
}