import os
import os.path
import subprocess


class DefaultRepositoryHandler():
    def __init__(self, cwd=None):
        self.cwd = cwd or os.getcwd()

    def repository_exists(self, path):
        print os.path.join(self.cwd, path, '.git')
        return os.path.exists(os.path.join(self.cwd, path, '.git'))

    def update_repository(self, path, remote_url, remote_branch):
        print 'Updating repository %s ...' % path

        remote_name = 'origin'
        repository_path = os.path.join(self.cwd, path)

        url = subprocess.check_output(
            ['git', 'config', 'remote.%s.url' % remote_name],
            cwd=repository_path
        )

        if url != remote_url:
            subprocess.check_call(
                ['git', 'config', 'remote.%s.url' % remote_name, remote_url],
                cwd=repository_path
            )

        subprocess.check_call(
            ['git', 'pull', '--rebase'],
            cwd=repository_path
        )

    def clone_repository(self, path, remote_url, remote_branch):
        print 'Cloning repository %s ...' % path
        subprocess.check_call(
            ['git', 'clone', remote_url, '-b',  remote_branch, path],
            cwd=self.cwd
        )

    def update_or_clone(self, path, remote_url, remote_branch):
        if self.repository_exists(path):
            self.update_repository(path, remote_url, remote_branch)
        else:
            self.clone_repository(path, remote_url, remote_branch)

import os
import os.path
import subprocess


class DefaultRepositoryHandler():
    def __init__(self, cwd=None):
        self.cwd = cwd or os.getcwd()

    def repository_exists(self, path):
        return os.path.exists(os.path.join(self.cwd, path, '.git'))

    def update_repository(self, path, remote_url, remote_branch):
        print 'Updating repository %s ...' % path

        remote_name = 'origin'
        repository_path = os.path.join(self.cwd, path)

        url = subprocess.check_output(
            ['git', 'config', 'remote.%s.url' % remote_name],
            cwd=repository_path
        )

        if url != remote_url:
            subprocess.check_call(
                ['git', 'config', 'remote.%s.url' % remote_name, remote_url],
                cwd=repository_path
            )

        subprocess.check_call(
            ['git', 'pull', '--rebase'],
            cwd=repository_path
        )

    def clone_repository(self, path, remote_url, remote_branch):
        print 'Cloning repository %s ...' % path
        subprocess.check_call(
            ['git', 'clone', remote_url, '-b',  remote_branch, path],
            cwd=self.cwd
        )

    def update_or_clone(self, path, remote_url, remote_branch):
        if self.repository_exists(path):
            self.update_repository(path, remote_url, remote_branch)
        else:
            self.clone_repository(path, remote_url, remote_branch)

Remove print statement