Rev 87: Use selftest --starting-with. in file:///data/jelmer/bzr-rebase/trunk/

Jelmer Vernooij jelmer at samba.org
Thu May 29 13:14:26 BST 2008


At file:///data/jelmer/bzr-rebase/trunk/

------------------------------------------------------------
revno: 87
revision-id: jelmer at samba.org-20080529121426-3i85ixcmuly3gj1j
parent: jelmer at samba.org-20080529121416-ycd19g48oy3bxxc5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-05-29 14:14:26 +0200
message:
  Use selftest --starting-with.
modified:
  Makefile                       makefile-20080330190326-ad4of1yovo6un1xf-1
  rebase.py                      rebase.py-20070626221123-ellanmf93nw8z9r1-1
=== modified file 'Makefile'
--- a/Makefile	2008-03-30 19:16:11 +0000
+++ b/Makefile	2008-05-29 12:14:26 +0000
@@ -4,7 +4,7 @@
 SETUP ?= ./setup.py
 CTAGS ?= ctags
 PYLINT ?= pylint
-TESTS ?= "^bzrlib.plugins.rebase"
+TESTS ?= 
 
 all:: build 
 
@@ -26,7 +26,7 @@
 	ln -sf .. $@
 
 check:: $(TMP_PLUGINS_DIR)/rebase/
-	BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(BZR) selftest $(TEST_OPTIONS) $(TESTS)
+	BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(BZR) selftest $(TEST_OPTIONS) --starting-with=bzrlib.plugins.rebase $(TESTS)
 
 check-verbose::
 	$(MAKE) check TEST_OPTIONS=-v

=== modified file 'rebase.py'
--- a/rebase.py	2008-05-18 13:57:53 +0000
+++ b/rebase.py	2008-05-29 12:14:26 +0000
@@ -125,7 +125,7 @@
 
 
 def generate_simple_plan(history, start_revid, stop_revid, onto_revid, 
-                         onto_ancestry, get_parents, generate_revid,
+                         onto_ancestry, graph, generate_revid,
                          skip_full_merged=False):
     """Create a simple rebase plan that replays history based 
     on one revision being replayed on top of another.
@@ -135,7 +135,7 @@
     :param stop_revid: Id of revision until which to stop replaying
     :param onto_revid: Id of revision on top of which to replay
     :param onto_ancestry: Ancestry of onto_revid
-    :param get_parents: Function for obtaining the parents of a revision
+    :param graph: Graph object
     :param generate_revid: Function for generating new revision ids
     :param skip_full_merged: Skip revisions that merge already merged 
                              revisions.
@@ -154,13 +154,15 @@
     else:
         stop_revno = None
     new_parent = onto_revid
-    for oldrevid in history[start_revno:stop_revno]: 
-        oldparents = list(get_parents(oldrevid))
-        assert isinstance(oldparents, list)
-        assert oldparents == [] or \
+    todo = history[start_revno:stop_revno]
+    parent_map = graph.get_parent_map(todo)
+    for oldrevid in todo: 
+        oldparents = parent_map[oldrevid]
+        assert isinstance(oldparents, tuple), "not tuple: %r" % oldparents
+        assert oldparents == () or \
                 oldparents[0] == history[history.index(oldrevid)-1]
         if len(oldparents) > 1:
-            parents = [new_parent] + filter(lambda p: p not in onto_ancestry or p == onto_revid, oldparents[1:]) 
+            parents = (new_parent,) + tuple(filter(lambda p: p not in onto_ancestry or p == onto_revid, oldparents[1:]))
             if len(parents) == 1 and skip_full_merged:
                 continue
         else:
@@ -275,6 +277,7 @@
             i += 1
             revid = todo.pop()
             (newrevid, newparents) = replace_map[revid]
+            assert isinstance(newparents, tuple)
             if filter(repository.has_revision, newparents) != newparents:
                 # Not all parents present yet, avoid for now
                 continue
@@ -283,7 +286,7 @@
                 continue
             replay_fn(repository, revid, newrevid, newparents)
             assert repository.has_revision(newrevid)
-            assert list(repository.get_parent_map([newrevid])[newrevid]) == newparents, \
+            assert repository.get_parent_map([newrevid])[newrevid] == newparents, \
                    "expected parents %r, got %r" % (newparents, 
                            repository.get_parent_map([newrevid])[newrevid])
             if dependencies.has_key(newrevid):




More information about the bazaar-commits mailing list