comparison mercurial/bundle2.py @ 31863:cd7aaf344d83

bundle2: move the 'close' method off the unpackermixin This method is unrelated to unpacking and only used by the unbundle20 class. We move it there for clarity.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sun, 09 Apr 2017 19:08:24 +0200
parents 9bd9e9cb3f69
children a02e773008f5
comparison
equal deleted inserted replaced
31862:9bd9e9cb3f69 31863:cd7aaf344d83
658 self._seekable = False 658 self._seekable = False
659 else: 659 else:
660 raise 660 raise
661 return None 661 return None
662 662
663 def close(self):
664 """close underlying file"""
665 if util.safehasattr(self._fp, 'close'):
666 return self._fp.close()
667
668 def getunbundler(ui, fp, magicstring=None): 663 def getunbundler(ui, fp, magicstring=None):
669 """return a valid unbundler object for a given magicstring""" 664 """return a valid unbundler object for a given magicstring"""
670 if magicstring is None: 665 if magicstring is None:
671 magicstring = changegroup.readexactly(fp, 4) 666 magicstring = changegroup.readexactly(fp, 4)
672 magic, version = magicstring[0:2], magicstring[2:4] 667 magic, version = magicstring[0:2], magicstring[2:4]
814 return None 809 return None
815 810
816 def compressed(self): 811 def compressed(self):
817 self.params # load params 812 self.params # load params
818 return self._compressed 813 return self._compressed
814
815 def close(self):
816 """close underlying file"""
817 if util.safehasattr(self._fp, 'close'):
818 return self._fp.close()
819 819
820 formatmap = {'20': unbundle20} 820 formatmap = {'20': unbundle20}
821 821
822 b2streamparamsmap = {} 822 b2streamparamsmap = {}
823 823