Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/hgweb.py @ 751:0b245edec124
When pulling from a non hg repository URL (e.g. http://www.kernel.org/hg)
you geta pretty obscure error (zlib: uknown compression type). The
attached patch modifies hgweb.py and hg.py to supply and check a
'Content-type: application/hg-0.1' HTTP header for the branches,
between and changegroup commands, so that we know it's a proper hg
repo before snarfing the input. Comments appreciated!
author | Muli Ben-Yehuda <mulix@mulix.org> |
---|---|
date | Thu, 21 Jul 2005 18:18:43 -0500 |
parents | b50cd98bb7e4 |
children | 8760d0c83b9b |
comparison
equal
deleted
inserted
replaced
750:25986be9a1aa | 751:0b245edec124 |
---|---|
655 | 655 |
656 elif args['cmd'][0] == 'filelog': | 656 elif args['cmd'][0] == 'filelog': |
657 write(self.filelog(args['file'][0], args['filenode'][0])) | 657 write(self.filelog(args['file'][0], args['filenode'][0])) |
658 | 658 |
659 elif args['cmd'][0] == 'heads': | 659 elif args['cmd'][0] == 'heads': |
660 httphdr("text/plain") | 660 httphdr("application/mercurial-0.1") |
661 h = self.repo.heads() | 661 h = self.repo.heads() |
662 sys.stdout.write(" ".join(map(hex, h)) + "\n") | 662 sys.stdout.write(" ".join(map(hex, h)) + "\n") |
663 | 663 |
664 elif args['cmd'][0] == 'branches': | 664 elif args['cmd'][0] == 'branches': |
665 httphdr("text/plain") | 665 httphdr("application/mercurial-0.1") |
666 nodes = [] | 666 nodes = [] |
667 if args.has_key('nodes'): | 667 if args.has_key('nodes'): |
668 nodes = map(bin, args['nodes'][0].split(" ")) | 668 nodes = map(bin, args['nodes'][0].split(" ")) |
669 for b in self.repo.branches(nodes): | 669 for b in self.repo.branches(nodes): |
670 sys.stdout.write(" ".join(map(hex, b)) + "\n") | 670 sys.stdout.write(" ".join(map(hex, b)) + "\n") |
671 | 671 |
672 elif args['cmd'][0] == 'between': | 672 elif args['cmd'][0] == 'between': |
673 httphdr("text/plain") | 673 httphdr("application/hg-0.1") |
674 nodes = [] | 674 nodes = [] |
675 if args.has_key('pairs'): | 675 if args.has_key('pairs'): |
676 pairs = [ map(bin, p.split("-")) | 676 pairs = [ map(bin, p.split("-")) |
677 for p in args['pairs'][0].split(" ") ] | 677 for p in args['pairs'][0].split(" ") ] |
678 for b in self.repo.between(pairs): | 678 for b in self.repo.between(pairs): |
679 sys.stdout.write(" ".join(map(hex, b)) + "\n") | 679 sys.stdout.write(" ".join(map(hex, b)) + "\n") |
680 | 680 |
681 elif args['cmd'][0] == 'changegroup': | 681 elif args['cmd'][0] == 'changegroup': |
682 httphdr("application/hg-changegroup") | 682 httphdr("application/mercurial-0.1") |
683 nodes = [] | 683 nodes = [] |
684 if self.viewonly: | 684 if self.viewonly: |
685 return | 685 return |
686 | 686 |
687 if args.has_key('roots'): | 687 if args.has_key('roots'): |