Rev 2733: NULL_REVISION is returned to indicate the null revision, not None in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Aug 20 15:19:23 BST 2007


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

------------------------------------------------------------
revno: 2733
revision-id: pqm at pqm.ubuntu.com-20070820141921-kmbpaev7g9epuy08
parent: pqm at pqm.ubuntu.com-20070820094305-9oosrencb83z0a6x
parent: abentley at panoramicfeedback.com-20070820133028-nx1ujd9zlyxddi0k
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-08-20 15:19:21 +0100
message:
  NULL_REVISION is returned to indicate the null revision, not None
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
  bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
  bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
  bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
  bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
  bzrlib/tests/test_revisionnamespaces.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
  bzrlib/tests/test_upgrade.py   test_upgrade.py-20051004040251-555fe1d2bae1bc71
  bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 2598.5.19
    merged: abentley at panoramicfeedback.com-20070820133028-nx1ujd9zlyxddi0k
    parent: abentley at panoramicfeedback.com-20070820130712-buopmg528zcgwyxc
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: nullrevision
    timestamp: Mon 2007-08-20 09:30:28 -0400
    message:
      update NEWS
    ------------------------------------------------------------
    revno: 2598.5.18
    merged: abentley at panoramicfeedback.com-20070820130712-buopmg528zcgwyxc
    parent: abentley at panoramicfeedback.com-20070820130346-qg771yhz9qaf4qjw
    parent: pqm at pqm.ubuntu.com-20070820094305-9oosrencb83z0a6x
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: nullrevision
    timestamp: Mon 2007-08-20 09:07:12 -0400
    message:
      Merge bzr.dev
    ------------------------------------------------------------
    revno: 2598.5.17
    merged: abentley at panoramicfeedback.com-20070820130346-qg771yhz9qaf4qjw
    parent: aaron.bentley at utoronto.ca-20070815003700-qjjnrv4ba7gwxket
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: nullrevision
    timestamp: Mon 2007-08-20 09:03:46 -0400
    message:
      Remove apparent no-op
    ------------------------------------------------------------
    revno: 2598.5.16
    merged: aaron.bentley at utoronto.ca-20070815003700-qjjnrv4ba7gwxket
    parent: aaron.bentley at utoronto.ca-20070815002734-qd0deycczb0tcq7l
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: nullrevision
    timestamp: Tue 2007-08-14 20:37:00 -0400
    message:
      Replace exception with deprecation warning
    ------------------------------------------------------------
    revno: 2598.5.15
    merged: aaron.bentley at utoronto.ca-20070815002734-qd0deycczb0tcq7l
    parent: abentley at panoramicfeedback.com-20070807200636-ytpc9vg6cl9uty11
    parent: pqm at pqm.ubuntu.com-20070814221506-6rw0b0oolfdeqrdw
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: nullrevision
    timestamp: Tue 2007-08-14 20:27:34 -0400
    message:
      Merge bzr.dev
    ------------------------------------------------------------
    revno: 2598.5.14
    merged: abentley at panoramicfeedback.com-20070807200636-ytpc9vg6cl9uty11
    parent: aaron.bentley at utoronto.ca-20070806222654-a96j4mysnih1ha8x
    parent: pqm at pqm.ubuntu.com-20070807082835-sxq0vmfbvsebps5z
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: nullrevision
    timestamp: Tue 2007-08-07 16:06:36 -0400
    message:
      Merge from bzr.dev
    ------------------------------------------------------------
    revno: 2598.5.13
    merged: aaron.bentley at utoronto.ca-20070806222654-a96j4mysnih1ha8x
    parent: aaron.bentley at utoronto.ca-20070726041102-7tptvr0xu2omwqox
    parent: pqm at pqm.ubuntu.com-20070801000518-wyeivv59zhkh9cbp
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: nullrevision
    timestamp: Mon 2007-08-06 18:26:54 -0400
    message:
      Merge bzr.dev
    ------------------------------------------------------------
    revno: 2598.5.12
    merged: aaron.bentley at utoronto.ca-20070726041102-7tptvr0xu2omwqox
    parent: aaron.bentley at utoronto.ca-20070726002625-axdxn0jfk0kapy6t
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: nullrevision
    timestamp: Thu 2007-07-26 00:11:02 -0400
    message:
      Merge bzr.dev
    ------------------------------------------------------------
    revno: 2598.5.11
    merged: aaron.bentley at utoronto.ca-20070726002625-axdxn0jfk0kapy6t
    parent: aaron.bentley at utoronto.ca-20070725052439-t6hzz6o142as6wmd
    parent: pqm at pqm.ubuntu.com-20070725140043-22lenkarm0oc3tvx
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: nullrevision
    timestamp: Wed 2007-07-25 20:26:25 -0400
    message:
      Merge bzr.dev
    ------------------------------------------------------------
    revno: 2598.5.10
    merged: aaron.bentley at utoronto.ca-20070725052439-t6hzz6o142as6wmd
    parent: aaron.bentley at utoronto.ca-20070712073944-f4fv0zzknqdcen7e
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: nullrevision
    timestamp: Wed 2007-07-25 01:24:39 -0400
    message:
      Return NULL_REVISION instead of None for the null revision
