[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS merge issue: "cvs update -j -j"
Re: CVS merge issue: "cvs update -j -j"
Thu, 3 Apr 2003 19:29:13 -0800
Glen Wolfe writes:
> In our use of the function,we wish to transfer the functionality
> represented by the change from RevE to RevF without taking the
> functionality delivered as the changes from RevA to RevE.
But in your case 2, RevE has text which was added in RevB and RevD.
So therefore you cannot expect cvs to completely ignore it. The text
is in RevE, so cvs will examine all of RevE.
The functionality you do want is right next to the functionality you
do not want, which is why cvs shows it as a conflict rather than
automatically merging it. I discuss this in more detail below.
> I am having trouble seeing your point of view that the addition of lines
> b,c on one branch or the removal on the other makes any difference to
> the result.
Consider this new example:
It is obvious that RevF added b, so the merge result is:
But suppose that you change RevE to be:
Then it becomes apparent that RevF did not add b. Rather RevC
deleted b. Therefore the merge should be:
So in this example, whether it was an addition on one branch or a delete on
another does make a difference in the merge result. RevC and RevF are
the same in both merges, so the only way to tell what the merge result
should be is to look at RevE. cvs does look at RevE, and I advocated
that the hypothetical user in Frederick's example also follow that
necessary rule of looking at RevE. That way, he won't make the mistake
of assuming all changes were additions.
> True, either may have been performed in error, but so may
> any of the other revision transitions which are not displayed as
> involved in this merge.
I disagree. I believe they are displayed. In your case2, suppose it
was a mistake to put line c into RevD and to put line b into RevE. You
are right to imply that RevF did not involve a *change* related to
lines b and c. But RevF does have those lines. I.e., RevF did not
make the mistake of adding b and c. Rather it was RevD and RevE which
make the mistake. But notice how cvs still shows the mistake, which is
good since it makes the person revolving it, notice the mistake.
> Can you help me to understand your idea of what the merge objectives are
> and how the path to each revision is important to you?
Given a set of 3 revisions which you want to merge, the "path to each
revision" is not important at all in determining what the auto-merged
file should contain. The path to each revision may be important in
deciding which 3 revisions to merge, but once you have decided on
which 3 revisions, the path to them is no longer relevant.
When cvs does a merge of a file, it reads only 3 revisions of that
file. Even though extra revisions may have been committed in a
long path to one of those 3 revisions, cvs ignores those extra
RevA differs between your two cases, but that is irrelevant. RevC,
RevE, RevF, are the same between your two cases, so therefore in both
cases, cvs will act the same.
You wanted to transfer the functionality from RevE to RevF. You
pointed out that functionality was implemented with a transition of
adding lines d,e. So you want to add those same lines to RevC
(i.e. the revision in your working directory). It would probably be a
mistake if the user who made RevF had added the lines d,e before
a,b,c. Of course he did not make that mistake. He correctly added
d,e after instead of before. cvs will try to notice if he added them
before or after. And then when cvs applies that change to RevC, cvs
will try to follow the example of adding the lines at the same
position. I.e., if you added the d,e to RevF before the other lines,
then cvs will try to likewise add them before the lines in RevC. But
if you added them afterwards, then cvs will likewise try to add them
afterwards. cvs actually tries to notice where you added d,e, by
observing that you added them after the lines a,b,c, but since the
RevC does not have lines a,b,c, then it gets confused and does not
know where in the file to add d,e. I.e., cvs sees RevF's
addition in a certain context, but that context does not exist in
RevC. Therefore cvs does not know where to put it. That means cvs
cannot automatically merge this file. cvs requires that the human
user to help merge it.