From be6b36be08fb6171843dd4b134e40ae44deef990 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Sat, 1 Sep 2012 14:09:02 +0200 Subject: [PATCH] If path no longer have SCM info, include it in change set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the SCM drivers to not report status for non-modified versioned files. The problem was previously that if a driver didn’t report status for such files, having a file go from modified → clean wouldn’t always cause a refresh, since no change notification was generated for the path. For the svn driver there is a 50% overhead by svn itself in reporting status for files without status, this overhead is likely magnified by the following XML step (where XML for all files in the working copy needs to be parsed). --- Frameworks/scm/src/scm.cc | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Frameworks/scm/src/scm.cc b/Frameworks/scm/src/scm.cc index 1a8f7df7..3c660db9 100644 --- a/Frameworks/scm/src/scm.cc +++ b/Frameworks/scm/src/scm.cc @@ -144,7 +144,7 @@ namespace scm background_status(_wc_path, _driver, _updated, _snapshot, &update_status); } - void info_t::update_status (bool didUpdate, std::string const& path, fs::snapshot_t const& snapshot, scm::status_map_t const& status) + void info_t::update_status (bool didUpdate, std::string const& path, fs::snapshot_t const& snapshot, scm::status_map_t const& newStatus) { if(!didUpdate) return; @@ -152,17 +152,38 @@ namespace scm auto it = cache().find(path); if(it != cache().end()) { - // TODO deleted paths std::set changedPaths; - iterate(pair, status) + + auto const oldStatus = it->second->_file_status; + auto oldStatusIter = oldStatus.begin(); + auto newStatusIter = newStatus.begin(); + + while(oldStatusIter != oldStatus.end() && newStatusIter != newStatus.end()) { - if(it->second->_file_status[pair->first] != pair->second) - changedPaths.insert(pair->first); + if(newStatusIter == newStatus.end() || oldStatusIter->first < newStatusIter->first) + { + changedPaths.insert(oldStatusIter->first); + ++oldStatusIter; + continue; + } + + if(oldStatusIter == oldStatus.end() || newStatusIter->first < oldStatusIter->first) + { + changedPaths.insert(newStatusIter->first); + ++newStatusIter; + continue; + } + + if(oldStatusIter->second != newStatusIter->second) + changedPaths.insert(newStatusIter->first); + + ++oldStatusIter; + ++newStatusIter; } it->second->_updated = oak::date_t::now(); it->second->_snapshot = snapshot; - it->second->_file_status = status; + it->second->_file_status = newStatus; it->second->_callbacks(&callback_t::status_changed, *it->second, changedPaths); }