[Pkg-bazaar-commits] ./bzr/unstable r120: more check functions
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:51:10 UTC 2009
------------------------------------------------------------
revno: 120
committer: mbp at sourcefrog.net
timestamp: Mon 2005-03-28 23:20:38 +1000
message:
more check functions
modified:
bzrlib/check.py
bzrlib/inventory.py
-------------- next part --------------
=== modified file 'bzrlib/check.py'
--- a/bzrlib/check.py 2005-03-28 11:30:12 +0000
+++ b/bzrlib/check.py 2005-03-28 13:20:38 +0000
@@ -46,45 +46,24 @@
bailout('repeated revision {%s}' % rid)
checked_revs.add(rid)
- #check_inventory()
+ ## TODO: Check all the required fields are present on the revision.
+
+ inv = branch.get_inventory(rev.inventory_id)
+ check_inventory(branch, inv)
mutter('branch %s is OK' % branch.base)
- ## TODO: Check that previous-inventory and previous-manifest
- ## are the same as those stored in the previous changeset.
-
- ## TODO: Check all patches present in patch directory are
- ## mentioned in patch history; having an orphaned patch only gives
- ## a warning.
-
- ## TODO: Check cached data is consistent with data reconstructed
- ## from scratch.
-
- ## TODO: Check no control files are versioned.
-
- ## TODO: Check that the before-hash of each file in a later
- ## revision matches the after-hash in the previous revision to
- ## touch it.
-
-
-def check_inventory():
- mutter("checking inventory file and ids...")
+
+
+def check_inventory(branch, inv):
seen_ids = Set()
seen_names = Set()
-
- for l in controlfile('inventory').readlines():
- parts = l.split()
- if len(parts) != 2:
- bailout("malformed inventory line: " + `l`)
- file_id, name = parts
-
- if file_id in seen_ids:
- bailout("duplicated file id " + file_id)
- seen_ids.add(file_id)
- if name in seen_names:
- bailout("duplicated file name in inventory: " + quotefn(name))
- seen_names.add(name)
+ for path, ie in inv.iter_entries():
+ if path in seen_names:
+ bailout('duplicated path %r in inventory' % path)
+ seen_names.add(path)
+ if ie.kind == 'file':
+ if not ie.text_id in branch.text_store:
+ bailout('text {%s} not in text_store' % ie.text_id)
- if is_control_file(name):
- raise BzrError("control file %s present in inventory" % quotefn(name))
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2005-03-23 03:09:50 +0000
+++ b/bzrlib/inventory.py 2005-03-28 13:20:38 +0000
@@ -17,6 +17,7 @@
"""Inventories map files to their name in a revision."""
+# TODO: Maybe store inventory_id in the file? Not really needed.
__copyright__ = "Copyright (C) 2005 Canonical Ltd."
__author__ = "Martin Pool <mbp at canonical.com>"
More information about the Pkg-bazaar-commits
mailing list