changeset 1119:1a43a8c758a4 TW-83599

TW-83599: recognize "path contains illegal component" error and retry pull command with explicit revision, agent side logic
author Andreas Eisele <andreas.eisele@jetbrains.com>
date Tue, 10 Oct 2023 12:32:28 +0200
parents 54472aa4b7b2
children f1b2de1a2555
files mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java	Tue Oct 10 12:11:40 2023 +0200
+++ b/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java	Tue Oct 10 12:32:28 2023 +0200
@@ -161,18 +161,17 @@
     }
   }
 
-  private void doPull(@NotNull HgRepo repo, @NotNull String repositoryUrl, @Nullable String revision) throws VcsException {
+  private void doPull(@NotNull HgRepo repo, @NotNull String repositoryUrl, @NotNull String revision) throws VcsException {
     doPull(repo, repositoryUrl, revision, false);
   }
 
-  private void doPull(@NotNull HgRepo repo, @NotNull String repositoryUrl, @Nullable String revision, boolean explicitRevision) throws VcsException {
-    final String effectiveRevision = revision != null ? revision : "tip";
+  private void doPull(@NotNull HgRepo repo, @NotNull String repositoryUrl, @NotNull String revision, boolean explicitRevision) throws VcsException {
     final PullCommand pullCommand = repo.pull().fromRepository(repositoryUrl)
             .withTraceback(myUseTraceback)
             .withProfile(myProfile)
             .withTimeout(myPullTimeout);
     if (explicitRevision) {
-      pullCommand.withNamedRevision(effectiveRevision);
+      pullCommand.withNamedRevision(revision);
     }
 
     try {
@@ -181,7 +180,7 @@
       if (!myRetryPullForIllegalPathComponent || explicitRevision) {
         throw e;
       }
-      myLogger.message("Pull encountered illegal path component " + e.getComponent() + " retrying with explicit revision " + effectiveRevision);
+      myLogger.message("Pull encountered illegal path component " + e.getComponent() + " retrying with explicit revision " + revision);
       doPull(repo, repositoryUrl, revision, true);
     }
   }