~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/serializer/v08.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
19
19
 
20
20
import os
21
21
 
22
 
from bzrlib import errors
 
22
from bzrlib import (
 
23
    errors,
 
24
    ui,
 
25
    )
23
26
from bzrlib.bundle.serializer import (BundleSerializer,
24
27
                                      _get_bundle_header,
25
28
                                     )
27
30
from bzrlib.bundle.bundle_data import (RevisionInfo, BundleInfo, BundleTree)
28
31
from bzrlib.diff import internal_diff
29
32
from bzrlib.osutils import pathjoin
30
 
from bzrlib.progress import DummyProgress
31
33
from bzrlib.revision import NULL_REVISION
32
 
import bzrlib.ui
33
34
from bzrlib.testament import StrictTestament
34
35
from bzrlib.timestamp import (
35
36
    format_highres_date,
119
120
        source.lock_read()
120
121
        try:
121
122
            self._write_main_header()
122
 
            pb = DummyProgress()
 
123
            pb = ui.ui_factory.nested_progress_bar()
123
124
            try:
124
125
                self._write_revisions(pb)
125
126
            finally:
126
 
                pass
127
 
                #pb.finished()
 
127
                pb.finished()
128
128
        finally:
129
129
            source.unlock()
130
130
 
183
183
 
184
184
        i_max = len(self.revision_ids)
185
185
        for i, rev_id in enumerate(self.revision_ids):
186
 
            pb.update("Generating revsion data", i, i_max)
 
186
            pb.update("Generating revision data", i, i_max)
187
187
            rev = self.source.get_revision(rev_id)
188
188
            if rev_id == last_rev_id:
189
189
                rev_tree = last_rev_tree