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