~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

Tree Transform-based merger

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
                           NotBranchError,
62
62
                           NoSuchFile,
63
63
                           NotVersionedError)
64
 
from bzrlib.inventory import InventoryEntry
 
64
from bzrlib.inventory import InventoryEntry, Inventory
65
65
from bzrlib.lockable_files import LockableFiles
66
66
from bzrlib.merge import merge_inner, transform_tree
67
67
from bzrlib.osutils import (appendpath,
78
78
                            normpath,
79
79
                            realpath,
80
80
                            relpath,
81
 
                            rename)
 
81
                            rename,
 
82
                            supports_executable,
 
83
                            )
82
84
from bzrlib.revision import NULL_REVISION
83
85
from bzrlib.symbol_versioning import *
84
86
from bzrlib.textui import show_status
85
87
import bzrlib.tree
86
88
from bzrlib.trace import mutter
 
89
from bzrlib.transform import build_tree
87
90
from bzrlib.transport import get_transport
88
91
from bzrlib.transport.local import LocalTransport
89
92
import bzrlib.xml5
484
487
        return self._hashcache.get_sha1(path)
485
488
 
486
489
    def is_executable(self, file_id):
487
 
        if os.name == "nt":
 
490
        if not supports_executable():
488
491
            return self._inventory[file_id].executable
489
492
        else:
490
493
            path = self._inventory.id2path(file_id)
1075
1078
 
1076
1079
    @needs_write_lock
1077
1080
    def revert(self, filenames, old_tree=None, backups=True):
1078
 
        from bzrlib.merge import merge_inner
 
1081
        from transform import revert
1079
1082
        if old_tree is None:
1080
1083
            old_tree = self.basis_tree()
1081
 
        merge_inner(self.branch, old_tree,
1082
 
                    self, ignore_zero=True,
1083
 
                    backup_files=backups, 
1084
 
                    interesting_files=filenames,
1085
 
                    this_tree=self)
 
1084
        revert(self, old_tree, filenames, backups)
1086
1085
        if not len(filenames):
1087
1086
            self.set_pending_merges([])
1088
1087
 
1330
1329
            finally:
1331
1330
                branch.unlock()
1332
1331
        revision = branch.last_revision()
1333
 
        basis_tree = branch.repository.revision_tree(revision)
1334
 
        inv = basis_tree.inventory
 
1332
        inv = Inventory() 
1335
1333
        wt = WorkingTree(a_bzrdir.root_transport.base,
1336
1334
                         branch,
1337
1335
                         inv,
1342
1340
        wt.set_root_id(inv.root.file_id)
1343
1341
        wt.set_last_revision(revision)
1344
1342
        wt.set_pending_merges([])
1345
 
        wt.revert([])
 
1343
        build_tree(wt.basis_tree(), wt)
1346
1344
        return wt
1347
1345
 
1348
1346
    def __init__(self):
1390
1388
        branch = a_bzrdir.open_branch()
1391
1389
        if revision_id is None:
1392
1390
            revision_id = branch.last_revision()
1393
 
        new_basis_tree = branch.repository.revision_tree(revision_id)
1394
 
        inv = new_basis_tree.inventory
 
1391
        inv = Inventory() 
1395
1392
        wt = WorkingTree3(a_bzrdir.root_transport.base,
1396
1393
                         branch,
1397
1394
                         inv,
1402
1399
        wt.set_root_id(inv.root.file_id)
1403
1400
        wt.set_last_revision(revision_id)
1404
1401
        wt.set_pending_merges([])
1405
 
        wt.revert([])
 
1402
        build_tree(wt.basis_tree(), wt)
1406
1403
        return wt
1407
1404
 
1408
1405
    def __init__(self):