List of usage examples for org.eclipse.jgit.lib Constants HEAD
String HEAD
To view the source code for org.eclipse.jgit.lib Constants HEAD.
Click Source Link
From source file:org.eclipse.egit.ui.internal.synchronize.GitSynchronizeWizard.java
License:Open Source License
@Override public boolean performFinish() { GitSynchronizeDataSet gsdSet = new GitSynchronizeDataSet(); Map<Repository, String> branches = page.getSelectedBranches(); for (Repository repo : branches.keySet()) try {/* w w w . j a v a2 s . c o m*/ gsdSet.add(new GitSynchronizeData(repo, Constants.HEAD, branches.get(repo), false)); } catch (IOException e) { Activator.logError(e.getMessage(), e); } new GitSynchronize(gsdSet); return true; }
From source file:org.eclipse.egit.ui.internal.synchronize.model.GitModelCache.java
License:Open Source License
/** * Creates and configures {@link TreeWalk} instance for * {@link GitModelCache#getChildrenImpl()} method. It is IMPORTANT to add * tree that will be used as a base as first, remote tree should be added as * second; {@link GitModelCache#dirCacheIteratorNth} should be set with * value of NTH that corresponds with {@link DirCacheIterator}. * * @return configured instance of TreeW//from w w w. j a va2 s . c o m * @throws IOException */ protected TreeWalk createAndConfigureTreeWalk() throws IOException { TreeWalk tw = createTreeWalk(); tw.setRecursive(true); Repository repo = getRepository(); DirCache index = repo.readDirCache(); ObjectId headId = repo.getRef(Constants.HEAD).getObjectId(); tw.addTree(new RevWalk(repo).parseTree(headId)); tw.addTree(new DirCacheIterator(index)); dirCacheIteratorNth = 1; return tw; }
From source file:org.eclipse.egit.ui.internal.synchronize.model.GitModelTestCase.java
License:Open Source License
protected GitSynchronizeData getGSD(Repository repo) throws IOException { return new GitSynchronizeData(repo, Constants.HEAD, Constants.HEAD, true); }
From source file:org.eclipse.egit.ui.search.CommitSearchDialogTest.java
License:Open Source License
@BeforeClass public static void setup() throws Exception { closeWelcomePage();/*from ww w . j a v a 2 s . c o m*/ File repoFile = createProjectAndCommitToRepository(); assertNotNull(repoFile); repository = Activator.getDefault().getRepositoryCache().lookupRepository(repoFile); assertNotNull(repository); Activator.getDefault().getRepositoryUtil().addConfiguredRepository(repository.getDirectory()); RevWalk walk = new RevWalk(repository); try { commit = walk.parseCommit(repository.resolve(Constants.HEAD)); assertNotNull(commit); walk.parseBody(commit.getParent(0)); } finally { walk.release(); } }
From source file:org.eclipse.egit.ui.search.CommitSearchQueryTest.java
License:Open Source License
@BeforeClass public static void setup() throws Exception { File repoFile = createProjectAndCommitToRepository(); assertNotNull(repoFile);//from w w w . j av a 2 s. c o m repository = Activator.getDefault().getRepositoryCache().lookupRepository(repoFile); assertNotNull(repository); RevWalk walk = new RevWalk(repository); try { commit = walk.parseCommit(repository.resolve(Constants.HEAD)); assertNotNull(commit); } finally { walk.release(); } }
From source file:org.eclipse.egit.ui.submodule.SubmoduleUpdateTest.java
License:Open Source License
@Test public void updateSubmodule() throws Exception { deleteAllProjects();/*from w w w. ja v a2 s. c o m*/ assertProjectExistence(PROJ1, false); clearView(); Activator.getDefault().getRepositoryUtil().addConfiguredRepository(repositoryFile); shareProjects(repositoryFile); assertProjectExistence(PROJ1, true); refreshAndWait(); assertHasRepo(repositoryFile); FileRepository repo = lookupRepository(repositoryFile); ObjectId repoHead = repo.resolve(Constants.HEAD); SubmoduleAddCommand command = new SubmoduleAddCommand(repo); String path = "sub"; command.setPath(path); String uri = new URIish(repo.getDirectory().toURI().toString()).toString(); command.setURI(uri); Repository subRepo = command.call(); assertNotNull(subRepo); Ref head = subRepo.getRef(Constants.HEAD); assertNotNull(head); assertTrue(head.isSymbolic()); assertEquals(Constants.R_HEADS + Constants.MASTER, head.getLeaf().getName()); assertEquals(repoHead, head.getObjectId()); refreshAndWait(); SWTBotTree tree = getOrOpenView().bot().tree(); tree.getAllItems()[0].expand().expandNode(UIText.RepositoriesViewLabelProvider_SubmodulesNodeText).select(); ContextMenuHelper.clickContextMenuSync(tree, myUtil.getPluginLocalizedValue(UPDATE_SUBMODULE_CONTEXT_MENU_LABEL)); TestUtil.joinJobs(JobFamilies.SUBMODULE_UPDATE); refreshAndWait(); head = subRepo.getRef(Constants.HEAD); assertNotNull(head); assertFalse(head.isSymbolic()); assertEquals(repoHead, head.getObjectId()); }
From source file:org.eclipse.egit.ui.test.commit.CommitEditorTest.java
License:Open Source License
@BeforeClass public static void setup() throws Exception { closeWelcomePage();/*from w ww . j a v a 2 s . c o m*/ File repoFile = createProjectAndCommitToRepository(); assertNotNull(repoFile); repository = Activator.getDefault().getRepositoryCache().lookupRepository(repoFile); assertNotNull(repository); RevWalk walk = new RevWalk(repository); try { commit = walk.parseCommit(repository.resolve(Constants.HEAD)); assertNotNull(commit); walk.parseBody(commit.getParent(0)); } finally { walk.release(); } }
From source file:org.eclipse.egit.ui.test.commit.DiffRegionFormatterTest.java
License:Open Source License
@Before public void setup() throws Exception { File repoFile = createProjectAndCommitToRepository(); assertNotNull(repoFile);/*from ww w. j ava 2 s. co m*/ repository = Activator.getDefault().getRepositoryCache().lookupRepository(repoFile); assertNotNull(repository); try (RevWalk walk = new RevWalk(repository)) { commit = walk.parseCommit(repository.resolve(Constants.HEAD)); assertNotNull(commit); walk.parseBody(commit.getParent(0)); } }
From source file:org.eclipse.egit.ui.test.commit.DiffStyleRangeFormatterTest.java
License:Open Source License
@BeforeClass public static void setup() throws Exception { File repoFile = createProjectAndCommitToRepository(); assertNotNull(repoFile);/*from www.ja va2 s. c o m*/ repository = Activator.getDefault().getRepositoryCache().lookupRepository(repoFile); assertNotNull(repository); RevWalk walk = new RevWalk(repository); try { commit = walk.parseCommit(repository.resolve(Constants.HEAD)); assertNotNull(commit); walk.parseBody(commit.getParent(0)); } finally { walk.release(); } }
From source file:org.eclipse.egit.ui.test.TestUtil.java
License:Open Source License
public static RevCommit getHeadCommit(Repository repository) throws Exception { RevCommit headCommit = null;//from ww w . j a v a2 s .c o m ObjectId parentId = repository.resolve(Constants.HEAD); if (parentId != null) headCommit = new RevWalk(repository).parseCommit(parentId); return headCommit; }