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


Java Constants.R_HEADS屬性代碼示例

本文整理匯總了Java中org.eclipse.jgit.lib.Constants.R_HEADS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Constants.R_HEADS屬性的具體用法?Java Constants.R_HEADS怎麽用?Java Constants.R_HEADS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.jgit.lib.Constants的用法示例。


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

示例1: run

@Override
protected void run () throws GitException {
    Repository repository = getRepository();
    
    try {
        Ref ref = repository.getRef(trackedBranchName);
        if (ref == null) {
            throw new GitException(MessageFormat.format(Utils.getBundle(SetUpstreamBranchCommand.class)
                    .getString("MSG_Error_UpdateTracking_InvalidReference"), trackedBranchName)); //NOI18N)
        }
        String remote = null;
        String branchName = ref.getName();
        StoredConfig config = repository.getConfig();
        if (branchName.startsWith(Constants.R_REMOTES)) {
            String[] elements = branchName.split("/", 4);
            remote = elements[2];
            if (config.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION).contains(remote)) {
                branchName = Constants.R_HEADS + elements[3];
                setupRebaseFlag(repository);
            } else {
                // remote not yet set
                remote = null;
            }
        }
        if (remote == null) {
            remote = "."; //NOI18N
        }
        config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName,
                ConfigConstants.CONFIG_KEY_REMOTE, remote);
        config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName,
                ConfigConstants.CONFIG_KEY_MERGE, branchName);
        config.save();
    } catch (IOException ex) {
        throw new GitException(ex);
    }
    ListBranchCommand branchCmd = new ListBranchCommand(repository, getClassFactory(), false, new DelegatingGitProgressMonitor(monitor));
    branchCmd.run();
    Map<String, GitBranch> branches = branchCmd.getBranches();
    branch = branches.get(localBranchName);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:40,代碼來源:SetUpstreamBranchCommand.java

示例2: ASFGitSCMFileSystem

/**
 * Constructor.
 *
 * @param remote the remote.
 * @param head   the head.
 * @param rev    the revision.
 */
public ASFGitSCMFileSystem(String remote, SCMHead head, SCMRevision rev) {
    super(rev instanceof AbstractGitSCMSource.SCMRevisionImpl ? rev : null);
    this.remote = remote;
    this.refOrHash = rev instanceof AbstractGitSCMSource.SCMRevisionImpl
            ? ((AbstractGitSCMSource.SCMRevisionImpl) rev).getHash()
            : (head instanceof GitTagSCMHead
                    ? Constants.R_TAGS + head.getName()
                    : Constants.R_HEADS + head.getName());
}
 
開發者ID:stephenc,項目名稱:asf-gitpubsub-jenkins-plugin,代碼行數:16,代碼來源:ASFGitSCMFileSystem.java

示例3: getDefaultTarget

/**
 * {@inheritDoc}
 */
@Override
public String getDefaultTarget(@NonNull String remote, StandardCredentials credentials)
        throws IOException, InterruptedException {
    String commitUrl = buildTemplateWithRemote("{+server}{?p}{;a}", remote)
            .set("a", "heads")
            .expand();
    Document doc = fetchDocument(commitUrl);
    Elements elements = doc.select("table.heads tr td.current_head a.name");
    if (elements.size() > 0) {
        return Constants.R_HEADS + elements.get(0).text();
    }
    return null;
}
 
開發者ID:stephenc,項目名稱:asf-gitpubsub-jenkins-plugin,代碼行數:16,代碼來源:ASFGitSCMFileSystem.java

示例4: branch2ref

public static String branch2ref(String branch) {
	return Constants.R_HEADS + branch; 
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:3,代碼來源:GitUtils.java

示例5: getFullRef

public String getFullRef() {
    return Constants.R_HEADS + branch;
}
 
開發者ID:berlam,項目名稱:github-bucket,代碼行數:3,代碼來源:Branch.java

示例6: shouldBeValid

@Test
public void shouldBeValid() throws Exception {
    Branch branch = new Branch(Constants.R_HEADS + Constants.MASTER);
    assertThat(branch.getShortRef(), is(Constants.MASTER));
    assertThat(branch.getFullRef(), is(Constants.R_HEADS + Constants.MASTER));
}
 
開發者ID:berlam,項目名稱:github-bucket,代碼行數:6,代碼來源:BranchTest.java


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