Rev 3487: Change the api to support multiple policies per instance. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/annotation

John Arbash Meinel john at arbash-meinel.com
Wed Jun 11 23:08:21 BST 2008


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

------------------------------------------------------------
revno: 3487
revision-id: john at arbash-meinel.com-20080611220815-ohmlsr99zpo0mze8
parent: john at arbash-meinel.com-20080611220400-d173fackfqd3gzyg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: annotation
timestamp: Wed 2008-06-11 17:08:15 -0500
message:
  Change the api to support multiple policies per instance.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_annotation_policy.py'
--- a/bzrlib/tests/test_annotation_policy.py	2008-06-11 22:04:00 +0000
+++ b/bzrlib/tests/test_annotation_policy.py	2008-06-11 22:08:15 +0000
@@ -39,8 +39,8 @@
     :cvar _revision_graph: The graph of how revisions fit together.
         {rev_id:[parents]}
     :ivar name: The name of this test
-    :ivar _policy: The policy that this scenario applies to. If set as None,
-        then the suite will apply this scenario to *all* known policies.
+    :ivar _policies: The policies that this scenario applies to. If set as
+        None, then the suite will apply this scenario to *all* known policies.
     :ivar _overrides: A dictionary of {revid:[overrides]} where overrides is a
         list of (line number, rev id, text) tuples. The annotation listed here
         will override the one _annotated_texts
@@ -51,9 +51,9 @@
     _annotated_texts = None
     _revision_graph = None
 
-    def __init__(self, name, policy, overrides):
+    def __init__(self, name, policies, overrides):
         self.name = name
-        self._policy = policy
+        self._policies = policies
         self._overrides = overrides
 
         AnnotationScenario._scenarios.append(self)
@@ -116,17 +116,14 @@
         # For each scenario name, keep track of policies that handle it
         scenario_policy_combinations = {}
         for scenario in ann_scenarios:
-            policy = scenario._policy
-            if policy is not None:
+            policies = scenario._policies
+            if policies is None:
+                # This applies to all scenarios
+                policies = all_policies
+            for policy in policies:
                 result.append(self._get_vars_for_scenario(policy, scenario))
-                scenario_policy_combinations.setdefault(scenario.name,
-                    set()).add(policy)
-            else:
-                # This applies to all scenarios
-                for policy in all_policies:
-                    result.append(self._get_vars_for_scenario(policy, scenario))
-                scenario_policy_combinations.setdefault(scenario.name,
-                    set()).update(all_policies)
+            scenario_policy_combinations.setdefault(scenario.name,
+                set()).update(policies)
         if 'annotation' in debug.debug_flags:
             log = trace.warning
         else:
@@ -282,12 +279,12 @@
                       }
 
 
-DuplicateLineScenario('duplicate', 'right-head',
+DuplicateLineScenario('duplicate', ['right-head', 'simple-right'],
     {'rev-D':[(1, 'rev-A', 'alt-second\n')],
      'rev-E':[(1, 'rev-A', 'alt-second\n')],
     })
 
-DuplicateLineScenario('duplicate', 'merge-node',
+DuplicateLineScenario('duplicate', ['merge-node'],
     {'rev-D':[(1, 'rev-D', 'alt-second\n')],
      'rev-E':[(1, 'rev-D', 'alt-second\n')],
     })



More information about the bazaar-commits mailing list