bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS merge issue: "cvs update -j -j"


From: bjacob
Subject: CVS merge issue: "cvs update -j -j"
Date: Fri, 28 Mar 2003 17:31:01 -0800

Frederic Gioanni writes:
>     Hi,
> 
> I have got some problems when merging delta between rev1 and rev2 into
> my Working revision of a file using
>     cvs  update  -j  rev1  -j  rev2  file
> 
> I am using CVS 1.10 with diff3 2.7. The same problem occurs in the
> latest version of CVS.
> 
> Let's say that the content of file:rev1 is:
> 
>     a
>     b
>     c
> 
> Content of file:rev2 is:
> 
>     a
>     b
>     c
>     d
>     e
> 
> Content of my working revision is:
> 
>     a
> 
> When doing the merge, I am expecting 2 new lines and so I am expecting
> the following conflict:
> 
>     a
>     <<<<<<< file
>     =======
>     d
>     e
>     >>>>>>> rev2

When two changes conflict, a merge utility should add conflict markers
that show both of the changes.  But the above file shows only one of
the changes, namely the addition of d and e.  But it does not show the
deletion of b and c even though that deletion conflicted with the
other change.

I.e., the above file is biased in favor of one of the two new revisions
of the file.  An analogy of this would be how newspapers often have a
policy that they will report both sides of an issue so as to be fair.
For example, if there is conflict between two senators, where one
senator offers a reason in support of a bill and another senator
offers a reason to be opposed to it, then to be fair, the newspaper
should quote both of the senators.  If it quotes only one senator,
then reader might think that argument makes sense and the reader might
not know of any opposing arguments.  If the reader knew about opposing
arguments he might change his mind.

This is analogous to how the person resolving the conflict in the
above file will not know that anyone deleted b and c.  But suppose
that that deletion was a mistake.  If only the person who is resolving
the conflict knew that someone deleted it, then he might realize that
that person made a mistake.  The above file will not help him notice
that mistake which means the mistake would remain uncorrected.  The
file below is better because it does show that someone may have
mistakingly deleted b and c.

> 
> However, "cvs up -j -j" ends with:
> 
>     a
>     <<<<<<< file
>     =======
>     b
>     c
>     d
>     e
>     >>>>>>> rev2
> 
> When resolving the conflict, the user thinks that 4 lines were added
> between rev1 and rev2 whereas only 2 lines were added.

Whenever one version of a file has some text which another file does
not have, it can always be interpreted in two ways: either someone
added the text to one file or someone deleted the text from the other
file.  The user in your example is mistaken if he does not consider
both possibilities.  When cvs made the file above, cvs did not imply
one interpretation over another.  Therefore the user should likewise not
assume one interpretation must be the right one based on only seeing
the above file.  However, the user will have other information which can
help him decide which interpretation is correct.  Specially, the user
will remember what changes he made so he will know whether he added or
deleted anything.  Knowing that will help him know if the other file
added or deleted anything.  Therefore, he can figure out which
interpretation is correct.  And if he forgets what changes he made, he
can ask cvs to show him the complete file of rev1.  That will make it easy
to see whether these changes are additions or deletions.

So, in my opinion, CVS is acting correctly.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]