Example usage for org.eclipse.jgit.lib Repository create

List of usage examples for org.eclipse.jgit.lib Repository create

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib Repository create.

Prototype

public void create() throws IOException 

Source Link

Document

Create a new Git repository.

Usage

From source file:org.eclipse.egit.core.storage.GitBlobStorageTest.java

License:Open Source License

@Test
public void testGitFileHistorySingleProjectOk() throws Exception {
    IProgressMonitor progress = new NullProgressMonitor();
    TestProject singleRepoProject = new TestProject(true, "Project-2");
    IProject proj = singleRepoProject.getProject();
    File singleProjectGitDir = new File(proj.getLocation().toFile(), Constants.DOT_GIT);
    if (singleProjectGitDir.exists())
        FileUtils.delete(singleProjectGitDir, FileUtils.RECURSIVE | FileUtils.RETRY);

    Repository singleProjectRepo = FileRepositoryBuilder.create(singleProjectGitDir);
    singleProjectRepo.create();

    // Repository must be mapped in order to test the GitFileHistory
    Activator.getDefault().getRepositoryUtil().addConfiguredRepository(singleProjectGitDir);
    ConnectProviderOperation connectOp = new ConnectProviderOperation(proj, singleProjectGitDir);
    connectOp.execute(progress);//from w  w w.j a  v a 2  s.  c  o  m

    try {
        IFile file = proj.getFile("file");
        file.create(new ByteArrayInputStream("data".getBytes("UTF-8")), 0, progress);
        Git git = new Git(singleProjectRepo);
        git.add().addFilepattern(".").call();
        RevCommit commit = git.commit().setAuthor("JUnit", "junit@jgit.org").setAll(true)
                .setMessage("First commit").call();

        GitFileHistoryProvider fhProvider = new GitFileHistoryProvider();
        IFileHistory fh = fhProvider.getFileHistoryFor(singleRepoProject.getProject(), 0, null);
        assertNotNull(fh);
        assertEquals(fh.getFileRevisions().length, 1);
        assertNotNull(fh.getFileRevision(commit.getId().getName()));
    } finally {
        DisconnectProviderOperation disconnectOp = new DisconnectProviderOperation(
                Collections.singletonList(proj));
        disconnectOp.execute(progress);
        Activator.getDefault().getRepositoryUtil().removeDir(singleProjectGitDir);
        singleProjectRepo.close();
        singleRepoProject.dispose();
    }
}

From source file:org.eclipse.egit.core.test.GitProjectSetCapabilityTest.java

License:Open Source License

private File createRepository(IPath location, String url, String branch) throws Exception {
    File gitDirectory = new File(location.toFile(), Constants.DOT_GIT);
    Repository repo = new FileRepository(gitDirectory);
    repo.getConfig().setString(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", ConfigConstants.CONFIG_KEY_URL,
            url);//from   ww  w .j  ava  2s. co  m
    repo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_REMOTE,
            "origin");
    repo.create();
    repo.close();

    Git git = new Git(repo);
    git.add().addFilepattern(".").call();
    git.commit().setMessage("initial").call();
    if (!branch.equals("master"))
        git.checkout().setName(branch).setCreateBranch(true).call();

    pathsToClean.add(gitDirectory);
    return gitDirectory;
}

From source file:org.eclipse.egit.core.test.op.ConnectProviderOperationTest.java

License:Open Source License

@Test
public void testNewRepository() throws CoreException, IOException {

    Repository repository = new FileRepository(gitDir);
    repository.create();
    repository.close();//  w w  w. j a va 2 s  . c  o  m
    ConnectProviderOperation operation = new ConnectProviderOperation(project.getProject(), gitDir);
    operation.execute(null);

    assertTrue(RepositoryProvider.isShared(project.getProject()));

    assertTrue(gitDir.exists());
}

From source file:org.eclipse.egit.core.test.op.T0001_ConnectProviderOperationTest.java

License:Open Source License

