changeset 157:43f4c91d5eaa

Implement BranchSupport interface
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Tue, 11 Jan 2011 20:38:46 +0300
parents 3a8af53dea6b (current diff) 7e36394a9c00 (diff)
children c8af439595ba
files mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java
diffstat 7 files changed, 709 insertions(+), 571 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/ChangeSet.java	Tue Jan 11 18:16:49 2011 +0300
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/ChangeSet.java	Tue Jan 11 20:38:46 2011 +0300
@@ -109,4 +109,13 @@
   public boolean containsFiles() {
     return myContainsFiles;
   }
+
+
+  /**
+   * Check if changeset is initial changeset (has no parents)
+   * @return true if changeset is initial changeset
+   */
+  public boolean isInitial() {
+    return getParents() == null;
+  }
 }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/LogCommand.java	Tue Jan 11 18:16:49 2011 +0300
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/LogCommand.java	Tue Jan 11 20:38:46 2011 +0300
@@ -33,6 +33,7 @@
   private String myFromId;
   private String myToId;
   private ArrayList<String> myPaths;
+  private Integer myLimit = null;
   private static final String CHANGESET_PREFIX = "changeset:";
   private static final String USER_PREFIX = "user:";
   private static final String PARENT_PREFIX = "parent:";
@@ -57,6 +58,10 @@
     myPaths = new ArrayList<String>(relPaths);
   }
 
