Mercurial > public > mercurial-scm > hg-stable
diff hgext/histedit.py @ 19018:730614b9b352
histedit: allow "-" as a command file
When "-" is specified as a command file, we read rules from stdin. Alter a
single test to demo the behavior, but most of them could benefit from this.
There is minor change in test output resulting from the fact we no
longer change log messages.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 16 Apr 2013 20:48:37 +0200 |
parents | c5c8613f265e |
children | 12c06686d371 |
line wrap: on
line diff
--- a/hgext/histedit.py Tue Apr 16 16:58:25 2013 +0200 +++ b/hgext/histedit.py Tue Apr 16 20:48:37 2013 +0200 @@ -143,6 +143,7 @@ except ImportError: import pickle import os +import sys from mercurial import cmdutil from mercurial import discovery @@ -515,7 +516,10 @@ f.write(rules) f.close() else: - f = open(rules) + if rules == '-': + f = sys.stdin + else: + f = open(rules) rules = f.read() f.close() rules = [l for l in (r.strip() for r in rules.splitlines())