Changeset 20b0a02116a6…
Parent 422e9c472bbb…
by
Changes to 3 files · Browse files at 20b0a02116a6 Showing diff from parent 422e9c472bbb Diff from another changeset...
@@ -60,8 +60,12 @@ {
std::string path = WideToMultibyte(pwszPath);
+ char filterStatus = 0;
+ if (myTortoiseClass == TORTOISE_OLE_ADDED)
+ filterStatus = 'A';
+
char status = 0;
- if (!HgQueryDirstate(path, status))
+ if (!HgQueryDirstate(path, filterStatus, status))
return S_FALSE;
if (myTortoiseClass == TORTOISE_OLE_ADDED && status == 'A')
|
@@ -98,6 +98,8 @@ typedef std::deque<direntry> EntriesT;
EntriesT entries;
+
+ unsigned num_added_; // number of entries that have state 'a'
public:
typedef EntriesT::size_type size_type;
@@ -113,8 +115,12 @@ Iter begin() const { return entries.begin(); }
Iter end() const { return entries.end(); }
size_type size() const { return entries.size(); }
+
+ unsigned num_added() const { return num_added_; }
private:
+ dirstate(): num_added_(0) {}
+
static uint32_t ntohl(uint32_t x)
{
return ((x & 0x000000ffUL) << 24) |
@@ -161,6 +167,9 @@
e.name = &temp[0];
+ if (e.state == 'a')
+ ++pd->num_added_;
+
pd->add(e);
}
@@ -321,7 +330,8 @@}
-int HgQueryDirstate(const std::string& path, char& outStatus)
+int HgQueryDirstate(
+ const std::string& path, const char& filterStatus, char& outStatus)
{
struct _stat stat;
if (0 != lstat(path.c_str(), stat))
@@ -355,6 +365,9 @@ return 0;
}
+ if (filterStatus == 'A' && pd->num_added() == 0)
+ return 0;
+
for (size_t i = 0; i < relpath.size(); ++i)
{
if (relpath[i] == '\\')
|
@@ -3,6 +3,7 @@
#include <string>
-int HgQueryDirstate(const std::string& path, char& outStatus);
+int HgQueryDirstate(
+ const std::string& path, const char& filterStatus, char& outStatus);
#endif
|
Loading...