[PATCH 1 of 2] largefiles: replace invocation of os.path module by vfs in overrides.py

liscju piotr.listkiewicz at gmail.com
Sat Mar 19 14:43:11 UTC 2016


# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1458395440 -3600
#      Sat Mar 19 14:50:40 2016 +0100
# Node ID ed35b14adb5caf1a8261d7021e2b00a2862fb896
# Parent  7d99ed52e3d5908a34e92d99094e613c3c30f050
largefiles: replace invocation of os.path module by vfs in overrides.py

This commit is part of bigger effort described in 'Windows UTF-8' plan.
It is not changing all invocations but the ones where change is
obviously correct and doesn't require complicated changes.

diff -r 7d99ed52e3d5 -r ed35b14adb5c hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Mon Mar 14 20:20:22 2016 +0100
+++ b/hgext/largefiles/overrides.py	Sat Mar 19 14:50:40 2016 +0100
@@ -603,7 +603,7 @@ def overridecopy(orig, ui, repo, pats, o
 
     def makestandin(relpath):
         path = pathutil.canonpath(repo.root, repo.getcwd(), relpath)
-        return os.path.join(repo.wjoin(lfutil.standin(path)))
+        return repo.wvfs.join(lfutil.standin(path))
 
     fullpats = scmutil.expandpats(pats)
     dest = fullpats[-1]
@@ -673,7 +673,7 @@ def overridecopy(orig, ui, repo, pats, o
                 dest.startswith(repo.wjoin(lfutil.shortname))):
                 srclfile = src.replace(repo.wjoin(lfutil.standin('')), '')
                 destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '')
-                destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.'
+                destlfiledir = repo.wvfs.dirname(repo.wjoin(destlfile)) or '.'
                 if not os.path.isdir(destlfiledir):
                     os.makedirs(destlfiledir)
                 if rename:
@@ -723,8 +723,8 @@ def overriderevert(orig, ui, repo, ctx, 
         for lfile in s.modified:
             lfutil.updatestandin(repo, lfutil.standin(lfile))
         for lfile in s.deleted:
-            if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
-                os.unlink(repo.wjoin(lfutil.standin(lfile)))
+            if (repo.wvfs.exists(lfutil.standin(lfile))):
+                repo.wvfs.unlink(lfutil.standin(lfile))
 
         oldstandins = lfutil.getstandinsstate(repo)
 
@@ -1366,7 +1366,7 @@ def mergeupdate(orig, repo, node, branch
         pctx = repo['.']
         for lfile in unsure + s.modified:
             lfileabs = repo.wvfs.join(lfile)
-            if not os.path.exists(lfileabs):
+            if not repo.wvfs.exists(lfileabs):
                 continue
             lfhash = lfutil.hashrepofile(repo, lfile)
             standin = lfutil.standin(lfile)


More information about the Mercurial-devel mailing list