/*
 * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.b2international.index.revision;

import java.util.Collections;
import java.util.Set;

/**
 * @since 7.2
 */
public final class BranchMergeOperation {

	private BaseRevisionBranching branching;
	
	final String fromPath;
	final String toPath;
	Set<String> exclusions;
	String author;
	String commitMessage;
	RevisionConflictProcessor conflictProcessor = new RevisionConflictProcessor.Default();
	boolean squash = false;
	Object context;

	public BranchMergeOperation(BaseRevisionBranching branching, String fromPath, String toPath) {
		this.branching = branching;
		this.fromPath = fromPath;
		this.toPath = toPath;
	}
	
	public BranchMergeOperation author(String author) {
		this.author = author;
		return this;
	}
	
	public BranchMergeOperation commitMessage(String commitMessage) {
		this.commitMessage = commitMessage;
		return this;
	}
	
	public BranchMergeOperation squash(boolean squash) {
		this.squash = squash;
		return this;
	}
	
	public BranchMergeOperation conflictProcessor(RevisionConflictProcessor conflictProcessor) {
		this.conflictProcessor = conflictProcessor;
		return this;
	}
	
	public BranchMergeOperation context(Object context) {
		this.context = context;
		return this;
	}
	
	public Commit merge() {
		return branching.doMerge(this);
	}

	public BranchMergeOperation exclude(String id) {
		return exclude(Collections.singleton(id));
	}
	
	public BranchMergeOperation exclude(Set<String> ids) {
		this.exclusions = ids;
		return this;
	}
	
	public Set<String> getExclusions() {
		return exclusions;
	}
	
}

@@ -678,26 +678,21 @@
 va.util.
-Collection
+Array
 s;%0Aimpor
@@ -709,16 +709,56 @@
 l.Set;%0A%0A
+import com.google.common.collect.Sets;%0A%0A
 /**%0A * @
@@ -1969,19 +1969,24 @@
 e(String
+ ...
  id
+s
 ) %7B%0A%09%09re
@@ -2002,32 +2002,37 @@
 ude(
-Collections.singleton(id
+Arrays.copyOf(ids, ids.length
 ));%0A
@@ -2073,19 +2073,24 @@
 exclude(
-Set
+Iterable
 %3CString%3E
@@ -2117,19 +2117,36 @@
 sions = 
+Sets.newHashSet(
 ids
+)
 ;%0A%09%09retu

Use varargs, defensive copy in merge operation exclude setters