Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG86e0a4bede5d: py3: slice over bytes to prevent getting the ascii values
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/patch.py (16 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Pulkit Goyal | May 19 2018, 9:19 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit |
return i | return i | ||||
out = "" | out = "" | ||||
s = deltahead(binchunk) | s = deltahead(binchunk) | ||||
binchunk = binchunk[s:] | binchunk = binchunk[s:] | ||||
s = deltahead(binchunk) | s = deltahead(binchunk) | ||||
binchunk = binchunk[s:] | binchunk = binchunk[s:] | ||||
i = 0 | i = 0 | ||||
while i < len(binchunk): | while i < len(binchunk): | ||||
cmd = ord(binchunk[i]) | cmd = ord(binchunk[i:i + 1]) | ||||
i += 1 | i += 1 | ||||
if (cmd & 0x80): | if (cmd & 0x80): | ||||
offset = 0 | offset = 0 | ||||
size = 0 | size = 0 | ||||
if (cmd & 0x01): | if (cmd & 0x01): | ||||
offset = ord(binchunk[i]) | offset = ord(binchunk[i:i + 1]) | ||||
i += 1 | i += 1 | ||||
if (cmd & 0x02): | if (cmd & 0x02): | ||||
offset |= ord(binchunk[i]) << 8 | offset |= ord(binchunk[i:i + 1]) << 8 | ||||
i += 1 | i += 1 | ||||
if (cmd & 0x04): | if (cmd & 0x04): | ||||
offset |= ord(binchunk[i]) << 16 | offset |= ord(binchunk[i:i + 1]) << 16 | ||||
i += 1 | i += 1 | ||||
if (cmd & 0x08): | if (cmd & 0x08): | ||||
offset |= ord(binchunk[i]) << 24 | offset |= ord(binchunk[i:i + 1]) << 24 | ||||
i += 1 | i += 1 | ||||
if (cmd & 0x10): | if (cmd & 0x10): | ||||
size = ord(binchunk[i]) | size = ord(binchunk[i:i + 1]) | ||||
i += 1 | i += 1 | ||||
if (cmd & 0x20): | if (cmd & 0x20): | ||||
size |= ord(binchunk[i]) << 8 | size |= ord(binchunk[i:i + 1]) << 8 | ||||
i += 1 | i += 1 | ||||
if (cmd & 0x40): | if (cmd & 0x40): | ||||
size |= ord(binchunk[i]) << 16 | size |= ord(binchunk[i:i + 1]) << 16 | ||||
i += 1 | i += 1 | ||||
if size == 0: | if size == 0: | ||||
size = 0x10000 | size = 0x10000 | ||||
offset_end = offset + size | offset_end = offset + size | ||||
out += data[offset:offset_end] | out += data[offset:offset_end] | ||||
elif cmd != 0: | elif cmd != 0: | ||||
offset_end = i + cmd | offset_end = i + cmd | ||||
out += binchunk[i:offset_end] | out += binchunk[i:offset_end] |