log: don't expand aliases in revset built from command options
authorYuya Nishihara <yuya@tcha.org>
Thu, 04 Jan 2018 12:00:18 +0900
changeset 35547 b6dbc860570d
parent 35546 5e1d4ccab455
child 35548 b14c8bcfbad9
log: don't expand aliases in revset built from command options Only -rREV should be rewritten with user aliases.
mercurial/cmdutil.py
tests/test-log.t
--- a/mercurial/cmdutil.py	Sun Oct 22 22:52:36 2017 +0900
+++ b/mercurial/cmdutil.py	Thu Jan 04 12:00:18 2018 +0900
@@ -2523,7 +2523,7 @@
         if not (revs.isdescending() or revs.istopo()):
             revs.sort(reverse=True)
     if expr:
-        matcher = revset.match(repo.ui, expr)
+        matcher = revset.match(None, expr)
         revs = matcher(repo, revs)
     if limit is not None:
         revs = revs.slice(0, limit)
--- a/tests/test-log.t	Sun Oct 22 22:52:36 2017 +0900
+++ b/tests/test-log.t	Thu Jan 04 12:00:18 2018 +0900
@@ -1252,6 +1252,16 @@
   
   $ hg log -u "user3"
 
+"-u USER" shouldn't be overridden by "user(USER)" alias
+
+  $ hg log --config 'revsetalias.user(x)=branch(x)' -u default
+  $ hg log --config 'revsetalias.user(x)=branch(x)' -u user1
+  changeset:   0:29a4c94f1924
+  user:        User One <user1@example.org>
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
+
   $ cd ..
 
   $ hg init branches