339 |
338 |
340 # disappointing hacks below |
339 # disappointing hacks below |
341 extensions.wrapfunction(scmutil, b'getrenamedfn', getrenamedfn) |
340 extensions.wrapfunction(scmutil, b'getrenamedfn', getrenamedfn) |
342 extensions.wrapfunction(revset, b'filelog', filelogrevset) |
341 extensions.wrapfunction(revset, b'filelog', filelogrevset) |
343 revset.symbols[b'filelog'] = revset.filelog |
342 revset.symbols[b'filelog'] = revset.filelog |
344 extensions.wrapfunction(cmdutil, b'walkfilerevs', walkfilerevs) |
|
345 |
343 |
346 |
344 |
347 def cloneshallow(orig, ui, repo, *args, **opts): |
345 def cloneshallow(orig, ui, repo, *args, **opts): |
348 if opts.get('shallow'): |
346 if opts.get('shallow'): |
349 repos = [] |
347 repos = [] |
780 return None |
778 return None |
781 |
779 |
782 return getrenamed |
780 return getrenamed |
783 |
781 |
784 |
782 |
785 def walkfilerevs(orig, repo, match, follow, revs, fncache): |
|
786 if not isenabled(repo): |
|
787 return orig(repo, match, follow, revs, fncache) |
|
788 |
|
789 # remotefilelog's can't be walked in rev order, so throw. |
|
790 # The caller will see the exception and walk the commit tree instead. |
|
791 if not follow: |
|
792 raise cmdutil.FileWalkError(b"Cannot walk via filelog") |
|
793 |
|
794 wanted = set() |
|
795 minrev, maxrev = min(revs), max(revs) |
|
796 |
|
797 pctx = repo[b'.'] |
|
798 for filename in match.files(): |
|
799 if filename not in pctx: |
|
800 raise error.Abort( |
|
801 _(b'cannot follow file not in parent revision: "%s"') % filename |
|
802 ) |
|
803 fctx = pctx[filename] |
|
804 |
|
805 linkrev = fctx.linkrev() |
|
806 if linkrev >= minrev and linkrev <= maxrev: |
|
807 fncache.setdefault(linkrev, []).append(filename) |
|
808 wanted.add(linkrev) |
|
809 |
|
810 for ancestor in fctx.ancestors(): |
|
811 linkrev = ancestor.linkrev() |
|
812 if linkrev >= minrev and linkrev <= maxrev: |
|
813 fncache.setdefault(linkrev, []).append(ancestor.path()) |
|
814 wanted.add(linkrev) |
|
815 |
|
816 return wanted |
|
817 |
|
818 |
|
819 def filelogrevset(orig, repo, subset, x): |
783 def filelogrevset(orig, repo, subset, x): |
820 """``filelog(pattern)`` |
784 """``filelog(pattern)`` |
821 Changesets connected to the specified filelog. |
785 Changesets connected to the specified filelog. |
822 |
786 |
823 For performance reasons, ``filelog()`` does not show every changeset |
787 For performance reasons, ``filelog()`` does not show every changeset |