D2394: histedit: make histedit's commands accept revsets (issue5746)

sangeet259 (Sangeet Kumar Mishra) phabricator at mercurial-scm.org
Fri Feb 23 01:43:49 EST 2018


sangeet259 updated this revision to Diff 6008.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2394?vs=6007&id=6008

REVISION DETAIL
  https://phab.mercurial-scm.org/D2394

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -422,7 +422,14 @@
     def fromrule(cls, state, rule):
         """Parses the given rule, returning an instance of the histeditaction.
         """
-        rulehash = rule.strip().split(' ', 1)[0]
+        ruleid = rule.strip().split(' ', 1)[0]
+        # The ruleid can be anything like revison no,rulehashes, "tip","@" etc
+        # Check for validation of rule ids and get the rulehash
+        try:
+            _ctx = scmutil.revsingle(state.repo, ruleid)
+            rulehash = _ctx.hex()[:12]
+        except RepoLookupError :
+            raise error.ParseError("invalid changeset %s" % ruleid)
         try:
             rev = node.bin(rulehash)
         except TypeError:



To: sangeet259, durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list