Rev 2596: Create a GraphIndexBuilder. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Thu Jul 12 14:17:43 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 2596
revision-id: robertc at robertcollins.net-20070712131738-ns8lo0xowgwvf2wo
parent: robertc at robertcollins.net-20070712130616-7c8rum60e382krml
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2007-07-12 23:17:38 +1000
message:
  Create a GraphIndexBuilder.
added:
  bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
  bzrlib/tests/test_index.py     test_index.py-20070712131115-lolkarso50vjr64s-2
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
=== added file 'bzrlib/index.py'
--- a/bzrlib/index.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/index.py	2007-07-12 13:17:38 +0000
@@ -0,0 +1,29 @@
+# Copyright (C) 2007 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Indexing facilities."""
+
+from cStringIO import StringIO
+
+
+_SIGNATURE = "Bazaar Graph Index 1\n"
+
+
+class GraphIndexBuilder(object):
+    """A builder that can build a GraphIndex."""
+
+    def finish(self):
+        return StringIO(_SIGNATURE + '\n')

=== added file 'bzrlib/tests/test_index.py'
--- a/bzrlib/tests/test_index.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/test_index.py	2007-07-12 13:17:38 +0000
@@ -0,0 +1,30 @@
+# Copyright (C) 2007 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Tests for indices."""
+
+from bzrlib.index import GraphIndexBuilder
+from bzrlib.tests import TestCaseWithMemoryTransport
+
+
+class TestGraphIndexBuilder(TestCaseWithMemoryTransport):
+
+    def test_build_index_empty(self):
+        builder = GraphIndexBuilder()
+        stream = builder.finish()
+        contents = stream.read()
+        self.assertEqual("Bazaar Graph Index 1\n\n", contents)
+

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-07-05 00:12:25 +0000
+++ b/bzrlib/tests/__init__.py	2007-07-12 13:17:38 +0000
@@ -2312,6 +2312,7 @@
                    'bzrlib.tests.test_https_ca_bundle',
                    'bzrlib.tests.test_identitymap',
                    'bzrlib.tests.test_ignores',
+                   'bzrlib.tests.test_index',
                    'bzrlib.tests.test_info',
                    'bzrlib.tests.test_inv',
                    'bzrlib.tests.test_knit',




More information about the bazaar-commits mailing list