[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[platform-cvs-dev] Getting the revision number of a removed file
|
- From: "Nettleton, Brian" <brian.nettleton@xxxxxxxxxxxxx>
- Date: Thu, 17 Jul 2008 17:26:10 -0700
- Delivered-to: platform-cvs-dev@eclipse.org
- Thread-index: AcjobGf37NHw3mEdQ5qKORVBx6Pqcg==
- Thread-topic: Getting the revision number of a removed file
I'm trying to add a
feature to Eclipse with the CVS plugin where I can add a tag to a file which is
being deleted. I want to tag the deleted revision. For clarity,
here's an example of how I might do this using standard cvs
commands:
bash-3.00$ rm
FileToBeDeleted.c
bash-3.00$ cvs remove FileToBeDeleted.c
cvs remove:
scheduling `FileToBeDeleted.c' for removal
cvs remove: use 'cvs commit' to
remove this file permanently
bash-3.00$ cvs commit -m "Delete the file"
FileToBeDeleted.c
Removing
FileToBeDeleted.c;
/cvs/FRA1158/TestNativeApplicationProject/FileToBeDeleted.c,v
<-- FileToBeDeleted.c
new revision: delete; previous revision:
1.96
done
bash-3.00$ cvs status
FileToBeDeleted.c
===================================================================
File:
no file FileToBeDeleted.c
Status: Up-to-date
Working
revision: No entry for FileToBeDeleted.c
Repository revision: 1.97
/cvs/FRA1158/TestNativeApplicationProject/Attic/FileToBeDeleted.c,v
bash-3.00$ cvs rtag -r
1.97 DELETED_FILE FileToBeDeleted.c
cvs rtag: cannot find module
`FileToBeDeleted.c' - ignored
bash-3.00$ cvs tag -r 1.97 DELETED_FILE
FileToBeDeleted.c
T FileToBeDeleted.c
I've gotten most of this to work from within Eclipse but having a tough
time retrieving the revision number for the file in the Attic. Here's some
example psuedo code for what I'm currently
trying:
IResource fileToBeDeleted =
...
ResourceTraversal resourcesToBeDeleted = new
ResourceTraversal(new IResource[]{ fileToBeDeleted }
);
ProgressMonitor monitor = new NullProgressMonitor();
// The above is just to give some context, not actually the way I determine
these values
fileToBeDeleted.delete( false, monitor );
CommitWizard.run(..., resourcesToBeDeleted);
Subscriber subscriber =
CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
subscriber.refresh( resourcesToBeDeleted, monitor );
SyncInfo syncinfo = subscriber.getSyncInfo( fileToBeDeleted
);
IResourceVariant remoteResource =
syncinfo.getRemote();
String remoteRevision =
remoteResource.getContentIdentifier();
This code
results in a NPE because the remoteResource is null. Is there a good way
to get the remote resource once it's been deleted? I tried just forcing
the parent to be a directory named Attic, but this didn't
help.
-Brian
Nettleton