comparison mercurial/bundle2.py @ 25640:39f0064a3079

bundle2.getunbundler: rename "header" to "magicstring" This is more consistent with the name used in the bundler class. Thanks goes to Martin von Zweigbergk for pointing this out.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 07 Apr 2015 14:14:27 -0700
parents ca656f3dffd7
children c0bdfe87b245
comparison
equal deleted inserted replaced
25639:7125225a5287 25640:39f0064a3079
595 def close(self): 595 def close(self):
596 """close underlying file""" 596 """close underlying file"""
597 if util.safehasattr(self._fp, 'close'): 597 if util.safehasattr(self._fp, 'close'):
598 return self._fp.close() 598 return self._fp.close()
599 599
600 def getunbundler(ui, fp, header=None): 600 def getunbundler(ui, fp, magicstring=None):
601 """return a valid unbundler object for a given header""" 601 """return a valid unbundler object for a given magicstring"""
602 if header is None: 602 if magicstring is None:
603 header = changegroup.readexactly(fp, 4) 603 magicstring = changegroup.readexactly(fp, 4)
604 magic, version = header[0:2], header[2:4] 604 magic, version = magicstring[0:2], magicstring[2:4]
605 if magic != 'HG': 605 if magic != 'HG':
606 raise util.Abort(_('not a Mercurial bundle')) 606 raise util.Abort(_('not a Mercurial bundle'))
607 unbundlerclass = formatmap.get(version) 607 unbundlerclass = formatmap.get(version)
608 if unbundlerclass is None: 608 if unbundlerclass is None:
609 raise util.Abort(_('unknown bundle version %s') % version) 609 raise util.Abort(_('unknown bundle version %s') % version)
610 unbundler = unbundlerclass(ui, fp) 610 unbundler = unbundlerclass(ui, fp)
611 indebug(ui, 'start processing of %s stream' % header) 611 indebug(ui, 'start processing of %s stream' % magicstring)
612 return unbundler 612 return unbundler
613 613
614 class unbundle20(unpackermixin): 614 class unbundle20(unpackermixin):
615 """interpret a bundle2 stream 615 """interpret a bundle2 stream
616 616