本文整理汇总了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();
}