[GME-commit] GMESRC/GME/XmlBackEnd/SVNCode Client.cpp, 1.3, 1.4 CmdClient.cpp, 1.2, 1.3 CmdClient.h, 1.2, 1.3 HiClient.cpp, 1.3, 1.4 HiClient.h, 1.2, 1.3

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Tue May 20 15:24:11 CDT 2008


Update of /project/gme-repository/GMESRC/GME/XmlBackEnd/SVNCode
In directory escher:/tmp/cvs-serv32605/SVNCode

Modified Files:
	Client.cpp CmdClient.cpp CmdClient.h HiClient.cpp HiClient.h 
Log Message:
Fixing SVN uptodate question.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: CmdClient.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/SVNCode/CmdClient.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CmdClient.h	13 Feb 2008 18:54:57 -0000	1.2
--- CmdClient.h	20 May 2008 20:24:09 -0000	1.3
***************
*** 40,43 ****
--- 40,44 ----
  	bool         info                   ( const std::string& p_url, bool p_recursive, bool p_assembleInfoMsg, std::string& p_resultMsg, std::string& p_author, std::string& p_holder);
  	bool         status                 ( const std::string& p_path, bool p_assembleStatMsg, std::string& p_resultMsg);
+ 	bool         statusOnServer         ( const std::string& p_path, bool p_assembleStatMsg, std::string& p_resultMsg, bool *p_outOfDate);
  	bool         cleanup                ( const std::string& p_path, bool p_assembleStatMsg, std::string& p_resultMsg);
  	bool         resolve                ( const std::string& p_path, bool p_recursive);
***************
*** 67,69 ****
--- 68,71 ----
  	std::string  findLastChangeAuthor   ( const std::string& p_out);
  	std::string  findLockOwner          ( const std::string& p_out);
+ 	bool         isFileOutOfDate        ( const std::string& p_out, const std::string& p_filename);
  };

Index: HiClient.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/SVNCode/HiClient.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** HiClient.cpp	15 Feb 2008 21:06:43 -0000	1.3
--- HiClient.cpp	20 May 2008 20:24:09 -0000	1.4
***************
*** 141,145 ****
  		rv = true;
  
! 		if( p_assembleInfoMessage)
  		{
  			msg = "After issuing 'svn info "; msg += ClientUtil::charstar2str( p_path.c_str(), "Url"); msg += "'";
--- 141,145 ----
  		rv = true;
  
! 		if( 1)
  		{
  			msg = "After issuing 'svn info "; msg += ClientUtil::charstar2str( p_path.c_str(), "Url"); msg += "'";
***************
*** 365,368 ****
--- 365,460 ----
  			p_statMsg = msg;
  		}
+ 	}
+ 	else // vec.empty()
+ 	{
+ 		if( p_assembleStatusMsg)
+ 			p_statMsg = "svn status command failed";
+ 	}
+ 	return rv;
+ }
+ 
+ 
+ bool HiClient::statusOnServer( const std::string& p_path, bool p_assembleStatusMsg, std::string& p_statMsg, bool* p_outOfDate, bool *p_repoEntryModified)
+ {
+ 	log( "statusOnServer", p_path);
+ 
+ 	Pool reqPool;
+ 
+ 	bool        rv = false;
+ 	std::string msg;
+ 
+ 	ClientUtil::StatusExtInfoVec vec;
+ 	vec = sub_extended_status( p_path.c_str(), true /* on_server*/);
+ 	if( !vec.empty())
+ 	{
+ 		rv = true;
+ 
+ 		msg = "Svn status " + p_path + " command resulted in:\n";
+ 		for( ClientUtil::StatusExtInfoVec::iterator it = vec.begin(); it != vec.end(); ++it)
+ 		{
+ 			//const char *                   m_path;
+ 			//svn_wc_status2_t *             m_status;
+ 
+ 			ASSERT( it->m_status);
+ 			if( it->m_status) 
+ 			{
+ 
+ 				bool is_repos_text_status_modified = it->m_status->repos_text_status == svn_wc_status_modified;
+ 				bool is_local_copy_out_of_date     = it->m_status->ood_last_cmt_rev != SVN_INVALID_REVNUM && it->m_status->entry->revision < it->m_status->ood_last_cmt_rev;
+ 
+ 				if( p_outOfDate)               // valid ptr
+ 					*p_outOfDate = is_local_copy_out_of_date;
+ 				if( p_repoEntryModified)       // valid ptr
+ 					*p_repoEntryModified = is_repos_text_status_modified;
+ 
+ 				if( p_assembleStatusMsg)
+ 				{
+ 					if( 1)
+ 					{
+ 						std::string st;
+ 						switch( it->m_status->text_status) {
+ 						//case items copied from enum svn_wc_status_kind, svn_wc.h
+ 						case svn_wc_status_none:        st += "Not exists "; break; /** does not exist */
+ 						case svn_wc_status_unversioned: st += "Unversioned"; break; /** is not a versioned thing in this wc */
+ 						case svn_wc_status_normal:      st += "Normal     "; break; /** exists, but uninteresting */
+ 						case svn_wc_status_added:       st += "Added      "; break; /** is scheduled for addition */
+ 						case svn_wc_status_missing:     st += "Missing    "; break; /** under v.c., but is missing */
+ 						case svn_wc_status_deleted:     st += "Deleted    "; break; /** scheduled for deletion */
+ 						case svn_wc_status_replaced:    st += "Replaced   "; break; /** was deleted and then re-added */
+ 						case svn_wc_status_modified:    st += "Modified   "; break; /** text or props have been modified */
+ 						case svn_wc_status_merged:      st += "Merged     "; break; /** local mods received repos mods */
+ 						case svn_wc_status_conflicted:  st += "Conflicted "; break; /** local mods received conflicting repos mods */
+ 						case svn_wc_status_ignored:     st += "Ignored    "; break; /** is unversioned but configured to be ignored */
+ 						case svn_wc_status_obstructed:  st += "Obstructed "; break; /** an unversioned resource is in the way of the versioned resource */
+ 						case svn_wc_status_external:    st += "External   "; break; /** an unversioned path populated by an svn:externals property */
+ 						case svn_wc_status_incomplete:  st += "Incomplete "; break; /** a directory doesn't contain a complete entries list */
+ 						default:                        st += "Unknown    ";
+ 						};
+ 
+ 						msg.append( st);
+ 					}
+ 
+ 					if( is_local_copy_out_of_date)
+ 						msg.append( " [Local copy out of date]");
+ 
+ 					if( is_repos_text_status_modified)
+ 						msg.append( " [Server copy modified]");
+ 
+ 					msg.append( " ");
+ 					msg.append( ClientUtil::charstar2str( it->m_path, "Path"));
+ 
+ 					if( it->m_status->locked)
+ 						msg.append( " locked");
+ 					if( it->m_status->repos_lock)
+ 						msg.append( std::string( " by ") + ClientUtil::charstar2str( it->m_status->repos_lock->owner, "Owner"));
+ 
+ 					msg.append( "\n");
+ 				}
+ 			}
+ 			else
+ 				msg.append( "Null status");
+ 		}
+ 		if( p_assembleStatusMsg)
+ 			p_statMsg = msg;
  	}
  	else // vec.empty()

Index: Client.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/SVNCode/Client.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Client.cpp	19 Feb 2008 19:20:54 -0000	1.3
--- Client.cpp	20 May 2008 20:24:09 -0000	1.4
***************
*** 989,994 ****
  	else
  	{
! 		// suppress SVN_ERR_RA_ILLEGAL_URL only, if allowed by p_suppressIllegalUrlErrorMsg
! 		if( !p_suppressIllegalUrlErrorMsg || p_suppressIllegalUrlErrorMsg && Err->apr_err != SVN_ERR_RA_ILLEGAL_URL)
  				Util::handleSVNError(Err);
  		return false;
--- 989,995 ----
  	else
  	{
! 		// suppress SVN_ERR_RA_ILLEGAL_URL and SVN_ERR_ENTRY_MISSING_URL only, if allowed by p_suppressIllegalUrlErrorMsg
! 		if( !p_suppressIllegalUrlErrorMsg ||
! 			p_suppressIllegalUrlErrorMsg && Err->apr_err != SVN_ERR_RA_ILLEGAL_URL && Err->apr_err != SVN_ERR_ENTRY_MISSING_URL)
  				Util::handleSVNError(Err);
  		return false;

Index: HiClient.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/SVNCode/HiClient.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HiClient.h	13 Feb 2008 18:54:57 -0000	1.2
--- HiClient.h	20 May 2008 20:24:09 -0000	1.3
***************
*** 25,28 ****
--- 25,29 ----
  	bool info                ( const std::string& p_url,  bool p_recursive, bool p_assembleInfoMsg, std::string& p_infoMsg, std::string& p_author, std::string& p_lockOwner);
  	bool status              ( const std::string& p_path, bool p_assembleStatusMsg, std::string& p_statMsg);
+ 	bool statusOnServer      ( const std::string& p_path, bool p_assembleStatusMsg, std::string& p_statMsg, bool *p_outOfDate, bool *p_repoEntryModified);
  	bool cleanup             ( const std::string& p_path);
  	bool resolve             ( const std::string& p_path, bool p_recursive);

Index: CmdClient.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/SVNCode/CmdClient.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CmdClient.cpp	13 Feb 2008 18:54:57 -0000	1.2
--- CmdClient.cpp	20 May 2008 20:24:09 -0000	1.3
***************
*** 394,397 ****
--- 394,425 ----
  }
  
+ bool CmdClient::statusOnServer( const std::string& p_path, bool p_assembleStatMsg, std::string& p_resultMsg, bool *p_outOfDate)
+ {
+ 	std::string cmd = command( m_cs_status) + " --show-updates " + p_path; // ! compares local copy to the latest version on the server
+ 	redirect( cmd);
+ 
+ 	int r;
+ 	r = execute( cmd.c_str());
+ 	
+ 	std::string  fc;
+ 
+ 	loadContents( m_stdo, fc); // std out file
+ 
+ 	if( p_outOfDate)
+ 		*p_outOfDate = isFileOutOfDate( fc, p_path);           // parse/analyze content
+ 
+ 	if( p_assembleStatMsg)
+ 	{
+ 		p_resultMsg.append( "\nOutput:\n");
+ 		p_resultMsg.append( fc);
+ 
+ 		p_resultMsg.append( "\nError (if any):\n");
+ 		loadContents( m_stde, fc); // std error file
+ 		p_resultMsg.append( fc);
+ 	}
+ 
+ 	return true; // always true, since the stde is captured and shown
+ }
+ 
  bool CmdClient::cleanup( const std::string& p_path, bool p_assembleStatMsg, std::string& p_resultMsg)
  {
***************
*** 654,655 ****
--- 682,706 ----
  }
  
+ bool CmdClient::isFileOutOfDate( const std::string& p_out, const std::string& p_filename) // parser for 'status --show-updates <file>
+ {
+ //possible outcomes of a status -u invokation
+ //F:\t\at\sftest0519>svn status  f18e8ba9d40b1646bfc4812cd1e8f887.xml
+ //
+ //F:\t\at\sftest0519>svn status  f18e8ba9d40b1646bfc4812cd1e8f887.xml
+ //     O *     2294   f18e8ba9d40b1646bfc4812cd1e8f887.xml
+ //Status against revision:   2297
+ //F:\t\at\sftest0519>svn status -u f18e8ba9d40b1646bfc4812cd1e8f887.xml
+ //       *     2294   f18e8ba9d40b1646bfc4812cd1e8f887.xml
+ 	bool res = false;
+ 
+ 	int fname_pos = p_out.find( p_filename);
+ 	if( fname_pos != std::string::npos) // it is the response line for the entry
+ 	{
+ 		int star_pos = p_out.find( '*');
+ 		if( star_pos != std::string::npos // '*' found
+ 		 && star_pos < fname_pos)         // pos of '*' is before the pos of entry
+ 			res = true;
+ 	}
+ 
+ 	return res;
+ }
\ No newline at end of file



More information about the GME-commit mailing list