Show More
@@ -106,7 +106,7 def patches(a: bytes, bins: List[bytes]) | |||||
106 | try: |
|
106 | try: | |
107 | p1, p2, l = struct.unpack(b">lll", m.read(12)) |
|
107 | p1, p2, l = struct.unpack(b">lll", m.read(12)) | |
108 | except struct.error: |
|
108 | except struct.error: | |
109 |
raise mpatchError( |
|
109 | raise mpatchError("patch cannot be decoded") | |
110 | _pull(new, frags, p1 - last) # what didn't change |
|
110 | _pull(new, frags, p1 - last) # what didn't change | |
111 | _pull([], frags, p2 - p1) # what got deleted |
|
111 | _pull([], frags, p2 - p1) # what got deleted | |
112 | new.append((l, pos + 12)) # what got added |
|
112 | new.append((l, pos + 12)) # what got added | |
@@ -137,7 +137,7 def patchedsize(orig: int, delta: bytes) | |||||
137 | outlen += length |
|
137 | outlen += length | |
138 |
|
138 | |||
139 | if bin != binend: |
|
139 | if bin != binend: | |
140 |
raise mpatchError( |
|
140 | raise mpatchError("patch cannot be decoded") | |
141 |
|
141 | |||
142 | outlen += orig - last |
|
142 | outlen += orig - last | |
143 | return outlen |
|
143 | return outlen |
@@ -25,6 +25,7 if typing.TYPE_CHECKING: | |||||
25 |
|
25 | |||
26 | from .. import ( |
|
26 | from .. import ( | |
27 | error, |
|
27 | error, | |
|
28 | pycompat, | |||
28 | revlogutils, |
|
29 | revlogutils, | |
29 | util, |
|
30 | util, | |
30 | ) |
|
31 | ) | |
@@ -235,7 +236,7 class DirstateItem: | |||||
235 | parentfiledata=(mode, size, (mtime, 0, False)), |
|
236 | parentfiledata=(mode, size, (mtime, 0, False)), | |
236 | ) |
|
237 | ) | |
237 | else: |
|
238 | else: | |
238 |
raise RuntimeError( |
|
239 | raise RuntimeError('unknown state: %s' % pycompat.sysstr(state)) | |
239 |
|
240 | |||
240 | def set_possibly_dirty(self): |
|
241 | def set_possibly_dirty(self): | |
241 | """Mark a file as "possibly dirty" |
|
242 | """Mark a file as "possibly dirty" | |
@@ -651,7 +652,7 class BaseIndexObject: | |||||
651 |
|
652 | |||
652 | def _check_index(self, i): |
|
653 | def _check_index(self, i): | |
653 | if not isinstance(i, int): |
|
654 | if not isinstance(i, int): | |
654 |
raise TypeError( |
|
655 | raise TypeError("expecting int indexes") | |
655 | if i < 0 or i >= len(self): |
|
656 | if i < 0 or i >= len(self): | |
656 | raise IndexError(i) |
|
657 | raise IndexError(i) | |
657 |
|
658 | |||
@@ -711,7 +712,7 class IndexObject(BaseIndexObject): | |||||
711 |
|
712 | |||
712 | def __delitem__(self, i): |
|
713 | def __delitem__(self, i): | |
713 | if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: |
|
714 | if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: | |
714 |
raise ValueError( |
|
715 | raise ValueError("deleting slices only supports a:-1 with step 1") | |
715 | i = i.start |
|
716 | i = i.start | |
716 | self._check_index(i) |
|
717 | self._check_index(i) | |
717 | self._stripnodes(i) |
|
718 | self._stripnodes(i) | |
@@ -790,12 +791,12 class InlinedIndexObject(BaseIndexObject | |||||
790 | count += 1 |
|
791 | count += 1 | |
791 | off += self.entry_size + s |
|
792 | off += self.entry_size + s | |
792 | if off != len(self._data): |
|
793 | if off != len(self._data): | |
793 |
raise ValueError( |
|
794 | raise ValueError("corrupted data") | |
794 | return count |
|
795 | return count | |
795 |
|
796 | |||
796 | def __delitem__(self, i): |
|
797 | def __delitem__(self, i): | |
797 | if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: |
|
798 | if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: | |
798 |
raise ValueError( |
|
799 | raise ValueError("deleting slices only supports a:-1 with step 1") | |
799 | i = i.start |
|
800 | i = i.start | |
800 | self._check_index(i) |
|
801 | self._check_index(i) | |
801 | self._stripnodes(i) |
|
802 | self._stripnodes(i) | |
@@ -848,7 +849,7 class IndexObject2(IndexObject): | |||||
848 | raise KeyError |
|
849 | raise KeyError | |
849 | self._check_index(rev) |
|
850 | self._check_index(rev) | |
850 | if rev < self._lgt: |
|
851 | if rev < self._lgt: | |
851 |
msg = |
|
852 | msg = "cannot rewrite entries outside of this transaction" | |
852 | raise KeyError(msg) |
|
853 | raise KeyError(msg) | |
853 | else: |
|
854 | else: | |
854 | entry = list(self[rev]) |
|
855 | entry = list(self[rev]) |
General Comments 0
You need to be logged in to leave comments.
Login now