Ensure all changes are fully qualified and affect only one file.
    This ensures that the diff output works and a state change is not
    incorrectly reported.
433531
def _check_filepath(changes):
    '''
    
    '''
    filename = None
    for change_ in changes:
        try:
            cmd, arg = change_.split(' ', 1)

            if cmd not in METHOD_MAP:
                error = 'Command {0} is not supported (yet)'.format(cmd)
                raise ValueError(error)
            method = METHOD_MAP[cmd]
            parts = salt.utils.args.shlex_split(arg)
            if method in ['set', 'setm', 'move', 'remove']:
                filename_ = parts[0]
            else:
                _, _, filename_ = parts
            if not filename_.startswith('/files'):
                error = 'Changes should be prefixed with ' \
                        '/files if no context is provided,' \
                        ' change: {0}'.format(change_)
                raise ValueError(error)
            filename_ = re.sub('^/files|/$', '', filename_)
            if filename is not None:
                if filename != filename_:
                    error = 'Changes should be made to one ' \
                            'file at a time, detected changes ' \
                            'to {0} and {1}'.format(filename, filename_)
                    raise ValueError(error)
            filename = filename_
        except (ValueError, IndexError) as err:
            log.error(err)
            if 'error' not in locals():
                error = 'Invalid formatted command, ' \
                               'see debug log for details: {0}' \
                               .format(change_)
            else:
                error = six.text_type(err)
            raise ValueError(error)

    filename = _workout_filename(filename)

    return filename
960228
boolean shouldCheckConformanceFor(String filePath) {
    for (String whitelistedPath : getWhitelistedPaths()) {
      if (filePath.contains(whitelistedPath)) {
        return false;
      }
    }
    ImmutableList<String> onlyApplyToPaths = getOnlyApplyToPaths();
    if (onlyApplyToPaths.isEmpty()) {
      return true;
    }
    // If only_apply_to field is presented in the configuration, check it.
    for (String onlyApplyToPath : onlyApplyToPaths) {
      if (filePath.contains(onlyApplyToPath)) {
        return true;
      }
    }
    return false;
  }
941566
def run_partial_replacement_with(combination)
      content = partial_replace(*combination)
      experimental_file = experimental_filename(combination)

      File.open(experimental_file, 'w+') { |f| f.puts content }

      raise 'No changes were made to the file.' if FileUtils.compare_file(@file, experimental_file)

      result = experiment.ok_if.call(experimental_file)

      if result
        ok_with(combination)
        puts "✅ #{experimental_file} - Combination: #{combination}"
      else
        failed_with(combination)
        puts "🔴 #{experimental_file} - Combination: #{combination}"
      end
    end
590461
def process_full_diff
        defaults = {
          :mode => '',
          :src => '',
          :dst => '',
          :type => 'modified'
        }
        final = {}
        current_file = nil
        if @full_diff.encoding.name != "UTF-8"
          full_diff_utf8_encoded = @full_diff.encode("UTF-8", "binary", { :invalid => :replace, :undef => :replace })
        else
          full_diff_utf8_encoded = @full_diff
        end
        full_diff_utf8_encoded.split("\n").each do |line|
          if m = /^diff --git a\/(.*?) b\/(.*?)/.match(line)
            current_file = m[1]
            final[current_file] = defaults.merge({:patch => line, :path => current_file})
          else
            if m = /^index (.......)\.\.(.......)( ......)*/.match(line)
              final[current_file][:src] = m[1]
              final[current_file][:dst] = m[2]
              final[current_file][:mode] = m[3].strip if m[3]
            end
            if m = /^([[:alpha:]]*?) file mode (......)/.match(line)
              final[current_file][:type] = m[1]
              final[current_file][:mode] = m[2]
            end
            if m = /^Binary files /.match(line)
              final[current_file][:binary] = true
            end
            final[current_file][:patch] << "\n" + line
          end
        end
        final.map { |e| [e[0], DiffFile.new(@base, e[1])] }
      end
405838
def change(file)
      if file.is_a?(Ichiban::HelperFile) or file.is_a?(Ichiban::ModelFile)
        delete_all
        load_all
        Ichiban.logger.reload(file.abs)
      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
