Example #1
0
    def update_git_file(self):
        # the git repo won't change that often
        # so we can easily wait 5 seconds
        # between updates for performance
        if ViewCollection.git_time(self.view) > 5:
            with open(self.git_temp_file, 'w'):
                pass

            args = [
                self.git_binary_path,
                '--git-dir=' + self.git_dir,
                '--work-tree=' + self.git_tree,
                'show',
                ViewCollection.get_compare(self.view) + ':' + self.git_path,
            ]
            try:
                contents = self.run_command(args)
                contents = contents.replace(b'\r\n', b'\n')
                contents = contents.replace(b'\r', b'\n')
                with open(self.git_temp_file, 'wb') as f:
                    f.write(contents)

                ViewCollection.update_git_time(self.view)
            except Exception:
                pass
Example #2
0
    def update_git_file(self):
        # the git repo won't change that often
        # so we can easily wait 5 seconds
        # between updates for performance
        if ViewCollection.git_time(self.view) > 5:
            open(self.git_temp_file.name, 'w').close()

            if self.view.get_status('remote'):
                base_path = self.view.file_name() + '.base'
                if os.path.exists(base_path):
                   shutil.copyfile(base_path, self.git_temp_file.name)
                return

            args = [
                self.git_binary_path,
                '--git-dir=' + self.git_dir,
                '--work-tree=' + self.git_tree,
                'show',
                ViewCollection.get_compare() + ':' + self.git_path,
            ]
            try:
                contents = self.run_command(args)
                contents = contents.replace(b'\r\n', b'\n')
                contents = contents.replace(b'\r', b'\n')
                f = open(self.git_temp_file.name, 'wb')
                f.write(contents)
                f.close()
                ViewCollection.update_git_time(self.view)
            except Exception:
                pass
Example #3
0
    def update_git_file(self):
        # the git repo won't change that often
        # so we can easily wait 5 seconds
        # between updates for performance
        if ViewCollection.git_time(self.view) > 5:
            open(self.git_temp_file.name, 'w').close()

            if self.view.get_status('remote'):
                base_path = self.view.file_name() + '.base'
                if os.path.exists(base_path):
                    shutil.copyfile(base_path, self.git_temp_file.name)
                return

            args = [
                self.git_binary_path,
                '--git-dir=' + self.git_dir,
                '--work-tree=' + self.git_tree,
                'show',
                ViewCollection.get_compare() + ':' + self.git_path,
            ]
            try:
                contents = self.run_command(args)
                contents = contents.replace(b'\r\n', b'\n')
                contents = contents.replace(b'\r', b'\n')
                f = open(self.git_temp_file.name, 'wb')
                f.write(contents)
                f.close()
                ViewCollection.update_git_time(self.view)
            except Exception:
                pass
Example #4
0
    def update_git_file(self):
        # the git repo won't change that often
        # so we can easily wait 5 seconds
        # between updates for performance
        if ViewCollection.git_time(self.view) > 5:
            with open(self.git_temp_file, 'w'):
                pass

            args = [
                self.git_binary_path,
                '--git-dir=' + self.git_dir,
                '--work-tree=' + self.git_tree,
                'show',
                ViewCollection.get_compare(self.view) + ':' + self.git_path,
            ]
            try:
                contents = self.run_command(args)
                contents = contents.replace(b'\r\n', b'\n')
                contents = contents.replace(b'\r', b'\n')
                with open(self.git_temp_file, 'wb') as f:
                    f.write(contents)

                ViewCollection.update_git_time(self.view)
            except Exception:
                pass
 def update_git_file(self):
   # the git repo won't change that often
   # so we can easily wait 5 seconds
   # between updates for performance
   if ViewCollection.git_time(self.view) > 5:
     self.git_temp_file.truncate()
     args = ['git','--git-dir='+self.git_dir,'--work-tree='+self.git_tree,'show','head:'+self.git_path]
     try:
       subprocess.call(args, stdout=self.git_temp_file)
       ViewCollection.update_git_time(self.view)
     except Exception:
       pass
 def update_git_file(self):
     # the git repo won't change that often
     # so we can easily wait 5 seconds
     # between updates for performance
     if ViewCollection.git_time(self.view) > 5:
         open(self.git_temp_file.name, 'w').close()
         args = [
             'git',
             '--git-dir=' + self.git_dir,
             '--work-tree=' + self.git_tree,
             'show',
             'HEAD:' + self.git_path,
         ]
         try:
             contents = self.run_command(args)
             contents = contents.replace('\r\n', '\n')
             contents = contents.replace('\r', '\n')
             f = open(self.git_temp_file.name, 'w')
             f.write(contents)
             f.close()
             ViewCollection.update_git_time(self.view)
         except Exception:
             pass