mercurial/subrepo.py
branchstable
changeset 21564 2e91d4964ecd
parent 21041 a2cc3c08c3ac
child 21565 7f7f634d073d
equal deleted inserted replaced
21556:5e13507a3b4e 21564:2e91d4964ecd
   313             return os.path.dirname(repo.sharedpath)
   313             return os.path.dirname(repo.sharedpath)
   314     if abort:
   314     if abort:
   315         raise util.Abort(_("default path for subrepository not found"))
   315         raise util.Abort(_("default path for subrepository not found"))
   316 
   316 
   317 def _sanitize(ui, path):
   317 def _sanitize(ui, path):
   318     def v(arg, dirname, names):
   318     for dirname, dirs, names in os.walk(path):
   319         if os.path.basename(dirname).lower() != '.hg':
   319         if os.path.basename(dirname).lower() != '.hg':
   320             return
   320             continue
   321         for f in names:
   321         for f in names:
   322             if f.lower() == 'hgrc':
   322             if f.lower() == 'hgrc':
   323                 ui.warn(
   323                 ui.warn(_("warning: removing potentially hostile 'hgrc' "
   324                     _("warning: removing potentially hostile .hg/hgrc in '%s'")
   324                           "in '%s'\n") % dirname)
   325                       % path)
       
   326                 os.unlink(os.path.join(dirname, f))
   325                 os.unlink(os.path.join(dirname, f))
   327     os.walk(path, v, None)
       
   328 
   326 
   329 def subrepo(ctx, path):
   327 def subrepo(ctx, path):
   330     """return instance of the right subrepo class for subrepo in path"""
   328     """return instance of the right subrepo class for subrepo in path"""
   331     # subrepo inherently violates our import layering rules
   329     # subrepo inherently violates our import layering rules
   332     # because it wants to make repo objects from deep inside the stack
   330     # because it wants to make repo objects from deep inside the stack