~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-23 19:08:05 UTC
  • mfrom: (6437.3.20 2.5)
  • mto: This revision was merged to the branch mainline in revision 6450.
  • Revision ID: jelmer@samba.org-20120123190805-hlcuihkt2dep44cw
merge bzr 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
import os
18
20
import errno
19
21
from stat import S_ISREG, S_IEXEC
48
50
                           ExistingLimbo, ImmortalLimbo, NoFinalPath,
49
51
                           UnableCreateSymlink)
50
52
from bzrlib.filters import filtered_output_bytes, ContentFilterContext
 
53
from bzrlib.mutabletree import MutableTree
51
54
from bzrlib.osutils import (
52
55
    delete_any,
53
56
    file_kind,
55
58
    pathjoin,
56
59
    sha_file,
57
60
    splitpath,
58
 
    supports_executable,
59
61
    )
60
62
from bzrlib.progress import ProgressPhase
61
63
from bzrlib.symbol_versioning import (
154
156
        """
155
157
        if self._tree is None:
156
158
            return
 
159
        for hook in MutableTree.hooks['post_transform']:
 
160
            hook(self._tree, self)
157
161
        self._tree.unlock()
158
162
        self._tree = None
159
163
 
228
232
        irrelevant.
229
233
 
230
234
        """
231
 
        new_roots = [k for k, v in self._new_parent.iteritems() if v is
 
235
        new_roots = [k for k, v in self._new_parent.iteritems() if v ==
232
236
                     ROOT_PARENT]
233
237
        if len(new_roots) < 1:
234
238
            return
624
628
        for trans_id in self._new_parent:
625
629
            seen = set()
626
630
            parent_id = trans_id
627
 
            while parent_id is not ROOT_PARENT:
 
631
            while parent_id != ROOT_PARENT:
628
632
                seen.add(parent_id)
629
633
                try:
630
634
                    parent_id = self.final_parent(parent_id)
640
644
        """If parent directories are versioned, children must be versioned."""
641
645
        conflicts = []
642
646
        for parent_id, children in by_parent.iteritems():
643
 
            if parent_id is ROOT_PARENT:
 
647
            if parent_id == ROOT_PARENT:
644
648
                continue
645
649
            if self.final_file_id(parent_id) is not None:
646
650
                continue
739
743
        """Children must have a directory parent"""
740
744
        conflicts = []
741
745
        for parent_id, children in by_parent.iteritems():
742
 
            if parent_id is ROOT_PARENT:
 
746
            if parent_id == ROOT_PARENT:
743
747
                continue
744
748
            no_children = True
745
749
            for child_id in children:
761
765
 
762
766
    def _set_executability(self, path, trans_id):
763
767
        """Set the executability of versioned files """
764
 
        if supports_executable():
 
768
        if self._tree._supports_executable():
765
769
            new_executability = self._new_executability[trans_id]
766
770
            abspath = self._tree.abspath(path)
767
771
            current_mode = os.stat(abspath).st_mode
1231
1235
        finally:
1232
1236
            TreeTransformBase.finalize(self)
1233
1237
 
 
1238
    def _limbo_supports_executable(self):
 
1239
        """Check if the limbo path supports the executable bit."""
 
1240
        # FIXME: Check actual file system capabilities of limbodir
 
1241
        return osutils.supports_executable()
 
1242
 
1234
1243
    def _limbo_name(self, trans_id):
1235
1244
        """Generate the limbo name of a file"""
1236
1245
        limbo_name = self._limbo_files.get(trans_id)
1715
1724
            calculating one.
1716
1725
        :param _mover: Supply an alternate FileMover, for testing
1717
1726
        """
 
1727
        for hook in MutableTree.hooks['pre_transform']:
 
1728
            hook(self._tree, self)
1718
1729
        if not no_conflicts:
1719
1730
            self._check_malformed()
1720
1731
        child_pb = ui.ui_factory.nested_progress_bar()
2319
2330
            if kind == 'file':
2320
2331
                statval = os.lstat(limbo_name)
2321
2332
                size = statval.st_size
2322
 
                if not supports_executable():
 
2333
                if not tt._limbo_supports_executable():
2323
2334
                    executable = False
2324
2335
                else:
2325
2336
                    executable = statval.st_mode & S_IEXEC