This patch adds a CFBundleGitRevision key to Info.plist which is set to the output of "git describe" when building.
The menu-entry for "About GitX" was reconnected to a custom method in the AppController, which reads the CF-string from the .plist and also indicates if the build is a DEBUG-build. Signed-off-by: Johannes Gilger <[email protected]> --- Hi list, after several failed attempts to get this feature working I think I've finally found a satisfying and minimally invasive solution. The commit-message should describe everything. The about-panel now looks like this: http://avalon.hoffentlich.net/~heipei/tmp/gitx_about_panel.png And the convenient thing is that it's still completely machine-generated. Will push it to github under jg/describe as well Greetings, Jojo ApplicationController.h | 1 + ApplicationController.m | 15 +++ English.lproj/MainMenu.xib | 208 +++++++++++++++++++++++++++++++--------- GitX.xcodeproj/project.pbxproj | 2 +- Info.plist | 2 + 5 files changed, 183 insertions(+), 45 deletions(-) diff --git a/ApplicationController.h b/ApplicationController.h index 44d9fb6..1c8e5f4 100644 --- a/ApplicationController.h +++ b/ApplicationController.h @@ -28,6 +28,7 @@ - (NSManagedObjectContext *)managedObjectContext; - (IBAction)openPreferencesWindow:(id)sender; +- (IBAction)showAboutPanel:(id)sender; - (IBAction)installCliTool:(id)sender; diff --git a/ApplicationController.m b/ApplicationController.m index 48f3964..2f1c641 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -92,6 +92,21 @@ - (IBAction)openPreferencesWindow:(id)sender [[PBPrefsWindowController sharedPrefsWindowController] showWindow:nil]; } +- (IBAction)showAboutPanel:(id)sender +{ + NSString* gitversion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleGitVersion"]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; + if(gitversion) { + [dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys: gitversion, @"Version", nil]]; + } + + #ifdef DEBUG_BUILD + [dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:@"GitX (DEBUG)", @"ApplicationName", nil]]; + #endif + + [NSApp orderFrontStandardAboutPanelWithOptions:dict]; +} + - (IBAction)installCliTool:(id)sender; { BOOL success = NO; diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 3e4d678..4873859 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9G55</string> + <string key="IBDocument.SystemVersion">10A432</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.43</string> - <string key="IBDocument.HIToolboxVersion">353.00</string> + <string key="IBDocument.AppKitVersion">1038</string> + <string key="IBDocument.HIToolboxVersion">437.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="81"/> + <integer value="57"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -16,7 +16,7 @@ </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> @@ -886,14 +886,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">orderFrontStandardAboutPanel:</string> - <reference key="source" ref="519751875"/> - <reference key="destination" ref="1039244063"/> - </object> - <int key="connectionID">142</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">hideOtherApplications:</string> <reference key="source" ref="519751875"/> <reference key="destination" ref="406172696"/> @@ -1220,34 +1212,40 @@ </object> <int key="connectionID">934</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">showAboutPanel:</string> + <reference key="source" ref="859235683"/> + <reference key="destination" ref="1039244063"/> + </object> + <int key="connectionID">935</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> - <object class="NSArray" key="object" id="91482642"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="object" ref="0"/> <reference key="children" ref="478503744"/> <nil key="parent"/> </object> <object class="IBObjectRecord"> <int key="objectID">-2</int> <reference key="object" ref="519751875"/> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="954860085"/> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="555328534"/> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> @@ -1262,7 +1260,7 @@ <reference ref="937798568"/> <reference ref="15213245"/> </object> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> <string key="objectName">MainMenu</string> </object> <object class="IBObjectRecord"> @@ -1792,7 +1790,7 @@ <object class="IBObjectRecord"> <int key="objectID">205</int> <reference key="object" ref="859235683"/> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> <string key="objectName">ApplicationController</string> </object> <object class="IBObjectRecord"> @@ -1818,7 +1816,7 @@ <object class="IBObjectRecord"> <int key="objectID">908</int> <reference key="object" ref="189246969"/> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">909</int> @@ -1828,7 +1826,7 @@ <object class="IBObjectRecord"> <int key="objectID">912</int> <reference key="object" ref="391227374"/> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">915</int> @@ -1843,7 +1841,7 @@ <object class="IBObjectRecord"> <int key="objectID">918</int> <reference key="object" ref="203602687"/> - <reference key="parent" ref="91482642"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">919</int> @@ -1869,7 +1867,7 @@ </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>-1.IBPluginDependency</string> <string>-2.IBPluginDependency</string> @@ -2246,9 +2244,7 @@ </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> @@ -2256,15 +2252,13 @@ <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> - <int key="maxID">934</int> + <int key="maxID">935</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -2274,11 +2268,12 @@ <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>installCliTool:</string> <string>openPreferencesWindow:</string> <string>saveAction:</string> + <string>showAboutPanel:</string> <string>showHelp:</string> </object> <object class="NSMutableArray" key="dict.values"> @@ -2287,11 +2282,12 @@ <string>id</string> <string>id</string> <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>firstResponder</string> <string>window</string> @@ -2320,7 +2316,7 @@ <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>setDetailedView:</string> <string>setRawView:</string> @@ -2339,24 +2335,34 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">PBCollapsibleSplitView</string> + <string key="superclassName">PBNiceSplitView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PBCollapsibleSplitView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">PBGitCommitController</string> <string key="superclassName">PBViewController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>commit:</string> <string>refresh:</string> + <string>signOff:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>cachedFilesController</string> <string>commitMessageView</string> @@ -2368,9 +2374,9 @@ <bool key="EncodedWithXMLCoder">YES</bool> <string>NSArrayController</string> <string>NSTextView</string> - <string>id</string> + <string>PBGitIndexController</string> <string>NSArrayController</string> - <string>id</string> + <string>PBWebChangesController</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -2383,13 +2389,16 @@ <string key="superclassName">PBViewController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> + <string>openFilesAction:</string> <string>openSelectedFile:</string> <string>refresh:</string> <string>setDetailedView:</string> <string>setRawView:</string> <string>setTreeView:</string> + <string>showCommitsFromTree:</string> + <string>showInFinderAction:</string> <string>toggleQuickView:</string> </object> <object class="NSMutableArray" key="dict.values"> @@ -2400,15 +2409,19 @@ <string>id</string> <string>id</string> <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>commitController</string> <string>commitList</string> <string>fileBrowser</string> + <string>historySplitView</string> <string>searchField</string> <string>treeController</string> <string>webView</string> @@ -2418,6 +2431,7 @@ <string>NSArrayController</string> <string>NSTableView</string> <string>NSOutlineView</string> + <string>PBCollapsibleSplitView</string> <string>NSSearchField</string> <string>NSTreeController</string> <string>id</string> @@ -2429,11 +2443,55 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">PBGitIndexController</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>rowClicked:</string> + <string>tableClicked:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSCell</string> + <string>NSTableView</string> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>commitController</string> + <string>stagedButtonCell</string> + <string>stagedFilesController</string> + <string>stagedTable</string> + <string>unstagedButtonCell</string> + <string>unstagedFilesController</string> + <string>unstagedTable</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>PBGitCommitController</string> + <string>PBIconAndTextCell</string> + <string>NSArrayController</string> + <string>NSTableView</string> + <string>PBIconAndTextCell</string> + <string>NSArrayController</string> + <string>NSTableView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PBGitIndexController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">PBGitWindowController</string> <string key="superclassName">NSWindowController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>showCommitView:</string> <string>showHistoryView:</string> @@ -2458,7 +2516,7 @@ <string key="superclassName">NSWindowController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>openSelectedFile:</string> <string>refresh:</string> @@ -2479,7 +2537,7 @@ </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>commitController</string> <string>commitList</string> @@ -2500,6 +2558,22 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">PBIconAndTextCell</string> + <string key="superclassName">NSTextFieldCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PBIconAndTextCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">PBNiceSplitView</string> + <string key="superclassName">NSSplitView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PBNiceSplitView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">PBRepositoryDocumentController</string> <string key="superclassName">NSDocumentController</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -2527,6 +2601,52 @@ <string key="minorKey">PBViewController.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">PBWebChangesController</string> + <string key="superclassName">PBWebController</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>cachedFilesController</string> + <string>controller</string> + <string>indexController</string> + <string>unstagedFilesController</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSArrayController</string> + <string>PBGitCommitController</string> + <string>PBGitIndexController</string> + <string>NSArrayController</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PBWebChangesController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">PBWebController</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>repository</string> + <string>view</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>WebView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">PBWebController.h</string> + </object> + </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> <bool key="EncodedWithXMLCoder">YES</bool> diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index db13f30..0ac0dcf 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -767,7 +767,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\nVERSION=$(cd \"$PROJECT_DIR\";git describe)\nLONG_VERSION=$(echo $VERSION | sed -e \"s/\\-/\\./\" -e \"s/^v//\" -e \"s/-.*//\")\nSHORT_VERSION=$(echo $VERSION | sed -e \"s/\\-.*//\" -e \"s/^v//\")\n\necho -n \"#define LONG_VERSION $LONG_VERSION\n#define SHORT_VERSION $SHORT_VERSION\" > \"$PROJECT_TEMP_DIR/revision\"\ntouch Info.plist"; + shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\nVERSION=$(cd \"$PROJECT_DIR\";git describe)\nexport GIT_VERSION=\"test\"\nLONG_VERSION=$(echo $VERSION | sed -e \"s/\\-/\\./\" -e \"s/^v//\" -e \"s/-.*//\")\nSHORT_VERSION=$(echo $VERSION | sed -e \"s/\\-.*//\" -e \"s/^v//\")\n\necho -n \"#define LONG_VERSION $LONG_VERSION\n#define GIT_VERSION $VERSION\n#define SHORT_VERSION $SHORT_VERSION\" > \"$PROJECT_TEMP_DIR/revision\"\ntouch Info.plist"; }; F5792DFB0EDB570C001B0C31 /* Compile libgit2 */ = { isa = PBXShellScriptBuildPhase; diff --git a/Info.plist b/Info.plist index 879b2a2..8aa62a7 100644 --- a/Info.plist +++ b/Info.plist @@ -50,6 +50,8 @@ <string>????</string> <key>CFBundleVersion</key> <string>LONG_VERSION</string> + <key>CFBundleGitVersion</key> + <string>GIT_VERSION</string> <key>CFBundleShortVersionString</key> <string>SHORT_VERSION</string> <key>NSMainNibFile</key> -- 1.6.4.2.236.gf324c
