Skip to content

Commit d973dc5

Browse files
Pieter de Biepieter
authored andcommitted
Display context menu in the history tree to show related commits
Signed-off-by: Johannes Gilger <[email protected]>
1 parent d04362b commit d973dc5

File tree

3 files changed

+73
-5
lines changed

3 files changed

+73
-5
lines changed

PBGitHistoryController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
- (IBAction) toggleQuickView: sender;
4242
- (IBAction) openSelectedFile: sender;
4343
- (void) updateQuicklookForce: (BOOL) force;
44+
- (void) showCommitsFromTree:(id) sender;
4445

4546
- (void) copyCommitInfo;
4647

PBGitHistoryController.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,16 @@ - (NSMenu *)tableColumnMenu
218218
return menu;
219219
}
220220

221+
- (void) showCommitsFromTree:(id) sender
222+
{
223+
// TODO: Enable this from webview as well!
224+
225+
NSMutableArray *filePaths = [NSMutableArray arrayWithObjects:@"HEAD", @"--", NULL];
226+
for (PBGitTree *tree in [treeController selectedObjects])
227+
[filePaths addObject:[tree fullPath]];
228+
PBGitRevSpecifier *revSpec = [[PBGitRevSpecifier alloc] initWithParameters:filePaths];
229+
230+
repository.currentBranch = [repository addBranch:revSpec];
231+
}
232+
221233
@end

