/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/developers/integration.txt

  • Committer: Martin Albisetti
  • Date: 2008-04-06 05:54:52 UTC
  • mto: (3344.1.1 doc)
  • mto: This revision was merged to the branch mainline in revision 3345.
  • Revision ID: argentina@gmail.com-20080406055452-uepzp05mp4smsjm9
Added changes sent by Aaron Bently

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
look through these three files (workingtree.py, mutabletree.py and tree.py)
21
21
to see which methods are available.
22
22
 
23
 
Checking Status
 
23
Compare trees
24
24
===============
25
 
To check status (equivalent of bzr status) we need to create a Delta object
26
 
showing changes::
 
25
There are two methods for comparing trees: ``changes_from`` and
 
26
``iter_changes``.  ``iter_changes`` is more regular and precise, but it is
 
27
somewhat harder to work with.  See the API documentation for more details.
 
28
 
 
29
``changes_from`` creates a Delta object showing changes::
27
30
 
28
31
  from bzrlib import delta
29
32
  changes = wt.changes_from(wt.basis_tree())
30
33
 
31
 
 
32
 
This gives us Delta object with different lists of files for each type of
 
34
This gives us a Delta object, which has several lists of files for each type of
33
35
change, eg changes.added is a list of added files, changes.removed is list
34
36
of removed files, changes.modified is a list of modified files. The contents
35
 
of the lists aren't just filenames, but included other information as well.
36
 
To grab just the filename we want the first value, eg::
 
37
of the lists aren't just filenames, but include other information as well.
 
38
 To grab just the filename we want the first value, eg::
37
39
 
38
40
  print("list of newly added files")
39
41
  for filename in changes.added:
293
295
 
294
296
  revtree = repo.revision_tree(rev_id)
295
297
 
296
 
There's a lot going on in a RevisionTree, but there are a couple of things
297
 
that may be interesting::
298
 
 
299
 
  revtree.changes_from(other_revtree)
300
 
 
301
 
gives you a TreeDelta which you is a form of diff.
302
 
 
303
 
A more regular and precise comparison can be derived from
304
 
``Tree.iter_changes``::
305
 
 
306
 
  revtree.iter_changes(other_revtree)
307
 
 
308
 
See the API documentation for more details.
309
 
 
 
298
RevisionTrees, like all trees, can be compared as described in "Comparing
 
299
Trees" above.
310
300
 
311
301
The most common way to list files in a tree is ``Tree.iter_entries()``.
312
302
The simplest way to get file content is ``Tree.get_file()``.  The best way