-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Diff support expansion and refactoring
Expanded existing diff support, and refactored the code to support additional use cases and improve safety. The entire commit history is provided, but in summary: - Split compare_cfgs() into smaller bits. Now a diff on individual stanzas is supported using the compare_stanzas() function. - Expand diff header support. It's now possible to further manipulate headers, primarily this is used for setting the modification time for non-file objects. - Add new TermColor helper to provide context manager support around ANSI color manipulation on the terminal. This reduces the likelihood of bad TTY state. - Added helper functions: reduce_stanza() and is_equal() Squashed commit of the following: commit 37f15f20c5bafecac303c72b25d7615b755bbff3 Author: Lowell Alleman <lowell@kintyre.co> Date: Mon Feb 25 19:45:11 2019 -0500 Refactor compare_stanza() into private and public parts - Split compare_stanzas() into 2 parts. 1 Part is private and used by the public version and by compare_cfgs(). The public interface now returns a list, not an iterable. commit 5a0ec24287a08ad5e2ce7ccfda828aad90815f80 Author: Lowell Alleman <lowell@kintyre.co> Date: Fri Feb 22 18:44:03 2019 -0500 Add new TermColor helper Created a new context-managing class as a replacement for the simple tty_color() function. I ran into an issue in the field where and unhandled exception in the diff library (surely caused by something external) left the terminal in a hard-to-read color. And that should just never happen. This context manager should keep this from being an issue. Written at 2AM after a 6 hour client working session. So, do more testing. commit 51866ea3d9e36331cd3d67440586a379f5acf233 Author: Lowell Alleman <lowell@kintyre.co> Date: Mon Feb 25 16:06:24 2019 -0500 Fixed diff logic and tests - Fixed issues with diff core - Added 2 new unit tests since the last break went undetected by all automated testing. ;-( commit 426a2343e96dd1b67965db9a1f2a55637e6f9a56 Author: Lowell Alleman <lowell@kintyre.co> Date: Mon Feb 25 19:42:52 2019 -0500 Expand diff helper functions - Created new shared functions: - reduce_stanza(): To filtered down two stanzas to a list of keys - is_equal(): Simple boolean test find identical stanzas/configs. commit 0dbfcbcfcad0a0dc19b85434a087ae65fa3dc300 Author: Lowell Alleman <lowell@kintyre.co> Date: Fri Feb 22 01:55:48 2019 -0500 Expand compare_stanza() algorithm - Updated the break down between compare_cfgs() and compare_stanzas() so that stanza-level changes, such as an added or removed stanza, can be detected by compare_stanzas() directly. commit ccae564e21a6b9fae21e770ad6e2ce69a7556ac9 Author: Lowell Alleman <lowell@kintyre.co> Date: Tue Feb 19 15:21:59 2019 -0500 Expand diff header support - Revamp support for diff headers (first 2 lines showing which files are being compared). Now these can be explicitly given a timestamp. commit b8e2f667d6018b86a2b6b5ae3144b11a36ffb66d Author: Lowell Alleman <lowell@kintyre.co> Date: Mon Feb 25 19:36:01 2019 -0500 Refactor compare_cfg() into smaller bits - Refactor config comparisons into smaller bits. Now individual stanzas can be compared using the compare_stanza() function, previously only a set of stanzas could be compared. - Created boolean munging function. (To eventually should support comparing booleans in a type-aware way)
- Loading branch information
Showing
3 changed files
with
179 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters