Mercurial > hg
comparison hgext/largefiles/overrides.py @ 24438:5b85a5bc5bbb
revert: evaluate filesets against working directory (issue4497)
As the failing revert tests in test-fileset-generated.t show,
Revert currently creates one matcher for matching files in the working
copy and another matcher for matching files in the target
revision. The two matchers are created with different contexts, which
means filesets are evaluated differently. Then the union of the sets
of files matching the matchers in the two contexts are reverted. It
doesn't seem to make sense to use two different matchers; only the
context they're applied to should be different.
It seems very likely that the user wants the filesets to be evaluated
against the working directory, which the tests
test-fileset-generated.t also assume, so let's make it so.
I willingly admit that the largefiles code was modified by trial and
error (according to tests).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 23 Mar 2015 23:04:51 -0700 |
parents | 2703eb73a3af |
children | 1bf71faf042e |
comparison
equal
deleted
inserted
replaced
24437:2703eb73a3af | 24438:5b85a5bc5bbb |
---|---|
763 lfdirstate = lfutil.openlfdirstate(mctx.repo().ui, mctx.repo(), | 763 lfdirstate = lfutil.openlfdirstate(mctx.repo().ui, mctx.repo(), |
764 False) | 764 False) |
765 | 765 |
766 def tostandin(f): | 766 def tostandin(f): |
767 standin = lfutil.standin(f) | 767 standin = lfutil.standin(f) |
768 if standin in mctx: | 768 if standin in ctx or standin in mctx: |
769 return standin | 769 return standin |
770 elif standin in repo[None] or lfdirstate[f] == 'r': | 770 elif standin in repo[None] or lfdirstate[f] == 'r': |
771 return None | 771 return None |
772 return f | 772 return f |
773 m._files = [tostandin(f) for f in m._files] | 773 m._files = [tostandin(f) for f in m._files] |
775 m._fmap = set(m._files) | 775 m._fmap = set(m._files) |
776 origmatchfn = m.matchfn | 776 origmatchfn = m.matchfn |
777 def matchfn(f): | 777 def matchfn(f): |
778 if lfutil.isstandin(f): | 778 if lfutil.isstandin(f): |
779 return (origmatchfn(lfutil.splitstandin(f)) and | 779 return (origmatchfn(lfutil.splitstandin(f)) and |
780 (f in repo[None] or f in mctx)) | 780 (f in ctx or f in mctx)) |
781 return origmatchfn(f) | 781 return origmatchfn(f) |
782 m.matchfn = matchfn | 782 m.matchfn = matchfn |
783 return m | 783 return m |
784 oldmatch = installmatchfn(overridematch) | 784 oldmatch = installmatchfn(overridematch) |
785 try: | 785 try: |