~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Vincent Ladeuil
  • Date: 2007-11-14 08:20:59 UTC
  • mfrom: (2990 +trunk)
  • mto: (2990.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2991.
  • Revision ID: v.ladeuil+lp@free.fr-20071114082059-bx03o3laiqfnyleb
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1326
1326
                        errors.PathsDoNotExist(paths=(str(from_rel),
1327
1327
                        str(to_rel))))
1328
1328
                else:
1329
 
                    raise errors.RenameFailedFilesExist(from_rel, to_rel,
1330
 
                        extra="(Use --after to update the Bazaar id)")
 
1329
                    raise errors.RenameFailedFilesExist(from_rel, to_rel)
1331
1330
            rename_entry.only_change_inv = only_change_inv
1332
1331
        return rename_entries
1333
1332
 
1541
1540
                                change_reporter=change_reporter)
1542
1541
                    if (basis_tree.inventory.root is None and
1543
1542
                        new_basis_tree.inventory.root is not None):
1544
 
                        self.set_root_id(new_basis_tree.inventory.root.file_id)
 
1543
                        self.set_root_id(new_basis_tree.get_root_id())
1545
1544
                finally:
1546
1545
                    pb.finished()
1547
1546
                    basis_tree.unlock()
2154
2153
            try:
2155
2154
                to_tree = self.branch.basis_tree()
2156
2155
                if basis.inventory.root is None:
2157
 
                    self.set_root_id(to_tree.inventory.root.file_id)
 
2156
                    self.set_root_id(to_tree.get_root_id())
2158
2157
                    self.flush()
2159
2158
                result += merge.merge_inner(
2160
2159
                                      self.branch,
2302
2301
            current_inv = None
2303
2302
            inv_finished = True
2304
2303
        while not inv_finished or not disk_finished:
 
2304
            if current_disk:
 
2305
                ((cur_disk_dir_relpath, cur_disk_dir_path_from_top),
 
2306
                    cur_disk_dir_content) = current_disk
 
2307
            else:
 
2308
                ((cur_disk_dir_relpath, cur_disk_dir_path_from_top),
 
2309
                    cur_disk_dir_content) = ((None, None), None)
2305
2310
            if not disk_finished:
2306
2311
                # strip out .bzr dirs
2307
 
                if current_disk[0][1][top_strip_len:] == '':
2308
 
                    # osutils.walkdirs can be made nicer - 
 
2312
                if (cur_disk_dir_path_from_top[top_strip_len:] == '' and
 
2313
                    len(cur_disk_dir_content) > 0):
 
2314
                    # osutils.walkdirs can be made nicer -
2309
2315
                    # yield the path-from-prefix rather than the pathjoined
2310
2316
                    # value.
2311
 
                    bzrdir_loc = bisect_left(current_disk[1], ('.bzr', '.bzr'))
2312
 
                    if current_disk[1][bzrdir_loc][0] == '.bzr':
 
2317
                    bzrdir_loc = bisect_left(cur_disk_dir_content,
 
2318
                        ('.bzr', '.bzr'))
 
2319
                    if cur_disk_dir_content[bzrdir_loc][0] == '.bzr':
2313
2320
                        # we dont yield the contents of, or, .bzr itself.
2314
 
                        del current_disk[1][bzrdir_loc]
 
2321
                        del cur_disk_dir_content[bzrdir_loc]
2315
2322
            if inv_finished:
2316
2323
                # everything is unknown
2317
2324
                direction = 1
2319
2326
                # everything is missing
2320
2327
                direction = -1
2321
2328
            else:
2322
 
                direction = cmp(current_inv[0][0], current_disk[0][0])
 
2329
                direction = cmp(current_inv[0][0], cur_disk_dir_relpath)
2323
2330
            if direction > 0:
2324
2331
                # disk is before inventory - unknown
2325
2332
                dirblock = [(relpath, basename, kind, stat, None, None) for
2326
 
                    relpath, basename, kind, stat, top_path in current_disk[1]]
2327
 
                yield (current_disk[0][0], None), dirblock
 
2333
                    relpath, basename, kind, stat, top_path in
 
2334
                    cur_disk_dir_content]
 
2335
                yield (cur_disk_dir_relpath, None), dirblock
2328
2336
                try:
2329
2337
                    current_disk = disk_iterator.next()
2330
2338
                except StopIteration:
2332
2340
            elif direction < 0:
2333
2341
                # inventory is before disk - missing.
2334
2342
                dirblock = [(relpath, basename, 'unknown', None, fileid, kind)
2335
 
                    for relpath, basename, dkind, stat, fileid, kind in 
 
2343
                    for relpath, basename, dkind, stat, fileid, kind in
2336
2344
                    current_inv[1]]
2337
2345
                yield (current_inv[0][0], current_inv[0][1]), dirblock
2338
2346
                try:
2344
2352
                # merge the inventory and disk data together
2345
2353
                dirblock = []
2346
2354
                for relpath, subiterator in itertools.groupby(sorted(
2347
 
                    current_inv[1] + current_disk[1], key=operator.itemgetter(0)), operator.itemgetter(1)):
 
2355
                    current_inv[1] + cur_disk_dir_content,
 
2356
                    key=operator.itemgetter(0)), operator.itemgetter(1)):
2348
2357
                    path_elements = list(subiterator)
2349
2358
                    if len(path_elements) == 2:
2350
2359
                        inv_row, disk_row = path_elements
2733
2742
                         _bzrdir=a_bzrdir)
2734
2743
        basis_tree = branch.repository.revision_tree(revision_id)
2735
2744
        if basis_tree.inventory.root is not None:
2736
 
            wt.set_root_id(basis_tree.inventory.root.file_id)
 
2745
            wt.set_root_id(basis_tree.get_root_id())
2737
2746
        # set the parent list and cache the basis tree.
2738
2747
        if _mod_revision.is_null(revision_id):
2739
2748
            parent_trees = []
2838
2847
            basis_tree = branch.repository.revision_tree(revision_id)
2839
2848
            # only set an explicit root id if there is one to set.
2840
2849
            if basis_tree.inventory.root is not None:
2841
 
                wt.set_root_id(basis_tree.inventory.root.file_id)
 
2850
                wt.set_root_id(basis_tree.get_root_id())
2842
2851
            if revision_id == NULL_REVISION:
2843
2852
                wt.set_parent_trees([])
2844
2853
            else: