Click here to Skip to main content
15,946,320 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
So I have a svn repo URL like this--

svn info
Path: .
URL: svn://xyz-repo/svn/ccsmp/branches/features/cre40_jenkins
Repository Root: svn://xyz-repo/svn/ccsmp
Repository UUID: 5de8f2f4-0d3b-0410-8f2c-d418a2640d16
Revision: 23430


I want to grab only this part--

branches/features/cre40_jenkins

So far I have tried something like this

def BRANCH_NAME = sh(script: " svn info | grep -Po 'Relative URL: \\^/\\K.*' ", returnStdout: true , trim: true)

But this didn't worked as I am using a very old Jenkins version with old plugins and svn.

Is there any other way to do this. Please help any suggestions would be highly appreciated.

What I have tried:

def BRANCH_NAME = sh(script: " svn info | grep -Po 'Relative URL: \\^/\\K.*' ", returnStdout: true , trim: true)
Posted
Updated 16-Feb-22 22:05pm

1 solution

Run it through something like this:

Bash
svn info | awk 'BEGIN {FS="/"} /^URL:/ {print $6 "/" $7 "/" $8}'


[edit] fixed typo [/edit]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900