Patchwork Hint for setting the username

login
register
mail settings
Submitter arne_bab at web.de
Date July 9, 2013, 2:51 p.m.
Message ID <878v1flrb2.wl%arne_bab@web.de>
Download mbox | patch
Permalink /patch/1809/
State Changes Requested, archived
Headers show

Comments

arne_bab at web.de - July 9, 2013, 2:51 p.m.
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@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.



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
Simon King - July 9, 2013, 4:32 p.m.
On Tue, Jul 9, 2013 at 3:51 PM, Arne Babenhauserheide <arne_bab@web.de> wrote:
> 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@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

(Presuming to be qualified to review patches, which I'm really not)

This falls foul of a number of rules on
http://mercurial.selenic.com/wiki/ContributingChanges and
http://mercurial.selenic.com/wiki/CodingStyle. Specifically, the ones
about patch description, line length, and spaces around operators.

From a more technical point of view, the Abort exception accepts a
"hint" keyword parameter. Hints will automatically be displayed after
the main message:

  http://selenic.com/hg/file/fbdac607bff3/mercurial/dispatch.py#l52

The irony (or whatever) of rejecting a patch that aims to make it
easier for people to contribute changes is not lost on me...

Simon
Alexander Plavin - July 9, 2013, 5:23 p.m.
2013/7/9 Arne Babenhauserheide <arne_bab@web.de>:
> Hi,
>
> As followup on the earlier discussion¹, I created a patch for adding a hint how to add the username.

Not speaking about the patch rules compliance, I would like such a
hint at the beginning of using Mercurial. Or even smth like 'git
config' :)

>
> # HG changeset patch
> # User Arne Babenhauserheide <arne_bab@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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - July 9, 2013, 6:21 p.m.
On Jul 9, 2013, at 10:51 AM, Arne Babenhauserheide <arne_bab@web.de> wrote:

> 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@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])

As Simon mentioned, this patch could use running the test suite and reading of the commit message guidelines.

Thanks!

>         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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - July 9, 2013, 6:29 p.m.
On Tue, 2013-07-09 at 16:51 +0200, Arne Babenhauserheide wrote:
> Hi,
> 
> As followup on the earlier discussion¹, I created a patch for adding a hint how to add the username. 

In addition to the usual submission checklist, it's extremely helpful
when proposing UI changes to show us what it looks like. For instance:

  It used to look like this:

    $ hg commit
    you are a n00b (read the manual)

  ..which was a problem, as the message was unhelpful. Now it looks like this:

    $ hg commit
    you are a n00b
    (add this setting)

> +                               '(add section [ui] with username = YOURNAME in %s)')%scmutil.userrcpath()[0])

We recommend using email addresses?

It's also worth noting that a non-negligible percentage of n00bs balk at
the idea of creating a brand new config file.
arne_bab at web.de - July 9, 2013, 8:30 p.m.
Am Dienstag, 9. Juli 2013, 14:21:48 schrieb Augie Fackler:
> > -            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])
> 
> As Simon mentioned, this patch could use running the test suite and reading of the commit message guidelines.
> 
> Thanks!

When the question is “do I write a mediocre patch or don’t I write one at all”, I prefer the mediocre patch.

This is a quick patch because when I skimmed the Mercurial release notes today I realized that I had not managed to do a good fix for the issue in 2 months - and no one else had done it either.

Best wishes,
Arne
--
A man in the streets faces a knife.
Two policemen are there it once. They raise a sign:

    “Illegal Scene! Noone may watch this!”

The man gets robbed and stabbed and bleeds to death.
The police had to hold the sign.

…Welcome to Europe, citizen. Censorship is beautiful.

   ( http://draketo.de/stichwort/censorship )
arne_bab at web.de - July 9, 2013, 8:30 p.m.
Am Dienstag, 9. Juli 2013, 13:29:49 schrieb Matt Mackall:
> > +                               '(add section [ui] with username = YOURNAME in %s)')%scmutil.userrcpath()[0])
> 
> We recommend using email addresses?

I left it out because I wasn’t sure about the maximum length of the commandline output. And had no time to read up.

> It's also worth noting that a non-negligible percentage of n00bs balk at
> the idea of creating a brand new config file.

Fixing this will require config file editing.

I would be all for adding a config command which simply allows querying for config values and starting an editor. Maybe with nicely commented example content, if there is no file, yet. IIRC that also was the conclusion about the best solution when last discussed this. 

hg config --edit # edit the repo config
hg config --edit --user # edit the user config
hg config --edit --system # edit the system config
hg config --files # list the rc files. --list could also mean listing the values.

But I cannot do it at the moment, and I don’t know whether I will be able to do it in the next months since my free time has grown really short.

All the while this huge new-user-turnoff sits here even though there would be a really simple fix which will make it much easier for most new users.
(that fix is what you proposed as temporary fix in the last discussion)

Best wishes,
Arne
--
Konstruktive Kritik: 

- http://draketo.de/licht/krude-ideen/konstruktive-kritik
Idan Kamara - July 9, 2013, 8:54 p.m.
On Tue, Jul 9, 2013 at 11:30 PM, Arne Babenhauserheide <arne_bab@web.de>
wrote:
>
> Am Dienstag, 9. Juli 2013, 13:29:49 schrieb Matt Mackall:
> > > +                               '(add section [ui] with username =
> > > YOURNAME in %s)')%scmutil.userrcpath()[0])
> >
> > We recommend using email addresses?
>
> I left it out because I wasn’t sure about the maximum length of the
> commandline output. And had no time to read up.
>
> > It's also worth noting that a non-negligible percentage of n00bs balk at
> > the idea of creating a brand new config file.
>
> Fixing this will require config file editing.

commit also has the -u option, perhaps the message could hint towards it
while also mentioning the permanent and preferred way via hgrc.
arne_bab at web.de - July 10, 2013, 7:45 p.m.
Hi Simon,

Am Dienstag, 9. Juli 2013, 17:32:30 schrieb Simon King:
> > -            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])
> (Presuming to be qualified to review patches, which I'm really not)

Judging from your post, you are.

> This falls foul of a number of rules on
> http://mercurial.selenic.com/wiki/ContributingChanges and
> http://mercurial.selenic.com/wiki/CodingStyle. Specifically, the ones
> about patch description, line length, and spaces around operators.
> 
> From a more technical point of view, the Abort exception accepts a
> "hint" keyword parameter. Hints will automatically be displayed after
> the main message:
> 
>   http://selenic.com/hg/file/fbdac607bff3/mercurial/dispatch.py#l52

That’s nice to know, thanks!

> The irony (or whatever) of rejecting a patch that aims to make it
> easier for people to contribute changes is not lost on me...

well… you can also take and improve it.

As I wrote in another mail, the free time in which I’m able to concentrate is quite limited nowadays (mostly due to family responsibilities), so I had the chance of doing a quick patch or not doing anything… 

Best wishes,
Arne
arne_bab at web.de - July 10, 2013, 7:46 p.m.
Am Dienstag, 9. Juli 2013, 13:29:49 schrieb Matt Mackall:
> > +                               '(add section [ui] with username = YOURNAME in %s)')%scmutil.userrcpath()[0])
> 
> We recommend using email addresses?

How about 

    add section [ui] with username = NAME <MAIL> in %s

--
singing a part of the history of free software: 

- http://infinite-hands.draketo.de

Patch

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