RE: [Issue 128] Add special folder item if folder/subfolder contains modified file
| Newsgroups | gmane.comp.version-control.subversion.rapidsvn.issues |
|---|---|
| Message-ID | <30555177.167561231759119291.JavaMail.httpd@localhost> |
Hi, sorry, bad english, please, review my patch on this issue. If necessary some changes, i'm ready to working. Thanks, Alexey A.
issue128.diff
(application/octet-stream, 2.8 KB)
Index: src/utils.hpp
===================================================================
--- src/utils.hpp (revision 7869)
+++ src/utils.hpp (working copy)
@@ -44,6 +44,7 @@
{
class Status;
class Path;
+ class Context;
}
/**
@@ -332,6 +333,18 @@
*/
wxString
FullNativePath(const svn::Path & target, const wxString & base, bool flat);
+
+/**
+ * Checks that folder on path contents a modified child(s).
+ *
+ * @param path path to folder
+ * @param context pointer to current context
+ *
+ * @return true if folder contents modified child(s),
+ * otherwise false
+ */
+bool
+hasModifiedChilds(const svn::Path & path, svn::Context * context);
#endif
/* -----------------------------------------------------------------
* local variables:
Index: src/filelist_ctrl.cpp
===================================================================
--- src/filelist_ctrl.cpp (revision 7869)
+++ src/filelist_ctrl.cpp (working copy)
@@ -770,7 +770,9 @@
if (IsDir(&status))
{
- if ((textIndex == svn_wc_status_modified) || (propIndex == svn_wc_status_modified))
+ if ((textIndex == svn_wc_status_modified) ||
+ (propIndex == svn_wc_status_modified) ||
+ (hasModifiedChilds(status.path(), Context)))
{
imageIndex = ImageIndexArray[IMG_INDX_MODIFIED_VERSIONED_FOLDER + lock_offset];
}
Index: src/folder_browser.cpp
===================================================================
--- src/folder_browser.cpp (revision 7869)
+++ src/folder_browser.cpp (working copy)
@@ -580,7 +580,8 @@
if ((status.textStatus() == svn_wc_status_modified) ||
- (status.propStatus() == svn_wc_status_modified))
+ (status.propStatus() == svn_wc_status_modified) ||
+ (hasModifiedChilds(status.path(), GetContext())))
{
image = FOLDER_IMAGE_MODIFIED_FOLDER;
open_image = FOLDER_IMAGE_MODIFIED_OPEN_FOLDER;
Index: src/utils.cpp
===================================================================
--- src/utils.cpp (revision 7869)
+++ src/utils.cpp (working copy)
@@ -611,6 +611,34 @@
}
}
}
+
+bool
+hasModifiedChilds( const svn::Path & path, svn::Context * context )
+{
+ svn::Client client(context);
+
+ svn::StatusEntries childs =
+ client.status(path.c_str(),
+ true, // Recursive
+ true, // Get all entries
+ false, // Dont update from repository
+ false); // Use global ignores
+
+ svn::StatusEntries::iterator it2;
+
+ for (it2 = childs.begin(); it2 != childs.end(); it2++)
+ {
+ svn::Status& child_status = *it2;
+
+ if ((child_status.textStatus() == svn_wc_status_modified) ||
+ (child_status.propStatus() == svn_wc_status_modified))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
/* -----------------------------------------------------------------
* local variables:
* eval: (load-file "../rapidsvn-dev.el")