@Test
public void testNewRepository() throws CoreException, IOException {

    File gitDir = new File(project.getProject().getWorkspace().getRoot().getRawLocation().toFile(),
            Constants.DOT_GIT);//w  ww.  ja  v a  2s . co m
    Repository repository = new Repository(gitDir);
    repository.create();
    repository.close();
    ConnectProviderOperation operation = new ConnectProviderOperation(project.getProject(), gitDir);
    operation.execute(null);

    assertTrue(RepositoryProvider.isShared(project.getProject()));

    assertTrue(gitDir.exists());
}

From source file:org.eclipse.egit.core.test.op.T0001_ConnectProviderOperationTest.java

License:Open Source License

@Test
public void testNewUnsharedFile() throws CoreException, IOException, InterruptedException {

    project.createSourceFolder();/*from   w  w w.  j a va 2 s .c o  m*/
    IFile fileA = project.getProject().getFolder("src").getFile("A.java");
    String srcA = "class A {\n" + "}\n";
    fileA.create(new ByteArrayInputStream(srcA.getBytes()), false, null);

    File gitDir = new File(project.getProject().getWorkspace().getRoot().getRawLocation().toFile(),
            Constants.DOT_GIT);
    Repository thisGit = new Repository(gitDir);
    thisGit.create();
    Tree rootTree = new Tree(thisGit);
    Tree prjTree = rootTree.addTree(project.getProject().getName());
    Tree srcTree = prjTree.addTree("src");
    FileTreeEntry entryA = srcTree.addFile("A.java");
    ObjectWriter writer = new ObjectWriter(thisGit);
    entryA.setId(writer.writeBlob(fileA.getRawLocation().toFile()));
    srcTree.setId(writer.writeTree(srcTree));
    prjTree.setId(writer.writeTree(prjTree));
    rootTree.setId(writer.writeTree(rootTree));
    Commit commit = new Commit(thisGit);
    commit.setTree(rootTree);
    commit.setAuthor(new PersonIdent("J. Git", "j.git@egit.org", new Date(60876075600000L),
            TimeZone.getTimeZone("GMT+1")));
    commit.setCommitter(commit.getAuthor());
    commit.setMessage("testNewUnsharedFile\n\nJunit tests\n");
    ObjectId id = writer.writeCommit(commit);
    RefUpdate lck = thisGit.updateRef("refs/heads/master");
    assertNotNull("obtained lock", lck);
    lck.setNewObjectId(id);
    assertEquals(RefUpdate.Result.NEW, lck.forceUpdate());

    ConnectProviderOperation operation = new ConnectProviderOperation(project.getProject(), gitDir);
    operation.execute(null);

    final boolean f[] = new boolean[1];
    new Job("wait") {
        protected IStatus run(IProgressMonitor monitor) {

            System.out.println("MyJob");
            f[0] = true;
            return null;
        }

        {
            setRule(project.getProject());
            schedule();
        }
    };
    while (!f[0]) {
        System.out.println("Waiting");
        Thread.sleep(1000);
    }
    System.out.println("DONE");

    assertNotNull(RepositoryProvider.getProvider(project.getProject()));

}

From source file:org.eclipse.egit.ui.common.LocalRepositoryTestCase.java

License:Open Source License

