In CVS, my working copy (WC) is on a certain branch (which we’ll call “foo”). There have been other changes checked into foo by another dev. I want to do a diff between my WC and the upstream state of foo. Normally, when working in the trunk (HEAD), I just do a cvs diff, and that’s fine. But for some reason when doing a plain cvs diff in the branch, the diff is empty. When I try to use “cvs diff -r foo”, the diff shows up, but it is inverted — upstream additions are shown with minuses, and upstream removals are shown with pluses.
How can I either: (1) get CVS to diff “the other way” (plus for upstream additions), or (2) invert a patch (in general)?
If the principal purpose of this is to check “what’s up” in the central repo, I suggest you get yourselves a functional CVS viewer/browser/web thingy where you can browse and see the latest changes before updating. But assuming all you have is command-line CVS, I will attempt to give you a solution anyway 🙂
So, what you have here is a branch
foothat went fromA->B, whereBis the state of the branch (on the server) after the other developer’s checkin, andAis the state you last updated your working copy to.When just doing a plain
cvs diffin this situation, you’ll see your local changes compared toAsinceAis what you have checked out. The local CVS state will show that each file comes from the A revision on the foo branch, and when diffing your CVS client will download that revision from the server. In your case I’m guessing you have no local changes since yourcvs diffis empty.Then, when you do a
cvs diff -r fooyou’re diffing your localA(or A+changes) against the server’sfoo(which currently is atB) – and the changes required to get from the server’sBto yourA+changesis exactly the opposite of the other developer’s check-in, plus your own local changes.Now, if you really really want to know how B (or tip-of-foo) compares to A (the pristine version of whatever you currently have checked out), what I think you have to do is set a tag on your working copy, then diff that tag against the state of the branch. Something like this: