Skip to content

Commit

Permalink
Restore old formatting in zodbsync.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiseqube committed Oct 25, 2023
1 parent 16911dd commit 987c71c
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions perfact/zodbsync/zodbsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,46 +691,44 @@ def playback_paths(self, paths, recurse=True, override=False,
self.num_obj_current = 0
self.num_obj_total = len(paths)

note = 'zodbsync/'
if len('paths') == 1:
note = 'zodbsync'
if len(paths) == 1:
note += ': ' + paths[0]
txn_mgr = self.start_transaction(note=note)

# Stack of paths that are to be played back (reversed
# alphabetical order, we pop elements from the top)
# Stack of paths that are to be played back (reversed alphabetical
# order, we pop elements from the top)
self.playback_todo = []
todo = self.playback_todo # local alias

# Stack of paths for which we need to fix the order after
# everything below that path has been handled.
# Stack of paths for which we need to fix the order after everything
# below that path has been handled.
self.playback_fixorder = []
fixorder = self.playback_fixorder # local alias

# Cached read metadata for paths that are in fixorder so we
# don't need to read it again from disk.
self.fs_data = {}

# Reverse order, ensure that paths end in '/' so startswith can be
# used reliably and remove elements that are to be deleted in that
# reverse order so properties of their parents can take their
# place
# Reverse order, ensure that paths end in '/' so startswith can be used
# reliably and remove elements that are to be deleted in that reverse
# order so properties of their parents can take their place
for path in reversed(paths):
if not os.path.isdir(self.fs_path(path)):
# Call it immediately, it will read None from the FS and
# remove the object
# Call it immediately, it will read None from the FS and remove
# the object
self._playback_path(path)
else:
todo.append(path)

# Iterate until both stacks are empty. Whenever the topmost element
# in todo is no longer a subelement of the topmost element of
# fixorder, we handle the fixorder element, otherwise we handle the
# todo element.
# Iterate until both stacks are empty. Whenever the topmost element in
# todo is no longer a subelement of the topmost element of fixorder, we
# handle the fixorder element, otherwise we handle the todo element.
try:
while todo or fixorder:
if fixorder:
# Handle next object on which to fix order unless
# there are still subpaths to be handled
# Handle next object on which to fix order unless there are
# still subpaths to be handled
path = fixorder[-1]
if not (todo and todo[-1].startswith(path)):
self._playback_fixorder(fixorder.pop())
Expand Down

0 comments on commit 987c71c

Please sign in to comment.