Skip to content

Log warnings when rename collisions occur (numeric suffix added) #44

@jlevy

Description

@jlevy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions