comparison mercurial/revset.py @ 23950:caff3675cba5 stable

log: evaluate filesets on working copy, not its parent When running "hg log 'set:added()'", we create two matchers: one used for producing the revset and one used for finding files to match. In 1fd352aa08fc (graphlog: evaluate FILE/-I/-X filesets on the working dir, 2012-02-26), we started passing a revision argument along from what's currently in cmdutil._makelogrevset() to revset._matchfiles(). When the revision was an empty string, it referred to the working copy. This was subtly done with "repo[rev or None]". Then, in f2aeff8a87b6 (revset: avoid recalculating filesets, 2014-10-22), that conversion from empty string to None was lost. Note that repo[''] is equivalent to repo['.'], not repo[None]. The consequence of this, to the user, is that when running "hg log 'set:added()'", the file matcher matches files added in the working copy, while the revset matcher matches revisions that touch files added in the parent of the working copy. As a result, only revisions that touch any files added in the parent of the working copy will be considered, but they will only be included if they also touch files added in the working copy. Fix the bug by converting '' to None again, but make it a little more explicit this time (plus, we now have tests for it).
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 21 Jan 2015 15:23:13 -0800
parents 71402bb8d8b2
children 310222feb9a8
comparison
equal deleted inserted replaced
23949:8efb7130a519 23950:caff3675cba5
1046 elif prefix == 'r:': 1046 elif prefix == 'r:':
1047 if rev is not None: 1047 if rev is not None:
1048 # i18n: "_matchfiles" is a keyword 1048 # i18n: "_matchfiles" is a keyword
1049 raise error.ParseError(_('_matchfiles expected at most one ' 1049 raise error.ParseError(_('_matchfiles expected at most one '
1050 'revision')) 1050 'revision'))
1051 rev = value 1051 if value != '': # empty means working directory; leave rev as None
1052 rev = value
1052 elif prefix == 'd:': 1053 elif prefix == 'd:':
1053 if default is not None: 1054 if default is not None:
1054 # i18n: "_matchfiles" is a keyword 1055 # i18n: "_matchfiles" is a keyword
1055 raise error.ParseError(_('_matchfiles expected at most one ' 1056 raise error.ParseError(_('_matchfiles expected at most one '
1056 'default mode')) 1057 'default mode'))