Project

General

Profile

Bug #2053

cdm could be more useful about recommit authorship

Added by Rich Lowe about 8 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
tools - gate/build tools
Start date:
2012-02-01
Due date:
% Done:

30%

Estimated time:
Difficulty:
Medium
Tags:

Description

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)[0]
+            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)

History

#1

Updated by Rich Lowe about 8 years ago

Whoever does this could also be awesome, and teach it to valid that the author matches the format we require ("Name name <>"), 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).

#2

Updated by Joshua M. Clulow about 8 years ago

  • Assignee set to Joshua M. Clulow
  • Tags deleted (needs-triage)
#3

Updated by Joshua M. Clulow over 2 years ago

  • Status changed from New to Closed

I don't think we really do Mercurial anymore, so this is no longer a thing?

Also available in: Atom PDF