Showing heading of the section following the hunk range in internal diff viewer

G S April 29, 2014

Hello,

Is the custom action required to achieve this output in the internal diff viewer?

Can't quite get the internal diff viewer to show the (optional) heading of the section that shows function that the hunk is part of, following the hunk range.

Is this showing of the function that the hunk is part of, even possible with current version of Sourcetree, 1.5.2.0 ?

Thanks much.

4 answers

0 votes
G S May 14, 2014

Yes, showing the method signature like it's shown in the "git diff" output.

Okay, so perhaps SourceTree isn't just using git diff under the hood.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2014

It sounds like George wants SourceTree to parse the code being displayed in the diff so that method signatures would be included in the context. For example, a hunk would look like:

...
function MyFunction() {
...
//precontext line 3
//precontext line 2
//precontext line 1
/*
diffed lines
*/
//postcontext line 1
//postcontext line 2
//postcontext line 3
...

I expect most people would understand that the proposed feature is far too complex to implement reliably, especially in languages that allow nested functions. However, if you were able to implement this for even some languages, it would be incredibly helpful/cool.

0 votes
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2014

Hi George,

Could you re-phrase your original question. I'm not understanding what you're getting at.

Cheers.

G S May 14, 2014

Hello, in the SourceTree in Log/History view, right side is a diff pane.

In a given diff output, one sees the following as an example:

Hunk 1 : Lines 3-15 (previously 3-14)
...
... dif output
...

That's good and all, but how do i show the diff heading that looks like following with the heading of the diff section that shows the function that the diff is part of ?

index b1d597c..1097bf4 100644
--- a/src/foo.c
+++ b/src/foo.c
@@ -1809,6 +1809,7 @@ blah42_routine(char** argv,
...
... dif output
...

G S May 20, 2014

Bump. Did the above info help to clarify the original question? Thanks.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

It did for me, I've never noticed that feature of git diff before, but it's pretty awesome.

Unfortunately, I don't think any existing options (including custom actions) are going to achieve what you want. File a feature request on jira.atlassian.com, then post a link here so I (and anyone else who is interested) can vote for it.

KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2014

Hey George. We parse out the diff in order to generate the diff view. We don't expose any of these options, you'd have to do a Git call to get them :)

0 votes
G S May 13, 2014

Bump. Help... :(

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events