Source

Murky / Source / RepoController_Actions.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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
//
//  RepoController_Actions.m
//  Murky
//
//  Copyright 2008-2009 Jens Alfke. All rights reserved.
//

#import "RepoController.h"
#import "HgRepository.h"
#import "HgDir.h"
#import "HgUncommittedRevision.h"
#import "HgOperation.h"
#import "HgTempDir.h"
#import "HgConfigFile.h"
#import "URLFormatter.h"


#define kPrefRevertWithoutBackup @"RevertWithoutBackup"


@implementation RepoController (Actions)


#pragma mark -
#pragma mark UTILITIES:


- (BOOL) anySelectedFilesHaveStatus: (HgStatus)status
{
    for( HgFile *file in self.selectedFiles )
        if( file.status == status )
            return YES;
    return NO;
}


- (BOOL) anySelectedFilesUncommitted
{
    for( HgFile *file in self.selectedFiles )
        if( file.isUncommitted )
            return YES;
    return NO;
}


- (BOOL) getSelectedRevisionsOld: (HgRevision**)outOld andNew: (HgRevision**)outNew
{
    HgFile *file = self.selectedFile;
    if( ! file )
        return NO;
    *outNew = self.selectedRevision;
    if( ! *outNew )
        return NO;
    *outOld = (*outNew).parent;
    return YES;
    /*
    NSArray *revisions = file.revisions;
    unsigned nRevisions = revisions.count;
    if( nRevisions < 2 )
        return NO;
    *outNew = [revisions lastObject];
    
    NSArray *sel;
    if( file == self.actuallySelectedFile )
        sel = [_revisions selectedObjects];
    else
        sel = nil;
    
    switch( sel.count ) {
        case 0:
            // No selection: diff current modifications against base:
            *outOld = [revisions objectAtIndex: nRevisions-2];
            return (*outNew).isUncommitted;
        case 1: {
            // One selection: diff it against previous
            *outNew = [sel objectAtIndex: 0];
            unsigned selIndex = [revisions indexOfObject: *outNew];
            if( selIndex==0 || selIndex==NSNotFound )
                return NO;
            *outOld = [revisions objectAtIndex: selIndex-1];
            return YES;
        }
        case 2:
            // Two selections: diff them:
            *outOld = [sel objectAtIndex: 0];
            *outNew = [sel objectAtIndex: 1];
            if( (*outOld).localNumber > (*outNew).localNumber ) {
                HgRevision *temp = *outOld;
                *outOld = *outNew;
                *outNew = temp;
            }
            return YES;
        default:
            return NO;
    }
     */
}


#pragma mark -
#pragma mark ACTIONS:


- (IBAction) toggleShowsOnlyUncleanFiles: (id)sender
{
    self.showsOnlyUncleanFiles = ! self.showsOnlyUncleanFiles;
}


- (IBAction) chooseRevisionFromPopUp: (id)sender
{
    HgRevision *rev = ((NSPopUpButton*)sender).selectedItem.representedObject;
    Log(@"Pop-up selected revision %@",rev);
    //[_revisions setSelectedObjects: [NSArray arrayWithObject: rev]];
}


- (IBAction) revealInFinder: (id) sender
{
    NSURL* fileURL = [NSURL fileURLWithPath: self.repository.absolutePath];
    NSWorkspace* ws = [NSWorkspace sharedWorkspace];
    [ws openURL:fileURL];   //use openURL instead of selectFile to support PathFinder. WD-rpw May 1, 2009
}

- (IBAction) refreshStatus: (id)sender
{
    NSError *error =nil;
    if( ! [_repo updateStatus: &error] )
        [self presentError: error];
}


/** Called when a file is double-clicked */
- (IBAction) openSelectedFile: (id)sender
{
    [self showRevision: sender];
}


- (IBAction) showRevision: (id)sender
{
    HgFile *file = self.selectedFile;
    if( !file.isFile || file!=self.actuallySelectedFile ) {
        NSBeep();
        return;
    }
    NSError *error;
    NSString *path = [file.revision getPathToFileContents: file
                                                inTempDir: self.tempDir
                                                    error: &error];
    if (!path) {
        [self presentError: error];
        return;
    }
    if (![[NSWorkspace sharedWorkspace] openFile: path])
        NSBeep();
}


#pragma mark -
#pragma mark DIFFS:


