[Pkg-bazaar-commits] ./bzr/unstable r890: - weave info should show minimal expression of parents
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:21:22 UTC 2009
------------------------------------------------------------
revno: 890
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-07-11 13:55:56 +1000
message:
- weave info should show minimal expression of parents
modified:
bzrlib/weave.py
tools/convertinv.py
-------------- next part --------------
=== modified file 'bzrlib/weave.py'
--- a/bzrlib/weave.py 2005-07-11 03:45:37 +0000
+++ b/bzrlib/weave.py 2005-07-11 03:55:56 +0000
@@ -249,6 +249,29 @@
return i
+ def minimal_parents(self, version):
+ """Find the minimal set of parents for the version."""
+ included = self._v[version]
+ if not included:
+ return []
+
+ li = list(included)
+ li.sort()
+ li.reverse()
+
+ mininc = []
+ gotit = set()
+
+ for pv in li:
+ if pv not in gotit:
+ mininc.append(pv)
+ gotit.update(self._v[pv])
+
+ assert mininc[0] >= 0
+ assert mininc[-1] < version
+ return mininc
+
+
def _addversion(self, parents):
if parents:
self._v.append(frozenset(parents))
@@ -499,7 +522,7 @@
bytes = sum((len(a) for a in text))
sha1 = w._sha1s[i]
print '%6d %6d %8d %40s' % (i, lines, bytes, sha1),
- print ', '.join(map(str, w._v[i]))
+ print ', '.join(map(str, w.minimal_parents(i)))
total += bytes
print >>out, "versions total %d bytes" % total
=== modified file 'tools/convertinv.py'
--- a/tools/convertinv.py 2005-07-11 03:49:54 +0000
+++ b/tools/convertinv.py 2005-07-11 03:55:56 +0000
@@ -43,7 +43,7 @@
pb.update('converting inventory', revno, len(rev_history))
inv_xml = b.inventory_store[rev_id].readlines()
weave_id = wf.add(parents, inv_xml)
- parents.add(weave_id)
+ parents = set([weave_id]) # always just one parent
revno += 1
pb.update('write weave', None, None)
More information about the Pkg-bazaar-commits
mailing list