~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
98
98
    def iter_changes(self, from_tree, include_unchanged=False,
99
99
                     specific_files=None, pb=None, extra_trees=None,
100
100
                     require_versioned=True, want_unversioned=False):
 
101
        """See InterTree.iter_changes"""
101
102
        intertree = InterTree.get(from_tree, self)
102
103
        return intertree.iter_changes(include_unchanged, specific_files, pb,
103
104
            extra_trees, require_versioned, want_unversioned=want_unversioned)
404
405
            bit_iter = iter(path.split("/"))
405
406
            for elt in bit_iter:
406
407
                lelt = elt.lower()
 
408
                new_path = None
407
409
                for child in self.iter_children(cur_id):
408
410
                    try:
 
411
                        # XXX: it seem like if the child is known to be in the
 
412
                        # tree, we shouldn't need to go from its id back to
 
413
                        # its path -- mbp 2010-02-11
 
414
                        #
 
415
                        # XXX: it seems like we could be more efficient
 
416
                        # by just directly looking up the original name and
 
417
                        # only then searching all children; also by not
 
418
                        # chopping paths so much. -- mbp 2010-02-11
409
419
                        child_base = os.path.basename(self.id2path(child))
410
 
                        if child_base.lower() == lelt:
 
420
                        if (child_base == elt):
 
421
                            # if we found an exact match, we can stop now; if
 
422
                            # we found an approximate match we need to keep
 
423
                            # searching because there might be an exact match
 
424
                            # later.  
411
425
                            cur_id = child
412
 
                            cur_path = osutils.pathjoin(cur_path, child_base)
 
426
                            new_path = osutils.pathjoin(cur_path, child_base)
413
427
                            break
 
428
                        elif child_base.lower() == lelt:
 
429
                            cur_id = child
 
430
                            new_path = osutils.pathjoin(cur_path, child_base)
414
431
                    except NoSuchId:
415
432
                        # before a change is committed we can see this error...
416
433
                        continue
 
434
                if new_path:
 
435
                    cur_path = new_path
417
436
                else:
418
437
                    # got to the end of this directory and no entries matched.
419
438
                    # Return what matched so far, plus the rest as specified.