/** * Shares the given project. A repository is created within the given project and the project is * connected to the freshly created repository. * * @param project * @param monitor * @return * @throws CoreException */ public static Repository share(IProject project, IProgressMonitor monitor) throws CoreException { Repository repository = createRepository(project, monitor); connect(project, repository, monitor); addToRepository(project, repository, monitor); commit(project, monitor); // checkout("master", repository); return repository; }
/** * Connects the given project to the given repository. * * @param project the project to connect * @param repository the repository to connect the project to * @param monitor the monitor to report progress to * @throws CoreException */ private static void connect(IProject project, Repository repository, IProgressMonitor monitor) throws CoreException { connect(project, repository.getDirectory(), monitor); }
/** * Connects the given project to the repository within it. * * @param project the project to connect * @param monitor the monitor to report progress to * @throws CoreException */ public static void connect(IProject project, IProgressMonitor monitor) throws CoreException { connect(project, getRepositoryPathFor(project), monitor); }