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


Java Constants.HEAD屬性代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ExportDiffCommand.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:RebaseCommand.java

示例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 "";
  }
}
 
開發者ID:HiromuHota,項目名稱:pdi-git-plugin,代碼行數:14,代碼來源:UIGit.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:ConflictCommand.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:GitClient.java


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