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

def vcpx::source::UpdatableSourceWorkingDir::applyPendingChangesets (   self,
  applyable = None,
  replayable = None,
  replay = None,
  applied = None 
)

Apply the collected upstream changes.

Loop over the collected changesets, doing whatever is needed
to apply each one to the working dir and if the changes do
not raise conflicts call the `replay` function to mirror the
changes on the target.

Return a tuple of two elements:

- the last applied changeset, if any
- the sequence (potentially empty!) of conflicts.

Definition at line 65 of file source.py.

                                                         :
        """
        Apply the collected upstream changes.

        Loop over the collected changesets, doing whatever is needed
        to apply each one to the working dir and if the changes do
        not raise conflicts call the `replay` function to mirror the
        changes on the target.

        Return a tuple of two elements:

        - the last applied changeset, if any
        - the sequence (potentially empty!) of conflicts.
        """

        from time import sleep

        c = None
        last = None
        conflicts = []

        try:
            for c in self.state_file:
                # Give the opportunity to subclasses to stop the application
                # of the queue, before the application of the patch by the
                # source backend.
                if not self._willApplyChangeset(c, applyable):
                    self.log.debug('Stopping application at revisin %r',
                                   c.revision)
                    break

                # Sometime is better to wait a little while before each
                # changeset, to avoid upstream server stress.
                if self.repository.delay_before_apply:
                    sleep(self.repository.delay_before_apply)

                try:
                    res = self._applyChangeset(c)
                except ChangesetApplicationFailure, e:
                    self.log.critical("Couldn't apply changeset")
                    self.log.debug("Reason: %s", str(e))
                    self.log.debug("Changeset: %s", c)
                    raise
                except KeyboardInterrupt:
                    self.log.warning("INTERRUPTED BY THE USER!")
                    break
                except:
                    self.log.exception("Couldn't apply changeset\n%s", c)
                    raise

                if res:
                    # Uh, we have a conflict: this should not ever
                    # happen, but the user may have manually tweaked
                    # the working directory. Give her a chance of
                    # fixing the situation, or abort with Ctrl-C, or
                    # whatever the subclasses decide.
                    try:
                        self._handleConflict(c, conflicts, res)
                    except KeyboardInterrupt:
                        self.log.warning("INTERRUPTED BY THE USER!")
                        break

                # Give the opportunity to subclasses to skip the commit on
                # the target backend.
                if self._didApplyChangeset(c, replayable):
                    if replay:
                        try:
                            replay(c)
                        except ChangesetApplicationFailure, e:
                            self.log.critical("Couldn't reply changeset")
                            self.log.debug("Reason: %s", str(e))
                            self.log.debug("Changeset: %s", c)
                            raise
                        except:
                            self.log.exception("Couldn't reply changeset\n%s",
                                               c)
                            raise

                # Remember it for the finally clause and notify the state
                # file so that it gets removed from the queue
                last = c
                self.state_file.applied()

                # Another hook (last==c here)
                if applied:
                    applied(last)
        finally:
            # For whatever reason we exit the loop, save the last state
            self.state_file.finalize()

        return last, conflicts

    def _willApplyChangeset(self, changeset, applyable=None):


Generated by  Doxygen 1.6.0   Back to index