[darcs-devel] [patch948] patch for repository aliases

Daniel Gorín jcpetruzza at gmail.com
Thu Oct 4 19:31:24 UTC 2012


Thanks Owen and Ganesh for the comments!

I'd be happy to polish the patch with the suggestions that were put forward, but I'd like to wait to see if there is consensus before putting more time in it (the implementation as it is already serves as proof-of-concept). So I'll comment next on the the concerns raised by Ganesh.

* I don't think bash-completion is a suitable alternative for a number of reasons:
    
   1) bash is not ubiquitous (e.g. Windows) and is not a requirement for using darcs. Moreover, even on systems that come with bash, bash-completion is not provided by default.
   2) This alternative depends, IIUC, on the user pressing <tab> _every time_ a repository alias is given on the command line.
   3) If you have two different projects, you will probably want 'master' to stand for different things in each case, so the completion script needs to take the current directory into account. Now, since you shouldn't modify the bash-completion script for darcs for each new project, you will want the script to read an 'aliases' file somewhere in your project to determine what 'master' stands for (a centralized file seems like a much worse alternative to me).

So summing up, with bash-completion you get the same burden on the user (namely, the need to define alias files in order to use it), with a worse interface (<tab> is mandatory) and on fewer platforms. (Btw, if some form of repository aliases were adopted, the darcs bash-completion script could be extended to take the info in the aliases files into account).

* If one wanted to avoid ambiguity in general, aliases could be forced to start/end with some character unusual in file names. I don't favor this alternative, but to me it it shows that question of handling ambiguity is more or less orthogonal to the question of having aliases in the first place.

Regarding ambiguity, as of this patch you only get an alias expanded if you created an aliases file in the first place, so I don't anticipate surprised users. As a connected but *independent* proposal one could consider adding an aliasesfile preference, in analogy to boringfile. I would actually use this feature (e.g., it makes migrating repository locations almost transparent), but of course, this could potentially puzzle users unaware of aliases.



More information about the darcs-devel mailing list