~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-02-04 14:30:07 UTC
  • mfrom: (2262.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20070204143007-ee1d0712bf5bccdf
(John Arbash Meinel) Don't create a progress bar for simple knit reading.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1130
1130
        # so - wc -l of a knit index is != the number of unique names
1131
1131
        # in the knit.
1132
1132
        self._history = []
1133
 
        decode_utf8 = cache_utf8.decode
1134
 
        pb = ui.ui_factory.nested_progress_bar()
1135
1133
        try:
1136
 
            pb.update('read knit index', 0, 1)
 
1134
            fp = self._transport.get(self._filename)
1137
1135
            try:
1138
 
                fp = self._transport.get(self._filename)
1139
 
                try:
1140
 
                    # _load_data may raise NoSuchFile if the target knit is
1141
 
                    # completely empty.
1142
 
                    self._load_data(fp)
1143
 
                finally:
1144
 
                    fp.close()
1145
 
            except NoSuchFile:
1146
 
                if mode != 'w' or not create:
1147
 
                    raise
1148
 
                elif delay_create:
1149
 
                    self._need_to_create = True
1150
 
                else:
1151
 
                    self._transport.put_bytes_non_atomic(
1152
 
                        self._filename, self.HEADER, mode=self._file_mode)
1153
 
        finally:
1154
 
            pb.update('read knit index', 1, 1)
1155
 
            pb.finished()
 
1136
                # _load_data may raise NoSuchFile if the target knit is
 
1137
                # completely empty.
 
1138
                self._load_data(fp)
 
1139
            finally:
 
1140
                fp.close()
 
1141
        except NoSuchFile:
 
1142
            if mode != 'w' or not create:
 
1143
                raise
 
1144
            elif delay_create:
 
1145
                self._need_to_create = True
 
1146
            else:
 
1147
                self._transport.put_bytes_non_atomic(
 
1148
                    self._filename, self.HEADER, mode=self._file_mode)
1156
1149
 
1157
1150
    def _load_data(self, fp):
1158
1151
        cache = self._cache