Rev 5415: (mbp) Deprecate casting PushResult and PullResult to int to get the relative in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 9 05:32:42 BST 2010


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

------------------------------------------------------------
revno: 5415 [merge]
revision-id: pqm at pqm.ubuntu.com-20100909043241-7ya6s3ghs5c1ijxk
parent: pqm at pqm.ubuntu.com-20100909001213-vfvobl4h09btm7mt
parent: mbp at sourcefrog.net-20100909003258-ioyugglvmu32yvff
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2010-09-09 05:32:41 +0100
message:
  (mbp) Deprecate casting PushResult and PullResult to int to get the relative
   revno change (Martin Pool)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/per_branch/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
  bzrlib/tests/per_interbranch/test_push.py test_push.py-20090330192649-pca31sb2ubbtcs15-1
  bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
=== modified file 'NEWS'
--- a/NEWS	2010-09-08 22:52:36 +0000
+++ b/NEWS	2010-09-09 00:32:58 +0000
@@ -231,6 +231,10 @@
   have the configuration file immediately written to disk. 
   (Vincent Ladeuil)
 
+* Deprecate treating a `PushResult` and `PullResult` as an integer for the
+  relative change in revno.
+  (Martin Pool)
+  `
 * ``IniBaseConfig`` objects should now use the ``from_string`` constructor
   the rather than the ``file`` parameter of the ``_get_parser`` method. The
   later has been deprecated. (Vincent Ladeuil)

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2010-08-17 22:24:01 +0000
+++ b/bzrlib/branch.py	2010-09-09 00:32:58 +0000
@@ -3103,8 +3103,12 @@
     :ivar tag_conflicts: A list of tag conflicts, see BasicTags.merge_to
     """
 
+    @deprecated_method(deprecated_in((2, 3, 0)))
     def __int__(self):
-        # DEPRECATED: pull used to return the change in revno
+        """Return the relative change in revno.
+
+        :deprecated: Use `new_revno` and `old_revno` instead.
+        """
         return self.new_revno - self.old_revno
 
     def report(self, to_file):
@@ -3135,8 +3139,12 @@
         target, otherwise it will be None.
     """
 
+    @deprecated_method(deprecated_in((2, 3, 0)))
     def __int__(self):
-        # DEPRECATED: push used to return the change in revno
+        """Return the relative change in revno.
+
+        :deprecated: Use `new_revno` and `old_revno` instead.
+        """
         return self.new_revno - self.old_revno
 
     def report(self, to_file):

=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- a/bzrlib/tests/per_branch/test_push.py	2010-07-05 08:10:13 +0000
+++ b/bzrlib/tests/per_branch/test_push.py	2010-09-09 00:32:58 +0000
@@ -30,6 +30,7 @@
     push,
     repository,
     revision,
+    symbol_versioning,
     tests,
     transport,
     )
@@ -61,7 +62,10 @@
         self.assertEqual(result.old_revid, 'M1')
         self.assertEqual(result.new_revid, 'P2')
         # and it can be treated as an integer for compatibility
-        self.assertEqual(int(result), 0)
+        self.assertEqual(self.applyDeprecated(
+            symbol_versioning.deprecated_in((2, 3, 0)),
+            result.__int__),
+            0)
 
     def test_push_merged_indirect(self):
         # it should be possible to do a push from one branch into another

=== modified file 'bzrlib/tests/per_interbranch/test_push.py'
--- a/bzrlib/tests/per_interbranch/test_push.py	2010-06-29 16:21:13 +0000
+++ b/bzrlib/tests/per_interbranch/test_push.py	2010-09-07 23:32:42 +0000
@@ -33,6 +33,7 @@
     errors,
     push,
     repository,
+    symbol_versioning,
     tests,
     )
 from bzrlib.branch import Branch
@@ -68,7 +69,10 @@
         self.assertEqual(result.old_revid, 'M1')
         self.assertEqual(result.new_revid, 'P2')
         # and it can be treated as an integer for compatibility
-        self.assertEqual(int(result), 0)
+        self.assertEqual(self.applyDeprecated(
+            symbol_versioning.deprecated_in((2, 3, 0)),
+            result.__int__),
+            0)
 
     def test_push_merged_indirect(self):
         # it should be possible to do a push from one branch into another

=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2010-08-29 14:32:45 +0000
+++ b/bzrlib/tests/test_branch.py	2010-09-09 00:32:58 +0000
@@ -29,6 +29,7 @@
     bzrdir,
     config,
     errors,
+    symbol_versioning,
     tests,
     trace,
     transport,
@@ -622,8 +623,10 @@
         # this usage of results is not recommended for new code (because it
         # doesn't describe very well what happened), but for api stability
         # it's still supported
-        a = "%d revisions pulled" % r
-        self.assertEqual(a, "10 revisions pulled")
+        self.assertEqual(self.applyDeprecated(
+            symbol_versioning.deprecated_in((2, 3, 0)),
+            r.__int__),
+            10)
 
     def test_report_changed(self):
         r = _mod_branch.PullResult()




More information about the bazaar-commits mailing list