On Wed, 11 Oct 2017 14:09:53 +0200, Boris Feld wrote: > # HG changeset patch > # User Boris Feld <boris.f...@octobus.net> > # Date 1507299827 -7200 > # Fri Oct 06 16:23:47 2017 +0200 > # Node ID b6b6cb2b16cb2c44b10113134e212bae5b47adb0 > # Parent c6979350fac712aae8bd776553b3c7692a8136cf > # EXP-Topic obsfatekeyword > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > b6b6cb2b16cb > ui: add the possibility to returns None as username in ui > > In a later patch we want to retrieve the current username or None if it isn't > defined. Add the allowempty parameter instead of catching Abort.
Nit: s/allow/accept/ ? > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -758,13 +758,15 @@ > return feature not in exceptions > return True > > - def username(self): > + def username(self, acceptempty=False): > """Return default username to be used in commits. > > Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL > and stop searching if one of these is set. > If not found and ui.askusername is True, ask the user, else use > ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname". > + If no username could be found, raise an Abort error or returns None > if > + acceptempty is True. > """ > user = encoding.environ.get("HGUSER") > if user is None: > @@ -782,6 +784,9 @@ > except KeyError: > pass > if not user: > + if acceptempty: > + return user Perhaps we'll need to suppress warning and prompt as well. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel