Summary
When a file rename would clobber an existing file, move_file() silently adds numeric suffixes (.1, .2, etc.) to avoid the collision. No log message is emitted, so users have no visibility into this happening.
Details
In repren.py, the move_file() function (line 767) handles collisions by incrementing a numeric suffix, but the caller (transform_file) doesn't log when this happens. There is a TODO at line 1637 acknowledging this: # Log collisions.
This can be confusing when a user runs repren and the output file has an unexpected .1 suffix with no explanation.
Suggestion
Add a log message when a collision is detected and a numeric suffix is applied, e.g.:
- collision: target 'foo.txt' already exists, writing to 'foo.txt.1'
This is especially important in --full mode where multiple renames could collide.
Summary
When a file rename would clobber an existing file,
move_file()silently adds numeric suffixes (.1,.2, etc.) to avoid the collision. No log message is emitted, so users have no visibility into this happening.Details
In
repren.py, themove_file()function (line 767) handles collisions by incrementing a numeric suffix, but the caller (transform_file) doesn't log when this happens. There is a TODO at line 1637 acknowledging this:# Log collisions.This can be confusing when a user runs repren and the output file has an unexpected
.1suffix with no explanation.Suggestion
Add a log message when a collision is detected and a numeric suffix is applied, e.g.:
This is especially important in
--fullmode where multiple renames could collide.