diff mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java @ 59:30cc10fe9479

accept version in two formats: with rev number and without
author Pavel.Sher
date Sun, 26 Oct 2008 16:50:12 +0300
parents d1ed856e38ea
children b328c6b6526d
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Sun Oct 26 16:34:32 2008 +0300
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Sun Oct 26 16:50:12 2008 +0300
@@ -110,7 +110,7 @@
       // stored in database (note that getContent method will be invoked with this version)
       List<VcsChange> files = toVcsChanges(modifiedFiles, prev.getFullVersion(), cur.getFullVersion(), includeRule);
       if (files.isEmpty()) continue;
-      ModificationData md = new ModificationData(cur.getTimestamp(), files, cur.getSummary(), cur.getUser(), root, cur.getFullVersion(), extractRevisionId(cur.getFullVersion()));
+      ModificationData md = new ModificationData(cur.getTimestamp(), files, cur.getSummary(), cur.getUser(), root, cur.getFullVersion(), cur.getId());
       result.add(md);
       prev = cur;
     }
@@ -158,8 +158,7 @@
     syncClonedRepository(vcsRoot);
     Settings settings = createSettings(vcsRoot);
     CatCommand cc = new CatCommand(settings);
-    ChangeSet cs = new ChangeSet(version);
-    cc.setRevId(cs.getId());
+    cc.setRevId(new ChangeSet(version).getId());
     File parentDir = cc.execute(Collections.singletonList(filePath));
     try {
       File file = new File(parentDir, filePath);
@@ -255,13 +254,7 @@
   }
 
   public String getVersionDisplayName(final String version, final VcsRoot root) throws VcsException {
-    return extractRevisionId(version);
-  }
-
-  private String extractRevisionId(final String version) {
-    int colon = version.indexOf(':');
-    if (colon == -1) return version;
-    return version.substring(colon+1);
+    return new ChangeSet(version).getId();
   }
 
   @NotNull