##// END OF EJS Templates
grep: correct handling of matching lines without line ending (issue3050)...
Mads Kiilerich -
r15293:0e34699d stable
parent child Browse files
Show More
@@ -2660,7 +2660,7 b' def grep(ui, repo, pattern, *pats, **opt'
2660 2660 mstart, mend = match.span()
2661 2661 linenum += body.count('\n', begin, mstart) + 1
2662 2662 lstart = body.rfind('\n', begin, mstart) + 1 or begin
2663 begin = body.find('\n', mend) + 1 or len(body)
2663 begin = body.find('\n', mend) + 1 or len(body) + 1
2664 2664 lend = begin - 1
2665 2665 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
2666 2666
@@ -106,12 +106,8 b' match in last "line" without newline'
106 106 $ python -c 'fp = open("noeol", "wb"); fp.write("no infinite loop"); fp.close();'
107 107 $ hg ci -Amnoeol
108 108 adding noeol
109
110 last character omitted in output to avoid infinite loop
111
112 109 $ hg grep loop
113 noeol:4:no infinite loo
114
110 noeol:4:no infinite loop
115 111
116 112 $ cd ..
117 113
General Comments 0
You need to be logged in to leave comments. Login now