Issue 23791: Identify Moved Lines with difflib (original) (raw)

Issue23791

Created on 2015-03-27 16:25 by bkiefer, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
python_diff_move.zip bkiefer,2015-03-31 00:15 Basic tests to impliment difflib move feature
Messages (2)
msg239416 - (view) Author: Brian (bkiefer) Date: 2015-03-27 16:25
It would be a helpful feature to incorporate logic into the difflib module to optionally identify and ignore identical, but relocated lines when doing a diff. This would be used when the order of lines in a document is not critical, but rather just the overall content. The Notepad++ Compare plug-in has this feature for reference. I would be willing to help submit a patch for this change. The only drawbacks I see using this function is it will either have to increase processing time or increase memory usage.
msg239649 - (view) Author: Brian (bkiefer) Date: 2015-03-31 00:15
I have put together 5 basic tests to implement moved lines in difflib. All diffs should be compared against the 'diffmove_base.txt' file. Below is a short description of each test. 1) Basic reordering of lines 2) Reordering of lines with new lines added 3) Reordering of lines with one line removed 4) Reordering of lines with one character omitted from a line and character added to another line 5) Combination of all previous tests
History
Date User Action Args
2022-04-11 14:58:14 admin set github: 67979
2015-04-03 20:16:31 terry.reedy set nosy: + terry.reedy
2015-03-31 00:15:49 bkiefer set files: + python_diff_move.zipmessages: +
2015-03-27 21:34:21 terry.reedy set stage: test neededversions: - Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.6
2015-03-27 16:25:20 bkiefer create