Show More
@@ -3431,7 +3431,7 b' def log(ui, repo, *pats, **opts):' | |||
|
3431 | 3431 | revs, lrfilematcher, hunksfilter = logcmdutil.getlinerangerevs( |
|
3432 | 3432 | repo, revs, opts) |
|
3433 | 3433 | |
|
3434 |
if filematcher is not None |
|
|
3434 | if filematcher is not None: | |
|
3435 | 3435 | basefilematcher = filematcher |
|
3436 | 3436 | |
|
3437 | 3437 | def filematcher(rev): |
@@ -792,11 +792,9 b' def getlinerangerevs(repo, userrevs, opt' | |||
|
792 | 792 | |
|
793 | 793 | "filematcher(ctx) -> match" is a factory function returning a match object |
|
794 | 794 | for a given revision for file patterns specified in --line-range option. |
|
795 | If neither --stat nor --patch options are passed, "filematcher" is None. | |
|
796 | 795 | |
|
797 | 796 | "hunksfilter(ctx) -> filterfn(fctx, hunks)" is a factory function |
|
798 | 797 | returning a hunks filtering function. |
|
799 | If neither --stat nor --patch options are passed, "filterhunks" is None. | |
|
800 | 798 | """ |
|
801 | 799 | wctx = repo[None] |
|
802 | 800 | |
@@ -815,37 +813,33 b' def getlinerangerevs(repo, userrevs, opt' | |||
|
815 | 813 | rev, {}).setdefault( |
|
816 | 814 | fctx.path(), []).append(linerange) |
|
817 | 815 | |
|
818 | filematcher = None | |
|
819 | hunksfilter = None | |
|
820 | if opts.get('patch') or opts.get('stat'): | |
|
816 | def nofilterhunksfn(fctx, hunks): | |
|
817 | return hunks | |
|
821 | 818 | |
|
822 |
|
|
|
823 | return hunks | |
|
824 | ||
|
825 | def hunksfilter(ctx): | |
|
826 | fctxlineranges = linerangesbyrev.get(ctx.rev()) | |
|
827 | if fctxlineranges is None: | |
|
828 | return nofilterhunksfn | |
|
819 | def hunksfilter(ctx): | |
|
820 | fctxlineranges = linerangesbyrev.get(ctx.rev()) | |
|
821 | if fctxlineranges is None: | |
|
822 | return nofilterhunksfn | |
|
829 | 823 | |
|
830 |
|
|
|
831 |
|
|
|
832 |
|
|
|
833 |
|
|
|
834 |
|
|
|
835 |
|
|
|
836 |
|
|
|
837 |
|
|
|
838 |
|
|
|
839 |
|
|
|
840 |
|
|
|
841 |
|
|
|
842 |
|
|
|
824 | def filterfn(fctx, hunks): | |
|
825 | lineranges = fctxlineranges.get(fctx.path()) | |
|
826 | if lineranges is not None: | |
|
827 | for hr, lines in hunks: | |
|
828 | if hr is None: # binary | |
|
829 | yield hr, lines | |
|
830 | continue | |
|
831 | if any(mdiff.hunkinrange(hr[2:], lr) | |
|
832 | for lr in lineranges): | |
|
833 | yield hr, lines | |
|
834 | else: | |
|
835 | for hunk in hunks: | |
|
836 | yield hunk | |
|
843 | 837 | |
|
844 |
|
|
|
838 | return filterfn | |
|
845 | 839 | |
|
846 |
|
|
|
847 |
|
|
|
848 |
|
|
|
840 | def filematcher(ctx): | |
|
841 | files = list(linerangesbyrev.get(ctx.rev(), [])) | |
|
842 | return scmutil.matchfiles(repo, files) | |
|
849 | 843 | |
|
850 | 844 | revs = sorted(linerangesbyrev, reverse=True) |
|
851 | 845 |
General Comments 0
You need to be logged in to leave comments.
Login now