This is because bytes[0] will return the ascii value and comparison will fail.
This makes test-commit-interactive-curses.t pass on Python 3.
hg-reviewers |
This is because bytes[0] will return the ascii value and comparison will fail.
This makes test-commit-interactive-curses.t pass on Python 3.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | contrib/python3-whitelist (1 line) | |||
M | mercurial/crecord.py (12 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Pulkit Goyal | Feb 7 2019, 8:44 AM |
test-clone-r.t | test-clone-r.t | ||||
test-clone-uncompressed.t | test-clone-uncompressed.t | ||||
test-clone-update-order.t | test-clone-update-order.t | ||||
test-clone.t | test-clone.t | ||||
test-clonebundles.t | test-clonebundles.t | ||||
test-close-head.t | test-close-head.t | ||||
test-commandserver.t | test-commandserver.t | ||||
test-commit-amend.t | test-commit-amend.t | ||||
test-commit-interactive-curses.t | |||||
test-commit-interactive.t | test-commit-interactive.t | ||||
test-commit-multiple.t | test-commit-multiple.t | ||||
test-commit-unresolved.t | test-commit-unresolved.t | ||||
test-commit.t | test-commit.t | ||||
test-committer.t | test-committer.t | ||||
test-completion.t | test-completion.t | ||||
test-config-env.py | test-config-env.py | ||||
test-config.t | test-config.t |
def allchildren(self): | def allchildren(self): | ||||
"return a list of all of the direct children of this node" | "return a list of all of the direct children of this node" | ||||
return self.changedlines | return self.changedlines | ||||
def countchanges(self): | def countchanges(self): | ||||
"""changedlines -> (n+,n-)""" | """changedlines -> (n+,n-)""" | ||||
add = len([l for l in self.changedlines if l.applied | add = len([l for l in self.changedlines if l.applied | ||||
and l.prettystr()[0] == '+']) | and l.prettystr().startswith('+')]) | ||||
rem = len([l for l in self.changedlines if l.applied | rem = len([l for l in self.changedlines if l.applied | ||||
and l.prettystr()[0] == '-']) | and l.prettystr().startswith('-')]) | ||||
return add, rem | return add, rem | ||||
def getfromtoline(self): | def getfromtoline(self): | ||||
# calculate the number of removed lines converted to context lines | # calculate the number of removed lines converted to context lines | ||||
removedconvertedtocontext = self.originalremoved - self.removed | removedconvertedtocontext = self.originalremoved - self.removed | ||||
contextlen = (len(self.before) + len(self.after) + | contextlen = (len(self.before) + len(self.after) + | ||||
removedconvertedtocontext) | removedconvertedtocontext) | ||||
hunklinelist = [] | hunklinelist = [] | ||||
# add the following to the list: (1) all applied lines, and | # add the following to the list: (1) all applied lines, and | ||||
# (2) all unapplied removal lines (convert these to context lines) | # (2) all unapplied removal lines (convert these to context lines) | ||||
for changedline in self.changedlines: | for changedline in self.changedlines: | ||||
changedlinestr = changedline.prettystr() | changedlinestr = changedline.prettystr() | ||||
if changedline.applied: | if changedline.applied: | ||||
hunklinelist.append(changedlinestr) | hunklinelist.append(changedlinestr) | ||||
elif changedlinestr[0] == "-": | elif changedlinestr.startswith("-"): | ||||
hunklinelist.append(" " + changedlinestr[1:]) | hunklinelist.append(" " + changedlinestr[1:]) | ||||
fp.write(''.join(self.before + hunklinelist + self.after)) | fp.write(''.join(self.before + hunklinelist + self.after)) | ||||
pretty = write | pretty = write | ||||
def prettystr(self): | def prettystr(self): | ||||
x = stringio() | x = stringio() | ||||
side and "-4" must exist between "-3" and "-5" to make the patch | side and "-4" must exist between "-3" and "-5" to make the patch | ||||
applicable to B. | applicable to B. | ||||
""" | """ | ||||
dels = [] | dels = [] | ||||
adds = [] | adds = [] | ||||
for line in self.changedlines: | for line in self.changedlines: | ||||
text = line.linetext | text = line.linetext | ||||
if line.applied: | if line.applied: | ||||
if text[0] == '+': | if text.startswith('+'): | ||||
dels.append(text[1:]) | dels.append(text[1:]) | ||||
elif text[0] == '-': | elif text.startswith('-'): | ||||
adds.append(text[1:]) | adds.append(text[1:]) | ||||
elif text[0] == '+': | elif text.startswith('+'): | ||||
dels.append(text[1:]) | dels.append(text[1:]) | ||||
adds.append(text[1:]) | adds.append(text[1:]) | ||||
hunk = ['-%s' % l for l in dels] + ['+%s' % l for l in adds] | hunk = ['-%s' % l for l in dels] + ['+%s' % l for l in adds] | ||||
h = self._hunk | h = self._hunk | ||||
return patchmod.recordhunk(h.header, h.toline, h.fromline, h.proc, | return patchmod.recordhunk(h.header, h.toline, h.fromline, h.proc, | ||||
h.before, hunk, h.after) | h.before, hunk, h.after) | ||||
def __getattr__(self, name): | def __getattr__(self, name): |