forked from laullon/gitx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPBStashContentController.m
48 lines (39 loc) · 1.3 KB
/
PBStashContentController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// PBStashContentController.h
// GitX
//
// Created by David Catmull on 20-06-11.
// Copyright 2011. All rights reserved.
//
#import "PBStashContentController.h"
#import "PBGitCommit.h"
#import "PBGitDefaults.h"
#import "PBGitStash.h"
#import "PBWebHistoryController.h"
#import "PBWebStashController.h"
const CGFloat kMinPaneSize = 32.0;
@implementation PBStashContentController
- (void) awakeFromNib
{
[unstagedController setRepository:repository];
[stagedController setRepository:repository];
}
- (void) showStash:(PBGitStash*)stash
{
NSString *stashRef = [NSString stringWithFormat:@"refs/%@", [stash name]];
NSString *stashSHA = [repository shaForRef:[PBGitRef refFromString:stashRef]];
PBGitCommit *commit = [repository commitForSHA:stashSHA];
NSString *indexSHA = [commit.parents objectAtIndex:1];
PBGitCommit *indexCommit = [repository commitForSHA:indexSHA];
[unstagedController changeContentTo:commit];
[stagedController changeContentTo:indexCommit];
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
return kMinPaneSize;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
return [splitView frame].size.height - kMinPaneSize;
}
@end