Patchwork [5,of,6] log: don't expand aliases in revset built from command options

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 4, 2018, 8:36 a.m.
Message ID <a7ad7ce089a3d9473c98.1515055006@mimosa>
Download mbox | patch
Permalink /patch/26534/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 4, 2018, 8:36 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1515034818 -32400
#      Thu Jan 04 12:00:18 2018 +0900
# Node ID a7ad7ce089a3d9473c98d094da670834ba40bdb6
# Parent  759d00588ebec2f0b9f6c6a762a7ba970e0f8d26
log: don't expand aliases in revset built from command options

Only -rREV should be rewritten with user aliases.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2523,7 +2523,7 @@  def getlogrevs(repo, pats, opts):
         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)
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1252,6 +1252,16 @@  User
   
   $ 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