changeset 35052:36507048da0f

merge with stable
author Augie Fackler <augie@google.com>
date Fri, 10 Nov 2017 17:12:04 -0500
parents d80380ba8e7d (current diff) 99ab7bc944d2 (diff)
children be6aa0cff8ea
files
diffstat 2 files changed, 25 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Wed Nov 08 18:24:43 2017 -0800
+++ b/mercurial/scmutil.py	Fri Nov 10 17:12:04 2017 -0500
@@ -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)
--- a/tests/test-origbackup-conflict.t	Wed Nov 08 18:24:43 2017 -0800
+++ b/tests/test-origbackup-conflict.t	Fri Nov 10 17:12:04 2017 -0500
@@ -12,11 +12,12 @@
   $ hg add base
   $ hg commit -m "base"
 
-Make a dir named b that contains a file
+Make a dir named b that contains a file, and a file named d
 
   $ mkdir -p b
   $ echo c1 > b/c
-  $ hg add b/c
+  $ echo d1 > d
+  $ hg add b/c d
   $ hg commit -m "c1"
   $ hg bookmark c1
 
@@ -30,15 +31,17 @@
   b/c: replacing untracked file
   getting b/c
   creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting d
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
   $ test -f .hg/origbackups/b/c
 
-Make a file named b
+Make files named b and d
 
   $ hg up -q 0
   $ echo b1 > b
-  $ hg add b
+  $ echo d2 > d
+  $ hg add b d
   $ hg commit -m b1
   created new head
   $ hg bookmark b1
@@ -52,7 +55,8 @@
   b: replacing untracked file
   getting b
   removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting d
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark b1)
   $ test -f .hg/origbackups/b
 
@@ -67,43 +71,51 @@
   getting b/c
   creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
   removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting d
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark c1)
   $ test -d .hg/origbackups/b
 
-Cause a symlink to be backed up that points to a valid location from the backup dir
+Cause two symlinks to be backed up that points to a valid location from the backup dir
 
   $ hg up -q 0
   $ mkdir ../sym-link-target
 #if symlink
   $ ln -s ../../../sym-link-target b
+  $ ln -s ../../../sym-link-target d
 #else
-  $ touch b
+  $ touch b d
 #endif
   $ hg up b1
   b: replacing untracked file
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  d: replacing untracked file
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark b1)
 #if symlink
   $ readlink.py .hg/origbackups/b
   .hg/origbackups/b -> ../../../sym-link-target
 #endif
 
-Perform an update that causes b/c to be backed up again - it should not go into the target dir
+Perform an update that causes b/c and d to be backed up again - b/c should not go into the target dir
 
   $ hg up -q 0
   $ mkdir b
   $ echo c4 > b/c
+  $ echo d3 > d
   $ hg up --verbose c1
   resolving manifests
   b/c: replacing untracked file
+  d: replacing untracked file
   getting b/c
   creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
   removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting d
+  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