comparison mercurial/bundle2.py @ 23139:e53f6b72a0e4

spelling: fixes from proofreading of spell checker issues
author Mads Kiilerich <madski@unity3d.com>
date Thu, 17 Apr 2014 22:47:38 +0200
parents 420a051616ce
children e4dc2b0be056
comparison
equal deleted inserted replaced
23136:6eab50a34fed 23139:e53f6b72a0e4
227 self._sequences.append((category, entry)) 227 self._sequences.append((category, entry))
228 if inreplyto is not None: 228 if inreplyto is not None:
229 self.getreplies(inreplyto).add(category, entry) 229 self.getreplies(inreplyto).add(category, entry)
230 230
231 def getreplies(self, partid): 231 def getreplies(self, partid):
232 """get the subrecords that replies to a specific part""" 232 """get the records that are replies to a specific part"""
233 return self._replies.setdefault(partid, unbundlerecords()) 233 return self._replies.setdefault(partid, unbundlerecords())
234 234
235 def __getitem__(self, cat): 235 def __getitem__(self, cat):
236 return tuple(self._categories.get(cat, ())) 236 return tuple(self._categories.get(cat, ()))
237 237
301 except Exception, exc: 301 except Exception, exc:
302 for part in iterparts: 302 for part in iterparts:
303 # consume the bundle content 303 # consume the bundle content
304 part.read() 304 part.read()
305 # Small hack to let caller code distinguish exceptions from bundle2 305 # Small hack to let caller code distinguish exceptions from bundle2
306 # processing fron the ones from bundle1 processing. This is mostly 306 # processing from processing the old format. This is mostly
307 # needed to handle different return codes to unbundle according to the 307 # needed to handle different return codes to unbundle according to the
308 # type of bundle. We should probably clean up or drop this return code 308 # type of bundle. We should probably clean up or drop this return code
309 # craziness in a future version. 309 # craziness in a future version.
310 exc.duringunbundle2 = True 310 exc.duringunbundle2 = True
311 raise 311 raise
357 # consume the part content to not corrupt the stream. 357 # consume the part content to not corrupt the stream.
358 part.read() 358 part.read()
359 359
360 360
361 def decodecaps(blob): 361 def decodecaps(blob):
362 """decode a bundle2 caps bytes blob into a dictionnary 362 """decode a bundle2 caps bytes blob into a dictionary
363 363
364 The blob is a list of capabilities (one per line) 364 The blob is a list of capabilities (one per line)
365 Capabilities may have values using a line of the form:: 365 Capabilities may have values using a line of the form::
366 366
367 capability=value1,value2,value3 367 capability=value1,value2,value3
739 739
740 def __call__(self): 740 def __call__(self):
741 self.ui.debug('bundle2 stream interruption, looking for a part.\n') 741 self.ui.debug('bundle2 stream interruption, looking for a part.\n')
742 headerblock = self._readpartheader() 742 headerblock = self._readpartheader()
743 if headerblock is None: 743 if headerblock is None:
744 self.ui.debug('no part found during iterruption.\n') 744 self.ui.debug('no part found during interruption.\n')
745 return 745 return
746 part = unbundlepart(self.ui, headerblock, self._fp) 746 part = unbundlepart(self.ui, headerblock, self._fp)
747 op = interruptoperation(self.ui) 747 op = interruptoperation(self.ui)
748 _processpart(op, part) 748 _processpart(op, part)
749 749
826 # make it a list of couple again 826 # make it a list of couple again
827 paramsizes = zip(paramsizes[::2], paramsizes[1::2]) 827 paramsizes = zip(paramsizes[::2], paramsizes[1::2])
828 # split mandatory from advisory 828 # split mandatory from advisory
829 mansizes = paramsizes[:mancount] 829 mansizes = paramsizes[:mancount]
830 advsizes = paramsizes[mancount:] 830 advsizes = paramsizes[mancount:]
831 # retrive param value 831 # retrieve param value
832 manparams = [] 832 manparams = []
833 for key, value in mansizes: 833 for key, value in mansizes:
834 manparams.append((self._fromheader(key), self._fromheader(value))) 834 manparams.append((self._fromheader(key), self._fromheader(value)))
835 advparams = [] 835 advparams = []
836 for key, value in advsizes: 836 for key, value in advsizes:
886 supportedformat = tuple('V%i' % v for v in obsolete.formats) 886 supportedformat = tuple('V%i' % v for v in obsolete.formats)
887 caps['b2x:obsmarkers'] = supportedformat 887 caps['b2x:obsmarkers'] = supportedformat
888 return caps 888 return caps
889 889
890 def bundle2caps(remote): 890 def bundle2caps(remote):
891 """return the bundlecapabilities of a peer as dict""" 891 """return the bundle capabilities of a peer as dict"""
892 raw = remote.capable('bundle2-exp') 892 raw = remote.capable('bundle2-exp')
893 if not raw and raw != '': 893 if not raw and raw != '':
894 return {} 894 return {}
895 capsblob = urllib.unquote(remote.capable('bundle2-exp')) 895 capsblob = urllib.unquote(remote.capable('bundle2-exp'))
896 return decodecaps(capsblob) 896 return decodecaps(capsblob)
918 # the source and url passed here are overwritten by the one contained in 918 # the source and url passed here are overwritten by the one contained in
919 # the transaction.hookargs argument. So 'bundle2' is a placeholder 919 # the transaction.hookargs argument. So 'bundle2' is a placeholder
920 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') 920 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
921 op.records.add('changegroup', {'return': ret}) 921 op.records.add('changegroup', {'return': ret})
922 if op.reply is not None: 922 if op.reply is not None:
923 # This is definitly not the final form of this 923 # This is definitely not the final form of this
924 # return. But one need to start somewhere. 924 # return. But one need to start somewhere.
925 part = op.reply.newpart('b2x:reply:changegroup') 925 part = op.reply.newpart('b2x:reply:changegroup')
926 part.addparam('in-reply-to', str(inpart.id), mandatory=False) 926 part.addparam('in-reply-to', str(inpart.id), mandatory=False)
927 part.addparam('return', '%i' % ret, mandatory=False) 927 part.addparam('return', '%i' % ret, mandatory=False)
928 assert not inpart.read() 928 assert not inpart.read()
987 raise util.Abort(_('%s: not a bundle version 1.0') % 987 raise util.Abort(_('%s: not a bundle version 1.0') %
988 util.hidepassword(raw_url)) 988 util.hidepassword(raw_url))
989 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') 989 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
990 op.records.add('changegroup', {'return': ret}) 990 op.records.add('changegroup', {'return': ret})
991 if op.reply is not None: 991 if op.reply is not None:
992 # This is definitly not the final form of this 992 # This is definitely not the final form of this
993 # return. But one need to start somewhere. 993 # return. But one need to start somewhere.
994 part = op.reply.newpart('b2x:reply:changegroup') 994 part = op.reply.newpart('b2x:reply:changegroup')
995 part.addparam('in-reply-to', str(inpart.id), mandatory=False) 995 part.addparam('in-reply-to', str(inpart.id), mandatory=False)
996 part.addparam('return', '%i' % ret, mandatory=False) 996 part.addparam('return', '%i' % ret, mandatory=False)
997 try: 997 try: