\r
CGitStatusListCtrl::~CGitStatusListCtrl()\r
{\r
- if (m_pDropTarget)\r
- delete m_pDropTarget;\r
+// if (m_pDropTarget)\r
+// delete m_pDropTarget;\r
ClearStatusArray();\r
}\r
\r
SetCursorPos(pt.x, pt.y);\r
return bRet;\r
#endif \r
+ BuildStatistics();\r
return TRUE;\r
}\r
\r
#endif\r
bool CGitStatusListCtrl::BuildStatistics()\r
{\r
-#if 0\r
+\r
bool bRefetchStatus = false;\r
- FileEntryVector::iterator itFirstUnversionedEntry;\r
- itFirstUnversionedEntry = std::partition(m_arStatusArray.begin(), m_arStatusArray.end(), IsEntryVersioned);\r
- if (m_bUnversionedLast)\r
- {\r
- // We partition the list of items so that it's arrange with all the versioned items first\r
- // then all the unversioned items afterwards.\r
- // Then we sort the versioned part of this, so that we can do quick look-ups in it\r
- std::sort(m_arStatusArray.begin(), itFirstUnversionedEntry, EntryPathCompareNoCase);\r
- // Also sort the unversioned section, to make the list look nice...\r
- std::sort(itFirstUnversionedEntry, m_arStatusArray.end(), EntryPathCompareNoCase);\r
- }\r
\r
// now gather some statistics\r
m_nUnversioned = 0;\r
m_nConflicted = 0;\r
m_nTotal = 0;\r
m_nSelected = 0;\r
+ \r
for (int i=0; i < (int)m_arStatusArray.size(); ++i)\r
{\r
- const FileEntry * entry = m_arStatusArray[i];\r
- if (entry)\r
- {\r
- switch (entry->status)\r
- {\r
- case git_wc_status_normal:\r
- m_nNormal++;\r
- break;\r
- case git_wc_status_added:\r
- m_nAdded++;\r
- break;\r
- case git_wc_status_missing:\r
- case git_wc_status_deleted:\r
- m_nDeleted++;\r
- break;\r
- case git_wc_status_replaced:\r
- case git_wc_status_modified:\r
- case git_wc_status_merged:\r
- m_nModified++;\r
- break;\r
- case git_wc_status_conflicted:\r
- case git_wc_status_obstructed:\r
- m_nConflicted++;\r
- break;\r
- case git_wc_status_ignored:\r
- m_nUnversioned++;\r
- break;\r
- default:\r
-#if 0\r
- {\r
- if (GitStatus::IsImportant(entry->remotestatus))\r
- break;\r
- m_nUnversioned++;\r
- // If an entry is in an unversioned folder, we don't have to do an expensive array search\r
- // to find out if it got case-renamed: an unversioned folder can't have versioned files\r
- // But nested folders are also considered to be in unversioned folders, we have to do the\r
- // check in that case too, otherwise we would miss case-renamed folders - they show up\r
- // as nested folders.\r
- if (((!entry->inunversionedfolder)||(entry->isNested))&&(m_bUnversionedLast))\r
- {\r
- // check if the unversioned item is just\r
- // a file differing in case but still versioned\r
- FileEntryVector::iterator itMatchingItem;\r
- if(std::binary_search(m_arStatusArray.begin(), itFirstUnversionedEntry, entry, EntryPathCompareNoCase))\r
- {\r
- // We've confirmed that there *is* a matching file\r
- // Find its exact location\r
- FileEntryVector::iterator itMatchingItem;\r
- itMatchingItem = std::lower_bound(m_arStatusArray.begin(), itFirstUnversionedEntry, entry, EntryPathCompareNoCase);\r
+ int status=((CTGitPath*)m_arStatusArray[i])->m_Action;\r
+\r
+ if(status&CTGitPath::LOGACTIONS_ADDED)\r
+ m_nAdded++;\r
+ \r
+ if(status&CTGitPath::LOGACTIONS_DELETED)\r
+ m_nDeleted++;\r
+ \r
+ if(status&(CTGitPath::LOGACTIONS_REPLACED|CTGitPath::LOGACTIONS_MODIFIED))\r
+ m_nModified++;\r
+ \r
+ if(status&CTGitPath::LOGACTIONS_CONFLICT)\r
+ m_nConflicted++;\r
+ \r
+ if(status&(CTGitPath::LOGACTIONS_IGNORE|CTGitPath::LOGACTIONS_UNVER))\r
+ m_nUnversioned++;\r
+ \r
+ \r
\r
- // adjust the case of the filename\r
- if (MoveFileEx(entry->path.GetWinPath(), (*itMatchingItem)->path.GetWinPath(), MOVEFILE_REPLACE_EXISTING))\r
- {\r
- // We successfully adjusted the case in the filename. But there is now a file with status 'missing'\r
- // in the array, because that's the status of the file before we adjusted the case.\r
- // We have to refetch the status of that file.\r
- // Since fetching the status of single files/directories is very expensive and there can be\r
- // multiple case-renames here, we just set a flag and refetch the status at the end from scratch.\r
- bRefetchStatus = true;\r
- DeleteItem(i);\r
- m_arStatusArray.erase(m_arStatusArray.begin()+i);\r
- delete entry;\r
- i--;\r
- m_nUnversioned--;\r
- // now that we removed an unversioned item from the array, find the first unversioned item in the 'new'\r
- // list again.\r
- itFirstUnversionedEntry = std::partition(m_arStatusArray.begin(), m_arStatusArray.end(), IsEntryVersioned);\r
- }\r
- break;\r
- }\r
- }\r
- }\r
-#endif\r
- break;\r
- } // switch (entry->status)\r
- } // if (entry)\r
+// } // switch (entry->status)\r
+// } // if (entry)\r
} // for (int i=0; i < (int)m_arStatusArray.size(); ++i)\r
return !bRefetchStatus;\r
-#endif \r
+\r
return FALSE;\r
}\r
\r