comparison mercurial/hgweb/hgweb_mod.py @ 4227:f5b9edf3390b

hgweb.unbundle: call req.httphdr only after the last possible call to bail
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 22 Oct 2006 13:54:43 -0300
parents 6fa7a2d0fc2e
children c52b7176af94
comparison
equal deleted inserted replaced
4226:fffacca46f09 4227:f5b9edf3390b
1074 if not self.check_perm(req, 'push', False): 1074 if not self.check_perm(req, 'push', False):
1075 bail(_('push not authorized\n'), 1075 bail(_('push not authorized\n'),
1076 headers={'status': '401 Unauthorized'}) 1076 headers={'status': '401 Unauthorized'})
1077 return 1077 return
1078 1078
1079 req.httphdr("application/mercurial-0.1")
1080
1081 their_heads = req.form['heads'][0].split(' ') 1079 their_heads = req.form['heads'][0].split(' ')
1082 1080
1083 def check_heads(): 1081 def check_heads():
1084 heads = map(hex, self.repo.heads()) 1082 heads = map(hex, self.repo.heads())
1085 return their_heads == [hex('force')] or their_heads == heads 1083 return their_heads == [hex('force')] or their_heads == heads
1086 1084
1087 # fail early if possible 1085 # fail early if possible
1088 if not check_heads(): 1086 if not check_heads():
1089 bail(_('unsynced changes\n')) 1087 bail(_('unsynced changes\n'))
1090 return 1088 return
1089
1090 req.httphdr("application/mercurial-0.1")
1091 1091
1092 # do not lock repo until all changegroup data is 1092 # do not lock repo until all changegroup data is
1093 # streamed. save to temporary file. 1093 # streamed. save to temporary file.
1094 1094
1095 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') 1095 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')