mirror of
https://github.com/HelloZeroNet/ZeroNet.git
synced 2023-12-14 04:33:03 +01:00
Fix diffing
This commit is contained in:
parent
b114c52c0d
commit
8edbecce3c
1 changed files with 4 additions and 0 deletions
|
@ -33,6 +33,8 @@ def diff(old, new, limit=False):
|
||||||
def patch(old_f, actions):
|
def patch(old_f, actions):
|
||||||
new_f = io.BytesIO()
|
new_f = io.BytesIO()
|
||||||
for action, param in actions:
|
for action, param in actions:
|
||||||
|
if type(action) is bytes:
|
||||||
|
action = action.decode()
|
||||||
if action == "=": # Same lines
|
if action == "=": # Same lines
|
||||||
new_f.write(old_f.read(param))
|
new_f.write(old_f.read(param))
|
||||||
elif action == "-": # Delete lines
|
elif action == "-": # Delete lines
|
||||||
|
@ -41,4 +43,6 @@ def patch(old_f, actions):
|
||||||
elif action == "+": # Add lines
|
elif action == "+": # Add lines
|
||||||
for add_line in param:
|
for add_line in param:
|
||||||
new_f.write(add_line)
|
new_f.write(add_line)
|
||||||
|
else:
|
||||||
|
raise "Unknown action: %s" % action
|
||||||
return new_f
|
return new_f
|
||||||
|
|
Loading…
Reference in a new issue