mercurial/ui.py
changeset 608 d2994b5298fb
parent 565 9a80418646dd
child 613 5374955ec5b1
--- a/mercurial/ui.py	Sun Jul 03 21:14:40 2005 -0800
+++ b/mercurial/ui.py	Sun Jul 03 21:51:09 2005 -0800
@@ -41,6 +41,14 @@
             return self.cdata.items(section)
         return []
 
+    def username(self):
+        return (self.config("ui", "username") or
+                os.environ.get("HGUSER") or
+                os.environ.get("EMAIL") or
+                (os.environ.get("LOGNAME",
+                                os.environ.get("USERNAME", "unknown"))
+                 + '@' + socket.getfqdn()))
+
     def expandpath(self, loc):
         paths = {}
         for name, path in self.configitems("paths"):
@@ -83,7 +91,10 @@
         f.write(text)
         f.close()
 
-        editor = os.environ.get("HGEDITOR") or os.environ.get("EDITOR", "vi")
+        editor = (self.config("ui", "editor") or
+                  os.environ.get("HGEDITOR") or
+                  os.environ.get("EDITOR", "vi"))
+
         util.system("%s %s" % (editor, name), errprefix = "edit failed")
 
         t = open(name).read()