Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Hohenegger2015-11-10 00:53:41 +0000
committerMatthias Sohn2015-11-23 00:02:43 +0000
commit211bb85b48481e7bc7f4242c33b7d177da91b7e2 (patch)
tree1e898853dc274545a2077e46a5a01cb308454115 /org.eclipse.egit.gitflow
parent25cfe1c0b4d3fca62594b13777898bdf871e6e3f (diff)
downloadegit-211bb85b48481e7bc7f4242c33b7d177da91b7e2.tar.gz
egit-211bb85b48481e7bc7f4242c33b7d177da91b7e2.tar.xz
egit-211bb85b48481e7bc7f4242c33b7d177da91b7e2.zip
Fix 'GitFlow doesn't use configured timeout for remote git commands'
- added timeout parameter to API - deprecated existing API Bug: 481553 Change-Id: I3a69bc9f5dea0c1fa81f9c672d1c7e1421a27c4e Signed-off-by: Max Hohenegger <eclipse@hohenegger.eu> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.gitflow')
-rw-r--r--org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureListOperation.java2
-rw-r--r--org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureTrackOperation.java23
-rw-r--r--org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java26
3 files changed, 46 insertions, 5 deletions
diff --git a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureListOperation.java b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureListOperation.java
index 40605c1525..5772d21b5b 100644
--- a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureListOperation.java
+++ b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureListOperation.java
@@ -58,7 +58,7 @@ public final class FeatureListOperation extends GitFlowOperation {
String uriString = FILE
+ repository.getRepository().getDirectory().getPath();
try {
- operationResult = fetch(monitor);
+ operationResult = fetch(monitor, timeout);
URIish uri = new URIish(uriString);
ListRemoteOperation listRemoteOperation = new ListRemoteOperation(
diff --git a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureTrackOperation.java b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureTrackOperation.java
index d3818eca02..52fb709b8f 100644
--- a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureTrackOperation.java
+++ b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/FeatureTrackOperation.java
@@ -42,16 +42,37 @@ public final class FeatureTrackOperation extends AbstractFeatureOperation {
private FetchResult operationResult;
+ private int timeout;
+
/**
* Track given ref, referencing a feature branch.
*
* @param repository
* @param ref
+ * @deprecated Use
+ * {@link FeatureTrackOperation#FeatureTrackOperation(GitFlowRepository, Ref, int)}
+ * instead.
*/
+ @Deprecated
public FeatureTrackOperation(GitFlowRepository repository, Ref ref) {
+ this(repository, ref, 0);
+ }
+
+ /**
+ * Track given ref, referencing a feature branch.
+ *
+ * @param repository
+ * @param ref
+ * @param timeout
+ * timeout in seconds for remote operations
+ * @since 4.2
+ */
+ public FeatureTrackOperation(GitFlowRepository repository, Ref ref,
+ int timeout) {
this(repository, ref, ref.getName().substring(
(REMOTE_ORIGIN_FEATURE_PREFIX + repository.getConfig()
.getFeaturePrefix()).length()));
+ this.timeout = timeout;
}
/**
@@ -72,7 +93,7 @@ public final class FeatureTrackOperation extends AbstractFeatureOperation {
try {
String newLocalBranch = repository
.getConfig().getFeatureBranchName(featureName);
- operationResult = fetch(monitor);
+ operationResult = fetch(monitor, timeout);
if (repository.hasBranch(newLocalBranch)) {
String errorMessage = String.format(
diff --git a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
index fdee6d6323..41648921ff 100644
--- a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
+++ b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
@@ -246,21 +246,41 @@ abstract public class GitFlowOperation implements IEGitOperation {
}
/**
+ * Fetch using the default remote configuration
+ *
* @param monitor
- * @return resulting of fetching from remote
+ * @param timeout
+ * timeout in seconds
+ * @return result of fetching from remote
* @throws URISyntaxException
* @throws InvocationTargetException
+ *
+ * @since 4.2
*/
- protected FetchResult fetch(IProgressMonitor monitor)
+ protected FetchResult fetch(IProgressMonitor monitor, int timeout)
throws URISyntaxException, InvocationTargetException {
RemoteConfig config = repository.getConfig().getDefaultRemoteConfig();
FetchOperation fetchOperation = new FetchOperation(
- repository.getRepository(), config, 0, false);
+ repository.getRepository(), config, timeout, false);
fetchOperation.run(monitor);
return fetchOperation.getOperationResult();
}
/**
+ * @param monitor
+ * @return resulting of fetching from remote
+ * @throws URISyntaxException
+ * @throws InvocationTargetException
+ * @deprecated Use {@link GitFlowOperation#fetch(IProgressMonitor, int)}
+ * instead.
+ */
+ @Deprecated
+ protected FetchResult fetch(IProgressMonitor monitor)
+ throws URISyntaxException, InvocationTargetException {
+ return fetch(monitor, 0);
+ }
+
+ /**
* @return The result of the merge this operation performs. May be null, if
* no merge was performed.
*/

Back to the top