~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
WorkingTree.open(dir).
23
23
"""
24
24
 
 
25
from __future__ import absolute_import
 
26
 
25
27
from cStringIO import StringIO
26
28
import os
27
29
import sys
55
57
from bzrlib.lock import LogicalLockResult
56
58
from bzrlib.lockable_files import LockableFiles
57
59
from bzrlib.lockdir import LockDir
58
 
from bzrlib.mutabletree import needs_tree_write_lock
 
60
from bzrlib.mutabletree import (
 
61
    MutableTree,
 
62
    needs_tree_write_lock,
 
63
    )
59
64
from bzrlib.osutils import (
60
65
    file_kind,
61
66
    isdir,
476
481
            return False # Missing entries are not executable
477
482
        return entry[1][0][3] # Executable?
478
483
 
479
 
    if not osutils.supports_executable():
480
 
        def is_executable(self, file_id, path=None):
481
 
            """Test if a file is executable or not.
 
484
    def is_executable(self, file_id, path=None):
 
485
        """Test if a file is executable or not.
482
486
 
483
 
            Note: The caller is expected to take a read-lock before calling this.
484
 
            """
 
487
        Note: The caller is expected to take a read-lock before calling this.
 
488
        """
 
489
        if not self._supports_executable():
485
490
            entry = self._get_entry(file_id=file_id, path=path)
486
491
            if entry == (None, None):
487
492
                return False
488
493
            return entry[1][0][3]
489
 
 
490
 
        _is_executable_from_path_and_stat = \
491
 
            _is_executable_from_path_and_stat_from_basis
492
 
    else:
493
 
        def is_executable(self, file_id, path=None):
494
 
            """Test if a file is executable or not.
495
 
 
496
 
            Note: The caller is expected to take a read-lock before calling this.
497
 
            """
 
494
        else:
498
495
            self._must_be_locked()
499
496
            if not path:
500
497
                path = self.id2path(file_id)
1484
1481
        control_files = self._open_control_files(a_bzrdir)
1485
1482
        control_files.create_lock()
1486
1483
        control_files.lock_write()
1487
 
        transport.put_bytes('format', self.get_format_string(),
 
1484
        transport.put_bytes('format', self.as_string(),
1488
1485
            mode=a_bzrdir._get_file_mode())
1489
1486
        if from_branch is not None:
1490
1487
            branch = from_branch
1550
1547
                transform.build_tree(basis, wt, accelerator_tree,
1551
1548
                                     hardlink=hardlink,
1552
1549
                                     delta_from_tree=delta_from_tree)
 
1550
                for hook in MutableTree.hooks['post_build_tree']:
 
1551
                    hook(wt)
1553
1552
            finally:
1554
1553
                basis.unlock()
1555
1554
        finally:
2266
2265
    def update_format(self, tree):
2267
2266
        """Change the format marker."""
2268
2267
        tree._transport.put_bytes('format',
2269
 
            self.target_format.get_format_string(),
 
2268
            self.target_format.as_string(),
2270
2269
            mode=tree.bzrdir._get_file_mode())
2271
2270
 
2272
2271
 
2289
2288
    def update_format(self, tree):
2290
2289
        """Change the format marker."""
2291
2290
        tree._transport.put_bytes('format',
2292
 
            self.target_format.get_format_string(),
 
2291
            self.target_format.as_string(),
2293
2292
            mode=tree.bzrdir._get_file_mode())
2294
2293
 
2295
2294
 
2318
2317
    def update_format(self, tree):
2319
2318
        """Change the format marker."""
2320
2319
        tree._transport.put_bytes('format',
2321
 
            self.target_format.get_format_string(),
 
2320
            self.target_format.as_string(),
2322
2321
            mode=tree.bzrdir._get_file_mode())