diff mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java @ 86:948a35b430e1 Darjeeling-5.0.x

report parent changesets
author Pavel.Sher
date Tue, 08 Dec 2009 19:49:28 +0300
parents 2e57d4e3f7b7
children 5d9c34cb543a
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Thu Dec 03 15:01:44 2009 +0300
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Tue Dec 08 19:49:28 2009 +0300
@@ -89,9 +89,9 @@
     List<ModificationData> result = new ArrayList<ModificationData>();
     Settings settings = createSettings(root);
     LogCommand lc = new LogCommand(settings);
-    String fromId = new ChangeSet(fromVersion).getId();
+    String fromId = new ChangeSetRevision(fromVersion).getId();
     lc.setFromRevId(fromId);
-    lc.setToRevId(new ChangeSet(currentVersion).getId());
+    lc.setToRevId(new ChangeSetRevision(currentVersion).getId());
     List<ChangeSet> changeSets = lc.execute();
     if (changeSets.isEmpty()) {
       return result;
@@ -100,8 +100,7 @@
     // invoke status command for each changeset and determine what files were modified in these changesets
     StatusCommand st = new StatusCommand(settings);
     ChangeSet prev = new ChangeSet(fromVersion);
-    for (int i=0; i<changeSets.size(); i++) {
-      ChangeSet cur = changeSets.get(i);
+    for (ChangeSet cur : changeSets) {
       if (cur.getId().equals(fromId)) continue; // skip already reported changeset
 
       st.setFromRevId(prev.getId());
@@ -145,17 +144,17 @@
   }
 
   @NotNull
-  public byte[] getContent(final VcsModification vcsModification,
-                           final VcsChangeInfo change,
-                           final VcsChangeInfo.ContentType contentType,
-                           final VcsRoot vcsRoot) throws VcsException {
+  public byte[] getContent(@NotNull final VcsModification vcsModification,
+                           @NotNull final VcsChangeInfo change,
+                           @NotNull final VcsChangeInfo.ContentType contentType,
+                           @NotNull final VcsRoot vcsRoot) throws VcsException {
     syncClonedRepository(vcsRoot);
     String version = contentType == VcsChangeInfo.ContentType.AFTER_CHANGE ? change.getAfterChangeRevisionNumber() : change.getBeforeChangeRevisionNumber();
     return getContent(change.getRelativeFileName(), vcsRoot, version);
   }
 
   @NotNull
-  public byte[] getContent(final String filePath, final VcsRoot vcsRoot, final String version) throws VcsException {
+  public byte[] getContent(@NotNull final String filePath, @NotNull final VcsRoot vcsRoot, @NotNull final String version) throws VcsException {
     syncClonedRepository(vcsRoot);
     Settings settings = createSettings(vcsRoot);
     CatCommand cc = new CatCommand(settings);
@@ -178,10 +177,12 @@
     return new byte[0];
   }
 
+  @NotNull
   public String getName() {
     return Constants.VCS_NAME;
   }
 
+  @NotNull
   @Used("jsp")
   public String getDisplayName() {
     return "Mercurial";
@@ -206,12 +207,13 @@
     };
   }
 
+  @NotNull
   public String getVcsSettingsJspFilePath() {
     return "mercurialSettings.jsp";
   }
 
   @NotNull
-  public String getCurrentVersion(final VcsRoot root) throws VcsException {
+  public String getCurrentVersion(@NotNull final VcsRoot root) throws VcsException {
     // we will return full version of the most recent change as current version
     syncClonedRepository(root);
     Settings settings = createSettings(root);
@@ -224,6 +226,7 @@
     return result.get(settings.getBranchName()).getFullVersion();
   }
 
+  @NotNull
   public String describeVcsRoot(final VcsRoot vcsRoot) {
     return "mercurial: " + vcsRoot.getProperty(Constants.REPOSITORY_PROP);
   }
@@ -233,7 +236,7 @@
   }
 
   @Nullable
-  public String testConnection(final VcsRoot vcsRoot) throws VcsException {
+  public String testConnection(@NotNull final VcsRoot vcsRoot) throws VcsException {
     Settings settings = createSettings(vcsRoot);
     IdentifyCommand id = new IdentifyCommand(settings);
     StringBuilder res = new StringBuilder();
@@ -261,7 +264,7 @@
     return defaults;
   }
 
-  public String getVersionDisplayName(final String version, final VcsRoot root) throws VcsException {
+  public String getVersionDisplayName(@NotNull final String version, @NotNull final VcsRoot root) throws VcsException {
     return new ChangeSet(version).getId();
   }
 
@@ -281,11 +284,11 @@
     };
   }
 
-  public void buildPatch(final VcsRoot root,
+  public void buildPatch(@NotNull final VcsRoot root,
                          @Nullable final String fromVersion,
                          @NotNull final String toVersion,
-                         final PatchBuilder builder,
-                         final CheckoutRules checkoutRules) throws IOException, VcsException {
+                         @NotNull final PatchBuilder builder,
+                         @NotNull final CheckoutRules checkoutRules) throws IOException, VcsException {
     syncClonedRepository(root);
     Settings settings = createSettings(root);
     if (fromVersion == null) {
@@ -430,7 +433,7 @@
   }
 
   @Override
-  public boolean ignoreServerCachesFor(final VcsRoot root) {
+  public boolean ignoreServerCachesFor(@NotNull final VcsRoot root) {
     // since a copy of repository for each VCS root is already stored on disk
     // we do not need separate cache for our patches 
     return true;