Skip to content

Commit

Permalink
Restore and rebuild should not break after a merge. Fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazza committed Aug 21, 2017
1 parent dbd967a commit 62469d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
19 changes: 11 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,17 @@ def interpret(cmd, arguments, parts, shorthands, outdir):
return
print 'Merging partitions...'
utils.merge(part1, part2)
position = int(arguments[1])
_, par = shorthands[position]
del shorthands[position]
del parts[par]
try:
rebuilt.remove(par)
except:
pass
source_position = int(arguments[1])
destination_position = int(arguments[0])
_, par_source = shorthands[source_position]
_, par_destination = shorthands[destination_position]
del shorthands[source_position]
del parts[par_source]
for par in (par_source, par_destination):
try:
rebuilt.remove(par)
except:
pass
print 'There are now %d partitions.' % (len(parts), )
elif cmd == 'recoverable':
list_parts(parts, shorthands, lambda x: x.recoverable)
Expand Down
3 changes: 3 additions & 0 deletions recuperabit/fs/core_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def add_child(self, node):
"""Add a new child to this directory."""
original_name = node.name
i = 0
# Check for multiple rebuilds
if node in self.children:
return
# Avoid name clashes
while node.name in self.children_names:
node.name = original_name + '_%03d' % i
Expand Down

0 comments on commit 62469d0

Please sign in to comment.