Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 37133:a2a6755a3def
grep: fixes erroneous output of grep in forward order (issue3885)
If grep is passed a revset in forwards order via -r , say -r 0:tip
Then the output is erroneous. This patch fixes that. The output was wrong
because we deleted the last revision key in the matches and when we moved
to the next revision we didn't had this to compare the diff. So the pstates
dict was always empty and in the SequenceMatcher, to convert and empty pstate
to the states dictionary you would always insert. This patch keeps the matches
dictionary until the end of this window and clears it at once when this
window ends. This solves the above mentioned problem and also do not cause
any memory leak.
author | Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com> |
---|---|
date | Tue, 27 Mar 2018 20:21:30 +0530 |
parents | 6f570c501e3e |
children | eb4a23382e18 |
comparison
equal
deleted
inserted
replaced
37132:a54113fcc8c9 | 37133:a2a6755a3def |
---|---|
2588 found = found or r | 2588 found = found or r |
2589 if r and not opts.get('all'): | 2589 if r and not opts.get('all'): |
2590 skip[fn] = True | 2590 skip[fn] = True |
2591 if copy: | 2591 if copy: |
2592 skip[copy] = True | 2592 skip[copy] = True |
2593 del matches[rev] | |
2594 del revfiles[rev] | 2593 del revfiles[rev] |
2594 # We will keep the matches dict for the duration of the window | |
2595 # clear the matches dict once the window is over | |
2596 if not revfiles: | |
2597 matches.clear() | |
2595 fm.end() | 2598 fm.end() |
2596 | 2599 |
2597 return not found | 2600 return not found |
2598 | 2601 |
2599 @command('heads', | 2602 @command('heads', |