Commit 5bf75c18 authored by Tim Peters's avatar Tim Peters

Made the "is this tid interesting?" logic more robust.

parent 39ceb14e
...@@ -81,6 +81,7 @@ class Tracer(object): ...@@ -81,6 +81,7 @@ class Tracer(object):
def _msg(self, oid, tid, *args): def _msg(self, oid, tid, *args):
args = map(str, args) args = map(str, args)
self.msgs.append( (oid, tid, ' '.join(args)) ) self.msgs.append( (oid, tid, ' '.join(args)) )
self._produced_msg = True
def report(self): def report(self):
"""Show all msgs, grouped by oid and sub-grouped by tid.""" """Show all msgs, grouped by oid and sub-grouped by tid."""
...@@ -130,20 +131,18 @@ class Tracer(object): ...@@ -130,20 +131,18 @@ class Tracer(object):
def _check_trec(self, txn): def _check_trec(self, txn):
# txn has members tid, status, user, description, # txn has members tid, status, user, description,
# _extension, _pos, _tend, _file, _tpos # _extension, _pos, _tend, _file, _tpos
interesting = False self._produced_msg = False
for drec in txn: for drec in txn:
if self._check_drec(drec): self._check_drec(drec)
interesting = True if self._produced_msg:
if interesting: # Copy txn info for later output.
self.tid2info[txn.tid] = (txn.status, txn.user, txn.description, self.tid2info[txn.tid] = (txn.status, txn.user, txn.description,
txn._tpos) txn._tpos)
# Process next data record. Return true iff a message is produced (so # Process next data record. If a message is produced, self._produced_msg
# the caller can know whether to save information about the tid the # will be set True.
# data record belongs to).
def _check_drec(self, drec): def _check_drec(self, drec):
# drec has members oid, tid, version, data, data_txn # drec has members oid, tid, version, data, data_txn
result = False
tid, oid, pick, pos = drec.tid, drec.oid, drec.data, drec.pos tid, oid, pick, pos = drec.tid, drec.oid, drec.data, drec.pos
if pick: if pick:
oidclass = None oidclass = None
...@@ -151,7 +150,6 @@ class Tracer(object): ...@@ -151,7 +150,6 @@ class Tracer(object):
oidclass = get_class(pick) oidclass = get_class(pick)
self._msg(oid, tid, "new revision", oidclass, self._msg(oid, tid, "new revision", oidclass,
"at", drec.pos) "at", drec.pos)
result = True
self.oids[oid] += 1 self.oids[oid] += 1
self.oid2name[oid] = oidclass self.oid2name[oid] = oidclass
...@@ -166,16 +164,11 @@ class Tracer(object): ...@@ -166,16 +164,11 @@ class Tracer(object):
oidclass = get_class(pick) oidclass = get_class(pick)
self._msg(ref, tid, "referenced by", oid_repr(oid), self._msg(ref, tid, "referenced by", oid_repr(oid),
oidclass, "at", pos) oidclass, "at", pos)
result = True
if oid in self.oids: if oid in self.oids:
self._msg(oid, tid, "references", oid_repr(ref), klass, self._msg(oid, tid, "references", oid_repr(ref), klass,
"at", pos) "at", pos)
result = True
elif oid in self.oids: elif oid in self.oids:
# Or maybe it's a version abort. # Or maybe it's a version abort.
self._msg(oid, tid, "creation undo at", pos) self._msg(oid, tid, "creation undo at", pos)
result = True
return result
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment