You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jan Keirse <ja...@tvh.be> on 2011/04/04 16:03:13 UTC

Betr.: how to avoid text and tree conflict

su heng <st...@gmail.com> schreef op 04/04/2011 15:41:38:

> Hi,
> 
>   I read the SVN book, as there are three type conflicts: text, tree and
> properties conflict. However, I wanna know why it is a conflict. For
> example, if there is a text conflict when I do merging code, I just know
> there is an conflict but don't know why it is a conflict.
> 
>   So could u provide me some resource or hints what are the judge rules
> for SVN to address it is a conflict, in this case, I can avoid more
> conflict when I'm coding or merging. I concert the text and tree
> conflict more.
> 

Start version is A. B and C are changes to A.
Change B says line 3 is 'cool!'
Change C says line 3 is 'boring!'
If you want to merge change B and C there's a conflict, because one change 
says the opposite of the other. 

Similar: 
Start filename is A . 
Change B says A should be renamed to B. 
Change C says A should be renamed to C.
If you want to merge B and C what should the filename be? B or C? 

Kind Regards,

JAN KEIRSE
ICT-AFDELING ? software quality & systems ? software engineer

**** DISCLAIMER ****

http://www.tvh.com/newen2/emaildisclaimer/default.html 

"This message is delivered to all addressees subject to the conditions
set forth in the attached disclaimer, which is an integral part of this
message."


Re: Betr.: Re: Betr.: how to avoid text and tree conflict