- (BOOL) showComparisonFromRevision: (HgRevision*)revOld 
                         toRevision: (HgRevision*)revNew
                             ofFile: (HgFile*)file
                              error: (NSError**)outError
{
    if( ! file.isFile ) {
        //FIX: Can't compare directories yet
        return MYMiscError(outError, @"Can't compare directories yet, sorry!");
    }
    NSString *pathOld = [revOld getPathToFileContents: file inTempDir: self.tempDir error: outError];
    if( ! pathOld ) return NO;
    NSString *pathNew = [revNew getPathToFileContents: file inTempDir: self.tempDir error: outError];
    if( ! pathNew ) return NO;
    
    MYTask *task = [[MYTask alloc] initWithCommand: @"/usr/bin/opendiff", pathOld,pathNew, nil];
    [task ignoreOutput];
    BOOL ok = [task start];
    *outError = task.error;
    return ok;
}


- (BOOL) showComparisonOfFiles: (NSArray*)files error: (NSError**)outError
{
    for( HgFile *file in files ) {
        if( file.isFile ) {
            if( file.status==kModified ) {
                NSArray *revisions = file.revisions;
                unsigned n = revisions.count;
                if( ! [self showComparisonFromRevision: [revisions objectAtIndex: n-2]
                                            toRevision: [revisions objectAtIndex: n-1]
                                                ofFile: file
                                                 error: outError] ) {
                    return NO;
                }
            }
        } else {
            if( ! [self showComparisonOfFiles: ((HgDir*)file).files error: outError] )
                return NO;
        }
    }
    return YES;
}


- (IBAction) showDiff: (id)sender
{
    HgRevision *revOld,*revNew;
    if( ! [self getSelectedRevisionsOld: &revOld andNew: &revNew] ) {
        NSBeep();
        return;
    }
    
    HgFile *file = self.selectedFile;
    NSString *filename = [NSString stringWithFormat: @"%@ (%@ vs %@).diff", 
                          file.name, revNew.localString,revOld.localString];
    NSError *error = nil;
    NSString *diff = [revNew diffFile: file withRevision: revOld error: &error];
    if( ! diff || ! [self.tempDir openDataInEditor: diff
                                       asFileNamed: filename
                                             error: &error] )
        [self presentError: error];
}


- (IBAction) showComparison: (id)sender
{
    NSError *error = nil;
    NSArray *files = self.selectedFiles;
    if( files.count == 1 && [[files objectAtIndex: 0] isFile] ) {
        HgRevision *revOld,*revNew;
        if( ! [self getSelectedRevisionsOld: &revOld andNew: &revNew] ) {
            NSBeep();
            return;
        }
        [self showComparisonFromRevision: revOld 
                              toRevision: revNew 
                                  ofFile: [files objectAtIndex: 0]
                                   error: &error];      
    } else {
        // Multiple selection: Compare each against base:
        [self showComparisonOfFiles: files error: &error];
    }
    if( error )
        [self presentError: error];
}


#pragma mark -
#pragma mark PROGRESS:


- (void) _startProgressForOperation: (HgOperation*)operation
                            message: (NSString*)message
                     didEndSelector: (SEL)didEndSelector
                            context: (void*)context
{
    Assert(!self.currentOperation);
    self.currentOperation = operation;
    if (![operation start]) {
        [self performSelector: didEndSelector withObject: _progressSheet withObject: (id)context];
        return;
    }
    _progressMessageField.stringValue = message;
    _progressStopButton.title = @"Stop";
    NSView *superview = _progressStopButton.superview;
    [_progressStopButton removeFromSuperview];
    _progressStopButton.keyEquivalent = @"\033"; // esc
    [superview addSubview: _progressStopButton];
    
    [NSApp beginSheet: _progressSheet
       modalForWindow: self.window
        modalDelegate: self
       didEndSelector: didEndSelector ?:@selector(_closeProgressSheet)
          contextInfo: context];
    
    [operation addObserver: self 
                forKeyPath: @"isRunning"
                   options: 0
                   context: @selector(_currentOperationStopped)];
}


- (void) _currentOperationStopped {
    _progressStopButton.title = @"Close";
    _progressStopButton.keyEquivalent = @"\r";
}


