In Eclipse, how to diff the current state against the lastcheckout?

T

Tom Anderson

Hi chaps,

This is an Eclipse question, but since Eclipse is a Java IDE, i thought
i'd try here first. I'll brave the Eclipse forums if necessary, but only
if necessary!

We use Eclipse. I checked out a project from our CVS server some time the
week before last, and have been doing some far-ranging editing since then.
Elsewhere in the office, someone else has also been doing some large-scale
reorganisation, and has now checked that in. The difference between my
current state and the head is big enough that i don't fancy merging the
two (plus, there's a lot of leftover debris from my editing, which was not
done very hygeinically - it started out as an experiment and became a
feature). Rather, what i want to do is capture the work i've done as a
patch file, then throw away my work, update to the head, and then think
about manually bringing my work in in small chunks, committing to CVS as i
go. I honestly think this will be less work in the long run than doing a
big merge.

The problem is that i have no idea how to make the patch. You can make a
patch of anything you've diffed, but what do i diff against? It's not the
head; it needs to be the version that i originally checked out. But that
was two weeks ago, and wasn't a particular tag. If i knew the exact time
and date of the checkout, i could pick a version based on that, but i
don't. So how do i do this? Is there a 'diff against last checkout'
option? Is there some way to look up the time of the last checkout? Any
ideas?

Thanks,
tom
 
L

lord.zoltar

Hi chaps,

This is an Eclipse question, but since Eclipse is a Java IDE, i thought
i'd try here first. I'll brave the Eclipse forums if necessary, but only
if necessary!

We use Eclipse. I checked out a project from our CVS server some time the
week before last, and have been doing some far-ranging editing since then..
Elsewhere in the office, someone else has also been doing some large-scale
reorganisation, and has now checked that in. The difference between my
current state and the head is big enough that i don't fancy merging the
two (plus, there's a lot of leftover debris from my editing, which was not
done very hygeinically - it started out as an experiment and became a
feature). Rather, what i want to do is capture the work i've done as a
patch file, then throw away my work, update to the head, and then think
about manually bringing my work in in small chunks, committing to CVS as i
go. I honestly think this will be less work in the long run than doing a
big merge.

The problem is that i have no idea how to make the patch. You can make a
patch of anything you've diffed, but what do i diff against? It's not the
head; it needs to be the version that i originally checked out. But that
was two weeks ago, and wasn't a particular tag. If i knew the exact time
and date of the checkout, i could pick a version based on that, but i
don't. So how do i do this? Is there a 'diff against last checkout'
option? Is there some way to look up the time of the last checkout? Any
ideas?

Thanks,
tom

I know RAD has a "compare with local history..." feature. Right-click
on the file (in the navigation tree or the text-area in the editor
itself) and choose, "Compare with -> Local history...". RAD is based
off Eclipse, and I think this is a stock feature of Eclipse (not a RAD-
specific plugin).
There are also settings somewhere in the preferences that let you
control just how much local history you want to save.
 
R

RedGrittyBrick

Tom said:
Hi chaps,

This is an Eclipse question, but since Eclipse is a Java IDE, i thought
i'd try here first. I'll brave the Eclipse forums if necessary, but only
if necessary!

We use Eclipse. I checked out a project from our CVS server some time
the week before last, and have been doing some far-ranging editing since
then. Elsewhere in the office, someone else has also been doing some
large-scale reorganisation, and has now checked that in. The difference
between my current state and the head is big enough that i don't fancy
merging the two (plus, there's a lot of leftover debris from my editing,
which was not done very hygeinically - it started out as an experiment
and became a feature). Rather, what i want to do is capture the work
i've done as a patch file, then throw away my work, update to the head,
and then think about manually bringing my work in in small chunks,
committing to CVS as i go. I honestly think this will be less work in
the long run than doing a big merge.

The problem is that i have no idea how to make the patch. You can make a
patch of anything you've diffed, but what do i diff against? It's not
the head; it needs to be the version that i originally checked out. But
that was two weeks ago, and wasn't a particular tag. If i knew the exact
time and date of the checkout, i could pick a version based on that, but
i don't. So how do i do this? Is there a 'diff against last checkout'
option? Is there some way to look up the time of the last checkout? Any
ideas?

If you had this in your templates I guess you'd have mentioned it.
/**
* @version $Id:$
*/
 
J

John B. Matthews

Tom Anderson said:
This is an Eclipse question, but since Eclipse is a Java IDE, i
thought i'd try here first. I'll brave the Eclipse forums if
necessary, but only if necessary!

We use Eclipse. I checked out a project from our CVS server some time
the week before last, and have been doing some far-ranging editing
since then. Elsewhere in the office, someone else has also been doing
some large-scale reorganisation, and has now checked that in. The
difference between my current state and the head is big enough that i
don't fancy merging the two (plus, there's a lot of leftover debris
from my editing, which was not done very hygeinically - it started
out as an experiment and became a feature). Rather, what i want to do
is capture the work i've done as a patch file, then throw away my
work, update to the head, and then think about manually bringing my
work in in small chunks, committing to CVS as i go. I honestly think
this will be less work in the long run than doing a big merge.

The problem is that i have no idea how to make the patch. You can
make a patch of anything you've diffed, but what do i diff against?
It's not the head; it needs to be the version that i originally
checked out. But that was two weeks ago, and wasn't a particular tag.
If i knew the exact time and date of the checkout, i could pick a
version based on that, but i don't. So how do i do this? Is there a
'diff against last checkout' option? Is there some way to look up the
time of the last checkout? Any ideas?

I've done it both ways. Initially, I created patches against the last
common tag, and the project owner merged by hand. Fortunately, my
changes were well circumscribed, largely confined to stubs in the
original and a few bug fixes. Since then I've used the Team
Synchronizing Perspective in Incoming/Outgoing mode. Conflicts Mode
(double-headed red arrow) narrows the list of files to those you might
want to Open in Compare Editor. Before you throw anything away, at least
look at Conflicts Mode to see how much your trees have diverged. AFAIK,
it can't hurt to look.
 
G

Giovanni Azua

Hi Tom,

Tom Anderson said:
The problem is that i have no idea how to make the patch. You can make a
patch of anything you've diffed, but what do i diff against? It's not the
head; it needs to be the version that i originally checked out. But that
was two weeks ago, and wasn't a particular tag. If i knew the exact time
and date of the checkout, i could pick a version based on that, but i
don't. So how do i do this? Is there a 'diff against last checkout'
option? Is there some way to look up the time of the last checkout? Any
ideas?
I would backup your working copy in a tar or zip and extract it somewhere
else. Then simply fully revert your changes and use it as reference to diff
against.

If you are in Linux/Unix I would create a patch using the diff tool. In
Windows I would use TortoiseCVS.

I have experience merging with Eclipse + Subversion (Subclipse plugin) and
it is fairly easy but none with cvs.

Another alternative is to try to merge your changes directly e.g. in Windows
I would use Araxis Merge http://www.araxis.com/merge/index.html to
recursively compare two directories and merge them, it is very very nice.
You can get a free trial for 30 days I think.

In any case always backup your working copy.

HTH,
Best regards,
Giovanni
 
M

Mike Schilling

Tom said:
Hi chaps,

This is an Eclipse question, but since Eclipse is a Java IDE, i
thought i'd try here first. I'll brave the Eclipse forums if
necessary, but only if necessary!

We use Eclipse. I checked out a project from our CVS server some
time
the week before last, and have been doing some far-ranging editing
since then. Elsewhere in the office, someone else has also been
doing
some large-scale reorganisation, and has now checked that in. The
difference between my current state and the head is big enough that
i
don't fancy merging the two (plus, there's a lot of leftover debris
from my editing, which was not done very hygeinically - it started
out as an experiment and became a feature). Rather, what i want to
do
is capture the work i've done as a patch file, then throw away my
work, update to the head, and then think about manually bringing my
work in in small chunks, committing to CVS as i go. I honestly think
this will be less work in the long run than doing a big merge.

The problem is that i have no idea how to make the patch. You can
make a patch of anything you've diffed, but what do i diff against?
It's not the head; it needs to be the version that i originally
checked out. But that was two weeks ago, and wasn't a particular
tag.
If i knew the exact time and date of the checkout, i could pick a
version based on that, but i don't. So how do i do this? Is there a
'diff against last checkout' option? Is there some way to look up
the
time of the last checkout? Any ideas?

I haven't used CVS for years (nor missed it), but is it really true
that CVS can't

1. Tell you what version your client last checked out, and
2. Fetch that version into another file, so that you can diff the two?

Good Lord, I've used CMS systems that were simple-minded shell scripts
on top of RCS that supported both of those.
 
T

Tom Anderson

If you go to Package Explorer, right-click on a project, and select
Team->Create Patch it will generate a patch file. As far as I know,
this is based the differences from your last checkout; I can't think
what else it would use. This works for SVN, but I assume CVS works the
same way.

I stumbled across this a bit after posting - from examining the resulting
patch file, it does look like it has everything in it. I was a bit
uncertain, though, due to the lack of any explicit indication that that
was the case. Thanks for reassuring me!

tom
 
T

Tom Anderson

I know RAD has a "compare with local history..." feature. Right-click
on the file (in the navigation tree or the text-area in the editor
itself) and choose, "Compare with -> Local history...". RAD is based
off Eclipse, and I think this is a stock feature of Eclipse (not a RAD-
specific plugin).

Got that. But how i do i know *which* entry in the local history to use?
There are changes every minute, and i have no idea which one is my
checkout!

tom
 
T

Tom Anderson

If you had this in your templates I guess you'd have mentioned it.
/**
* @version $Id:$
*/

Mostly, i don't have that. But even if i did, those tags only get updated
when a fresh version of a file is checked out (right?). So if there's a
file that was checked out three months ago and hasn't changed in CVS
since, then it will still have that three-month-old date in my local copy.
If i checked out into a clean directory every time, of course, i'd have
the right date. But i don't.

tom
 
T

Tom Anderson

I've done it both ways. Initially, I created patches against the last
common tag, and the project owner merged by hand. Fortunately, my
changes were well circumscribed, largely confined to stubs in the
original and a few bug fixes. Since then I've used the Team
Synchronizing Perspective in Incoming/Outgoing mode. Conflicts Mode
(double-headed red arrow) narrows the list of files to those you might
want to Open in Compare Editor. Before you throw anything away, at least
look at Conflicts Mode to see how much your trees have diverged. AFAIK,
it can't hurt to look.

Well, it didn't hurt *much*. :)

The other guy's changes include splitting two of the projects (the project
is actually about half a dozen CVS projects) in half, assigning some files
to each half (it's a sort of reusable / non-reusable split), and moving
things around within each half (eg from /foo/conf/main.xml to
/conf/foo.xml). It's not just that there are big differences in files,
it's that files are in completely different places. If i was using a more
sophisticated version control system that new about renames, i'd be
laughing, but sadly, i'm not.

tom
 
T

Tom Anderson

I would backup your working copy in a tar or zip and extract it
somewhere else. Then simply fully revert your changes and use it as
reference to diff against.

Revert it what? The 'revert' menu option undoes unsaved changes, which is
obviously no use in this situation. I can override and update from CVS,
but only to a version i know the date of, so i'm back to square one there.
Is there a way to tell Eclipse to revert to the last checkout from CVS? I
haven't come across one, but if so, that would be perfect.

tom
 
T

Tom Anderson

I haven't used CVS for years (nor missed it), but is it really true
that CVS can't

1. Tell you what version your client last checked out, and
2. Fetch that version into another file, so that you can diff the two?

Good Lord, I've used CMS systems that were simple-minded shell scripts
on top of RCS that supported both of those.

I'm sure it must be able to. But i don't know how to make it do it!

tom
 
L

lord.zoltar

Got that. But how i do i know *which* entry in the local history to use?
There are changes every minute, and i have no idea which one is my
checkout!

tom

I don't think RAD or Eclipse will actually keep track of the last time
you checked out and indicate this to you - at least not without some
sort of plugin to your repository (probably).
But not all hope is lost: 1) do you remember the date you last checked
out and 2) is that date in the local history? There ARE limits to how
far back in local history you can go.

Or... you could maybe check out the current head changes, overwrite
the local file, and then compare that with the local history of just
BEFORE you checked out. AND keep a local backup of the file, of
course. ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top