cdm could be more useful about recommit authorship
Several people have been bitten lately by "recommit" resetting authorship unless told not to.
We can make it better.
A fix, which I have barely tested, and only wrote because I pretty much wrote it verbatim into IRC is here. Anyone taking this and running with it would need to add tests to cadtest, which you can find here: http://bitbucket.org/richlowe/il-scmtest:
diff --git a/usr/src/tools/onbld/hgext/cdm.py b/usr/src/tools/onbld/hgext/cdm.py index 0ce41d4..eafa492 100644 --- a/usr/src/tools/onbld/hgext/cdm.py +++ b/usr/src/tools/onbld/hgext/cdm.py @@ -950,7 +950,19 @@ def cdm_recommit(ui, repo, **opts): False): raise util.Abort("recommit would clobber files") - user = opts['user'] or ui.username() + + if opts['user']: + user = opts['user'] + else: + authors = set(x.user() for x in active.revs) + if len(authors) == 1: + user = list(authors) + else: + ui.write("There are %d potential authors\n" % len(authors)) + for elt in authors: + ui.write(" %s\n" % elt) + user = ui.prompt("author (defaults to you):", default=ui.username()) + comments = '\n'.join(active.comments()) message = cmdutil.logmessage(opts) or ui.edit(comments, user)
Updated by Rich Lowe over 9 years ago
Whoever does this could also be awesome, and teach it to valid that the author matches the format we require ("Name name <firstname.lastname@example.org>"), to prevent problems later. Especially now we prompt interactively and typoes will abound.
There is also a really good chance that the above only works in Mercurial's newer than 1.3 (which I'd bet OI still ships, for shame).