##// END OF EJS Templates
edit: allow to configure the suffix of the temporary filename...
Jordi Gutiérrez Hermoso -
r28635:87f92d6f default
parent child Browse files
Show More
@@ -971,12 +971,15 b' class ui(object):'
971 self.write(*msg, **opts)
971 self.write(*msg, **opts)
972
972
973 def edit(self, text, user, extra=None, editform=None, pending=None):
973 def edit(self, text, user, extra=None, editform=None, pending=None):
974 extra_defaults = { 'prefix': 'editor' }
974 extra_defaults = {
975 'prefix': 'editor',
976 'suffix': '.txt',
977 }
975 if extra is not None:
978 if extra is not None:
976 extra_defaults.update(extra)
979 extra_defaults.update(extra)
977 extra = extra_defaults
980 extra = extra_defaults
978 (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-',
981 (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-',
979 suffix=".txt", text=True)
982 suffix=extra['suffix'], text=True)
980 try:
983 try:
981 f = os.fdopen(fd, "w")
984 f = os.fdopen(fd, "w")
982 f.write(text)
985 f.write(text)
General Comments 0
You need to be logged in to leave comments. Login now