List of usage examples for org.eclipse.jgit.lib Repository getDirectory
public File getDirectory()
From source file:com.madgag.agit.operations.RepoDeleter.java
License:Open Source License
public RepoDeleter(Repository repository) { super(repository.getDirectory()); this.topFolderToDelete = topDirectoryFor(repository); }
From source file:com.madgag.agit.RepoDeleter.java
License:Open Source License
RepoDeleter(Repository repository, Context context) { this.gitdir = repository.getDirectory(); this.topFolderToDelete = repository.isBare() ? repository.getDirectory() : repository.getWorkTree(); this.context = context; }
From source file:com.madgag.agit.Repos.java
License:Open Source License
public static String niceNameFor(Repository repo) { return niceNameFromNameDirectory(repo.isBare() ? repo.getDirectory() : repo.getWorkTree()); }
From source file:com.madgag.agit.RepositoryViewerActivity.java
License:Open Source License
public static Intent manageRepoIntent(Repository repository) { return manageRepoIntent(repository.getDirectory()); }
From source file:com.madgag.agit.RepositoryViewerActivityTest.java
License:Open Source License
public void testShouldShowRepoViewerPageWithoutExplosion() throws Exception { Repository repoWithTags = helper(getInstrumentation()).unpackRepo("small-repo.with-tags.zip"); setActivityIntent(manageRepoIntent(repoWithTags.getDirectory())); getActivity(); // shouldn't crash }
From source file:com.madgag.agit.views.CommitSummaryView.java
License:Open Source License
public void setObject(final RevCommit commit, View view, final Repository repo) { ((PersonIdentView) view.findViewById(R.id.author_ident)).setIdent("Author", commit.getAuthorIdent()); ((TextView) view.findViewById(R.id.short_message_text)).setText(commit.getShortMessage()); view.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { view.getContext().startActivity(revCommitViewIntentFor(repo.getDirectory(), commit.name())); }//from w w w . j av a2 s. c om }); }
From source file:com.microsoft.gittf.client.clc.commands.CloneCommand.java
License:Open Source License
@Override public int run() throws Exception { // Parse arguments final String collection = ((FreeArgument) getArguments().getArgument("projectcollection")).getValue(); //$NON-NLS-1$ String tfsPath = ((FreeArgument) getArguments().getArgument("serverpath")).getValue(); //$NON-NLS-1$ String repositoryPath = getArguments().contains("directory") ? //$NON-NLS-1$ ((FreeArgument) getArguments().getArgument("directory")).getValue() : null; //$NON-NLS-1$ final VersionSpec versionSpec = getArguments().contains("version") ? //$NON-NLS-1$ VersionSpecUtil.parseVersionSpec(((ValueArgument) getArguments().getArgument("version")).getValue()) //$NON-NLS-1$ : LatestVersionSpec.INSTANCE; verifyVersionSpec(versionSpec);/*w w w . ja v a2 s . c o m*/ final boolean bare = getArguments().contains("bare"); //$NON-NLS-1$ final int depth = getDepthFromArguments(); final boolean mentions = getArguments().contains("mentions"); //$NON-NLS-1$ if (mentions && depth < 2) { throw new Exception(Messages.getString("Command.MentionsOnlyAvailableWithDeep")); //$NON-NLS-1$ } final boolean tag = getTagFromArguments(); final URI serverURI = URIUtil.getServerURI(collection); tfsPath = ServerPath.canonicalize(tfsPath); /* * Build repository path */ if (repositoryPath == null) { repositoryPath = ServerPath.getFileName(tfsPath); } repositoryPath = LocalPath.canonicalize(repositoryPath); final File repositoryLocation = new File(repositoryPath); File parentLocationCreated = null; if (!repositoryLocation.exists()) { parentLocationCreated = DirectoryUtil.createDirectory(repositoryLocation); if (parentLocationCreated == null) { throw new Exception(Messages.formatString("CloneCommnad.InvalidPathFormat", repositoryPath)); //$NON-NLS-1$ } } final Repository repository = RepositoryUtil.createNewRepository(repositoryPath, bare); /* * Connect to the server */ try { final TFSTeamProjectCollection connection = getConnection(serverURI, repository); Check.notNull(connection, "connection"); //$NON-NLS-1$ final WorkItemClient witClient = mentions ? connection.getWorkItemClient() : null; final CloneTask cloneTask = new CloneTask(serverURI, getVersionControlService(), tfsPath, repository, witClient); cloneTask.setBare(bare); cloneTask.setDepth(depth); cloneTask.setVersionSpec(versionSpec); cloneTask.setTag(tag); final TaskStatus cloneStatus = new CommandTaskExecutor(getProgressMonitor()).execute(cloneTask); if (!cloneStatus.isOK()) { FileHelpers.deleteDirectory(bare ? repository.getDirectory() : repository.getWorkTree()); if (parentLocationCreated != null) { FileHelpers.deleteDirectory(parentLocationCreated); } return ExitCode.FAILURE; } } finally { repository.close(); } return ExitCode.SUCCESS; }
From source file:com.microsoft.gittf.core.config.ChangesetCommitMap.java
License:Open Source License
/** * Constructor/*from w ww. ja v a 2s .co m*/ * * @param repository * the git repository */ public ChangesetCommitMap(final Repository repository) { Check.notNull(repository, "repository"); //$NON-NLS-1$ this.repository = repository; this.configFile = new FileBasedConfig(new File(repository.getDirectory(), GitTFConstants.GIT_TF_NAME), FS.DETECTED); }
From source file:com.microsoft.gittf.core.tasks.ConfigureRepositoryTask.java
License:Open Source License
public ConfigureRepositoryTask(final Repository repository, final URI projectCollectionURI, final String tfsPath) { Check.notNull(repository, "repository"); //$NON-NLS-1$ Check.notNull(repository.getDirectory(), "repository.directory"); //$NON-NLS-1$ Check.notNull(projectCollectionURI, "projectCollectionURI"); //$NON-NLS-1$ Check.notNullOrEmpty(tfsPath, "tfsPath"); //$NON-NLS-1$ this.repository = repository; this.config = new GitTFConfiguration(projectCollectionURI, tfsPath); }
From source file:com.microsoft.gittf.core.upgrade.UpgradeManager.java
License:Open Source License
private static void upgradeFromV0ToV1(final Repository repository, final GitTFConfiguration currentConfiguration) throws Exception { /*/* ww w . ja v a2 s . c o m*/ * Delete old temp git-tf folder sense we will create a config with the * same name. Newly created temp git-tf folder will be named "tf". */ final File currentTempFileLocation = new File(repository.getDirectory(), GitTFConstants.GIT_TF_NAME); if (currentTempFileLocation.exists() && currentTempFileLocation.isDirectory()) { final boolean cleanupTempDir = FileHelpers.deleteDirectory(currentTempFileLocation); if (!cleanupTempDir) { throw new Exception( Messages.formatString("UpgradeManager.upgradeFromV0ToV1.CannotCleanUpTempDirectoryFormat", //$NON-NLS-1$ currentTempFileLocation.getAbsolutePath())); } } /* * Move the existing "changesets" and "commits" sections to the new * "git-tf" config file */ final File newConfigFileLocation = new File(repository.getDirectory(), GitTFConstants.GIT_TF_NAME); if (!newConfigFileLocation.exists()) { ChangesetCommitMap.copyConfigurationEntriesFromRepositoryConfigToNewConfig(repository, newConfigFileLocation); } currentConfiguration.setFileFormatVersion(1); currentConfiguration.saveTo(repository); }