yougov / velociraptor

BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

swarm config diffs contains ¶ character at the end of each line #217

Closed amateja closed 7 years ago

amateja commented 7 years ago

In each swarm in Versions tab in Diff column are ¶ chars at the end of each line of config_yaml row. Could you have a look on that to see if it's an error or not?

lbolla commented 7 years ago

It's just the "newline" symbol used by "django-reversion's generate_patch_html" function that we use to generate a pretty diff of the changes.

amateja commented 7 years ago

It's not exactly "newline" symbol and diff should show differences between two configs where none of those contains such symbol. Kinda misleading.

lbolla commented 7 years ago

The HTML symbol "¶" is what's used by Google's diff_match_patch library (itself used by Django's reversion) to pretty-print a newline in HTML. See https://bitbucket.org/spookylukey/diff-match-patch/src/89225550f1af82beaa1278926305054170f6c6c5/python2/diff_match_patch/diff_match_patch.py?at=default&fileviewer=file-view-default#diff_match_patch.py-1073

So, the diff is highlighting all characters that are different in the 2 sets and it seems like the newline is one of them. We could use the usual diff format, rather then its pretty-printed HTML representation, but it's more verbose.