CVS "Search" function?

View: New views
5 Messages — Rating Filter:   Alert me  

CVS "Search" function?

by Hamilton, Fred :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I asked an employee (no longer with the company) to reorganize his
portion of the CVS tree for a project he was working on (it was
disorganized, mislabeled, there were multiple copies of the same
project, and you basically couldn't find anything).  It turns out he
apparently deleted all the files in the project, reorganized a copy of a
subset of the files, and checked those copies back in.  We were able to
restore most of the files that *weren't* his, but I'm trying to find the
previous versions of some of the files that *were* his.  

The exact example is that I wrote some code that was checked in to CVS
by me.  He then deleted all that code, checked it in as new at a new
location under his name, modified my code, and, of course, there are now
5 different versions of this project.

So what I would ideally like to do is search for all the versions of a
certain filename, wherever it is, deleted or not, that were checked in
by me.

Is there an easy way to do this?

Is there a hard way to do this?

Thanks,
Fred



Re: CVS "Search" function?

by Todd Denniston :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hamilton, Fred wrote, On 09/24/2008 12:39 PM:

> Hi,
>
> I asked an employee (no longer with the company) to reorganize his
> portion of the CVS tree for a project he was working on (it was
> disorganized, mislabeled, there were multiple copies of the same
> project, and you basically couldn't find anything).  It turns out he
> apparently deleted all the files in the project, reorganized a copy of a
> subset of the files, and checked those copies back in.  We were able to
> restore most of the files that *weren't* his, but I'm trying to find the
> previous versions of some of the files that *were* his.  
>
> The exact example is that I wrote some code that was checked in to CVS
> by me.  He then deleted all that code, checked it in as new at a new
> location under his name, modified my code, and, of course, there are now
> 5 different versions of this project.
>
> So what I would ideally like to do is search for all the versions of a
> certain filename, wherever it is, deleted or not, that were checked in
> by me.
>
> Is there an easy way to do this?
>
> Is there a hard way to do this?
>
> Thanks,
> Fred
>
>
>

I think we need a bit more information.
When you say "He then deleted all that code" do you mean:
A) he logged into the cvs server (or accessed the NFS drive) an executed `rm
important/code/`.
or
B) in his sandbox he executed
`cvs remove -f important/code;cvs commit -m "hurt these guys"`. ????

You do have backups of the repository prior to his changes, RIGHT????

To answer the two questions at the end of your email: maybe, probably. :)


--
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter



RE: CVS "Search" function?

by Wurdock, Tom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'll take a stab.  In the cvs directory on the server you could run:

   find . | grep "filename"

To find them all.

But if you want to search the commits you made, pass the filenames to:

   grep "author your_username;"

This will show you files where you made commits, but you'd be looking at
the raw source.

Am I way off or is this a god start?  



> -----Original Message-----
> From: info-cvs-bounces+twurdock=plato.com@...
> [mailto:info-cvs-bounces+twurdock=plato.com@...] On
> Behalf Of Hamilton, Fred
> Sent: Wednesday, September 24, 2008 11:40 AM
> To: info-cvs@...
> Subject: CVS "Search" function?
>
> Hi,
>
> I asked an employee (no longer with the company) to
> reorganize his portion of the CVS tree for a project he was
> working on (it was disorganized, mislabeled, there were
> multiple copies of the same project, and you basically
> couldn't find anything).  It turns out he apparently deleted
> all the files in the project, reorganized a copy of a subset
> of the files, and checked those copies back in.  We were able
> to restore most of the files that *weren't* his, but I'm
> trying to find the previous versions of some of the files
> that *were* his.  
>
> The exact example is that I wrote some code that was checked
> in to CVS by me.  He then deleted all that code, checked it
> in as new at a new location under his name, modified my code,
> and, of course, there are now
> 5 different versions of this project.
>
> So what I would ideally like to do is search for all the
> versions of a certain filename, wherever it is, deleted or
> not, that were checked in by me.
>
> Is there an easy way to do this?
>
> Is there a hard way to do this?
>
> Thanks,
> Fred
>
>
>



RE: CVS "Search" function?

by Hamilton, Fred :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Todd,

You wrote:

>I think we need a bit more information.
>When you say "He then deleted all that code" do you mean:
>A) he logged into the cvs server (or accessed the NFS drive) an
executed `rm important/code/`.

He didn't have the know-how to do that.

>or
>B) in his sandbox he executed
>`cvs remove -f important/code;cvs commit -m "hurt these guys"`. ????

