~bzr/ubuntu/jaunty/bzr/beta-ppa

« back to all changes in this revision

Viewing changes to doc/developers/testing.txt

  • Committer: Max Bowsher
  • Date: 2011-04-13 17:25:11 UTC
  • mfrom: (3875.1.7 karmic)
  • Revision ID: maxb@f2s.com-20110413172511-5y3pnux9dwlbnn5g
Tags: 2.4.0~beta1-1~bazaar1~jaunty1
Set up for 2.4-beta PPA builds. For jaunty and earlier, revert to source format
1.0 and opt to drop the removal of bzr's internal copy of elementtree, because
that's simpler than adding quilt support to the buildsystem.

Show diffs side-by-side

added added

removed removed

Lines of Context:
971
971
 
972
972
Please see bzrlib.treebuilder for more details.
973
973
 
 
974
PreviewTree
 
975
~~~~~~~~~~~
 
976
 
 
977
PreviewTrees are based on TreeTransforms.  This means they can represent
 
978
virtually any state that a WorkingTree can have, including unversioned files.
 
979
They can be used to test the output of anything that produces TreeTransforms,
 
980
such as merge algorithms and revert.  They can also be used to test anything
 
981
that takes arbitrary Trees as its input.
 
982
 
 
983
::
 
984
 
 
985
  # Get an empty tree to base the transform on.
 
986
  b = self.make_branch('.')
 
987
  empty_tree = b.repository.revision_tree(_mod_revision.NULL_REVISION)
 
988
  tt = TransformPreview(empty_tree)
 
989
  self.addCleanup(tt.finalize)
 
990
  # Empty trees don't have a root, so add it first.
 
991
  root = tt.new_directory('', ROOT_PARENT, 'tree-root')
 
992
  # Set the contents of a file.
 
993
  tt.new_file('new-file', root, 'contents', 'file-id')
 
994
  preview = tt.get_preview_tree()
 
995
  # Test the contents.
 
996
  self.assertEqual('contents', preview.get_file_text('file-id'))
 
997
 
 
998
PreviewTrees can stack, with each tree falling back to the previous::
 
999
 
 
1000
  tt2 = TransformPreview(preview)
 
1001
  self.addCleanup(tt2.finalize)
 
1002
  tt2.new_file('new-file2', tt2.root, 'contents2', 'file-id2')
 
1003
  preview2 = tt2.get_preview_tree()
 
1004
  self.assertEqual('contents', preview2.get_file_text('file-id'))
 
1005
  self.assertEqual('contents2', preview2.get_file_text('file-id2'))
 
1006
 
974
1007
 
975
1008
Temporarily changing state
976
1009
~~~~~~~~~~~~~~~~~~~~~~~~~~