- (IBAction) stopProgress: (id)sender
{
    int button = NSOKButton;
    if( self.currentOperation.isRunning ) {
        self.currentOperation.stop;
        button = NSCancelButton;
    }
    [NSApp endSheet: _progressSheet returnCode: button];
}

- (void) _closeProgressSheet
{
    [_progressSheet orderOut: self];
    [self.currentOperation removeObserver: self forKeyPath: @"isRunning"];
    self.currentOperation = nil;
}


#pragma mark -
#pragma mark COMMIT / PUSH / PULL:


static BOOL isFileStatus( id file, void *status )
{
    return [file status] == (HgStatus)status;
}


- (void) _endCommitWarnSheet: (NSPanel*)sheet resultCode: (int)result context: (NSArray*)files
{
    [sheet orderOut: self];
    if( result == NSOKButton )
        [NSApp beginSheet: _commitSheet
           modalForWindow: self.window
            modalDelegate: self
           didEndSelector: @selector(_commitSheetDidEnd:returnCode:context:)
              contextInfo: files];
}


- (void) commitChangesToFiles: (NSArray*)files
{
    _commitMessageField.string = _repo.uncommittedRevision.formattedDescription ?: @"";
    
    NSArray *filesToCheck = files ?:[NSArray arrayWithObject: _repo.uncommittedRevision.root];
    HgRevision *revision = [filesToCheck.lastObject revision];
    if( filesToCheck.count==0 || ! revision.isUncommitted ) {
        NSBeep();
        return;
    }
    NSMutableArray *unknown = [NSMutableArray array];
    for( HgFile *file in filesToCheck ) {
        [file addFilesMatching: FunctionPredicate1(isFileStatus,(void*)kNotTracked) toArray: unknown];
    }
    
    if( unknown.count == 0 ) {
        // No warning sheet
        [self _endCommitWarnSheet: nil resultCode: NSOKButton context: files];
    } else {
        // Helpfully select the "?" files:
        self.selectedRevision = revision;
        self.showsOnlyUncleanFiles = YES;
        [_outline deselectAll: self];
        for( HgFile *file in unknown ) {
            int row = [revision.uncleanFiles indexOfObjectIdenticalTo: file];
            if( row != NSNotFound )
                [_outline selectRow: row byExtendingSelection: YES];
        }
        
        NSBeginCriticalAlertSheet(@"Some files aren't in the repository",
                                  @"OK", @"Cancel", nil,
                                  self.window, self,
                                  @selector(_endCommitWarnSheet:resultCode:context:),NULL,
                                  files, 
                                  @"%i file(s) you're trying to check in have not yet "
                                  "been added to the repository (status is '?'). These won't be checked in. Proceed anyway?",
                                  unknown.count);
    }
}


- (IBAction) commitChanges: (id)sender
{
    [self commitChangesToFiles: _tree.selectedObjects];
}

- (IBAction) commitAllChanges: (id)sender
{
    [self commitChangesToFiles: nil];
}


- (IBAction) endCommitSheet: (id)sender
{
    _repo.uncommittedRevision.formattedDescription = _commitMessageField.string;
    BOOL ok = YES;
    NSButton *button = sender;
    int returnCode = button.tag;
    if( returnCode == NSOKButton ) {
        NSWindow *sheet = [sender window];
        if( sheet==_commitSheet )
            ok = _commitMessageField.string.length > 0;
        else if( sheet==_pushSheet )
            ok = [NSURL URLWithString: _pushURLField.stringValue] != nil;
    }
    if( ok )
        [NSApp endSheet: button.window returnCode: returnCode];
    else
        NSBeep();
}

- (void) _commitSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
{
    [sheet orderOut: self];
    if( returnCode == NSOKButton ) {
        NSArray *files = (NSArray*)context;
        NSError *error = nil;
        if( [_repo.uncommittedRevision commitFiles: files message: _commitMessageField.string error: &error] ) {
            _commitMessageField.string = @"";
            [_repo updateStatus: &error];
        } else {
            [self presentError: error];
        }
    }
}


static NSString* kTransferOpTitle[] = {@"Pull",@"Push",@"Clone"};


