D680: scmutil: handle conflicting files and dirs in origbackuppath

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Wed Sep 13 10:54:31 EDT 2017


yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> scmutil.py:570
> +        # Remove any files that conflict with the backup file's path
> +        for f in util.finddirs(fullorigpath):
> +            if repo.vfs.exists(f):

Perhaps fullorigpath may be a Windows path, but util.finddirs()
can only handle internal path.

> scmutil.py:574
> +                    ui.note(_('removing conflicting file: %s\n') % f)
> +                    repo.vfs.unlink(f)
> +                break

It shouldn't delete files out of the origbackuppath directory
even if the configured path points to (or under) a file.

Maybe we could use a new vfs dedicated to backup directory to
audit operations.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D680

To: mbthomas, ryanmce, #hg-reviewers, durham, yuja
Cc: yuja, durham, mercurial-devel


More information about the Mercurial-devel mailing list