Exemple #1
0
    def temp_copy(self):
        """Yields a new Vcs object that represents a temporary, disposable
        copy of the current repository. The copy is deleted at the end
        of the context.

        The following are not copied:
        - ignored files
        - easyci private directory (.git/eci for git)

        Yields:
            Vcs
        """
        with contextmanagers.temp_dir() as temp_dir:
            temp_root_path = os.path.join(temp_dir, "root")
            path = os.path.join(self.path, "")  # adds trailing slash
            check_call(
                [
                    "rsync",
                    "-r",
                    "--exclude={}".format(self.private_dir()),
                    "--filter=dir-merge,- {}".format(self.ignore_patterns_file()),
                    path,
                    temp_root_path,
                ]
            )
            copy = self.__class__(path=temp_root_path)
            yield copy
Exemple #2
0
    def temp_copy(self):
        """Yields a new Vcs object that represents a temporary, disposable
        copy of the current repository. The copy is deleted at the end
        of the context.

        The following are not copied:
        - ignored files
        - easyci private directory (.git/eci for git)

        Yields:
            Vcs
        """
        with contextmanagers.temp_dir() as temp_dir:
            temp_root_path = os.path.join(temp_dir, 'root')
            path = os.path.join(self.path, '')  # adds trailing slash
            check_call([
                'rsync', '-r', "--exclude={}".format(self.private_dir()),
                "--filter=dir-merge,- {}".format(self.ignore_patterns_file()),
                path, temp_root_path
            ])
            copy = self.__class__(path=temp_root_path)
            yield copy
Exemple #3
0
def vcs():
    with contextmanagers.temp_dir() as temp_dir:
        os.makedirs(os.path.join(temp_dir, '.dummy/eci'))
        yield DummyVcs(path=temp_dir)
Exemple #4
0
def temp_path():
    with contextmanagers.temp_dir() as temp_dir:
        yield temp_dir
Exemple #5
0
def temp_path():
    with contextmanagers.temp_dir() as temp:
        with contextmanagers.chdir(temp):
            yield temp
Exemple #6
0
def repo_path():
    with contextmanagers.temp_dir() as temp_dir:
        os.mkdir(os.path.join(temp_dir, '.git'))
        yield temp_dir
Exemple #7
0
def vcs():
    with contextmanagers.temp_dir() as temp_dir:
        os.makedirs(os.path.join(temp_dir, '.dummy/eci'))
        yield DummyVcs(path=temp_dir)
def test_temp_dir():
    with contextmanagers.temp_dir() as temp_dir:
        assert os.path.exists(temp_dir)
        assert os.path.isdir(temp_dir)
    assert not os.path.exists(temp_dir)
Exemple #9
0
def temp_path():
    with contextmanagers.temp_dir() as temp:
        with contextmanagers.chdir(temp):
            yield temp
Exemple #10
0
def temp_path():
    with contextmanagers.temp_dir() as temp_dir:
        yield temp_dir