Example usage for org.eclipse.jgit.lib Constants MASTER

List of usage examples for org.eclipse.jgit.lib Constants MASTER

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib Constants MASTER.

Prototype

String MASTER

To view the source code for org.eclipse.jgit.lib Constants MASTER.

Click Source Link

Document

Default main branch name

Usage

From source file:org.gitective.tests.CommitUtilsTest.java

License:Open Source License

/**
 * Get commit with null repository parameter
 */// ww  w .j  a v  a2 s .  co  m
@Test(expected = IllegalArgumentException.class)
public void getCommitWithNullRepository2() {
    CommitUtils.getCommit(null, Constants.MASTER);
}

From source file:org.gitective.tests.CommitUtilsTest.java

License:Open Source License

/**
 * Get base with null repository parameter
 *//*  w w w  .  ja v  a 2s.co m*/
@Test(expected = IllegalArgumentException.class)
public void getBaseWithNullRepository2() {
    CommitUtils.getBase(null, Constants.MASTER);
}

From source file:org.gitective.tests.CommitUtilsTest.java

License:Open Source License

/**
 * Get ref with null repository/* w  w w .j  av a2s .c  o  m*/
 */
@Test(expected = IllegalArgumentException.class)
public void getRefWithNullRepository() {
    CommitUtils.getRef(null, Constants.MASTER);
}

From source file:org.gitective.tests.CommitUtilsTest.java

License:Open Source License

/**
 * Get ref with bad ref database/*ww w  . j  a va  2s. co  m*/
 *
 * @throws IOException
 */
@Test(expected = GitException.class)
public void getRefWithBadRepository() throws IOException {
    CommitUtils.getRef(new BadRepository(testRepo, new IOException()), Constants.MASTER);
}

From source file:org.gitective.tests.RepositoryUtilsTest.java

License:Open Source License

/**
 * Get branches for repository/* w  w w.  j  a  v  a2  s  . c  o m*/
 *
 * @throws Exception
 */
@Test
public void branchesForRepository() throws Exception {
    add("test.txt", "content");
    Collection<String> branches = RepositoryUtils.getBranches(new FileRepository(testRepo));
    assertNotNull(branches);
    assertFalse(branches.isEmpty());
    assertEquals(Constants.R_HEADS + Constants.MASTER, branches.iterator().next());
}

From source file:org.gitective.tests.RepositoryUtilsTest.java

License:Open Source License

/**
 * Test one origin change/* w ww  .  ja va 2 s  .c o  m*/
 *
 *
 * @throws Exception
 */
@Test
public void oneOriginChange() throws Exception {
    RevCommit commit1 = add("test.txt", "content");
    File repo2 = initRepo();
    RevCommit commit2 = add(repo2, "test2.txt", "content2.txt");
    Repository repo = new FileRepository(testRepo);
    RefUpdate originMaster = repo
            .updateRef(Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + Constants.MASTER);
    originMaster.setNewObjectId(commit1);
    originMaster.forceUpdate();
    RemoteConfig config = new RemoteConfig(repo.getConfig(), Constants.DEFAULT_REMOTE_NAME);
    config.addURI(new URIish(repo2.toURI().toString()));
    config.update(repo.getConfig());
    Collection<RefDiff> diffs = RepositoryUtils.diffOriginRefs(repo);
    assertNotNull(diffs);
    assertFalse(diffs.isEmpty());
    assertNotNull(diffs.iterator().next().getLocal());
    assertNotNull(diffs.iterator().next().getRemote());
    assertEquals(commit1, diffs.iterator().next().getLocal().getObjectId());
    assertEquals(commit2, diffs.iterator().next().getRemote().getObjectId());
}

From source file:org.gitective.tests.TreeUtilsTest.java

License:Open Source License

/**
 * Parent tree walk with null repository
 *///w w  w .j a  v  a 2s .  c  om
@Test(expected = IllegalArgumentException.class)
public void withParentsNullRepository2() {
    TreeUtils.withParents(null, Constants.MASTER);
}

From source file:org.gitective.tests.TreeUtilsTest.java

License:Open Source License

/**
 * Diff walk for commit with one parent// w ww .j a  va2s  . co  m
 *
 * @throws Exception
 */
@Test
public void diffRevisions() throws Exception {
    Repository repo = new FileRepository(testRepo);
    RevCommit commit1 = add("test.txt", "content");
    RevCommit commit2 = add("test.txt", "content2");
    TreeWalk walk = TreeUtils.diffWithCommits(repo, Constants.MASTER + "~1", Constants.MASTER);
    assertNotNull(walk);
    assertEquals(2, walk.getTreeCount());
    assertTrue(walk.next());
    assertEquals("test.txt", walk.getPathString());
    assertEquals(BlobUtils.getId(repo, commit1, "test.txt"), walk.getObjectId(0));
    assertEquals(BlobUtils.getId(repo, commit2, "test.txt"), walk.getObjectId(1));
    assertFalse(walk.next());
}

From source file:org.gitective.tests.TreeUtilsTest.java

License:Open Source License

/**
 * Parent tree walk with null repository
 *///from   w  w w .jav a2 s.  co  m
@Test(expected = IllegalArgumentException.class)
public void withCommitsNullRepository2() {
    TreeUtils.withCommits(null, Constants.MASTER);
}

From source file:org.gitective.tests.TreeUtilsTest.java

License:Open Source License

/**
 * Get tree id with null repository//w  w  w  .  ja va2  s .co  m
 */
@Test(expected = IllegalArgumentException.class)
public void getIdNullRepository2() {
    TreeUtils.getId(null, Constants.MASTER, "folder");
}