Rev 3489: Implement 'trunk-reverted' which demonstrates the difference between simple-right and right-head in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/annotation

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


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

------------------------------------------------------------
revno: 3489
revision-id: john at arbash-meinel.com-20080611222634-cnteyr7i7sglt317
parent: john at arbash-meinel.com-20080611222029-wwcckhnvnyl9xs6r
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: annotation
timestamp: Wed 2008-06-11 17:26:34 -0500
message:
  Implement 'trunk-reverted' which demonstrates the difference between simple-right and right-head
-------------- next part --------------
=== modified file 'bzrlib/tests/test_annotation_policy.py'
--- a/bzrlib/tests/test_annotation_policy.py	2008-06-11 22:20:29 +0000
+++ b/bzrlib/tests/test_annotation_policy.py	2008-06-11 22:26:34 +0000
@@ -119,6 +119,10 @@
             policies = scenario._policies
             if policies is None:
                 # This applies to all scenarios
+                # TODO: It might be nicer if we allowed a test to apply to all
+                #       scenarios, but then be overridden by more specific
+                #       scenarios. So that a plugin that disagrees with an 'all
+                #       core implementations' can override the test.
                 policies = all_policies
             for policy in policies:
                 result.append(self._get_vars_for_scenario(policy, scenario))
@@ -159,7 +163,8 @@
             # match
             self.assertEqualDiff(''.join('\t'.join(l) for l in expected),
                                  ''.join('\t'.join(l) for l in actual),
-                'reannotate for revision {%s} did not match\n' % (revision_id,))
+                'reannotate for revision {%s}, policy %r did not match\n'
+                % (revision_id, self.policy_name))
 
     def get_parent_and_child_lines(self, revision_id):
         """Get the annotated parent texts and the plain child lines."""
@@ -301,9 +306,9 @@
 
       A    # Common text, has line 'foo'
       |\
-      B C  # No change in W, X changes 'foo' to 'bar'
+      B C  # No change in B, C changes 'foo' to 'bar'
       | |
-      | D  # Y reverts 'bar' back to 'foo'
+      | D  # D reverts 'bar' back to 'foo'
       |/
       E
     """
@@ -322,6 +327,39 @@
 
 # Currently all implementations offer this value
 MergeRevertedLineScenario(None, {'rev-E':[(0, 'rev-D', 'foo\n')]})
+
+
+class TrunkRevertedLineScenario(AnnotationScenario):
+    """A line was modified and then reverted in trunk.
+
+      A    # Common text, has line 'foo'
+      |\
+      B C  # No change in C, B changes 'foo' to 'bar'
+      | |
+      D |  # D reverts 'bar' back to 'foo'
+      |/
+      E
+    """
+
+    name = 'trunk-reverted-line'
+
+    _revision_graph = {'rev-A':(), 'rev-B':('rev-A',), 'rev-C':('rev-A',),
+                       'rev-D':('rev-B',), 'rev-E':('rev-D', 'rev-C')}
+
+    _annotated_texts = {'rev-A':'rev-A foo\n',
+                        'rev-B':'rev-B bar\n',
+                        'rev-C':'rev-A foo\n',
+                        'rev-D':'rev-D foo\n',
+                        'rev-E':'None foo\n',
+                       }
+
+# Currently all implementations offer this value
+TrunkRevertedLineScenario(['merge-node', 'right-head'],
+    {'rev-E':[(0, 'rev-D', 'foo\n')]})
+# simple-right always assumes that the right branch is correct, so it changes
+# the value
+TrunkRevertedLineScenario(['simple-right'],
+    {'rev-E':[(0, 'rev-A', 'foo\n')]})
                        
 
 



More information about the bazaar-commits mailing list