protected static File createProjectAndCommitToRepository() throws Exception {

    File gitDir = new File(new File(testDirectory, REPO1), Constants.DOT_GIT);
    gitDir.mkdir();/* w  ww .  ja  v  a 2  s  .com*/
    Repository myRepository = new FileRepository(gitDir);
    myRepository.create();

    // we need to commit into master first
    IProject firstProject = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1);

    if (firstProject.exists())
        firstProject.delete(true, null);
    IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(PROJ1);
    desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ1).getPath()));
    firstProject.create(desc, null);
    firstProject.open(null);

    IFolder folder = firstProject.getFolder(FOLDER);
    folder.create(false, true, null);
    IFile textFile = folder.getFile(FILE1);
    textFile.create(new ByteArrayInputStream("Hello, world".getBytes(firstProject.getDefaultCharset())), false,
            null);
    IFile textFile2 = folder.getFile(FILE2);
    textFile2.create(new ByteArrayInputStream("Some more content".getBytes(firstProject.getDefaultCharset())),
            false, null);

    new ConnectProviderOperation(firstProject, gitDir).execute(null);

    IProject secondPoject = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ2);

    if (secondPoject.exists())
        secondPoject.delete(true, null);

    desc = ResourcesPlugin.getWorkspace().newProjectDescription(PROJ2);
    desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ2).getPath()));
    secondPoject.create(desc, null);
    secondPoject.open(null);

    IFolder secondfolder = secondPoject.getFolder(FOLDER);
    secondfolder.create(false, true, null);
    IFile secondtextFile = secondfolder.getFile(FILE1);
    secondtextFile.create(new ByteArrayInputStream("Hello, world".getBytes(firstProject.getDefaultCharset())),
            false, null);
    IFile secondtextFile2 = secondfolder.getFile(FILE2);
    secondtextFile2.create(
            new ByteArrayInputStream("Some more content".getBytes(firstProject.getDefaultCharset())), false,
            null);
    // TODO we should be able to hide the .project
    // IFile gitignore = secondPoject.getFile(".gitignore");
    // gitignore.create(new ByteArrayInputStream("/.project\n"
    // .getBytes(firstProject.getDefaultCharset())), false, null);

    new ConnectProviderOperation(secondPoject, gitDir).execute(null);

    IFile[] commitables = new IFile[] { firstProject.getFile(".project"), textFile, textFile2, secondtextFile,
            secondtextFile2 };
    ArrayList<IFile> untracked = new ArrayList<IFile>();
    untracked.addAll(Arrays.asList(commitables));
    // commit to stable
    CommitOperation op = new CommitOperation(commitables, new ArrayList<IFile>(), untracked,
            TestUtil.TESTAUTHOR, TestUtil.TESTCOMMITTER, "Initial commit");
    op.execute(null);

    // now create a stable branch (from master)
    createStableBranch(myRepository);
    // and check in some stuff into master again
    touchAndSubmit(null);
    return gitDir;
}

From source file:org.eclipse.egit.ui.common.LocalRepositoryTestCase.java

License:Open Source License

protected static File createRemoteRepository(File repositoryDir) throws Exception {
    FileRepository myRepository = lookupRepository(repositoryDir);
    File gitDir = new File(testDirectory, REPO2);
    Repository myRemoteRepository = new FileRepository(gitDir);
    myRemoteRepository.create();
    // double-check that this is bare
    assertTrue(myRemoteRepository.isBare());

    createStableBranch(myRepository);/*from  w w w . j  a va2s  . com*/

    // now we configure a pure push destination
    myRepository.getConfig().setString("remote", "push", "pushurl",
            "file:///" + myRemoteRepository.getDirectory().getPath());
    myRepository.getConfig().setString("remote", "push", "push", "+refs/heads/*:refs/heads/*");

    // and a pure fetch destination
    myRepository.getConfig().setString("remote", "fetch", "url",
            "file:///" + myRemoteRepository.getDirectory().getPath());
    myRepository.getConfig().setString("remote", "fetch", "fetch", "+refs/heads/*:refs/heads/*");

    // a destination with both fetch and push urls and specs
    myRepository.getConfig().setString("remote", "both", "pushurl",
            "file:///" + myRemoteRepository.getDirectory().getPath());
    myRepository.getConfig().setString("remote", "both", "push", "+refs/heads/*:refs/heads/*");
    myRepository.getConfig().setString("remote", "both", "url",
            "file:///" + myRemoteRepository.getDirectory().getPath());
    myRepository.getConfig().setString("remote", "both", "fetch", "+refs/heads/*:refs/heads/*");

    // a destination with only a fetch url and push and fetch specs
    myRepository.getConfig().setString("remote", "mixed", "push", "+refs/heads/*:refs/heads/*");
    myRepository.getConfig().setString("remote", "mixed", "url",
            "file:///" + myRemoteRepository.getDirectory().getPath());
    myRepository.getConfig().setString("remote", "mixed", "fetch", "+refs/heads/*:refs/heads/*");

    myRepository.getConfig().save();
    // and push
    PushConfiguredRemoteAction pa = new PushConfiguredRemoteAction(myRepository, "push");

    pa.run(null, false);

    try {
        // delete the stable branch again
        RefUpdate op = myRepository.updateRef("refs/heads/stable");
        op.setRefLogMessage("branch deleted", //$NON-NLS-1$
                false);
        // we set the force update in order
        // to avoid having this rejected
        // due to minor issues
        op.setForceUpdate(true);
        op.delete();
    } catch (IOException ioe) {
        throw new InvocationTargetException(ioe);
    }
    return myRemoteRepository.getDirectory();
}

From source file:org.eclipse.egit.ui.internal.sharing.ExistingOrNewPage.java

License:Open Source License

public void createControl(Composite parent) {
    Group g = new Group(parent, SWT.NONE);
    g.setLayout(new GridLayout(3, false));
    g.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    tree = new Tree(g, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
    viewer = new CheckboxTreeViewer(tree);
    tree.setHeaderVisible(true);//  www  .  j a va  2s . com
    tree.setLayout(new GridLayout());
    tree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(3, 1).create());
    viewer.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            if (event.getChecked()) {
                ProjectAndRepo checkable = (ProjectAndRepo) event.getElement();
                for (TreeItem ti : tree.getItems()) {
                    if (ti.getItemCount() > 0 || ((ProjectAndRepo) ti.getData()).getRepo().equals("")) //$NON-NLS-1$
                        ti.setChecked(false);
                    for (TreeItem subTi : ti.getItems()) {
                        IProject project = ((ProjectAndRepo) subTi.getData()).getProject();
                        if (checkable.getProject() != null && !subTi.getData().equals(checkable)
                                && checkable.getProject().equals(project))
                            subTi.setChecked(false);
                    }
                }
            }
        }
    });
    TreeColumn c1 = new TreeColumn(tree, SWT.NONE);
    c1.setText(UIText.ExistingOrNewPage_HeaderProject);
    c1.setWidth(100);
    TreeColumn c2 = new TreeColumn(tree, SWT.NONE);
    c2.setText(UIText.ExistingOrNewPage_HeaderPath);
    c2.setWidth(400);
    TreeColumn c3 = new TreeColumn(tree, SWT.NONE);
    c3.setText(UIText.ExistingOrNewPage_HeaderRepository);
    c3.setWidth(200);
    for (IProject project : myWizard.projects) {
        RepositoryFinder repositoryFinder = new RepositoryFinder(project);
        try {
            Collection<RepositoryMapping> mappings;
            mappings = repositoryFinder.find(new NullProgressMonitor());
            Iterator<RepositoryMapping> mi = mappings.iterator();
            RepositoryMapping m = mi.hasNext() ? mi.next() : null;
            if (m == null) {
                // no mapping found, enable repository creation
                TreeItem treeItem = new TreeItem(tree, SWT.NONE);
                treeItem.setText(0, project.getName());
                treeItem.setText(1, project.getLocation().toOSString());
                treeItem.setText(2, ""); //$NON-NLS-1$
                treeItem.setData(new ProjectAndRepo(project, "")); //$NON-NLS-1$
            } else if (!mi.hasNext()) {
                // exactly one mapping found
                TreeItem treeItem = new TreeItem(tree, SWT.NONE);
                treeItem.setText(0, project.getName());
                treeItem.setText(1, project.getLocation().toOSString());
                fillTreeItemWithGitDirectory(m, treeItem, false);
                treeItem.setData(new ProjectAndRepo(project, treeItem.getText(2)));
                treeItem.setChecked(true);
            }

            else {
                TreeItem treeItem = new TreeItem(tree, SWT.NONE);
                treeItem.setText(0, project.getName());
                treeItem.setText(1, project.getLocation().toOSString());
                treeItem.setData(new ProjectAndRepo(null, null));

                TreeItem treeItem2 = new TreeItem(treeItem, SWT.NONE);
                treeItem2.setText(0, project.getName());
                fillTreeItemWithGitDirectory(m, treeItem2, true);
                treeItem2.setData(new ProjectAndRepo(project, treeItem2.getText(2)));
                while (mi.hasNext()) { // fill in additional mappings
                    m = mi.next();
                    treeItem2 = new TreeItem(treeItem, SWT.NONE);
                    treeItem2.setText(0, project.getName());
                    fillTreeItemWithGitDirectory(m, treeItem2, true);
                    treeItem2.setData(new ProjectAndRepo(m.getContainer().getProject(), treeItem2.getText(2)));
                }
                treeItem.setExpanded(true);
            }
        } catch (CoreException e) {
            TreeItem treeItem2 = new TreeItem(tree, SWT.BOLD | SWT.ITALIC);
            treeItem2.setText(e.getMessage());
        }
    }

    button = new Button(g, SWT.PUSH);
    button.setLayoutData(GridDataFactory.fillDefaults().create());
    button.setText(UIText.ExistingOrNewPage_CreateButton);
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            File gitDir = new File(repositoryToCreate.getText(), Constants.DOT_GIT);
            try {
                Repository repository = new FileRepository(gitDir);
                repository.create();
                for (IProject project : getProjects().keySet()) {
                    // If we don't refresh the project directories right
                    // now we won't later know that a .git directory
                    // exists within it and we won't mark the .git
                    // directory as a team-private member. Failure
                    // to do so might allow someone to delete
                    // the .git directory without us stopping them.
                    // (Half lie, we should optimize so we do not
                    // refresh when the .git is not within the project)
                    //
                    if (!gitDir.toString().contains("..")) //$NON-NLS-1$
                        project.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
                }
                RepositoryUtil util = Activator.getDefault().getRepositoryUtil();
                util.addConfiguredRepository(gitDir);
            } catch (IOException e1) {
                String msg = NLS.bind(UIText.ExistingOrNewPage_ErrorFailedToCreateRepository,
                        gitDir.toString());
                org.eclipse.egit.ui.Activator.handleError(msg, e1, true);
            } catch (CoreException e2) {
                String msg = NLS.bind(UIText.ExistingOrNewPage_ErrorFailedToRefreshRepository, gitDir);
                org.eclipse.egit.ui.Activator.handleError(msg, e2, true);
            }
            for (TreeItem ti : tree.getSelection()) {
                ti.setText(2, gitDir.toString());
                ((ProjectAndRepo) ti.getData()).repo = gitDir.toString();
                ti.setChecked(true);
            }
            updateCreateOptions();
            getContainer().updateButtons();
        }
    });
    repositoryToCreate = new Text(g, SWT.SINGLE | SWT.BORDER);
    repositoryToCreate.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(1, 1).create());
    repositoryToCreate.addListener(SWT.Modify, new Listener() {
        public void handleEvent(Event e) {
            if (repositoryToCreate.getText().equals("")) { //$NON-NLS-1$
                button.setEnabled(false);
                return;
            }
            IPath fromOSString = Path.fromOSString(repositoryToCreate.getText());
            button.setEnabled(minumumPath.matchingFirstSegments(fromOSString) == fromOSString.segmentCount());
        }
    });
    dotGitSegment = new Text(g, SWT.NONE);
    dotGitSegment.setEnabled(false);
    dotGitSegment.setEditable(false);
    dotGitSegment.setText(File.separatorChar + Constants.DOT_GIT);
    dotGitSegment.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).create());

    tree.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateCreateOptions();
        }
    });
    updateCreateOptions();
    Dialog.applyDialogFont(g);
    setControl(g);
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestBase.java

