Rev 2237: Use 'null:' instead of '' to mean NULL_REVISION on the wire. in sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

Andrew Bennetts andrew.bennetts at canonical.com
Thu Apr 19 05:30:34 BST 2007


At sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

------------------------------------------------------------
revno: 2237
revision-id: andrew.bennetts at canonical.com-20070419042920-fwr334s98mbcxh5e
parent: andrew.bennetts at canonical.com-20070418112756-0sqsp5yxemwt3mrg
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: hpss
timestamp: Thu 2007-04-19 14:29:20 +1000
message:
  Use 'null:' instead of '' to mean NULL_REVISION on the wire.
modified:
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/smart/branch.py         branch.py-20061124031907-mzh3pla28r83r97f-1
  bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
  bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2007-04-18 11:27:56 +0000
+++ b/bzrlib/remote.py	2007-04-19 04:29:20 +0000
@@ -877,8 +877,6 @@
         assert response[0] == 'ok', 'unexpected response code %s' % (response,)
         revno = int(response[1])
         last_revision = response[2]
-        if last_revision == '':
-            last_revision = NULL_REVISION
         return (revno, last_revision)
 
     def _gen_revision_history(self):
@@ -900,7 +898,7 @@
         # branch, NoSuchRevision will be raised.
         path = self.bzrdir._path_for_remote_call(self._client)
         if rev_history == []:
-            rev_id = ''
+            rev_id = 'null:'
         else:
             rev_id = rev_history[-1]
         response = self._client.call('Branch.set_last_revision',

=== modified file 'bzrlib/smart/branch.py'
--- a/bzrlib/smart/branch.py	2007-04-12 07:08:33 +0000
+++ b/bzrlib/smart/branch.py	2007-04-19 04:29:20 +0000
@@ -97,15 +97,13 @@
         The revno is encoded in decimal, the revision_id is encoded as utf8.
         """
         revno, last_revision = branch.last_revision_info()
-        if last_revision == NULL_REVISION:
-            last_revision = ''
         return SmartServerResponse(('ok', str(revno), last_revision))
 
 
 class SmartServerBranchRequestSetLastRevision(SmartServerLockedBranchRequest):
     
     def do_with_locked_branch(self, branch, new_last_revision_id):
-        if new_last_revision_id == '':
+        if new_last_revision_id == 'null:':
             branch.set_revision_history([])
         else:
             if not branch.repository.has_revision(new_last_revision_id):

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2007-04-18 11:27:56 +0000
+++ b/bzrlib/tests/test_remote.py	2007-04-19 04:29:20 +0000
@@ -206,7 +206,7 @@
 
     def test_empty_branch(self):
         # in an empty branch we decode the response properly
-        client = FakeClient([(('ok', '0', ''), )])
+        client = FakeClient([(('ok', '0', 'null:'), )])
         transport = MemoryTransport()
         transport.mkdir('quack')
         transport = transport.clone('quack')
@@ -264,7 +264,7 @@
         result = branch.set_revision_history([])
         self.assertEqual(
             [('call', 'Branch.set_last_revision',
-                ('///branch/', 'branch token', 'repo token', ''))],
+                ('///branch/', 'branch token', 'repo token', 'null:'))],
             client._calls)
         branch.unlock()
         self.assertEqual(None, result)

=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py	2007-04-18 05:10:19 +0000
+++ b/bzrlib/tests/test_smart.py	2007-04-19 04:29:20 +0000
@@ -229,11 +229,11 @@
 class TestSmartServerBranchRequestLastRevisionInfo(tests.TestCaseWithTransport):
 
     def test_empty(self):
-        """For an empty branch, the result is ('ok', '0', '')."""
+        """For an empty branch, the result is ('ok', '0', 'null:')."""
         backing = self.get_transport()
         request = smart.branch.SmartServerBranchRequestLastRevisionInfo(backing)
         self.make_branch('.')
-        self.assertEqual(SmartServerResponse(('ok', '0', '')),
+        self.assertEqual(SmartServerResponse(('ok', '0', 'null:')),
             request.execute(backing.local_abspath('')))
 
     def test_not_empty(self):
@@ -288,7 +288,8 @@
         try:
             self.assertEqual(SmartServerResponse(('ok',)),
                 request.execute(
-                    backing.local_abspath(''), branch_token, repo_token, ''))
+                    backing.local_abspath(''), branch_token, repo_token,
+                    'null:'))
         finally:
             b.unlock()
 




More information about the bazaar-commits mailing list