automatically use the git username and e-mail in the generated ChangeLog.txt entries

This commit is contained in:
Viktor Szakats
2013-03-18 00:10:57 +01:00
parent 4b077bd8cf
commit 69c60e9ef3
2 changed files with 26 additions and 5 deletions

View File

@@ -10,6 +10,11 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-03-18 00:09 UTC+0100 Viktor Szakats (harbour syenar.net)
* bin/commit.hb
+ automatically use the git username and e-mail in the
generated ChangeLog.txt entries
2013-03-18 00:01 UTC+0100 Viktor Szakats (harbour syenar.net)
* doc/howtorep.txt
* updated for Git

View File

@@ -51,12 +51,16 @@ PROCEDURE Main()
// ;
IF ! Empty( GetEnv( _CONFIGENV_ ) )
cMyName := GetEnv( _CONFIGENV_ )
ELSEIF hb_FileExists( _CONFIGFIL_ )
cMyName := AllTrim( hb_MemoRead( _CONFIGFIL_ ) )
IF cVCS == "git"
cMyName := GitUser()
ELSE
cMyName := "Firstname Lastname (me domain.net)"
IF ! Empty( GetEnv( _CONFIGENV_ ) )
cMyName := GetEnv( _CONFIGENV_ )
ELSEIF hb_FileExists( _CONFIGFIL_ )
cMyName := AllTrim( hb_MemoRead( _CONFIGFIL_ ) )
ELSE
cMyName := "Firstname Lastname (me domain.net)"
ENDIF
ENDIF
nOffset := hb_UTCOffset()
@@ -223,3 +227,15 @@ STATIC FUNCTION Changes( cVCS )
ENDCASE
RETURN hb_ATokens( StrTran( cStdOut, Chr( 13 ) ), Chr( 10 ) )
STATIC FUNCTION GitUser()
LOCAL cName := ""
LOCAL cEMail := ""
hb_processRun( Shell() + " " + CmdEscape( "git config user.name" ),, @cName )
hb_processRun( Shell() + " " + CmdEscape( "git config user.email" ),, @cEMail )
RETURN hb_StrFormat( "%s (%s)", ;
AllTrim( hb_StrReplace( cName, Chr( 10 ) + Chr( 13 ), "" ) ), ;
StrTran( AllTrim( hb_StrReplace( cEMail, Chr( 10 ) + Chr( 13 ), "" ) ), "@", " " ) )