Skip to content

Commit

Permalink
Merge remote-tracking branch 'tiennou/master' into ssp
Browse files Browse the repository at this point in the history
  • Loading branch information
ssp committed Jul 4, 2016
2 parents a890f7e + 29cf62f commit c1d8f15
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Classes/Controllers/PBGitRepositoryDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@class PBGitRepository;
@class PBGitRevSpecifier;
@class PBGitWindowController;

extern NSString *PBGitRepositoryDocumentType;

Expand All @@ -30,4 +31,6 @@ extern NSString *PBGitRepositoryDocumentType;

- (void)selectRevisionSpecifier:(PBGitRevSpecifier *)specifier;

- (PBGitWindowController *)windowController;

@end
2 changes: 2 additions & 0 deletions Classes/Controllers/PBGitRepositoryDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
if (!_repository)
return NO;

[_repository setDocument:self];

return YES;
}

Expand Down
2 changes: 2 additions & 0 deletions Classes/git/PBGitRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) {
// Designated initializer
- (id)initWithURL:(NSURL *)repositoryURL error:(NSError **)error;

- (void)setDocument:(NSDocument *)document; // Backward-compatibility while PBGitRepository gets "modelized";

- (void) cloneRepositoryToPath:(NSString *)path bare:(BOOL)isBare;
- (void) beginAddRemote:(NSString *)remoteName forURL:(NSString *)remoteURL;
- (void) beginFetchFromRemoteForRef:(PBGitRef *)ref;
Expand Down
16 changes: 16 additions & 0 deletions Classes/git/PBGitRepository.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "PBGitCommit.h"
#import "PBGitIndex.h"
#import "PBGitWindowController.h"
#import "PBGitRepositoryDocument.h"
#import "PBGitBinary.h"

#import "NSFileHandleExt.h"
Expand All @@ -32,6 +33,8 @@ @interface PBGitRepository () {
__strong GTOID* _headOID;
__strong GTRepository* _gtRepo;
PBGitIndex *_index;

PBGitRepositoryDocument *_document;
}

@property (nonatomic, strong) NSNumber *hasSVNRepoConfig;
Expand Down Expand Up @@ -91,6 +94,19 @@ - (void) dealloc
[watcher stop];
}

#pragma mark -
#pragma mark Backward-compatibility
// PBGitRepository is responsible for both repository actions and document management
// This is here for the time being while the controller code gets updated to use PBGitRepositoryDocument.

- (void)setDocument:(NSDocument *)document {
_document = (PBGitRepositoryDocument *)document;
}

- (PBGitWindowController *)windowController {
return _document.windowController;
}

#pragma mark -
#pragma mark Properties/General methods

Expand Down

0 comments on commit c1d8f15

Please sign in to comment.