mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
4a8c524692
- filters for All, Local/Remote, and the selected branch
- "Local" includes both branches and tags
- "Remote" includes all branches from the same remote as the selected remote branch (i.e. not other remotes)
Changes to make the above work:
- add a history list class between the repository and rev list
- store a project rev list with all the commits from the project
- use the project rev list to graph the history for individual branches when there have been no changes
- use a different rev list to show non-simple revs (history of a file, revs from the gitx tool)
- update the commits in chunks to a mutable array so the table view's array controller has less work to do
- only update the project rev list from git when actually necessary
- don't add the All Branches and Local Branches revs to the branches array
- some changes related to forcing the project's rev list to update when changes are made
- some changes related to not causing updates too often
- store the selected filter in user defaults
- when the graphing is done select the commit for the branch
57 lines
1.4 KiB
Objective-C
57 lines
1.4 KiB
Objective-C
//
|
|
// PBGitHistoryGrapher.m
|
|
// GitX
|
|
//
|
|
// Created by Nathan Kinsinger on 2/20/10.
|
|
// Copyright 2010 Nathan Kinsinger. All rights reserved.
|
|
//
|
|
|
|
#import "PBGitHistoryGrapher.h"
|
|
#import "PBGitGrapher.h"
|
|
|
|
|
|
@implementation PBGitHistoryGrapher
|
|
|
|
|
|
- (id) initWithBaseCommits:(NSSet *)commits viewAllBranches:(BOOL)viewAll delegate:(id)theDelegate
|
|
{
|
|
delegate = theDelegate;
|
|
searchSHAs = [NSMutableSet setWithSet:commits];
|
|
grapher = [[PBGitGrapher alloc] initWithRepository:nil];
|
|
viewAllBranches = viewAll;
|
|
|
|
return self;
|
|
}
|
|
|
|
|
|
- (void) graphCommits:(NSArray *)revList
|
|
{
|
|
if (!revList || [revList count] == 0)
|
|
return;
|
|
|
|
NSMutableArray *commits = [NSMutableArray array];
|
|
NSInteger counter = 0;
|
|
|
|
for (PBGitCommit *commit in revList) {
|
|
NSString *commitSHA = [commit realSha];
|
|
if (viewAllBranches || [searchSHAs containsObject:commitSHA]) {
|
|
[grapher decorateCommit:commit];
|
|
[commits addObject:commit];
|
|
if (!viewAllBranches) {
|
|
[searchSHAs removeObject:commitSHA];
|
|
[searchSHAs addObjectsFromArray:commit.parents];
|
|
}
|
|
}
|
|
if (++counter % 2000 == 0) {
|
|
[delegate performSelectorOnMainThread:@selector(addCommitsFromArray:) withObject:[commits copy] waitUntilDone:NO];
|
|
commits = [NSMutableArray array];
|
|
}
|
|
}
|
|
|
|
[delegate performSelectorOnMainThread:@selector(addCommitsFromArray:) withObject:commits waitUntilDone:YES];
|
|
[delegate performSelectorOnMainThread:@selector(finishedGraphing) withObject:nil waitUntilDone:NO];
|
|
}
|
|
|
|
|
|
@end
|