Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.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 | a0004402776b |
children | bab983bb6fd1 |
comparison
equal
deleted
inserted
replaced
24437:2703eb73a3af | 24438:5b85a5bc5bbb |
---|---|
2826 for f in names: | 2826 for f in names: |
2827 if f.startswith(path_): | 2827 if f.startswith(path_): |
2828 return | 2828 return |
2829 ui.warn("%s: %s\n" % (m.rel(path), msg)) | 2829 ui.warn("%s: %s\n" % (m.rel(path), msg)) |
2830 | 2830 |
2831 m = scmutil.match(ctx, pats, opts) | |
2832 m.bad = badfn | 2831 m.bad = badfn |
2833 for abs in ctx.walk(m): | 2832 for abs in ctx.walk(m): |
2834 if abs not in names: | 2833 if abs not in names: |
2835 names[abs] = m.rel(abs), m.exact(abs) | 2834 names[abs] = m.rel(abs), m.exact(abs) |
2836 | 2835 |