diff options
author | Robin Stocker | 2012-09-02 21:37:25 +0000 |
---|---|---|
committer | Matthias Sohn | 2012-09-02 21:37:25 +0000 |
commit | 03513ef305f3d4f8414ab7ac2624b6d2ca75b3ee (patch) | |
tree | 81abe7c1c899ebd935350eafb5791fbf5a156c3a /org.eclipse.egit.ui.test/src | |
parent | fa2f9bf5afb9e111f496acd42dcca2696b0120fc (diff) | |
download | egit-03513ef305f3d4f8414ab7ac2624b6d2ca75b3ee.tar.gz egit-03513ef305f3d4f8414ab7ac2624b6d2ca75b3ee.tar.xz egit-03513ef305f3d4f8414ab7ac2624b6d2ca75b3ee.zip |
[historyView] Rebase: Pass a better Ref as upstream
JGit change I1333a8dd170bb0077f491962013485efb6f2a926 is about improving
the ours/theirs conflict markers during rebase. The way the rebase
action worked before, it would always pass the commit ID to rebase,
which is not very helpful during a rebase conflict.
This change makes it use a Ref if there is one. If there are multiple
refs pointing to the selected commit:
- and if the branch being rebased tracks another one, this tracked
branch should be the one to pick if it's in the list
- otherwise pick a remote tracking branch if it's in the list
Also adds a "does it work at all?" test for rebase in History view.
Bug: 336819
Change-Id: Ib78c3e8965e2f57e2c844a065629511ab1158160
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui.test/src')
-rw-r--r-- | org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java index d5fb551727..f38342bbe6 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java @@ -30,6 +30,8 @@ import org.eclipse.egit.ui.test.ContextMenuHelper; import org.eclipse.egit.ui.test.TestUtil; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.swt.widgets.Display; @@ -49,9 +51,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -/** - * Tests for the Team->Branch action - */ @RunWith(SWTBotJunit4ClassRunner.class) public class HistoryViewTest extends LocalRepositoryTestCase { private static final String SECONDFOLDER = "secondFolder"; @@ -375,6 +374,17 @@ public class HistoryViewTest extends LocalRepositoryTestCase { .startsWith(FILE1)); } + @Test + public void testRebaseAlreadyUpToDate() throws Exception { + Repository repo = lookupRepository(repoFile); + Ref stable = repo.getRef("stable"); + SWTBotTable table = getHistoryViewTable(PROJ1); + SWTBotTableItem stableItem = getTableItemWithId(table, stable.getObjectId()); + + stableItem.contextMenu(UIText.GitHistoryPage_rebaseMenuItem).click(); + TestUtil.joinJobs(JobFamilies.REBASE); + } + private RevCommit[] checkoutLine(final SWTBotTable table, int line) throws InterruptedException { table.getTableItem(line).select(); @@ -415,4 +425,16 @@ public class HistoryViewTest extends LocalRepositoryTestCase { if(isChecked && !checked || !isChecked && checked) showAllBranches.click(); } + + private static SWTBotTableItem getTableItemWithId(SWTBotTable table, + ObjectId wantedId) { + for (int i = 0; i < table.rowCount(); i++) { + String id = table.cell(i, UIText.CommitGraphTable_CommitId); + String idWithoutEllipsis = id.substring(0, 7); + if (wantedId.getName().startsWith(idWithoutEllipsis)) + return table.getTableItem(i); + } + + throw new IllegalStateException("TableItem for commit with ID " + wantedId + " not found."); + } } |