287248
def fixity_check_file(file)
        versions = file.has_versions? ? file.versions.all : [file]

        versions = [versions.max_by(&:created)] if file.has_versions? && latest_version_only

        versions.collect { |v| fixity_check_file_version(file.id, v.uri.to_s) }.flatten
      end
686877
def raise_exception_if_baseline_file_is_unstaged(filename):
    
    try:
        files_changed_but_not_staged = subprocess.check_output(
            [
                'git',
                'diff',
                '--name-only',
            ],
        ).split()
    except subprocess.CalledProcessError:
        # Since we don't pipe stderr, we get free logging through git.
        raise ValueError

    if filename.encode() in files_changed_but_not_staged:
        log.error((
            'Your baseline file ({}) is unstaged.\n'
            '`git add {}` to fix this.'
        ).format(
            filename,
            filename,
        ))

        raise ValueError
416547
def _dep_changed(self, dep, code_changed=False, value_changed=False):
        
        self.changed(code_changed, value_changed)
325109
def diffs_of_interest
      files_of_interest.map do |file|
        diff = EmptyDiff.new
        begin
          diff = git.diff_for_file(file)
        rescue NoMethodError
          log_unable_to_find_diff(file.inspect)
        end
        diff
      end
    end
1019671
def run_on_changes(paths)
      validate_at_least_one_target('copy')
      with_all_target_paths(paths) do |from_path, to_path|
        to_dir = File.dirname(to_path)
        if !File.directory?(to_dir) && options[:mkpath]
          UI.info("creating directory #{to_dir}") if options[:verbose]
          FileUtils.mkpath(to_dir)
        end
        validate_to_path(to_path)
        UI.info("copying to #{to_path}") if options[:verbose]
        copy(from_path, to_path)
      end
    end
292995
def verify_preconditions
      super

      if not gitlib.status.clean?
        GitProc::ChangeFileHelper.new(gitlib).offer_to_help_uncommitted_changes
      end

      raise ParkedChangesError.new(self) if gitlib.is_parked?
    end
1317851
def release():
    

    with settings(warn_only=True):
        r = local(clom.git['diff-files']('--quiet', '--ignore-submodules', '--'))

    if r.return_code != 0:
        abort('There are uncommitted changes, commit or stash them before releasing')

    version = open('VERSION.txt').read().strip()

    print('Releasing %s...' % version)
    local(clom.git.flow.release.start(version))
    local(clom.git.flow.release.finish(version, m='Release-%s' % version))
    local(clom.git.push('origin', 'master', 'develop', tags=True))
    local(clom.python('setup.py', 'sdist', 'upload'))
869558
def _check_diff(changes):
    '''
    
    '''
    for conf_dict in changes:
        if conf_dict == 'Networks':
            continue
        for item in changes[conf_dict]:
            if changes[conf_dict][item]['new'] is None:
                old = changes[conf_dict][item]['old']
                if old == '':
                    return True
                else:
                    try:
                        if all(x == '' for x in old):
                            return True
                    except TypeError:
                        # Old value is not an iterable type
                        pass
    return False
1295389
def release():
    

    with settings(warn_only=True):
        r = local(clom.git['diff-files']('--quiet', '--ignore-submodules', '--'))

    if r.return_code != 0:
        abort('There are uncommitted changes, commit or stash them before releasing')

    version = open('VERSION.txt').read().strip()

    existing_tag = local(clom.git.tag('-l', version), capture=True)
    if not existing_tag.strip():
        print('Releasing %s...' % version)
        local(clom.git.tag(version))

    if confirm('Push %s to pypi?' % version, default=True):
        local(clom.git.push('origin', 'HEAD'))
        local(clom.git.push('origin', version))
        local(clom.python('setup.py', 'sdist', 'upload'))
1127241
boolean checkForChanges()
    {
        // initialize with last checked files
        final Map<File, byte[]> presents = new HashMap<>(fingerprints);
        boolean modified = traverseDirectory(location, new IFileVisitor()
        {
            @Override
            public boolean visitFile(File file)
            {
                return modified(presents.remove(file), file);
            }

            @Override
            public boolean visitDir(File dir)
            {
                return modified(presents.remove(dir), dir);
            }
        });
        // if some files remain, that means they have been deleted since last scan
        return modified || !presents.isEmpty();
    }
1281155
def set_diff(self, file_diff):
        
        self.file_diff = file_diff
        self.__record_progress(Status.START_UPLOAD)