- (IBAction) pushPullRevisions: (id)sender
{
    HgTransferOp op = [sender tag];
    NSString *defaultURL, *desc;
    switch( op ) {
        case kHgPush: 
            desc = @"Push revisions to repository at URL/file:";
            defaultURL = [_repo.configFile valueForKey: @"default-push" inStanza: @"paths"];
            if( ! defaultURL )
                defaultURL = [_repo.configFile valueForKey: @"default" inStanza: @"paths"];
            break;
        case kHgPull: 
            desc = @"Pull revisions from repository at URL/file:";
            defaultURL = [_repo.configFile valueForKey: @"default" inStanza: @"paths"];
            break;
        case kHgClone:
            desc = @"Clone repository to URL/file:";
            defaultURL = _repo.absolutePath;
            if( [defaultURL hasSuffix: @"/"] )
                defaultURL = [defaultURL substringToIndex: defaultURL.length-1];
            defaultURL = [defaultURL stringByAppendingString: @"_clone"];
            break;
        default:
            Assert(NO,@"Invalid op %i",op);
            return;
    }
    [_pushURLField setStringValue: (defaultURL ?:@"")];
    [_pushURLField removeAllItems];
    if( defaultURL )
    [_pushURLField addItemsWithObjectValues: [_repo.configFile URLsForStanza: @"paths"]];
    
    [_pushDescriptionField setObjectValue: desc];
    [_pushButton setTitle: kTransferOpTitle[op] ];
    [_pullUpdateCheckbox setHidden: (op==kHgPush)];
    
    [NSApp beginSheet: _pushSheet
       modalForWindow: self.window
        modalDelegate: self
       didEndSelector: @selector(_pushSheetDidEnd:returnCode:context:)
          contextInfo: (void*)(size_t)op];
}

- (IBAction) beginPushSheetFilePicker: (id)sender
{
    [_pushSheet makeFirstResponder: _pushURLField];
    [URLFormatter beginFilePickerFor: _pushURLField];
}

- (void) _pushSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
{
    [sheet orderOut: self];
    if( returnCode != NSOKButton )
        return;
    
    NSURL *url = _pushURLField.objectValue;
    if( ! url )
        return;
    
    HgTransferOp xferOp = (HgTransferOp)(size_t)context;
    HgTransferOptions options = 0;
    if( _pullUpdateCheckbox.state )
        options = kHgUpdateAfterwards;
    
    HgOperation *op = [_repo transferRevisions: xferOp
                                       options: options
                               otherRepository: url];
    
    SEL didEnd = NULL;
    if( url.isFileURL ) {
        if( xferOp==kHgPush ) 
            didEnd = @selector(_pushDidEnd:result:url:);
        else if( xferOp==kHgClone ) 
            didEnd = @selector(_cloneDidEnd:result:url:);
    }    
    
    static NSString* const kMessage[] = {@"Pulling from <%@>", @"Pushing to <%@>", @"Cloning to <%@>"};
    
    [self _startProgressForOperation: op
                             message: [NSString stringWithFormat: kMessage[xferOp], url.absoluteString]
                      didEndSelector: didEnd
                             context: url];
}

- (void) _pushDidEnd: (NSPanel*)sheet result: (int)result url: (NSURL*)url
{
    [self _closeProgressSheet];
    // If pushed to a repo open in another window, update that one:
    RepoController *other = [[self class] existingRepoControllerWithDirectory: url.path];
    NSError *error;
    if( other )
        [other.repository updateStatus: &error];
}

- (void) _cloneDidEnd: (NSPanel*)sheet result: (int)result url: (NSURL*)url
{
    [self _closeProgressSheet];
    // If cloned to a local filesystem, open the new cloned repo:
    NSError *error;
    RepoController *other = [[self class] repoControllerWithDirectory: url.path
                                                                error: &error];
    [other showWindow: self];
}


#pragma mark -
#pragma mark ADD / REMOVE / DISCARD:


- (NSArray*) _uncommittedSelectedFiles
{
    if( self.selectedRevision.isUncommitted ) {
        NSArray *files = [_tree selectedObjects];
        if( files.count > 0 )
            return files;
    }
    NSBeep();
    return nil;
}


- (void) addToRepository: (id)sender
{
    NSArray *files = self._uncommittedSelectedFiles;
    NSError *error = nil;
    if( files && ! [_repo.uncommittedRevision addFiles: files error: &error] ) {
        [self presentError: error];
    }
}


- (void) removeFromRepository: (id)sender
{
    NSArray *files = self._uncommittedSelectedFiles;
    if( files )
        NSBeginCriticalAlertSheet(@"Remove files from repository?",
                                  @"Remove", @"Cancel", nil,
                                  self.window,self,
                                  @selector(_removeSheetDidEnd:returnCode:context:), NULL, files,
                                  @"Are you sure you want to remove the selected files from the repository?");
}