License:Open Source License

protected static File createProjectAndCommitToRepository() throws Exception {

    File gitDir = new File(new File(getTestDirectory(), REPO1), Constants.DOT_GIT);
    gitDir.mkdir();/*from w  w w  .j  a v a  2s  .com*/
    Repository myRepository = lookupRepository(gitDir);
    myRepository.create();

    // TODO Bug: for some reason, this seems to be required
    myRepository.getConfig().setString(ConfigConstants.CONFIG_CORE_SECTION, null,
            ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "0");

    myRepository.getConfig().save();

    // we need to commit into master first
    IProject firstProject = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1);

    if (firstProject.exists())
        firstProject.delete(true, null);
    IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(PROJ1);
    desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ1).getPath()));
    firstProject.create(desc, null);
    firstProject.open(null);

    IFolder folder = firstProject.getFolder(FOLDER);
    folder.create(false, true, null);
    IFile textFile = folder.getFile(FILE1);
    textFile.create(new ByteArrayInputStream("Hello, world".getBytes(firstProject.getDefaultCharset())), false,
            null);
    IFile textFile2 = folder.getFile(FILE2);
    textFile2.create(new ByteArrayInputStream("Some more content".getBytes(firstProject.getDefaultCharset())),
            false, null);

    new ConnectProviderOperation(firstProject, gitDir).execute(null);

    IProject secondPoject = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ2);

    if (secondPoject.exists())
        secondPoject.delete(true, null);

    desc = ResourcesPlugin.getWorkspace().newProjectDescription(PROJ2);
    desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ2).getPath()));
    secondPoject.create(desc, null);
    secondPoject.open(null);

    IFolder secondfolder = secondPoject.getFolder(FOLDER);
    secondfolder.create(false, true, null);
    IFile secondtextFile = secondfolder.getFile(FILE1);
    secondtextFile.create(new ByteArrayInputStream("Hello, world".getBytes(firstProject.getDefaultCharset())),
            false, null);
    IFile secondtextFile2 = secondfolder.getFile(FILE2);
    secondtextFile2.create(
            new ByteArrayInputStream("Some more content".getBytes(firstProject.getDefaultCharset())), false,
            null);

    new ConnectProviderOperation(secondPoject, gitDir).execute(null);

    IFile[] commitables = new IFile[] { firstProject.getFile(".project"), textFile, textFile2, secondtextFile,
            secondtextFile2 };
    ArrayList<IFile> untracked = new ArrayList<IFile>();
    untracked.addAll(Arrays.asList(commitables));
    // commit to stable
    CommitOperation op = new CommitOperation(commitables, new ArrayList<IFile>(), untracked,
            "Test Author <test.author@test.com>", "Test Committer <test.commiter@test.com>", "Initial commit");
    op.execute(null);

    // now create a stable branch (from master)
    createStableBranch(myRepository);
    // and check in some stuff into master again
    touchAndSubmit(null);
    return gitDir;
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestBase.java

