diff --git a/Crystal_Clear_action_2downarrow.png b/Crystal_Clear_action_2downarrow.png new file mode 100644 index 0000000..df7adc6 Binary files /dev/null and b/Crystal_Clear_action_2downarrow.png differ diff --git a/Crystal_Clear_action_2uparrow.png b/Crystal_Clear_action_2uparrow.png new file mode 100644 index 0000000..1165b5a Binary files /dev/null and b/Crystal_Clear_action_2uparrow.png differ diff --git a/Crystal_Clear_action_reload.png b/Crystal_Clear_action_reload.png new file mode 100644 index 0000000..3eb0c93 Binary files /dev/null and b/Crystal_Clear_action_reload.png differ diff --git a/English.lproj/RepositoryWindow.xib b/English.lproj/RepositoryWindow.xib index 003254b..6803f32 100644 --- a/English.lproj/RepositoryWindow.xib +++ b/English.lproj/RepositoryWindow.xib @@ -2,10 +2,10 @@ 1050 - 9F33 + 9L31a 677 - 949.34 - 352.00 + 949.54 + 353.00 YES @@ -42,7 +42,471 @@ 1886912512 GitX NSWindow - + + + 27A2F5CF-4BCA-4353-B806-0E0F13EB2FFD + + + YES + YES + YES + YES + 1 + 1 + + YES + + YES + 1E431E79-1591-49E7-9E17-49497CA4622A + 2C3809A1-DBAB-456F-B222-A133DAC6C633 + 5D2A15BF-26CE-4E1A-972B-2428B7334A86 + 7FFB691C-2D2F-49A9-997F-AE1AE8BFF3F1 + 86360841-A2B1-4802-845A-AE424521FE99 + 99C2C9EB-AE16-42A9-BE52-46CE903E9AF9 + E8AEE3B4-5661-4310-B27C-B158726D7F15 + NSToolbarFlexibleSpaceItem + NSToolbarSeparatorItem + + + YES + + + 1E431E79-1591-49E7-9E17-49497CA4622A + + View + View selector + + + + 268 + {{0, 14}, {87, 25}} + 3 + YES + + 67239424 + 0 + + LucidaGrande + 1.300000e+01 + 1044 + + + + YES + + 4.000000e+01 + + NSImage + HistoryViewTemplate + + + History View + 0 + + + 4.000000e+01 + + NSImage + CommitViewTemplate + + + Commit View + YES + 0 + + + 1 + 2 + + + + + + {87, 25} + {87, 25} + YES + YES + 3 + YES + 0 + + + + 2C3809A1-DBAB-456F-B222-A133DAC6C633 + + Fetch + Fetch + RmV0Y2ggdGhlIGxhdGVzdCBjaGFuZ2VzIGZyb20gdGhlIHJlbW90ZSByZXBvc2l0b3J5LCBidXQgZG9u +J3QgbWVyZ2UgdGhlbSBpbnRvIGxvY2FsIGNoYW5nZXMuA + + + NSImage + Crystal_Clear_action_reload + + + + {0, 0} + {0, 0} + YES + YES + 0 + YES + 0 + + + + 5D2A15BF-26CE-4E1A-972B-2428B7334A86 + + Push + Push + Push local commits up to the remote repository. + + + NSImage + Crystal_Clear_action_2uparrow + + + + {0, 0} + {0, 0} + YES + YES + 0 + YES + 0 + + + + 7FFB691C-2D2F-49A9-997F-AE1AE8BFF3F1 + + Search + + Search Field + + + + + 265 + {{0, 14}, {183, 22}} + YES + + 343014976 + 268436480 + + Subject + + YES + 1 + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + 130560 + 0 + search + _searchFieldSearch: + + + 138690815 + 0 + + 400 + 75 + + + 130560 + 0 + clear + + YES + + YES + + YES + AXDescription + NSAccessibilityEncodedAttributesValueType + + + YES + cancel + + + + + _searchFieldCancel: + + + 138690815 + 0 + + 400 + 75 + + 255 + CAAAAA + + + + + + {183, 22} + {183, 22} + YES + YES + 0 + YES + 0 + + + + 86360841-A2B1-4802-845A-AE424521FE99 + + Create Branch + Create Branch + + + + 268 + {{21, 14}, {40, 25}} + YES + + -2080244224 + 134217728 + + + + -2033434369 + 163 + + NSImage + AddBranchTemplate + + + + 400 + 75 + + + + + + {40, 25} + {40, 25} + YES + YES + 0 + YES + 0 + + + + 99C2C9EB-AE16-42A9-BE52-46CE903E9AF9 + + Branch + Branch + + + + 268 + {{0, 14}, {134, 26}} + YES + + -2076049856 + 2048 + + + 109199615 + 1 + + + 400 + 75 + + + master + + 1048576 + 2147483647 + 1 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + _popUpItemAction: + + + YES + + OtherViews + + YES + + + + Item 2 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Item 3 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + 1 + YES + YES + 2 + + + + + + {134, 26} + {134, 26} + YES + YES + 0 + YES + 0 + + + + E8AEE3B4-5661-4310-B27C-B158726D7F15 + + Rebase + Rebase + Pull the latest version from the remote repository, and replay local changes on top of it. + + + NSImage + Crystal_Clear_action_2downarrow + + + + {0, 0} + {0, 0} + YES + YES + 0 + YES + 0 + + + NSToolbarFlexibleSpaceItem + + Flexible Space + + + + + + {1, 5} + {20000, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + NSToolbarSeparatorItem + + Separator + + + + + + {12, 5} + {12, 1000} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + + + YES + + + + + + + + + + + + YES + + + + + + + + + + + + YES + + {3.40282e+38, 3.40282e+38} {213, 107} @@ -52,7 +516,7 @@ {{0, 0}, {1440, 878}} - {213, 129} + {213, 179} {3.40282e+38, 3.40282e+38} GitX @@ -112,6 +576,7 @@ YES + Window @@ -124,6 +589,171 @@ + + 351 + + + YES + + + + + + + + + + + + History Toolbar + + + 352 + + + + + 353 + + + + + 354 + + + + + 355 + + + + + 356 + + + YES + + + + + + 357 + + + YES + + + + + + 358 + + + YES + + + + + + 359 + + + YES + + + + + + 360 + + + + + 361 + + + YES + + + + + + 362 + + + + + 363 + + + YES + + + + + + 364 + + + + + 365 + + + YES + + + + + + 366 + + + + + 367 + + + YES + + + + + + 368 + + + YES + + + + + + 369 + + + YES + + + + + + + + 370 + + + + + 371 + + + + + 372 + + + @@ -142,6 +772,31 @@ 3.windowTemplate.hasMinSize 3.windowTemplate.maxSize 3.windowTemplate.minSize + 351.IBEditorWindowLastContentRect + 351.IBPluginDependency + 351.editorWindowContentRectSynchronizationRect + 353.IBPluginDependency + 354.IBPluginDependency + 355.IBPluginDependency + 356.IBPluginDependency + 357.IBPluginDependency + 358.IBPluginDependency + 359.IBPluginDependency + 361.IBPluginDependency + 362.IBPluginDependency + 363.IBPluginDependency + 364.IBPluginDependency + 365.IBAttributePlaceholdersKey + 365.IBPluginDependency + 366.IBPluginDependency + 367.IBPluginDependency + 368.IBPluginDependency + 369.IBEditorWindowLastContentRect + 369.IBPluginDependency + 369.editorWindowContentRectSynchronizationRect + 370.IBPluginDependency + 371.IBPluginDependency + 372.IBPluginDependency 5.IBPluginDependency 5.ImportedFromIB2 @@ -150,15 +805,47 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit - {{1047, 395}, {850, 418}} - {{1047, 395}, {850, 418}} - + {{64, 65}, {850, 418}} + {{64, 65}, {850, 418}} + {{15, 196}, {850, 418}} {3.40282e+38, 3.40282e+38} {213, 107} + {{204, 463}, {616, 0}} + com.apple.InterfaceBuilder.CocoaPlugin + {{132, 614}, {616, 0}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Create Branch + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{725, 616}, {134, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + {{848, 458}, {116, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -183,7 +870,7 @@ - 350 + 372 diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 2bee4af..e6d4993 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -31,6 +31,9 @@ 47DBDBCA0E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m in Sources */ = {isa = PBXBuildFile; fileRef = 47DBDBC90E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m */; }; 654D16E8108C6CA6008D960C /* PBQLOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */; }; 65C77FA0108BF560003BD3B5 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65C77F9F108BF560003BD3B5 /* Quartz.framework */; }; + 66D5992E1094012B000D397A /* Crystal_Clear_action_2downarrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 66D5992B1094012B000D397A /* Crystal_Clear_action_2downarrow.png */; }; + 66D5992F1094012B000D397A /* Crystal_Clear_action_2uparrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 66D5992C1094012B000D397A /* Crystal_Clear_action_2uparrow.png */; }; + 66D599301094012B000D397A /* Crystal_Clear_action_reload.png in Resources */ = {isa = PBXBuildFile; fileRef = 66D5992D1094012B000D397A /* Crystal_Clear_action_reload.png */; }; 770B37ED0679A11B001EADE2 /* GitTest_DataModel.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = 770B37EC0679A11B001EADE2 /* GitTest_DataModel.xcdatamodel */; }; 77C8280E06725ACE000B614F /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C8280C06725ACE000B614F /* ApplicationController.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; @@ -191,6 +194,9 @@ 654D18EF108C9597008D960C /* Install.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Install.xcconfig; sourceTree = ""; }; 654D18F6108C96CB008D960C /* install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = install.sh; sourceTree = ""; }; 65C77F9F108BF560003BD3B5 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; + 66D5992B1094012B000D397A /* Crystal_Clear_action_2downarrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Crystal_Clear_action_2downarrow.png; sourceTree = ""; }; + 66D5992C1094012B000D397A /* Crystal_Clear_action_2uparrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Crystal_Clear_action_2uparrow.png; sourceTree = ""; }; + 66D5992D1094012B000D397A /* Crystal_Clear_action_reload.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Crystal_Clear_action_reload.png; sourceTree = ""; }; 770B37EC0679A11B001EADE2 /* GitTest_DataModel.xcdatamodel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.xcdatamodel; path = GitTest_DataModel.xcdatamodel; sourceTree = ""; }; 77C82804067257F0000B614F /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 77C8280B06725ACE000B614F /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; @@ -434,6 +440,9 @@ 32CA4F630368D1EE00C91783 /* GitX_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, F5E92A220E88569500056E75 /* new_file.png */, + 66D5992B1094012B000D397A /* Crystal_Clear_action_2downarrow.png */, + 66D5992C1094012B000D397A /* Crystal_Clear_action_2uparrow.png */, + 66D5992D1094012B000D397A /* Crystal_Clear_action_reload.png */, ); name = "Other Sources"; sourceTree = ""; @@ -843,6 +852,9 @@ 47DBDB6A0E94EF6500671A1E /* Preferences.xib in Resources */, 47DBDBB10E94F6CA00671A1E /* Updates.png in Resources */, F569AE930F2CBD7C00C2FFA7 /* Credits.html in Resources */, + 66D5992E1094012B000D397A /* Crystal_Clear_action_2downarrow.png in Resources */, + 66D5992F1094012B000D397A /* Crystal_Clear_action_2uparrow.png in Resources */, + 66D599301094012B000D397A /* Crystal_Clear_action_reload.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib index 68b7789..61f3853 100644 --- a/PBGitHistoryView.xib +++ b/PBGitHistoryView.xib @@ -8,8 +8,8 @@ 353.00 YES - + YES @@ -913,7 +913,7 @@ {1000, 102} {346, 102} - + 256 YES @@ -1022,7 +1022,6 @@ {346, 102} - {{0, 0}, {1680, 1028}} {346, 124} @@ -1044,9 +1043,12 @@ YES 1E431E79-1591-49E7-9E17-49497CA4622A + 2C3809A1-DBAB-456F-B222-A133DAC6C633 + 5D2A15BF-26CE-4E1A-972B-2428B7334A86 7FFB691C-2D2F-49A9-997F-AE1AE8BFF3F1 86360841-A2B1-4802-845A-AE424521FE99 99C2C9EB-AE16-42A9-BE52-46CE903E9AF9 + E8AEE3B4-5661-4310-B27C-B158726D7F15 NSToolbarFlexibleSpaceItem NSToolbarSeparatorItem @@ -1060,9 +1062,10 @@ View selector - + 268 {{0, 14}, {87, 25}} + 3 YES @@ -1109,6 +1112,51 @@ YES 0 + + + 2C3809A1-DBAB-456F-B222-A133DAC6C633 + + Fetch + Fetch + RmV0Y2ggdGhlIGxhdGVzdCBjaGFuZ2VzIGZyb20gdGhlIHJlbW90ZSByZXBvc2l0b3J5LCBidXQgZG9u +J3QgbWVyZ2UgdGhlbSBpbnRvIGxvY2FsIGNoYW5nZXMuA + + + NSImage + Crystal_Clear_action_reload + + + + {0, 0} + {0, 0} + YES + YES + 0 + YES + 0 + + + + 5D2A15BF-26CE-4E1A-972B-2428B7334A86 + + Push + Push + Push local commits up to the remote repository. + + + NSImage + Crystal_Clear_action_2uparrow + + + + {0, 0} + {0, 0} + YES + YES + 0 + YES + 0 + 7FFB691C-2D2F-49A9-997F-AE1AE8BFF3F1 @@ -1119,9 +1167,10 @@ - + 265 {{0, 14}, {183, 22}} + YES 343014976 @@ -1198,9 +1247,10 @@ Create Branch - + 268 {{21, 14}, {40, 25}} + YES -2080244224 @@ -1239,9 +1289,10 @@ Branch - + 268 {{0, 14}, {134, 26}} + YES -2076049856 @@ -1311,8 +1362,30 @@ - {134, 25} - {134, 25} + {134, 26} + {134, 26} + YES + YES + 0 + YES + 0 + + + + E8AEE3B4-5661-4310-B27C-B158726D7F15 + + Rebase + Rebase + Pull the latest version from the remote repository, and replay local changes on top of it. + + + NSImage + Crystal_Clear_action_2downarrow + + + + {0, 0} + {0, 0} YES YES 0 @@ -1383,6 +1456,9 @@ + + + YES @@ -1390,6 +1466,10 @@ + + + + @@ -1995,6 +2075,30 @@ 291 + + + rebaseButton: + + + + 296 + + + + pushButton: + + + + 297 + + + + fetchButton: + + + + 298 + @@ -2411,10 +2515,13 @@ YES - + + + + History Toolbar @@ -2433,11 +2540,6 @@ - - 222 - - - 223 @@ -2579,6 +2681,26 @@ + + 292 + + + + + 293 + + + + + 294 + + + + + 222 + + + @@ -2660,6 +2782,9 @@ 288.IBPluginDependency 29.IBPluginDependency 29.IBShouldRemoveOnLegacySave + 292.IBPluginDependency + 293.IBPluginDependency + 294.IBPluginDependency 3.IBPluginDependency 3.ImportedFromIB2 30.CustomClassName @@ -2702,7 +2827,7 @@ com.apple.InterfaceBuilderKit com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{312, 366}, {616, 227}} + {{707, 168}, {616, 227}} com.apple.InterfaceBuilder.CocoaPlugin {{132, 614}, {616, 0}} com.apple.InterfaceBuilder.CocoaPlugin @@ -2788,6 +2913,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin PBUnsortableTableHeader com.apple.InterfaceBuilder.CocoaPlugin @@ -2817,7 +2945,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{321, 67}, {852, 432}} + {{235, 559}, {852, 432}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2851,11 +2979,19 @@ - 291 + 304 YES + + NSToolbarItem + NSObject + + IBUserSource + + + PBCollapsibleSplitView PBNiceSplitView @@ -3004,6 +3140,9 @@ addRef: changeBranch: closeSheet: + fetchButton: + pushButton: + rebaseButton: saveSheet: @@ -3012,6 +3151,9 @@ NSMenuItem id id + id + id + id diff --git a/PBRefController.h b/PBRefController.h index 0706fc5..037b7c0 100644 --- a/PBRefController.h +++ b/PBRefController.h @@ -29,10 +29,19 @@ - (IBAction)closeSheet:(id) sender; - (IBAction)saveSheet:(id) sender; +- (IBAction)rebaseButton:(id)sender; +- (IBAction)pushButton:(id)sender; +- (IBAction)fetchButton:(id)sender; + - (NSArray *) menuItemsForRef:(PBGitRef *)ref commit:(PBGitCommit *)commit; - (void) changeBranch:(NSMenuItem *)sender; - (void) selectCurrentBranch; - (void) updateBranchMenu; +- (void) pullImpl:(NSString *)refName; +- (void) pushImpl:(NSString *)refName; +- (void) rebaseImpl:(NSString *)refName; + + @end diff --git a/PBRefController.m b/PBRefController.m index ebe31d4..4d6cbb7 100644 --- a/PBRefController.m +++ b/PBRefController.m @@ -70,44 +70,17 @@ - (void) pushRef:(PBRefMenuItem *)sender { - int ret = 1; - NSString *remote = [[historyController.repository config] valueForKeyPath:[NSString stringWithFormat:@"branch.%@.remote", [[sender ref] shortName]]]; - NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"push", remote, [[sender ref] shortName], nil] retValue: &ret]; - if (ret) { - NSString *info = [NSString stringWithFormat:@"There was an error pushing the branch to the remote repository.\n\n%d\n%@", ret, rval]; - [[historyController.repository windowController] showMessageSheet:@"Pushing branch failed" infoText:info]; - return; - } - [historyController.repository reloadRefs]; - [commitController rearrangeObjects]; + [self pushImpl:[[sender ref] shortName]]; } - (void) pullRef:(PBRefMenuItem *)sender { - int ret = 1; - NSString *remote = [[historyController.repository config] valueForKeyPath:[NSString stringWithFormat:@"branch.%@.remote", [[sender ref] shortName]]]; - NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"pull", remote, [[sender ref] shortName], nil] retValue: &ret]; - if (ret) { - NSString *info = [NSString stringWithFormat:@"There was an error pulling from the remote repository.\n\n%d\n%@", ret, rval]; - [[historyController.repository windowController] showMessageSheet:@"Pulling from remote failed" infoText:info]; - return; - } - [historyController.repository reloadRefs]; - [commitController rearrangeObjects]; + [self pullImpl:[[sender ref] shortName]]; } - (void) rebaseRef:(PBRefMenuItem *)sender { - int ret = 1; - NSString *remote = [[historyController.repository config] valueForKeyPath:[NSString stringWithFormat:@"branch.%@.remote", [[sender ref] shortName]]]; - NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"pull", @"--rebase", remote, [[sender ref] shortName], nil] retValue: &ret]; - if (ret) { - NSString *info = [NSString stringWithFormat:@"There was an error rebasing from the remote repository.\n\n%d\n%@", ret, rval]; - [[historyController.repository windowController] showMessageSheet:@"Rebasing from remote failed" infoText:info]; - return; - } - [historyController.repository reloadRefs]; - [commitController rearrangeObjects]; + [self rebaseImpl:[[sender ref] shortName]]; } - (void) tagInfo:(PBRefMenuItem *)sender @@ -128,6 +101,63 @@ return [PBRefMenuItem defaultMenuItemsForRef:ref commit:commit target:self]; } +- (void) pushImpl:(NSString *)refName +{ + int ret = 1; + NSString *remote = [[historyController.repository config] valueForKeyPath:[NSString stringWithFormat:@"branch.%@.remote", refName]]; + NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"push", remote, refName, nil] retValue: &ret]; + if (ret) { + NSString *info = [NSString stringWithFormat:@"There was an error pushing the branch to the remote repository.\n\n%d\n%@", ret, rval]; + [[historyController.repository windowController] showMessageSheet:@"Pushing branch failed" infoText:info]; + return; + } + [historyController.repository reloadRefs]; + [commitController rearrangeObjects]; +} + +- (void) pullImpl:(NSString *)refName +{ + int ret = 1; + NSString *remote = [[historyController.repository config] valueForKeyPath:[NSString stringWithFormat:@"branch.%@.remote", refName]]; + NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"pull", remote, refName, nil] retValue: &ret]; + if (ret) { + NSString *info = [NSString stringWithFormat:@"There was an error pulling from the remote repository.\n\n%d\n%@", ret, rval]; + [[historyController.repository windowController] showMessageSheet:@"Pulling from remote failed" infoText:info]; + return; + } + [historyController.repository reloadRefs]; + [commitController rearrangeObjects]; +} + +- (void) rebaseImpl:(NSString *)refName +{ + int ret = 1; + NSString *remote = [[historyController.repository config] valueForKeyPath:[NSString stringWithFormat:@"branch.%@.remote", refName]]; + NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"pull", @"--rebase", remote, refName, nil] retValue: &ret]; + if (ret) { + NSString *info = [NSString stringWithFormat:@"There was an error rebasing from the remote repository.\n\n%d\n%@", ret, rval]; + [[historyController.repository windowController] showMessageSheet:@"Rebasing from remote failed" infoText:info]; + return; + } + [historyController.repository reloadRefs]; + [commitController rearrangeObjects]; +} + +- (void) fetchImpl:(NSString *)refName +{ + int ret = 1; + NSString *remote = nil; + if(refName != nil) remote = [[historyController.repository config] valueForKeyPath:[NSString stringWithFormat:@"branch.%@.remote", refName]]; + NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"fetch", remote, refName, nil] retValue: &ret]; + if (ret) { + NSString *info = [NSString stringWithFormat:@"There was an error fetching from the remote repository.\n\n%d\n%@", ret, rval]; + [[historyController.repository windowController] showMessageSheet:@"Rebasing from remote failed" infoText:info]; + return; + } + [historyController.repository reloadRefs]; + [commitController rearrangeObjects]; +} + # pragma mark Tableview delegate methods - (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard @@ -220,6 +250,27 @@ contextInfo:NULL]; } +-(void)rebaseButton:(id)sender +{ + NSString *refName =[historyController.repository.currentBranch simpleRef]; + [self rebaseImpl:refName]; +// NSLog([NSString stringWithFormat:@"Rebase hit for %@!", refName]); +} + +-(void)pushButton:(id)sender +{ + NSString *refName =[historyController.repository.currentBranch simpleRef]; + [self pushImpl:refName]; +// NSLog([NSString stringWithFormat:@"Push hit for %@!", refName]); +} + +-(void)fetchButton:(id)sender +{ + NSString *refName =[historyController.repository.currentBranch simpleRef]; + [self fetchImpl:refName]; +// NSLog([NSString stringWithFormat:@"Fetch hit for %@!", refName]); +} + -(void)saveSheet:(id) sender { NSString *branchName = [@"refs/heads/" stringByAppendingString:[newBranchName stringValue]];