Home > front end >  Extracting Revision numbers in svn
Extracting Revision numbers in svn

Time:01-12

I am trying to create a pipeline on jenkins which takes the code from a svn repository , builds it (using MSBuild) , tests it , creates a package from the build artifacts (using Maven) and then commits this package to another svn repository which belongs to another company.

This commit must have a specific commit message format which includes :

1- a short text

2- the url of our repository

3- the revision of some specific dlls what we used to build the solution So as an example :

#Automatic Package Update 
------
src_svn_url = "the source code URL"
src_svn_rev = 33568 , dll1 = 4654 , dll2 = 7657 , ..... 
------

I did some research and found out that it can be done through the pre-commit hooks. Are we able to make this pre-commit hook extract the revision number of different dlls inside my repo and write them automatically in the commit message every time we are committing? The goal for us is to know using which revision of the dlls , we produced the mentioned package.

CodePudding user response:

This is not a task of any commit hook script.

You can run the svnversion command in your pipeline to get the revision number and use it to create a commit log message for your new commit into another repository.

For example, you can create the log message in a dedicated file log-message.txt with all the necessary information and then use the svn commit -F log-message.txt command to use the file's contents as the log message.

  • Related