Merge branch 'ab/fqueue_stage' into devel

This commit is contained in:
André Berg
2009-10-24 09:04:37 +02:00
7 changed files with 83 additions and 3 deletions
+61
View File
@@ -34,11 +34,72 @@
return [NSDate dateWithTimeIntervalSince1970:timestamp];
}
#ifdef NormalDate
- (NSString *) dateString
{
NSDateFormatter* formatter = [[NSDateFormatter alloc] initWithDateFormat:@"%Y-%m-%d %H:%M:%S" allowNaturalLanguage:NO];
return [formatter stringFromDate: self.date];
}
#else
// Code modified from Gilean ( http://stackoverflow.com/users/6305/gilean ).
// Copied from stackoverflow's accepted answer for Objective C relative dates.
// http://stackoverflow.com/questions/902950/iphone-convert-date-string-to-a-relative-time-stamp
// Modified the seconds constants with compile time math to aid in ease of adjustment of "Majic" numbers.
//
-(NSString *)dateString {
NSDate *todayDate = [NSDate date];
double ti = [self.date timeIntervalSinceDate:todayDate];
ti = ti * -1;
if(ti < 1) {
return @"In the future!";
} else if ( ti < 60 ) {
return @"less than a minute ago";
} else if ( ti < (60 * 60) ) {
int diff = round(ti / 60);
if ( diff < 2 ) {
return @"1 minute ago";
} else {
return [NSString stringWithFormat:@"%d minutes ago", diff];
}
} else if ( ti < ( 60 * 60 * 24 ) ) {
int diff = round(ti / 60 / 60);
if ( diff < 2 ) {
return @"1 hour ago";
} else {
return[NSString stringWithFormat:@"%d hours ago", diff];
}
} else if ( ti < ( 60 * 60 * 24 * 7 ) ) {
int diff = round(ti / 60 / 60 / 24);
if ( diff < 2 ) {
return @"1 day ago";
} else {
return[NSString stringWithFormat:@"%d days ago", diff];
}
} else if ( ti < ( 60 * 60 * 24 * 31.5 ) ) {
int diff = round(ti / 60 / 60 / 24 / 7);
if ( diff < 2 ) {
return @"1 week ago";
} else {
return[NSString stringWithFormat:@"%d weeks ago", diff];
}
} else if ( ti < ( 60 * 60 * 24 * 365 ) ) {
int diff = round(ti / 60 / 60 / 24 / 30);
if ( diff < 2 ) {
return @"1 month ago";
} else {
return[NSString stringWithFormat:@"%d months ago", diff];
}
} else {
float diff = round(ti / 60 / 60 / 24 / 365 * 4) / 4.0;
if ( diff < 1.25 ) {
return @"1 year ago";
} else {
return[NSString stringWithFormat:@"%g years ago", diff];
}
}
}
#endif
- (NSArray*) treeContents
{
+1 -1
View File
@@ -14,7 +14,7 @@
@interface PBGitGrapher : NSObject {
PBGraphCellInfo *previous;
void *pl;
int curLane;
void *endLane;
}
- (id) initWithRepository:(PBGitRepository *)repo;
+7 -1
View File
@@ -53,6 +53,11 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
std::list<PBGitLane *>::iterator it = previousLanes->begin();
for (; it != previousLanes->end(); ++it) {
i++;
if(*it == (PBGitLane *)endLane) {
delete *it;
endLane = NULL;
continue;
}
// This is our commit! We should do a "merge": move the line from
// our upperMapping to their lowerMapping
if ((*it)->isCommit([commit sha])) {
@@ -141,7 +146,8 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
if (currentLane && commit.nParents > 0)
currentLane->setSha(commit.parentShas[0]);
else
currentLanes->remove(currentLane);
endLane = currentLane;
// currentLanes->remove(currentLane); // must be leaked without this changes
delete previousLanes;
+7
View File
@@ -9,6 +9,7 @@
#import "PBGitWindowController.h"
#import "PBGitHistoryController.h"
#import "PBGitCommitController.h"
#import "PBGitDefaults.h"
@implementation PBGitWindowController
@@ -137,6 +138,12 @@
[[NSAlert alertWithError:error] beginSheetModalForWindow: [self window] modalDelegate:self didEndSelector:nil contextInfo:nil];
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
if (self.viewController && [PBGitDefaults refreshAutomatically]) {
[(PBViewController *)self.viewController refresh:nil];
}
}
#pragma mark -
#pragma mark Toolbar Delegates
+1
View File
@@ -25,4 +25,5 @@
- (void) updateView;
- (NSResponder *)firstResponder;
- (IBAction) refresh:(id)sender;
@end
+5
View File
@@ -45,4 +45,9 @@
{
return nil;
}
- (IBAction) refresh:(id)sender
{
return;
}
@end
+1 -1
View File
@@ -244,7 +244,7 @@ var showDiff = function() {
p.insertBefore(document.createTextNode(name1 + " -> "), link);
}
link.appendChild(document.createTextNode(finalFile));
link.appendChild(document.createTextNode(finalFile.unEscapeHTML()));
button.setAttribute("representedFile", finalFile);
link.setAttribute("representedFile", finalFile);