[PATCH 1 of 2] destutil: use revset.match for desthistedit (issue5001)

Gregory Szorc gregory.szorc at gmail.com
Sun Dec 20 18:32:34 UTC 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1450636109 28800
#      Sun Dec 20 10:28:29 2015 -0800
# Node ID fd6eb3903a016edc748053a5aa42c74cefa6a7fb
# Parent  ff305ab2e0d7291da12a8b640ce8c9bb28e0cb03
destutil: use revset.match for desthistedit (issue5001)

This allows user aliases to be expanded. It also prevents the
user-provided revset from being treated as a revset expression.

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -7,16 +7,17 @@
 
 from __future__ import absolute_import
 
 from .i18n import _
 from . import (
     bookmarks,
     error,
     obsolete,
+    revset,
 )
 
 def _destupdatevalidate(repo, rev, clean, check):
     """validate that the destination comply to various rules
 
     This exists as its own function to help wrapping from extensions."""
     wc = repo[None]
     p1 = wc.p1()
@@ -202,16 +203,17 @@ def destmerge(repo):
     return repo[node].rev()
 
 histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())'
 
 def desthistedit(ui, repo):
     """Default base revision to edit for `hg histedit`."""
     default = ui.config('histedit', 'defaultrev', histeditdefaultrevset)
     if default:
-        revs = repo.revs(default)
+        m = revset.match(ui, default)
+        revs = m(repo)
         if revs:
             # The revset supplied by the user may not be in ascending order nor
             # take the first revision. So do this manually.
             revs.sort()
             return revs.first()
 
     return None


More information about the Mercurial-devel mailing list