[Last Call] Learn how to a build a cloud-first strategyRegister Now


automate the svn merge process with shell script

Posted on 2009-12-25
Medium Priority
Last Modified: 2013-12-26
I want to automate the process of merging tag to trunk in svn using shell script. I'm finding difficulty when getting the revision number of tags and put it in svn merge automatically.

these are the following steps to merge the tag to trunk

1. checkout tag
2. checkout trunk
3. cd to tag
4. run the command svn log --stop-on-copy (this will give the revisions. Please see the code snippet)
5. get the revision number from the above command (here the revision is 2780 from code snippet)
6. svn merge --dry-run -r2780:HEAD http://url/path  (testing the merge. if test merge fails ask the user whether the real merge can be done or not)
7. If user says yes, run svn merge  -r2780:HEAD http://url/path
8. print merge successful
svn log --stop-on-copy
r2811 | harry | 2009-12-24 11:47:57 -0800 (Thu, 24 Dec 2009) | 1 line

removed *.db
r2790 | sally | 2009-12-23 15:35:26 -0800 (Wed, 23 Dec 2009) | 1 line

updated index.jsp
r2787 | sally | 2009-12-23 15:33:09 -0800 (Wed, 23 Dec 2009) | 1 line

r2780 | sally | 2009-12-23 15:20:04 -0800 (Wed, 23 Dec 2009) | 1 line


Open in new window

Question by:CharanR
1 Comment
LVL 14

Accepted Solution

jb1dev earned 2000 total points
ID: 26123246
So you want the last (bottom) revision?

REV=`svn log --stop-on-copy | grep "^r" | tail -1 | awk '{print $1;}'`

> svn merge --dry-run -r2780:HEAD http://url/path  (testing the merge. if test merge fails ask the user

Then use:
svn merge --dry-run -r$REV:HEAD http://url/path

If test merge fails does svn return non-zero exit code? if so:

if [ $? != 0 ]; then
    echo "Merge failed..."
    # Handle merge fail here...


Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question