Esempio n. 1
0
    def _replayChangeset(self, changeset):
        """
        Under Codeville, it's safer to explicitly edit modified items.
        """

        SynchronizableTargetWorkingDir._replayChangeset(self, changeset)

        names = [e.name for e in changeset.modifiedEntries()]
        cmd = self.repository.command("edit")
        ExternalCommand(cwd=self.repository.basedir, command=cmd).execute(names)
Esempio n. 2
0
    def _initializeWorkingDir(self):
        """
        Add the given directory to an already existing svn working tree.
        """

        from os.path import exists, join

        if not exists(join(self.repository.basedir, self.repository.METADIR)):
            raise TargetInitializationFailure("'%s' needs to be an SVN working copy already under SVN" % self.repository.basedir)

        SynchronizableTargetWorkingDir._initializeWorkingDir(self)
Esempio n. 3
0
    def _initializeWorkingDir(self):
        """
        Add the given directory to an already existing svn working tree.
        """

        from os.path import exists, join

        if not exists(join(self.repository.basedir, self.repository.METADIR)):
            raise TargetInitializationFailure(
                "'%s' needs to be an SVN working copy already under SVN" %
                self.repository.basedir)

        SynchronizableTargetWorkingDir._initializeWorkingDir(self)
Esempio n. 4
0
    def _initializeWorkingDir(self):
        """
        Setup the ArX working copy

        The user must setup a ArX working directory himself. Then
        we simply use 'arx commit', without having to specify an archive
        or branch. ArX looks up the archive and branch in it's _arx
        directory.
        """

        from os.path import exists, join

        if not exists(join(self.repository.basedir, '_arx')):
            raise TargetInitializationFailure("Please setup '%s' as an ArX working directory" % self.repository.basedir)

        SynchronizableTargetWorkingDir._initializeWorkingDir(self)
Esempio n. 5
0
    def _initializeWorkingDir(self):
        """
        Setup the monotone working copy

        The user must setup a monotone working directory himself or use the
        tailor config file to provide parameters for creation. Then
        we simply use 'mtn commit', without having to specify a database
        file or branch. Monotone looks up the database and branch in it's _MTN
        directory.
        """

        if not exists(join(self.repository.basedir, '_MTN')):
            raise TargetInitializationFailure("Please setup '%s' as a "
                                              "monotone working directory" %
                                              self.repository.basedir)

        SynchronizableTargetWorkingDir._initializeWorkingDir(self)
Esempio n. 6
0
    def _initializeWorkingDir(self):
        """
        Setup the monotone working copy

        The user must setup a monotone working directory himself or use the
        tailor config file to provide parameters for creation. Then
        we simply use 'mtn commit', without having to specify a database
        file or branch. Monotone looks up the database and branch in it's _MTN
        directory.
        """

        if not exists(join(self.repository.basedir, '_MTN')):
            raise TargetInitializationFailure("Please setup '%s' as a "
                                              "monotone working directory" %
                                              self.repository.basedir)

        SynchronizableTargetWorkingDir._initializeWorkingDir(self)
Esempio n. 7
0
    def _initializeWorkingDir(self):
        """
        Setup the ArX working copy

        The user must setup a ArX working directory himself. Then
        we simply use 'arx commit', without having to specify an archive
        or branch. ArX looks up the archive and branch in it's _arx
        directory.
        """

        from os.path import exists, join

        if not exists(join(self.repository.basedir, '_arx')):
            raise TargetInitializationFailure(
                "Please setup '%s' as an ArX working directory" %
                self.repository.basedir)

        SynchronizableTargetWorkingDir._initializeWorkingDir(self)
Esempio n. 8
0
    def _adaptChangeset(self, changeset):
        project_files = self.repository.project_file_list_get()

        from copy import deepcopy
        adapted = deepcopy(changeset)

        #
        # adapt the entries:
        # * delete directory entries
        # * delete entries with action_kind REMOVE not in the repository (DEL => )
        # * change to ADD a rename of a file non in the repository (REN => ADD)
        # * remove from the changeset entries whith 2 operation (REN + UPD => REN);
        # * change the ADD action_kind for files already in the repository (ADD => UPD);
        # * change the UPD action_kind for files *non* in the repository (UPD => ADD);
        #
        for e in adapted.entries[:]:
            if e.is_directory or e.is_symlink:
                adapted.entries.remove(e)
                continue
            if e.action_kind == e.DELETED and not project_files.count(e.name):
                self.log.info("remove delete entry %s", e.name)
                adapted.entries.remove(e)

        renamed_file = []
        for e in adapted.entries:
            if e.action_kind == e.RENAMED:
                renamed_file.append(e.name)

        for e in adapted.entries[:]:
            if renamed_file.count(e.name) and e.action_kind != e.RENAMED:
                adapted.entries.remove(e)
            if e.action_kind == e.RENAMED and not project_files.count(
                    e.old_name):
                e.action_kind = e.ADDED
                e.old_name = None
            if e.action_kind == e.ADDED and project_files.count(e.name):
                e.action_kind = ChangesetEntry.UPDATED
            elif e.action_kind == e.UPDATED and not project_files.count(
                    e.name):
                e.action_kind = e.ADDED

        #
        # Returns even if the changeset does not contain entries to
        # give the opportunity to still register tags.
        #
        return SynchronizableTargetWorkingDir._adaptChangeset(self, adapted)
