[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevplatform/plugins/mercurial
From:       Tom Burdick <tburdi1 () uic ! edu>
Date:       2008-07-10 3:03:19
Message-ID: 1215658999.403979.28636.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 830276 by tburdick:

Further attempts to get the unit test to pass... ending in failure.


 M  +10 -21    hgproxy.cpp  
 M  +3 -0      importmetadatawidget.cpp  
 M  +9 -2      tests/initTest.cpp  


--- trunk/KDE/kdevplatform/plugins/mercurial/hgproxy.cpp #830275:830276
@@ -55,26 +55,14 @@
 //maybe func()const?
 bool HgProxy::isValidDirectory(const KUrl & dirPath)
 {
-    HgJob* job = new HgJob(vcsplugin);
-    if (job)
-    {
-        job->clear();
-        *job << "hg-rev-parse";
-        *job << "--is-inside-work-tree";
-        QString path = dirPath.path();
-        QFileInfo fsObject(path);
-        if (fsObject.isFile())
-            path = fsObject.path();
-        job->setDirectory(path);
-        job->exec();
-        if (job->status() == KDevelop::VcsJob::JobSucceeded)
-        {
-            kDebug(9500) << "Dir:" << path << " is is inside work tree of hg" ;
-            return true;
-        }
-    }
-    kDebug(9500) << "Dir:" << dirPath.path() << " is is not inside work tree of hg" ;
-    return false;
+    QString path = dirPath.path();
+    QFileInfo fsObject(path);
+    if (fsObject.isFile())
+        path = fsObject.path() + QDir::separator() + ".hg";
+    else
+        path = path + QDir::separator() + ".hg";
+    fsObject.setFile(path);
+    return fsObject.exists();
 }
 
 bool HgProxy::prepareJob(HgJob* job, const QString& repository, enum RequestedOperation op)
@@ -144,7 +132,8 @@
 HgJob* HgProxy::init(const KUrl &directory)
 {
     HgJob* job = new HgJob(vcsplugin);
-    if (prepareJob(job, directory.toLocalFile(), HgProxy::Init) ) {
+    kDebug() << "HG HG HG" << directory.toLocalFile();
+    if ( prepareJob(job, directory.toLocalFile(), HgProxy::Init) ) {
         *job << "hg init";
         return job;
     }
--- trunk/KDE/kdevplatform/plugins/mercurial/importmetadatawidget.cpp #830275:830276
@@ -5,6 +5,9 @@
  *   Adapted for Git                                                       *
  *   Copyright 2008 Evgeniy Ivanov <powerfox@kde.ru>                       *
  *                                                                         *
+ *   Adapted for Hg                                                        *
+ *   Copyright 2008 Tom Burdick <thomas.burdick@gmail.com>                 *
+ *                                                                         *
  *   This program is free software; you can redistribute it and/or         *
  *   modify it under the terms of the GNU General Public License as        *
  *   published by the Free Software Foundation; either version 2 of        *
--- trunk/KDE/kdevplatform/plugins/mercurial/tests/initTest.cpp #830275:830276
@@ -29,13 +29,14 @@
 
 #include <QtTest/QtTest>
 #include <KUrl>
+#include <KDebug>
 
 #include <hgjob.h>
 #include <hgproxy.h>
 
 #define HGTEST_DIR1            "kdevHg_testdir"
 #define HGTEST_BASEDIR         "/tmp/kdevHg_testdir/"
-#define HG_REPO                HGTEST_BASEDIR".hg"
+#define HG_REPO                "/tmp/kdevHg_testdir/.hg"
 #define HGTEST_BASEDIR2        "/tmp/kdevHg_testdir2/"
 #define HG_TESTFILE_NAME       "testfile"
 
@@ -65,25 +66,31 @@
 void HgInitTest::cleanupTestCase()
 {
     delete m_proxy;
-
+/*
    if ( QFileInfo(HGTEST_BASEDIR).exists() ) {
        system("rm -rf "HGTEST_BASEDIR);
    }
    if ( QFileInfo(HGTEST_BASEDIR2).exists() ) {
        system("rm -rf "HGTEST_BASEDIR2);
    }
+*/
 }
 
 void HgInitTest::repoInit()
 {
     // make job that creates the local repository
     HgJob* j = m_proxy->init(KUrl(HGTEST_BASEDIR));
+    kDebug() << KUrl(HGTEST_BASEDIR);
     QVERIFY( j );
 
 
     // try to start the job
     QVERIFY( j->exec() );
 
+    while(j->status() == KDevelop::VcsJob::JobRunning)
+    {
+    };
+
     //check if the CVSROOT directory in the new local repository exists now
     QVERIFY( QFileInfo(QString(HG_REPO)).exists() );
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic