[prev in list] [next in list] [prev in thread] [next in thread]
List: kdevelop-devel
Subject: RE: ClearCase integration with QMake project (patch included, help needed)
From: "Patrick Noffke" <patrickn () adpro ! com ! au>
Date: 2005-09-08 2:57:44
Message-ID: 21E1E750F7A66649A99576799021BBD81572C5 () zulu ! adpro ! com ! au
[Download RAW message or body]
A simpler (but not ideal) fix is to not check for the /view/<view_name>/vobs/ \
heirarchy. The clearcase context menu will then show up for all files as long as the \
project is configured to use ClearCase as the VCS. When running checkin/checkout and \
other ClearCase operations, the command output will be seen in the Messages window. \
If the file is not in a valid location, or the view isn't set correctly, the output \
in the Messages window can be used to indicate this.
I've included this fix in the attached patch. The changes are fairly \
straightforward.
Other comments about this patch:
The patch is against the 3.4 branch, but should be easily applied to later versions. \
I've updated the documentation (vcs/clearcase/README.dox) as well as the source.
Snapshot views should work (I haven't tested this yet).
I've also added a couple of menu options:
History - Lists the history of the selected file (runs: cleartool lshistory).
List Checkouts - Recursively lists checkouts for the directory containing the \
selected file (runs: cleartool lsco -recurse).
Philippe, it sounds like you have a better way to show the versions of the files. If \
so, feel free to chop and change what I've done to fit with your changes.
Could someone PLEASE suggest a good way to run a process and parse it's output in the \
VCS modules? I need this for the purpose of deciding what should be presented on the \
menu. For example, it would be nice to gray out the checkin option if the file is \
not checked out. Or display the option "Create Element" only if the file is not \
already added to clearcase. These options all require running cleartool to determine \
the state of the file.
Regards,
Patrick
-----Original Message-----
From: Philippe Hétroy [mailto:Phil@hetroy.org]
Sent: Wednesday, 7 September 2005 5:50 AM
To: kdevelop-devel@kdevelop.org; Patrick Noffke
Subject: Re: FW: ClearCase integration with QMake project
Hi,
On Tue, Sep 06, 2005 at 08:36:24AM +0930, Patrick Noffke wrote:
> Thank you, that helps. Unfortunately, our directory structure doesn't follow the \
> /view/<view_name>/vobs/<project> heirarchy. I am investigating changing the \
> clearcasepart to use cleartool for determining whether to present the ClearCase \
> context menu.
I am not a kdevelop developer but I worked on integrating clearcase
with kdevelop. Currently I am able to detect a clearcase environment and
even show the version of the files in the project tree browser as CVS ...
I would suggest sending the patch before the end of the week. This gives
me time to clean the code.
There are still other improvements I planned to add but it is not easy to
understand the kdevelop API without any "UML" diagrams, unless I did not
find the ressource on the website.
Philippe
--
Philippe Hétroy, Phil@hetroy.org
["clearcase.patch" (application/octet-stream)]
Index: vcs/clearcase/clearcasepart.h
===================================================================
--- vcs/clearcase/clearcasepart.h (revision 457214)
+++ vcs/clearcase/clearcasepart.h (working copy)
@@ -29,8 +29,9 @@
const QString default_uncheckout;
const QString default_create;
const QString default_remove;
+ const QString default_lshistory;
const QString default_diff;
-// const QString default_log;
+ const QString default_lscheckout;
virtual void createNewProject(const QString& dir) {}
virtual bool fetchFromRepository() { return true; }
@@ -46,11 +47,13 @@
void slotCreate();
void slotRemove();
-// void slotLog();
+ void slotListHistory();
void slotDiff();
void slotDiffFinished( const QString& diff, const QString& err );
+ void slotListCheckouts();
+
private:
QString popupfile;
QString viewname;
Index: vcs/clearcase/README.dox
===================================================================
--- vcs/clearcase/README.dox (revision 457214)
+++ vcs/clearcase/README.dox (working copy)
@@ -14,19 +14,23 @@
-# Clearcase functions appear in the popup menu for an open file just
like cvs or perforce.
-# Functions supported so far are: checkout, checkin, uncheckout, diff,
- mkelem, and rmname (not rmelem).
+ mkelem, rmname (not rmelem), lshistory, and lsco (list checkouts).
-# For mkelem or rmname, you need to make sure that current directory
is checked out or the operation will fail.
- -# No support for snapshot views yet. I haven't worked with them.
+ -# For lshistory, the history is printed to the Messages window.
+ -# For lsco, the checkouts are listed recursively from the directory
+ containing the selected file.
+ -# Snapshot views should work.
-# To checkout a directory, select directory in file selector part and use
popup-menu.
+ -# The Clearcase popup-menu will appear for any file, even if it is not in
+ a VOB. Attempts to perform Clearcase operations on these files will not
+ succeed, and the output can be viewed in the Messages window.
\authors <a href="mailto:ajay_guleria AT yahoo dot com">Ajay Guleria</a>
+\authors <a href="mailto:pnoffke AT bigpond dot com">Patrick Noffke</a>
\feature Integrates Clearcase configuration management system into KDevelop.
\feature Provided a dialog for checkout and checkin comments.
-\feature If selected file is not a clearcase file, "ClearCase" menu does not appear
- in the popup. A filename must start with /view or /vobs to qualify as a
- clearcase filename.
*/
Index: vcs/clearcase/clearcasepart.cpp
===================================================================
--- vcs/clearcase/clearcasepart.cpp (revision 457214)
+++ vcs/clearcase/clearcasepart.cpp (working copy)
@@ -39,8 +39,14 @@
ClearcasePart::ClearcasePart( QObject *parent, const char *name, const QStringList & )
: KDevVersionControl( &data, parent, name ? name : "ClearcasePart" ),
- default_checkin(""),default_checkout(""),default_uncheckout("-rm"),
- default_create("-ci"),default_remove("-f"),default_diff("-pred -diff")
+ default_checkin(""),
+ default_checkout(""),
+ default_uncheckout("-rm"),
+ default_create("-ci"),
+ default_remove("-f"),
+ default_lshistory(""),
+ default_diff("-pred -diff"),
+ default_lscheckout("-recurse")
{
setInstance(ClearcaseFactory::instance());
connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
@@ -60,14 +66,6 @@
// check if this file belongs to a clearcase directory
// i.e. is the file /view/<view_name/vobs/... format?
- QString s1 = popupfile.section('/', 1, 1);
- QString s2 = popupfile.section('/', 2, 2);
- QString s3 = popupfile.section('/', 3, 3);
- if(s1 == "view" && s3 == "vobs" || s1 == "vobs")
- viewname = s2;
- else
- return;
-
QFileInfo fi(popupfile);
popup->insertSeparator();
@@ -86,8 +84,14 @@
sub->insertItem( i18n("Remove Element"),
this, SLOT(slotRemove()) );
sub->insertSeparator();
+ sub->insertItem( i18n("History"),
+ this, SLOT(slotListHistory()) );
+ sub->insertSeparator();
sub->insertItem( i18n("Diff"),
this, SLOT(slotDiff()) );
+ sub->insertSeparator();
+ sub->insertItem( i18n("List Checkouts"),
+ this, SLOT(slotListCheckouts()) );
popup->insertItem(i18n("Clearcase"), sub);
}
@@ -243,7 +247,31 @@
makeFrontend->queueCommand(dir, command);
}
+void ClearcasePart::slotListHistory()
+{
+ QString dir, name;
+ QFileInfo fi(popupfile);
+ if (fi.isDir()) {
+ dir = fi.absFilePath();
+ name = ".";
+ } else {
+ dir = fi.dirPath();
+ name = fi.fileName();
+ }
+ QDomDocument &dom = *this->projectDom();
+
+ QString command("cd ");
+ command += KShellProcess::quote(dir);
+ command += " && cleartool lshistory ";
+ command += DomUtil::readEntry(dom, "/kdevclearcase/lshistory_options", default_lshistory);
+ command += " ";
+ command += KShellProcess::quote(name);
+
+ if (KDevMakeFrontend *makeFrontend = extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir, command);
+}
+
void ClearcasePart::slotDiff()
{
QFileInfo fi(popupfile);
@@ -296,4 +324,25 @@
diffFrontend->showDiff( diff );
}
+void ClearcasePart::slotListCheckouts()
+{
+ QString dir;
+ QFileInfo fi(popupfile);
+ if (fi.isDir()) {
+ dir = fi.absFilePath();
+ } else {
+ dir = fi.dirPath();
+ }
+
+ QDomDocument &dom = *this->projectDom();
+
+ QString command("cd ");
+ command += KShellProcess::quote(dir);
+ command += " && cleartool lsco ";
+ command += DomUtil::readEntry(dom, "/kdevclearcase/lscheckout_options", default_lscheckout);
+
+ if (KDevMakeFrontend *makeFrontend = extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir, command);
+}
+
#include "clearcasepart.moc"
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel@barney.cs.uni-potsdam.de
http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic