Get a list of added, copied, or modified files that have been staged.
 Renames and deletions are ignored, since there should be nothing to check.
190893
def modified_files
      unless @modified_files
        currently_staged = Overcommit::GitRepo.modified_files(staged: true)
        @modified_files = currently_staged

        # Include files modified in last commit if amending
        if amendment?
          subcmd = 'show --format=%n'
          previously_modified = Overcommit::GitRepo.modified_files(subcmd: subcmd)
          @modified_files |= filter_modified_files(previously_modified)
        end
      end
      @modified_files
    end
813484
def added(self):
        '''
        
        '''
        def _added(diffs, prefix):
            keys = []
            for key in diffs.keys():
                if isinstance(diffs[key], dict) and 'old' not in diffs[key]:
                    keys.extend(_added(diffs[key],
                                       prefix='{0}{1}.'.format(prefix, key)))
                elif diffs[key]['old'] == self.NONE_VALUE:
                    if isinstance(diffs[key]['new'], dict):
                        keys.extend(
                            _added(diffs[key]['new'],
                                   prefix='{0}{1}.'.format(prefix, key)))
                    else:
                        keys.append('{0}{1}'.format(prefix, key))
            return keys

        return sorted(_added(self._diffs, prefix=''))
1242775
def file_list(self):
        
        blacklist = ['.git', 'aetros']
        working_tree = self.git.work_tree

        def recursive(path='.'):
            if os.path.basename(path) in blacklist:
                return 0, 0

            if os.path.isdir(path):
                files = []
                for file in os.listdir(path):
                    if path and path != '.':
                        file = path + '/' + file

                    added_files = recursive(file)
                    files += added_files

                return files
            else:
                if path.endswith('.pyc'):
                    return []

                if is_ignored(path, self.config['ignore']):
                    return []

                return [os.path.relpath(path, working_tree)]

        return recursive(working_tree)
709531
def undocumented(scope = :modified)
      return [] unless scope != :ignore && File.exist?(undocumented_path)
      @undocumented = { modified: [], all: [] } if @undocumented.nil?
      load_undocumented(scope) if @undocumented[scope].empty?
      @undocumented[scope]
    end
1321161
def paste
      if @yanked_items
        if current_item.directory?
          FileUtils.cp_r @yanked_items.map(&:path), current_item
        else
          @yanked_items.each do |item|
            if items.include? item
              i = 1
              while i += 1
                new_item = load_item dir: current_dir, name: "#{item.basename}_#{i}#{item.extname}", stat: item.stat
                break unless File.exist? new_item.path
              end
              FileUtils.cp_r item, new_item
            else
              FileUtils.cp_r item, current_dir
            end
          end
        end
        ls
      end
    end
1224741
def changes_found(self):
        
        if self.dest is None:
            warnings.warn("dest directory not found!")
        if self.src is None:
            warnings.warn("src directory not found!")
        if self.src is None or self.dest is None:
            return False
        dest_mtime = -1
        src_mtime = os.path.getmtime(self.src)
        if os.path.exists(self.dest):
            dest_mtime = os.path.getmtime(self.dest)

        if src_mtime >= dest_mtime:
            return True # changes found

        for folder, _, files in os.walk(self.src):
            for filename in fnmatch.filter(files, '*.scss'):
                src_path = os.path.join(folder, filename)
                if os.path.getmtime(src_path) >= dest_mtime:
                    return True 
        return False
1204702
def all_modified_files_coverage
      unless @project.nil?
        all_modified_files_coverage ||= begin
          modified_files = git.modified_files.nil? ? [] : git.modified_files
          added_files = git.added_files.nil? ? [] : git.added_files
          all_changed_files = modified_files | added_files
          @project.coverage_files.select do |file|
            all_changed_files.include? file.source_file_pathname_relative_to_repo_root.to_s
          end
        end

        all_modified_files_coverage
      end
    end
366823
def get_files(commit_only=True, copy_dest=None):
    ""
    if commit_only:
        real_files = bash(
            "git diff --cached --name-status | "
            "grep -v -E '^D' | "
            "awk '{ print ( $(NF) ) }' "
        ).value().strip()
    else:
        real_files = bash(
            "git ls-tree --name-only --full-tree -r HEAD"
        ).value().strip()

    if real_files:
        return create_fake_copies(real_files.split('\n'), copy_dest)
    return []
773096
def _get_changes(rsync_out):
    '''
    
    '''
    copied = list()
    deleted = list()

    for line in rsync_out.split("\n\n")[0].split("\n")[1:]:
        if line.startswith("deleting "):
            deleted.append(line.split(" ", 1)[-1])
        else:
            copied.append(line)

    ret = {
        'copied': os.linesep.join(sorted(copied)) or "N/A",
        'deleted': os.linesep.join(sorted(deleted)) or "N/A",
    }

    # Return whether anything really changed
    ret['changed'] = not ((ret['copied'] == 'N/A') and (ret['deleted'] == 'N/A'))

    return ret
888447
def modified_files(options)
      flags = '--cached' if options[:staged]
      refs = options[:refs]
      subcmd = options[:subcmd] || 'diff'

      `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.
        split("\0").
        map(&:strip).
        reject(&:empty?).
        map { |relative_file| File.expand_path(relative_file) }
    end
1197814
def get_staged_files():
    
    proc = subprocess.Popen(('git', 'status', '--porcelain'),
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)
    out, _ = proc.communicate()
    staged_files = modified_re.findall(out)
    return staged_files
865147
def removeduplicates(self, entries = None):
        '''
        
        '''
        removed = []
        if entries == None:
            entries = {}
        new_children = []
        for c in self.children:
            cs = str(c)
            cp = entries.get(cs,None)
            if cp:
                new_children.append(cp)
                removed.append(c)
            else:
                dups = c.removeduplicates(entries)
                if dups:
                    removed.extend(dups)
                entries[cs] = c
                new_children.append(c)
        self.children = new_children
        return removed
689799
def find_new(self):
        
        print("\nSearch for .new configuration files:\n")
        for path, dirs, files in os.walk(self.etc):
            del dirs    # delete unsed
            for f in files:
                if f.endswith(".new"):
                    self.news.append(os.path.join(path, f))
        if not self.news:
            print("  No new configuration files\n")
            raise SystemExit()
1210515
def changed(self):
        
        if not self.parents:
            return []
        return ChangedFileNodesGenerator([n for n in
                                self._get_paths_for_status('modified')], self)
590143
def action
      updated_list_filename = File.join(Configuration::application_root, 'upgrade_package_add_files.txt')
      removed_list_filename = File.join(Configuration::application_root, 'upgrade_package_remove_files.txt')
      mkdir_p Configuration::development_directory
      Configuration::enabled_subscriber_platforms.each { |each|
        RhoDevelopment.setup(Configuration::development_directory, each)
        puts "Check changes for #{each}".warning
        changed = RhoDevelopment.check_changes_from_last_build(updated_list_filename, removed_list_filename)
        if changed
          puts "Source code for platform #{each} was changed".primary
          WebServer.dispatch_task(PlatformPartialUpdateBuildingTask.new(each, @filename));
          Configuration::enabled_subscribers_by_platform(each).each { |subscriber|
            WebServer.dispatch_task(SubscriberPartialUpdateNotifyingTask.new(subscriber, @filename));
          }
        else
          puts "Source code for platform #{each} wasn't changed".primary
        end
      }
    end
211978
def _get_files_modified():
    """"""
    cmd = "git diff-index --cached --name-only --diff-filter=ACMRTUXB HEAD"
    _, files_modified, _ = run(cmd)

    extensions = [re.escape(ext) for ext in list(SUPPORTED_FILES) + [".rst"]]
    test = "(?:{0})$".format("|".join(extensions))
    return list(filter(lambda f: re.search(test, f), files_modified))
231809
def get_changed_files_from(old_commit_sha, new_commit_sha):
        
        return check_output(
            "git diff-tree --no-commit-id --name-only -r {0}..{1}".format(
                old_commit_sha,
                new_commit_sha
            ).split(" ")
            ).decode('utf-8').strip()