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

login
register
mail settings
Submitter phabricator
Date Feb. 23, 2018, 6:43 a.m.
Message ID <24db70611312be2aecb54ea3390c1fa9@localhost.localdomain>
Download mbox | patch
Permalink /patch/28266/
State Not Applicable
Headers show

Comments

phabricator - Feb. 23, 2018, 6:43 a.m.
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




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

Patch

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: