Rev 2744: (robertc) Several minor miscellaneous code cleanup fixes. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Aug 23 01:18:14 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2744
revision-id: pqm at pqm.ubuntu.com-20070823001812-eermtd2vfr5o6b7o
parent: pqm at pqm.ubuntu.com-20070822052832-nxby1d1plok4syek
parent: robertc at robertcollins.net-20070822234336-pl9dspu4z6kbt8lg
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-08-23 01:18:12 +0100
message:
  (robertc) Several minor miscellaneous code cleanup fixes. (Robert Collins)
modified:
  bzrlib/check.py                check.py-20050309040759-f3a679400c06bcc1
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
  bzrlib/store/revision/text.py  text.py-20060303020652-e49155f0da4d14ab
  bzrlib/tests/revisionstore_implementations/test_all.py test_all.py-20060303020702-9b2d4c1d75407f31
    ------------------------------------------------------------
    revno: 2743.1.5
    merged: robertc at robertcollins.net-20070822234336-pl9dspu4z6kbt8lg
    parent: robertc at robertcollins.net-20070822223223-0heetwybcuonp00g
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: misc-fixen
    timestamp: Thu 2007-08-23 09:43:36 +1000
    message:
      Tighten the revision store implementation tests surrounding the
      None/null: difference. (Robert Collins)
    ------------------------------------------------------------
    revno: 2743.1.4
    merged: robertc at robertcollins.net-20070822223223-0heetwybcuonp00g
    parent: robertc at robertcollins.net-20070822223112-e2qgp43wu1ut5u8l
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: misc-fixen
    timestamp: Thu 2007-08-23 08:32:23 +1000
    message:
      Fix an off-by-one in check.py that leads to the progress bar showing
      complete for a phase but not actually being complete; if the last file id
      checked is big this is confusing. (Robert Collins)
    ------------------------------------------------------------
    revno: 2743.1.3
    merged: robertc at robertcollins.net-20070822223112-e2qgp43wu1ut5u8l
    parent: robertc at robertcollins.net-20070822223011-7ir7fquiyjqpgzko
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: misc-fixen
    timestamp: Thu 2007-08-23 08:31:12 +1000
    message:
      Fix vertical whitespace in errors.py. (Robert Collins)
    ------------------------------------------------------------
    revno: 2743.1.2
    merged: robertc at robertcollins.net-20070822223011-7ir7fquiyjqpgzko
    parent: robertc at robertcollins.net-20070822222807-nvjwqzrof5gg3s0b
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: misc-fixen
    timestamp: Thu 2007-08-23 08:30:11 +1000
    message:
      This cleans up a few things in fetch.py that are bit-rotten:
       - the overly general control_files interface is removed in place of
         using get_inventory_weave.
       - unused variables are removed
       - a empty 4-space indent is turned into a empty line.
      (Robert Collins)
    ------------------------------------------------------------
    revno: 2743.1.1
    merged: robertc at robertcollins.net-20070822222807-nvjwqzrof5gg3s0b
    parent: pqm at pqm.ubuntu.com-20070822052832-nxby1d1plok4syek
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: misc-fixen
    timestamp: Thu 2007-08-23 08:28:07 +1000
    message:
      In bzrlib.tests.revisionstore_implementations.test_all,
      test_get_revision_none was confusing because the comment and the test did
      not match. So I made a new test that matched the comment, and altered the
      test name and comment to match the test. (Robert Collins)
=== modified file 'bzrlib/check.py'
--- a/bzrlib/check.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/check.py	2007-08-22 22:32:23 +0000
@@ -156,7 +156,7 @@
         weave_ids = []
         if self.repository.weave_store.listable():
             weave_ids = list(self.repository.weave_store)
-            n_weaves = len(weave_ids)
+            n_weaves = len(weave_ids) + 1
         self.progress.update('checking weave', 0, n_weaves)
         self.inventory_weave.check(progress_bar=self.progress)
         for i, weave_id in enumerate(weave_ids):

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2007-08-21 02:46:21 +0000
+++ b/bzrlib/errors.py	2007-08-22 22:31:12 +0000
@@ -1636,6 +1636,7 @@
         self.text_revision = text_revision
         self.file_id = file_id
 
+
 class DuplicateFileId(BzrError):
 
     _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"

=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2007-08-16 05:50:11 +0000
+++ b/bzrlib/fetch.py	2007-08-22 22:30:11 +0000
@@ -121,9 +121,7 @@
         requested revisions, finally clearing the progress bar.
         """
         self.to_weaves = self.to_repository.weave_store
-        self.to_control = self.to_repository.control_weaves
         self.from_weaves = self.from_repository.weave_store
-        self.from_control = self.from_repository.control_weaves
         self.count_total = 0
         self.file_ids_names = {}
         pp = ProgressPhase('Fetch phase', 4, self.pb)
@@ -221,9 +219,7 @@
 
     def _fetch_inventory_weave(self, revs, pb):
         pb.update("fetch inventory", 0, 2)
-        to_weave = self.to_control.get_weave('inventory',
-                self.to_repository.get_transaction())
-
+        to_weave = self.to_repository.get_inventory_weave()
         child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
         try:
             # just merge, this is optimisable and its means we don't
@@ -249,7 +245,7 @@
         after fetching weave texts.
         """
         pass
-        
+
 
 class GenericRepoFetcher(RepoFetcher):
     """This is a generic repo to repo fetcher.

=== modified file 'bzrlib/store/revision/text.py'
--- a/bzrlib/store/revision/text.py	2007-07-10 21:18:54 +0000
+++ b/bzrlib/store/revision/text.py	2007-08-22 23:43:36 +0000
@@ -108,6 +108,7 @@
         return revisions
 
     def _get_revision_xml_file(self, revision_id):
+        _mod_revision.check_not_reserved_id(revision_id)
         try:
             return self.text_store.get(revision_id)
         except (IndexError, KeyError):

=== modified file 'bzrlib/tests/revisionstore_implementations/test_all.py'
--- a/bzrlib/tests/revisionstore_implementations/test_all.py	2007-07-11 16:42:37 +0000
+++ b/bzrlib/tests/revisionstore_implementations/test_all.py	2007-08-22 23:43:36 +0000
@@ -58,17 +58,24 @@
         # has of a non present id -> False
         self.assertFalse(self.store.has_revision_id('missing', self.transaction))
 
-    def test_has_None(self):
-        # has of None -> True
+    def test_has_null(self):
+        # has of null -> True
         self.assertTrue(self.store.has_revision_id('null:', self.transaction))
 
-    def test_get_revision_none(self):
-        # get_revision(None) -> raises NoSuchRevision
+    def test_get_revision_missing(self):
+        # get_revision('B') -> raises NoSuchRevision
         self.assertRaises(errors.NoSuchRevision,
                           self.store.get_revision,
                           'B',
                           self.transaction)
 
+    def test_get_revision_null(self):
+        # get_revision(null) -> raises ReservedId
+        self.assertRaises(errors.ReservedId,
+                          self.store.get_revision,
+                          'null:',
+                          self.transaction)
+
     def test_add_signature_text_missing(self):
         # add of a text signature for a missing revision must work, to allow
         # revisions to be added after the signature.




More information about the bazaar-commits mailing list