-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Improve renamed_tree
method (Editor)
#21696
Conversation
Ah, but this PR does assume that |
Looking through the code more carefully, I see that this should never be the case. So it turns out that this patch is probably not needed, but it does no harm. In fact, assuming that def renamed_tree(self, source, dest):
"""Directory was renamed in file explorer or in project explorer."""
for fname in self.get_filenames():
if fname.startswith(source):
source_re = "^" + re.escape(source)
dest_quoted = dest.replace("\\", r"\\")
new_filename = re.sub(source_re, dest_quoted, fname)
self.renamed(source=fname, dest=new_filename) But I wouldn't suggest doing this, in case there are cases I've not spotted where this assumption is invalid. But if this patch is not applied, the test |
renamed_tree
on Windowsrenamed_tree
method on Windows (Editor)
renamed_tree
method on Windows (Editor)renamed_tree
method on Windows (Editor)
renamed_tree
method on Windows (Editor)renamed_tree
method (Editor)
@juliangilbey, could you merge with |
f373561
to
75477ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @juliangilbey!
Oh, I hadn't even had a chance to check if all the tests had passed!! Thanks for merging. |
Description of Changes
This follows the discussion in PR #21692 and fixes the issue identified there. Turns out that
count=1
is not needed as the regex is anchored to the start of the string.Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: @juliangilbey