Rev 3453: Clarity tweaks recommended by Ian in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/graph_find_distance_to_null

John Arbash Meinel john at arbash-meinel.com
Thu May 29 21:18:00 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/graph_find_distance_to_null

------------------------------------------------------------
revno: 3453
revision-id: john at arbash-meinel.com-20080529201737-4y4md0w6u6cuvrpo
parent: john at arbash-meinel.com-20080528222817-pcl5rlms0k9pd1g2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: graph_find_distance_to_null
timestamp: Thu 2008-05-29 15:17:37 -0500
message:
  Clarity tweaks recommended by Ian
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/tests/branch_implementations/test_update.py test_update.py-20060305010612-e68efbcbb1baa69f
  bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2008-05-28 22:28:17 +0000
+++ b/bzrlib/branch.py	2008-05-29 20:17:37 +0000
@@ -447,11 +447,16 @@
                 raise errors.NoSuchRevision(self, stop_revision)
         return other_history[self_len:stop_revision]
 
-    def update_revisions(self, other, stop_revision=None):
+    def update_revisions(self, other, stop_revision=None, overwrite=False,
+                         graph=None):
         """Pull in new perfect-fit revisions.
 
         :param other: Another Branch to pull from
         :param stop_revision: Updated until the given revision
+        :param overwrite: Always set the branch pointer, rather than checking
+            to see if it is a proper descendant.
+        :param graph: A Graph object that can be used to query history
+            information. This can be None.
         :return: None
         """
         raise NotImplementedError(self.update_revisions)
@@ -1515,7 +1520,7 @@
                     return
                 stop_revno = other_revno
 
-            # whats the current last revision, before we fetch [and change it
+            # what's the current last revision, before we fetch [and change it
             # possibly]
             last_rev = _mod_revision.ensure_null(self.last_revision())
             # we fetch here so that we don't process data twice in the common
@@ -1677,6 +1682,8 @@
         result.target_branch = target
         result.old_revno, result.old_revid = target.last_revision_info()
 
+        # We assume that during 'push' this repository is closer than
+        # the target.
         graph = self.repository.get_graph(target.repository)
         target.update_revisions(self, stop_revision, overwrite=overwrite,
                                 graph=graph)

=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2008-05-22 22:02:57 +0000
+++ b/bzrlib/graph.py	2008-05-29 20:17:37 +0000
@@ -241,7 +241,7 @@
             to_search.update(searching_known_tips)
             parent_map = self.get_parent_map(to_search)
             parents = parent_map.get(cur_tip, None)
-            if not parents: # An empty list, or None is still a ghost
+            if not parents: # An empty list or None is a ghost
                 raise errors.GhostRevisionsHaveNoRevno(target_revision_id,
                                                        cur_tip)
             cur_tip = parents[0]
@@ -256,7 +256,6 @@
                     # We have enough information to return a value right now
                     return next_revno + unknown_searched[next]
                 if next in known_revnos:
-                    assert known_revnos[next] == next_revno
                     continue
                 known_revnos[next] = next_revno
                 next_known_tips.append(next)

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-05-28 22:28:17 +0000
+++ b/bzrlib/remote.py	2008-05-29 20:17:37 +0000
@@ -1565,7 +1565,8 @@
         self._ensure_real()
         return self._real_branch.set_push_location(location)
 
-    def update_revisions(self, other, stop_revision=None, overwrite=False, graph=None):
+    def update_revisions(self, other, stop_revision=None, overwrite=False,
+                         graph=None):
         self._ensure_real()
         return self._real_branch.update_revisions(
             other, stop_revision=stop_revision, overwrite=overwrite,

=== modified file 'bzrlib/tests/branch_implementations/test_update.py'
--- a/bzrlib/tests/branch_implementations/test_update.py	2008-05-22 22:56:34 +0000
+++ b/bzrlib/tests/branch_implementations/test_update.py	2008-05-29 20:17:37 +0000
@@ -104,7 +104,7 @@
         tree1.branch.update_revisions(tree2.branch, overwrite=True)
         self.assertEqual((2, rev2b), tree1.branch.last_revision_info())
 
-    def test_ignores_older(self):
+    def test_ignores_older_unless_overwrite(self):
         tree1 = self.make_branch_and_tree('tree1')
         rev1 = tree1.commit('one')
         tree2 = tree1.bzrdir.sprout('tree2').open_workingtree()

=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py	2008-05-22 22:02:57 +0000
+++ b/bzrlib/tests/test_graph.py	2008-05-29 20:17:37 +0000
@@ -1303,7 +1303,7 @@
         self.assertFindDistance(3, graph, 'rev3', [('rev4', 4)])
 
     def test_target_parallel_to_known_limits(self):
-        # Even though the known revision isn't part of the other ancestry, the
+        # Even though the known revision isn't part of the other ancestry, they
         # eventually converge
         graph = self.make_breaking_graph(with_tail, ['a'])
         self.assertFindDistance(6, graph, 'f', [('g', 6)])



More information about the bazaar-commits mailing list