activate tags field
parent
3180dfeda0
commit
9337f04621
|
@ -29,7 +29,6 @@ EXCLUDED_FIELDS = (
|
||||||
NON_SQUASHABLE_FIELDS = (
|
NON_SQUASHABLE_FIELDS = (
|
||||||
'points',
|
'points',
|
||||||
'attachments',
|
'attachments',
|
||||||
'tags',
|
|
||||||
'watchers',
|
'watchers',
|
||||||
'description_diff',
|
'description_diff',
|
||||||
'content_diff',
|
'content_diff',
|
||||||
|
@ -49,9 +48,14 @@ def summary(field, entries):
|
||||||
if len(entries) <= 1:
|
if len(entries) <= 1:
|
||||||
return entries
|
return entries
|
||||||
|
|
||||||
|
# Apply squashing algorithm. In this case, get first `from` and last `to`.
|
||||||
initial = entries[0].values_diff[field]
|
initial = entries[0].values_diff[field]
|
||||||
final = entries[-1].values_diff[field]
|
final = entries[-1].values_diff[field]
|
||||||
from_, to = initial[0], final[1]
|
from_, to = initial[0], final[1]
|
||||||
|
|
||||||
|
# If the resulting squashed `from` and `to` are equal we can skip
|
||||||
|
# this entry completely
|
||||||
|
|
||||||
return [] if from_ == to else [HistoryEntry('', {field: [from_, to]})]
|
return [] if from_ == to else [HistoryEntry('', {field: [from_, to]})]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,3 +84,16 @@ def test_squash_values_diff_with_multiple_fields():
|
||||||
|
|
||||||
squashed = squashing.squash_history_entries(history_entries)
|
squashed = squashing.squash_history_entries(history_entries)
|
||||||
assert_(expected, squashed, ordered=False)
|
assert_(expected, squashed, ordered=False)
|
||||||
|
|
||||||
|
|
||||||
|
def test_squash_arrays():
|
||||||
|
history_entries = [
|
||||||
|
squashing.HistoryEntry(comment='', values_diff={'tags': [['A', 'B'], ['A']]}),
|
||||||
|
squashing.HistoryEntry(comment='', values_diff={'tags': [['A'], ['A', 'C']]}),
|
||||||
|
]
|
||||||
|
expected = [
|
||||||
|
squashing.HistoryEntry(comment='', values_diff={'tags': [['A', 'B'], ['A', 'C']]}),
|
||||||
|
]
|
||||||
|
|
||||||
|
squashed = squashing.squash_history_entries(history_entries)
|
||||||
|
assert_(expected, squashed, ordered=False)
|
||||||
|
|
Loading…
Reference in New Issue