/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to processors/generic_processor.py

more progress reporting tweaks

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    inventory,
27
27
    lru_cache,
28
28
    osutils,
 
29
    progress,
29
30
    revision,
30
31
    revisiontree,
31
32
    )
71
72
    known_params = ['info']
72
73
 
73
74
    def pre_process(self):
 
75
        self._start_time = time.time()
 
76
 
74
77
        # Load the info file, if any
75
78
        info_path = self.params.get('info')
76
79
        if info_path is not None:
145
148
                self.cache_mgr.revision_ids[":" + cmd.mark] = rev_id
146
149
            self.cache_mgr.last_revision_ids[self.active_branch] = rev_id
147
150
            self._revision_count += 1
148
 
            self.report_progress("(%s)" % cmd.mark)
 
151
            self.report_progress("(:%s)" % cmd.mark)
149
152
        except:
150
153
            self.repo.abort_write_group()
151
154
            raise
153
156
            self.repo.commit_write_group()
154
157
 
155
158
    def report_progress(self, details=''):
156
 
        #if self._revision_count % 10 != 0:
157
 
        #    return
158
159
        # TODO: use a progress bar with ETA enabled
159
 
        if self.total_commits is not None:
160
 
            counts = "%d/%d" % (self._revision_count, self.total_commits)
161
 
        else:
162
 
            counts = "%d" % (self._revision_count,)
163
 
        note("%s %s commits loaded %s" % (self._time_of_day(), counts,
164
 
            details))
 
160
        if self.verbose or self._revision_count % 10 == 0:
 
161
            if self.total_commits is not None:
 
162
                counts = "%d/%d" % (self._revision_count, self.total_commits)
 
163
                eta = progress.get_eta(self._start_time, self._revision_count,
 
164
                    self.total_commits)
 
165
                eta_str = '[%s] ' % progress.str_tdelta(eta)
 
166
            else:
 
167
                counts = "%d" % (self._revision_count,)
 
168
                eta_str = ''
 
169
            note("%s %s commits loaded %s%s" % (self._time_of_day(),
 
170
                counts, eta_str, details))
165
171
 
166
172
    def progress_handler(self, cmd):
167
173
        """Process a ProgressCommand."""