@@ -48,7 +48,7 @@ - (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGit
48
48
self = [super initWithRepository: theRepository superController: controller];
49
49
[sourceView setDelegate: self ];
50
50
items = [NSMutableArray array ];
51
-
51
+
52
52
return self;
53
53
}
54
54
@@ -57,19 +57,19 @@ - (void)awakeFromNib
57
57
[super awakeFromNib ];
58
58
window.contentView = self.view ;
59
59
[self populateList ];
60
-
60
+
61
61
historyViewController = [[PBGitHistoryController alloc ] initWithRepository: repository superController: superController];
62
62
commitViewController = [[PBGitCommitController alloc ] initWithRepository: repository superController: superController];
63
-
63
+
64
64
[repository addObserver: self forKeyPath: @" refs" options: 0 context: @" updateRefs" ];
65
65
[repository addObserver: self forKeyPath: @" currentBranch" options: 0 context: @" currentBranchChange" ];
66
66
[repository addObserver: self forKeyPath: @" branches" options: (NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context: @" branchesModified" ];
67
67
[repository addObserver: self forKeyPath: @" stashController.stashes" options: NSKeyValueObservingOptionNew context: kObservingContextStashes ];
68
68
[repository addObserver: self forKeyPath: @" submoduleController.submodules" options: NSKeyValueObservingOptionNew context: kObservingContextSubmodules ];
69
-
70
-
69
+
70
+
71
71
[self menuNeedsUpdate: [actionButton menu ]];
72
-
72
+
73
73
if ([PBGitDefaults showStageView ])
74
74
[self selectStage ];
75
75
else
@@ -83,12 +83,12 @@ - (void)closeView
83
83
{
84
84
[historyViewController closeView ];
85
85
[commitViewController closeView ];
86
-
86
+
87
87
[repository removeObserver: self forKeyPath: @" currentBranch" ];
88
88
[repository removeObserver: self forKeyPath: @" branches" ];
89
89
[repository removeObserver: self forKeyPath: @" stashController.stashes" ];
90
90
[repository removeObserver: self forKeyPath: @" submoduleController.submodules" ];
91
-
91
+
92
92
[super closeView ];
93
93
}
94
94
@@ -99,7 +99,7 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
99
99
[self selectCurrentBranch ];
100
100
}else if ([@" branchesModified" isEqualToString: context]) {
101
101
NSInteger changeKind = [(NSNumber *)[change objectForKey: NSKeyValueChangeKindKey ] intValue ];
102
-
102
+
103
103
if (changeKind == NSKeyValueChangeInsertion) {
104
104
NSArray *newRevSpecs = [change objectForKey: NSKeyValueChangeNewKey ];
105
105
for (PBGitRevSpecifier *rev in newRevSpecs) {
@@ -195,7 +195,7 @@ - (PBSourceViewItem *) selectedItem
195
195
{
196
196
NSInteger index = [sourceView selectedRow ];
197
197
PBSourceViewItem *item = [sourceView itemAtRow: index];
198
-
198
+
199
199
return item;
200
200
}
201
201
@@ -261,7 +261,7 @@ - (void)addRevSpec:(PBGitRevSpecifier *)rev
261
261
[sourceView reloadData ];
262
262
return ;
263
263
}
264
-
264
+
265
265
NSArray *pathComponents = [[rev simpleRef ] componentsSeparatedByString: @" /" ];
266
266
if ([pathComponents count ] < 2 )
267
267
[branches addChild: [PBSourceViewItem itemWithRevSpec: rev]];
@@ -271,17 +271,17 @@ - (void)addRevSpec:(PBGitRevSpecifier *)rev
271
271
[tags addRev: rev toPath: [pathComponents subarrayWithRange: NSMakeRange (2 , [pathComponents count ] - 2 )]];
272
272
else if ([[rev simpleRef ] hasPrefix: @" refs/remotes/" ])
273
273
[remotes addRev: rev toPath: [pathComponents subarrayWithRange: NSMakeRange (2 , [pathComponents count ] - 2 )]];
274
-
274
+
275
275
[sourceView reloadData ];
276
276
}
277
277
278
278
- (void ) removeRevSpec : (PBGitRevSpecifier *)rev
279
279
{
280
280
PBSourceViewItem *item = [self itemForRev: rev];
281
-
281
+
282
282
if (!item)
283
283
return ;
284
-
284
+
285
285
PBSourceViewItem *parent = item.parent ;
286
286
[parent removeChild: item];
287
287
[sourceView reloadData ];
@@ -298,19 +298,19 @@ - (void)outlineViewSelectionDidChange:(NSNotification *)notification
298
298
{
299
299
NSInteger index = [sourceView selectedRow ];
300
300
PBSourceViewItem *item = [sourceView itemAtRow: index];
301
-
301
+
302
302
if ([item revSpecifier ]) {
303
303
if (![repository.currentBranch isEqual: [item revSpecifier ]])
304
304
repository.currentBranch = [item revSpecifier ];
305
305
[superController changeContentController: historyViewController];
306
306
[PBGitDefaults setShowStageView: NO ];
307
307
}
308
-
308
+
309
309
if (item == stage) {
310
310
[superController changeContentController: commitViewController];
311
311
[PBGitDefaults setShowStageView: YES ];
312
312
}
313
-
313
+
314
314
[self updateActionMenu ];
315
315
[self updateRemoteControls ];
316
316
}
@@ -358,7 +358,7 @@ - (void)populateList
358
358
PBSourceViewItem *project = [PBSourceViewItem groupItemWithTitle: [repository projectName ]];
359
359
project.showsActionButton = YES ;
360
360
project.isUncollapsible = YES ;
361
-
361
+
362
362
stage = [PBGitSVStageItem stageItem ];
363
363
[project addChild: stage];
364
364
@@ -369,18 +369,18 @@ - (void)populateList
369
369
others = [PBSourceViewItem groupItemWithTitle: @" Other" ];
370
370
stashes = [PBSourceViewItem groupItemWithTitle: @" Stashes" ];
371
371
submodules = [PBSourceViewItem groupItemWithTitle: @" Submodules" ];
372
-
372
+
373
373
for (PBGitRevSpecifier *rev in repository.branches )
374
374
[self addRevSpec: rev];
375
-
375
+
376
376
[items addObject: project];
377
377
[items addObject: branches];
378
378
[items addObject: remotes];
379
379
[items addObject: tags];
380
380
[items addObject: others];
381
381
[items addObject: stashes];
382
382
[items addObject: submodules];
383
-
383
+
384
384
[sourceView reloadData ];
385
385
[sourceView expandItem: project];
386
386
[sourceView expandItem: branches expandChildren: YES ];
@@ -396,7 +396,7 @@ - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id
396
396
{
397
397
if (!item)
398
398
return [items objectAtIndex: index];
399
-
399
+
400
400
return [[(PBSourceViewItem *)item children ] objectAtIndex: index];
401
401
}
402
402
@@ -409,7 +409,7 @@ - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id
409
409
{
410
410
if (!item)
411
411
return [items count ];
412
-
412
+
413
413
return [[(PBSourceViewItem *)item children ] count ];
414
414
}
415
415
@@ -430,7 +430,7 @@ - (void) addMenuItemsForRef:(PBGitRef *)ref toMenu:(NSMenu *)menu
430
430
{
431
431
if (!ref)
432
432
return ;
433
-
433
+
434
434
for (NSMenuItem *menuItem in [historyViewController.refController menuItemsForRef: ref])
435
435
[menu addItem: menuItem];
436
436
}
@@ -441,7 +441,7 @@ - (NSMenuItem *) actionIconItem
441
441
NSImage *actionIcon = [NSImage imageNamed: @" NSActionTemplate" ];
442
442
[actionIcon setSize: NSMakeSize (12 , 12 )];
443
443
[actionIconItem setImage: actionIcon];
444
-
444
+
445
445
return actionIconItem;
446
446
}
447
447
@@ -472,11 +472,11 @@ - (NSMenu *) menuForRow:(NSInteger)row
472
472
PBGitRef *ref = [viewItem ref ];
473
473
if (!ref)
474
474
return nil ;
475
-
475
+
476
476
NSMenu *menu = [[NSMenu alloc ] init ];
477
477
[menu setAutoenablesItems: NO ];
478
478
[self addMenuItemsForRef: ref toMenu: menu];
479
-
479
+
480
480
return menu;
481
481
}
482
482
@@ -485,7 +485,7 @@ - (void) menuNeedsUpdate:(NSMenu *)menu
485
485
{
486
486
[actionButton removeAllItems ];
487
487
[menu addItem: [self actionIconItem ]];
488
-
488
+
489
489
PBGitRef *ref = [[self selectedItem ] ref ];
490
490
[self addMenuItemsForRef: ref toMenu: menu];
491
491
}
@@ -503,11 +503,11 @@ - (void) menuNeedsUpdate:(NSMenu *)menu
503
503
- (void ) updateRemoteControls
504
504
{
505
505
BOOL hasRemote = NO ;
506
-
506
+
507
507
PBGitRef *ref = [[self selectedItem ] ref ];
508
508
if ([ref isRemote ] || ([ref isBranch ] && [[repository remoteRefForBranch: ref error: NULL ] remoteName ]))
509
509
hasRemote = YES ;
510
-
510
+
511
511
[remoteControls setEnabled: hasRemote forSegment: kFetchSegment ];
512
512
[remoteControls setEnabled: hasRemote forSegment: kPullSegment ];
513
513
[remoteControls setEnabled: hasRemote forSegment: kPushSegment ];
@@ -522,26 +522,26 @@ - (void) updateRemoteControls
522
522
- (IBAction ) fetchPullPushAction : (id )sender
523
523
{
524
524
NSInteger selectedSegment = [sender selectedSegment ];
525
-
525
+
526
526
if (selectedSegment == kAddRemoteSegment ) {
527
527
[PBAddRemoteSheet beginAddRemoteSheetForRepository: repository];
528
528
return ;
529
529
}
530
-
530
+
531
531
NSInteger index = [sourceView selectedRow ];
532
532
PBSourceViewItem *item = [sourceView itemAtRow: index];
533
533
PBGitRef *ref = [[item revSpecifier ] ref ];
534
-
534
+
535
535
if (!ref && (item.parent == remotes))
536
536
ref = [PBGitRef refFromString: [kGitXRemoteRefPrefix stringByAppendingString: [item title ]]];
537
-
537
+
538
538
if (![ref isRemote ] && ![ref isBranch ])
539
539
return ;
540
-
540
+
541
541
PBGitRef *remoteRef = [repository remoteRefForBranch: ref error: NULL ];
542
542
if (!remoteRef)
543
543
return ;
544
-
544
+
545
545
if (selectedSegment == kFetchSegment )
546
546
[repository beginFetchFromRemoteForRef: ref];
547
547
else if (selectedSegment == kPullSegment )
0 commit comments