mercurial/subrepo.py
changeset 24726 747748766421
parent 24724 95eb067b2b5e
child 24778 a48b65ab428d
equal deleted inserted replaced
24725:ee751d47cf2c 24726:747748766421
   301             return os.path.dirname(repo.sharedpath)
   301             return os.path.dirname(repo.sharedpath)
   302     if abort:
   302     if abort:
   303         raise util.Abort(_("default path for subrepository not found"))
   303         raise util.Abort(_("default path for subrepository not found"))
   304 
   304 
   305 def _sanitize(ui, vfs, ignore):
   305 def _sanitize(ui, vfs, ignore):
   306     for dirname, dirs, names in os.walk(vfs.base):
   306     for dirname, dirs, names in vfs.walk():
   307         for i, d in enumerate(dirs):
   307         for i, d in enumerate(dirs):
   308             if d.lower() == ignore:
   308             if d.lower() == ignore:
   309                 del dirs[i]
   309                 del dirs[i]
   310                 break
   310                 break
   311         if os.path.basename(dirname).lower() != '.hg':
   311         if os.path.basename(dirname).lower() != '.hg':
   312             continue
   312             continue
   313         for f in names:
   313         for f in names:
   314             if f.lower() == 'hgrc':
   314             if f.lower() == 'hgrc':
   315                 ui.warn(_("warning: removing potentially hostile 'hgrc' "
   315                 ui.warn(_("warning: removing potentially hostile 'hgrc' "
   316                           "in '%s'\n") % dirname)
   316                           "in '%s'\n") % vfs.join(dirname))
   317                 os.unlink(os.path.join(dirname, f))
   317                 vfs.unlink(vfs.reljoin(dirname, f))
   318 
   318 
   319 def subrepo(ctx, path):
   319 def subrepo(ctx, path):
   320     """return instance of the right subrepo class for subrepo in path"""
   320     """return instance of the right subrepo class for subrepo in path"""
   321     # subrepo inherently violates our import layering rules
   321     # subrepo inherently violates our import layering rules
   322     # because it wants to make repo objects from deep inside the stack
   322     # because it wants to make repo objects from deep inside the stack