Beispiel #1
0
    def setup_quoting(self):
        """
        Set QuotedRPath versions of important RPaths if chars_to_quote is set.

        Return True if quoting needed to be done, False else.
        """
        # FIXME the problem is that the chars_to_quote can come from the command
        # line but can also be a value coming from the repository itself,
        # set globally by the fs_abilities.xxx_set_globals functions.
        if not Globals.chars_to_quote:
            return False

        if Globals.get_api_version() < 201:  # compat200
            FilenameMapping.set_init_quote_vals()
            self.base_dir = FilenameMapping.get_quotedrpath(self.base_dir)
            self.data_dir = FilenameMapping.get_quotedrpath(self.data_dir)
            self.incs_dir = FilenameMapping.get_quotedrpath(self.incs_dir)
        else:
            self.base_dir = map_filenames.get_quotedrpath(self.base_dir)
            self.data_dir = map_filenames.get_quotedrpath(self.data_dir)
            self.incs_dir = map_filenames.get_quotedrpath(self.incs_dir)

        Globals.set_all('rbdir', self.data_dir)  # compat200

        return True
    def set_chars_to_quote(self, rbdir):
        """Set chars_to_quote setting for backup session

        Unlike most other options, the chars_to_quote setting also
        depends on the current settings in the rdiff-backup-data
        directory, not just the current fs features.

        """
        ctq = self._compare_ctq_file(rbdir, self._get_ctq_from_fsas())

        Globals.set_all('chars_to_quote', ctq)
        if Globals.chars_to_quote:
            FilenameMapping.set_init_quote_vals()
Beispiel #3
0
	def getinc_paths(self, basename, directory, quoted = 0):
		"""Return increment.______.dir paths"""
		if quoted:
			FilenameMapping.set_init_quote_vals()
			dirrp = FilenameMapping.QuotedRPath(Globals.local_connection,
												  directory)
		else: dirrp = rpath.RPath(Globals.local_connection, directory)
		incbasenames = [filename for filename in robust.listrp(dirrp)
						if filename.startswith(basename)]
		incbasenames.sort()
		incrps = map(dirrp.append, incbasenames)
		return map(lambda x: x.path,
				   filter(lambda incrp: incrp.isincfile(), incrps))
Beispiel #4
0
 def getinc_paths(self, basename, directory, quoted=0):
     """Return increment.______.dir paths"""
     if quoted:
         FilenameMapping.set_init_quote_vals()
         dirrp = FilenameMapping.QuotedRPath(Globals.local_connection,
                                             directory)
     else:
         dirrp = rpath.RPath(Globals.local_connection, directory)
     incbasenames = [
         filename for filename in robust.listrp(dirrp)
         if filename.startswith(basename)
     ]
     incbasenames.sort()
     incrps = map(dirrp.append, incbasenames)
     return map(lambda x: x.path,
                filter(lambda incrp: incrp.isincfile(), incrps))
Beispiel #5
0
    def getinc_paths(self, basename, directory, quoted=0):
        """Returns a sorted list of files which starts with basename
        within a given directory."""

        if quoted:
            FilenameMapping.set_init_quote_vals()
            dirrp = FilenameMapping.QuotedRPath(Globals.local_connection,
                                                directory)
        else:
            dirrp = rpath.RPath(Globals.local_connection, directory)
        incbasenames = [
            filename for filename in robust.listrp(dirrp)
            if filename.startswith(basename)
        ]
        incbasenames.sort()
        incrps = list(map(dirrp.append, incbasenames))
        return [
            x.path for x in [incrp for incrp in incrps if incrp.isincfile()]
        ]
 def setUp(self):
     """Just initialize quoting"""
     Globals.chars_to_quote = "A-Z"
     FilenameMapping.set_init_quote_vals()
Beispiel #7
0
 def setUp(self):
     """Just initialize quoting"""
     Globals.chars_to_quote = b'A-Z'
     FilenameMapping.set_init_quote_vals()