# HG changeset patch # User FUJIWARA Katsunori # Date 2015-04-11 14:00:04 # Node ID 747748766421a7a19b82028eaa428d1f2884a4a1 # Parent ee751d47cf2ca09b37284db091dd59b8296c8f3f subrepo: use vfs.walk instead of os.walk "dirpath" in the tuple yielded by "vfs.walk()" is relative one from the root of specified vfs, and absolute path in the warning message is composed by "vfs.join()". On the other hand, target file "f" exists in "dirpath", and "reljoin()" is needed to unlink "f" by "vfs.unlink()". diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -303,7 +303,7 @@ def _abssource(repo, push=False, abort=T raise util.Abort(_("default path for subrepository not found")) def _sanitize(ui, vfs, ignore): - for dirname, dirs, names in os.walk(vfs.base): + for dirname, dirs, names in vfs.walk(): for i, d in enumerate(dirs): if d.lower() == ignore: del dirs[i] @@ -313,8 +313,8 @@ def _sanitize(ui, vfs, ignore): for f in names: if f.lower() == 'hgrc': ui.warn(_("warning: removing potentially hostile 'hgrc' " - "in '%s'\n") % dirname) - os.unlink(os.path.join(dirname, f)) + "in '%s'\n") % vfs.join(dirname)) + vfs.unlink(vfs.reljoin(dirname, f)) def subrepo(ctx, path): """return instance of the right subrepo class for subrepo in path"""