Show More
@@ -442,6 +442,7 b' class localrepository(object):' | |||||
442 | new = new.keys() |
|
442 | new = new.keys() | |
443 | new.sort() |
|
443 | new.sort() | |
444 |
|
444 | |||
|
445 | user = user or self.ui.username() | |||
445 | if not text: |
|
446 | if not text: | |
446 | edittext = [""] |
|
447 | edittext = [""] | |
447 | if p2 != nullid: |
|
448 | if p2 != nullid: | |
@@ -454,13 +455,12 b' class localrepository(object):' | |||||
454 | # run editor in the repository root |
|
455 | # run editor in the repository root | |
455 | olddir = os.getcwd() |
|
456 | olddir = os.getcwd() | |
456 | os.chdir(self.root) |
|
457 | os.chdir(self.root) | |
457 | edittext = self.ui.edit("\n".join(edittext)) |
|
458 | edittext = self.ui.edit("\n".join(edittext), user) | |
458 | os.chdir(olddir) |
|
459 | os.chdir(olddir) | |
459 | if not edittext.rstrip(): |
|
460 | if not edittext.rstrip(): | |
460 | return None |
|
461 | return None | |
461 | text = edittext |
|
462 | text = edittext | |
462 |
|
463 | |||
463 | user = user or self.ui.username() |
|
|||
464 | n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date) |
|
464 | n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date) | |
465 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, |
|
465 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, | |
466 | parent2=xp2) |
|
466 | parent2=xp2) |
@@ -194,7 +194,7 b' class ui(object):' | |||||
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") | |
@@ -205,9 +205,8 b' class ui(object):' | |||||
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': |
|
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() |
General Comments 0
You need to be logged in to leave comments.
Login now