[meld] Replace symlinks when explicitly copied



commit 9c9dee637d087c0c80a14a2658c16e10b19805be
Author: Jeff Oliver <kaiserfro gmail com>
Date:   Wed Sep 19 07:39:51 2012 +1000

    Replace symlinks when explicitly copied
    
    Previously, Meld would refuse to replace a file or link with a symlink,
    which was inconsistent with our copying of files. This patch changes
    behaviour so that symlinks are always copied across.

 meld/misc.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/meld/misc.py b/meld/misc.py
index f35bbc2..c1ce664 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -257,6 +257,8 @@ def copy2(src, dst):
         dst = os.path.join(dst, os.path.basename(src))
 
     if os.path.islink(src) and os.path.isfile(src):
+        if os.path.lexists(dst):
+            os.unlink(dst)
         os.symlink(os.readlink(src), dst)
     elif os.path.isfile(src):
         shutil.copyfile(src, dst)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]