def archive(self, ref, destination, *archive_args):
        tmp_dir = tempfile.mkdtemp()
        tar_file = None

        try:
            # create our git interface via the sh module
            # see:
            # github.com/stackstrap/stackstrap/blob/master/scripts/loose_ssh.sh
            git = sh.git.bake(_cwd=tmp_dir, _env={
                'GIT_SSH': "loose_ssh.sh"
            })

            self.log.debug("Cloning %s to %s" % (self.url, tmp_dir))
            git('clone', '--recursive', self.url, tmp_dir)

            self.log.debug("Archiving '{ref}' to {destination}".format(
                ref=ref,
                destination=destination
            ))

            settings.mkdir_p(destination)

            (fd, tar_file) = tempfile.mkstemp()
            git.archive('origin/%s' % ref, *archive_args, _out=tar_file)
            sh.tar("xpf", tar_file, _cwd=destination)
        finally:
            if tar_file:
                os.remove(tar_file)

            if os.path.isdir(tmp_dir):
                shutil.rmtree(tmp_dir)
Iterator on self.
dataset/ETHPy150Open stackstrap/stackstrap/stackstrap/repository.py/Repository.archive--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/ext/db/__init__.py/_QueryIterator.__iter__