developer | thinker | tinkerer

Automated Merge Notices

I'm working on a project with another developer and we've decided to create a branch for my changes. Heavy development continues in the trunk as well and I need to frequently merge the trunk into my branch. Being lazy of course I didn't want to do this manually :)

First I created a simple batch file. I'm doing an update on my local working copy to make sure it's updated, then I run an Ant script.

REM Change to local working copy directory
cd c:\myproject

REM Run SVN update to verify working copy code is current
svn update

REM Run merge target
ant -f c:\myproject\_build\build.xml email-merge-status

My Ant script simply runs the merge and sends me an email. See my previous post (from 2006!) about sending email via Ant if you need help configuring that. All my properties ${something} are defined in an external property file but you should get the idea.

<target name="email-merge-status" depends="-init" description="Send email with merge status">
<exec executable="svn" outputproperty="svnmergeoutput">
<arg line="merge ${svn.trunk} ${path.branch} --dry-run" />

<mail mailhost="${mail.server}" mailport="${mail.port}" subject="${} Merge Status">
<from address="${mail.default.from}" />
<to address="${}" />
Merge status for: ${}
Running:  merge ${svn.trunk} ${path.branch} --dry-run



I'm using the --dry-run SVN option with the merge just so I can get an idea of how many conflicts I can expect. If there aren't many I will remove that and automate the merge and possibly the commit as well.

Now a few times I day I get a nicely formatted email that lets me know if I need to take action to update my branch:

Merge status for: IRBIS
Running:  merge https://svn.myproject.some.url/svn/myproject/trunk/ c:/myproject --dry-run
--- Merging r703 through r708 into 'c:\myproject':
U    c:\myproject\admin_buckets_search.cfm
U    c:\myproject\admin_gen_attachment_types.cfm
U    c:\myproject\event_attachments.cfm
U    c:\myproject\admin_gen_detail.cfm
U    c:\myproject\wireframe\balsamiq_files\popup_existing_responses.bmml

Finding CFDUMP Line Numbers How I Get Started in ColdFusion

More like this...