Posted by su heng <st...@gmail.com>.
On Mon, 2011-04-04 at 17:37 +0200, Jan Keirse wrote:
> su heng <st...@gmail.com> schreef op 04/04/2011 16:31:17:
> 
> > Hi Jan,
> > 
> >   Please kindly refer to my below comments.
> > 
> > Regards,
> > Su Heng
> > 
> > On Mon, 2011-04-04 at 16:03 +0200, Jan Keirse wrote:
> > > su heng <st...@gmail.com> schreef op 04/04/2011 15:41:38:
> > > 
> > > > Hi,
> > > > 
> > > >   I read the SVN book, as there are three type conflicts: text, tree 
> and
> > > > properties conflict. However, I wanna know why it is a conflict. For
> > > > example, if there is a text conflict when I do merging code, I just 
> know
> > > > there is an conflict but don't know why it is a conflict.
> > > > 
> > > >   So could u provide me some resource or hints what are the judge 
> rules
> > > > for SVN to address it is a conflict, in this case, I can avoid more
> > > > conflict when I'm coding or merging. I concert the text and tree
> > > > conflict more.
> > > > 
> > > 
> > > Start version is A. B and C are changes to A.
> > > Change B says line 3 is 'cool!'
> > > Change C says line 3 is 'boring!'
> > > If you want to merge change B and C there's a conflict, because one 
> change 
> > > says the opposite of the other. 
> > [suheng] : thanks, However, your example just covers one condition. Can
> > you give me a basic conflict rule policy of SVN so I can conclude all
> > conditions?
> >   As your example, can I thought whenever a low revision(C) merge to a
> > high revision(when B merge to A, A will be A+1), a text conflict will be
> > pop up whatever the line is changed?
> >   In your example, the precondition is file a is revision A, then the
> > same file under change B is revision B = A + n(n>0), and same file under
> > change C is revision C = B + n(n>0), when change B is merged to A, we
> > must commit it firstly(at this time revision A will be rise to A+n > B
> > && A+n > C, then do another merge I mean change C will be merged in A+n,
> > then conflict out.
> >   I think if C is a branch of from revision B+n(n>1) but not A, when we
> > merge C+n(n>1) won't involve conflict, right?
> > 
> >   Hmm...I think it has little confusing. you can ignore my explain, just
> > suggest me the basic conflict policy is appreciated.^_^
> 
> Ok, you misunderstood, C has nothing to do with B, it does not come after 
> B. As a general rule: if you changed the same line there is a conflict.
> 
> I'll put it another way. 
> Imagine at some point velkswagen makes a car, and stores the information 
> about that car in a file, named possat.txt.
> The file could have the following contents:
> 
> ---------------
> brand=vw
> model=possat
> tires=4
> engine=1900
> horsepower=110
> ---------------
> 
> Now at some point VW decides there possat can be sold with another logo as 
> skida octevia. So they branch the file:
>        octevia
>       /
> possat
> 
> And the file becomes:
> ---------------
> brand=skida
> model=octevia
> tires=4
> engine=1900
> horsepower=110
> ---------------
> 
> 
> After a few more years they decide to sell the same car under the siat 
> Brand:
> 
>        octevia
>       /
> possat
>       \
>          somesiat
> 
> 
> ---------------
> brand=siat
> model=somesiat
> tires=4
> engine=1900
> horsepower=110
> ---------------
> 
> Now a clever engineer at siat notices that a car does not have 4 tires but 
> 5, in case you hit a nail along the road you get an extra one in the trunk 
> to get you home. So he changes tires to 5. 
> Now we have 3 files, possat, somesiat and octevia. They all share the same 
> origin, the possat is long out of production so we don't care about that 
> anymore, but we want the octevia fixed. 
> If you merge from somesiat to octevia, with the possat as mutual ancestor, 
> you're going to get a problem, not with the tires but with the brand and 
> model, because somesiat changed brand and model but octevia did as well, 
> who holds the truth, what brand and model should be in the octevia file? 
> 
> 
> Kind Regards,
> 
> JAN KEIRSE
> ICT-AFDELING • software quality & systems • software engineer
> 
> **** DISCLAIMER ****
> 
> http://www.tvh.com/newen2/emaildisclaimer/default.html 
> 
> "This message is delivered to all addressees subject to the conditions
> set forth in the attached disclaimer, which is an integral part of this
> message."

Hi Jan,

  I just try the example which you provided to me. Please refer to my
flow:
###############
step 1 
submit one file possat:
--------------
brand=vw
model=possat
tires=4
engine=1900
horsepower=110
---------------

file name:possat(possat@r159)
################
step 2
create branch octevia(possat@r160) and somesiat(possat@r161) base on
file possat
################
step 3
change file possat under somesiat branch (possat@r161)
--------------------
brand=siat
model=somesiat
tires=4
engine=1900
horsepower=110
---------------------
and submit can get (possat@r162)

change file possat under octevia branch:
----------------
brand=skida
model=octevia
tires=4
engine=1900
horsepower=110
----------------
and submit can get (possat@r163)

######################
step 4
change possat under trunk(possat@r161)
--------------
brand=vw
model=possat
tires=5
engine=1900
horsepower=110
---------------
and submit can get (possat@r164)


Now, I switch to branch possat or octevia, do merge from trunk.
the line 'tires=5' will be merge automatically to my branch possat or
octevia.


Strange thing, if I switch to trunk do merge from possat or octevia,
brand line and model line will be automatically overwrite trunk's lines.


I'm using ecilpse + subeclipse. I will go to shell to verify the
correctness. 




Regards,
Su Heng


-- 
QQ :    49757862
MSN:    suh.steven@hotmail.com
Mobile: (0512)60780554



Betr.: Re: Betr.: how to avoid text and tree conflict

Posted by Jan Keirse <ja...@tvh.be>.
su heng <st...@gmail.com> schreef op 04/04/2011 16:31:17:

> Hi Jan,
> 
>   Please kindly refer to my below comments.
> 
> Regards,
> Su Heng
> 
> On Mon, 2011-04-04 at 16:03 +0200, Jan Keirse wrote:
> > su heng <st...@gmail.com> schreef op 04/04/2011 15:41:38:
> > 
> > > Hi,
> > > 
> > >   I read the SVN book, as there are three type conflicts: text, tree 
and
> > > properties conflict. However, I wanna know why it is a conflict. For
> > > example, if there is a text conflict when I do merging code, I just 
know
> > > there is an conflict but don't know why it is a conflict.
> > > 
> > >   So could u provide me some resource or hints what are the judge 
rules
> > > for SVN to address it is a conflict, in this case, I can avoid more
> > > conflict when I'm coding or merging. I concert the text and tree
> > > conflict more.
> > > 
> > 
> > Start version is A. B and C are changes to A.
> > Change B says line 3 is 'cool!'
> > Change C says line 3 is 'boring!'
> > If you want to merge change B and C there's a conflict, because one 
change 
> > says the opposite of the other. 
> [suheng] : thanks, However, your example just covers one condition. Can
> you give me a basic conflict rule policy of SVN so I can conclude all
> conditions?
>   As your example, can I thought whenever a low revision(C) merge to a
> high revision(when B merge to A, A will be A+1), a text conflict will be
> pop up whatever the line is changed?
>   In your example, the precondition is file a is revision A, then the
> same file under change B is revision B = A + n(n>0), and same file under
> change C is revision C = B + n(n>0), when change B is merged to A, we
> must commit it firstly(at this time revision A will be rise to A+n > B
> && A+n > C, then do another merge I mean change C will be merged in A+n,
> then conflict out.
>   I think if C is a branch of from revision B+n(n>1) but not A, when we
> merge C+n(n>1) won't involve conflict, right?
> 
>   Hmm...I think it has little confusing. you can ignore my explain, just
> suggest me the basic conflict policy is appreciated.^_^

Ok, you misunderstood, C has nothing to do with B, it does not come after 
B. As a general rule: if you changed the same line there is a conflict.

I'll put it another way. 
Imagine at some point velkswagen makes a car, and stores the information 
about that car in a file, named possat.txt.
The file could have the following contents:

---------------
brand=vw
model=possat
tires=4
engine=1900
horsepower=110
---------------

Now at some point VW decides there possat can be sold with another logo as 
skida octevia. So they branch the file:
       octevia
      /
possat

And the file becomes:
---------------
brand=skida
model=octevia
tires=4
engine=1900
horsepower=110
---------------


After a few more years they decide to sell the same car under the siat 
Brand:

       octevia
      /
possat
      \
         somesiat


---------------
brand=siat
model=somesiat
tires=4
engine=1900
horsepower=110
---------------

Now a clever engineer at siat notices that a car does not have 4 tires but 
5, in case you hit a nail along the road you get an extra one in the trunk 
to get you home. So he changes tires to 5. 
Now we have 3 files, possat, somesiat and octevia. They all share the same 
origin, the possat is long out of production so we don't care about that 
anymore, but we want the octevia fixed. 
If you merge from somesiat to octevia, with the possat as mutual ancestor, 
you're going to get a problem, not with the tires but with the brand and 
model, because somesiat changed brand and model but octevia did as well, 
who holds the truth, what brand and model should be in the octevia file? 


Kind Regards,

JAN KEIRSE
ICT-AFDELING • software quality & systems • software engineer

**** DISCLAIMER ****

http://www.tvh.com/newen2/emaildisclaimer/default.html 

"This message is delivered to all addressees subject to the conditions
set forth in the attached disclaimer, which is an integral part of this
message."

Re: Betr.: how to avoid text and tree conflict

Posted by su heng <st...@gmail.com>.
Hi Jan,

  Please kindly refer to my below comments.

Regards,
Su Heng

On Mon, 2011-04-04 at 16:03 +0200, Jan Keirse wrote:
> su heng <st...@gmail.com> schreef op 04/04/2011 15:41:38:
> 
> > Hi,
> > 
> >   I read the SVN book, as there are three type conflicts: text, tree and
> > properties conflict. However, I wanna know why it is a conflict. For
> > example, if there is a text conflict when I do merging code, I just know
> > there is an conflict but don't know why it is a conflict.
> > 
> >   So could u provide me some resource or hints what are the judge rules
> > for SVN to address it is a conflict, in this case, I can avoid more
> > conflict when I'm coding or merging. I concert the text and tree
> > conflict more.
> > 
> 
> Start version is A. B and C are changes to A.
> Change B says line 3 is 'cool!'
> Change C says line 3 is 'boring!'
> If you want to merge change B and C there's a conflict, because one change 
> says the opposite of the other. 
[suheng] : thanks, However, your example just covers one condition. Can
you give me a basic conflict rule policy of SVN so I can conclude all
conditions?
  As your example, can I thought whenever a low revision(C) merge to a
high revision(when B merge to A, A will be A+1), a text conflict will be
pop up whatever the line is changed?
  In your example, the precondition is file a is revision A, then the
same file under change B is revision B = A + n(n>0), and same file under
change C is revision C = B + n(n>0), when change B is merged to A, we
must commit it firstly(at this time revision A will be rise to A+n > B
&& A+n > C, then do another merge I mean change C will be merged in A+n,
then conflict out.
  I think if C is a branch of from revision B+n(n>1) but not A, when we
merge C+n(n>1) won't involve conflict, right?

  Hmm...I think it has little confusing. you can ignore my explain, just
suggest me the basic conflict policy is appreciated.^_^

> 
> Similar: 
> Start filename is A . 
> Change B says A should be renamed to B. 
> Change C says A should be renamed to C.
> If you want to merge B and C what should the filename be? B or C? 
[suheng] : thanks for your explain.
> 
> Kind Regards,
> 
> JAN KEIRSE
> ICT-AFDELING ? software quality & systems ? software engineer
> 
> **** DISCLAIMER ****
> 
> http://www.tvh.com/newen2/emaildisclaimer/default.html 
> 
> "This message is delivered to all addressees subject to the conditions
> set forth in the attached disclaimer, which is an integral part of this
> message."
> 


-- 
QQ :    49757862
MSN:    suh.steven@hotmail.com
Mobile: (0512)60780554