Show More
@@ -62,7 +62,7 b' Binary format is as follow' | |||||
62 |
|
62 | |||
63 | import util |
|
63 | import util | |
64 | import changegroup |
|
64 | import changegroup | |
65 |
|
65 | from i18n import _ | ||
66 |
|
66 | |||
67 | _magicstring = 'HG20' |
|
67 | _magicstring = 'HG20' | |
68 |
|
68 | |||
@@ -93,10 +93,13 b' class unbundle20(object):' | |||||
93 | (this will eventually yield parts)""" |
|
93 | (this will eventually yield parts)""" | |
94 |
|
94 | |||
95 | def __init__(self, fp): |
|
95 | def __init__(self, fp): | |
96 | # assume the magic string is ok and drop it |
|
|||
97 | # to be obviously fixed soon. |
|
|||
98 | self._fp = fp |
|
96 | self._fp = fp | |
99 | self._readexact(4) |
|
97 | header = self._readexact(4) | |
|
98 | magic, version = header[0:2], header[2:4] | |||
|
99 | if magic != 'HG': | |||
|
100 | raise util.Abort(_('not a Mercurial bundle')) | |||
|
101 | if version != '20': | |||
|
102 | raise util.Abort(_('unknown bundle version %s') % version) | |||
100 |
|
103 | |||
101 | def _unpack(self, format): |
|
104 | def _unpack(self, format): | |
102 | """unpack this struct format from the stream""" |
|
105 | """unpack this struct format from the stream""" |
@@ -38,6 +38,9 b' The extension requires a repo (currently' | |||||
38 |
|
38 | |||
39 | $ hg init main |
|
39 | $ hg init main | |
40 | $ cd main |
|
40 | $ cd main | |
|
41 | $ touch a | |||
|
42 | $ hg add a | |||
|
43 | $ hg commit -m 'a' | |||
41 |
|
44 | |||
42 | Test simple generation of empty bundle |
|
45 | Test simple generation of empty bundle | |
43 |
|
46 | |||
@@ -49,3 +52,11 b' Test parsing of an empty bundle' | |||||
49 | $ hg bundle2 | hg unbundle2 |
|
52 | $ hg bundle2 | hg unbundle2 | |
50 | options count: 0 |
|
53 | options count: 0 | |
51 | parts count: 0 |
|
54 | parts count: 0 | |
|
55 | ||||
|
56 | Test old style bundle are detected and refused | |||
|
57 | ||||
|
58 | $ hg bundle --all ../bundle.hg | |||
|
59 | 1 changesets found | |||
|
60 | $ hg unbundle2 < ../bundle.hg | |||
|
61 | abort: unknown bundle version 10 | |||
|
62 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now