Beispiel #1
0
 def _convert_to_prefixed(self):
     from bzrlib.store import TransportStore
     self.bzrdir.transport.delete('branch-format')
     for store_name in ["weaves", "revision-store"]:
         ui.ui_factory.note(gettext("adding prefixes to %s") % store_name)
         store_transport = self.bzrdir.transport.clone(store_name)
         store = TransportStore(store_transport, prefixed=True)
         for urlfilename in store_transport.list_dir('.'):
             filename = urlutils.unescape(urlfilename)
             if (filename.endswith(".weave") or filename.endswith(".gz")
                     or filename.endswith(".sig")):
                 file_id, suffix = os.path.splitext(filename)
             else:
                 file_id = filename
                 suffix = ''
             new_name = store._mapper.map((file_id, )) + suffix
             # FIXME keep track of the dirs made RBC 20060121
             try:
                 store_transport.move(filename, new_name)
             except errors.NoSuchFile:  # catches missing dirs strangely enough
                 store_transport.mkdir(osutils.dirname(new_name))
                 store_transport.move(filename, new_name)
     self.bzrdir.transport.put_bytes('branch-format',
                                     BzrDirFormat6().get_format_string(),
                                     mode=self.bzrdir._get_file_mode())
 def test__relpath_prefixed_suffixed(self):
     my_store = TransportStore(MockTransport(), True)
     my_store.register_suffix('bar')
     my_store.register_suffix('baz')
     self.assertEqual('45/foo.baz', my_store._relpath('foo', ['baz']))
     self.assertEqual('45/foo.bar.baz',
                      my_store._relpath('foo', ['bar', 'baz']))
Beispiel #3
0
 def test_escaped_uppercase(self):
     """Uppercase letters are escaped for safety on Windows"""
     my_store = TransportStore(MemoryTransport(), prefixed=True, escaped=True)
     # a particularly perverse file-id! :-)
     self.assertEquals(my_store._relpath("C:<>"), "be/%2543%253a%253c%253e")
Beispiel #4
0
 def test_relpath_escaped(self):
     my_store = TransportStore(MemoryTransport())
     self.assertEqual("%25", my_store._relpath("%"))
Beispiel #5
0
 def test__relpath_prefixed_suffixed(self):
     my_store = TransportStore(MockTransport(), True)
     my_store.register_suffix("bar")
     my_store.register_suffix("baz")
     self.assertEqual("45/foo.baz", my_store._relpath("foo", ["baz"]))
     self.assertEqual("45/foo.bar.baz", my_store._relpath("foo", ["bar", "baz"]))
Beispiel #6
0
 def test__relpath_prefixed(self):
     my_store = TransportStore(MockTransport(), True)
     self.assertEqual("45/foo", my_store._relpath("foo"))
Beispiel #7
0
 def test__relpath_simple(self):
     my_store = TransportStore(MockTransport())
     self.assertEqual("foo", my_store._relpath("foo"))
 def test_escaped_uppercase(self):
     """Uppercase letters are escaped for safety on Windows"""
     my_store = TransportStore(MemoryTransport(), prefixed=True,
         escaped=True)
     # a particularly perverse file-id! :-)
     self.assertEqual(my_store._relpath('C:<>'), 'be/%2543%253a%253c%253e')
 def test_relpath_escaped(self):
     my_store = TransportStore(MemoryTransport())
     self.assertEqual('%25', my_store._relpath('%'))
 def test__relpath_prefixed(self):
     my_store = TransportStore(MockTransport(), True)
     self.assertEqual('45/foo', my_store._relpath('foo'))
 def test__relpath_simple(self):
     my_store = TransportStore(MockTransport())
     self.assertEqual("foo", my_store._relpath('foo'))
 def test__relpath_unregister_suffixes(self):
     my_store = TransportStore(MockTransport())
     self.assertRaises(ValueError, my_store._relpath, 'foo', ['gz'])
     self.assertRaises(ValueError, my_store._relpath, 'foo', ['dsc', 'gz'])
 def test_register_invalid_suffixes(self):
     my_store = TransportStore(MockTransport())
     self.assertRaises(ValueError, my_store.register_suffix, '/')
     self.assertRaises(ValueError, my_store.register_suffix, '.gz/bar')
 def test__relpath_invalid(self):
     my_store = TransportStore(MockTransport())
     self.assertRaises(ValueError, my_store._relpath, '/foo')
     self.assertRaises(ValueError, my_store._relpath, 'foo/')