Hint for setting the username

Arne Babenhauserheide arne_bab at web.de
Tue Jul 9 09:51:45 CDT 2013


Hi,

As followup on the earlier discussion¹, I created a patch for adding a hint how to add the username. 

# HG changeset patch
# User Arne Babenhauserheide <arne_bab at web.de>
# Date 1373381124 -7200
#      Tue Jul 09 16:45:24 2013 +0200
# Node ID ffab6750bcc27f226ac8d3face81ff42baed5302
# Parent  648d1974b3f328947ee6cf2d00c66815a33cd208
when no username is set, provide a hint with the user rcfile.

diff -r 648d1974b3f3 -r ffab6750bcc2 mercurial/ui.py
--- a/mercurial/ui.py   Sun Jun 30 15:19:39 2013 -0500
+++ b/mercurial/ui.py   Tue Jul 09 16:45:24 2013 +0200
@@ -448,7 +448,8 @@
             except KeyError:
                 pass
         if not user:
-            raise util.Abort(_('no username supplied (see "hg help config")'))
+            raise util.Abort(_('no username supplied (see "hg help config")\n'
+                               '(add section [ui] with username = YOURNAME in %s)')%scmutil.userrcpath()[0])
         if "\n" in user:
             raise util.Abort(_("username %s contains a newline\n") % repr(user))
         return user


You can also pull it from bitbucket as ffab6750bcc27f226ac8d3face81ff42baed5302:

    https://bitbucket.org/ArneBab/hg-stable/


Best wishes,
Arne

¹: discussion about the new-user workflow breaking when a username is
   required:
   http://draketo.de/light/english/dvcs-workflow-failures-git-hg


More information about the Mercurial-devel mailing list