本文整理匯總了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);
}
示例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());
}
示例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;
}
示例4: branch2ref
public static String branch2ref(String branch) {
return Constants.R_HEADS + branch;
}
示例5: getFullRef
public String getFullRef() {
return Constants.R_HEADS + branch;
}
示例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));
}