From aa4a24a5799919cd74bbf52b090ea8cb153ae445 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sat, 20 Feb 2010 06:44:28 -0700 Subject: [PATCH] Add Create Tag A Create Tag item: - A new class (and xib) PBCreateTagSheet - In the Repository menu - In the contextual menu for commits PBRefController the method tagInfo: - renamed to showTagInfoSheet: - moved it under the Tags mark --- English.lproj/MainMenu.xib | 202 ++++- English.lproj/PBCreateTagSheet.xib | 1338 ++++++++++++++++++++++++++++ GitX.xcodeproj/project.pbxproj | 18 + PBCreateTagSheet.h | 38 + PBCreateTagSheet.m | 93 ++ PBGitHistoryController.h | 1 + PBGitHistoryController.m | 9 + PBGitRepository.h | 1 + PBGitRepository.m | 35 + PBRefController.h | 2 + PBRefController.m | 38 +- PBRefMenuItem.m | 6 +- 12 files changed, 1749 insertions(+), 32 deletions(-) create mode 100644 English.lproj/PBCreateTagSheet.xib create mode 100644 PBCreateTagSheet.h create mode 100644 PBCreateTagSheet.m diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 8f619b8..34b4033 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -3,12 +3,12 @@ 1050 10C540 - 732 + 759 1038.25 458.00 com.apple.InterfaceBuilder.CocoaPlugin - 732 + 759 YES @@ -648,6 +648,15 @@ Repository YES + + + Create Tag + t + 1048576 + 2147483647 + + + Create Branch @@ -675,7 +684,7 @@ - + Reveal in Finder @@ -1294,9 +1303,17 @@ revealInFinder: - + - 946 + 948 + + + + createTag: + + + + 950 @@ -1959,7 +1976,8 @@ - + + @@ -1979,8 +1997,13 @@ - 945 - + 947 + + + + + 949 + @@ -2179,7 +2202,8 @@ 938.IBPluginDependency 942.IBPluginDependency 943.IBPluginDependency - 945.IBPluginDependency + 947.IBPluginDependency + 949.IBPluginDependency YES @@ -2368,7 +2392,8 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{668, 663}, {192, 73}} + {{668, 643}, {192, 93}} + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2392,7 +2417,7 @@ - 946 + 950 @@ -2476,6 +2501,29 @@ PBCollapsibleSplitView.h + + PBCommitList + NSTableView + + YES + + YES + controller + webController + webView + + + YES + PBGitHistoryController + PBWebHistoryController + WebView + + + + IBProjectSource + PBCommitList.h + + PBCreateBranchSheet NSWindowController @@ -2496,19 +2544,15 @@ YES YES - branchName - errorMessage - isTrackingBranch - remoteMenu - remotePopup + branchNameField + errorMessageField + startRefish YES NSTextField NSTextField - NSButton - NSMenu - NSPopUpButton + id @@ -2516,6 +2560,44 @@ PBCreateBranchSheet.h + + PBCreateTagSheet + NSWindowController + + YES + + YES + closeCreateTagSheet: + createTag: + + + YES + id + id + + + + YES + + YES + errorMessageField + tagMessageText + tagNameField + targetRefish + + + YES + NSTextField + NSTextView + NSTextField + id + + + + IBProjectSource + PBCreateTagSheet.h + + PBGitCommitController PBViewController @@ -2568,6 +2650,7 @@ YES createBranch: + createTag: openFilesAction: openSelectedFile: refresh: @@ -2590,6 +2673,7 @@ id id id + id @@ -2743,6 +2827,64 @@ PBNiceSplitView.h + + PBRefController + NSObject + + YES + + YES + changeBranch: + copyPatch: + copySHA: + createBranch: + createTag: + showTagInfoSheet: + + + YES + NSMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + PBRefMenuItem + + + + YES + + YES + branchPopUp + commitController + commitList + historyController + + + YES + NSPopUpButton + NSArrayController + PBCommitList + PBGitHistoryController + + + + IBProjectSource + PBRefController.h + + + + PBRefMenuItem + NSMenuItem + + refish + id + + + IBProjectSource + PBRefMenuItem.h + + PBRepositoryDocumentController NSDocumentController @@ -2817,6 +2959,27 @@ PBWebController.h + + PBWebHistoryController + PBWebController + + YES + + YES + contextMenuDelegate + historyController + + + YES + id + PBGitHistoryController + + + + IBProjectSource + PBWebHistoryController.h + + YES @@ -3600,6 +3763,7 @@ 0 + IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.macosx diff --git a/English.lproj/PBCreateTagSheet.xib b/English.lproj/PBCreateTagSheet.xib new file mode 100644 index 0000000..a47eb30 --- /dev/null +++ b/English.lproj/PBCreateTagSheet.xib @@ -0,0 +1,1338 @@ + + + + 1050 + 10C540 + 732 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 732 + + + YES + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + PBCreateTagSheet + + + FirstResponder + + + NSApplication + + + 1 + 2 + {{196, 233}, {425, 277}} + 544736256 + Window + NSWindow + + {1.79769e+308, 1.79769e+308} + {425, 277} + + + 256 + + YES + + + 268 + {{17, 240}, {77, 17}} + + YES + + 68288064 + 272630784 + Create Tag + + LucidaGrande-Bold + 13 + 16 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 268 + {{29, 204}, {71, 17}} + + YES + + 68288064 + 71304192 + Tag name: + + LucidaGrande + 13 + 1044 + + + + + + + + + 266 + {{105, 202}, {300, 22}} + + YES + + -1804468671 + 272630784 + + + Tag + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + + + + + + 268 + {{37, 172}, {63, 17}} + + YES + + 68288064 + 71304192 + Message: + + + + + + + + + 266 + + YES + + + 2304 + + YES + + + 2322 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + public.url + + + {298, 14} + + + + + + + + + + + YES + + + 134 + + + + 298 + 1 + + + 3971 + 0 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSCursor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + {8, -8} + 13 + + + + + + + 6 + {598, 1e+07} + {204, 0} + + + + {{1, 1}, {298, 133}} + + + + + + {4, -5} + 1 + + 4 + + + + -2147483392 + {{339, 1}, {15, 133}} + + + _doScroller: + 1 + 0.85256409645080566 + + + + -2147483392 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1 + 0.94565218687057495 + + + {{105, 59}, {300, 135}} + + + 530 + + + + + + + 289 + {{315, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + Create + + + -2038284033 + 129 + + DQ + 200 + 25 + + + + + 289 + {{219, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + Cancel + + + -2038284033 + 129 + + Gw + 200 + 25 + + + + + -2147483358 + {{17, 22}, {203, 17}} + + YES + + 68288064 + 272630784 + Label + + + + + 1 + MSAwIDAAA + + + + + + 268 + {{50, 157}, {46, 11}} + + YES + + 68288064 + 272892928 + (optional) + + LucidaGrande + 9 + 3614 + + + + + + + + {425, 277} + + {{0, 0}, {1680, 1028}} + {425, 299} + {1.79769e+308, 1.79769e+308} + + + + + YES + + + window + + + + 28 + + + + closeCreateTagSheet: + + + + 29 + + + + createTag: + + + + 30 + + + + tagNameField + + + + 31 + + + + tagMessageText + + + + 32 + + + + errorMessageField + + + + 33 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + + + + + + + + + 3 + + + YES + + + + + + 4 + + + + + 5 + + + YES + + + + + + 6 + + + + + 7 + + + YES + + + + + + 8 + + + + + 11 + + + YES + + + + + + 12 + + + + + 13 + + + YES + + + + + + 14 + + + + + 15 + + + YES + + + + + + 16 + + + + + 17 + + + YES + + + + + + 18 + + + + + 21 + + + YES + + + + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 26 + + + YES + + + + + + 27 + + + + + + + YES + + YES + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 1.windowTemplate.hasMinSize + 1.windowTemplate.minSize + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 2.IBPluginDependency + 21.IBPluginDependency + 22.IBPluginDependency + 23.IBPluginDependency + 24.IBPluginDependency + 26.IBPluginDependency + 27.IBPluginDependency + 3.IBPluginDependency + 4.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + + + YES + {{798, 694}, {425, 277}} + com.apple.InterfaceBuilder.CocoaPlugin + {{798, 694}, {425, 277}} + + {196, 240} + {{202, 428}, {480, 270}} + + {425, 277} + 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 + 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 + + + + YES + + + YES + + + + + YES + + + YES + + + + 33 + + + + YES + + PBCreateTagSheet + NSWindowController + + YES + + YES + closeCreateTagSheet: + createTag: + + + YES + id + id + + + + YES + + YES + errorMessageField + tagMessageText + tagNameField + + + YES + NSTextField + NSTextView + NSTextField + + + + IBProjectSource + PBCreateTagSheet.h + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUAppcast.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUUpdater.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSScrollView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSScrollView.h + + + + NSScroller + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSScroller.h + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + GitX.xcodeproj + 3 + + diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 5d2238f..7caba38 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -46,7 +46,9 @@ D26DC6450E782C9000C777B2 /* gitx.icns in Resources */ = {isa = PBXBuildFile; fileRef = D26DC6440E782C9000C777B2 /* gitx.icns */; }; D854948610D5C01B0083B917 /* PBCreateBranchSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = D854948510D5C01B0083B917 /* PBCreateBranchSheet.m */; }; D85B939310E3D8B4007F3C28 /* PBCreateBranchSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = D85B939210E3D8B4007F3C28 /* PBCreateBranchSheet.xib */; }; + D889EB3110E6BCBB00F08413 /* PBCreateTagSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = D889EB3010E6BCBB00F08413 /* PBCreateTagSheet.xib */; }; D8E3B2B810DC9FB2001096A3 /* ScriptingBridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E3B2B710DC9FB2001096A3 /* ScriptingBridge.framework */; }; + D8E3B34D10DCA958001096A3 /* PBCreateTagSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = D8E3B34C10DCA958001096A3 /* PBCreateTagSheet.m */; }; EB2A734A0FEE3F09006601CF /* PBCollapsibleSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = EB2A73490FEE3F09006601CF /* PBCollapsibleSplitView.m */; }; F50A411F0EBB874C00208746 /* mainSplitterBar.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F50A411D0EBB874C00208746 /* mainSplitterBar.tiff */; }; F50A41200EBB874C00208746 /* mainSplitterDimple.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F50A411E0EBB874C00208746 /* mainSplitterDimple.tiff */; }; @@ -217,6 +219,9 @@ D854949310D5C3E20083B917 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/PBCreateBranchSheet.xib; sourceTree = ""; }; D85B93F610E51279007F3C28 /* PBGitRefish.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRefish.h; sourceTree = ""; }; D8E3B2B710DC9FB2001096A3 /* ScriptingBridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScriptingBridge.framework; path = /System/Library/Frameworks/ScriptingBridge.framework; sourceTree = ""; }; + D8E3B34B10DCA958001096A3 /* PBCreateTagSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCreateTagSheet.h; sourceTree = ""; }; + D8E3B34C10DCA958001096A3 /* PBCreateTagSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCreateTagSheet.m; sourceTree = ""; }; + D8E3B38110DD4E2C001096A3 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/PBCreateTagSheet.xib; sourceTree = ""; }; EB2A73480FEE3F09006601CF /* PBCollapsibleSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCollapsibleSplitView.h; sourceTree = ""; }; EB2A73490FEE3F09006601CF /* PBCollapsibleSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCollapsibleSplitView.m; sourceTree = ""; }; F50A411D0EBB874C00208746 /* mainSplitterBar.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = mainSplitterBar.tiff; path = Images/mainSplitterBar.tiff; sourceTree = ""; }; @@ -456,6 +461,7 @@ F52BCE020E84208300AA3741 /* PBGitHistoryView.xib */, F59116E50E843BB50072CCB1 /* PBGitCommitView.xib */, D85B939210E3D8B4007F3C28 /* PBCreateBranchSheet.xib */, + D889EB3010E6BCBB00F08413 /* PBCreateTagSheet.xib */, 47DBDB680E94EF6500671A1E /* Preferences.xib */, F569AE920F2CBD7C00C2FFA7 /* Credits.html */, ); @@ -503,6 +509,8 @@ children = ( D854948410D5C01B0083B917 /* PBCreateBranchSheet.h */, D854948510D5C01B0083B917 /* PBCreateBranchSheet.m */, + D8E3B34B10DCA958001096A3 /* PBCreateTagSheet.h */, + D8E3B34C10DCA958001096A3 /* PBCreateTagSheet.m */, ); name = Sheets; sourceTree = ""; @@ -844,6 +852,7 @@ 47DBDBB10E94F6CA00671A1E /* Updates.png in Resources */, F569AE930F2CBD7C00C2FFA7 /* Credits.html in Resources */, D85B939310E3D8B4007F3C28 /* PBCreateBranchSheet.xib in Resources */, + D889EB3110E6BCBB00F08413 /* PBCreateTagSheet.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -964,6 +973,7 @@ EB2A734A0FEE3F09006601CF /* PBCollapsibleSplitView.m in Sources */, F59F1DD5105C4FF300115F88 /* PBGitIndex.m in Sources */, D854948610D5C01B0083B917 /* PBCreateBranchSheet.m in Sources */, + D8E3B34D10DCA958001096A3 /* PBCreateTagSheet.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1064,6 +1074,14 @@ name = PBCreateBranchSheet.xib; sourceTree = ""; }; + D889EB3010E6BCBB00F08413 /* PBCreateTagSheet.xib */ = { + isa = PBXVariantGroup; + children = ( + D8E3B38110DD4E2C001096A3 /* English */, + ); + name = PBCreateTagSheet.xib; + sourceTree = ""; + }; F5B721C20E05CF7E00AF29DC /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( diff --git a/PBCreateTagSheet.h b/PBCreateTagSheet.h new file mode 100644 index 0000000..78c1793 --- /dev/null +++ b/PBCreateTagSheet.h @@ -0,0 +1,38 @@ +// +// PBCreateTagSheet.h +// GitX +// +// Created by Nathan Kinsinger on 12/18/09. +// Copyright 2009 Nathan Kinsinger. All rights reserved. +// + +#import +#import "PBGitRefish.h" + + +@class PBGitRepository; + + +@interface PBCreateTagSheet : NSWindowController { + PBGitRepository *repository; + id targetRefish; + + NSTextField *tagNameField; + NSTextView *tagMessageText; + NSTextField *errorMessageField; +} + ++ (void) beginCreateTagSheetAtRefish:(id )refish inRepository:(PBGitRepository *)repo; + +- (IBAction) createTag:(id)sender; +- (IBAction) closeCreateTagSheet:(id)sender; + + +@property (retain) PBGitRepository *repository; +@property (retain) id targetRefish; + +@property (assign) IBOutlet NSTextField *tagNameField; +@property (assign) IBOutlet NSTextView *tagMessageText; +@property (assign) IBOutlet NSTextField *errorMessageField; + +@end diff --git a/PBCreateTagSheet.m b/PBCreateTagSheet.m new file mode 100644 index 0000000..4ca5fb1 --- /dev/null +++ b/PBCreateTagSheet.m @@ -0,0 +1,93 @@ +// +// PBCreateTagSheet.m +// GitX +// +// Created by Nathan Kinsinger on 12/18/09. +// Copyright 2009 Nathan Kinsinger. All rights reserved. +// + +#import "PBCreateTagSheet.h" +#import "PBGitRepository.h" +#import "PBGitCommit.h" + + +@interface PBCreateTagSheet () + +- (void) beginCreateTagSheetAtRefish:(id )refish inRepository:(PBGitRepository *)repo; + +@end + + +@implementation PBCreateTagSheet + +@synthesize repository; +@synthesize targetRefish; + +@synthesize tagNameField; +@synthesize tagMessageText; +@synthesize errorMessageField; + + + +#pragma mark - +#pragma mark PBCreateTagSheet + ++ (void) beginCreateTagSheetAtRefish:(id )refish inRepository:(PBGitRepository *)repo +{ + PBCreateTagSheet *sheet = [[self alloc] initWithWindowNibName:@"PBCreateTagSheet"]; + [sheet beginCreateTagSheetAtRefish:refish inRepository:repo]; +} + + +- (void) beginCreateTagSheetAtRefish:(id )refish inRepository:(PBGitRepository *)repo +{ + self.repository = repo; + self.targetRefish = refish; + + [self window]; // loads the window (if it wasn't already) + [self.errorMessageField setStringValue:@""]; + + [NSApp beginSheet:[self window] modalForWindow:[self.repository.windowController window] modalDelegate:self didEndSelector:nil contextInfo:NULL]; +} + + + +#pragma mark IBActions + +- (IBAction) createTag:(id)sender +{ + NSString *tagName = [self.tagNameField stringValue]; + [self.errorMessageField setHidden:YES]; + + NSString *refName = [@"refs/tags/" stringByAppendingString:tagName]; + if (![self.repository checkRefFormat:refName]) { + [self.errorMessageField setStringValue:@"Invalid name"]; + [self.errorMessageField setHidden:NO]; + return; + } + + for (PBGitRevSpecifier *rev in self.repository.branches) { + NSString *name = [[rev ref] tagName]; + if ([tagName isEqualToString:name]) { + [self.errorMessageField setStringValue:@"Tag already exists"]; + [self.errorMessageField setHidden:NO]; + return; + } + } + + [self closeCreateTagSheet:sender]; + + NSString *message = [self.tagMessageText string]; + [self.repository createTag:tagName message:message atRefish:self.targetRefish]; +} + + +- (IBAction) closeCreateTagSheet:(id)sender +{ + [NSApp endSheet:[self window]]; + [[self window] orderOut:self]; +} + + + +@end diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index f45402b..2be198b 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -53,6 +53,7 @@ // Repository Methods - (IBAction) createBranch:(id)sender; +- (IBAction) createTag:(id)sender; - (void) copyCommitInfo; diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index abb7147..ba1517c 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -12,6 +12,7 @@ #import "PBGitRevisionCell.h" #import "PBCommitList.h" #import "PBCreateBranchSheet.h" +#import "PBCreateTagSheet.h" #define QLPreviewPanel NSClassFromString(@"QLPreviewPanel") @@ -335,4 +336,12 @@ [PBCreateBranchSheet beginCreateBranchSheetAtRefish:realCommit inRepository:self.repository]; } +- (IBAction) createTag:(id)sender +{ + if (!realCommit) + [PBCreateTagSheet beginCreateTagSheetAtRefish:[repository.currentBranch ref] inRepository:repository]; + else + [PBCreateTagSheet beginCreateTagSheetAtRefish:realCommit inRepository:repository]; +} + @end diff --git a/PBGitRepository.h b/PBGitRepository.h index e78a36f..2a0029f 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -30,6 +30,7 @@ extern NSString* PBGitRepositoryErrorDomain; } - (BOOL) createBranch:(NSString *)branchName atRefish:(id )ref; +- (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id )commitSHA; - (NSFileHandle*) handleForCommand:(NSString*) cmd; - (NSFileHandle*) handleForArguments:(NSArray*) args; diff --git a/PBGitRepository.m b/PBGitRepository.m index a9ed922..95f177d 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -446,6 +446,41 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; return YES; } +- (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id )target +{ + if (!tagName) + return NO; + + NSMutableArray *arguments = [NSMutableArray arrayWithObject:@"tag"]; + + // if there is a message then make this an annotated tag + if (message && ![message isEqualToString:@""] && ([message length] > 3)) { + [arguments addObject:@"-a"]; + [arguments addObject:[@"-m" stringByAppendingString:message]]; + } + + [arguments addObject:tagName]; + + // if no refish then git will add it to HEAD + if (target) + [arguments addObject:[target refishName]]; + + int retValue = 1; + NSString *output = [self outputInWorkdirForArguments:arguments retValue:&retValue]; + if (retValue) { + NSString *targetName = @"HEAD"; + if (target) + targetName = [NSString stringWithFormat:@"%@ '%@'", [target refishType], [target shortName]]; + NSString *message = [NSString stringWithFormat:@"There was an error creating the tag '%@' at %@.", tagName, targetName]; + [self.windowController showErrorSheetTitle:@"Create Tag failed!" message:message arguments:arguments output:output]; + return NO; + } + + [self reloadRefs]; + return YES; +} + + #pragma mark low level - (int) returnValueForCommand:(NSString *)cmd diff --git a/PBRefController.h b/PBRefController.h index c1d7175..6cd1631 100644 --- a/PBRefController.h +++ b/PBRefController.h @@ -26,6 +26,8 @@ - (void) createBranch:(PBRefMenuItem *)sender; - (void) copySHA:(PBRefMenuItem *)sender; - (void) copyPatch:(PBRefMenuItem *)sender; +- (void) createTag:(PBRefMenuItem *)sender; +- (void) showTagInfoSheet:(PBRefMenuItem *)sender; - (NSArray *) menuItemsForRef:(PBGitRef *)ref; - (NSArray *) menuItemsForCommit:(PBGitCommit *)commit; diff --git a/PBRefController.m b/PBRefController.m index c4e4e8d..3b7f81d 100644 --- a/PBRefController.m +++ b/PBRefController.m @@ -10,6 +10,7 @@ #import "PBGitRevisionCell.h" #import "PBRefMenuItem.h" #import "PBCreateBranchSheet.h" +#import "PBCreateTagSheet.h" @implementation PBRefController @@ -75,6 +76,31 @@ } +#pragma mark Tags + +- (void) createTag:(PBRefMenuItem *)sender +{ + id refish = [sender refish]; + [PBCreateTagSheet beginCreateTagSheetAtRefish:refish inRepository:historyController.repository]; +} + +- (void) showTagInfoSheet:(PBRefMenuItem *)sender +{ + if ([[sender refish] refishType] != kGitXTagType) + return; + + NSString *tagName = [(PBGitRef *)[sender refish] tagName]; + + int retValue = 1; + NSArray *args = [NSArray arrayWithObjects:@"tag", @"-n50", @"-l", tagName, nil]; + NSString *info = [historyController.repository outputInWorkdirForArguments:args retValue:&retValue]; + if (!retValue) { + NSString *message = [NSString stringWithFormat:@"Info for tag: %@", tagName]; + [historyController.repository.windowController showMessageSheet:message infoText:info]; + } +} + + - (void) removeRefSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSAlertDefaultReturn) { @@ -111,18 +137,6 @@ [commitController rearrangeObjects]; } -- (void) tagInfo:(PBRefMenuItem *)sender -{ - NSString *message = [NSString stringWithFormat:@"Info for tag: %@", [[sender refish] shortName]]; - - int ret = 1; - NSString *info = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"tag", @"-n50", @"-l", [[sender refish] shortName], nil] retValue: &ret]; - - if (!ret) { - [[historyController.repository windowController] showMessageSheet:message infoText:info]; - } - return; -} #pragma mark Contextual menus diff --git a/PBRefMenuItem.m b/PBRefMenuItem.m index 875948a..54cd2ce 100644 --- a/PBRefMenuItem.m +++ b/PBRefMenuItem.m @@ -51,9 +51,12 @@ // create branch [items addObject:[PBRefMenuItem itemWithTitle:@"Create branch…" action:@selector(createBranch:) enabled:YES]]; + // create tag + [items addObject:[PBRefMenuItem itemWithTitle:@"Create Tag…" action:@selector(createTag:) enabled:YES]]; + // view tag info if ([ref isTag]) - [items addObject:[PBRefMenuItem itemWithTitle:@"View tag info" action:@selector(tagInfo:) enabled:YES]]; + [items addObject:[PBRefMenuItem itemWithTitle:@"View tag info…" action:@selector(showTagInfoSheet:) enabled:YES]]; // delete ref [items addObject:[PBRefMenuItem separatorItem]]; @@ -74,6 +77,7 @@ NSMutableArray *items = [NSMutableArray array]; [items addObject:[PBRefMenuItem itemWithTitle:@"Create Branch…" action:@selector(createBranch:) enabled:YES]]; + [items addObject:[PBRefMenuItem itemWithTitle:@"Create Tag…" action:@selector(createTag:) enabled:YES]]; [items addObject:[PBRefMenuItem separatorItem]]; [items addObject:[PBRefMenuItem itemWithTitle:@"Copy SHA" action:@selector(copySHA:) enabled:YES]];