git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [JGIT PATCH 8/8] Define a basic merge API, and a two-way tree merge strategy

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Jan 15, 2009, 21:05 UTC
Message-ID
<200901152205.00600.robin.rosenberg@dewire.com>
In-Reply-To
<200810232314.29867.robin.rosenberg@dewire.com>
I never got a  received reply... on this.
-- robin
torsdag 23 oktober 2008 23:14:29 skrev Robin Rosenberg:
Show 52 quoted lines
> Hi, Shawn
> 
> Shouldn't testTrivialTwoWay_disjointhistories()  work?
> 
> The two trees have nothing in common and so should be trivially mergeable.
> 
> -- robin
> 
> From cef2695431e368da616a1e9c8de3e5e419854a4c Mon Sep 17 00:00:00 2001
> From: Robin Rosenberg <robin.rosenberg@dewire.com>
> Date: Thu, 23 Oct 2008 23:09:10 +0200
> Subject: [EGIT PATCH] Simple merge test
> 
> ---
>  .../org/spearce/jgit/merge/SimpleMergeTest.java    |   28 ++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
>  create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java
> 
> diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java
> new file mode 100644
> index 0000000..8ec1c7f
> --- /dev/null
> +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java
> @@ -0,0 +1,28 @@
> +package org.spearce.jgit.merge;
> +
> +import java.io.IOException;
> +
> +import org.spearce.jgit.lib.ObjectId;
> +import org.spearce.jgit.lib.RepositoryTestCase;
> +
> +public class SimpleMergeTest extends RepositoryTestCase {
> +
> +	public void testTrivialTwoWay_noway() throws IOException {
> +		Merger ourMerger = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
> +		boolean merge = ourMerger.merge(new ObjectId[] { db.resolve("a"), db.resolve("c") });
> +		assertFalse(merge);
> +	}
> +
> +	public void testTrivialTwoWay_disjointhistories() throws IOException {
> +		Merger ourMerger = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
> +		boolean merge = ourMerger.merge(new ObjectId[] { db.resolve("a"), db.resolve("c~4") });
> +		assertTrue(merge); 
> +	}
> +
> +	public void testTrivialTwoWay_ok() throws IOException {
> +		Merger ourMerger = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
> +		boolean merge = ourMerger.merge(new ObjectId[] { db.resolve("a^0^0^0"), db.resolve("a^0^0^1") });
> +		assertTrue(merge);
> +		assertEquals(db.mapTree("a^0^0").getId(), ourMerger.getResultTreeId());
> +	}
> +}
Previous: Robin RosenbergNext: Shawn O. Pearce
Message 11 of 16 in “Crude merge support”
  1. 0/8 Crude merge supportShawn O. Pearce, Oct 13, 2008
  2. 1/8 Expose the raw path for the current entry of a TreeWalkShawn O. Pearce, Oct 13, 2008
  3. 2/8 Expose DirCacheEntry.getFileMode as a utility functionShawn O. Pearce, Oct 13, 2008
  4. 3/8 Add writeTree support to DirCacheShawn O. Pearce, Oct 13, 2008
  5. 4/8 Allow a DirCache to be created with no backing store fileShawn O. Pearce, Oct 13, 2008
  6. 5/8 Allow CanonicalTreeParsers to be created with a UTF-8 path prefixShawn O. Pearce, Oct 13, 2008
  7. 6/8 Recursively load an entire tree into a DirCacheBuilderShawn O. Pearce, Oct 13, 2008
  8. 7/8 Allow DirCacheEntry instances to be created with stage > 0Shawn O. Pearce, Oct 13, 2008
  9. 8/8 Define a basic merge API, and a two-way tree merge strategyShawn O. Pearce, Oct 13, 2008
  10. Robin RosenbergOct 23, 2008
  11. Robin RosenbergJan 15, 2009
  12. Shawn O. PearceJan 15, 2009
  13. Tomi PakarinenJan 17, 2009
  14. Robin RosenbergJan 18, 2009
  15. Shawn O. PearceJan 19, 2009
  16. Shawn O. PearceJan 19, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.