Edward,

On Mon, Aug 12, 2019 at 11:13 AM Edward K. Ream <[email protected]> wrote:

> On Monday, August 12, 2019 at 9:59:05 AM UTC-5, Edward K. Ream wrote:
>
[...]

> 1. We can now see clearly we must import *all* of pyzo's code into Leo.
> Exactly where doesn't matter. We can't adapt pyzo to Leo in any other way.
> This is a significant commitment for future devs.  Imo, it's probably worth
> doing, but we should confront the costs, particularly...
>
> 2. Comments of the form #EKR:change-(why)mark all significant changes. In
> future, if we want to take advantage of updates to pyzo, we would have to
> retro-fit those EKR changes back into the updated copy of pyzo's sources.
> This would likely take only a few hours.  The alternatives would be much
> worse.  Experience shows that we shouldn't even think about monkey-patches.
>

3 observations

   1. IMO, at a bare minimum, you should always first check in the pyzo
   code without any of your changes and only then add your changes. The EKR
   comments are probably very helpful to you, but that should done in addition
   to, not instead of the git tracking of your changes. Let git be the
   authoritative bookkeeper of changes...it is pretty good at that. Again,
   this is just my opinion.
   2. Git has a very useful subcommand called 'subtree' which can be used
   to track another repository as a subdirectory of your own repository.
   Details below.
   3. This is premature at this point, but can some/most/all the changes
   you make be generalized such that they are not leo specific? IOW, all they
   do is help make pyzo more embeddable into *any* python project, not just
   Leo? If the answer is yes, then you could open a pull request in upstream
   pyzo. If the changes get accepted, then that's less work on the Leo side
   going forward.

You can read about the subtree module at
https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree
.

The first time you bring the source in, the command would be something like:

git subtree *add* --prefix leo/plugins/pyzo <pyzo git url> <pyzo branch>
--squash


Then later when you want to pull more recent code from pyzo you would run a
command like this:

git subtree *pull* --prefix leo/plugins/pyzo <pyzo git url> <pyzo branch>
--squash


git takes care of all the bookkeeping of mapping the file path prefix
(leo/plugins/pyzo) and you will have the opportunity to resolve conflicts
(if any) just like a normal git merge.

I've used this git feature lightly before and overall found it to be more
help than pain.

Brian

-- 
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/CAO5X8CwcCoU%3DUj7y5iXn2BpLsDut11EEU-ioJ7iwEGt93zSRCw%40mail.gmail.com.

Reply via email to