I'm pretty sure it was more something like that.  We're using
TortoiseCVS on WinXP, so I think he just removed and committed the
remove as you state (not 100% sure about the switches).  BTW, he wasn't
intentionally trying to hurt us, he just had no clue how to use CVS and
apparently it didn't occur to him to ask or look it up or think before
he acted.

>You do have backups of the repository prior to his changes, RIGHT????

I'm sure we do, though this happened 18 months ago so the backups are
probably spaced pretty coarsely in time.

>To answer the two questions at the end of your email: maybe, probably.
:)

:-)

I ended up doing "cvs log >logfile.txt" I found many earlier versions of
the file in different projects.  I didn't find any checked in by me, but
I did find plenty of pre-genocide files, followed by the deletion,
followed by the re-adding once we discovered they had been deleted, so I
think it's a comprehensive list of all the files.  

At this point I'm starting to think that I never did check in this file
myself - I must have given it to the employee to check in.

In any case, I did find a version of it that I can use.

Thanks for your support!

-Fred



Re: CVS "Search" function?

by Todd Denniston :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hamilton, Fred wrote, On 09/25/2008 12:23 PM:

> Hi Todd,
>
> You wrote:
>
>> I think we need a bit more information.
>> When you say "He then deleted all that code" do you mean:
>> A) he logged into the cvs server (or accessed the NFS drive) an
> executed `rm important/code/`.
>
> He didn't have the know-how to do that.
>

Let's keep hoping. :)

>> or
>> B) in his sandbox he executed
>> `cvs remove -f important/code;cvs commit -m "hurt these guys"`. ????
>
> I'm pretty sure it was more something like that.  We're using
> TortoiseCVS on WinXP, so I think he just removed and committed the
> remove as you state (not 100% sure about the switches).

Good, then you should be able to use just CVS commands to recover the files.

>  BTW, he wasn't
> intentionally trying to hurt us, he just had no clue how to use CVS and
> apparently it didn't occur to him to ask or look it up or think before
> he acted.


This is why I usually run over each VC plan (pre execution) with anyone who
will be messing about in my repositories, until I think they "Get It"(tm).

BTW my -m "text" was mostly for flair.

>
>> You do have backups of the repository prior to his changes, RIGHT????
>
> I'm sure we do, though this happened 18 months ago so the backups are
> probably spaced pretty coarsely in time.
>

If you still have them, I would sequester (don't allow it to be reused or
destroyed)  the backup media until I was sure that we had all the files back
the way you wanted them.

>> To answer the two questions at the end of your email: maybe, probably.
> :)
>
> :-)
>
> I ended up doing "cvs log >logfile.txt" I found many earlier versions of
> the file in different projects.

I find when doing this kind of work, cvs2cl (or cvs2cl.py on windows, comes
with CVSNT & tortoise) to be very useful, as it lets you see the big sweeping
changes, such as a directory tree getting cvs removed or added at the same time.

My standard execution would be:
cvs2cl -r -t


BTW, Is your repository server running a CVS version or CVSNT version?
The reason for asking is that CVSNT keeps 'change set' records that may be
useful IIRC.

>  I didn't find any checked in by me, but
> I did find plenty of pre-genocide files, followed by the deletion,
> followed by the re-adding once we discovered they had been deleted, so I
> think it's a comprehensive list of all the files.  

If $CVSROOT/CVSROOT/history was kept, the cvs history command might be of help
too.

and it sounds like once you have found the files and versions you need to work
with, you already know about using `cvs add` and `cvs update -jnew -jold` for
recovering files.

>
> At this point I'm starting to think that I never did check in this file
> myself - I must have given it to the employee to check in.
>
> In any case, I did find a version of it that I can use.

Nice to hear.
>
> Thanks for your support!
>

Your welcome.

suggestion for the future:
When having someone re-factor a baseline|directory tree, it is usually a good
idea to have someone who is both very familiar with the version control tool
and very familiar with configuration management practices do: A) planning
(scripting) of the changes, B) test in a copy of the baseline, C) execute the
plan on the real baseline. And it only hurts a little if they happen to be
obsessive compulsively detail oriented.

I have seen, too many times, junior folks assigned to the role of "integrator"
or "Configuration Manager" and because they A) don't know what they are doing,
B) don't have a desire to learn the tools and C) think they know it all (think
straight from college, or the old mainframe-er thrown on your modern
development team), make a right royal mess.

[In slight defense of the old mainframe-er, at least the mess is from keeping
too much stuff, which happens to be reasonably organized.]

--
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter


LightInTheBox - Buy quality products at wholesale price!