comparison mercurial/ui.py @ 1983:ae12a81549a7

Pass correct username as $HGUSER to hgeditor if "commit -u" is used. And only use the new util.system parameter to set the environment.
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 21 Mar 2006 12:45:27 +0100
parents 696230e52e4d
children df7436f439a0
comparison
equal deleted inserted replaced
1982:70ba0c86da8b 1983:ae12a81549a7
192 self.write_err(*msg) 192 self.write_err(*msg)
193 def note(self, *msg): 193 def note(self, *msg):
194 if self.verbose: self.write(*msg) 194 if self.verbose: self.write(*msg)
195 def debug(self, *msg): 195 def debug(self, *msg):
196 if self.debugflag: self.write(*msg) 196 if self.debugflag: self.write(*msg)
197 def edit(self, text): 197 def edit(self, text, user):
198 import tempfile 198 import tempfile
199 (fd, name) = tempfile.mkstemp("hg") 199 (fd, name) = tempfile.mkstemp("hg")
200 f = os.fdopen(fd, "w") 200 f = os.fdopen(fd, "w")
201 f.write(text) 201 f.write(text)
202 f.close() 202 f.close()
203 203
204 editor = (os.environ.get("HGEDITOR") or 204 editor = (os.environ.get("HGEDITOR") or
205 self.config("ui", "editor") or 205 self.config("ui", "editor") or
206 os.environ.get("EDITOR", "vi")) 206 os.environ.get("EDITOR", "vi"))
207 207
208 os.environ["HGUSER"] = self.username()
209 util.system("%s \"%s\"" % (editor, name), 208 util.system("%s \"%s\"" % (editor, name),
210 environ={'HGUSER': self.username()}, 209 environ={'HGUSER': user},
211 onerr=util.Abort, errprefix=_("edit failed")) 210 onerr=util.Abort, errprefix=_("edit failed"))
212 211
213 t = open(name).read() 212 t = open(name).read()
214 t = re.sub("(?m)^HG:.*\n", "", t) 213 t = re.sub("(?m)^HG:.*\n", "", t)
215 214