~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: John Arbash Meinel
  • Date: 2011-04-20 15:06:17 UTC
  • mto: This revision was merged to the branch mainline in revision 5836.
  • Revision ID: john@arbash-meinel.com-20110420150617-i41caxgemg32tq1r
Start adding tests that _worth_saving_limit works as expected.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2263
2263
        """The number of parent entries in each record row."""
2264
2264
        return len(self._parents) - len(self._ghosts)
2265
2265
 
2266
 
    @staticmethod
2267
 
    def on_file(path, sha1_provider=None, worth_saving_limit=0):
 
2266
    @classmethod
 
2267
    def on_file(cls, path, sha1_provider=None, worth_saving_limit=0):
2268
2268
        """Construct a DirState on the file at path "path".
2269
2269
 
2270
2270
        :param path: The path at which the dirstate file on disk should live.
2277
2277
        """
2278
2278
        if sha1_provider is None:
2279
2279
            sha1_provider = DefaultSHA1Provider()
2280
 
        result = DirState(path, sha1_provider,
2281
 
                          worth_saving_limit=worth_saving_limit)
 
2280
        result = cls(path, sha1_provider,
 
2281
                     worth_saving_limit=worth_saving_limit)
2282
2282
        return result
2283
2283
 
2284
2284
    def _read_dirblocks_if_needed(self):
2424
2424
            # number of changes, keeping the calculation time
2425
2425
            # as low overhead as possible. (This also keeps all existing
2426
2426
            # tests passing as the default is 0, i.e. always save.)
2427
 
            if len(self._known_hash_changes) > self._worth_saving_limit:
 
2427
            if len(self._known_hash_changes) >= self._worth_saving_limit:
2428
2428
                return True
2429
2429
        return False
2430
2430