Skip to content
Snippets Groups Projects
Commit 99ab7bc944d2 authored by Mark Thomas's avatar Mark Thomas
Browse files

scmutil: don't try to delete origbackup symlinks to directories (issue5731)

When origbackuppath is set, when looking to see if a file we are backing up
conflicts with a directory in the origbackuppath, we incorrectly match on
symlinks to directories.  This means we try to call vfs.rmtree on the
symlink, which fails.

Differential Revision: https://phab.mercurial-scm.org/D1311
parent ad671b4cb9fc
No related branches found
No related tags found
No related merge requests found
......@@ -610,7 +610,7 @@
origvfs.makedirs(origbackupdir)
if origvfs.isdir(filepathfromroot):
if origvfs.isdir(filepathfromroot) and not origvfs.islink(filepathfromroot):
ui.note(_('removing conflicting directory: %s\n')
% origvfs.join(filepathfromroot))
origvfs.rmtree(filepathfromroot, forcibly=True)
......
......@@ -110,15 +110,7 @@
creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
getting d
removing conflicting directory: $TESTTMP/repo/.hg/origbackups/d (glob)
abort: None
[255]
Workaround issue by deleting d:
$ rm d
$ hg up c1
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark c1)
$ cat .hg/origbackups/b/c
c4
......@@ -121,7 +113,9 @@
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark c1)
$ cat .hg/origbackups/b/c
c4
$ cat .hg/origbackups/d
d3
$ ls ../sym-link-target
Incorrectly configure origbackuppath to be under a file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment