[darcs-users] Using hash(es) for selecting one or more patches
Gian Piero Carrubba
gpiero at rm-rf.it
Tue Aug 26 07:09:28 UTC 2014
Hi Guillame
* [Mon, Aug 25, 2014 at 04:51:31PM -0300] Guillaume Hoffmann:
>> now that `log` shows the hash of the patches, I would like to use it
>> for selecting patches as `log (or whatever) -p` is not much handy
>> where there are similar- or same-named patches. On the other hand,
>> typing `--match 'hash` is boring, so I've added a `-H/--hash`[0]
>> option that aliases to `--match 'hash ...'`.
>
>I think it's a good idea.
>
>I wouldn't even mind using -h (currently used as --help). Some
>programs use it as a --help alias (svn, hg), others don't (git, ghc).
I'm pretty adverse to this, as '-h' for 'help' has a long tradition in
the Unix world. Also, when this is not the case (git, ghc), as far as I
know '-h' is not used for something different but is simply
unrecognized. My idea is that it would break users expectations and
violate an unwritten contract.
>> Then I've changed idea and instead thought that I would prefer to
>> continue using `-p` and darcs should discriminate if I've provided a
>> regex or a hash.
>> So I've modified `-p` (and the related `--from-patch` and
>> `--to-patch`) in order to consider its argument as a hash if it's 40
>> chars long and only composed by hex digits.
>>
>> advantages:
>> - much shorter patch
>
>I'm not sure I understand. You mean shorter flag?
Well, in a way the flag is shorter as you don't have to use the Shift
key (my opinion is that the short options should be as fast to type as
possible[0]). But what I meant here is that the number of line
insertions/deletions is lower.
>> disadvantages:
[...]
>> 2. lack of correctness if your regex happens to be a 40 digits long
>> hex. In this case you would have to resort to `--match 'name ...'`
[...]
>> While I consider the chances for 2. pretty limited, the drawbacks
>> seem serious: user's surprise, breakage of sw that automatically
>> names patches using hashes, possible kittens injuries, ...
>
>Indeed. I wonder if people out there use hashes as patch names?
I think it's unlikely, but not impossible. So after some thought,
although I'm using the modified '-p' for myself and I like it, I've
managed to convince myself that adding a new option is the way to go.
Ciao,
Gian Piero.
[0] So, I still don't like '-H'. I would probably use '-x', if only I
could find a valid, easy to remember, rationale for it.
More information about the darcs-users
mailing list