Rev 2268: merge up tags and resultobject in http://sourcefrog.net/bzr/tags

Martin Pool mbp at sourcefrog.net
Thu Mar 1 06:47:30 GMT 2007


At http://sourcefrog.net/bzr/tags

------------------------------------------------------------
revno: 2268
revision-id: mbp at sourcefrog.net-20070301064729-1y0zb2ap6ntxm9d4
parent: mbp at sourcefrog.net-20070301043643-ho3snagjdl64a96g
parent: mbp at sourcefrog.net-20070301041528-14my1q8v0buynzut
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: tags
timestamp: Thu 2007-03-01 17:47:29 +1100
message:
  merge up tags and resultobject
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
  bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
    ------------------------------------------------------------
    revno: 2220.1.83
    merged: mbp at sourcefrog.net-20070301041528-14my1q8v0buynzut
    parent: mbp at sourcefrog.net-20070225104133-nd8tyugcozbq1uox
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: resultobj
    timestamp: Thu 2007-03-01 15:15:28 +1100
    message:
      Add docs for Results, give some members cleaner names
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-02-26 05:33:32 +0000
+++ b/bzrlib/branch.py	2007-03-01 06:47:29 +0000
@@ -1440,7 +1440,8 @@
             hooks, used when pushing to a master branch.
         """
         result = PullResult()
-        result.source = source
+        result.source_branch = source
+        result.target_branch = self
         source.lock_read()
         try:
             result.old_revno, result.old_revid = self.last_revision_info()
@@ -1454,11 +1455,11 @@
             result.tag_conflicts = source.tags.merge_to(self.tags)
             result.new_revno, result.new_revid = self.last_revision_info()
             if _hook_master:
-                result.master = _hook_master
-                result.local = self
+                result.master_branch = _hook_master
+                result.local_branch = self
             else:
-                result.master = self
-                result.local = None
+                result.master_branch = self
+                result.local_branch = None
             if _run_hooks:
                 for hook in Branch.hooks['post_pull']:
                     hook(result)
@@ -1486,8 +1487,8 @@
             hooks, used when pushing to a master branch.
         """
         result = PushResult()
-        result.source = self
-        result.target = target
+        result.source_branch = self
+        result.target_branch = target
         target.lock_write()
         try:
             result.old_revno, result.old_revid = target.last_revision_info()
@@ -1501,11 +1502,11 @@
             result.tag_conflicts = self.tags.merge_to(target.tags)
             result.new_revno, result.new_revid = target.last_revision_info()
             if _hook_master:
-                result.master = _hook_master
-                result.local = target
+                result.master_branch = _hook_master
+                result.local_branch = target
             else:
-                result.master = target
-                result.local = None
+                result.master_branch = target
+                result.local_branch = None
             if _run_hooks:
                 for hook in Branch.hooks['post_push']:
                     hook(result)
@@ -2071,6 +2072,16 @@
 
 
 class PullResult(_Result):
+    """Result of a Branch.pull operation.
+
+    :ivar old_revno: Revision number before pull.
+    :ivar new_revno: Revision number after pull.
+    :ivar old_revid: Tip revision id before pull.
+    :ivar new_revid: Tip revision id after pull.
+    :ivar source_branch: Source (local) branch object.
+    :ivar master_branch: Master branch of the target, or None.
+    :ivar target_branch: Target/destination branch object.
+    """
 
     def __int__(self):
         # DEPRECATED: pull used to return the change in revno
@@ -2085,7 +2096,16 @@
 
 
 class PushResult(_Result):
-    """Describes the result of a Branch.push operation"""
+    """Result of a Branch.push operation.
+
+    :ivar old_revno: Revision number before push.
+    :ivar new_revno: Revision number after push.
+    :ivar old_revid: Tip revision id before push.
+    :ivar new_revid: Tip revision id after push.
+    :ivar source_branch: Source branch object.
+    :ivar master_branch: Master branch of the target, or None.
+    :ivar target_branch: Target/destination branch object.
+    """
 
     def __int__(self):
         # DEPRECATED: push used to return the change in revno

=== modified file 'bzrlib/tests/branch_implementations/test_pull.py'
--- a/bzrlib/tests/branch_implementations/test_pull.py	2007-02-23 05:39:35 +0000
+++ b/bzrlib/tests/branch_implementations/test_pull.py	2007-03-01 04:15:28 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2004, 2005 Canonical Ltd
+# Copyright (C) 2004, 2005, 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
@@ -92,17 +92,19 @@
         
         The call is logged, as is some state of the two branches.
         """
-        if result.local:
-            local_locked = result.local.is_locked()
-            local_base = result.local.base
+        if result.local_branch:
+            local_locked = result.local_branch.is_locked()
+            local_base = result.local_branch.base
         else:
             local_locked = None
             local_base = None
         self.hook_calls.append(
-            ('post_pull', result.source, local_base, result.master.base, result.old_revno,
+            ('post_pull', result.source_branch, local_base,
+             result.master_branch.base, result.old_revno,
              result.old_revid,
-             result.new_revno, result.new_revid, result.source.is_locked(), local_locked,
-             result.master.is_locked()))
+             result.new_revno, result.new_revid,
+             result.source_branch.is_locked(), local_locked,
+             result.master_branch.is_locked()))
 
     def test_post_pull_empty_history(self):
         target = self.make_branch('target')

=== modified file 'bzrlib/tests/branch_implementations/test_push.py'
--- a/bzrlib/tests/branch_implementations/test_push.py	2007-02-25 10:40:16 +0000
+++ b/bzrlib/tests/branch_implementations/test_push.py	2007-03-01 04:15:28 +0000
@@ -153,17 +153,19 @@
         
         The call is logged, as is some state of the two branches.
         """
-        if result.local:
-            local_locked = result.local.is_locked()
-            local_base = result.local.base
+        if result.local_branch:
+            local_locked = result.local_branch.is_locked()
+            local_base = result.local_branch.base
         else:
             local_locked = None
             local_base = None
         self.hook_calls.append(
-            ('post_push', result.source, local_base, result.master.base,
+            ('post_push', result.source_branch, local_base,
+             result.master_branch.base,
              result.old_revno, result.old_revid,
-             result.new_revno, result.new_revid, result.source.is_locked(), local_locked,
-             result.master.is_locked()))
+             result.new_revno, result.new_revid,
+             result.source_branch.is_locked(), local_locked,
+             result.master_branch.is_locked()))
 
     def test_post_push_empty_history(self):
         target = self.make_branch('target')




More information about the bazaar-commits mailing list