# HG changeset patch # User Alexis S. L. Carvalho # Date 1174704025 10800 # Node ID 81402b2b294de1d7419cbe6662bd8080278545de # Parent af4f0d52f94834be76286654aa703599e49d4a2f use os.path.islink instead of util.is_link; remove util.is_link diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -122,11 +122,6 @@ class localrepository(repo.repository): self.filterpats = {} self.transhandle = None - self._link = lambda x: False - if util.checklink(self.root): - r = self.root # avoid circular reference in lambda - self._link = lambda x: util.is_link(os.path.join(r, x)) - self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root) def url(self): @@ -525,6 +520,9 @@ class localrepository(repo.repository): def wfile(self, f, mode='r'): return self.wopener(f, mode) + def _link(self, f): + return os.path.islink(self.wjoin(f)) + def _filter(self, filter, filename, data): if filter not in self.filterpats: l = [] diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -792,7 +792,7 @@ def checklink(path): def linkfunc(path, fallback): '''return an is_link() function with default to fallback''' if checklink(path): - return lambda x: is_link(os.path.join(path, x)) + return lambda x: os.path.islink(os.path.join(path, x)) return fallback # Platform specific variants @@ -968,10 +968,6 @@ else: else: os.chmod(f, s & 0666) - def is_link(f): - """check whether a file is a symlink""" - return (os.lstat(f).st_mode & 0120000 == 0120000) - def set_link(f, mode): """make a file a symbolic link/regular file @@ -979,7 +975,7 @@ else: if a link is changed to a file, its link data become its contents """ - m = is_link(f) + m = os.path.islink(f) if m == bool(mode): return