Powershell: SVN logs formatting issue- please help ; Microso

by psnovice at 2013-01-23 09:47:18

Please help me formatting as table or list view for svn log output.





$buildLatestLogs=svn log --limit 2 $Repo | Format-Table -AutoSiz

Send email code:

$body = "$buildLatestLogs"

Send-MailMessage -smtpServer $smtp -from $from -to $to -subject $subject -Body $body -BodyAsHtml


Email:

Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
by ArtB0514 at 2013-01-23 13:23:33
You cannot use the output from Format-Table. It returns internal format objects that represent the table and they are not at all useful for further processing. You are going to have to find some other way to convert the data returned from SVN into a string to be emailed. Do this to see what you have to work with:

$buildLatestLogs=@(svn log --limit 2 $Repo)
$buildLatestLogs[0] | Get-Member -MemberType *Property # this will tell you what data was returned
$buildLatestLogs | Format-Table -AutoSize # this will show you the returned objects in table form if it fits the screen


I don’t have access to SVN, so you’ll need to post the results in order to get some help in formatting the message body.
by psnovice at 2013-01-23 14:02:14
Thanks.

Result form line # 2:

TypeName: System.String

Name MemberType Definition
---- ---------- ----------
Chars ParameterizedProperty char Chars(int index) {get;}
Length Property System.Int32 Length {get;}
by ArtB0514 at 2013-01-24 10:47:00
Good. Then use this to build the body of your email message:

$body = $buildLatestLogs -Join “`n”

$buildLatestLogs is an array of strings. All you need to do is join all the individual strings into a single big string separated by new-line characters.