D3210: patch: move yielding "\n" to the end of loop

2018-04-16 Thread quark (Jun Wu)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8d730f96e792: patch: move yielding "\n" to the end of loop (authored by quark, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3210?vs=7922&id=8333

D3210: patch: move yielding "\n" to the end of loop

2018-04-12 Thread yuja (Yuya Nishihara)
yuja added a comment. `rawline` can be removed after the rewrite of +/- lines handling. -for rawline in mdiff.splitnewlines(chunk): -line = rawline.rstrip('\n') +for line in mdiff.splitnewlines(chunk): if head: if

D3210: patch: move yielding "\n" to the end of loop

2018-04-11 Thread quark (Jun Wu)
quark added a comment. I thought it was `for line in mdiff.splitnewlines(...)`. If we have both `rawline` and `line` variables, then it is easier. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3210 To: quark, #hg-reviewers Cc: yuja, mercurial-devel ___

D3210: patch: move yielding "\n" to the end of loop

2018-04-11 Thread yuja (Yuya Nishihara)
yuja added a comment. It's just a few-line patch after removal of the current worddiff, and can be simplified further. Anyway, I can clean up later. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2490,10 +2490

D3210: patch: move yielding "\n" to the end of loop

2018-04-10 Thread quark (Jun Wu)
quark added a comment. That's ideal. But a lot of code in this area expects "line" to not contain "\n". So the change won't be as easy as it looks. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3210 To: quark, #hg-reviewers Cc: yuja, mercurial-devel __

D3210: patch: move yielding "\n" to the end of loop

2018-04-10 Thread yuja (Yuya Nishihara)
yuja added a comment. Perhaps, it's simpler to use `mdiff.splitnewlines(chunk)` instead of `chunk.split('\n')` because otherwise the next patch has to reconstruct `line + '\n'`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3210 To: quark, #hg-reviewers Cc:

D3210: patch: move yielding "\n" to the end of loop

2018-04-09 Thread quark (Jun Wu)
quark created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The original logic makes it harder to reason about - it yields the "\n" character belonging to the last line in the next loop iteration. The new code is in theo