# HG changeset patch # User FUJIWARA Katsunori # Date 1381765864 -32400 # Node ID 7c21e3398931acaebb200622f5385d1dea1351b1 # Parent 8c3dcbbfb5deaa2385e5166542a5c8a6fbd6df81 context: use "vfs.lstat()" instead of "os.lstat()" This patch also changes paths added to "rejected" list from full path (referred by "p") to relative one (referred by "f"), when type of target path is neither file nor symlink. This change should be reasonable, because the path added to "rejected" list is relative one, when "OSError" is raised at "lstat()". diff -r 8c3dcbbfb5de -r 7c21e3398931 mercurial/context.py --- a/mercurial/context.py Tue Oct 15 00:51:04 2013 +0900 +++ b/mercurial/context.py Tue Oct 15 00:51:04 2013 +0900 @@ -1111,11 +1111,11 @@ ui, ds = self._repo.ui, self._repo.dirstate try: rejected = [] + lstat = self._repo.wvfs.lstat for f in list: scmutil.checkportable(ui, join(f)) - p = self._repo.wjoin(f) try: - st = os.lstat(p) + st = lstat(f) except OSError: ui.warn(_("%s does not exist!\n") % join(f)) rejected.append(f) @@ -1129,7 +1129,7 @@ if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): ui.warn(_("%s not added: only files and symlinks " "supported currently\n") % join(f)) - rejected.append(p) + rejected.append(f) elif ds[f] in 'amn': ui.warn(_("%s already tracked!\n") % join(f)) elif ds[f] == 'r': diff -r 8c3dcbbfb5de -r 7c21e3398931 mercurial/scmutil.py --- a/mercurial/scmutil.py Tue Oct 15 00:51:04 2013 +0900 +++ b/mercurial/scmutil.py Tue Oct 15 00:51:04 2013 +0900 @@ -254,6 +254,9 @@ def islink(self, path=None): return os.path.islink(self.join(path)) + def lstat(self, path=None): + return os.lstat(self.join(path)) + def makedir(self, path=None, notindexed=True): return util.makedir(self.join(path), notindexed)