Logo Search packages:      
Sourcecode: tailor version File versions  Download package

def vcpx::target::SyncronizableTargetWorkingDir::_replayChangeset (   self,
  changeset 
) [private]

Replicate the actions performed by the changeset on the tree of
files.

Definition at line 260 of file target.py.

00260                                          :
        """
        Replicate the actions performed by the changeset on the tree of
        files.
        """

        from os.path import join, isdir

        added = changeset.addedEntries()
        renamed = changeset.renamedEntries()
        removed = changeset.removedEntries()

        # Sort added entries, to be sure that /root/addedDir/ comes
        # before /root/addedDir/addedSubdir
        added.sort(lambda x,y: cmp(x.name, y.name))

        # Sort removes in reverse order, to delete directories after
        # their contents.
        removed.sort(lambda x,y: cmp(y.name, x.name))

        # Replay the actions

        if renamed and removed:
            # Handle the "replace" operation, that is a remove+rename

            renames = [e.name for e in renamed]
            removesfirst = []
            for rem in removed:
                if rem.name in renames:
                    removesfirst.append(rem)

            if removesfirst:
                self._removeEntries(removesfirst)
                for rem in removesfirst:
                    removed.remove(rem)

        if renamed: self._renameEntries(renamed)
        if removed: self._removeEntries(removed)
        if added: self._addEntries(added)

        # Finally, deal with "copied" directories. The simple way is
        # executing an _addSubtree on each of them, evenif this may
        # cause "warnings" on items just moved/added above...

        while added:
            subdir = added.pop(0).name
            if isdir(join(self.basedir, subdir)):
                self._addSubtree(subdir)
                added = [e for e in added if not e.name.startswith(subdir)]

    def _addEntries(self, entries):


Generated by  Doxygen 1.6.0   Back to index