Mercurial > hg-stable
comparison mercurial/bundle2.py @ 20950:c7ceae0faf69
bundle2: first crude version of bundling changeset with bundle2
The current changegroup format is put in a "changegroup" part and processed by
an appropriate handlers.
This is not production ready code, but let us start smoke testing.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 24 Mar 2014 19:37:59 -0700 |
parents | 571f2903ff1e |
children | b24ee5076b94 |
comparison
equal
deleted
inserted
replaced
20949:571f2903ff1e | 20950:c7ceae0faf69 |
---|---|
139 | 139 |
140 import util | 140 import util |
141 import struct | 141 import struct |
142 import urllib | 142 import urllib |
143 import string | 143 import string |
144 import StringIO | |
144 | 145 |
145 import changegroup | 146 import changegroup |
146 from i18n import _ | 147 from i18n import _ |
147 | 148 |
148 _pack = struct.pack | 149 _pack = struct.pack |
522 yield _pack(_fpayloadsize, len(self.data)) | 523 yield _pack(_fpayloadsize, len(self.data)) |
523 yield self.data | 524 yield self.data |
524 # end of payload | 525 # end of payload |
525 yield _pack(_fpayloadsize, 0) | 526 yield _pack(_fpayloadsize, 0) |
526 | 527 |
528 @parthandler('changegroup') | |
529 def handlechangegroup(op, part): | |
530 """apply a changegroup part on the repo | |
531 | |
532 This is a very early implementation that will massive rework before being | |
533 inflicted to any end-user. | |
534 """ | |
535 data = StringIO.StringIO(part.data) | |
536 data.seek(0) | |
537 cg = changegroup.readbundle(data, 'bundle2part') | |
538 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') | |
539 op.records.add('changegroup', {'return': ret}) | |
540 | |
541 |