Changeset 69ba8d0380eb…
Parent be84c28c135b…
by
Changes to 2 files · Browse files at 69ba8d0380eb Showing diff from parent be84c28c135b Diff from another changeset...
@@ -53,12 +53,11 @@ switch (this->state)
{
case 'n':
- if (this->mtime == (unsigned)stat.mtime
- && this->size == (unsigned)stat.size
- )
- return 'C';
- else
- return 'M';
+ if (this->size != (unsigned)stat.size)
+ return 'M'; // modified
+ if (this->mtime == (unsigned)stat.mtime)
+ return 'C'; // clean
+ return 'P'; // must peek into file contents
case 'm':
return 'M';
case 'r':
|
@@ -219,6 +219,8 @@ if (!outdated && last.path == path)
{
outStatus = last.status;
+ if (outStatus == 'P')
+ outStatus = 'M';
return 1;
}
@@ -319,10 +321,15 @@
outStatus = e->status(stat);
- if (outStatus == 'M' && pdirsta)
+ if (unset)
+ goto exit;
+
+ bool update = false;
+
+ if (outStatus == 'M')
{
std::string relbase;
- if (get_relpath(cur.hgroot, cur.basedir, relbase))
+ if (pdirsta && get_relpath(cur.hgroot, cur.basedir, relbase))
{
TDEBUG_TRACE(dp << "relbase = '" << relbase << "'");
@@ -330,21 +337,35 @@ TDEBUG_TRACE(dp << "basedir_status = " << basedir_status);
if (basedir_status != 'M')
- {
- if (unset)
- {
- TDEBUG_TRACE(dp << "omitting Thgstatus::update");
- }
- else
- {
- TDEBUG_TRACE(dp << "calling Thgstatus::update");
- Thgstatus::update(cur.hgroot);
- }
- }
+ update = true;
+ }
+ }
+ else if (outStatus == 'P')
+ {
+ static unsigned lasttickcount;
+
+ const unsigned tc = ::GetTickCount();
+ const bool outdated = tc - lasttickcount > 6000;
+
+ if (outdated) // protect against endless update loops
+ {
+ update = true;
+ lasttickcount = tc;
}
+
+ TDEBUG_TRACE(dp << "outStatus is 'P'");
}
+ if (update)
+ {
+ TDEBUG_TRACE(dp << "calling Thgstatus::update");
+ Thgstatus::update(path);
+ }
+
+ exit:
cur.status = outStatus;
+ if (outStatus == 'P')
+ outStatus = 'M';
cur.tickcount = ::GetTickCount();
last = cur;
return 1;
|
Loading...