~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/read_bundle.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
"""\
3
 
Read in a bundle stream, and process it into a BundleReader object.
4
 
"""
 
1
# Copyright (C) 2006 by Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
"""Read in a bundle stream, and process it into a BundleReader object."""
5
18
 
6
19
import base64
7
20
from cStringIO import StringIO
8
21
import os
9
22
import pprint
10
23
 
 
24
from bzrlib.bundle.common import get_header, header_str
 
25
import bzrlib.errors
11
26
from bzrlib.errors import (TestamentMismatch, BzrError, 
12
 
                           MalformedHeader, MalformedPatches)
13
 
from bzrlib.bundle.common import get_header, header_str
 
27
                           MalformedHeader, MalformedPatches, NotABundle)
14
28
from bzrlib.inventory import (Inventory, InventoryEntry,
15
29
                              InventoryDirectory, InventoryFile,
16
30
                              InventoryLink)
17
 
from bzrlib.osutils import sha_file, sha_string
 
31
from bzrlib.osutils import sha_file, sha_string, pathjoin
18
32
from bzrlib.revision import Revision, NULL_REVISION
19
33
from bzrlib.testament import StrictTestament
20
34
from bzrlib.trace import mutter, warning
 
35
import bzrlib.transport
21
36
from bzrlib.tree import Tree
 
37
import bzrlib.urlutils
22
38
from bzrlib.xml5 import serializer_v5
23
39
 
24
40
 
360
376
                                ' a header, but did not match')
361
377
                    header.pop(0)
362
378
        else:
363
 
            raise MalformedHeader('Did not find an opening header')
 
379
            raise NotABundle('Did not find an opening header')
364
380
 
365
381
    def _read_revision_header(self):
366
382
        self.info.revisions.append(RevisionInfo(None))
702
718
            if old_dir is None:
703
719
                old_path = None
704
720
            else:
705
 
                old_path = os.path.join(old_dir, basename)
 
721
                old_path = pathjoin(old_dir, basename)
706
722
        else:
707
723
            old_path = new_path
708
724
        #If the new path wasn't in renamed, the old one shouldn't be in
727
743
            if new_dir is None:
728
744
                new_path = None
729
745
            else:
730
 
                new_path = os.path.join(new_dir, basename)
 
746
                new_path = pathjoin(new_dir, basename)
731
747
        else:
732
748
            new_path = old_path
733
749
        #If the old path wasn't in renamed, the new one shouldn't be in