Den fre 10 mars 2023 kl 10:22 skrev Atena Bogusz <atena.bog...@gmail.com>:

> Hello everybody,
>
> I wish to write a patch that would perform a lookup on missing targets
> when SVN_ERR_ILLEGAL_TARGET occurs and would display a suggested correction
> to the path alongside the error message.
>
> Suggested implementation: the algorithm will identify which part of the
> path is valid (starting from root), substitute the invalid element with
> other directories found in the path (not recursive) and test if that makes
> the path a valid target. I don't see a simple method for suggesting
> corrections to mistyped files without a full-fledged autocorrection engine,
> therefore only the directories can be substituted.
>
> The implementation I proposed above is hopefully simple enough to not
> warrant a drawn out debate on what kinds of mistakes in the path and in
> what way should be handled before receiving a go-ahead.
>
> Feel free to respond with any objections or suggestions.
>
> Maybe I'm spoiled by modern C compilers literally writing code for me when
> I make a typo but this missing feature really irks me for some reason. I'm
> glad to contribute a proper autocorrection system server-side instead of my
> simple algorithm if my imagined opposition to the idea turns out to be, in
> fact, imaginary. I reckon the problem of rating strings by similarity is a
> solved problem in computing and there is a properly-licensed library to
> plug into the codebase or an open-source algorithm at the least.
>

Glad to see you want to contribute!

I tried a quick grep in the source code for SVN_ERR_ILLEGAL_TARGET and it
occurs in a lot of places, but it isn't clear to me what problem you are
trying to solve. Most places seems to be along the lines:

[[[
if (svn_path_is_url(path))
  return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
    _("'%s' is not a local path"), path);
]]]

Can you give a short reproduction script of what use case you consider,
with the current error and the suggested result?

Please note that there is already some autocompletion support if you are
using bash (or compatible shells), see
http://svn.apache.org/repos/asf/subversion/trunk/tools/client-side/bash_completion
.

Kind regards,
Daniel Sahlberg

Reply via email to