comparison hgext/mq.py @ 3079:bed7cb835d8d

Fixed python2.3 incompatibility (rsplit) in qpush/qpop with index.
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 12 Sep 2006 17:27:41 +0200
parents 1a792e4a1f3a
children 82c9d1aac308
comparison
equal deleted inserted replaced
3078:760414dc7ac6 3079:bed7cb835d8d
755 return self.series[sno] 755 return self.series[sno]
756 if not strict: 756 if not strict:
757 # return any partial match made above 757 # return any partial match made above
758 if res: 758 if res:
759 return res 759 return res
760 minus = patch.rsplit('-', 1) 760 minus = patch.rfind('-')
761 if len(minus) > 1: 761 if minus >= 0:
762 res = partial_name(minus[0]) 762 res = partial_name(patch[:minus])
763 if res: 763 if res:
764 i = self.series.index(res) 764 i = self.series.index(res)
765 try: 765 try:
766 off = int(minus[1] or 1) 766 off = int(patch[minus+1:] or 1)
767 except(ValueError, OverflowError): 767 except(ValueError, OverflowError):
768 pass 768 pass
769 else: 769 else:
770 if i - off >= 0: 770 if i - off >= 0:
771 return self.series[i - off] 771 return self.series[i - off]
772 plus = patch.rsplit('+', 1) 772 plus = patch.rfind('+')
773 if len(plus) > 1: 773 if plus >= 0:
774 res = partial_name(plus[0]) 774 res = partial_name(patch[:plus])
775 if res: 775 if res:
776 i = self.series.index(res) 776 i = self.series.index(res)
777 try: 777 try:
778 off = int(plus[1] or 1) 778 off = int(patch[plus+1:] or 1)
779 except(ValueError, OverflowError): 779 except(ValueError, OverflowError):
780 pass 780 pass
781 else: 781 else:
782 if i + off < len(self.series): 782 if i + off < len(self.series):
783 return self.series[i + off] 783 return self.series[i + off]