akede@users - 1.7.2 patch Files readonly
1701
public void setDataReadOnly(boolean value) {

        // Changing the Read-Only mode for the table is only allowed if the
        // the database can realize it.
        if (!value && database.isFilesReadOnly() && isFileBased()) {
            throw Error.error(ErrorCode.DATA_IS_READONLY);
        }

        isReadOnly = value;
    }
345027
function trimNested(previous, current, opts) {
    // bail early if we want to keep nested dependencies
    if (opts.keepNested) {
        return current;
    }

    // purposes find patches from to
    // apply TO current FROM previous
    var patches = jsonDiff.diff(current, previous);

    if (!patches) {
        return current;
    }

    patches = removeTopLevelPatches(patches);

    if (patches.dependencies) {
        Object.keys(patches.dependencies)
            .forEach(function (key) {
                current.dependencies[key] =
                    previous.dependencies[key];
            });
    }

    return current;
}
1243085
def apply_patch(self):
        
        patch = self.patches.get(self.storage.__class__.__name__)
        if patch:
            patch.apply(self)
302688
def unpatch(self):
        """"""
        if not self._patched:
            return
        for func in self._read_compilers + self._write_compilers:
            func.execute_sql = self._original[func]
        self.cache_backend.unpatch()
        self._patched = False
992708
function stripProxyResHeaders(res) {
  return Object.entries(res.headers).reduce((memo, header) => {
    const [key, val] = header
    const invalid = [undefined, 'connection', 'content-encoding']
    if (invalid.indexOf(key) === -1) {
      memo[key] = val // eslint-disable-line
    }
    return memo
  }, {})
}
493445
def patch(self, keepNull = True, **docArgs) :
        """"""

        if self.URL is None :
            raise ValueError("Cannot patch a document that was not previously saved")

        payload = self._store.getPatches()
        
        if self.collection._validation['on_save'] :
            self.validate()

        if len(payload) > 0 :
            params = dict(docArgs)
            params.update({'collection': self.collection.name, 'keepNull' : keepNull})
            payload = json.dumps(payload, default=str)

            r = self.connection.session.patch(self.URL, params = params, data = payload)
            data = r.json()
            if (r.status_code == 201 or r.status_code == 202) and "error" not in data :
                self._rev = data['_rev']
            else :
                raise UpdateError(data['errorMessage'], data)

            self.modified = False

        self._store.resetPatch()
613741
def upgrade(yes, dry_run, patches):
    
    patcher = _get_mongopatcher()
    if dry_run:
        patcher.discover_and_apply(directory=patches, dry_run=dry_run)
    else:
        if (yes or prompt_bool("Are you sure you want to alter %s" %
                               green(patcher.db))):
            patcher.discover_and_apply(patches)
        else:
            raise SystemExit('You changed your mind, exiting...')
832243
def update(self, quiet=False, prefix='[polyglot_data] '):
    
    self.clear_status_cache()
    for pkg in self.packages():
      if self.status(pkg) == self.STALE:
        self.download(pkg, quiet=quiet, prefix=prefix)
180806
def _get_patches(installed_only=False, root=None):
    '''
    
    '''
    patches = {}
    for element in __zypper__(root=root).nolock.xml.call('se', '-t', 'patch').getElementsByTagName('solvable'):
        installed = element.getAttribute('status') == 'installed'
        if (installed_only and installed) or not installed_only:
            patches[element.getAttribute('name')] = {
                'installed': installed,
                'summary': element.getAttribute('summary'),
            }

    return patches
1156511
def update(
        ctx,
        archive_name,
        bumpversion='patch',
        prerelease=None,
        dependency=None,
        message=None,
        string=False,
        file=None):
    '''
    
    '''

    _generate_api(ctx)

    args, kwargs = _parse_args_and_kwargs(ctx.args)
    assert len(args) == 0, 'Unrecognized arguments: "{}"'.format(args)

    dependencies_dict = _parse_dependencies(dependency)

    var = ctx.obj.api.get_archive(archive_name)
    latest_version = var.get_latest_version()

    if string:

        with var.open(
                'w+',
                bumpversion=bumpversion,
                prerelease=prerelease,
                dependencies=dependencies_dict,
                metadata=kwargs,
                message=message) as f:

            if file is None:
                for line in sys.stdin:
                    f.write(u(line))
            else:
                f.write(u(file))

    else:
        if file is None:
            file = click.prompt('enter filepath')

        var.update(
            file,
            bumpversion=bumpversion,
            prerelease=prerelease,
            dependencies=dependencies_dict,
            metadata=kwargs,
            message=message)

    new_version = var.get_latest_version()

    if latest_version is None and new_version is not None:
        bumpmsg = ' new version {} created.'.format(
            new_version)

    elif new_version != latest_version:
        bumpmsg = ' version bumped {} --> {}.'.format(
            latest_version, new_version)

    elif var.versioned:
        bumpmsg = ' version remains {}.'.format(latest_version)
    else:
        bumpmsg = ''

    click.echo('uploaded data to {}.{}'.format(var, bumpmsg))
770980
def can_patch(self, filename):
    
    filename = abspath(filename)
    for p in self.items:
      if filename == abspath(p.source):
        return self._match_file_hunks(filename, p.hunks)
    return None
710839
def patches
      patch = {}
      loaded_headers.each do |header|
        header.patches.each do |key, val|
          patch[key + header.offset] = val
        end
      end
      patch
    end
442829
function editReadme( readme ) {
		var rprev = new RegExp( Release.prevVersion, "g" );
		return readme.replace( rprev, Release.newVersion );
	}
316231
def _remove_persistent_module(mod, comment):
    '''
    
    '''
    conf = _get_modules_conf()
    mod_name = _strip_module_name(mod)
    if not mod_name or mod_name not in mod_list(True):
        return set()
    escape_mod = re.escape(mod)
    if comment:
        __salt__['file.comment'](conf, '^[\t ]*{0}[\t ]?'.format(escape_mod))
    else:
        __salt__['file.sed'](conf, '^[\t ]*{0}[\t ]?'.format(escape_mod), '')
    return set([mod_name])
302780
def update(oldrev=nil, newrev=nil)
      if index_file_exists? && oldrev != "0"*40
        hg([
            "log --debug -r ?:? --style ? >> ?",
            oldrev, newrev, Style.file_index, path
          ])
      else
        hg(["log --debug -r : --style ? > ?", Style.file_index, path])
      end
    end
1340048
def edit(self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet):
        
        assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
        assert files is github.GithubObject.NotSet or all(element is None or isinstance(element, github.InputFileContent) for element in files.itervalues()), files
        post_parameters = dict()
        if description is not github.GithubObject.NotSet:
            post_parameters["description"] = description
        if files is not github.GithubObject.NotSet:
            post_parameters["files"] = {key: None if value is None else value._identity for key, value in files.iteritems()}
        headers, data = self._requester.requestJsonAndCheck(
            "PATCH",
            self.url,
            input=post_parameters
        )
        self._useAttributes(data)
800076
def checkSetReadOnly(fname, raiseOnErr = False):
    
    if os.access(fname, os.W_OK):
        # We can write to this but it is supposed to be read-only. Fix it.
        # Take away usr-write, leave group and other alone, though it
        # may be simpler to just force/set it to: r--r--r-- or r--------
        irafutils.setWritePrivs(fname, False, ignoreErrors= not raiseOnErr)