# HG changeset patch # User Mateusz Kwapich # Date 2015-12-02 20:19:01 # Node ID 7a523b6d5265f542e98e89ab76431d9349c4d2f3 # Parent 787d8cc3f04e6b3cc719a134ae280e6c09edbf9d histedit: add tostate method to histedit action the format of rules that we store in state file format is different from the rule format that we present to users. We need a way of dumping action to state file. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -376,6 +376,12 @@ class histeditaction(object): maxlen = max(maxlen, 22) # avoid truncating hash return util.ellipsis(line, maxlen) + def tostate(self): + """Print an action in format used by histedit state files + (the first line is a verb, the remainder is the second) + """ + return "%s\n%s" % (self.verb, node.hex(self.node)) + def constraints(self): """Return a set of constrains that this action should be verified for """