Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change fork with clone, and change some message text #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ACCodeSnippetRepository Tests/ACGitRepositoryTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (void)testExample {

ACGitRepository *git = [[ACGitRepository alloc] initWithLocalRepositoryDirectory:gitPath];

//[git forkRemoteRepositoryWithURL:gitURL inDirectory:gitPath];
//[git cloneRemoteRepositoryWithURL:gitURL inDirectory:gitPath];
//[git removeLocalRepository];
//NSLog(@"%@", [git identifierForCurrentCommit]);
//NSLog(@"%@", [git changedFilesSinceCommitWithIdentifier:@"HEAD~6"]);
Expand Down
2 changes: 1 addition & 1 deletion ACCodeSnippetRepository/Classes/ACGitRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern NSString * const ACGitRepositoryFileChangeUnmergedKey;
- (void)initializeLocalRepository;
- (void)initializeLocalRepositoryInDirectory:(NSString*)localRepositoryPath;

- (void)forkRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath;
- (void)cloneRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath;

- (NSString*)identifierForCurrentCommit;

Expand Down
2 changes: 1 addition & 1 deletion ACCodeSnippetRepository/Classes/ACGitRepository.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ - (void)initializeLocalRepositoryInDirectory:(NSString*)localRepositoryPath {
}
}

- (void)forkRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath {
- (void)cloneRemoteRepositoryWithURL:(NSURL*)remoteRepositoryURL inDirectory:(NSString*)localRepositoryPath {
if (
![[NSFileManager defaultManager] fileExistsAtPath:localRepositoryPath] &&
remoteRepositoryURL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ - (instancetype)init {
- (id)initWithRemoteRepositoryURL:(NSURL*)remoteRepositoryURL {
ACGitRepository *gitRepository = [[ACGitRepository alloc] initWithLocalRepositoryDirectory:self.localRepositoryPath];
if (remoteRepositoryURL && !gitRepository.localRepositoryExists) {
[gitRepository forkRemoteRepositoryWithURL:remoteRepositoryURL inDirectory:self.localRepositoryPath];
[gitRepository cloneRemoteRepositoryWithURL:remoteRepositoryURL inDirectory:self.localRepositoryPath];
}
return [self initWithGitRepository:gitRepository];
}
Expand Down Expand Up @@ -58,7 +58,7 @@ - (void)setRemoteRepositoryURL:(NSURL *)remoteRepositoryURL {
- (void)dataStoreWillAdd {
NSLog(@"%@ dataStoreWillAdd", self);
if (![self.gitRepository localRepositoryExists]) {
[self.gitRepository forkRemoteRepositoryWithURL:self.remoteRepositoryURL inDirectory:self.localRepositoryPath];
[self.gitRepository cloneRemoteRepositoryWithURL:self.remoteRepositoryURL inDirectory:self.localRepositoryPath];
}
}

Expand Down Expand Up @@ -158,7 +158,7 @@ - (void)exportAllCodeSnippets {
for (IDECodeSnippet *snippet in codeSnippetRepository.codeSnippets) {
[self addFileInLocalRepositoryForSnippet:snippet overwrite:NO];
}
[self.gitRepository commitWithMessage:@"Imported user code snippets"];
[self.gitRepository commitWithMessage:@"Pushed user code snippets"];
[self.gitRepository push];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern NSString * const ACCodeSnippetRepositoryUpdateRegularlyKey;
@property (nonatomic, weak) id<ACCodeSnippetRepositoryConfigurationWindowControllerDelegate> delegate;

@property (nonatomic, weak) IBOutlet NSTextField *remoteRepositoryTextfield;
@property (nonatomic, weak) IBOutlet NSButton *forkRemoteRepositoryButton;
@property (nonatomic, weak) IBOutlet NSButton *cloneRemoteRepositoryButton;
@property (nonatomic, weak) IBOutlet NSButton *importButton;

@property (nonatomic, weak) IBOutlet NSPanel *progressPanel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ - (void)controlTextDidChange:(NSNotification *)notification {
NSTextField *textField = [notification object];

if (![[NSURL URLWithString:textField.stringValue] isEqualTo:self.gitDataStore.remoteRepositoryURL]) {
self.forkRemoteRepositoryButton.enabled = YES;
self.cloneRemoteRepositoryButton.enabled = YES;
} else {
self.forkRemoteRepositoryButton.enabled = NO;
self.cloneRemoteRepositoryButton.enabled = NO;
}

if ([textField.stringValue length]) {
Expand All @@ -77,13 +77,13 @@ - (IBAction)updateCheckboxAction:(NSButton*)button {
}


- (IBAction)forkRemoteRepositoryAction:(id)sender {
NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:@"Do you want to fork %@?", self.remoteRepositoryTextfield.stringValue]
defaultButton:@"Fork"
- (IBAction)cloneRemoteRepositoryAction:(id)sender {

NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:@"Do you want to clone %@?", self.remoteRepositoryTextfield.stringValue]
defaultButton:@"Clone"
alternateButton:@"Cancel"
otherButton:nil
informativeTextWithFormat:@"This will remove all snippets from the current git repository and replace them with snippets from the new fork."];
informativeTextWithFormat:@"All snippets from the current git repository will be removed from Xcode and replaced with snippets from the new cloned repository."];

__weak typeof(self)weakSelf = self;
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
Expand Down Expand Up @@ -121,7 +121,7 @@ - (IBAction)forkRemoteRepositoryAction:(id)sender {
[weakSelf.progressIndicator stopAnimation:weakSelf];
});

[weakSelf importUserSnippetsAction:weakSelf];
[weakSelf exportUserSnippetsAction:weakSelf];
});

break;
Expand Down Expand Up @@ -155,12 +155,12 @@ - (void)backupUserSnippets {
}
}

- (IBAction)importUserSnippetsAction:(id)sender {
NSAlert *alert = [NSAlert alertWithMessageText:@"Do you want to import your existing user code snippets in the repository?"
defaultButton:@"Import"
- (IBAction)exportUserSnippetsAction:(id)sender {
NSAlert *alert = [NSAlert alertWithMessageText:@"Do you want to export (push) your existing user code snippets to the repository?"
defaultButton:@"Export"
alternateButton:@"Cancel"
otherButton:nil
informativeTextWithFormat:@"This will import all your user code snippets in the current git repository. System code snippets will not be imported."];
informativeTextWithFormat:@"This will export all your user code snippets to the current git repository."];

__weak typeof(self)weakSelf = self;

Expand Down
Loading