diff mercurial/scmutil.py @ 35009:99ab7bc944d2 stable

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
author Mark Thomas <mbthomas@fb.com>
date Fri, 03 Nov 2017 09:27:36 -0700
parents 39b094e4ae2c
children 96dcc78468e3
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Nov 03 09:27:35 2017 -0700
+++ b/mercurial/scmutil.py	Fri Nov 03 09:27:36 2017 -0700
@@ -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)