View Javadoc
1   /*
2    * Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com> and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  
11  package org.eclipse.jgit.notes;
12  
13  import java.io.IOException;
14  
15  import org.eclipse.jgit.lib.ObjectInserter;
16  import org.eclipse.jgit.lib.ObjectReader;
17  
18  /**
19   * Three-way note merge operation.
20   * <p>
21   * This operation takes three versions of a note: base, ours and theirs,
22   * performs the three-way merge and returns the merge result.
23   */
24  public interface NoteMerger {
25  
26  	/**
27  	 * Merges the conflicting note changes.
28  	 * <p>
29  	 * base, ours and their are all notes on the same object.
30  	 *
31  	 * @param base
32  	 *            version of the Note
33  	 * @param ours
34  	 *            version of the Note
35  	 * @param their
36  	 *            version of the Note
37  	 * @param reader
38  	 *            the object reader that must be used to read Git objects
39  	 * @param inserter
40  	 *            the object inserter that must be used to insert Git objects
41  	 * @return the merge result
42  	 * @throws org.eclipse.jgit.notes.NotesMergeConflictException
43  	 *             in case there was a merge conflict which this note merger
44  	 *             couldn't resolve
45  	 * @throws java.io.IOException
46  	 *             in case the reader or the inserter would throw an
47  	 *             java.io.IOException the implementor will most likely want to
48  	 *             propagate it as it can't do much to recover from it
49  	 */
50  	Note merge(Note base, Note ours, Note their, ObjectReader reader,
51  			ObjectInserter inserter) throws NotesMergeConflictException,
52  			IOException;
53  }
54