equal
deleted
inserted
replaced
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 |