+  public void setLimit(final int limit) {
+    myLimit = limit;
+  }
+
   public List<ChangeSet> execute() throws VcsException {
     GeneralCommandLine cli = createCommandLine();
     cli.addParameter("log");
@@ -71,6 +76,10 @@
     String to = myToId;
     if (to == null) to = "tip";
     cli.addParameter(from + ":" + to);
+    if (myLimit != null) {
+      cli.addParameter("--limit");
+      cli.addParameter(myLimit.toString());
+    }
     if (myPaths != null) {
       for (String path: myPaths) {
         cli.addParameter(path);
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Tue Jan 11 18:16:49 2011 +0300
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Tue Jan 11 20:38:46 2011 +0300
@@ -52,7 +52,7 @@
  * <p>Working copy of repository is created in the $TEAMCITY_DATA_PATH/system/caches/hg_&lt;hash code> folder.
  * <p>Personal builds (remote runs) are not yet supported, they require corresponding functionality from the IDE.
  */
-public class MercurialVcsSupport extends ServerVcsSupport implements LabelingSupport, VcsFileContentProvider {
+public class MercurialVcsSupport extends ServerVcsSupport implements LabelingSupport, VcsFileContentProvider, BranchSupport {
   private ConcurrentMap<String, Lock> myWorkDirLocks= new ConcurrentHashMap<String, Lock>();
   private VcsManager myVcsManager;
   private File myDefaultWorkFolderParent;
@@ -412,6 +412,54 @@
   }
 
   @NotNull
+  public String getRemoteRunOnBranchPattern() {
+    return "remote-run/{teamcity.user}/.+";
+  }
+
+  @NotNull
+  public Map<String, String> getBranchesRevisions(@NotNull VcsRoot root) throws VcsException {
+    syncClonedRepository(root);
+    Settings settings = createSettings(root);
+    BranchesCommand branches = new BranchesCommand(settings);
+    Map<String, String> result = new HashMap<String, String>();
+    for (Map.Entry<String, ChangeSet> entry : branches.execute().entrySet()) {
+      result.put(entry.getKey(), entry.getValue().getId());
+    }
+    return result;
+  }
+
+  @NotNull
+  public Map<String, String> getBranchRootOptions(@NotNull VcsRoot root, @NotNull String branchName) {
+    final Map<String, String> options = new HashMap<String, String>(root.getProperties());
+    options.put(Constants.BRANCH_NAME_PROP, branchName);
+    return options;
+  }
+
+  public List<ModificationData> collectChanges(@NotNull VcsRoot fromRoot, @NotNull String fromRootRevision,
+                                               @NotNull VcsRoot toRoot, @Nullable String toRootRevision,
+                                               @NotNull CheckoutRules checkoutRules) throws VcsException {
+    //we get all branches while clone, if vcs roots are related it is doesn't matter in which one search for branch point
+    syncClonedRepository(fromRoot);
+    String branchPoint = getBranchPoint(fromRoot, fromRootRevision, toRootRevision);
+    return ((CollectChangesByCheckoutRules) getCollectChangesPolicy()).collectChanges(toRoot, branchPoint, toRootRevision, checkoutRules);
+  }
+
+  private String getBranchPoint(@NotNull VcsRoot root, String branchOneRev, String branchTwoRev) throws VcsException {
+    Settings settings = createSettings(root);
+    LogCommand lc = new LogCommand(settings);
+    lc.setFromRevId(new ChangeSetRevision(branchOneRev).getId());
+    lc.setToRevId(new ChangeSetRevision(branchTwoRev).getId());
+    lc.setLimit(1);
+    List<ChangeSet> changeSets = lc.execute();
+    ChangeSet cs = changeSets.get(0);
+    if (cs.isInitial()) {
+      return cs.getId();
+    } else {
+      return cs.getParents().get(0).getId();
+    }
+  }
+
+  @NotNull
   public CollectChangesPolicy getCollectChangesPolicy() {
     return new CollectChangesByCheckoutRules() {
       public List<ModificationData> collectChanges(@NotNull VcsRoot root, @NotNull String fromVersion, @Nullable String currentVersion, @NotNull CheckoutRules checkoutRules) throws VcsException {
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Tue Jan 11 18:16:49 2011 +0300
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Tue Jan 11 20:38:46 2011 +0300
@@ -84,14 +84,20 @@
     return ((CollectChangesByCheckoutRules) myVcs.getCollectChangesPolicy()).collectChanges(vcsRoot, from, to, rules);
   }
 
-  private List<ModificationData> collectChanges(@NotNull VcsRoot vcsRoot, @NotNull String from, @NotNull String to, @NotNull IncludeRule rule) throws VcsException {
-    return ((CollectChangesByIncludeRules)myVcs.getCollectChangesPolicy()).getChangeCollector(vcsRoot, from, to).collectChanges(rule);
+  public void test_collect_changes_between_two_same_roots() throws Exception {
+    VcsRootImpl vcsRoot = createVcsRoot(simpleRepo());
+    VcsRootImpl sameVcsRoot = createVcsRoot(simpleRepo());
+    List<ModificationData> changes = myVcs.collectChanges(vcsRoot, "0:9875b412a788", sameVcsRoot, "3:9522278aa38d", new CheckoutRules(""));
+    do_check_for_collect_changes(changes);
   }
 
   public void test_collect_changes() throws Exception {
     VcsRootImpl vcsRoot = createVcsRoot(simpleRepo());
+    List<ModificationData> changes = collectChanges(vcsRoot, "0:9875b412a788", "3:9522278aa38d", new CheckoutRules(""));
+    do_check_for_collect_changes(changes);
+  }
 
-    List<ModificationData> changes = collectChanges(vcsRoot, "0:9875b412a788", "3:9522278aa38d", new CheckoutRules(""));
+  private void do_check_for_collect_changes(List<ModificationData> changes) throws Exception {
     assertEquals(3, changes.size());
 
     ModificationData md1 = changes.get(0);
@@ -337,6 +343,16 @@
     return new File("mercurial-tests/testData/rep2").getAbsolutePath();
   }
 
+  public void test_collect_changes_between_two_different_roots() throws Exception {
+    VcsRootImpl defaultRoot = createVcsRoot(mergeCommittsRepo());
+    VcsRootImpl branchRoot = createVcsRoot(mergeCommittsRepo(), "test");
+    List<ModificationData> changes = myVcs.collectChanges(defaultRoot, "11:48177654181c", branchRoot, "10:fc524efc2bc4", CheckoutRules.DEFAULT);
+    assertEquals(changes.size(), 2);
+
+    assertEquals("9:8c44244d6645", changes.get(0).getVersion());
+    assertEquals("10:fc524efc2bc4", changes.get(1).getVersion());
+  }
+
   public void test_collect_changes_merge() throws Exception {
     VcsRootImpl vcsRoot = createVcsRoot(mergeCommittsRepo());
 
--- a/mercurial.ipr	Tue Jan 11 18:16:49 2011 +0300
+++ b/mercurial.ipr	Tue Jan 11 20:38:46 2011 +0300
@@ -443,6 +443,7 @@
     <library name="TeamCityAPI-server">
       <CLASSES>
         <root url="jar://$TeamCityDistribution$/devPackage/server-api.jar!/" />
+        <root url="jar://$TeamCityDistribution$/webapps/ROOT/WEB-INF/lib/server.jar!/" />
       </CLASSES>
       <JAVADOC />
       <SOURCES>
--- a/mercurial.properties	Tue Jan 11 18:16:49 2011 +0300
+++ b/mercurial.properties	Tue Jan 11 20:38:46 2011 +0300
@@ -1,5 +1,4 @@
-path.variable.ant_home=C\:/Tools/apache-ant-1.7.1
-path.variable.maven_repository=C\:/Documents and Settings/pavel.sher/.m2/repository
-path.variable.teamcitydistribution=C\:/TeamCity
-path.variable.user_home_grails=C\:/Documents and Settings/pavel.sher/.grails
-path.variable.user_home_griffon=C\:/Documents and Settings/pavel.sher/.griffon
\ No newline at end of file
+path.variable.maven_repository=/home/nd/.m2/repository
+path.variable.teamcitydistribution=/home/nd/sandbox/TeamCity-Eluru
+path.variable.path.to.idea.libs=/home/nd/sandbox/idea/idea-IU-98.319/lib
+jdk.home.1.5=/opt/jdk1.5.0_18
\ No newline at end of file
--- a/mercurial.xml	Tue Jan 11 18:16:49 2011 +0300
+++ b/mercurial.xml	Tue Jan 11 20:38:46 2011 +0300
@@ -1,563 +1,619 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="mercurial" default="all">
-  
-  
-  <property file="mercurial.properties"/>
-  <!-- Uncomment the following property if no tests compilation is needed -->
-  <!-- 
-  <property name="skip.tests" value="true"/>
-   -->
-  
-  <!-- Compiler options -->
-  
-  <property name="compiler.debug" value="on"/>
-  <property name="compiler.generate.no.warnings" value="off"/>
-  <property name="compiler.args" value=""/>
-  <property name="compiler.max.memory" value="128m"/>
-  <patternset id="ignored.files">
-    <exclude name="**/CVS/**"/>
-    <exclude name="**/SCCS/**"/>
-    <exclude name="**/RCS/**"/>
-    <exclude name="**/rcs/**"/>
-    <exclude name="**/.DS_Store/**"/>
-    <exclude name="**/.svn/**"/>
-    <exclude name="**/.pyc/**"/>
-    <exclude name="**/.pyo/**"/>
-    <exclude name="**/*.pyc/**"/>
-    <exclude name="**/*.pyo/**"/>
-    <exclude name="**/.git/**"/>
-    <exclude name="**/*.hprof/**"/>
-    <exclude name="**/_svn/**"/>
-    <exclude name="**/.hg/**"/>
-    <exclude name="**/.sbas/**"/>
-    <exclude name="**/.IJI.*/**"/>
-  </patternset>
-  <patternset id="library.patterns">
-    <include name="*.zip"/>
-    <include name="*.war"/>
-    <include name="*.egg"/>
-    <include name="*.ear"/>
-    <include name="*.swc"/>
-    <include name="*.jar"/>
-  </patternset>
-  <patternset id="compiler.resources">
-    <include name="**/?*.properties"/>
-    <include name="**/?*.xml"/>
-    <include name="**/?*.gif"/>
-    <include name="**/?*.png"/>
-    <include name="**/?*.jpeg"/>
-    <include name="**/?*.jpg"/>
-    <include name="**/?*.html"/>
-    <include name="**/?*.dtd"/>
-    <include name="**/?*.tld"/>
-    <include name="**/?*.jsp"/>
-    <include name="**/?*.tag"/>
-  </patternset>
-  
-  
-  <!-- Project Libraries -->
-  
-  <path id="library.idea-openapi.classpath">
-    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/annotations.jar"/>
-    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/openapi.jar"/>
-    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/resources_en.jar"/>
-    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/util.jar"/>
-  </path>
-  
-  <path id="library.jmock.classpath">
-    <pathelement location="${basedir}/mercurial-tests/lib/jmock-SNAPSHOT.jar"/>
-  </path>
-  
-  <path id="library.junit.classpath">
-    <pathelement location="${basedir}/mercurial-tests/lib/junit-3.8.1.jar"/>
-  </path>
-  
-  <path id="library.log4j.classpath">
-    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/log4j-1.2.12.jar"/>
-  </path>
-  
-  <path id="library.teamcity-impl.classpath">
-    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/patches-impl.jar"/>
-    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/trove4j.jar"/>
-  </path>
-  
-  <path id="library.teamcity-testsapi.classpath">
-    <pathelement location="${path.variable.teamcitydistribution}/devPackage/tests/patches-test.jar"/>
-  </path>
-  
-  <path id="library.teamcityapi-agent.classpath">
-    <pathelement location="${path.variable.teamcitydistribution}/devPackage/agent-api.jar"/>
-  </path>
-  
-  <path id="library.teamcityapi-common.classpath">
-    <pathelement location="${path.variable.teamcitydistribution}/devPackage/common-api.jar"/>
-  </path>
-  
-  <path id="library.teamcityapi-server.classpath">
-    <pathelement location="${path.variable.teamcitydistribution}/devPackage/server-api.jar"/>
-  </path>
-  
-  <path id="library.testng.classpath">
-    <pathelement location="${basedir}/mercurial-tests/lib/testng-5.7-jdk15.jar"/>
-  </path>
-  
-  
-  <!-- Global Libraries -->
-  
-  
-  <!-- Application Server Libraries -->
-  
-  <!-- Modules -->
-  
-  
-  <!-- Module main -->
-  
-  <dirname property="module.main.basedir" file="${ant.file}"/>
-  
-  
-  
-  <property name="compiler.args.main" value="${compiler.args}"/>
-  
-  <property name="main.output.dir" value="undefined"/>
-  <property name="main.testoutput.dir" value="undefined"/>
-  
-  <path id="main.module.bootclasspath">
-    <!-- Paths to be included in compilation bootclasspath -->
-  </path>
-  
-  <path id="main.module.production.classpath"/>
-  
-  <path id="main.runtime.production.module.classpath"/>
-  
-  <path id="main.module.classpath"/>
-  
-  <path id="main.runtime.module.classpath"/>
-  
-  
-  <patternset id="excluded.from.module.main">
-    <patternset refid="ignored.files"/>
-  </patternset>
-  
-  <patternset id="excluded.from.compilation.main">
-    <patternset refid="excluded.from.module.main"/>
-  </patternset>
-  
-  
-  <target name="compile.module.main" depends="compile.module.main.production,compile.module.main.tests" description="Compile module main"/>
-  
-  <target name="compile.module.main.production" description="Compile module main; production classes"/>
-  
-  <target name="compile.module.main.tests" depends="compile.module.main.production" description="compile module main; test classes" unless="skip.tests"/>
-  
-  <target name="clean.module.main" description="cleanup module">
-    <delete dir="${main.output.dir}"/>
-    <delete dir="${main.testoutput.dir}"/>
-  </target>
-  
-  
-  <!-- Module mercurial-common -->
-  
-  <dirname property="module.mercurial-common.basedir" file="${ant.file}"/>
-  
-  
-  
-  <property name="compiler.args.mercurial-common" value="${compiler.args}"/>
-  
-  <property name="mercurial-common.output.dir" value="${module.mercurial-common.basedir}/mercurial-common/classes"/>
-  <property name="mercurial-common.testoutput.dir" value="${module.mercurial-common.basedir}/mercurial-common/classes"/>
-  
-  <path id="mercurial-common.module.bootclasspath">
-    <!-- Paths to be included in compilation bootclasspath -->
-  </path>
-  
-  <path id="mercurial-common.module.production.classpath">
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  <path id="mercurial-common.runtime.production.module.classpath">
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  <path id="mercurial-common.module.classpath">
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  <path id="mercurial-common.runtime.module.classpath">
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  
-  <patternset id="excluded.from.module.mercurial-common">
-    <patternset refid="ignored.files"/>
-  </patternset>
-  
-  <patternset id="excluded.from.compilation.mercurial-common">
-    <patternset refid="excluded.from.module.mercurial-common"/>
-  </patternset>
-  
-  <path id="mercurial-common.module.sourcepath">
-    <dirset dir="${module.mercurial-common.basedir}/mercurial-common">
-      <include name="src"/>
-    </dirset>
-  </path>
-  
-  
-  <target name="compile.module.mercurial-common" depends="compile.module.mercurial-common.production,compile.module.mercurial-common.tests" description="Compile module mercurial-common"/>
-  
-  <target name="compile.module.mercurial-common.production" description="Compile module mercurial-common; production classes">
-    <mkdir dir="${mercurial-common.output.dir}"/>
-    <javac destdir="${mercurial-common.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
-      <compilerarg line="${compiler.args.mercurial-common}"/>
-      <bootclasspath refid="mercurial-common.module.bootclasspath"/>
-      <classpath refid="mercurial-common.module.production.classpath"/>
-      <src refid="mercurial-common.module.sourcepath"/>
-      <patternset refid="excluded.from.compilation.mercurial-common"/>
-    </javac>
-    
-    <copy todir="${mercurial-common.output.dir}">
-      <fileset dir="${module.mercurial-common.basedir}/mercurial-common/src">
-        <patternset refid="compiler.resources"/>
-        <type type="file"/>
-      </fileset>
-    </copy>
-  </target>
-  
-  <target name="compile.module.mercurial-common.tests" depends="compile.module.mercurial-common.production" description="compile module mercurial-common; test classes" unless="skip.tests"/>
-  
-  <target name="clean.module.mercurial-common" description="cleanup module">
-    <delete dir="${mercurial-common.output.dir}"/>
-    <delete dir="${mercurial-common.testoutput.dir}"/>
-  </target>
-  
-  
-  <!-- Module mercurial-agent -->
-  
-  <dirname property="module.mercurial-agent.basedir" file="${ant.file}"/>
-  
-  
-  
-  <property name="compiler.args.mercurial-agent" value="${compiler.args}"/>
-  
-  <property name="mercurial-agent.output.dir" value="${module.mercurial-agent.basedir}/mercurial-agent/classes"/>
-  <property name="mercurial-agent.testoutput.dir" value="${module.mercurial-agent.basedir}/mercurial-agent/classes"/>
-  
-  <path id="mercurial-agent.module.bootclasspath">
-    <!-- Paths to be included in compilation bootclasspath -->
-  </path>
-  
-  <path id="mercurial-agent.module.production.classpath">
-    <path refid="library.teamcityapi-agent.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  <path id="mercurial-agent.runtime.production.module.classpath">
-    <pathelement location="${mercurial-agent.output.dir}"/>
-    <path refid="library.teamcityapi-agent.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  <path id="mercurial-agent.module.classpath">
-    <pathelement location="${mercurial-agent.output.dir}"/>
-    <path refid="library.teamcityapi-agent.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  <path id="mercurial-agent.runtime.module.classpath">
-    <pathelement location="${mercurial-agent.output.dir}"/>
-    <path refid="library.teamcityapi-agent.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-  </path>
-  
-  
-  <patternset id="excluded.from.module.mercurial-agent">
-    <patternset refid="ignored.files"/>
-  </patternset>
-  
-  <patternset id="excluded.from.compilation.mercurial-agent">
-    <patternset refid="excluded.from.module.mercurial-agent"/>
-  </patternset>
-  
-  <path id="mercurial-agent.module.sourcepath">
-    <dirset dir="${module.mercurial-agent.basedir}/mercurial-agent">
-      <include name="src"/>
-    </dirset>
-  </path>
-  
-  
-  <target name="compile.module.mercurial-agent" depends="compile.module.mercurial-agent.production,compile.module.mercurial-agent.tests" description="Compile module mercurial-agent"/>
-  
-  <target name="compile.module.mercurial-agent.production" depends="compile.module.mercurial-common" description="Compile module mercurial-agent; production classes">
-    <mkdir dir="${mercurial-agent.output.dir}"/>
-    <javac destdir="${mercurial-agent.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
-      <compilerarg line="${compiler.args.mercurial-agent}"/>
-      <bootclasspath refid="mercurial-agent.module.bootclasspath"/>
-      <classpath refid="mercurial-agent.module.production.classpath"/>
-      <src refid="mercurial-agent.module.sourcepath"/>
-      <patternset refid="excluded.from.compilation.mercurial-agent"/>
-    </javac>
-    
-    <copy todir="${mercurial-agent.output.dir}">
-      <fileset dir="${module.mercurial-agent.basedir}/mercurial-agent/src">
-        <patternset refid="compiler.resources"/>
-        <type type="file"/>
-      </fileset>
-    </copy>
-  </target>
-  
-  <target name="compile.module.mercurial-agent.tests" depends="compile.module.mercurial-agent.production" description="compile module mercurial-agent; test classes" unless="skip.tests"/>
-  
-  <target name="clean.module.mercurial-agent" description="cleanup module">
-    <delete dir="${mercurial-agent.output.dir}"/>
-    <delete dir="${mercurial-agent.testoutput.dir}"/>
-  </target>
-  
-  
-  <!-- Module mercurial-server -->
-  
-  <dirname property="module.mercurial-server.basedir" file="${ant.file}"/>
-  
-  
-  
-  <property name="compiler.args.mercurial-server" value="${compiler.args}"/>
-  
-  <property name="mercurial-server.output.dir" value="${module.mercurial-server.basedir}/mercurial-server/classes"/>
-  <property name="mercurial-server.testoutput.dir" value="${module.mercurial-server.basedir}/mercurial-server/classes"/>
-  
-  <path id="mercurial-server.module.bootclasspath">
-    <!-- Paths to be included in compilation bootclasspath -->
-  </path>
-  
-  <path id="mercurial-server.module.production.classpath">
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-  </path>
-  
-  <path id="mercurial-server.runtime.production.module.classpath">
-    <pathelement location="${mercurial-server.output.dir}"/>
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-  </path>
-  
-  <path id="mercurial-server.module.classpath">
-    <pathelement location="${mercurial-server.output.dir}"/>
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-  </path>
-  
-  <path id="mercurial-server.runtime.module.classpath">
-    <pathelement location="${mercurial-server.output.dir}"/>
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-  </path>
-  
-  
-  <patternset id="excluded.from.module.mercurial-server">
-    <patternset refid="ignored.files"/>
-  </patternset>
-  
-  <patternset id="excluded.from.compilation.mercurial-server">
-    <patternset refid="excluded.from.module.mercurial-server"/>
-  </patternset>
-  
-  <path id="mercurial-server.module.sourcepath">
-    <dirset dir="${module.mercurial-server.basedir}/mercurial-server">
-      <include name="resources"/>
-      <include name="src"/>
-    </dirset>
-  </path>
-  
-  
-  <target name="compile.module.mercurial-server" depends="compile.module.mercurial-server.production,compile.module.mercurial-server.tests" description="Compile module mercurial-server"/>
-  
-  <target name="compile.module.mercurial-server.production" depends="compile.module.mercurial-common" description="Compile module mercurial-server; production classes">
-    <mkdir dir="${mercurial-server.output.dir}"/>
-    <javac destdir="${mercurial-server.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
-      <compilerarg line="${compiler.args.mercurial-server}"/>
-      <bootclasspath refid="mercurial-server.module.bootclasspath"/>
-      <classpath refid="mercurial-server.module.production.classpath"/>
-      <src refid="mercurial-server.module.sourcepath"/>
-      <patternset refid="excluded.from.compilation.mercurial-server"/>
-    </javac>
-    
-    <copy todir="${mercurial-server.output.dir}">
-      <fileset dir="${module.mercurial-server.basedir}/mercurial-server/resources">
-        <patternset refid="compiler.resources"/>
-        <type type="file"/>
-      </fileset>
-      <fileset dir="${module.mercurial-server.basedir}/mercurial-server/src">
-        <patternset refid="compiler.resources"/>
-        <type type="file"/>
-      </fileset>
-    </copy>
-  </target>
-  
-  <target name="compile.module.mercurial-server.tests" depends="compile.module.mercurial-server.production" description="compile module mercurial-server; test classes" unless="skip.tests"/>
-  
-  <target name="clean.module.mercurial-server" description="cleanup module">
-    <delete dir="${mercurial-server.output.dir}"/>
-    <delete dir="${mercurial-server.testoutput.dir}"/>
-  </target>
-  
-  
-  <!-- Module mercurial-tests -->
-  
-  <dirname property="module.mercurial-tests.basedir" file="${ant.file}"/>
-  
-  
-  
-  <property name="compiler.args.mercurial-tests" value="${compiler.args}"/>
-  
-  <property name="mercurial-tests.output.dir" value="${module.mercurial-tests.basedir}/mercurial-tests/classes"/>
-  <property name="mercurial-tests.testoutput.dir" value="${module.mercurial-tests.basedir}/mercurial-tests/classes"/>
-  
-  <path id="mercurial-tests.module.bootclasspath">
-    <!-- Paths to be included in compilation bootclasspath -->
-  </path>
-  
-  <path id="mercurial-tests.module.production.classpath">
-    <pathelement location="${mercurial-server.output.dir}"/>
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <path refid="library.junit.classpath"/>
-    <path refid="library.testng.classpath"/>
-    <path refid="library.jmock.classpath"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <pathelement location="${mercurial-agent.output.dir}"/>
-    <path refid="library.teamcity-testsapi.classpath"/>
-    <path refid="library.teamcity-impl.classpath"/>
-    <path refid="library.teamcityapi-agent.classpath"/>
-  </path>
-  
-  <path id="mercurial-tests.runtime.production.module.classpath">
-    <pathelement location="${mercurial-tests.output.dir}"/>
-    <pathelement location="${mercurial-server.output.dir}"/>
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.junit.classpath"/>
-    <path refid="library.testng.classpath"/>
-    <path refid="library.jmock.classpath"/>
-    <pathelement location="${mercurial-agent.output.dir}"/>
-    <path refid="library.teamcityapi-agent.classpath"/>
-    <path refid="library.teamcity-testsapi.classpath"/>
-    <path refid="library.teamcity-impl.classpath"/>
-  </path>
-  
-  <path id="mercurial-tests.module.classpath">
-    <pathelement location="${mercurial-tests.output.dir}"/>
-    <pathelement location="${mercurial-server.output.dir}"/>
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <path refid="library.junit.classpath"/>
-    <path refid="library.testng.classpath"/>
-    <path refid="library.jmock.classpath"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <pathelement location="${mercurial-agent.output.dir}"/>
-    <path refid="library.teamcity-testsapi.classpath"/>
-    <path refid="library.teamcity-impl.classpath"/>
-    <path refid="library.teamcityapi-agent.classpath"/>
-  </path>
-  
-  <path id="mercurial-tests.runtime.module.classpath">
-    <pathelement location="${mercurial-tests.output.dir}"/>
-    <pathelement location="${mercurial-server.output.dir}"/>
-    <path refid="library.teamcityapi-server.classpath"/>
-    <path refid="library.idea-openapi.classpath"/>
-    <path refid="library.log4j.classpath"/>
-    <pathelement location="${mercurial-common.output.dir}"/>
-    <path refid="library.teamcityapi-common.classpath"/>
-    <path refid="library.junit.classpath"/>
-    <path refid="library.testng.classpath"/>
-    <path refid="library.jmock.classpath"/>
-    <pathelement location="${mercurial-agent.output.dir}"/>
-    <path refid="library.teamcityapi-agent.classpath"/>
-    <path refid="library.teamcity-testsapi.classpath"/>
-    <path refid="library.teamcity-impl.classpath"/>
-  </path>
-  
-  
-  <patternset id="excluded.from.module.mercurial-tests">
-    <patternset refid="ignored.files"/>
-  </patternset>
-  
-  <patternset id="excluded.from.compilation.mercurial-tests">
-    <patternset refid="excluded.from.module.mercurial-tests"/>
-  </patternset>
-  
-  <path id="mercurial-tests.module.test.sourcepath">
-    <dirset dir="${module.mercurial-tests.basedir}/mercurial-tests">
-      <include name="src"/>
-    </dirset>
-  </path>
-  
-  
-  <target name="compile.module.mercurial-tests" depends="compile.module.mercurial-tests.production,compile.module.mercurial-tests.tests" description="Compile module mercurial-tests"/>
-  
-  <target name="compile.module.mercurial-tests.production" depends="compile.module.mercurial-server,compile.module.mercurial-common,compile.module.mercurial-agent" description="Compile module mercurial-tests; production classes"/>
-  
-  <target name="compile.module.mercurial-tests.tests" depends="compile.module.mercurial-tests.production" description="compile module mercurial-tests; test classes" unless="skip.tests">
-    <mkdir dir="${mercurial-tests.testoutput.dir}"/>
-    <javac destdir="${mercurial-tests.testoutput.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
-      <compilerarg line="${compiler.args.mercurial-tests}"/>
-      <bootclasspath refid="mercurial-tests.module.bootclasspath"/>
-      <classpath refid="mercurial-tests.module.classpath"/>
-      <src refid="mercurial-tests.module.test.sourcepath"/>
-      <patternset refid="excluded.from.compilation.mercurial-tests"/>
-    </javac>
-    
-    <copy todir="${mercurial-tests.testoutput.dir}">
-      <fileset dir="${module.mercurial-tests.basedir}/mercurial-tests/src">
-        <patternset refid="compiler.resources"/>
-        <type type="file"/>
-      </fileset>
-    </copy>
-  </target>
-  
-  <target name="clean.module.mercurial-tests" description="cleanup module">
-    <delete dir="${mercurial-tests.output.dir}"/>
-    <delete dir="${mercurial-tests.testoutput.dir}"/>
-  </target>
-  
-  <target name="init" description="Build initialization">
-    <!-- Perform any build initialization in this target -->
-  </target>
-  
-  <target name="clean" depends="clean.module.main, clean.module.mercurial-common, clean.module.mercurial-agent, clean.module.mercurial-server, clean.module.mercurial-tests" description="cleanup all"/>
-  
-  <target name="build.modules" depends="init, clean, compile.module.main, compile.module.mercurial-common, compile.module.mercurial-agent, compile.module.mercurial-server, compile.module.mercurial-tests" description="build all modules"/>
-  
-  <target name="all" depends="build.modules" description="build all"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="mercurial" default="all">
+  
+  
+  <property file="mercurial.properties"/>
+  <!-- Uncomment the following property if no tests compilation is needed -->
+  <!-- 
+  <property name="skip.tests" value="true"/>
+   -->
+  
+  <!-- Compiler options -->
+  
+  <property name="compiler.debug" value="on"/>
+  <property name="compiler.generate.no.warnings" value="off"/>
+  <property name="compiler.args" value=""/>
+  <property name="compiler.max.memory" value="128m"/>
+  <patternset id="ignored.files">
+    <exclude name="**/CVS/**"/>
+    <exclude name="**/SCCS/**"/>
+    <exclude name="**/RCS/**"/>
+    <exclude name="**/rcs/**"/>
+    <exclude name="**/.DS_Store/**"/>
+    <exclude name="**/.svn/**"/>
+    <exclude name="**/.pyc/**"/>
+    <exclude name="**/.pyo/**"/>
+    <exclude name="**/*.pyc/**"/>
+    <exclude name="**/*.pyo/**"/>
+    <exclude name="**/.git/**"/>
+    <exclude name="**/*.hprof/**"/>
+    <exclude name="**/_svn/**"/>
+    <exclude name="**/.hg/**"/>
+    <exclude name="**/.sbas/**"/>
+    <exclude name="**/.IJI.*/**"/>
+    <exclude name="**/vssver.scc/**"/>
+    <exclude name="**/vssver2.scc/**"/>
+    <exclude name="**/*.orig/**"/>
+    <exclude name="**/*.lib/**"/>
+    <exclude name="**/*~/**"/>
+  </patternset>
+  <patternset id="library.patterns">
+    <include name="*.zip"/>
+    <include name="*.war"/>
+    <include name="*.egg"/>
+    <include name="*.ear"/>
+    <include name="*.swc"/>
+    <include name="*.jar"/>
+  </patternset>
+  <patternset id="compiler.resources">
+    <include name="**/?*.properties"/>
+    <include name="**/?*.xml"/>
+    <include name="**/?*.gif"/>
+    <include name="**/?*.png"/>
+    <include name="**/?*.jpeg"/>
+    <include name="**/?*.jpg"/>
+    <include name="**/?*.html"/>
+    <include name="**/?*.dtd"/>
+    <include name="**/?*.tld"/>
+    <include name="**/?*.jsp"/>
+    <include name="**/?*.tag"/>
+  </patternset>
+  
+  <!-- JDK definitions -->
+  
+  <property name="jdk.bin.1.5" value="${jdk.home.1.5}/bin"/>
+  <path id="jdk.classpath.1.5">
+    <fileset dir="${jdk.home.1.5}">
+      <include name="jre/lib/rt.jar"/>
+      <include name="jre/lib/jce.jar"/>
+      <include name="jre/lib/deploy.jar"/>
+      <include name="jre/lib/javaws.jar"/>
+      <include name="jre/lib/jsse.jar"/>
+      <include name="jre/lib/charsets.jar"/>
+      <include name="jre/lib/plugin.jar"/>
+      <include name="jre/lib/ext/localedata.jar"/>
+      <include name="jre/lib/ext/sunpkcs11.jar"/>
+      <include name="jre/lib/ext/sunjce_provider.jar"/>
+      <include name="jre/lib/ext/dnsns.jar"/>
+    </fileset>
+  </path>
+  
+  <property name="project.jdk.home" value="${jdk.home.1.5}"/>
+  <property name="project.jdk.bin" value="${jdk.bin.1.5}"/>
+  <property name="project.jdk.classpath" value="jdk.classpath.1.5"/>
+  
+  
+  <!-- Project Libraries -->
+  
+  <path id="library.idea-openapi.classpath">
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/annotations.jar"/>
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/openapi.jar"/>
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/resources_en.jar"/>
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/util.jar"/>
+  </path>
+  
+  <path id="library.jmock.classpath">
+    <pathelement location="${basedir}/mercurial-tests/lib/jmock-SNAPSHOT.jar"/>
+  </path>
+  
+  <path id="library.junit.classpath">
+    <pathelement location="${basedir}/mercurial-tests/lib/junit-3.8.1.jar"/>
+  </path>
+  
+  <path id="library.log4j.classpath">
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/log4j-1.2.12.jar"/>
+  </path>
+  
+  <path id="library.teamcity-impl.classpath">
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/patches-impl.jar"/>
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/trove4j.jar"/>
+  </path>
+  
+  <path id="library.teamcity-testsapi.classpath">
+    <pathelement location="${path.variable.teamcitydistribution}/devPackage/tests/patches-test.jar"/>
+  </path>
+  
+  <path id="library.teamcityapi-agent.classpath">
+    <pathelement location="${path.variable.teamcitydistribution}/devPackage/agent-api.jar"/>
+  </path>
+  
+  <path id="library.teamcityapi-common.classpath">
+    <pathelement location="${path.variable.teamcitydistribution}/devPackage/common-api.jar"/>
+  </path>
+  
+  <path id="library.teamcityapi-server.classpath">
+    <pathelement location="${path.variable.teamcitydistribution}/devPackage/server-api.jar"/>
+    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/server.jar"/>
+  </path>
+  
+  <path id="library.testng.classpath">
+    <pathelement location="${basedir}/mercurial-tests/lib/testng-5.7-jdk15.jar"/>
+  </path>
+  
+  
+  <!-- Global Libraries -->
+  
+  
+  <!-- Application Server Libraries -->
+  
+  <!-- Modules -->
+  
+  
+  <!-- Module main -->
+  
+  <dirname property="module.main.basedir" file="${ant.file}"/>
+  
+  
+  <property name="module.jdk.home.main" value="${project.jdk.home}"/>
+  <property name="module.jdk.bin.main" value="${project.jdk.bin}"/>
+  <property name="module.jdk.classpath.main" value="${project.jdk.classpath}"/>
+  
+  <property name="compiler.args.main" value="${compiler.args}"/>
+  
+  <property name="main.output.dir" value="undefined"/>
+  <property name="main.testoutput.dir" value="undefined"/>
+  
+  <path id="main.module.bootclasspath">
+    <!-- Paths to be included in compilation bootclasspath -->
+  </path>
+  
+  <path id="main.module.production.classpath">
+    <path refid="${module.jdk.classpath.main}"/>
+  </path>
+  
+  <path id="main.runtime.production.module.classpath"/>
+  
+  <path id="main.module.classpath">
+    <path refid="${module.jdk.classpath.main}"/>
+  </path>
+  
+  <path id="main.runtime.module.classpath"/>
+  
+  
+  <patternset id="excluded.from.module.main">
+    <patternset refid="ignored.files"/>
+  </patternset>
+  
+  <patternset id="excluded.from.compilation.main">
+    <patternset refid="excluded.from.module.main"/>
+  </patternset>
+  
+  
+  <target name="compile.module.main" depends="compile.module.main.production,compile.module.main.tests" description="Compile module main"/>
+  
+  <target name="compile.module.main.production" description="Compile module main; production classes"/>
+  
+  <target name="compile.module.main.tests" depends="compile.module.main.production" description="compile module main; test classes" unless="skip.tests"/>
+  
+  <target name="clean.module.main" description="cleanup module">
+    <delete dir="${main.output.dir}"/>
+    <delete dir="${main.testoutput.dir}"/>
+  </target>
+  
+  
+  <!-- Module mercurial-common -->
+  
+  <dirname property="module.mercurial-common.basedir" file="${ant.file}"/>
+  
+  
+  <property name="module.jdk.home.mercurial-common" value="${project.jdk.home}"/>
+  <property name="module.jdk.bin.mercurial-common" value="${project.jdk.bin}"/>
+  <property name="module.jdk.classpath.mercurial-common" value="${project.jdk.classpath}"/>
+  
+  <property name="compiler.args.mercurial-common" value="${compiler.args}"/>
+  
+  <property name="mercurial-common.output.dir" value="${module.mercurial-common.basedir}/mercurial-common/classes"/>
+  <property name="mercurial-common.testoutput.dir" value="${module.mercurial-common.basedir}/mercurial-common/classes"/>
+  
+  <path id="mercurial-common.module.bootclasspath">
+    <!-- Paths to be included in compilation bootclasspath -->
+  </path>
+  
+  <path id="mercurial-common.module.production.classpath">
+    <path refid="${module.jdk.classpath.mercurial-common}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  <path id="mercurial-common.runtime.production.module.classpath">
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  <path id="mercurial-common.module.classpath">
+    <path refid="${module.jdk.classpath.mercurial-common}"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  <path id="mercurial-common.runtime.module.classpath">
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  
+  <patternset id="excluded.from.module.mercurial-common">
+    <patternset refid="ignored.files"/>
+  </patternset>
+  
+  <patternset id="excluded.from.compilation.mercurial-common">
+    <patternset refid="excluded.from.module.mercurial-common"/>
+  </patternset>
+  
+  <path id="mercurial-common.module.sourcepath">
+    <dirset dir="${module.mercurial-common.basedir}/mercurial-common">
+      <include name="src"/>
+    </dirset>
+  </path>
+  
+  
+  <target name="compile.module.mercurial-common" depends="compile.module.mercurial-common.production,compile.module.mercurial-common.tests" description="Compile module mercurial-common"/>
+  
+  <target name="compile.module.mercurial-common.production" description="Compile module mercurial-common; production classes">
+    <mkdir dir="${mercurial-common.output.dir}"/>
+    <javac destdir="${mercurial-common.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.mercurial-common}/javac">
+      <compilerarg line="${compiler.args.mercurial-common}"/>
+      <bootclasspath refid="mercurial-common.module.bootclasspath"/>
+      <classpath refid="mercurial-common.module.production.classpath"/>
+      <src refid="mercurial-common.module.sourcepath"/>
+      <patternset refid="excluded.from.compilation.mercurial-common"/>
+    </javac>
+    
+    <copy todir="${mercurial-common.output.dir}">
+      <fileset dir="${module.mercurial-common.basedir}/mercurial-common/src">
+        <patternset refid="compiler.resources"/>
+        <type type="file"/>
+      </fileset>
+    </copy>
+  </target>
+  
+  <target name="compile.module.mercurial-common.tests" depends="compile.module.mercurial-common.production" description="compile module mercurial-common; test classes" unless="skip.tests"/>
+  
+  <target name="clean.module.mercurial-common" description="cleanup module">
+    <delete dir="${mercurial-common.output.dir}"/>
+    <delete dir="${mercurial-common.testoutput.dir}"/>
+  </target>
+  
+  
+  <!-- Module mercurial-agent -->
+  
+  <dirname property="module.mercurial-agent.basedir" file="${ant.file}"/>
+  
+  
+  <property name="module.jdk.home.mercurial-agent" value="${project.jdk.home}"/>
+  <property name="module.jdk.bin.mercurial-agent" value="${project.jdk.bin}"/>
+  <property name="module.jdk.classpath.mercurial-agent" value="${project.jdk.classpath}"/>
+  
+  <property name="compiler.args.mercurial-agent" value="${compiler.args}"/>
+  
+  <property name="mercurial-agent.output.dir" value="${module.mercurial-agent.basedir}/mercurial-agent/classes"/>
+  <property name="mercurial-agent.testoutput.dir" value="${module.mercurial-agent.basedir}/mercurial-agent/classes"/>
+  
+  <path id="mercurial-agent.module.bootclasspath">
+    <!-- Paths to be included in compilation bootclasspath -->
+  </path>
+  
+  <path id="mercurial-agent.module.production.classpath">
+    <path refid="${module.jdk.classpath.mercurial-agent}"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  <path id="mercurial-agent.runtime.production.module.classpath">
+    <pathelement location="${mercurial-agent.output.dir}"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  <path id="mercurial-agent.module.classpath">
+    <path refid="${module.jdk.classpath.mercurial-agent}"/>
+    <pathelement location="${mercurial-agent.output.dir}"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  <path id="mercurial-agent.runtime.module.classpath">
+    <pathelement location="${mercurial-agent.output.dir}"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+  </path>
+  
+  
+  <patternset id="excluded.from.module.mercurial-agent">
+    <patternset refid="ignored.files"/>
+  </patternset>
+  
+  <patternset id="excluded.from.compilation.mercurial-agent">
+    <patternset refid="excluded.from.module.mercurial-agent"/>
+  </patternset>
+  
+  <path id="mercurial-agent.module.sourcepath">
+    <dirset dir="${module.mercurial-agent.basedir}/mercurial-agent">
+      <include name="src"/>
+    </dirset>
+  </path>
+  
+  
+  <target name="compile.module.mercurial-agent" depends="compile.module.mercurial-agent.production,compile.module.mercurial-agent.tests" description="Compile module mercurial-agent"/>
+  
+  <target name="compile.module.mercurial-agent.production" depends="compile.module.mercurial-common" description="Compile module mercurial-agent; production classes">
+    <mkdir dir="${mercurial-agent.output.dir}"/>
+    <javac destdir="${mercurial-agent.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.mercurial-agent}/javac">
+      <compilerarg line="${compiler.args.mercurial-agent}"/>
+      <bootclasspath refid="mercurial-agent.module.bootclasspath"/>
+      <classpath refid="mercurial-agent.module.production.classpath"/>
+      <src refid="mercurial-agent.module.sourcepath"/>
+      <patternset refid="excluded.from.compilation.mercurial-agent"/>
+    </javac>
+    
+    <copy todir="${mercurial-agent.output.dir}">
+      <fileset dir="${module.mercurial-agent.basedir}/mercurial-agent/src">
+        <patternset refid="compiler.resources"/>
+        <type type="file"/>
+      </fileset>
+    </copy>
+  </target>
+  
+  <target name="compile.module.mercurial-agent.tests" depends="compile.module.mercurial-agent.production" description="compile module mercurial-agent; test classes" unless="skip.tests"/>
+  
+  <target name="clean.module.mercurial-agent" description="cleanup module">
+    <delete dir="${mercurial-agent.output.dir}"/>
+    <delete dir="${mercurial-agent.testoutput.dir}"/>
+  </target>
+  
+  
+  <!-- Module mercurial-server -->
+  
+  <dirname property="module.mercurial-server.basedir" file="${ant.file}"/>
+  
+  
+  <property name="module.jdk.home.mercurial-server" value="${project.jdk.home}"/>
+  <property name="module.jdk.bin.mercurial-server" value="${project.jdk.bin}"/>
+  <property name="module.jdk.classpath.mercurial-server" value="${project.jdk.classpath}"/>
+  
+  <property name="compiler.args.mercurial-server" value="${compiler.args}"/>
+  
+  <property name="mercurial-server.output.dir" value="${module.mercurial-server.basedir}/mercurial-server/classes"/>
+  <property name="mercurial-server.testoutput.dir" value="${module.mercurial-server.basedir}/mercurial-server/classes"/>
+  
+  <path id="mercurial-server.module.bootclasspath">
+    <!-- Paths to be included in compilation bootclasspath -->
+  </path>
+  
+  <path id="mercurial-server.module.production.classpath">
+    <path refid="${module.jdk.classpath.mercurial-server}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+  </path>
+  
+  <path id="mercurial-server.runtime.production.module.classpath">
+    <pathelement location="${mercurial-server.output.dir}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+  </path>
+  
+  <path id="mercurial-server.module.classpath">
+    <path refid="${module.jdk.classpath.mercurial-server}"/>
+    <pathelement location="${mercurial-server.output.dir}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+  </path>
+  
+  <path id="mercurial-server.runtime.module.classpath">
+    <pathelement location="${mercurial-server.output.dir}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+  </path>
+  
+  
+  <patternset id="excluded.from.module.mercurial-server">
+    <patternset refid="ignored.files"/>
+  </patternset>
+  
+  <patternset id="excluded.from.compilation.mercurial-server">
+    <patternset refid="excluded.from.module.mercurial-server"/>
+  </patternset>
+  
+  <path id="mercurial-server.module.sourcepath">
+    <dirset dir="${module.mercurial-server.basedir}/mercurial-server">
+      <include name="resources"/>
+      <include name="src"/>
+    </dirset>
+  </path>
+  
+  
+  <target name="compile.module.mercurial-server" depends="compile.module.mercurial-server.production,compile.module.mercurial-server.tests" description="Compile module mercurial-server"/>
+  
+  <target name="compile.module.mercurial-server.production" depends="compile.module.mercurial-common" description="Compile module mercurial-server; production classes">
+    <mkdir dir="${mercurial-server.output.dir}"/>
+    <javac destdir="${mercurial-server.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.mercurial-server}/javac">
+      <compilerarg line="${compiler.args.mercurial-server}"/>
+      <bootclasspath refid="mercurial-server.module.bootclasspath"/>
+      <classpath refid="mercurial-server.module.production.classpath"/>
+      <src refid="mercurial-server.module.sourcepath"/>
+      <patternset refid="excluded.from.compilation.mercurial-server"/>
+    </javac>
+    
+    <copy todir="${mercurial-server.output.dir}">
+      <fileset dir="${module.mercurial-server.basedir}/mercurial-server/resources">
+        <patternset refid="compiler.resources"/>
+        <type type="file"/>
+      </fileset>
+      <fileset dir="${module.mercurial-server.basedir}/mercurial-server/src">
+        <patternset refid="compiler.resources"/>
+        <type type="file"/>
+      </fileset>
+    </copy>
+  </target>
+  
+  <target name="compile.module.mercurial-server.tests" depends="compile.module.mercurial-server.production" description="compile module mercurial-server; test classes" unless="skip.tests"/>
+  
+  <target name="clean.module.mercurial-server" description="cleanup module">
+    <delete dir="${mercurial-server.output.dir}"/>
+    <delete dir="${mercurial-server.testoutput.dir}"/>
+  </target>
+  
+  
+  <!-- Module mercurial-tests -->
+  
+  <dirname property="module.mercurial-tests.basedir" file="${ant.file}"/>
+  
+  
+  <property name="module.jdk.home.mercurial-tests" value="${project.jdk.home}"/>
+  <property name="module.jdk.bin.mercurial-tests" value="${project.jdk.bin}"/>
+  <property name="module.jdk.classpath.mercurial-tests" value="${project.jdk.classpath}"/>
+  
+  <property name="compiler.args.mercurial-tests" value="${compiler.args}"/>
+  
+  <property name="mercurial-tests.output.dir" value="${module.mercurial-tests.basedir}/mercurial-tests/classes"/>
+  <property name="mercurial-tests.testoutput.dir" value="${module.mercurial-tests.basedir}/mercurial-tests/classes"/>
+  
+  <path id="mercurial-tests.module.bootclasspath">
+    <!-- Paths to be included in compilation bootclasspath -->
+  </path>
+  
+  <path id="mercurial-tests.module.production.classpath">
+    <path refid="${module.jdk.classpath.mercurial-tests}"/>
+    <pathelement location="${mercurial-server.output.dir}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <path refid="library.junit.classpath"/>
+    <path refid="library.testng.classpath"/>
+    <path refid="library.jmock.classpath"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <pathelement location="${mercurial-agent.output.dir}"/>
+    <path refid="library.teamcity-testsapi.classpath"/>
+    <path refid="library.teamcity-impl.classpath"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+  </path>
+  
+  <path id="mercurial-tests.runtime.production.module.classpath">
+    <pathelement location="${mercurial-tests.output.dir}"/>
+    <pathelement location="${mercurial-server.output.dir}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.junit.classpath"/>
+    <path refid="library.testng.classpath"/>
+    <path refid="library.jmock.classpath"/>
+    <pathelement location="${mercurial-agent.output.dir}"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+    <path refid="library.teamcity-testsapi.classpath"/>
+    <path refid="library.teamcity-impl.classpath"/>
+  </path>
+  
+  <path id="mercurial-tests.module.classpath">
+    <path refid="${module.jdk.classpath.mercurial-tests}"/>
+    <pathelement location="${mercurial-tests.output.dir}"/>
+    <pathelement location="${mercurial-server.output.dir}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <path refid="library.junit.classpath"/>
+    <path refid="library.testng.classpath"/>
+    <path refid="library.jmock.classpath"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <pathelement location="${mercurial-agent.output.dir}"/>
+    <path refid="library.teamcity-testsapi.classpath"/>
+    <path refid="library.teamcity-impl.classpath"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+  </path>
+  
+  <path id="mercurial-tests.runtime.module.classpath">
+    <pathelement location="${mercurial-tests.output.dir}"/>
+    <pathelement location="${mercurial-server.output.dir}"/>
+    <path refid="library.teamcityapi-server.classpath"/>
+    <path refid="library.idea-openapi.classpath"/>
+    <path refid="library.log4j.classpath"/>
+    <pathelement location="${mercurial-common.output.dir}"/>
+    <path refid="library.teamcityapi-common.classpath"/>
+    <path refid="library.junit.classpath"/>
+    <path refid="library.testng.classpath"/>
+    <path refid="library.jmock.classpath"/>
+    <pathelement location="${mercurial-agent.output.dir}"/>
+    <path refid="library.teamcityapi-agent.classpath"/>
+    <path refid="library.teamcity-testsapi.classpath"/>
+    <path refid="library.teamcity-impl.classpath"/>
+  </path>
+  
+  
+  <patternset id="excluded.from.module.mercurial-tests">
+    <patternset refid="ignored.files"/>
+  </patternset>
+  
+  <patternset id="excluded.from.compilation.mercurial-tests">
+    <patternset refid="excluded.from.module.mercurial-tests"/>
+  </patternset>
+  
+  <path id="mercurial-tests.module.test.sourcepath">
+    <dirset dir="${module.mercurial-tests.basedir}/mercurial-tests">
+      <include name="src"/>
+    </dirset>
+  </path>
+  
+  
+  <target name="compile.module.mercurial-tests" depends="compile.module.mercurial-tests.production,compile.module.mercurial-tests.tests" description="Compile module mercurial-tests"/>
+  
+  <target name="compile.module.mercurial-tests.production" depends="compile.module.mercurial-server,compile.module.mercurial-common,compile.module.mercurial-agent" description="Compile module mercurial-tests; production classes"/>
+  
+  <target name="compile.module.mercurial-tests.tests" depends="compile.module.mercurial-tests.production" description="compile module mercurial-tests; test classes" unless="skip.tests">
+    <mkdir dir="${mercurial-tests.testoutput.dir}"/>
+    <javac destdir="${mercurial-tests.testoutput.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.mercurial-tests}/javac">
+      <compilerarg line="${compiler.args.mercurial-tests}"/>
+      <bootclasspath refid="mercurial-tests.module.bootclasspath"/>
+      <classpath refid="mercurial-tests.module.classpath"/>
+      <src refid="mercurial-tests.module.test.sourcepath"/>
+      <patternset refid="excluded.from.compilation.mercurial-tests"/>
+    </javac>
+    
+    <copy todir="${mercurial-tests.testoutput.dir}">
+      <fileset dir="${module.mercurial-tests.basedir}/mercurial-tests/src">
+        <patternset refid="compiler.resources"/>
+        <type type="file"/>
+      </fileset>
+    </copy>
+  </target>
+  
+  <target name="clean.module.mercurial-tests" description="cleanup module">
+    <delete dir="${mercurial-tests.output.dir}"/>
+    <delete dir="${mercurial-tests.testoutput.dir}"/>
+  </target>
+  
+  <target name="init" description="Build initialization">
+    <!-- Perform any build initialization in this target -->
+  </target>
+  
+  <target name="clean" depends="clean.module.main, clean.module.mercurial-common, clean.module.mercurial-agent, clean.module.mercurial-server, clean.module.mercurial-tests" description="cleanup all"/>
+  
+  <target name="build.modules" depends="init, clean, compile.module.main, compile.module.mercurial-common, compile.module.mercurial-agent, compile.module.mercurial-server, compile.module.mercurial-tests" description="build all modules"/>
+  
+  <target name="all" depends="build.modules" description="build all"/>
 </project>
\ No newline at end of file