License:Open Source License

protected static File createRemoteRepository(File repositoryDir) throws Exception {
    Repository myRepository = org.eclipse.egit.core.Activator.getDefault().getRepositoryCache()
            .lookupRepository(repositoryDir);
    File gitDir = new File(getTestDirectory(), REPO2);
    Repository myRemoteRepository = lookupRepository(gitDir);
    myRemoteRepository.create();

    createStableBranch(myRepository);//from  ww  w  .  j a  v  a  2  s .co m

    // now we configure the push destination
    myRepository.getConfig().setString("remote", "push", "pushurl",
            "file:///" + myRemoteRepository.getDirectory().getPath());
    myRepository.getConfig().setString("remote", "push", "push", "+refs/heads/*:refs/heads/*");
    // TODO Bug: for some reason, this seems to be required
    myRepository.getConfig().setString(ConfigConstants.CONFIG_CORE_SECTION, null,
            ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "0");

    myRepository.getConfig().save();
    // and push
    PushConfiguredRemoteAction pa = new PushConfiguredRemoteAction(myRepository, "push");

    pa.run(null, false);
    TestUtil.joinJobs(JobFamilies.PUSH);
    try {
        // delete the stable branch again
        RefUpdate op = myRepository.updateRef("refs/heads/stable");
        op.setRefLogMessage("branch deleted", //$NON-NLS-1$
                false);
        // we set the force update in order
        // to avoid having this rejected
        // due to minor issues
        op.setForceUpdate(true);
        op.delete();
    } catch (IOException ioe) {
        throw new InvocationTargetException(ioe);
    }
    return myRemoteRepository.getDirectory();
}