blob: 3fdb3b41d0fb52493e824c97579c958ce22a5345 (
plain) (
blame)
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
|
/*******************************************************************************
* Copyright (C) 2015, Max Hohenegger <eclipse@hohenegger.eu>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.egit.gitflow.op;
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.egit.gitflow.GitFlowRepository;
import org.eclipse.egit.gitflow.WrongGitFlowStateException;
import org.eclipse.egit.gitflow.internal.CoreText;
/**
* Common logic for hotfix branch operations.
*/
abstract public class AbstractHotfixOperation extends
AbstractVersionFinishOperation {
/**
* @param repository
* @param hotfixName
*/
public AbstractHotfixOperation(GitFlowRepository repository,
String hotfixName) {
super(repository, hotfixName);
}
/**
* @param repository
* @return current hotfix branch name
* @throws WrongGitFlowStateException
* @throws CoreException
* @throws IOException
*/
protected static String getHotfixName(GitFlowRepository repository)
throws WrongGitFlowStateException, CoreException, IOException {
if (!repository.isHotfix()) {
throw new WrongGitFlowStateException(
CoreText.AbstractHotfixOperation_notOnAHotfixBranch);
}
String currentBranch = repository.getRepository().getBranch();
return currentBranch.substring(repository.getConfig().getHotfixPrefix().length());
}
}
|