=== modified file 'NEWS'
--- a/NEWS	2007-08-20 09:43:05 +0000
+++ b/NEWS	2007-08-20 13:30:28 +0000
@@ -39,8 +39,11 @@
    * ``Branch.append_revision`` is removed altogether; please use 
      ``Branch.set_last_revision_info`` instead.  (Martin Pool)
 
-    * ``Transport.should_cache`` has been removed.  It was not called in the
-      previous release.  (Martin Pool)
+   * ``Transport.should_cache`` has been removed.  It was not called in the
+     previous release.  (Martin Pool)
+
+   * NULL_REVISION is returned to indicate the null revision, not None.
+     (Aaron Bentley)
 
   INTERNALS:
 

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-08-17 05:16:14 +0000
+++ b/bzrlib/branch.py	2007-08-20 13:07:12 +0000
@@ -437,7 +437,7 @@
         if ph:
             return ph[-1]
         else:
-            return None
+            return _mod_revision.NULL_REVISION
 
     def last_revision_info(self):
         """Return information about the last revision.
@@ -497,7 +497,7 @@
     def get_rev_id(self, revno, history=None):
         """Find the revision id of the specified revno."""
         if revno == 0:
-            return None
+            return _mod_revision.NULL_REVISION
         if history is None:
             history = self.revision_history()
         if revno <= 0 or revno > len(history):
@@ -1900,8 +1900,6 @@
     def last_revision(self):
         """Return last revision id, or None"""
         revision_id = self.last_revision_info()[1]
-        if revision_id == _mod_revision.NULL_REVISION:
-            revision_id = None
         return revision_id
 
     def _write_last_revision_info(self, revno, revision_id):

=== modified file 'bzrlib/revision.py'
--- a/bzrlib/revision.py	2007-08-15 04:33:34 +0000
+++ b/bzrlib/revision.py	2007-08-20 13:07:12 +0000
@@ -446,6 +446,9 @@
 def ensure_null(revision_id):
     """Ensure only NULL_REVISION is used to represent the null revisionn"""
     if revision_id is None:
+        symbol_versioning.warn('NULL_REVISION should be used for the null'
+            ' revision instead of None, as of bzr 0.91.',
+            DeprecationWarning, stacklevel=2)
         return NULL_REVISION
     else:
         return revision_id

=== modified file 'bzrlib/revisionspec.py'
--- a/bzrlib/revisionspec.py	2007-08-07 01:58:45 +0000
+++ b/bzrlib/revisionspec.py	2007-08-20 13:03:46 +0000
@@ -458,7 +458,7 @@
             rev = branch.repository.get_revision(r.rev_id)
             if not rev.parent_ids:
                 revno = 0
-                revision_id = None
+                revision_id = revision.NULL_REVISION
             else:
                 revision_id = rev.parent_ids[0]
                 try:

=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2007-08-15 17:26:53 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2007-08-20 13:07:12 +0000
@@ -136,4 +136,4 @@
         self.assertEqual('1', tree.last_revision())
         branch.bzrdir.destroy_workingtree()
         self.run_bzr('checkout -r 0')
-        self.assertIs(None, tree.last_revision())
+        self.assertEqual('null:', tree.last_revision())

=== modified file 'bzrlib/tests/blackbox/test_diff.py'
--- a/bzrlib/tests/blackbox/test_diff.py	2007-08-03 02:52:23 +0000
+++ b/bzrlib/tests/blackbox/test_diff.py	2007-08-20 13:07:12 +0000
@@ -209,7 +209,7 @@
         print >> open('branch1/file1', 'wb'), 'new line'
         output = self.run_bzr('diff -r 1.. branch1',
                               retcode=1)
-        self.assertTrue('\n-original line\n+new line\n' in output[0])
+        self.assertContainsRe(output[0], '\n\\-original line\n\\+new line\n')
 
     def test_diff_across_rename(self):
         """The working tree path should always be considered for diffing"""

=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py	2007-08-17 05:01:28 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py	2007-08-20 13:07:12 +0000
@@ -381,7 +381,7 @@
         tree_a = self.make_branch_and_tree('a')
         branch_a = tree_a.branch
         checkout_b = branch_a.create_checkout('b')
-        self.assertEqual(None, checkout_b.last_revision())
+        self.assertEqual('null:', checkout_b.last_revision())
         checkout_b.commit('rev1', rev_id='rev1')
         self.assertEqual('rev1', branch_a.last_revision())
         self.assertNotEqual(checkout_b.branch.base, branch_a.base)

=== modified file 'bzrlib/tests/test_revisionnamespaces.py'
--- a/bzrlib/tests/test_revisionnamespaces.py	2007-07-25 22:03:13 +0000
+++ b/bzrlib/tests/test_revisionnamespaces.py	2007-08-06 22:26:54 +0000
@@ -116,7 +116,7 @@
 class TestRevisionSpec_revno(TestRevisionSpec):
 
     def test_positive_int(self):
-        self.assertInHistoryIs(0, None, '0')
+        self.assertInHistoryIs(0, 'null:', '0')
         self.assertInHistoryIs(1, 'r1', '1')
         self.assertInHistoryIs(2, 'r2', '2')
         self.assertInvalid('3')
@@ -133,7 +133,7 @@
         self.assertInHistoryIs(1, 'r1', '-100')
 
     def test_positive(self):
-        self.assertInHistoryIs(0, None, 'revno:0')
+        self.assertInHistoryIs(0, 'null:', 'revno:0')
         self.assertInHistoryIs(1, 'r1', 'revno:1')
         self.assertInHistoryIs(2, 'r2', 'revno:2')
 
@@ -289,7 +289,7 @@
     def test_positive(self):
         self.assertInHistoryIs(2, 'r2', 'last:1')
         self.assertInHistoryIs(1, 'r1', 'last:2')
-        self.assertInHistoryIs(0, None, 'last:3')
+        self.assertInHistoryIs(0, 'null:', 'last:3')
 
     def test_empty(self):
         self.assertInHistoryIs(2, 'r2', 'last:')
@@ -322,7 +322,7 @@
         self.assertInHistoryIs(1, 'r1', 'before:-1')
 
     def test_before_one(self):
-        self.assertInHistoryIs(0, None, 'before:1')
+        self.assertInHistoryIs(0, 'null:', 'before:1')
 
     def test_before_none(self):
         self.assertInvalid('before:0',
@@ -343,7 +343,7 @@
         new_tree.commit('first', rev_id='new_r1')
         self.tree.branch.repository.fetch(new_tree.branch.repository,
                                           revision_id='new_r1')
-        self.assertInHistoryIs(0, None, 'before:revid:new_r1')
+        self.assertInHistoryIs(0, 'null:', 'before:revid:new_r1')
 
 
 class TestRevisionSpec_tag(TestRevisionSpec):

=== modified file 'bzrlib/tests/test_upgrade.py'
--- a/bzrlib/tests/test_upgrade.py	2007-07-31 02:07:34 +0000
+++ b/bzrlib/tests/test_upgrade.py	2007-08-06 22:26:54 +0000
@@ -195,7 +195,7 @@
         converter.convert(tree.bzrdir, progress.DummyProgress())
         new_tree = workingtree.WorkingTree.open('tree')
         self.assertIs(new_tree.__class__, workingtree_4.WorkingTree4)
-        self.assertEqual(None, new_tree.last_revision())
+        self.assertEqual('null:', new_tree.last_revision())
 
     def test_convert_knit_dirstate_content(self):
         # smoke test for dirstate conversion: we call dirstate primitives,
@@ -208,7 +208,7 @@
         converter.convert(tree.bzrdir, progress.DummyProgress())
         new_tree = workingtree.WorkingTree.open('tree')
         self.assertIs(new_tree.__class__, workingtree_4.WorkingTree4)
-        self.assertEqual(None, new_tree.last_revision())
+        self.assertEqual('null:', new_tree.last_revision())
 
     def test_convert_knit_one_parent_dirstate(self):
         # test that asking for an upgrade from knit to dirstate works.

=== modified file 'bzrlib/tests/workingtree_implementations/test_commit.py'
--- a/bzrlib/tests/workingtree_implementations/test_commit.py	2007-07-13 06:22:45 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_commit.py	2007-07-26 00:26:25 +0000
@@ -271,7 +271,7 @@
         tree.lock_read()
         self.addCleanup(tree.unlock)
         # the deepest subtree has not changed, so no commit should take place.
-        self.assertEqual(None, subsubtree.last_revision())
+        self.assertEqual('null:', subsubtree.last_revision())
         # the intermediate tree should have committed a pointer to the current
         # subtree revision.
         sub_basis = subtree.basis_tree()

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-08-15 04:33:34 +0000
+++ b/bzrlib/workingtree.py	2007-08-20 13:07:12 +0000
@@ -1640,7 +1640,7 @@
     @needs_read_lock
     def _last_revision(self):
         """helper for get_parent_ids."""
-        return self.branch.last_revision()
+        return _mod_revision.ensure_null(self.branch.last_revision())
 
     def is_locked(self):
         return self._control_files.is_locked()
@@ -2443,7 +2443,7 @@
             return osutils.safe_revision_id(
                         self._control_files.get('last-revision').read())
         except errors.NoSuchFile:
-            return None
+            return _mod_revision.NULL_REVISION
 
     def _change_last_revision(self, revision_id):
         """See WorkingTree._change_last_revision."""

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-08-09 03:23:04 +0000
+++ b/bzrlib/workingtree_4.py	2007-08-15 00:27:34 +0000
@@ -568,7 +568,7 @@
         if parent_ids:
             return parent_ids[0]
         else:
-            return None
+            return _mod_revision.NULL_REVISION
 
     def lock_read(self):
         """See Branch.lock_read, and WorkingTree.unlock."""




More information about the bazaar-commits mailing list