<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The eflow blog &#187; svn</title>
	<atom:link href="http://blog.eflow.org/archives/tag/svn/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.eflow.org</link>
	<description>Insert some amazingly witty tagline here</description>
	<lastBuildDate>Fri, 23 Apr 2010 03:19:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Merge Problems with Inconsistent Newlines in SVN</title>
		<link>http://blog.eflow.org/archives/162</link>
		<comments>http://blog.eflow.org/archives/162#comments</comments>
		<pubDate>Thu, 18 Dec 2008 19:32:26 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[openmrs]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.eflow.org/?p=162</guid>
		<description><![CDATA[When trying to merge from our trunk to a branch I was getting these errors:
    svn: File &#8216;/tmp/svnkitmerge42139.tmp/.diff.192.tmp&#8217; has inconsistent newlines
    svn: File &#8216;/tmp/svnkitmerge42139.tmp/.diff.192.tmp&#8217; has inconsistent newlines

and

svn: File &#8216;/tmp/tmp&#8217; has inconsistent newlines svn: Inconsistent line ending style
svn: Error reading spooled REPORT request response
    svn: Generic IO [...]]]></description>
			<content:encoded><![CDATA[<p>When trying to merge from our trunk to a branch I was getting these errors:</p>
<blockquote><p>    svn: File &#8216;/tmp/svnkitmerge42139.tmp/.diff.192.tmp&#8217; has inconsistent newlines<br />
    svn: File &#8216;/tmp/svnkitmerge42139.tmp/.diff.192.tmp&#8217; has inconsistent newlines
</p></blockquote>
<p>and</p>
<blockquote><p>
svn: File &#8216;/tmp/tmp&#8217; has inconsistent newlines svn: Inconsistent line ending style<br />
svn: Error reading spooled REPORT request response</p>
<p>    svn: Generic IO error<br />
    svn: Generic IO error
</p></blockquote>
<p><br/><br />
Here are the steps I did to get around this and still merge from trunk to the branch:</p>
<ol>
<li>Check out a fresh copy of the branch. </li>
<li> Merge the branch to the latest, skipping over the revision that did the newline changes (5893 in my case).  You might have to do two merges for this: previous merge point to 5892, then one from 5894 to HEAD.</li>
<li>Run the <a href="http://blog.eflow.org/archives/130">fix_newlines.sh</a> script.</li>
<li>Commit the branch.</li>
</ol>
<p>Note: If you have changes on another checked out copy, an &#8220;svn update&#8221; won&#8217;t work on that one.  You will have to apply a patch of the changes to the freshly checked out/merged copy.</p>
 <img src="http://blog.eflow.org/wp-content/plugins/feed-statistics.php?view=1&post_id=162" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.eflow.org/archives/162/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merging a Renamed Branch Back to Trunk</title>
		<link>http://blog.eflow.org/archives/164</link>
		<comments>http://blog.eflow.org/archives/164#comments</comments>
		<pubDate>Tue, 16 Dec 2008 22:42:33 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[babble]]></category>
		<category><![CDATA[openmrs]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.eflow.org/?p=164</guid>
		<description><![CDATA[I had a lot of trouble recently merging a renamed branch back into trunk.  I ended up having to resort to the command line to get the exact parameter setup that I wanted.  Subclipse didn&#8217;t quite cut it, unfortunately.
To set the stage:

All changes on trunk have been merged to the branch (complex-obs) and [...]]]></description>
			<content:encoded><![CDATA[<p>I had a lot of trouble recently merging a renamed branch back into trunk.  I ended up having to resort to the command line to get the exact parameter setup that I wanted.  Subclipse didn&#8217;t quite cut it, unfortunately.</p>
<p>To set the stage:</p>
<ol>
<li>All changes on trunk have been merged to the branch (complex-obs) and committed</li>
<li>The checked out trunk copy is up-to-date</li>
</ol>
<p>I created a patch file comparing trunk to the branch:</p>
<blockquote><p>svn diff &#8211;old /home/ben/workspace/openmrs-trunk-clean &#8211;new http://svn.openmrs.org/openmrs/branches/complex-obs > /home/ben/openmrs/patches/complexobs.diff</p></blockquote>
<p>I then applied that patch file to my local trunk copy:</p>
<blockquote><p>patch -p0 < /home/ben/openmrs/patches/complexobs.diff</p></blockquote>
<p>This should only be used if you plan on closing the branch.  Subversion isn&#8217;t able to keep track of any ancestry this way, so future merges would be harder.</p>
<p>Note: Diff files don&#8217;t handle binary files.  You will need to move those yourself.  I suggest comparing the patched trunk with your branch to make sure everything is the same. (In eclipse, select the root of both projects, then right click&#8211;>compare with&#8211;>each other)</p>
 <img src="http://blog.eflow.org/wp-content/plugins/feed-statistics.php?view=1&post_id=164" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.eflow.org/archives/164/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing SVN Inconsistent Newlines</title>
		<link>http://blog.eflow.org/archives/130</link>
		<comments>http://blog.eflow.org/archives/130#comments</comments>
		<pubDate>Mon, 03 Nov 2008 15:21:30 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[openmrs]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.eflow.org/?p=130</guid>
		<description><![CDATA[I&#8217;ve spoken previously about the travails of having a developer community that uses both Windows and Unix-based machines: merging files edited in both environments. Hopefully those days are over. (At least for the OpenMRS community)

Chase Yarbrough attempted to fix this by adding the svn:eol-style to all of the files in the OpenMRS repository recursively.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve <a href="http://blog.eflow.org/archives/45">spoken previously</a> about the travails of having a developer community that uses both Windows and Unix-based machines: merging files edited in both environments. Hopefully those days are over. (At least for the OpenMRS community)<br />
<span id="more-130"></span></p>
<p>Chase Yarbrough <a href="http://dev.openmrs.org/changeset/4095">attempted to fix</a> this by adding the svn:eol-style to all of the files in the OpenMRS repository recursively.  The problem is that all files that were already committed from both operating systems failed with:</p>
<blockquote><p>
svn: File &#8217;somefilename.ext&#8217; has inconsistent newlines<br />
svn: Inconsistent line ending style
</p></blockquote>
<p>However, merging continued to be a pain with those files that were skipped over.  </p>
<p><br/></p>
<h3>Solution</h3>
<p>I created a short script to recursively loop over all files in the root directory, run dos2unix, and then set the svn:eol-style to CRLF:</p>
<p><a href='http://blog.eflow.org/wp-content/uploads/2008/12/fix_newlines.sh'>Download this script</a></p>
<blockquote>
<pre>
#!/bin/sh

# This script normalizes the newlines in all files in
# a directory and adds the svn:eol-style property
# Author: Ben Wolfe - 10/2008
# http://blog.eflow.org

path=`pwd`

# get a flat list of all files under the current directory
f=`ls -RlQ | awk -v PATH=$path '{ \
if ($1 ~ /.*:$/) \
path = substr($1,3,length($1)-4); \
else \
if ($0 ~ /^-/) \
printf("%s%s/%s\n", PATH, path, \
substr($0, match($0,"\".*\"")+1, RLENGTH-2) \
) \
}'`

for i in $f
do
#ignore the build folder contents
if ! echo $i | grep build > /dev/null;
then
        #check subversion for this property
        x=`svn propget svn:eol-style $i`
        if [ ! -n "$x" ]
        then
                # get the file's extension
                ext=`echo "$i" | awk -F . '{print $NF}'`

                # This is an "if list contains" method for shell scripts
                # check if ext is one of the text based extensions
                case $ext in
                        java|jsp|css|js|xml|sql|txt|properties|tld|tag|html|htm|sh)
                                #echo No svn:eol-style prop: $i . Adding now.
                                dos2unix -a $i
                                svn propset svn:eol-style "CRLF" $i
                                ;;
                        *)
                                echo invalid extension: $ext
                                ;;
                esac
        fi
fi
done

echo "done"
</pre>
</blockquote>
<p>I committed all changes from running this script in <a href="http://dev.openmrs.org/changeset/5893">changeset 5893</a>.</p>
 <img src="http://blog.eflow.org/wp-content/plugins/feed-statistics.php?view=1&post_id=130" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.eflow.org/archives/130/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Merging Apparently Non-Conflicting Conflicts with SVN</title>
		<link>http://blog.eflow.org/archives/45</link>
		<comments>http://blog.eflow.org/archives/45#comments</comments>
		<pubDate>Mon, 28 Apr 2008 21:14:42 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[openmrs]]></category>
		<category><![CDATA[license]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.eflow.org/?p=45</guid>
		<description><![CDATA[Saptarshi Purkayastha, an OpenMRS GSoC student this year, wrote mini java script and submitted a patch for adding the OpenMRS license to all of our java files.  This was long overdue and was much appreciated, thanks Saptarshi!
Submitting this to trunk was no trouble at all, all things went as normal.  However, when merging [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sunnytalkstech.blogspot.com/">Saptarshi Purkayastha</a>, an <a href="http://openmrs.org">OpenMRS</a> <a href="http://code.google.com/soc">GSoC</a> student this year, wrote mini java script and <a href="http://dev.openmrs.org/ticket/188">submitted a patch</a> for adding the OpenMRS license to all of our java files.  This was long overdue and was much appreciated, thanks Saptarshi!</p>
<p>Submitting this to trunk was no trouble at all, all things went as normal.  However, when merging from trunk to other branches, I kept running into problems.  All files that received the new license were showing as conflicts, even though there were no other changes.  I had to manually copy the license from the old file to merged file.  NOT fun.  I did this manually when I was merging to the report-api-refactoring branch because it was late and I didn&#8217;t want to look up the &#8220;right&#8221; way to fix it.</p>
<p>Well, I think I found the reason.  Java file handlers don&#8217;t do prepending very well.  The script that Saptarshi wrote creates a new file with the license code, and then appends the old file contents.  The java newLine() method used in the java script to append that old file contents apparently uses a different newline character than the default for unix/windows.</p>
<p>This minor little difference caused two problems: 1) merging produced conflicts and 2) when comparing versions or showing annotations it showed that I had changed <em>all</em> lines when in fact I had just added the license header.</p>
<p>The fix for problem 1 above was to merge from trunk with the <em>ignore-eol-style</em> flag set:</p>
<blockquote><p>svn merge -x&ndash;&ndash;ignore-eol-style -r3684:3685 http://svn.openmrs.org/openmrs/trunk /home/ben/workspace/openmrs-api-refactoring</p></blockquote>
<p><em>Note: I merged from trunk up to version 3684 first using the Subclipse svn gui (3685 was the revision with the license patch).  I ran the above at the command line to get a nice clean successful merge.  I was then able to merge from 3685 to HEAD using subclipse again.</em></p>
<p>I can&#8217;t really tell if this fixed problem 2 as well because I can&#8217;t remember which files this was happening to before.  The few files I queried were only showing me as having changed the first few license lines, so it appears to have solved it.</p>
 <img src="http://blog.eflow.org/wp-content/plugins/feed-statistics.php?view=1&post_id=45" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.eflow.org/archives/45/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
