Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 21184:28d76afa1568 stable
bundle2: fix raising errors during heads checking
If the heads on the server differ from the ones reported seen by the client at
bundle time, we raise a PushRaced exception. However, the part raising the
exception was broken.
To fix it, we move the PushRaced class in the error module so it can be
accessible everywhere without an import cycle.
A test is also added to prevent regression.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 21 Apr 2014 18:59:09 -0700 |
parents | 4345274adc4b |
children | 5b3717e1a3ea |
comparison
equal
deleted
inserted
replaced
21183:4345274adc4b | 21184:28d76afa1568 |
---|---|
143 import util | 143 import util |
144 import struct | 144 import struct |
145 import urllib | 145 import urllib |
146 import string | 146 import string |
147 | 147 |
148 import changegroup | 148 import changegroup, error |
149 from i18n import _ | 149 from i18n import _ |
150 | 150 |
151 _pack = struct.pack | 151 _pack = struct.pack |
152 _unpack = struct.unpack | 152 _unpack = struct.unpack |
153 | 153 |
728 while len(h) == 20: | 728 while len(h) == 20: |
729 heads.append(h) | 729 heads.append(h) |
730 h = inpart.read(20) | 730 h = inpart.read(20) |
731 assert not h | 731 assert not h |
732 if heads != op.repo.heads(): | 732 if heads != op.repo.heads(): |
733 raise exchange.PushRaced() | 733 raise error.PushRaced() |
734 | 734 |
735 @parthandler('b2x:output') | 735 @parthandler('b2x:output') |
736 def handleoutput(op, inpart): | 736 def handleoutput(op, inpart): |
737 """forward output captured on the server to the client""" | 737 """forward output captured on the server to the client""" |
738 for line in inpart.read().splitlines(): | 738 for line in inpart.read().splitlines(): |