Option to move restored data to origins.#11
Open
karitra wants to merge 6 commits into
Open
Conversation
1 task
karitra
force-pushed
the
pr/move_to_source
branch
7 times, most recently
from
July 2, 2019 18:39
bb64c44 to
857f75b
Compare
karitra
force-pushed
the
pr/move_to_source
branch
from
July 2, 2019 18:58
857f75b to
1ca3cdb
Compare
shaitan
requested changes
Jul 3, 2019
| @staticmethod | ||
| def move_back(from_index, to_index): | ||
| """Move underlying file(s) between specified pathes.""" | ||
| if not to_index.endswith(SORTED_INDEX_SUFFIX): |
Collaborator
There was a problem hiding this comment.
if from_index.endswith(SORTED_INDEX_SUFFIX) == to_index.endswith(SORTED_INDEX_SUFFIX):
shutil.move(src=from_index, dst=to_index)
else:
temporary_name = to_index + TO_REMOVE_SUFFIX
shutil.move(src=to_index, dst=temporary_name)
shutil.move(src=from_index, dst=to_index)| self._file.close() | ||
|
|
||
| @staticmethod | ||
| def move_back(from_index, to_index): |
Collaborator
There was a problem hiding this comment.
Why isn't it just a method of IndexFile:
def move(self, path):
shutil.move(self.path, path)
Contributor
Author
There was a problem hiding this comment.
It was implemented likewise in first version of this PR, but it seems a violation of class api, as 'user' can freely call move for entity in wrong state, e.g. before any file was closed or written. It could be combined close_and_move method here, but it looks more rigid then current version.
Collaborator
There was a problem hiding this comment.
It could be made via close, move, re-open
Collaborator
There was a problem hiding this comment.
Also it could be made without close and re-open within one filesystem via os.rename().
karitra
force-pushed
the
pr/move_to_source
branch
3 times, most recently
from
July 3, 2019 19:45
4f03d3b to
ab3ca41
Compare
Contributor
Author
|
Updated, based on review. @shaitan, PTAL. |
karitra
force-pushed
the
pr/move_to_source
branch
from
July 5, 2019 10:22
132a529 to
0d9e2b1
Compare
karitra
force-pushed
the
pr/move_to_source
branch
from
August 9, 2019 15:54
0d9e2b1 to
81e86a9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO: