当前位置: 首页>>代码示例>>Java>>正文


Java FileUtils.delete方法代码示例

本文整理汇总了Java中org.eclipse.jgit.util.FileUtils.delete方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.delete方法的具体用法?Java FileUtils.delete怎么用?Java FileUtils.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.util.FileUtils的用法示例。


在下文中一共展示了FileUtils.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clone

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
@Override
public File clone(String branch, Set<String> checkoutFiles, ProgressMonitor monitor) throws GitException {
    checkGitUrl();

    File gitDir = getGitPath().toFile();

    // delete existing git folder since may have conflict
    if (gitDir.exists()) {
        try {
            FileUtils.delete(gitDir.getParentFile(), FileUtils.RECURSIVE);
        } catch (IOException e) {
            // IO error on delete existing folder
        }
    }

    // git init
    initGit(checkoutFiles);

    pull(branch, monitor);
    return gitDir;
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:22,代码来源:JGitBasedClient.java

示例2: deleteFS

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
private boolean deleteFS(final FileSystem fileSystem) {
    final File gitDir = ((JGitFileSystemImpl) fileSystem).getGit().getRepository().getDirectory();
    fileSystem.close();
    fileSystem.dispose();

    try {
        if (System.getProperty("os.name").toLowerCase().contains("windows")) {
            //this operation forces a cache clean freeing any lock -> windows only issue!
            WindowCache.reconfigure(new WindowCacheConfig());
        }
        FileUtils.delete(gitDir,
                         FileUtils.RECURSIVE | FileUtils.RETRY);
        return true;
    } catch (java.io.IOException e) {
        throw new IOException("Failed to remove the git repository.",
                              e);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:JGitFileSystemProvider.java

示例3: deleteRepository

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
/**
 * Deletes the repository from the file system and removes the repository
 * permission from all repository users.
 * 
 * @param repositoryName
 * @return true if successful
 */
public boolean deleteRepository(String repositoryName) {
	try {
		closeRepository(repositoryName);
		// clear the repository cache
		clearRepositoryMetadataCache(repositoryName);
		
		RepositoryModel model = removeFromCachedRepositoryList(repositoryName);
		if (model != null && !ArrayUtils.isEmpty(model.forks)) {
			resetRepositoryListCache();
		}

		File folder = new File(repositoriesFolder, repositoryName);
		if (folder.exists() && folder.isDirectory()) {
			FileUtils.delete(folder, FileUtils.RECURSIVE | FileUtils.RETRY);
			if (userService.deleteRepositoryRole(repositoryName)) {
				logger.info(MessageFormat.format("Repository \"{0}\" deleted", repositoryName));
				return true;
			}
		}
	} catch (Throwable t) {
		logger.error(MessageFormat.format("Failed to delete repository {0}", repositoryName), t);
	}
	return false;
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:32,代码来源:GitBlit.java

示例4: testAnonymousClone

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
@Test
public void testAnonymousClone() throws Exception {
	GitBlitSuite.close(ticgitFolder);
	if (ticgitFolder.exists()) {
		FileUtils.delete(ticgitFolder, FileUtils.RECURSIVE | FileUtils.RETRY);
	}

	// set push restriction
	RepositoryModel model = GitBlit.self().getRepositoryModel("ticgit.git");
	model.accessRestriction = AccessRestrictionType.PUSH;
	model.authorizationControl = AuthorizationControl.NAMED;
	GitBlit.self().updateRepositoryModel(model.name, model, false);
	
	CloneCommand clone = Git.cloneRepository();
	clone.setURI(MessageFormat.format("{0}/ticgit.git", url));
	clone.setDirectory(ticgitFolder);
	clone.setBare(false);
	clone.setCloneAllBranches(true);
	GitBlitSuite.close(clone.call());		
	assertTrue(true);
	
	// restore anonymous repository access
	model.accessRestriction = AccessRestrictionType.NONE;
	model.authorizationControl = AuthorizationControl.NAMED;
	GitBlit.self().updateRepositoryModel(model.name, model, false);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:27,代码来源:GitDaemonTest.java

示例5: testCreateRepository

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
@Test
public void testCreateRepository() throws Exception {
	String[] repositories = { "NewTestRepository.git", "NewTestRepository" };
	for (String repositoryName : repositories) {
		Repository repository = JGitUtils.createRepository(GitBlitSuite.REPOSITORIES,
				repositoryName);
		File folder = FileKey.resolve(new File(GitBlitSuite.REPOSITORIES, repositoryName),
				FS.DETECTED);
		assertNotNull(repository);
		assertFalse(JGitUtils.hasCommits(repository));
		assertNull(JGitUtils.getFirstCommit(repository, null));
		assertEquals(folder.lastModified(), JGitUtils.getFirstChange(repository, null)
				.getTime());
		assertEquals(folder.lastModified(), JGitUtils.getLastChange(repository).getTime());
		assertNull(JGitUtils.getCommit(repository, null));
		repository.close();
		RepositoryCache.close(repository);
		FileUtils.delete(repository.getDirectory(), FileUtils.RECURSIVE);
	}
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:21,代码来源:JGitUtilsTest.java

示例6: deleteWorkingFolders

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
public static void deleteWorkingFolders() throws Exception {
	if (ticgitFolder.exists()) {
		GitBlitSuite.close(ticgitFolder);
		FileUtils.delete(ticgitFolder, FileUtils.RECURSIVE);
	}
	if (ticgit2Folder.exists()) {
		GitBlitSuite.close(ticgit2Folder);
		FileUtils.delete(ticgit2Folder, FileUtils.RECURSIVE);
	}
	if (jgitFolder.exists()) {
		GitBlitSuite.close(jgitFolder);
		FileUtils.delete(jgitFolder, FileUtils.RECURSIVE);
	}
	if (jgit2Folder.exists()) {
		GitBlitSuite.close(jgit2Folder);
		FileUtils.delete(jgit2Folder, FileUtils.RECURSIVE);
	}
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:19,代码来源:GitServletTest.java

示例7: testClone

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
@Test
public void testClone() throws Exception {
	GitBlitSuite.close(ticgitFolder);
	if (ticgitFolder.exists()) {
		FileUtils.delete(ticgitFolder, FileUtils.RECURSIVE | FileUtils.RETRY);
	}
	
	CloneCommand clone = Git.cloneRepository();
	clone.setURI(MessageFormat.format("{0}/ticgit.git", url));
	clone.setDirectory(ticgitFolder);
	clone.setBare(false);
	clone.setCloneAllBranches(true);
	clone.setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password));
	GitBlitSuite.close(clone.call());		
	assertTrue(true);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:17,代码来源:GitServletTest.java

示例8: deleteBaseDirIfExists

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
private void deleteBaseDirIfExists() {
	if (this.basedir.exists()) {
		try {
			FileUtils.delete(this.basedir, FileUtils.RECURSIVE);
		}
		catch (IOException e) {
			throw new IllegalStateException("Failed to initialize base directory", e);
		}
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:11,代码来源:GitRepo.java

示例9: prepareLocalRepo

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
private static void prepareLocalRepo(String buildDir, String repoPath) throws IOException {
	File dotGit = new File(buildDir + repoPath + "/.git");
	File git = new File(buildDir + repoPath + "/git");
	if (git.exists()) {
		if (dotGit.exists()) {
			FileUtils.delete(dotGit, FileUtils.RECURSIVE);
		}
	}
	git.renameTo(dotGit);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:11,代码来源:TestUtils.java

示例10: tryDeleteRepository

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
public static void tryDeleteRepository(String remoteUrl) {
	RepositoryCache repositoryCache = Activator.getDefault().getRepositoryCache();
	Repository[] repositories = repositoryCache.getAllRepositories();
	for (Repository repository : repositories) {
		if (getRemotesUrls(repository).contains(remoteUrl)) {
			try {
				FileUtils.delete(repository.getDirectory(),
						FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING);
				FileUtils.delete(repository.getWorkTree(),
						FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING);
			} catch (IOException e) {
			}
		}
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:16,代码来源:GitTestHelper.java

示例11: closeRepository

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
@After
public void closeRepository() throws IOException {
  if(repo != null)
    repo.close();
  if(repoDir != null && repoDir.exists())
    FileUtils.delete(repoDir, FileUtils.RECURSIVE);
}
 
开发者ID:beijunyi,项目名称:ParallelGit,代码行数:8,代码来源:AbstractParallelGitTest.java

示例12: deleteRepositoryFolder

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
private void deleteRepositoryFolder() {
  try {
    if (repository.getDirectory().exists()) {
      FileUtils.delete(repository.getDirectory(), FileUtils.RECURSIVE | FileUtils.IGNORE_ERRORS);
    }
  } catch (Exception exception) {
    // Ignore the error since we want to throw the original error
    LOG.error(
        "Could not remove .git folder in path " + repository.getDirectory().getPath(), exception);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:JGitConnection.java

示例13: destroyGitFsProvider

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
@After
public void destroyGitFsProvider() throws IOException {
    if (provider == null) {
        // this would mean that setup failed. no need to clean up.
        return;
    }

    provider.shutdown();

    if (provider.getGitRepoContainerDir() != null && provider.getGitRepoContainerDir().exists()) {
        FileUtils.delete(provider.getGitRepoContainerDir(),
                         FileUtils.RECURSIVE);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:15,代码来源:AbstractTestInfra.java

示例14: cleanup

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
@AfterClass
@BeforeClass
public static void cleanup() {
    for (final File tempFile : tempFiles) {
        try {
            FileUtils.delete(tempFile,
                             FileUtils.RECURSIVE);
        } catch (IOException e) {
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:12,代码来源:AbstractTestInfra.java

示例15: deleteBaseDirIfExists

import org.eclipse.jgit.util.FileUtils; //导入方法依赖的package包/类
private void deleteBaseDirIfExists() {
	if (getBasedir().exists()) {
		for (File file : getBasedir().listFiles()) {
			try {
				FileUtils.delete(file, FileUtils.RECURSIVE);
			}
			catch (IOException e) {
				throw new IllegalStateException("Failed to initialize base directory",
						e);
			}
		}
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-config,代码行数:14,代码来源:JGitEnvironmentRepository.java


注:本文中的org.eclipse.jgit.util.FileUtils.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。