/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 bzrlib/dirstate.py

  • Committer: Martin Pool
  • Date: 2007-10-09 04:09:40 UTC
  • mto: This revision was merged to the branch mainline in revision 2899.
  • Revision ID: mbp@sourcefrog.net-20071009040940-yjwm33zkzp033j8q
Review documentation cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
1865
1865
                "set_state_from_inventory called; please mutate the tree instead")
1866
1866
        self._read_dirblocks_if_needed()
1867
1867
        # sketch:
1868
 
        # incremental algorithm:
1869
 
        # two iterators: current data and new data, both in dirblock order. 
 
1868
        # Two iterators: current data and new data, both in dirblock order. 
 
1869
        # We zip them together, which tells about entries that are new in the
 
1870
        # inventory, or removed in the inventory, or present in both and
 
1871
        # possibly changed.  
 
1872
        #
 
1873
        # You might think we could just synthesize a new dirstate directly
 
1874
        # since we're processing it in the right order.  However, we need to
 
1875
        # also consider there may be any number of parent trees and relocation
 
1876
        # pointers, and we don't want to duplicate that here.
1870
1877
        new_iterator = new_inv.iter_entries_by_dir()
1871
1878
        # we will be modifying the dirstate, so we need a stable iterator. In
1872
1879
        # future we might write one, for now we just clone the state into a
1875
1882
        # both must have roots so this is safe:
1876
1883
        current_new = new_iterator.next()
1877
1884
        current_old = old_iterator.next()
1878
 
        # XXX: if we're generating things in order, why do we need to call
1879
 
        # update_minimal, rather than just generating the whole list in one
1880
 
        # go?
1881
1885
        def advance(iterator):
1882
1886
            try:
1883
1887
                return iterator.next()
1911
1915
                    new_entry_key = None
1912
1916
            # 5 cases, we dont have a value that is strictly greater than everything, so
1913
1917
            # we make both end conditions explicit
1914
 
            if current_old is None:
 
1918
            if not current_old:
1915
1919
                # old is finished: insert current_new into the state.
1916
1920
                self.update_minimal(new_entry_key, current_new_minikind,
1917
1921
                    executable=current_new[1].executable,
1918
1922
                    path_utf8=new_path_utf8, fingerprint=fingerprint)
1919
1923
                current_new = advance(new_iterator)
1920
 
            elif current_new is None:
 
1924
            elif not current_new:
1921
1925
                # new is finished
1922
1926
                self._make_absent(current_old)
1923
1927
                current_old = advance(old_iterator)