Example #1
0
    def commit(self, commit_message_file, commit_message, files):
        '''Commit this workspace.'''
        add_remove = self.get_add_remove()

        self.assert_no_dirs(files)
        self.verify_add_remove(add_remove)
        self.update_index(add_remove, files, self.alt_git)

        # look for any files which need to be implicitly added and add them
        all_files = Set(self.alt_git.iter_ls_files([]))
        given_files = Set(files)
        removed_files = add_remove.get_removed_files()
        implicit_add_files = given_files - all_files - removed_files
        for implicit_add in implicit_add_files:
            full_path = pjoin(self.work_dir, implicit_add)
            if not os.path.exists(full_path):
                message = 'Missing file "%s".' % implicit_add
                raise SemanticError, message

        self.alt_git.run_update_index(implicit_add_files, add_flag=True)
        self.alt_git.run_commit(commit_message_file, commit_message)
        shell_command('git update-index --add --remove --refresh %s' %
                      " ".join([f for f in all_files]))

        add_remove.clear(files)
Example #2
0
 def update(self):
     '''Grab the remote file and store it locally.'''
     get_remote_file(self.full_path, self.channel_file, True)
     shell_command('gunzip -c %s > % s' % (self.channel_file ,self.channel_file[0:-3]))
     if self.has_release:
          full_path = '/'.join(self.full_path.split('/')[0:-1]) + '/Release'
          release_file = '_'.join(self.channel_file.split('_')[0:-1]) + '_Release'             
          get_remote_file(full_path, release_file, True)
Example #3
0
 def update(self):
     '''Grab the remote file and store it locally.'''
     get_remote_file(self.full_path, self.channel_file, True)
     shell_command('gunzip -c %s > % s' %
                   (self.channel_file, self.channel_file[0:-3]))
     if self.has_release:
         full_path = '/'.join(self.full_path.split('/')[0:-1]) + '/Release'
         release_file = '_'.join(
             self.channel_file.split('_')[0:-1]) + '_Release'
         get_remote_file(full_path, release_file, True)
Example #4
0
 def load(self, cache, mass_progress):
     '''Use a framer to stream the assigned blobs into a cache.'''
     blob_ids = [l.blob_id for l in self.locators]
     framer = Framer(*shell_command('pdk remote listen %s' % self.path))
     framer.write_stream(['pull-blobs'])
     framer.write_stream(blob_ids)
     framer.write_stream(['done'])
     cache.import_from_framer(framer, mass_progress)
Example #5
0
 def load(self, cache, mass_progress):
     '''Use a framer to stream the assigned blobs into a cache.'''
     blob_ids = [ l.blob_id for l in self.locators ]
     framer = Framer(*shell_command('ssh %s pdk remote listen %s'
                                      % (self.host, self.path)))
     framer.write_stream(['pull-blobs'])
     framer.write_stream(blob_ids)
     framer.write_stream(['done'])
     cache.import_from_framer(framer, mass_progress)
Example #6
0
    def merge(self, branch_name, silent=False):
        '''Do a merge from branch to HEAD.

        Do a plain checkout for new repositories.
        '''
        self.git.clean_fetch_head()
        if self.is_new():
            self.alt_git.new_branch('master', branch_name, silent)
            self.alt_git.checkout_branch('master', silent)
        else:
            add_remove = self.get_add_remove()
            self.verify_add_remove(add_remove)
            self.update_index(add_remove, [], self.alt_git)
            if self.alt_git.has_index_changed('HEAD'):
                raise InputError, \
                      'Cannot merge with uncommitted changes in the ' + \
                      'workspace.'
            self.alt_git.merge('HEAD', branch_name, silent)
            add_remove.clear([])
        shell_command('git reset --hard HEAD')
Example #7
0
    def merge(self, branch_name, silent = False):
        '''Do a merge from branch to HEAD.

        Do a plain checkout for new repositories.
        '''
        self.git.clean_fetch_head()
        if self.is_new():
            self.alt_git.new_branch('master', branch_name, silent)
            self.alt_git.checkout_branch('master', silent)
        else:
            add_remove = self.get_add_remove()
            self.verify_add_remove(add_remove)
            self.update_index(add_remove, [], self.alt_git)
            if self.alt_git.has_index_changed('HEAD'):
                raise InputError, \
                      'Cannot merge with uncommitted changes in the ' + \
                      'workspace.'
            self.alt_git.merge('HEAD', branch_name, silent)
            add_remove.clear([])
        shell_command('git reset --hard HEAD')
Example #8
0
    def commit(self, commit_message_file, commit_message, files):
        '''Commit this workspace.'''
        add_remove = self.get_add_remove()

        self.assert_no_dirs(files)
        self.verify_add_remove(add_remove)
        self.update_index(add_remove, files, self.alt_git)

        # look for any files which need to be implicitly added and add them
        all_files = Set(self.alt_git.iter_ls_files([]))
        given_files = Set(files)
        removed_files = add_remove.get_removed_files()
        implicit_add_files = given_files - all_files - removed_files
        for implicit_add in implicit_add_files:
            full_path = pjoin(self.work_dir, implicit_add)
            if not os.path.exists(full_path):
                message = 'Missing file "%s".' % implicit_add
                raise SemanticError, message

        self.alt_git.run_update_index(implicit_add_files, add_flag = True)
        self.alt_git.run_commit(commit_message_file, commit_message)
        shell_command('git update-index --add --remove --refresh %s' % " ".join([ f for f in all_files ]))

        add_remove.clear(files)
Example #9
0
    def popen2(self, command, pipes = True):
        """Forks off a git command.

        Returns handles to stdin and standard out.
        command is fed to /bin/sh, not exec'ed directly.

        Command is executed with cwd set to self.work_dir, and
        env variable GIT_DIR pointed at self.git_dir.
        """
        def set_up_child():
            '''Child process should chdir [work]; and set GIT_DIR.'''
            os.chdir(self.work_dir)
            os.environ.update({ 'GIT_DIR': self.git_dir })
            if self.index_file:
                os.environ.update({ 'GIT_INDEX_FILE': self.index_file })
            if 'PDK_SSL_NO_VERIFY' in os.environ:
                os.environ.update({ 'GIT_SSL_NO_VERIFY': '1' })
        return shell_command(command, set_up_child, pipes)
Example #10
0
    def popen2(self, command, pipes=True):
        """Forks off a git command.

        Returns handles to stdin and standard out.
        command is fed to /bin/sh, not exec'ed directly.

        Command is executed with cwd set to self.work_dir, and
        env variable GIT_DIR pointed at self.git_dir.
        """
        def set_up_child():
            '''Child process should chdir [work]; and set GIT_DIR.'''
            os.chdir(self.work_dir)
            os.environ.update({'GIT_DIR': self.git_dir})
            if self.index_file:
                os.environ.update({'GIT_INDEX_FILE': self.index_file})
            if 'PDK_SSL_NO_VERIFY' in os.environ:
                os.environ.update({'GIT_SSL_NO_VERIFY': '1'})

        return shell_command(command, set_up_child, pipes)