~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Martin Pool
  • Date: 2005-07-11 03:55:56 UTC
  • Revision ID: mbp@sourcefrog.net-20050711035556-77a5990cec5699c1
- weave info should show minimal expression of parents

Show diffs side-by-side

added added

removed removed

Lines of Context:
249
249
        return i
250
250
 
251
251
 
 
252
    def minimal_parents(self, version):
 
253
        """Find the minimal set of parents for the version."""
 
254
        included = self._v[version]
 
255
        if not included:
 
256
            return []
 
257
        
 
258
        li = list(included)
 
259
        li.sort()
 
260
        li.reverse()
 
261
 
 
262
        mininc = []
 
263
        gotit = set()
 
264
 
 
265
        for pv in li:
 
266
            if pv not in gotit:
 
267
                mininc.append(pv)
 
268
                gotit.update(self._v[pv])
 
269
 
 
270
        assert mininc[0] >= 0
 
271
        assert mininc[-1] < version
 
272
        return mininc
 
273
 
 
274
 
252
275
    def _addversion(self, parents):
253
276
        if parents:
254
277
            self._v.append(frozenset(parents))
499
522
        bytes = sum((len(a) for a in text))
500
523
        sha1 = w._sha1s[i]
501
524
        print '%6d %6d %8d %40s' % (i, lines, bytes, sha1),
502
 
        print ', '.join(map(str, w._v[i]))
 
525
        print ', '.join(map(str, w.minimal_parents(i)))
503
526
        total += bytes
504
527
 
505
528
    print >>out, "versions total %d bytes" % total