[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Question about SVN update will cause the unexpect merge result.

From: Dcma Tsai -sj <Dcma.Tsai_at_zyxel.com.tw>
Date: 2007-09-10 10:57:46 CEST

Dear All
SVN update will automatically merge the difference from trunk to working copy.
But we found that in some cases, the automatically merge result is not what we want.
The reason is about "blank line".
Take an example.
 
The Base revision is
----------------------------------------------
for( i = 0; i < 100; i++ ) {
    
    a[i]++;
}
-----------------------------------------------
Then both A and B modify the code to fix the same bug.
When A modifies the code.
He adds the code at "blank line" and commits first.
This commit is revision R1.
Revision R1.
----------------------------------------------
for( i = 0; i < 100; i++ ) {
    a[i]*=2; /* A fixs the bug */
    a[i]++;
}
-----------------------------------------------
But at the same time, B modifies the code to fix the same bug.
He adds the code below "blank line".
Following is the code he modified.
----------------------------------------------
for( i = 0; i < 100; i++ ) {
 
    a[i]*=2; /* B fixs the bug */
    a[i]++;
}
-----------------------------------------------
When B wants to commit the code, he needs to perform update first and this will merge the code from trunk.
And this will cause the following situation in B's working copy.
No conflict! Just merge!! And the merge result cause another bug!!!
----------------------------------------------
for( i = 0; i < 100; i++ ) {
    a[i]*=2; /* A fixs the bug */
    a[i]*=2; /* B fixs the bug */
    a[i]++;
}
-----------------------------------------------
 
This situation is dangerous. Can SVN update ignore the difference of blank line??
If blank line is ignore, then B will find that his modification is conflict with A's modification.
 
Best regards
Dylan
Received on Mon Sep 10 10:54:25 2007

This is an archived mail posted to the Subversion Dev mailing list.