Rev 3253: Merge tsort NULL_REVISION patch from mwhudson, with John's import fix in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Mar 6 12:07:35 GMT 2008


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

------------------------------------------------------------
revno: 3253
revision-id:pqm at pqm.ubuntu.com-20080306120728-w54bzmmrr0ri1xfu
parent: pqm at pqm.ubuntu.com-20080306002706-0ahjg0eqnxh8ofas
parent: mbp at sourcefrog.net-20080301091139-iwnt5j6380oxnlw5
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-03-06 12:07:28 +0000
message:
  Merge tsort NULL_REVISION patch from mwhudson, with John's import fix
modified:
  bzrlib/deprecated_graph.py     graph.py-20050905070950-b47dce53236c5e48
  bzrlib/tests/test_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
  bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
    ------------------------------------------------------------
    revno: 3246.2.2
    revision-id:mbp at sourcefrog.net-20080301091139-iwnt5j6380oxnlw5
    parent: mbp at sourcefrog.net-20080229155355-syrrv7nzr4y9oyyq
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: integration
    timestamp: Sat 2008-03-01 09:11:39 +0000
    message:
      Fix up import of tsort
    modified:
      bzrlib/deprecated_graph.py     graph.py-20050905070950-b47dce53236c5e48
      bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
    ------------------------------------------------------------
    revno: 3246.2.1
    revision-id:mbp at sourcefrog.net-20080229155355-syrrv7nzr4y9oyyq
    parent: pqm at pqm.ubuntu.com-20080229011300-p50it0si2y8mbv0d
    parent: michael.hudson at canonical.com-20080226230415-iaecaj60fzthfzzi
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: integration
    timestamp: Fri 2008-02-29 15:53:55 +0000
    message:
      Merge tsort NULL_REVISION patch from mwhudson, with John's import fix
    modified:
      bzrlib/tests/test_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
      bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
    ------------------------------------------------------------
    revno: 3236.2.1
    revision-id:michael.hudson at canonical.com-20080226230415-iaecaj60fzthfzzi
    parent: pqm at pqm.ubuntu.com-20080225092119-bk1won32t9nw4h6u
    committer: Michael Hudson <michael.hudson at canonical.com>
    branch nick: merge_sort-empty-graph
    timestamp: Wed 2008-02-27 12:04:15 +1300
    message:
      test and fix
    modified:
      bzrlib/tests/test_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
      bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
=== modified file 'bzrlib/deprecated_graph.py'
--- a/bzrlib/deprecated_graph.py	2007-07-19 07:45:10 +0000
+++ b/bzrlib/deprecated_graph.py	2008-03-01 09:11:39 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 Canonical Ltd
+# Copyright (C) 2005, 2008 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
@@ -15,9 +15,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
-from bzrlib.tsort import topo_sort
-
-
 def max_distance(node, ancestors, distances, root_descendants):
     """Calculate the max distance to an ancestor.  
     Return None if not all possible ancestors have known distances"""
@@ -145,6 +142,7 @@
     def get_ancestry(self, node_id, topo_sorted=True):
         """Return the inclusive ancestors of node_id in topological order."""
         # maybe optimise this ?
+        from bzrlib.tsort import topo_sort
         result = {}
         pending = set([node_id])
         while len(pending):

=== modified file 'bzrlib/tests/test_tsort.py'
--- a/bzrlib/tests/test_tsort.py	2008-01-15 21:42:00 +0000
+++ b/bzrlib/tests/test_tsort.py	2008-02-26 23:04:15 +0000
@@ -21,6 +21,7 @@
 from bzrlib.tests import TestCase
 from bzrlib.tsort import topo_sort, TopoSorter, MergeSorter, merge_sort
 from bzrlib.errors import GraphCycleError
+from bzrlib.revision import NULL_REVISION
 
 
 class TopoSortTests(TestCase):
@@ -112,6 +113,8 @@
         # sorting of an emptygraph does not error
         self.assertSortAndIterate({}, None, [], False)
         self.assertSortAndIterate({}, None, [], True)
+        self.assertSortAndIterate({}, NULL_REVISION, [], False)
+        self.assertSortAndIterate({}, NULL_REVISION, [], True)
 
     def test_merge_sort_not_empty_no_tip(self):
         # merge sorting of a branch starting with None should result

=== modified file 'bzrlib/tsort.py'
--- a/bzrlib/tsort.py	2008-01-15 21:00:31 +0000
+++ b/bzrlib/tsort.py	2008-03-01 09:11:39 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006, 2008 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
@@ -19,6 +19,7 @@
 
 
 from bzrlib import errors
+import bzrlib.revision as _mod_revision
 
 
 __all__ = ["topo_sort", "TopoSorter", "merge_sort", "MergeSorter"]
@@ -406,7 +407,8 @@
         self._left_subtree_pushed_stack = []
 
         # seed the search with the tip of the branch
-        if branch_tip is not None:
+        if (branch_tip is not None and
+            branch_tip != _mod_revision.NULL_REVISION):
             parents = self._graph.pop(branch_tip)
             self._push_node(branch_tip, 0, parents)
 




More information about the bazaar-commits mailing list