本文整理了Java中org.locationtech.geogig.model.Ref.namespace
方法的一些代码示例,展示了Ref.namespace
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ref.namespace
方法的具体详情如下:
包路径:org.locationtech.geogig.model.Ref
类名称:Ref
方法名:namespace
暂无
代码示例来源:origin: locationtech/geogig
/**
* @return the namespace for this ref, ends with a /
*/
public String namespace() {
return namespace(name);
}
代码示例来源:origin: org.locationtech.geogig/geogig-api
/**
* @return the namespace for this ref, ends with a /
*/
public String namespace() {
return namespace(name);
}
代码示例来源:origin: org.locationtech.geogig/geogig-remoting
private Ref toLocal(Ref localRemoteRef) {
final Remote remote = this.remote;
if (localRemoteRef.namespace().equals(Ref.TAGS_PREFIX)) {
return localRemoteRef;
}
final String localName = localRemoteRef.localName();
final String remoteNamespace = localRemoteRef.namespace();
final String expectedRemotePrefix = Ref.REMOTES_PREFIX + remote.getName() + "/";
Preconditions.checkArgument(remoteNamespace.equals(expectedRemotePrefix));
final String localPrefix = Ref.HEAD.equals(localName) ? "" : Ref.HEADS_PREFIX;
final String localRefName = localPrefix + localName;
Ref ref = null;
if (localRemoteRef instanceof SymRef) {
SymRef sr = (SymRef) localRemoteRef;
Ref localTarget = toLocal(new Ref(sr.getTarget(), sr.getObjectId()));
ref = new SymRef(localRefName, localTarget);
} else {
ref = new Ref(localRefName, localRemoteRef.getObjectId());
}
return ref;
}
代码示例来源:origin: org.locationtech.geogig/geogig-remoting
private Ref toRemote(Ref localRef) {
if (localRef.namespace().equals(Ref.TAGS_PREFIX)) {
return localRef;
}
checkArgument(!localRef.getName().startsWith(Ref.REMOTES_PREFIX),
"ref is already in a remotes namespace: %s", localRef);
final String remoteNamespace = Ref.REMOTES_PREFIX + remote.getName() + "/";
final String remoteRefName = remoteNamespace + localRef.localName();
Ref remoteRef;
if (localRef instanceof SymRef) {
SymRef sr = (SymRef) localRef;
String localtarget = sr.getTarget();
Ref remoteTarget = toRemote(new Ref(localtarget, sr.getObjectId()));
remoteRef = new SymRef(remoteRefName, remoteTarget);
} else {
remoteRef = new Ref(remoteRefName, localRef.getObjectId());
}
return remoteRef;
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
.setName(branch.get().namespace() + newBranchName)
.setNewValue(branch.get().getObjectId()).call();
代码示例来源:origin: locationtech/geogig
.setName(oldBranch.get().namespace() + newBranchName)
.setNewValue(oldBranch.get().getObjectId()).call();
代码示例来源:origin: locationtech/geogig
@Test
public void testLocalNameAndNamespace() {
String ref = Ref.localName(Ref.HEADS_PREFIX + "branch1");
assertEquals("branch1", ref);
ref = Ref.localName(Ref.REFS_PREFIX + "commit1");
assertEquals("commit1", ref);
ref = Ref.localName(Ref.REMOTES_PREFIX + "origin/branch1");
assertEquals("branch1", ref);
ref = Ref.localName(Ref.TAGS_PREFIX + "tag1");
assertEquals("tag1", ref);
ref = Ref.localName("ref1");
assertEquals("ref1", ref);
ref = Ref.namespace(Ref.HEADS_PREFIX + "branch1");
assertEquals(Ref.HEADS_PREFIX, ref);
ref = Ref.namespace(Ref.REFS_PREFIX + "commit1");
assertEquals(Ref.REFS_PREFIX, ref);
ref = Ref.namespace(Ref.REMOTES_PREFIX + "origin/branch1");
assertEquals(Ref.REMOTES_PREFIX + "origin/", ref);
ref = Ref.namespace(Ref.TAGS_PREFIX + "tag1");
assertEquals(Ref.TAGS_PREFIX, ref);
ref = Ref.namespace("ref1");
assertEquals("ref1", ref);
}
代码示例来源:origin: org.locationtech.geogig/geogig-web-api
if (!(branch instanceof SymRef)) {
out.writeStartArrayElement("Branch");
String namespace = branch.namespace();
String remoteName = namespace.replace(Ref.REMOTES_PREFIX, "").replace("/", "");
writeElement("remoteName", remoteName);
代码示例来源:origin: locationtech/geogig
@Test
public void testConstructor() throws Exception {
Ref testRef = new Ref(Ref.REFS_PREFIX + "commit1", oid);
assertEquals(Ref.REFS_PREFIX + "commit1", testRef.getName());
assertEquals(Ref.REFS_PREFIX, testRef.namespace());
assertEquals("commit1", testRef.localName());
assertEquals(oid, testRef.getObjectId());
}
内容来源于网络,如有侵权,请联系作者删除!