changeset 12344:b6173aee4a47 stable

Use lexists() instead of exists() where appropriate
author Patrick Mezard <pmezard@gmail.com>
date Mon, 20 Sep 2010 21:46:56 +0200
parents 28642f7fc2cf
children e0ee3e822a9a 5be733b20bd1
files hgext/convert/gnuarch.py hgext/mq.py mercurial/context.py mercurial/dirstate.py mercurial/patch.py mercurial/util.py
diffstat 6 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/gnuarch.py	Mon Sep 20 21:46:39 2010 +0200
+++ b/hgext/convert/gnuarch.py	Mon Sep 20 21:46:56 2010 +0200
@@ -138,7 +138,7 @@
             raise util.Abort(_('internal calling inconsistency'))
 
         # Raise IOError if necessary (i.e. deleted files).
-        if not os.path.exists(os.path.join(self.tmppath, name)):
+        if not os.path.lexists(os.path.join(self.tmppath, name)):
             raise IOError
 
         return self._getfile(name, rev)
--- a/hgext/mq.py	Mon Sep 20 21:46:39 2010 +0200
+++ b/hgext/mq.py	Mon Sep 20 21:46:56 2010 +0200
@@ -674,7 +674,7 @@
                 removed = []
                 merged = []
                 for f in files:
-                    if os.path.exists(repo.wjoin(f)):
+                    if os.path.lexists(repo.wjoin(f)):
                         merged.append(f)
                     else:
                         removed.append(f)
--- a/mercurial/context.py	Mon Sep 20 21:46:39 2010 +0200
+++ b/mercurial/context.py	Mon Sep 20 21:46:56 2010 +0200
@@ -824,7 +824,7 @@
         wlock = self._repo.wlock()
         try:
             for f in list:
-                if unlink and os.path.exists(self._repo.wjoin(f)):
+                if unlink and os.path.lexists(self._repo.wjoin(f)):
                     self._repo.ui.warn(_("%s still exists!\n") % f)
                 elif self._repo.dirstate[f] == 'a':
                     self._repo.dirstate.forget(f)
@@ -852,7 +852,7 @@
 
     def copy(self, source, dest):
         p = self._repo.wjoin(dest)
-        if not (os.path.exists(p) or os.path.islink(p)):
+        if not os.path.lexists(p):
             self._repo.ui.warn(_("%s does not exist!\n") % dest)
         elif not (os.path.isfile(p) or os.path.islink(p)):
             self._repo.ui.warn(_("copy failed: %s is not a file or a "
--- a/mercurial/dirstate.py	Mon Sep 20 21:46:39 2010 +0200
+++ b/mercurial/dirstate.py	Mon Sep 20 21:46:56 2010 +0200
@@ -362,7 +362,7 @@
         norm_path = os.path.normcase(path)
         fold_path = self._foldmap.get(norm_path, None)
         if fold_path is None:
-            if knownpath or not os.path.exists(os.path.join(self._root, path)):
+            if knownpath or not os.path.lexists(os.path.join(self._root, path)):
                 fold_path = path
             else:
                 fold_path = self._foldmap.setdefault(norm_path,
--- a/mercurial/patch.py	Mon Sep 20 21:46:39 2010 +0200
+++ b/mercurial/patch.py	Mon Sep 20 21:46:56 2010 +0200
@@ -1230,7 +1230,7 @@
             islink, isexec = gp.mode
             dst = repo.wjoin(gp.path)
             # patch won't create empty files
-            if gp.op == 'ADD' and not os.path.exists(dst):
+            if gp.op == 'ADD' and not os.path.lexists(dst):
                 flags = (isexec and 'x' or '') + (islink and 'l' or '')
                 repo.wwrite(gp.path, '', flags)
             util.set_flags(dst, islink, isexec)
--- a/mercurial/util.py	Mon Sep 20 21:46:39 2010 +0200
+++ b/mercurial/util.py	Mon Sep 20 21:46:56 2010 +0200
@@ -642,7 +642,7 @@
             l = l + 1
         name = name[l:]
 
-    if not os.path.exists(os.path.join(root, name)):
+    if not os.path.lexists(os.path.join(root, name)):
         return None
 
     seps = os.sep