本文整理了Java中org.guvnor.structure.repositories.Branch.getPath()
方法的一些代码示例,展示了Branch.getPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Branch.getPath()
方法的具体详情如下:
包路径:org.guvnor.structure.repositories.Branch
类名称:Branch
方法名:getPath
暂无
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend
private Branch getBranch(final Repository repository,
final Path convertedPath) {
for (final Branch branch : repository.getBranches()) {
if (branch.getPath().equals(convertedPath)) {
return branch;
}
}
return null;
}
代码示例来源:origin: kiegroup/appformer
@Override
public Optional<Branch> getBranch(Path branchRoot) {
for (final Branch branch : getBranches()) {
if (branch.getPath().equals(branchRoot)) {
return Optional.of(branch);
}
}
return Optional.empty();
}
代码示例来源:origin: org.uberfire/uberfire-project-api
/**
* Short cut for the WorkspaceProject root.
* @return The root path of the active branch.
*/
public Path getRootPath() {
return this.getBranch().getPath();
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
@Override
public WorkspaceProject resolveProject(final Space space,
final Branch branch) {
return resolveProject(space,
branch.getPath());
}
代码示例来源:origin: kiegroup/appformer
private Branch resolveBranch(final org.uberfire.java.nio.file.Path repositoryRoot,
final Repository repository) {
final Branch defaultBranch = repository.getDefaultBranch().get();
if (!Paths.convert(defaultBranch.getPath()).equals(repositoryRoot)) {
for (final Branch branch : repository.getBranches()) {
if (Paths.convert(branch.getPath()).equals(repositoryRoot)) {
return branch;
}
}
}
return defaultBranch;
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
private Branch resolveBranch(final org.uberfire.java.nio.file.Path repositoryRoot,
final Repository repository) {
final Branch defaultBranch = repository.getDefaultBranch().get();
if (!Paths.convert(defaultBranch.getPath()).equals(repositoryRoot)) {
for (final Branch branch : repository.getBranches()) {
if (Paths.convert(branch.getPath()).equals(repositoryRoot)) {
return branch;
}
}
}
return defaultBranch;
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-client
public void onArchiveActiveRepository() {
final Optional<Branch> defaultBranch = context.getActiveWorkspaceProject()
.map(proj -> proj.getRepository())
.orElseThrow(() -> new IllegalStateException("Cannot check for default branch without an active project."))
.getDefaultBranch();
if (defaultBranch.isPresent()) {
view.archive(defaultBranch.get().getPath());
}
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
public Set<Module> find() {
if (branch == null) {
return modules;
}
findModule(Paths.convert(branch.getPath()),
true);
return modules;
}
代码示例来源:origin: kiegroup/appformer
public Set<Module> find() {
if (branch == null) {
return modules;
}
findModule(Paths.convert(branch.getPath()),
true);
return modules;
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
private String getNiogitRepoPath(Repository repository) {
final Branch branch = repository.getDefaultBranch().get();
final Path path = pathUtil.convert(branch.getPath());
return pathUtil.getNiogitRepoPath(path);
}
代码示例来源:origin: kiegroup/appformer
public void add(Repository repository) {
repositoriesByAlias.put(repository.getAlias(),
repository);
if (repository.getBranches() != null) {
for (final Branch branch : repository.getBranches()) {
repositoriesByBranchRoot.put(Paths.normalizePath(branch.getPath()),
repository);
}
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend
public Module get(final OrganizationalUnit organizationalUnit,
final Repository repository) {
if (organizationalUnit == null || repository == null || !repository.getDefaultBranch().isPresent()) {
return null;
}
final Object obj = content.get(Pair.newPair(organizationalUnit.getName(),
repository.getDefaultBranch().get().getPath()).toString());
if (obj != null && obj instanceof Module) {
return (Module) obj;
}
return null;
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend
public void addModule(final OrganizationalUnit organizationalUnit,
final Repository repository,
final Module module) {
if (repository.getDefaultBranch().isPresent()) {
final String key = Pair.newPair(organizationalUnit.getName(),
repository.getDefaultBranch().get().getPath()).toString();
content.put(key,
module);
indexRepository(repository,
key);
}
}
代码示例来源:origin: kiegroup/appformer
public void onNewBranch(final @Observes NewBranchEvent event) {
for (final GuvnorStructureContextChangeHandler handler : handlers.values()) {
final Optional<Branch> branchOptional = event.getRepository().getBranch(event.getNewBranchName());
if (branchOptional.isPresent()) {
handler.onNewBranchAdded(event.getRepository().getAlias(),
event.getNewBranchName(),
branchOptional.get().getPath());
}
}
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
private void setUpMasterBranch() {
final HashSet<Module> masterBranchModules = new HashSet<>();
final Module mockModule = mockModule("legacyProject1",
legacyMasterBranchProject1RootPath);
masterBranchModules.add(mockModule);
doReturn(masterBranchModules).when(moduleService).getAllModules(legacyMasterBranch);
final Path masterRoot = mock(Path.class);
when(legacyMasterBranch.getPath()).thenReturn(masterRoot);
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
protected void cleanupOrigin(Repository repository) {
try {
// AF-1715: Cleaning origin to prevent errors while importing the new generated repo.
Git git = ((JGitPathImpl) pathUtil.convert(repository.getDefaultBranch().get().getPath())).getFileSystem().getGit();
new RemoveRemote(git,"origin",REMOTE_ORIGIN_REF).execute();
} catch (GitException e) {
log.warn("Error cleaning up origin for repository '{}': {}", repository.getAlias(), e);
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-backend
@Override
public void removeBranch(final WorkspaceProject project,
final Branch branch) {
final org.uberfire.java.nio.file.Path branchPath = pathUtil.convert(branch.getPath());
ioService.delete(branchPath);
configuredRepositories.refreshRepository(project.getRepository());
}
代码示例来源:origin: kiegroup/appformer
@Test
public void getRootPath() {
final Branch branch = mock(Branch.class);
final Path branchPath = mock(Path.class);
when(branch.getPath()).thenReturn(branchPath);
final WorkspaceProject workspaceProject = new WorkspaceProject(mock(OrganizationalUnit.class),
mock(Repository.class),
branch,
mock(Module.class));
assertEquals(branchPath,
workspaceProject.getRootPath());
}
代码示例来源:origin: kiegroup/appformer
@Override
public List<FileDiff> diff(final PullRequest pullRequest) {
final Repository repository = repositoryService.getRepositoryFromSpace(spaces.getSpace(pullRequest.getTargetSpace()), pullRequest.getTargetRepository());
this.createHiddenBranch(pullRequest);
String diff = String.format("diff:%s,%s",
pullRequest.getTargetBranch(),
this.buildHiddenBranchName(pullRequest));
final List<FileDiff> diffs = (List<FileDiff>) this.ioService.readAttributes(convert(repository.getBranch(pullRequest.getSourceBranch()).get().getPath()),
diff);
this.deleteHiddenBranch(pullRequest);
return diffs;
}
代码示例来源:origin: org.uberfire/uberfire-structure-backend
@Test
public void testBranches() throws Exception {
rootDirectories.add(createPath("default://origin@uf-playground"));
rootDirectories.add(createPath("default://master@uf-playground"));
rootDirectories.add(createPath("default://branch1@uf-playground"));
ConfigGroup configGroup = getConfigGroup();
configGroup.setName("test");
Repository repository = helper.newRepository(configGroup);
assertEquals(3,
repository.getBranches().size());
assertTrue(repository.getDefaultBranch().get().getPath().toURI().contains("master"));
}
内容来源于网络,如有侵权,请联系作者删除!