- (void) _removeSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
{
    [sheet orderOut: self];
    if( returnCode == NSOKButton ) {
        NSError *error = nil;
        if( ! [_repo.uncommittedRevision removeFiles: (NSArray*)context error: &error] ) {
            [self presentError: error];
        }
    }
}


- (void) discardChanges: (id)sender
{
    NSArray *files = self._uncommittedSelectedFiles;
    if( files )
        NSBeginCriticalAlertSheet(@"Discard file changes?",
                                  @"Discard", @"Cancel", nil,
                                  self.window,self,
                                  @selector(_discardSheetDidEnd:returnCode:context:), NULL, files,
                                  @"Are you sure you want to discard all uncommitted changes to the selected files?");
}

- (void) _discardSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
{
    [sheet orderOut: self];
    if( returnCode == NSOKButton ) {
        BOOL backup = ! [[NSUserDefaults standardUserDefaults] boolForKey: kPrefRevertWithoutBackup];
        NSError *error = nil;
        if( ! [_repo.uncommittedRevision revertFiles: (NSArray*)context
                                              backup: backup
                                               error: &error] ) {
            [self presentError: error];
        }
    }
}


#pragma mark -
#pragma mark UPDATING TO A REVISION:


- (IBAction) _updateTo: (HgRevision*)rev
{
    NSError *error;
    NSString *output;
    if( [_repo updateToRevision: rev output: &output error: &error] ) {
        if( ! output ) output = @"";
        NSBeginInformationalAlertSheet(@"Update Completed",
                                       nil, nil, nil, self.window, nil, NULL, NULL, NULL,
                                       @"%@", output);
    } else        
        [self presentError: error];
}


- (IBAction) updateToLatest: (id)sender
{
    [self _updateTo: nil];
}


- (IBAction) updateToSelectedRevision: (id)sender
{
    HgRevision *rev = [self selectedRevision];
    if( rev==nil || rev.isUncommitted ) {
        NSBeep();
        return;
    }
    NSBeginCriticalAlertSheet(@"Update to revision?",
                              @"Update", @"Cancel", nil,
                              self.window,self,
                              @selector(_updateSheetDidEnd:returnCode:context:), NULL, rev,
                              @"Are you sure you want to update the source tree to revision %i?",
                              rev.localNumber);
}

- (void) _updateSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
{
    [sheet orderOut: self];
    if( returnCode == NSOKButton )
        [self _updateTo: (HgRevision*)context];
}


- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
{
    SEL action = [anItem action];
    if( action == @selector(toggleShowsOnlyUncleanFiles:) ) {
        if( [(id)anItem respondsToSelector: @selector(setState:)] )
            [(id)anItem setState: self.showsOnlyUncleanFiles];
        return YES;
    } else if( action==@selector(openSelectedFile:) || action==@selector(showRevision:)) {
        return self.selectedFile.isFile;
    } else if( action==@selector(showDiff:) ) {
        HgRevision *revOld,*revNew;
        return [self getSelectedRevisionsOld: &revOld andNew: &revNew];
    } else if( action==@selector(addToRepository:) ) {
        return self.selectedRevision.isUncommitted && [self anySelectedFilesHaveStatus: kNotTracked];
    } else if( action==@selector(removeFromRepository:) ) {
        return self.selectedRevision.isUncommitted && self.selectedFiles.count > 0;
    } else if( action==@selector(showComparison:) ) {
        HgRevision *revOld,*revNew;
        return self.selectedFiles.count>1 || [self getSelectedRevisionsOld: &revOld andNew: &revNew];
    } else if( action==@selector(commitChanges:) || action==@selector(discardChanges:) ) {
        return self.selectedRevision.isUncommitted && self.anySelectedFilesUncommitted;
    } else if( action==@selector(commitAllChanges:) ) {
        HgStatus status = _repo.uncommittedRevision.root.status;
        return status==kModified || status==kAdded || status==kDeleted;
    } else if( action == @selector(updateToSelectedRevision:) ) {
        HgRevision *rev = self.selectedRevision;
        return rev!=nil && ! rev.isUncommitted;
    } else
        return YES;
}


@end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.