aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java167
1 files changed, 103 insertions, 64 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
index 977f95341f..079db4a07f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
@@ -1,50 +1,18 @@
/*
- * Copyright (C) 2009, Christian Halstrick <christian.halstrick@sap.com>
- * and other copyright owners as documented in the project's IP log.
+ * Copyright (C) 2009, Christian Halstrick <christian.halstrick@sap.com> and others
*
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Distribution License v1.0 which
- * accompanies this distribution, is reproduced below, and is
- * available at http://www.eclipse.org/org/documents/edl-v10.php
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
*
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * - Neither the name of the Eclipse Foundation, Inc. nor the
- * names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.merge;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
@@ -54,40 +22,108 @@ import org.eclipse.jgit.diff.RawText;
* A class to convert merge results into a Git conformant textual presentation
*/
public class MergeFormatter {
+
/**
- * Formats the results of a merge of {@link RawText} objects in a Git
- * conformant way. This method also assumes that the {@link RawText} objects
- * being merged are line oriented files which use LF as delimiter. This
- * method will also use LF to separate chunks and conflict metadata,
- * therefore it fits only to texts that are LF-separated lines.
+ * Formats the results of a merge of {@link org.eclipse.jgit.diff.RawText}
+ * objects in a Git conformant way. This method also assumes that the
+ * {@link org.eclipse.jgit.diff.RawText} objects being merged are line
+ * oriented files which use LF as delimiter. This method will also use LF to
+ * separate chunks and conflict metadata, therefore it fits only to texts
+ * that are LF-separated lines.
*
* @param out
- * the outputstream where to write the textual presentation
+ * the output stream where to write the textual presentation
* @param res
* the merge result which should be presented
* @param seqName
* When a conflict is reported each conflicting range will get a
- * name. This name is following the "&lt;&lt;&lt;&lt;&lt;&lt;&lt; " or "&gt;&gt;&gt;&gt;&gt;&gt;&gt; "
- * conflict markers. The names for the sequences are given in
- * this list
- * @param charsetName
- * the name of the characterSet used when writing conflict
- * metadata
- * @throws IOException
+ * name. This name is following the "&lt;&lt;&lt;&lt;&lt;&lt;&lt;
+ * " or "&gt;&gt;&gt;&gt;&gt;&gt;&gt; " conflict markers. The
+ * names for the sequences are given in this list
+ * @param charset
+ * the character set used when writing conflict metadata
+ * @throws java.io.IOException
+ * if an IO error occurred
+ * @since 5.2
*/
public void formatMerge(OutputStream out, MergeResult<RawText> res,
- List<String> seqName, String charsetName) throws IOException {
- new MergeFormatterPass(out, res, seqName, charsetName).formatMerge();
+ List<String> seqName, Charset charset) throws IOException {
+ new MergeFormatterPass(out, res, seqName, charset).formatMerge();
+ }
+
+ /**
+ * Formats the results of a merge of {@link org.eclipse.jgit.diff.RawText}
+ * objects in a Git conformant way using diff3 style. This method also
+ * assumes that the {@link org.eclipse.jgit.diff.RawText} objects being
+ * merged are line oriented files which use LF as delimiter. This method
+ * will also use LF to separate chunks and conflict metadata, therefore it
+ * fits only to texts that are LF-separated lines.
+ *
+ * @param out
+ * the output stream where to write the textual presentation
+ * @param res
+ * the merge result which should be presented
+ * @param seqName
+ * When a conflict is reported each conflicting range will get a
+ * name. This name is following the "&lt;&lt;&lt;&lt;&lt;&lt;&lt;
+ * ", "|||||||" or "&gt;&gt;&gt;&gt;&gt;&gt;&gt; " conflict
+ * markers. The names for the sequences are given in this list
+ * @param charset
+ * the character set used when writing conflict metadata
+ * @throws java.io.IOException
+ * if an IO error occurred
+ * @since 6.7
+ */
+ public void formatMergeDiff3(OutputStream out,
+ MergeResult<RawText> res, List<String> seqName, Charset charset)
+ throws IOException {
+ new MergeFormatterPass(out, res, seqName, charset, true).formatMerge();
+ }
+
+ /**
+ * Formats the results of a merge of exactly two
+ * {@link org.eclipse.jgit.diff.RawText} objects in a Git conformant way.
+ * This convenience method accepts the names for the three sequences (base
+ * and the two merged sequences) as explicit parameters and doesn't require
+ * the caller to specify a List
+ *
+ * @param out
+ * the {@link java.io.OutputStream} where to write the textual
+ * presentation
+ * @param res
+ * the merge result which should be presented
+ * @param baseName
+ * the name ranges from the base should get
+ * @param oursName
+ * the name ranges from ours should get
+ * @param theirsName
+ * the name ranges from theirs should get
+ * @param charset
+ * the character set used when writing conflict metadata
+ * @throws java.io.IOException
+ * if an IO error occurred
+ * @since 5.2
+ */
+ @SuppressWarnings("unchecked")
+ public void formatMerge(OutputStream out, MergeResult res, String baseName,
+ String oursName, String theirsName, Charset charset)
+ throws IOException {
+ List<String> names = new ArrayList<>(3);
+ names.add(baseName);
+ names.add(oursName);
+ names.add(theirsName);
+ formatMerge(out, res, names, charset);
}
/**
- * Formats the results of a merge of exactly two {@link RawText} objects in
- * a Git conformant way. This convenience method accepts the names for the
+ * Formats the results of a merge of three
+ * {@link org.eclipse.jgit.diff.RawText} objects in a Git conformant way,
+ * using diff-3 style. This convenience method accepts the names for the
* three sequences (base and the two merged sequences) as explicit
* parameters and doesn't require the caller to specify a List
*
* @param out
- * the {@link OutputStream} where to write the textual
+ * the {@link java.io.OutputStream} where to write the textual
* presentation
* @param res
* the merge result which should be presented
@@ -97,17 +133,20 @@ public class MergeFormatter {
* the name ranges from ours should get
* @param theirsName
* the name ranges from theirs should get
- * @param charsetName
- * the name of the characterSet used when writing conflict
- * metadata
- * @throws IOException
+ * @param charset
+ * the character set used when writing conflict metadata
+ * @throws java.io.IOException
+ * if an IO error occurred
+ * @since 6.7
*/
- public void formatMerge(OutputStream out, MergeResult res, String baseName,
- String oursName, String theirsName, String charsetName) throws IOException {
- List<String> names = new ArrayList<String>(3);
+ @SuppressWarnings("unchecked")
+ public void formatMergeDiff3(OutputStream out,
+ MergeResult res, String baseName, String oursName,
+ String theirsName, Charset charset) throws IOException {
+ List<String> names = new ArrayList<>(3);
names.add(baseName);
names.add(oursName);
names.add(theirsName);
- formatMerge(out, res, names, charsetName);
+ formatMergeDiff3(out, res, names, charset);
}
}
ble30 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/apps/sharebymail/l10n/zh_TW.js
blob: c2cb85919e0782fc26a65f2410c3b054202b5baf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63