hgext/fastannotate/protocol.py
changeset 39211 c8a40b33ce30
parent 39210 1ddb296e0dee
child 39213 303dae0136b0
equal deleted inserted replaced
39210:1ddb296e0dee 39211:c8a40b33ce30
   183                 'getannotate',
   183                 'getannotate',
   184                 {'path': p, 'lastnode':lastnodemap.get(p)}))
   184                 {'path': p, 'lastnode':lastnodemap.get(p)}))
   185 
   185 
   186     ui.debug('fastannotate: server returned\n')
   186     ui.debug('fastannotate: server returned\n')
   187     for result in results:
   187     for result in results:
   188         for path, content in result.result().iteritems():
   188         r = result.result()
       
   189         for path in sorted(r):
   189             # ignore malicious paths
   190             # ignore malicious paths
   190             if not path.startswith('fastannotate/') or '/../' in (path + '/'):
   191             if not path.startswith('fastannotate/') or '/../' in (path + '/'):
   191                 ui.debug('fastannotate: ignored malicious path %s\n' % path)
   192                 ui.debug('fastannotate: ignored malicious path %s\n' % path)
   192                 continue
   193                 continue
       
   194             content = r[path]
   193             if ui.debugflag:
   195             if ui.debugflag:
   194                 ui.debug('fastannotate: writing %d bytes to %s\n'
   196                 ui.debug('fastannotate: writing %d bytes to %s\n'
   195                          % (len(content), path))
   197                          % (len(content), path))
   196             repo.vfs.makedirs(os.path.dirname(path))
   198             repo.vfs.makedirs(os.path.dirname(path))
   197             with repo.vfs(path, 'wb') as f:
   199             with repo.vfs(path, 'wb') as f: