The git plugin has an "Additional Behaviour" which tells the plugin to
calculate changes from a base branch, rather than calculating the changes
from the preceding build.  Could you use that instead of writing code?

Mark Waite

On Mon, Aug 15, 2016 at 11:11 AM Eric Crahen <[email protected]> wrote:

> Hey,
>
>   To support a PR-building workflow, I have a plugin which sets the branch
> used by the Jenkins workspace, to something I configure (which is the
> pr-branch).
>   This happens by using the GitSCM API, a very abbreviated version of what
> happens is this:
>
>    GitTool tool = GitTool.getDefaultInstallation();
>    GitClient git = Git.with(listener,
> env).in(workspaceDir).using(tool.getGitExe()).getClient();
>    git.fetch("origin", new RefSpec(refspec));
>    git.checkout(localBranch);
>
>
>    What I would like to do is make the changelog that appears on the build
> page understand that the base branch used is not master (or whatever the
> default branch is that the job was configured to use). Currently, I notice
> the changelog is unaware the branch built from changed, and so it shows the
> wrong commits.
>
>    I have tried to change the BuildData associated with the job, and that
> part at least makes the GitData link that shows on the build page name and
> link to the correct (in this case the PR branch) branch. This doesn't seem
> to be what ChangeLog is looking at though. I took a quick look and the
> changelog logic is kind of complex, so if anyone knows how this works
> that'd be super useful - this must be a thing we can do one way or another.
> thanks :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/c5041a95-874b-4bed-9130-88305f2acd36%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/c5041a95-874b-4bed-9130-88305f2acd36%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFCb-vJk7s4Sv6Giw84-isubuTNU3En9J5XZZMtf5TGNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to