Skip to content
Permalink
Browse files
[JENKINS-47526] Ok that's at least enough tests for to merge with
  • Loading branch information
stephenc committed Oct 22, 2017
1 parent 4d95566 commit 2bee28395f90f817642a8c208c02a3f435c49045
Showing 3 changed files with 321 additions and 13 deletions.
@@ -674,7 +674,19 @@ protected SCMRevision retrieve(@NonNull final String revision, @NonNull final Ta
final String remote = getRemote();
final StandardUsernameCredentials credentials = getCredentials();
telescope.validate(remote, credentials);
return telescope.getRevision(remote, credentials, revision);
SCMRevision result = telescope.getRevision(remote, credentials, revision);
if (result != null) {
return result;
}
result = telescope.getRevision(remote, credentials, Constants.R_HEADS + revision);
if (result != null) {
return result;
}
result = telescope.getRevision(remote, credentials, Constants.R_TAGS + revision);
if (result != null) {
return result;
}
return null;
}
return doRetrieve(new Retriever<SCMRevision>() {
@Override
@@ -722,7 +734,11 @@ protected Set<String> retrieveRevisions(@NonNull final TaskListener listener) th
}
Set<String> result = new HashSet<>();
for (SCMRevision r : telescope.getRevisions(remote, credentials, referenceTypes)) {
result.add(r.getHead().getName());
if (r instanceof GitTagSCMRevision && context.wantTags()) {
result.add(r.getHead().getName());
} else if (!(r instanceof GitTagSCMRevision) && context.wantBranches()) {
result.add(r.getHead().getName());
}
}
return result;
}
@@ -255,7 +255,7 @@ protected abstract SCMFileSystem build(@NonNull String remote, @CheckForNull Sta
*
* @param remote the repository URL.
* @param credentials the credentials or {@code null} for an anonymous connection.
* @param refOrHash the reference or hash.
* @param refOrHash the reference or hash. If this is a reference then it will start with {@link Constants#R_REFS}
* @return the timestamp.
* @throws IOException if the operation failed due to an IO error.
* @throws InterruptedException if the operation was interrupted.
@@ -268,7 +268,7 @@ public abstract long getTimestamp(@NonNull String remote, @CheckForNull Standard
*
* @param remote the repository URL.
* @param credentials the credentials or {@code null} for an anonymous connection.
* @param refOrHash the reference or hash.
* @param refOrHash the reference or hash. If this is a reference then it will start with {@link Constants#R_REFS}
* @return the revision or {@code null} if the reference or hash does not exist.
* @throws IOException if the operation failed due to an IO error.
* @throws InterruptedException if the operation was interrupted.
@@ -355,7 +355,7 @@ public abstract Iterable<SCMRevision> getRevisions(@NonNull String remote,
*
* @param remote the repository URL.
* @param credentials the credentials or {@code null} for an anonymous connection.
* @return the default target of the repository.
* @return the default target of the repository,
* @throws IOException if the operation failed due to an IO error.
* @throws InterruptedException if the operation was interrupted.
*/

0 comments on commit 2bee283

Please sign in to comment.