Den fre 10 mars 2023 kl 12:03 skrev Atena Bogusz <atena.bog...@gmail.com>:
> Sure, I'll use subversion repository as an example. > > I'm working on Linux in terminal. Suppose I want to check out > documentation from a specific branch: > > $ svn co > https://svn.apache.org/repos/asf/subversion/branches/issue-2897/doc > > I type the address in the command line from memory, because I'm familiar > with the project and remember the path and happen to make a typo: > > $ svn ls > https://svn.apache.org/repos/asf/subversion/branches/issue2897/doc > svn: warning: W160013: URL ' > https://svn.apache.org/repos/asf/subversion/branches/issue2897/doc' nie > istnieje w wersji 1908248 > svn: E200009: Could not list all targets because some targets don't exist > > What I would want to see in that situation would be another message > pointing me to a correct path: > > $ svn ls > https://svn.apache.org/repos/asf/subversion/branches/issue2897/doc > svn: warning: W160013: URL ' > https://svn.apache.org/repos/asf/subversion/branches/issue2897/doc' nie > istnieje w wersji 1908248 > svn: E200009: Could not list all targets because some targets don't exist > svn: did you mean ' > https://svn.apache.org/repos/asf/subversion/branches/issue-2897/doc'' > instead? > > The way we organize directories at my workplace, I'd often need to go > through 5 directories to get to the branch I'm working on and I make typos > often. > Sounds like a good idea to me, however I still think you should investigate the tabcompletion feature. At least to me it is more intuitive to tab my way through the path when I enter it. Kind regards, Daniel > > pt., 10 mar 2023 o 11:45 Daniel Sahlberg <daniel.l.sahlb...@gmail.com> > napisaĆ(a): > >> 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 >> >> >> >> >> >>