patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
This commit is contained in:
Vikram Narayanan
2012-05-23 09:01:06 +00:00
committed by Wolfgang Denk
parent 2b36c75d7b
commit 87d65558ef
3 changed files with 55 additions and 3 deletions

View File

@@ -357,6 +357,24 @@ def GetAliasFile():
fname = os.path.join(GetTopLevel(), fname.strip())
return fname
def GetDefaultUserName():
"""Gets the user.name from .gitconfig file.
Returns:
User name found in .gitconfig file, or None if none
"""
uname = command.OutputOneLine('git', 'config', '--global', 'user.name')
return uname
def GetDefaultUserEmail():
"""Gets the user.email from the global .gitconfig file.
Returns:
User's email found in .gitconfig file, or None if none
"""
uemail = command.OutputOneLine('git', 'config', '--global', 'user.email')
return uemail
def Setup():
"""Set up git utils, by reading the alias files."""
settings.Setup('')