changeset 785:427f550c4554

Implement FetchService
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Tue, 29 Apr 2014 17:10:46 +0200
parents f0327df85b9d
children 969b545efa1b
files mercurial-server/src/META-INF/build-server-plugin-mercurial.xml mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialFetchService.java
diffstat 2 files changed, 44 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-server/src/META-INF/build-server-plugin-mercurial.xml	Thu Apr 17 20:16:48 2014 +0200
+++ b/mercurial-server/src/META-INF/build-server-plugin-mercurial.xml	Tue Apr 29 17:10:46 2014 +0200
@@ -34,4 +34,6 @@
 
   <bean class="jetbrains.buildServer.buildTriggers.vcs.mercurial.command.CommandSettingsForRootImpl"/>
   <bean class="jetbrains.buildServer.buildTriggers.vcs.mercurial.command.ExtensionsWeaver"/>
+
+  <bean class="jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialFetchService"/>
 </beans>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialFetchService.java	Tue Apr 29 17:10:46 2014 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * 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 jetbrains.buildServer.buildTriggers.vcs.mercurial;
+
+import jetbrains.buildServer.vcs.CheckoutRules;
+import jetbrains.buildServer.vcs.FetchService;
+import jetbrains.buildServer.vcs.VcsException;
+import jetbrains.buildServer.vcs.VcsRoot;
+import org.jetbrains.annotations.NotNull;
+
+public class MercurialFetchService implements FetchService, MercurialServerExtension {
+
+  private final MercurialVcsSupport myVcs;
+  private final HgVcsRootFactory myHgVcsRootFactory;
+
+  public MercurialFetchService(@NotNull MercurialVcsSupport vcs,
+                               @NotNull HgVcsRootFactory hgVcsRootFactory) {
+    myVcs = vcs;
+    myHgVcsRootFactory = hgVcsRootFactory;
+    vcs.addExtension(this);
+  }
+
+  public void fetchRepository(@NotNull VcsRoot root,
+                              @NotNull CheckoutRules rules,
+                              @NotNull FetchRepositoryCallback callback) throws VcsException {
+    myVcs.syncRepository(myHgVcsRootFactory.createHgRoot(root));
+  }
+}