~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Martin Pool
  • Date: 2005-08-25 07:46:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050825074611-98130ea6d05d9d2a
- add functions to enable and disable default logging, so that we can
  turn it off while running the tests

- default logging gets turned on from the bzr main function so that
  other applications using the library can make their own decisions

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
import tempfile, os, errno
19
 
                
20
18
import bzrlib.errors
21
19
import bzrlib.progress
22
 
from bzrlib.xml import serializer_v4
23
20
 
24
21
 
25
22
def upgrade(branch):
42
39
 
43
40
    branch.lock_write()
44
41
 
45
 
    pb = bzrlib.ui.ui_factory.progress_bar()
 
42
    pb = bzrlib.ui.progress_bar()
46
43
 
47
44
    try:
48
45
        last_rev_id = None
99
96
                # revision entry. I'm not supremely happy about it, but
100
97
                # there should be *some* way of making old entries have
101
98
                # the full meta information.
 
99
                import tempfile, os, errno
 
100
                from bzrlib.xml import pack_xml
 
101
                
102
102
                rev_tmp = tempfile.TemporaryFile()
103
 
                serializer_v4.write_revision(rev, rev_tmp)
 
103
                pack_xml(rev, rev_tmp)
104
104
                rev_tmp.seek(0)
105
105
 
106
106
                tmpfd, tmp_path = tempfile.mkstemp(prefix=rev_id, suffix='.gz',