@@ -550,6 +550,8 @@ - (NSString *) parseBlame:(NSString *)txt
550
550
NSMutableDictionary *headers=[NSMutableDictionary dictionary ];
551
551
NSMutableString *res=[NSMutableString string ];
552
552
553
+ NSDateFormatter * dateFormatter = [[NSDateFormatter alloc ] initWithDateFormat: @" %Y-%m-%d %H:%M:%S " allowNaturalLanguage: NO ];
554
+
553
555
[res appendString: @" <table class='blocks'>\n " ];
554
556
int i=0 ;
555
557
while (i<[lines count ]){
@@ -561,12 +563,32 @@ - (NSString *) parseBlame:(NSString *)txt
561
563
[res appendFormat: @" <tr class='block l%d '>\n " ,nLines];
562
564
line=[lines objectAtIndex: ++i];
563
565
if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" author" ]){
564
- NSString *author=[line stringByReplacingOccurrencesOfString: @" author" withString: @" " ];
566
+ NSString *author=[line stringByReplacingOccurrencesOfString: @" author " withString: @" " ];
567
+
568
+ NSString *timestamp=nil ;
569
+ while (timestamp==nil ){
570
+ line=[lines objectAtIndex: i++];
571
+ if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" author-time" ]){
572
+ timestamp=[line stringByReplacingOccurrencesOfString: @" author-time " withString: @" " ];
573
+ }
574
+ }
575
+
576
+ NSString *timezone=nil ;
577
+ while (timezone==nil ){
578
+ line=[lines objectAtIndex: i++];
579
+ if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" author-tz" ]){
580
+ timezone=[line stringByReplacingOccurrencesOfString: @" author-tz " withString: @" " ];
581
+ }
582
+ }
583
+
584
+ NSDate *date = [NSDate dateWithTimeIntervalSince1970: [timestamp doubleValue ]];
585
+ NSString *dateString = [NSString stringWithFormat: @" %@ %@ " ,[dateFormatter stringFromDate: date],timezone];
586
+
565
587
NSString *summary=nil ;
566
588
while (summary==nil ){
567
589
line=[lines objectAtIndex: i++];
568
590
if ([[[line componentsSeparatedByString: @" " ] objectAtIndex: 0 ] isEqual: @" summary" ]){
569
- summary=[line stringByReplacingOccurrencesOfString: @" summary" withString: @" " ];
591
+ summary=[line stringByReplacingOccurrencesOfString: @" summary " withString: @" " ];
570
592
}
571
593
}
572
594
NSRange trunc_c={0 ,7 };
@@ -583,7 +605,8 @@ - (NSString *) parseBlame:(NSString *)txt
583
605
if ([summary length ]>30 ){
584
606
truncate_s=[summary substringWithRange: trunc];
585
607
}
586
- NSString *block=[NSString stringWithFormat: @" <td><p class='author'><a href='' onclick='selectCommit(\" %@ \" ); return false;'>%@ </a> %@ </p><p class='summary'>%@ </p></td>\n <td>\n " ,commitID,truncate_c,truncate_a,truncate_s];
608
+ NSString *tooltip = [NSString stringWithFormat: @" %@ \n Author: %@ \n Date: %@ \n\n %@ " ,commitID,author,dateString,summary];
609
+ NSString *block=[NSString stringWithFormat: @" <td><p class='author'><a title='%@ ' href='' onclick='selectCommit(\" %@ \" ); return false;'>%@ </a> %@ </p><p class='summary'>%@ </p></td>\n <td>\n " ,tooltip,commitID,truncate_c,truncate_a,truncate_s];
587
610
[headers setObject: block forKey: [header objectAtIndex: 0 ]];
588
611
}
589
612
[res appendString: [headers objectForKey: [header objectAtIndex: 0 ]]];
0 commit comments