Get a list of VCS modifications between two builds

I have two builds (instances of SFinishedBuild), both of the same build configuration. How do I get the list of VCS modifications (SVcsModification) between them?

I need this for my culprit-finding plug-in. The user selects an arbitrary pair of finished builds and reruns the builds for every intermediate change. Example:

  • there are changes a, b, c, d, e, f
  • change b gets built in build B
  • change c gets built in build C
  • change e gets built in build E
  • I need a way to find changes between B and E (= c, d, e)


Something like [E].getContainingChanges(), but relative to an arbitrary historical build (B).

2 comments
Comment actions Permalink
 
There is no single method to do that, but you can interate previous builds using the call:
 
SBuild.getBuildPromotion().getPreviousBuildPromotion(SelectPrevBuildPolicy.SINCE_LAST_BUILD)

and get chanegs from each via getContainingChanges.

0
Comment actions Permalink

Thank you, that's great.

Somewhat related, if I come across an SFinishedBuild with .getContainingChanges().isEmpty() (which is typical of reruns), can I use the same trick to get at the SVcsModification that applies to this finished build?

Example:

  • there are changes a, b, c
  • change b gets built in build B
  • change c gets built in build C and then D
  • [D].getContainingChanges() is empty because D is a rerun


If I want to get hold of the last SVcsModification of D, can I use [D].getBuildPromotion().getPreviousBuildPromotion(SelectPrevBuildPolicy.SINCE_LAST_BUILD).getContainingChanges().get(0)?

And does the trick work well with feature branches?

Thanks,
Sam

0

Please sign in to leave a comment.