Esempio n. 9
0
    def _adaptChangeset(self, changeset):
        project_files = self.repository.project_file_list_get()

        from copy import deepcopy
        adapted = deepcopy(changeset)

        #
        # adapt the entries:
        # * delete directory entries
        # * delete entries with action_kind REMOVE not in the repository (DEL => )
        # * change to ADD a rename of a file non in the repository (REN => ADD)
        # * remove from the changeset entries whith 2 operation (REN + UPD => REN);
        # * change the ADD action_kind for files already in the repository (ADD => UPD);
        # * change the UPD action_kind for files *non* in the repository (UPD => ADD);
        #
        for e in adapted.entries[:]:
            if e.is_directory or e.is_symlink:
                adapted.entries.remove(e)
                continue
            if e.action_kind == e.DELETED and not project_files.count(e.name):
                self.log.info("remove delete entry %s", e.name)
                adapted.entries.remove(e)

        renamed_file = []
        for e in adapted.entries:
            if e.action_kind == e.RENAMED:
                renamed_file.append(e.name)

        for e in adapted.entries[:]:
            if renamed_file.count(e.name) and e.action_kind != e.RENAMED:
                adapted.entries.remove(e)
            if e.action_kind == e.RENAMED and not project_files.count(e.old_name):
                e.action_kind = e.ADDED
                e.old_name = None
            if e.action_kind == e.ADDED and project_files.count(e.name):
                e.action_kind = ChangesetEntry.UPDATED
            elif e.action_kind == e.UPDATED and not project_files.count(e.name):
                e.action_kind = e.ADDED

        #
        # Returns even if the changeset does not contain entries to
        # give the opportunity to still register tags.
        #
        return SynchronizableTargetWorkingDir._adaptChangeset(self, adapted)
Esempio n. 10
0
    def _adaptEntries(self, changeset):
        """
        Filter out boring files.
        """

        from copy import copy

        adapted = SynchronizableTargetWorkingDir._adaptEntries(self, changeset)

        # If there are no entries or no rules, there's nothing to do
        if not adapted or not adapted.entries or not self.__unwanted_entries:
            return adapted

        entries = []
        skipped = False
        for e in adapted.entries:
            skip = False
            for rx in self.__unwanted_entries:
                if rx.search(e.name):
                    skip = True
                    break
            if skip:
                self.log.info('Entry "%s" skipped per boring rules', e.name)
                skipped = True
            else:
                entries.append(e)

        # All entries are gone, don't commit this changeset
        if not entries:
            self.log.info(
                'All entries ignored, skipping whole '
                'changeset "%s"', changeset.revision)
            return None

        if skipped:
            adapted = copy(adapted)
            adapted.entries = entries

        return adapted
Esempio n. 11
0
    def _adaptEntries(self, changeset):
        """
        Filter out boring files.
        """

        from copy import copy

        adapted = SynchronizableTargetWorkingDir._adaptEntries(self, changeset)

        # If there are no entries or no rules, there's nothing to do
        if not adapted or not adapted.entries or not self.__unwanted_entries:
            return adapted

        entries = []
        skipped = False
        for e in adapted.entries:
            skip = False
            for rx in self.__unwanted_entries:
                if rx.search(e.name):
                    skip = True
                    break
            if skip:
                self.log.info('Entry "%s" skipped per boring rules', e.name)
                skipped = True
            else:
                entries.append(e)

        # All entries are gone, don't commit this changeset
        if not entries:
            self.log.info('All entries ignored, skipping whole '
                          'changeset "%s"', changeset.revision)
            return None

        if skipped:
            adapted = copy(adapted)
            adapted.entries = entries

        return adapted
Esempio n. 12
0
 def importFirstRevision(self, source_repo, changeset, initial):
     # If we have a parent repository, always track from INITIAL
     SynchronizableTargetWorkingDir.importFirstRevision(
         self, source_repo, changeset, initial
         or self.repository.branch_point)
Esempio n. 13
0
 def importFirstRevision(self, source_repo, changeset, initial):
     # If we have a parent repository, always track from INITIAL
     SynchronizableTargetWorkingDir.importFirstRevision(
         self, source_repo, changeset,
         initial or self.repository.branch_point)