This is an archive of the discontinued Mercurial Phabricator instance.

scmutil: handle conflicting files and dirs in origbackuppath
AbandonedPublic

Authored by mbthomas on Sep 11 2017, 11:55 AM.

Details

Reviewers
ryanmce
durham
Group Reviewers
hg-reviewers
Summary

When ui.origbackuppath is set, .orig files are stored outside of the working
copy. However conflicts can occur when files or directories end up having the
same name. These conflicts cause Mercurial to abort, even if they've been
created as a result of different sets of backup.

This is made worse by the .orig suffix that is appended to file names as they
are backed up. A file named x can conflict with a directory named x.orig from
a different backup, or perhaps even the same backup.

This change removes the .orig suffix from files stored in an out-of-tree
origbackuppath, and deals with the case where files and directories replace
each other in the backup directory.

Test Plan

Re-run unit tests. Add new unit test for conflicting paths.

Diff Detail

Repository
rHG Mercurial
Branch
dirfixes (bookmark) on default (branch)
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

mbthomas created this revision.Sep 11 2017, 11:55 AM
durham accepted this revision.Sep 11 2017, 12:26 PM
ryanmce requested changes to this revision.Sep 11 2017, 12:35 PM

I think this will be a bit easier to ingest as two patches: one to deal with the conflicting directories and one to remove the .orig from files with a custom destination.

This is a relatively new feature so I don't think we need a config option to maintain BC about these file names, and I'd argue the current behavior is a bug so I think it's good to change. That being said, a origsuffix config might be a way to please everyone if there's any pushback on this front.

This revision now requires changes to proceed.Sep 11 2017, 12:35 PM
mbthomas abandoned this revision.Sep 11 2017, 2:04 PM

As suggested by @ryanmce I have split this into D679 and D680.