Thanks, this looks like just the right thing.

On Tuesday, May 28, 2024 at 11:14:07 AM UTC-4 Edward K. Ream wrote:

> On Tue, May 28, 2024 at 9:38 AM Thomas Passin <[email protected]> wrote:
>
>> Sometimes I want to diff a specific external file between two git 
>> branches.  They might be the currently checked out version and some other, 
>> or even between two different but not checked out commit hashes.
>>
>> Can I do this using the existing Leo commands?
>>
>
> No, but LeoPyRef.leo contains two scripts that you can use:
>
> *script: diff-branches/revs (all files)*
>
> from leo.commands import editFileCommands as efc
>
> efc.GitDiffController(c).diff_two_revs(
>     rev1='ekr-3744-pr3-token-based-orange',  # Old
>     rev2='tbo-test',   # New
> )
>
> *script: diff-branches/revs (one file)*
>
> g.cls()
> import os
> import leo.commands.editFileCommands as efc
> path = g.finalize_join(g.app.loadDir, '..', '..')
> os.chdir(path)
>
> # Any revspec is valid as an argument to the "branch1" and "branch2" args.
> # See https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection
>
> efc.GitDiffController(c).diff_two_branches(
>     branch1='97282792e', # old branch/rev
>     branch2='fd7537f5c', # new branch/rev
>     fn='leo/plugins/viewrendered.py',  # Don't use backslashes.
>
> They aren't commands because you have to fill data.  I have used both from 
> time to time.
>
> HTH. Please let me know if you have questions.
>
> Edward
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/e03de8d9-a6d8-48a8-bb1a-a8469da94c17n%40googlegroups.com.

Reply via email to