~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/multiparent.py

  • Committer: Vincent Ladeuil
  • Date: 2013-05-25 17:12:43 UTC
  • mto: (6437.77.1 2.5)
  • mto: This revision was merged to the branch mainline in revision 6577.
  • Revision ID: v.ladeuil+lp@free.fr-20130525171243-au0073fnspecl3kg
Empty arguments in EDITOR are now properly preserved

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2011 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
from bzrlib.lazy_import import lazy_import
18
20
 
19
21
lazy_import(globals(), """
20
22
import errno
 
23
import gzip
21
24
import itertools
22
25
import os
23
26
from StringIO import StringIO
24
27
 
25
28
from bzrlib import (
 
29
    bencode,
26
30
    errors,
27
31
    patiencediff,
28
 
    trace,
29
32
    ui,
30
33
    )
31
 
from bzrlib import bencode
32
34
""")
33
 
from bzrlib.tuned_gzip import GzipFile
34
35
 
35
36
 
36
37
def topo_iter_keys(vf, keys=None):
422
423
                            if not (lines == self.get_line_list([revision])[0]):
423
424
                                raise AssertionError()
424
425
                            self.clear_cache()
425
 
                    pb.update('Importing revisions',
 
426
                    pb.update(gettext('Importing revisions'),
426
427
                              (total - len(revisions)) + len(added), total)
427
428
                revisions = [r for r in revisions if r not in added]
428
429
        finally:
561
562
            sio = StringIO(infile.read(count))
562
563
        finally:
563
564
            infile.close()
564
 
        zip_file = GzipFile(None, mode='rb', fileobj=sio)
 
565
        zip_file = gzip.GzipFile(None, mode='rb', fileobj=sio)
565
566
        try:
566
567
            file_version_id = zip_file.readline()
567
 
            return MultiParent.from_patch(zip_file.read())
 
568
            content = zip_file.read()
 
569
            return MultiParent.from_patch(content)
568
570
        finally:
569
571
            zip_file.close()
570
572
 
576
578
                                    # before any write returns 0
577
579
            start = outfile.tell()
578
580
            try:
579
 
                zipfile = GzipFile(None, mode='ab', fileobj=outfile)
 
581
                zipfile = gzip.GzipFile(None, mode='ab', fileobj=outfile)
580
582
                zipfile.writelines(itertools.chain(
581
583
                    ['version %s\n' % version_id], diff.to_patch()))
582
584
            finally:
673
675
 
674
676
def gzip_string(lines):
675
677
    sio = StringIO()
676
 
    data_file = GzipFile(None, mode='wb', fileobj=sio)
 
678
    data_file = gzip.GzipFile(None, mode='wb', fileobj=sio)
677
679
    data_file.writelines(lines)
678
680
    data_file.close()
679
681
    return sio.getvalue()