changeset 6258:c24f4b3f156b

Fix issue995 (copy --after and symlinks pointing to a directory) I haven't looked at other places that call os.path.isdir to make sure they're OK.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 14 Mar 2008 10:32:19 -0300
parents bfd49ce0db64
children f295206ae1f9
files mercurial/cmdutil.py tests/test-symlink-basic tests/test-symlink-basic.out
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Mar 14 09:56:58 2008 -0300
+++ b/mercurial/cmdutil.py	Fri Mar 14 10:32:19 2008 -0300
@@ -470,7 +470,7 @@
     if len(pats) == 1:
         raise util.Abort(_('no destination specified'))
     dest = pats.pop()
-    destdirexists = os.path.isdir(dest)
+    destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or util.patkind(pats[0], None)[0]:
             raise util.Abort(_('with multiple sources, destination must be an '
--- a/tests/test-symlink-basic	Fri Mar 14 09:56:58 2008 -0300
+++ b/tests/test-symlink-basic	Fri Mar 14 10:32:19 2008 -0300
@@ -38,3 +38,13 @@
 hg cp -v dangling dangling2
 hg st -Cmard
 $TESTDIR/readlink.py dangling dangling2
+
+echo '% issue995'
+hg up -C
+mkdir dir
+ln -s dir dirlink
+hg ci -qAm 'add dirlink'
+mkdir newdir
+mv dir newdir/dir
+mv dirlink newdir/dirlink
+hg mv -A dirlink newdir/dirlink
--- a/tests/test-symlink-basic.out	Fri Mar 14 09:56:58 2008 -0300
+++ b/tests/test-symlink-basic.out	Fri Mar 14 10:32:19 2008 -0300
@@ -27,3 +27,5 @@
   dangling
 dangling -> void
 dangling2 -> void
+% issue995
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved