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

List:       kde-commits
Subject:    KDE/kdesdk/kioslave/svn/ksvnd
From:       Mickael Marchand <marchand () kde ! org>
Date:       2005-05-05 21:46:18
Message-ID: 1115329578.185739.20205.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 409878 by marchand:

add some new helpers to check repository contents



 M  +51 -4     trunk/KDE/kdesdk/kioslave/svn/ksvnd/ksvnd.cpp  
 M  +5 -0      trunk/KDE/kdesdk/kioslave/svn/ksvnd/ksvnd.h  


--- trunk/KDE/kdesdk/kioslave/svn/ksvnd/ksvnd.cpp #409877:409878
@@ -53,6 +53,54 @@
 		return QString::null;
 }
 
+<<<<<<< .mine
+bool KSvnd::AreAnyFilesInSvn( const KURL::List& wclist ) {
+	for ( QValueListConstIterator<KURL> it = wclist.begin(); it != wclist.end() ; ++it \
) { +		if ( isFileInSvnEntries( ( *it ).fileName(), ( *it ).directory() + \
"/.svn/entries" ) ) +			return true;
+	}
+	return false;
+}
+
+bool KSvnd::AreAnyFilesNotInSvn( const KURL::List& wclist ) {
+	for ( QValueListConstIterator<KURL> it = wclist.begin(); it != wclist.end() ; ++it \
) { +		if ( !isFileInSvnEntries( ( *it ).fileName(), ( *it ).directory() + \
"/.svn/entries" ) ) +			return true;
+	}
+	return false;
+}
+
+bool KSvnd::AreAllFilesInSvn( const KURL::List& wclist ) {
+	for ( QValueListConstIterator<KURL> it = wclist.begin(); it != wclist.end() ; ++it \
) { +		if ( !isFileInSvnEntries( ( *it ).fileName(), ( *it ).directory() + \
"/.svn/entries" ) ) +			return false;
+	}
+	return true;
+}
+
+bool KSvnd::AreAllFilesNotInSvn( const KURL::List& wclist ) {
+	for ( QValueListConstIterator<KURL> it = wclist.begin(); it != wclist.end() ; ++it \
) { +		if ( isFileInSvnEntries( ( *it ).fileName(), ( *it ).directory() + \
"/.svn/entries" ) ) +			return false;
+	}
+	return true;
+}
+
+bool KSvnd::isFileInSvnEntries ( const QString filename, const QString entfile ) {
+	QFile file( entfile );
+	if ( file.open( IO_ReadOnly ) ) {
+		QTextStream stream( &file );
+		QString line;
+		while ( !stream.atEnd() ) {
+			line = stream.readLine().simplifyWhiteSpace();
+			if ( line == "name=\""+ filename + "\"" )
+				return true;
+		}
+		file.close();
+	}
+	return false;
+}
+
 bool KSvnd::anyNotValidWorkingCopy( const KURL::List& wclist ) {
 	bool result = true; //one negative match is enough
 	for ( QValueListConstIterator<KURL> it = wclist.begin(); it != wclist.end() ; ++it \
) { @@ -71,20 +119,19 @@
 }
 
 bool KSvnd::anyValidWorkingCopy( const KURL::List& wclist ) {
-	bool result = false; //one match is enough to run subversion on it
 	for ( QValueListConstIterator<KURL> it = wclist.begin(); it != wclist.end() ; ++it \
) {  //if is a directory check whether it contains a .svn/entries file
 		QDir dir( ( *it ).path() );
 		if ( dir.exists() ) { //it's a dir
 			if ( QFile::exists( ( *it ).path() + "/.svn/entries" ) )
-				result = true;
+				return true;
 		}
 
 		//else check if ./.svn/entries exists
 		if ( QFile::exists( ( *it ).directory() + "/.svn/entries" ) )
-			result = true;
+			return true;
 	}
-	return result;
+	return false;
 }
 
 #if 0
--- trunk/KDE/kdesdk/kioslave/svn/ksvnd/ksvnd.h #409877:409878
@@ -38,6 +38,10 @@
   QString commitDialog(QString);
   bool anyNotValidWorkingCopy( const KURL::List& wclist );
   bool anyValidWorkingCopy( const KURL::List& wclist );
+  bool AreAnyFilesNotInSvn( const KURL::List& wclist );
+  bool AreAnyFilesInSvn( const KURL::List& wclist );
+  bool AreAllFilesNotInSvn( const KURL::List& wclist );
+  bool AreAllFilesInSvn( const KURL::List& wclist );
 //  void notify(const QString&, int ,int, const QString& , int , int, long int, \
const QString&);  //  void status(const QString& path, int text_status, int \
prop_status, int repos_text_status, int repos_prop_status ,long int rev);  //  void \
popupMessage( const QString& message ); @@ -50,6 +54,7 @@
 public slots:
 
 protected:
+  bool isFileInSvnEntries ( const QString filename, const QString entfile );
 };
 
 #endif


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

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