Exemplo n.º 1
0
    def _syncTargetWithSource(self):
        cmd = ['rsync', '--archive']
        now = datetime.now()
        if hasattr(self, '_last_rsync'):
            last = self._last_rsync
            if not (now-last).seconds:
                cmd.append('--ignore-times')
        self._last_rsync = now
        for M in IGNORED_METADIRS:
            cmd.extend(['--exclude', M])

        rsync = ExternalCommand(command=cmd)
        rsync.execute(self.source.repository.basedir+'/', self.target.repository.basedir)
Exemplo n.º 2
0
    def _syncTargetWithSource(self):
        cmd = ['rsync', '--archive']
        now = datetime.now()
        if hasattr(self, '_last_rsync'):
            last = self._last_rsync
            if not (now - last).seconds:
                cmd.append('--ignore-times')
        self._last_rsync = now
        for M in IGNORED_METADIRS:
            cmd.extend(['--exclude', M])

        rsync = ExternalCommand(command=cmd)
        rsync.execute(self.source.repository.basedir + '/',
                      self.target.repository.basedir)
Exemplo n.º 3
0
    def applyPatch(self, working_dir, patch_options="-p1"):
        """
        Apply the changeset using ``patch(1)`` to a given directory.
        """

        from shwrap import ExternalCommand
        from source import ChangesetApplicationFailure

        if self.unidiff:
            cmd = ["patch"]
            if patch_options:
                if isinstance(patch_options, basestring):
                    cmd.extend(patch_options.split(' '))
                else:
                    cmd.extend(patch_options)

            patch = ExternalCommand(cwd=working_dir, command=cmd)
            patch.execute(input=self.unidiff)

            if patch.exit_status:
                raise ChangesetApplicationFailure(
                    "%s returned status %s" % (str(patch), patch.exit_status))
Exemplo n.º 4
0
    def applyPatch(self, working_dir, patch_options="-p1"):
        """
        Apply the changeset using ``patch(1)`` to a given directory.
        """

        from shwrap import ExternalCommand
        from source import ChangesetApplicationFailure

        if self.unidiff:
            cmd = ["patch"]
            if patch_options:
                if isinstance(patch_options, basestring):
                    cmd.extend(patch_options.split(' '))
                else:
                    cmd.extend(patch_options)

            patch = ExternalCommand(cwd=working_dir, command=cmd)
            patch.execute(input=self.unidiff)

            if patch.exit_status:
                raise ChangesetApplicationFailure(
                    "%s returned status %s" % (str(patch), patch.exit_status))