Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 608:d2994b5298fb
Add username/merge/editor to .hgrc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Add username/merge/editor to .hgrc
These take priority over the equivalent environment vars
Deprecate HGMERGE, HGUSER, and HGEDITOR in docs
Add ui section to docs
Remove undocumented HG_OPTS
Raise username code out of changelog class
Make tests ignore ~/.hgrc
manifest hash: d127ef02bc5266036b4c77a55319519e91bd475b
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCyM5NywK+sNU5EO8RAuU7AJ9zKk1TFrJXHM04jOOJJeBSp8jlTgCeP+tr
qwGFd+WaNqTepZ0wun5g9Uc=
=QEBu
-----END PGP SIGNATURE-----
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 03 Jul 2005 21:51:09 -0800 |
parents | 9a80418646dd |
children | 5374955ec5b1 |
comparison
equal
deleted
inserted
replaced
607:94744f6fe0e7 | 608:d2994b5298fb |
---|---|
39 def configitems(self, section): | 39 def configitems(self, section): |
40 if self.cdata.has_section(section): | 40 if self.cdata.has_section(section): |
41 return self.cdata.items(section) | 41 return self.cdata.items(section) |
42 return [] | 42 return [] |
43 | 43 |
44 def username(self): | |
45 return (self.config("ui", "username") or | |
46 os.environ.get("HGUSER") or | |
47 os.environ.get("EMAIL") or | |
48 (os.environ.get("LOGNAME", | |
49 os.environ.get("USERNAME", "unknown")) | |
50 + '@' + socket.getfqdn())) | |
51 | |
44 def expandpath(self, loc): | 52 def expandpath(self, loc): |
45 paths = {} | 53 paths = {} |
46 for name, path in self.configitems("paths"): | 54 for name, path in self.configitems("paths"): |
47 paths[name] = path | 55 paths[name] = path |
48 | 56 |
81 (fd, name) = tempfile.mkstemp("hg") | 89 (fd, name) = tempfile.mkstemp("hg") |
82 f = os.fdopen(fd, "w") | 90 f = os.fdopen(fd, "w") |
83 f.write(text) | 91 f.write(text) |
84 f.close() | 92 f.close() |
85 | 93 |
86 editor = os.environ.get("HGEDITOR") or os.environ.get("EDITOR", "vi") | 94 editor = (self.config("ui", "editor") or |
95 os.environ.get("HGEDITOR") or | |
96 os.environ.get("EDITOR", "vi")) | |
97 | |
87 util.system("%s %s" % (editor, name), errprefix = "edit failed") | 98 util.system("%s %s" % (editor, name), errprefix = "edit failed") |
88 | 99 |
89 t = open(name).read() | 100 t = open(name).read() |
90 t = re.sub("(?m)^HG:.*\n", "", t) | 101 t = re.sub("(?m)^HG:.*\n", "", t) |
91 | 102 |