[PATCH] subrepo: convert the os.path references in git to vfs
Matt Harbison
mharbison72 at gmail.com
Fri Apr 10 01:21:11 UTC 2015
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1423331860 18000
# Sat Feb 07 12:57:40 2015 -0500
# Node ID 7b26d433ab78988a19cadcead645196999b59568
# Parent e0e28e910fa3797fd0aa4f818e9b33c5bcbf0e53
subrepo: convert the os.path references in git to vfs
There are a handful of os.path references in the free functions at the top of
the module that will be trickier to remove.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1300,7 +1300,7 @@
return retdata, p.returncode
def _gitmissing(self):
- return not os.path.exists(os.path.join(self._abspath, '.git'))
+ return not self.wvfs.exists('.git')
def _gitstate(self):
return self._gitcommand(['rev-parse', 'HEAD'])
@@ -1632,14 +1632,13 @@
# local-only history
self.ui.note(_('removing subrepo %s\n') % self._relpath)
self._gitcommand(['config', 'core.bare', 'true'])
- for f in os.listdir(self._abspath):
+ for f in self.wvfs.listdir():
if f == '.git':
continue
- path = os.path.join(self._abspath, f)
- if os.path.isdir(path) and not os.path.islink(path):
- shutil.rmtree(path)
+ if self.wvfs.isdir(f) and not self.wvfs.islink(f):
+ shutil.rmtree(self.wvfs.join(f))
else:
- os.remove(path)
+ self.wvfs.unlink(f)
def archive(self, archiver, prefix, match=None):
total = 0
@@ -1815,8 +1814,7 @@
bakname = "%s.orig" % name
self.ui.note(_('saving current version of %s as %s\n') %
(name, bakname))
- util.rename(os.path.join(self._abspath, name),
- os.path.join(self._abspath, bakname))
+ self.wvfs.rename(name, bakname)
if not opts.get('dry_run'):
self.get(substate, overwrite=True)
More information about the Mercurial-devel
mailing list