private void cherryPick(final JGitPathImpl source, final JGitPathImpl target, final String... commits) { try { target.getFileSystem().lock(); source.getFileSystem().getGit().cherryPick(target, commits); } finally { target.getFileSystem().unlock(); } }
private void merge(final JGitPathImpl source, final JGitPathImpl target) { try { target.getFileSystem().lock(); source.getFileSystem().getGit().merge(source.getRefTree(), target.getRefTree()); } finally { target.getFileSystem().unlock(); } }
private void createBranch(final JGitPathImpl source, final JGitPathImpl target) { try { target.getFileSystem().lock(); source.getFileSystem().getGit().createRef(source.getRefTree(), target.getRefTree()); } finally { target.getFileSystem().unlock(); } }
public void deleteBranch(final JGitPathImpl path) { final Ref branch = path.getFileSystem().getGit().getRef(path.getRefTree()); if (branch == null) { throw new NoSuchFileException(path.toString()); } try { path.getFileSystem().lock(); path.getFileSystem().getGit().deleteRef(branch); } finally { path.getFileSystem().unlock(); } }
public boolean deleteBranchIfExists(final JGitPathImpl path) { final Ref branch = getBranch(path.getFileSystem().gitRepo(), path.getRefTree()); if (branch == null) { return false; } JGitUtil.deleteBranch(path.getFileSystem().gitRepo(), branch); return true; }
@Override public BasicFileAttributes readAttributes() throws IOException { if (attrs == null) { attrs = buildAttrs(path.getFileSystem(), path.getRefTree(), path.getPath()); } return attrs; }
@Override public HiddenAttributes readAttributes() throws IOException { if (attrs == null) { attrs = buildAttrs(path.getFileSystem(), path.getRefTree(), path.getPath()); } return attrs; }
@Override public VersionAttributes readAttributes() throws IOException { if (attrs == null) { attrs = buildAttrs(path.getFileSystem(), path.getRefTree(), path.getPath()); } return attrs; }
public boolean isRegularFile() throws IllegalAccessError, SecurityException { try { return getFileSystem().provider().readAttributes(this, BasicFileAttributes.class).isRegularFile(); } catch (IOException ioe) { } return false; }
public void deleteBranch(final JGitPathImpl path) { final Ref branch = getBranch(path.getFileSystem().gitRepo(), path.getRefTree()); if (branch == null) { throw new NoSuchFileException(path.toString()); } JGitUtil.deleteBranch(path.getFileSystem().gitRepo(), branch); }
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); } }
private void removeSpaceDirectory(final Space space) { final URI configPathURI = URI.create(SpacesAPI.resolveConfigFileSystemPath(SpacesAPI.Scheme.DEFAULT, space.getName())); final Path configPath = ioService.get(configPathURI); final JGitPathImpl configGitPath = (JGitPathImpl) configPath; final File spacePath = configGitPath.getFileSystem().getGit().getRepository().getDirectory().getParentFile().getParentFile(); ioService.delete(configPath.getFileSystem().getPath("")); spacePath.delete(); }
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); } }
@Override public FileStore getFileStore(final Path path) throws IOException, SecurityException { checkNotNull("path", path); return new JGitFileStore(toPathImpl(path).getFileSystem().gitRepo().getRepository()); }
@Override public FileStore getFileStore(final Path path) throws IOException, SecurityException { checkNotNull("path", path); return new JGitFileStore(toPathImpl(path).getFileSystem().getGit().getRepository()); }
@Override public InputStream newInputStream(final Path path, final OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, NoSuchFileException, IOException, SecurityException { checkNotNull("path", path); final JGitPathImpl gPath = toPathImpl(path); return resolveInputStream(gPath.getFileSystem().gitRepo(), gPath.getRefTree(), gPath.getPath()); }
@Override public InputStream newInputStream(final Path path, final OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException { checkNotNull("path", path); final JGitPathImpl gPath = toPathImpl(path); return gPath.getFileSystem().getGit().blobAsInputStream(gPath.getRefTree(), gPath.getPath()); }
@Override public void checkAccess(final Path path, final AccessMode... modes) throws UnsupportedOperationException, NoSuchFileException, AccessDeniedException, IOException, SecurityException { checkNotNull("path", path); final JGitPathImpl gPath = toPathImpl(path); final Pair<PathType, ObjectId> result = checkPath(gPath.getFileSystem().gitRepo(), gPath.getRefTree(), gPath.getPath()); if (result.getK1().equals(NOT_FOUND)) { throw new NoSuchFileException(path.toString()); } }
public boolean deleteAssetIfExists(final JGitPathImpl path) { final Pair<PathType, ObjectId> result = checkPath(path.getFileSystem().gitRepo(), path.getRefTree(), path.getPath()); if (result.getK1().equals(PathType.DIRECTORY)) { throw new DirectoryNotEmptyException(path.toString()); } if (result.getK1().equals(NOT_FOUND)) { return false; } JGitUtil.delete(path.getFileSystem().gitRepo(), path.getRefTree(), path.getPath(), null, null, "delete {" + path.getPath() + "}", null, null); return true; }
public void deleteAsset(final JGitPathImpl path) { final Pair<PathType, ObjectId> result = checkPath(path.getFileSystem().gitRepo(), path.getRefTree(), path.getPath()); if (result.getK1().equals(PathType.DIRECTORY)) { throw new DirectoryNotEmptyException(path.toString()); } if (result.getK1().equals(NOT_FOUND)) { throw new NoSuchFileException(path.toString()); } JGitUtil.delete(path.getFileSystem().gitRepo(), path.getRefTree(), path.getPath(), null, null, "delete {" + path.getPath() + "}", null, null); }