PBGitHistoryView.xib

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
33
<data>
44
<int key="IBDocument.SystemTarget">1050</int>
5-
<string key="IBDocument.SystemVersion">9G55</string>
5+
<string key="IBDocument.SystemVersion">9J61</string>
66
<string key="IBDocument.InterfaceBuilderVersion">677</string>
7-
<string key="IBDocument.AppKitVersion">949.43</string>
7+
<string key="IBDocument.AppKitVersion">949.46</string>
88
<string key="IBDocument.HIToolboxVersion">353.00</string>
99
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
1010
<bool key="EncodedWithXMLCoder">YES</bool>
11+
<integer value="275"/>
1112
<integer value="237"/>
1213
<integer value="27"/>
1314
</object>
@@ -345,6 +346,7 @@
345346
<object class="NSMutableArray" key="set.sortedObjects">
346347
<bool key="EncodedWithXMLCoder">YES</bool>
347348
<string>Apple HTML pasteboard type</string>
349+
<string>Apple PDF pasteboard type</string>
348350
<string>Apple PICT pasteboard type</string>
349351
<string>Apple URL pasteboard type</string>
350352
<string>Apple Web Archive pasteboard type</string>
@@ -355,6 +357,7 @@
355357
<string>NeXT Rich Text Format v1.0 pasteboard type</string>
356358
<string>NeXT TIFF v4.0 pasteboard type</string>
357359
<string>WebURLsWithTitlesPboardType</string>
360+
<string>public.png</string>
358361
<string>public.url</string>
359362
<string>public.url-name</string>
360363
</object>
@@ -1515,6 +1518,20 @@
15151518
<bool key="EncodedWithXMLCoder">YES</bool>
15161519
</object>
15171520
</object>
1521+
<object class="NSMenu" id="500542810">
1522+
<string key="NSTitle"/>
1523+
<object class="NSMutableArray" key="NSMenuItems">
1524+
<bool key="EncodedWithXMLCoder">YES</bool>
1525+
<object class="NSMenuItem" id="661418857">
1526+
<reference key="NSMenu" ref="500542810"/>
1527+
<string key="NSTitle">Commits touching paths</string>
1528+
<string key="NSKeyEquiv"/>
1529+
<int key="NSMnemonicLoc">2147483647</int>
1530+
<reference key="NSOnImage" ref="908677745"/>
1531+
<reference key="NSMixedImage" ref="746375230"/>
1532+
</object>
1533+
</object>
1534+
</object>
15181535
</object>
15191536
<object class="IBObjectContainer" key="IBDocument.Objects">
15201537
<object class="NSMutableArray" key="connectionRecords">
@@ -2105,6 +2122,22 @@
21052122
</object>
21062123
<int key="connectionID">274</int>
21072124
</object>
2125+
<object class="IBConnectionRecord">
2126+
<object class="IBActionConnection" key="connection">
2127+
<string key="label">showCommitsFromTree:</string>
2128+
<reference key="source" ref="1001"/>
2129+
<reference key="destination" ref="661418857"/>
2130+
</object>
2131+
<int key="connectionID">281</int>
2132+
</object>
2133+
<object class="IBConnectionRecord">
2134+
<object class="IBOutletConnection" key="connection">
2135+
<string key="label">menu</string>
2136+
<reference key="source" ref="216928480"/>
2137+
<reference key="destination" ref="500542810"/>
2138+
</object>
2139+
<int key="connectionID">282</int>
2140+
</object>
21082141
</object>
21092142
<object class="IBMutableOrderedSet" key="objectRecords">
21102143
<object class="NSArray" key="orderedObjects">
@@ -2735,6 +2768,20 @@
27352768
<reference key="object" ref="217429948"/>
27362769
<reference key="parent" ref="27300806"/>
27372770
</object>
2771+
<object class="IBObjectRecord">
2772+
<int key="objectID">276</int>
2773+
<reference key="object" ref="500542810"/>
2774+
<object class="NSMutableArray" key="children">
2775+
<bool key="EncodedWithXMLCoder">YES</bool>
2776+
<reference ref="661418857"/>
2777+
</object>
2778+
<reference key="parent" ref="1002"/>
2779+
</object>
2780+
<object class="IBObjectRecord">
2781+
<int key="objectID">275</int>
2782+
<reference key="object" ref="661418857"/>
2783+
<reference key="parent" ref="500542810"/>
2784+
</object>
27382785
</object>
27392786
</object>
27402787
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2814,6 +2861,9 @@
28142861
<string>27.ImportedFromIB2</string>
28152862
<string>272.IBPluginDependency</string>
28162863
<string>273.IBPluginDependency</string>
2864+
<string>275.IBPluginDependency</string>
2865+
<string>276.IBEditorWindowLastContentRect</string>
2866+
<string>276.IBPluginDependency</string>
28172867
<string>28.IBPluginDependency</string>
28182868
<string>28.IBShouldRemoveOnLegacySave</string>
28192869
<string>29.IBPluginDependency</string>
@@ -2945,6 +2995,9 @@
29452995
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29462996
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29472997
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2998+
<string>{{126, 715}, {223, 23}}</string>
2999+
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
3000+
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29483001
<reference ref="9"/>
29493002
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29503003
<reference ref="9"/>
@@ -2978,7 +3031,7 @@
29783031
</object>
29793032
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29803033
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2981-
<string>{{321, 79}, {852, 432}}</string>
3034+
<string>{{59, 317}, {852, 432}}</string>
29823035
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29833036
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29843037
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3013,7 +3066,7 @@
30133066
</object>
30143067
</object>
30153068
<nil key="sourceID"/>
3016-
<int key="maxID">274</int>
3069+
<int key="maxID">282</int>
30173070
</object>
30183071
<object class="IBClassDescriber" key="IBDocument.Classes">
30193072
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3032,7 +3085,7 @@
30323085
<object class="NSMutableArray" key="dict.values">
30333086
<bool key="EncodedWithXMLCoder">YES</bool>
30343087
<string>PBGitHistoryController</string>
3035-
<string>id</string>
3088+
<string>PBWebHistoryController</string>
30363089
<string>WebView</string>
30373090
</object>
30383091
</object>
@@ -3053,6 +3106,7 @@
30533106
<string>setDetailedView:</string>
30543107
<string>setRawView:</string>
30553108
<string>setTreeView:</string>
3109+
<string>showCommitsFromTree:</string>
30563110
<string>toggleQuickView:</string>
30573111
</object>
30583112
<object class="NSMutableArray" key="dict.values">
@@ -3063,6 +3117,7 @@
30633117
<string>id</string>
30643118
<string>id</string>
30653119
<string>id</string>
3120+
<string>id</string>
30663121
</object>
30673122
</object>
30683123
<object class="NSMutableDictionary" key="outlets">

0 commit comments

Comments
 (0)