The new git-diff command shows the diffs between any uncommitted work and git's HEAD in an outline. This is, by far, the best outline-oriented diff in Leo's history.
This command is safe to use. It does all behind-the-scenes work using hidden, temporary outlines (Commanders). This command creates copies of nodes, never clones. *Outline organization* This command creates a single tree as the last top-level node of the outline: - git diff # The *single *organizer node for the command - file A # The organizer node for file A. Body contains the text diff of the entire file. - Added # An organizer node for all added nodes, created only if necessary. - node 1 # A copy of the first added node. - node 2 # A copy of the second added node. ... - Deleted # An organizer node for all deleted nodes, created only if necessary. - node 1 # A copy of the first deleted node. ... - Changed # An organizer node for all changed nodes, created only if necessary. - node 1 # An organizer node for the changed node. Body contains the text diff of that node. - old: node1 # A copy of the old node. - new: node1 # A copy of the new node. This command creates text diffs node-by-node, using the nodes created in the hidden commanders. The command uses git only to *fetch* the two versions to be diffed. *This command does not use git diff in any way.* This means, for example, that moving a node affects only the overall diff in the organizer node for the file. *Moved nodes do not otherwise appear in the diff*. *Text diffs* Organizer nodes for files and changed nodes contain text diffs. Diffs look like this: @language patch --- HEAD +++ uncommitted @@ -553,8 +553,8 @@ c1 = self.make_outline(fn, s1, self.rev1) c2 = self.make_outline(fn, s2, self.rev2) assert c1 and c2 - for p in c1.all_positions(): - print('%25s %s' % (p.gnx, p.h)) + # for p in c1.all_positions(): + # print('%25s %s' % (p.gnx, p.h)) self.make_diff_outlines(fn, c1, c2) # try: # c.disable_redraw() @@ -578,6 +578,7 @@ ... @language python *Settings* leoSettings.leo contains new colorizer settings for @language patch: @settings-->Syntax coloring-->Language-specific colors-->patch *Still to do* 1. (Easy) The default is to diff uncommitted changes with HEAD. At present, the command does nothing if no such diffs exist. Instead, the command will diff the two previous commits as a fallback. 2. (Harder) This command only works for external files containing sentinels. The command will use the @clean algorithm to diff all other external files, provided they exist in the present outline. 3. (Maybe) It would be possible to create (safely) all added or changed nodes. *Theory of operation* For each diffed file, this command uses a variant of the atFile read logic to create the corresponding outline in a hidden commander. Separate hidden commanders contain the "before" and "after" versions of the file. These outlines *preserve* gnx's, so it is easy to create dicts of inserted, deleted and changed nodes. For changed nodes, the command uses difflib.Differ to create per-node diffs of body text. Similarly, the command uses difflib.Differ to create the text diff of the entire file. *Summary* I have already started to rely on the git-diff command to summarize what I have just done. Please try this command if you use git. 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 leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.