8
8
9
9
#import " FileViewerController.h"
10
10
#import " PBGitHistoryController.h"
11
+ #import " PBGitDefaults.h"
11
12
12
13
#define GROUP_LABEL @" Label" // string
13
14
#define GROUP_SEPARATOR @" HasSeparator" // BOOL as NSNumber
@@ -33,6 +34,10 @@ - (void)awakeFromNib
33
34
self.groups = [NSMutableArray arrayWithCapacity: 0 ];
34
35
scopeBar.delegate = self;
35
36
NSArray *items = [NSArray arrayWithObjects:
37
+ [NSDictionary dictionaryWithObjectsAndKeys:
38
+ (commit)?@" commit" :@" diff" , ITEM_IDENTIFIER,
39
+ @" Diff" , ITEM_NAME,
40
+ nil ],
36
41
[NSDictionary dictionaryWithObjectsAndKeys:
37
42
@" source" , ITEM_IDENTIFIER,
38
43
@" Source" , ITEM_NAME,
@@ -41,10 +46,6 @@ - (void)awakeFromNib
41
46
@" blame" , ITEM_IDENTIFIER,
42
47
@" Blame" , ITEM_NAME,
43
48
nil ],
44
- [NSDictionary dictionaryWithObjectsAndKeys:
45
- (commit)?@" commit" :@" diff" , ITEM_IDENTIFIER,
46
- @" Diff" , ITEM_NAME,
47
- nil ],
48
49
[NSDictionary dictionaryWithObjectsAndKeys:
49
50
@" log" , ITEM_IDENTIFIER,
50
51
@" History" , ITEM_NAME,
@@ -78,6 +79,7 @@ - (void) selectCommit:(NSString*)c
78
79
NSLog (@" [FileViewerController selectCommit:%@ ]" ,c);
79
80
}
80
81
82
+
81
83
#pragma mark MGScopeBarDelegate methods
82
84
83
85
@@ -145,13 +147,16 @@ - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *
145
147
146
148
+ (BOOL )isSelectorExcludedFromWebScript : (SEL )sel
147
149
{
148
- return YES ;
150
+ NSLog (@" [%@ %s ]: self = %@ (%i )" , [self class ], _cmd, self,[self respondsToSelector: sel]);
151
+ return NO ;
149
152
}
150
153
151
154
- (void )webView : (WebView *)sender didClearWindowObject : (WebScriptObject *)windowObject forFrame : (WebFrame *)frame
152
155
{
153
156
id script = [sender windowScriptObject ];
157
+ NSLog (@" Controller: %@ " , controller);
154
158
[script setValue: controller forKey: @" Controller" ];
159
+ [script setValue: [PBGitDefaults alloc ] forKey: @" Config" ];
155
160
}
156
161
157
162
- (void )webView : (WebView *)webView addMessageToConsole : (NSDictionary *)dictionary
@@ -175,8 +180,13 @@ - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
175
180
txt=[repository outputForArguments: [NSArray arrayWithObjects: @" show" , [self refSpec ], nil ]];
176
181
else if (show==@" blame" )
177
182
txt=[self parseBlame: [repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" blame" , @" -p" , file, sha, nil ]]];
178
- else if ((show==@" diff" ) || (show==@" commit" ))
179
- txt=[repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" diff" , (sha!=nil )?sha: file , (sha!=nil )?file: nil , nil ]];
183
+ else if (show==@" diff" ){
184
+ NSString *diff_p=[repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" show" , @" --pretty=format:" , sha, file, nil ]];
185
+ NSString *diff_l=[repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" diff" , file, nil ]];
186
+ txt=[NSString stringWithFormat: @" %@ \n %@ " ,diff_p,diff_l];
187
+ }
188
+ else if (show==@" commit" )
189
+ txt=[repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" diff" , (sha!=nil )?sha: file, (sha!=nil )?file: nil , nil ]];
180
190
else if (show==@" log" )
181
191
txt=[self parseLog: [repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" log" , [NSString stringWithFormat: @" --pretty=format:%@ " ,format], @" --" , file, nil ]]];
182
192
else
0 commit comments