hgext/histedit.py
changeset 19018 730614b9b352
parent 19017 c5c8613f265e
child 19020 12c06686d371
equal deleted inserted replaced
19017:c5c8613f265e 19018:730614b9b352
   141 try:
   141 try:
   142     import cPickle as pickle
   142     import cPickle as pickle
   143 except ImportError:
   143 except ImportError:
   144     import pickle
   144     import pickle
   145 import os
   145 import os
       
   146 import sys
   146 
   147 
   147 from mercurial import cmdutil
   148 from mercurial import cmdutil
   148 from mercurial import discovery
   149 from mercurial import discovery
   149 from mercurial import error
   150 from mercurial import error
   150 from mercurial import copies
   151 from mercurial import copies
   513             # surprising happens.
   514             # surprising happens.
   514             f = open(repo.join('histedit-last-edit.txt'), 'w')
   515             f = open(repo.join('histedit-last-edit.txt'), 'w')
   515             f.write(rules)
   516             f.write(rules)
   516             f.close()
   517             f.close()
   517         else:
   518         else:
   518             f = open(rules)
   519             if rules == '-':
       
   520                 f = sys.stdin
       
   521             else:
       
   522                 f = open(rules)
   519             rules = f.read()
   523             rules = f.read()
   520             f.close()
   524             f.close()
   521         rules = [l for l in (r.strip() for r in rules.splitlines())
   525         rules = [l for l in (r.strip() for r in rules.splitlines())
   522                  if l and not l[0] == '#']
   526                  if l and not l[0] == '#']
   523         rules = verifyrules(rules, repo, ctxs)
   527         rules = verifyrules(rules, repo, ctxs)