[cvsnt] But... (was: No conflict when merging, where one is expected)
John Peacock
jpeacock at rowman.com
Thu Sep 4 16:32:24 BST 2003
Oliver Giesen wrote:
> 3. I went back the trunk revision, deleted all lines from it and
> committed it. As far I understood you, you are saying that this is
> pretty much the same as cvs removing the file.
No, I'm saying that as far as /patching/ the file is concerned, a deleted file
is unable to cause a conflict because it has no lines to conflict. It is a
conceptual thing, rather than any sort of objective reality.
And the more important thing to remember is that when you merge from a branch,
you are merging against the local sandbox, which may or may not be up to date
with any spot in the repository. Under CVS, it is impossible to merge directly
in the repository.
>
> 4. I merged the now empty trunk-file with the still filled branch file
> and got a conflict.
>
And the conflict here is caused by the fact that it is impossible to match _any_
lines in the empty file in order to begin patching. If you were to manually try
to apply the changes from the branch, you would [conceptually] do this:
cvs diff -r branch-tip -r branch-root file.ext > file.diff
patch -i file.diff
If you looked at file.diff, you would discover that there were lines that should
be added and lines that should be deleted. The file.diff has some instructions
about /where/ to apply those changes. It will look roughly like this:
D:\working\Home\htdocs>c:cvs diff EmailAddresses.shtml
Index: EmailAddresses.shtml
===================================================================
RCS file: w:/cvs-repository/websites/Home/htdocs/EmailAddresses.shtml,v
retrieving revision 1.4
diff -r1.4 EmailAddresses.shtml
7,10c7
< <h2>Creating database of e-mail addresses</h2>
< [writefile file=^DB\Intranet\EmailAddresses.db][!]
< [/!][Middle StartAfter=.pl][DOS]perl EmailAddresses.pl[/DOS][/middle][!
]
< [/!][/writefile]
---
> [DOS]perl EmailAddresses.pl > EmailAddresses.db[/DOS]
where the lines preceeded < are to be deleted and > to be added. Those cryptic
numbers tell the patching code where to start making changes. It is even more
clear what is going on is you use the '-u' option to produce unified context diff:
D:\working\Home\htdocs>c:cvs diff -u EmailAddresses.shtml
Index: EmailAddresses.shtml
===================================================================
RCS file: w:/cvs-repository/websites/Home/htdocs/EmailAddresses.shtml,v
retrieving revision 1.4
diff -u -r1.4 EmailAddresses.shtml
--- EmailAddresses.shtml 16 Jul 2003 19:21:29 -0000 1.4
+++ EmailAddresses.shtml 4 Sep 2003 15:24:34 -0000
@@ -4,10 +4,7 @@
<title>Sample display email addresses</title>
</head>
<body>
- <h2>Creating database of e-mail addresses</h2>
- [writefile file=^DB\Intranet\EmailAddresses.db][!]
- [/!][Middle StartAfter=.pl][DOS]perl EmailAddresses.pl[/DOS][/middle][!
]
- [/!][/writefile]
+ [DOS]perl EmailAddresses.pl > EmailAddresses.db[/DOS]
<h2>Done!</h2>
</body>
</html>
where the @@ line is telling you that before context is lines 4-10 and after it
is 4-7. The nice thing about context diff's is that if a bunch of text was
deleted or added, the three unchanging lines would be assist patch in finding
the correct spot to start changing.
The conflict in your case is that there is no way to start patching, since there
is a file, but the markers/lines aren't present.
HTH
John
More information about the cvsnt
mailing list