--diff: Leo as an external git diff

34 views
Skip to first unread message

Edward K. Ream

unread,
Dec 7, 2016, 8:13:22 AM12/7/16
to leo-editor
Leo already supports --diff command line option: - h reports:

     --diff    use Leo as an external git diff

Apparently this was not up to snuff.  Or maybe I just forgot about it...

Anyway, I'm not using Leo this way, and typical flat file comparisons are inadequate when trying to compare Leonine code changes.

I need a break from endless bug fixes, so I'll look into what's involved in making Leo truly useful as a git diff. If successful, this could be a big improvement in Leonine work flow.

EKR

Edward K. Ream

unread,
Dec 7, 2016, 11:12:39 AM12/7/16
to leo-e...@googlegroups.com
On Wednesday, December 7, 2016 at 7:13:22 AM UTC-6, Edward K. Ream wrote:
Leo already supports --diff command line option: - h reports:

     --diff    use Leo as an external git diff

Apparently this was not up to snuff.  Or maybe I just forgot about it...

The present code is in LM.doDiff. It appears to be more of a stub than an attempt at complete code. The next sections provide haiku designs for using Leo as a git diff/merge tool...

Diff

1. All diffed files open immediately in a single Leo outline.  No tabs.

2. Diffed files will be grouped by folder.

3. Each diffed file will be represented by a single node, with two or more children giving the details of the diff.

Merge

An outline-oriented merge will be so useful. Merging files would open Leo much as for diff.  However, some way of indicating which code to use is essential.  The ideal would be the ability to cherry pick from within Leo.  We'll see.

Summary

Using Leo for git diff and merge will make collaboration between Leonistas much easier.  This is an extremely important project! How did I not see this before?

Edward

P.S. Supporting diff and merge in Leo should be relatively straightforward. Indeed, a few minutes of googling has already solved several git-related problems:

1. How to make git diff write to stdout?
2. git difftool, open all diff files immediately, not in serial

As a result, I expect progress on this project to be swift.

EKR

Edward K. Ream

unread,
Dec 7, 2016, 11:33:03 AM12/7/16
to leo-editor
On Wednesday, December 7, 2016 at 10:12:39 AM UTC-6, Edward K. Ream wrote:

> Merge...The ideal would be the ability to cherry pick from within Leo.

A way must be found.  This is way too good to miss!

SourceTree has superb cherry-picking abilities.  I switched from SourceTree to gitk because SourceTree had severe performance bugs.  Maybe they have been fixed...

SourceTree presents diffs as a series of separate snippets.  For each snippet, you could choose whether to use the old or new version of the code.  You just press a button. SourceTree may do something similar for merges.

Clearly, Leo can do at least as well, without performance problems!  Indeed, Leo can diff huge files instantly because each node has a unique gnx.  Thus moves can be detected without effort, and O(N**2) diff algorithms work on smallish text, namely p.b. Outlines are the ultimate platform for diffs and merges!

Eventually, we may want a SourceTree-like interface for cherry-picking.  But that might not be necessary.  We can imagine a command like git-pick (applied to the desired code) or git-pick-mine, applied to an organizer node containing two or three variants of code.  Or maybe something even simpler :-)

It's hard to overstate how important this could be.  Heh.  Imagine non-Leonistas using Leo as the ultimate git diff/merge tool!

EKR

john lunzer

unread,
Dec 7, 2016, 12:59:43 PM12/7/16
to leo-editor
As you've stated, Leo seems uniquely suited towards tasks of this nature. I could even imagine full git integration, I imagine never having to leave the confines of Leo to work on a project and manage it in Git.

Terry Brown

unread,
Dec 7, 2016, 4:08:48 PM12/7/16
to leo-e...@googlegroups.com
Check out Meld (http://meldmerge.org/) as well, it's pretty good.  Side by side text view.

Cheers -Terry


From: Edward K. Ream <edre...@gmail.com>
To: leo-editor <leo-e...@googlegroups.com>
Sent: Wednesday, December 7, 2016 10:33 AM
Subject: Re: --diff: Leo as an external git diff

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To post to this group, send email to leo-e...@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Edward K. Ream

unread,
Dec 7, 2016, 4:43:50 PM12/7/16
to leo-editor
​​On Wed, Dec 7, 2016 at 10:33 AM, Edward K. Ream <edre...@gmail.com> wrote:

​> ​
Heh.  Imagine non-Leonistas using Leo as the ultimate git diff/merge tool!

​There is an interesting lacuna in this statement.  I was forgetting that without a .leo file using Leo as a diff/merge tool implies using @auto to bring in the files to be compared/merged.

Wait a minute. The two imported versions won't have the same gnx's.  But the lack of comparable gnx's doesn't matter! It turns out that diff and @auto complement each other superbly, even though they know nothing of each other!

Indeed, @auto will break both files into pieces in a consistent way.  And usually, most pieces will be identical.  A simple hashing scheme will very quickly discover all identical nodes, which means that the O(N**2) diff code still gets applied to relatively small (and relatively few) chunks.

Do you see what this means?  It means that @auto is a breakthrough in diff and merge!  There is no way that meld, or any other text-based tool can do as well as Leo can do in comparing the logical structure of two versions of a source file.

Like I said, this is way to good to ignore...

EKR
Reply all
Reply to author
Forward
0 new messages