~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-01 19:18:09 UTC
  • mfrom: (6459 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6460.
  • Revision ID: jelmer@samba.org-20120201191809-xn340a5i5v4fqsfu
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
import re
18
20
import sys
19
21
 
55
57
from bzrlib.repository import (
56
58
    _LazyListJoin,
57
59
    MetaDirRepository,
58
 
    RepositoryFormat,
 
60
    RepositoryFormatMetaDir,
59
61
    RepositoryWriteLockResult,
60
62
    )
61
63
from bzrlib.vf_repository import (
1221
1223
        """
1222
1224
        for pack in packs:
1223
1225
            try:
1224
 
                pack.pack_transport.move(pack.file_name(),
1225
 
                    '../obsolete_packs/' + pack.file_name())
 
1226
                try:
 
1227
                    pack.pack_transport.move(pack.file_name(),
 
1228
                        '../obsolete_packs/' + pack.file_name())
 
1229
                except errors.NoSuchFile:
 
1230
                    # perhaps obsolete_packs was removed? Let's create it and
 
1231
                    # try again
 
1232
                    try:
 
1233
                        pack.pack_transport.mkdir('../obsolete_packs/')
 
1234
                    except errors.FileExists:
 
1235
                        pass
 
1236
                    pack.pack_transport.move(pack.file_name(),
 
1237
                        '../obsolete_packs/' + pack.file_name())
1226
1238
            except (errors.PathError, errors.TransportError), e:
1227
1239
                # TODO: Should these be warnings or mutters?
1228
1240
                mutter("couldn't rename obsolete pack, skipping it:\n%s"
1494
1506
        obsolete_pack_transport = self.transport.clone('obsolete_packs')
1495
1507
        if preserve is None:
1496
1508
            preserve = set()
1497
 
        for filename in obsolete_pack_transport.list_dir('.'):
 
1509
        try:
 
1510
            obsolete_pack_files = obsolete_pack_transport.list_dir('.')
 
1511
        except errors.NoSuchFile:
 
1512
            return found
 
1513
        for filename in obsolete_pack_files:
1498
1514
            name, ext = osutils.splitext(filename)
1499
1515
            if ext == '.pack':
1500
1516
                found.append(name)
1906
1922
                                    than normal. I.e. during 'upgrade'.
1907
1923
        """
1908
1924
        if not _found:
1909
 
            format = RepositoryFormat.find_format(a_bzrdir)
 
1925
            format = RepositoryFormatMetaDir.find_format(a_bzrdir)
1910
1926
        if _override_transport is not None:
1911
1927
            repo_transport = _override_transport
1912
1928
        else: