~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: John Arbash Meinel
  • Date: 2006-11-24 18:35:55 UTC
  • mto: This revision was merged to the branch mainline in revision 2150.
  • Revision ID: john@arbash-meinel.com-20061124183555-u05ssr07pzt61b0b
Simplify the knit max-chain detection code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
334
334
        Return True if we should create a new delta, False if we should use a
335
335
        full text.
336
336
        """
337
 
        count = 0
338
337
        delta_size = 0
339
338
        fulltext_size = None
340
339
        delta_parents = first_parents
341
 
        while count < self._max_delta_chain:
 
340
        for count in xrange(self._max_delta_chain):
342
341
            parent = delta_parents[0]
343
342
            method = self._index.get_method(parent)
344
343
            pos, size = self._index.get_position(parent)
347
346
                break
348
347
            delta_size += size
349
348
            delta_parents = self._index.get_parents(parent)
350
 
            count = count + 1
351
 
 
352
 
        if method == 'line-delta' or fulltext_size < delta_size:
 
349
        else:
 
350
            # We couldn't find a fulltext, so we must create a new one
353
351
            return False
354
 
        return True
 
352
 
 
353
        return fulltext_size > delta_size
355
354
 
356
355
    def _add_delta(self, version_id, parents, delta_parent, sha1, noeol, delta):
357
356
        """See VersionedFile._add_delta()."""