示例#1
0
    def setup_project_repo(self):
        """ Create a new project repo, and download pantheon/drupal core.

        """
        project_repo = os.path.join('/var/git/projects', self.project)

        # Get Pantheon core
        local('git clone --mirror ' + \
              'git://git.getpantheon.com/pantheon/%s.git %s' % (self.version,
                                                                project_repo))

        with cd(project_repo):
            # Drupal Core
            #TODO: Use official Drupal git repo once available.
            local('git fetch git://git.getpantheon.com/drupal/' + \
                  '%s.git master:drupal_core' % (self.version))
            # Repo config
            local('git config core.sharedRepository group')
            # Group write.
            local('chmod -R g+w .')

        # post-receive-hook
        post_receive_hook = os.path.join(project_repo,
                                         'hooks/post-receive')
        pantheon.copy_template('git.hook.post-receive', post_receive_hook)
        local('chmod +x %s' % post_receive_hook)
示例#2
0
    def setup_project_repo(self):
        """ Create a new project repo, and download pantheon/drupal core.

        """
        project_repo = os.path.join('/var/git/projects', self.project)

        # Get Pantheon core
        local('git clone --mirror ' + \
              'git://git.getpantheon.com/pantheon/%s.git %s' % (self.version,
                                                                project_repo))

        with cd(project_repo):
            # Drupal Core
            #TODO: Use official Drupal git repo once available.
            local('git fetch git://git.getpantheon.com/drupal/' + \
                  '%s.git master:drupal_core' % (self.version))
            # Repo config
            local('git config core.sharedRepository group')
            # Group write.
            local('chmod -R g+w .')

        # post-receive-hook
        post_receive_hook = os.path.join(project_repo, 'hooks/post-receive')
        pantheon.copy_template('git.hook.post-receive', post_receive_hook)
        local('chmod +x %s' % post_receive_hook)
示例#3
0
    def push_to_repo(self, tag):
        """ Commit changes in working directory and push to central repo.

        """
        with cd(self.working_dir):
            local('git checkout %s' % self.project)
            # Set up .gitignore
            pantheon.copy_template('git.ignore', os.path.join(self.working_dir, '.gitignore'))
            local('git add -A .')
            local("git commit --author=\"%s\" -m 'Initialize Project: %s'" % (
                                                   self.author, self.project))
            local('git tag %s.%s' % (self.project, tag))
            local('git push')
            local('git push --tags')
示例#4
0
    def push_to_repo(self, tag):
        """ Commit changes in working directory and push to central repo.

        """
        with cd(self.working_dir):
            local('git checkout %s' % self.project)
            # Set up .gitignore
            pantheon.copy_template(
                'git.ignore', os.path.join(self.working_dir, '.gitignore'))
            local('git add -A .')
            local("git commit --author=\"%s\" -m 'Initialize Project: %s'" %
                  (self.author, self.project))
            local('git tag %s.%s' % (self.project, tag))
            local('git push')
            local('git push --tags')
示例#5
0
    def setup_project_repo(self, upstream_repo=None):
        """ Create a new project repo, and download pantheon/drupal core.

        """
        project_repo = os.path.join('/var/git/projects', self.project)
        dev_branch = None

        # If this is a development server check branch.txt for source.
        if os.path.exists('/opt/branch.txt'):
            dev_branch = open('/opt/branch.txt').read().strip() or None
            if dev_branch == 'master':
                dev_branch = None

        # For imports, no upstream is set. But self.version is known.
        if upstream_repo is None:
            # Is this a development branch?
            if dev_branch:
                upstream_repo = 'git://github.com/pantheon-systems/' + \
                                '%s-%s.git' % (self.version, dev_branch)
            else:
                upstream_repo = 'git://git.getpantheon.com/pantheon/%s.git' %(
                                                                 self.version)
        else:
            # If this is a development server, make sure the upstream has
            # not been changed to some other source before modifying. Mostly
            # because we make hackish assumptions about determining version
            # and destination.
            if dev_branch and upstream_repo.startswith(
                                 'git://git.getpantheon.com'):
                self.version = upstream_repo[-5]
                upstream_repo = 'git://github.com/pantheon-systems/' + \
                                '%s-%s.git' % (self.version, dev_branch)

        # Get Pantheon core
        local('git clone --mirror %s %s' % (upstream_repo, project_repo))

        with cd(project_repo):
            # Repo config
            local('git config core.sharedRepository group')
            # Group write.
            local('chmod -R g+w .')

        # post-receive-hook
        post_receive_hook = os.path.join(project_repo,
                                         'hooks/post-receive')
        pantheon.copy_template('git.hook.post-receive', post_receive_hook)
        local('chmod +x %s' % post_receive_hook)
示例#6
0
    def setup_project_repo(self, upstream_repo=None):
        """ Create a new project repo, and download pantheon/drupal core.

        """
        project_repo = os.path.join('/var/git/projects', self.project)
        dev_branch = None

        # If this is a development server check MERCURY_BRANCH for source.
        if MERCURY_BRANCH != 'master':
            dev_branch = MERCURY_BRANCH

        # For imports, no upstream is set. But self.version is known.
        if upstream_repo is None:
            # Is this a development branch?
            if dev_branch:
                upstream_repo = 'git://github.com/pantheon-systems/' + \
                                '%s-%s.git' % (self.version, dev_branch)
            else:
                upstream_repo = 'git://git.getpantheon.com/pantheon/%s.git' % (
                    self.version)
        else:
            # If this is a development server, make sure the upstream has
            # not been changed to some other source before modifying. Mostly
            # because we make hackish assumptions about determining version
            # and destination.
            if dev_branch and upstream_repo.startswith(
                    'git://git.getpantheon.com'):
                self.version = upstream_repo[-5]
                upstream_repo = 'git://github.com/pantheon-systems/' + \
                                '%s-%s.git' % (self.version, dev_branch)

        # Get Pantheon core
        local('git clone --mirror %s %s' % (upstream_repo, project_repo))

        with cd(project_repo):
            # Repo config
            local('git config core.sharedRepository group')
            # Group write.
            local('chmod -R g+w .')

        # post-receive-hook
        post_receive_hook = os.path.join(project_repo, 'hooks/post-receive')
        pantheon.copy_template('git.hook.post-receive', post_receive_hook)
        local('chmod +x %s' % post_receive_hook)
示例#7
0
    def setup_project_repo(self, upstream_repo=None):
        """ Create a new project repo, and download pantheon/drupal core.

        """
        project_repo = os.path.join('/var/git/projects', self.project)

        if upstream_repo is None:
            upstream_repo = 'git://git.getpantheon.com/pantheon/%s.git' % (
                                                              self.version)

        # Get Pantheon core
        local('git clone --mirror %s %s' % (upstream_repo, project_repo))

        with cd(project_repo):
            # Repo config
            local('git config core.sharedRepository group')
            # Group write.
            local('chmod -R g+w .')

        # post-receive-hook
        post_receive_hook = os.path.join(project_repo,
                                         'hooks/post-receive')
        pantheon.copy_template('git.hook.post-receive', post_receive_hook)
        local('chmod +x %s' % post_receive_hook)