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

Yuya Nishihara yuya at tcha.org
Thu Jan 4 03:36:46 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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 at example.org>
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
+
   $ cd ..
 
   $ hg init branches


More information about the Mercurial-devel mailing list