[darcs-users] Using hash(es) for selecting one or more patches

Gian Piero Carrubba gpiero at rm-rf.it
Thu Aug 14 19:42:20 UTC 2014


Hi all,

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 ...'`.

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
- no options inflating

disadvantages:
1. no hash prefix matches: too many chances for false positives.
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 ...'`

If we had (or will have in the future) a short-id like other VCSs, we 
could use both full and short versions for alleviate 1, but this would 
OTOH aggravate 2.

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, ...

Does it make sense ? I would really like to avoid adding another option, 
but the drawbacks are bugging me.

Ciao,
Gian Piero.

[0] I would have preferred `-h/--hash` or `-i/--id` or even 
`-u/--(uuid|uniqueid)`, but all the good short options were already 
taken.


More information about the darcs-users mailing list