# HG changeset patch # User bos@serpentine.internal.keyresearch.com # Date 1125336701 25200 # Node ID d32b91ebad5d1cda40ade0eed01d4d335be515d0 # Parent 9061f79c6c6f12e6b33f8b8bf875aa33dc26d347# Parent 8a39df05d2c18764ee56d4f2ff575e300ddb101b Merge with TAH. diff -r 9061f79c6c6f -r d32b91ebad5d contrib/patchbomb --- a/contrib/patchbomb Mon Aug 29 10:05:49 2005 -0700 +++ b/contrib/patchbomb Mon Aug 29 10:31:41 2005 -0700 @@ -107,6 +107,7 @@ def makepatch(patch, idx, total): desc = [] node = None + body = '' for line in patch: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] @@ -191,8 +192,9 @@ ui.write('\n') - d = cdiffstat('Final summary:\n', jumbo) - if d: msg.attach(MIMEText(d)) + if opts['diffstat']: + d = cdiffstat('Final summary:\n', jumbo) + if d: msg.attach(MIMEText(d)) msgs.insert(0, msg) diff -r 9061f79c6c6f -r d32b91ebad5d hgwebdir.cgi --- a/hgwebdir.cgi Mon Aug 29 10:05:49 2005 -0700 +++ b/hgwebdir.cgi Mon Aug 29 10:31:41 2005 -0700 @@ -13,5 +13,8 @@ # virtual/path = /real/path # virtual/path = /real/path +# Alternatively you can pass a list of ('virtual/path', '/real/path') tuples +# or use a dictionary with entries like 'virtual/path': '/real/path' + h = hgweb.hgwebdir("hgweb.config") h.run() diff -r 9061f79c6c6f -r d32b91ebad5d mercurial/commands.py --- a/mercurial/commands.py Mon Aug 29 10:05:49 2005 -0700 +++ b/mercurial/commands.py Mon Aug 29 10:31:41 2005 -0700 @@ -297,20 +297,12 @@ tn = None fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text)) -def trimuser(ui, rev, name, revcache): +def trimuser(ui, name, rev, revcache): """trim the name of the user who committed a change""" - try: - return revcache[rev] - except KeyError: - if not ui.verbose: - f = name.find('@') - if f >= 0: - name = name[:f] - f = name.find('<') - if f >= 0: - name = name[f+1:] - revcache[rev] = name - return name + user = revcache.get(rev) + if user is None: + user = revcache[rev] = ui.shortuser(name) + return user def show_changeset(ui, repo, rev=0, changenode=None, brinfo=None): """show a single changeset or file revision""" @@ -517,7 +509,7 @@ ucache = {} def getname(rev): cl = repo.changelog.read(repo.changelog.node(rev)) - return trimuser(ui, rev, cl[1], ucache) + return trimuser(ui, cl[1], rev, ucache) if not pats: raise util.Abort('at least one file name or pattern required') @@ -630,8 +622,8 @@ repo = hg.repository(ui, dest, create=1) repo.pull(other) - f = repo.opener("hgrc", "w") - f.write("[paths]\n") + f = repo.opener("hgrc", "a") + f.write("\n[paths]\n") f.write("default = %s\n" % abspath) if not opts['noupdate']: @@ -726,9 +718,8 @@ % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2], time.strftime("%x %X", time.localtime(dc[file_][3])), file_)) - ui.write("\n") for f in repo.dirstate.copies: - ui.write("%s -> %s\n" % (repo.dirstate.copies[f], f)) + ui.write("copy: %s -> %s\n" % (repo.dirstate.copies[f], f)) def debugdata(ui, file_, rev): """dump the contents of an data file revision""" @@ -922,7 +913,7 @@ cols = [fn, str(rev)] if opts['line_number']: cols.append(str(l.linenum)) if opts['every_match']: cols.append(change) - if opts['user']: cols.append(trimuser(ui, rev, getchange(rev)[1], + if opts['user']: cols.append(trimuser(ui, getchange(rev)[1], rev, ucache)) if opts['files_with_matches']: c = (fn, rev) diff -r 9061f79c6c6f -r d32b91ebad5d mercurial/hgweb.py --- a/mercurial/hgweb.py Mon Aug 29 10:05:49 2005 -0700 +++ b/mercurial/hgweb.py Mon Aug 29 10:31:41 2005 -0700 @@ -507,14 +507,7 @@ name = bcache[r] except KeyError: cl = self.repo.changelog.read(cnode) - name = cl[1] - f = name.find('@') - if f >= 0: - name = name[:f] - f = name.find('<') - if f >= 0: - name = name[f+1:] - bcache[r] = name + bcache[r] = name = self.repo.ui.shortuser(cl[1]) if last != cnode: parity = 1 - parity @@ -929,8 +922,16 @@ # This is a stopgap class hgwebdir: def __init__(self, config): - self.cp = ConfigParser.SafeConfigParser() - self.cp.read(config) + if type(config) == type([]): + self.repos = config + elif type(config) == type({}): + self.repos = config.items() + self.repos.sort() + else: + cp = ConfigParser.SafeConfigParser() + cp.read(config) + self.repos = cp.items("paths") + self.repos.sort() def run(self): def header(**map): @@ -939,53 +940,37 @@ def footer(**map): yield tmpl("footer", **map) - templates = templatepath() - m = os.path.join(templates, "map") + m = os.path.join(templatepath(), "map") tmpl = templater(m, common_filters, {"header": header, "footer": footer}) def entries(**map): parity = 0 - l = self.cp.items("paths") - l.sort() - for v,r in l: - cp2 = ConfigParser.SafeConfigParser() - cp2.read(os.path.join(r, ".hg", "hgrc")) + for name, path in self.repos: + u = ui() + u.readconfig(file(os.path.join(path, '.hg', 'hgrc'))) + get = u.config - def get(sec, val, default): - try: - return cp2.get(sec, val) - except: - return default + url = ('/'.join([os.environ["REQUEST_URI"], name]) + .replace("//", "/")) - url = os.environ["REQUEST_URI"] + "/" + v - url = url.replace("//", "/") - - yield dict(author=get("web", "author", "unknown"), - name=get("web", "name", v), + yield dict(contact=get("web", "contact") or + get("web", "author", "unknown"), + name=get("web", "name", name), url=url, parity=parity, shortdesc=get("web", "description", "unknown"), - lastupdate=os.stat(os.path.join(r, ".hg", - "00changelog.d")).st_mtime) + lastupdate=os.stat(os.path.join(path, ".hg", + "00changelog.d")).st_mtime) parity = 1 - parity - try: - virtual = os.environ["PATH_INFO"] - except: - virtual = "" - - virtual = virtual.strip('/') - - if len(virtual): - if self.cp.has_option("paths", virtual): - real = self.cp.get("paths", virtual) - h = hgweb(real) - h.run() - return + virtual = os.environ.get("PATH_INFO", "").strip('/') + if virtual: + real = dict(self.repos).get(virtual) + if real: + hgweb(real).run() else: - write(tmpl("notfound", repo = virtual)) - return - - write(tmpl("index", entries=entries)) + write(tmpl("notfound", repo=virtual)) + else: + write(tmpl("index", entries=entries)) diff -r 9061f79c6c6f -r d32b91ebad5d mercurial/localrepo.py --- a/mercurial/localrepo.py Mon Aug 29 10:05:49 2005 -0700 +++ b/mercurial/localrepo.py Mon Aug 29 10:31:41 2005 -0700 @@ -27,11 +27,6 @@ self.root = os.path.abspath(path) self.ui = ui - - if create: - os.mkdir(self.path) - os.mkdir(self.join("data")) - self.opener = util.opener(self.path) self.wopener = util.opener(self.root) self.manifest = manifest.manifest(self.opener) @@ -39,6 +34,13 @@ self.tagscache = None self.nodetagscache = None + if create: + os.mkdir(self.path) + os.mkdir(self.join("data")) + f = self.opener("hgrc", "w") + f.write("[web]\n") + f.write("contact = %s\n" % ui.shortuser(ui.username())) + self.dirstate = dirstate.dirstate(self.opener, ui, self.root) try: self.ui.readconfig(self.opener("hgrc")) diff -r 9061f79c6c6f -r d32b91ebad5d mercurial/ui.py --- a/mercurial/ui.py Mon Aug 29 10:05:49 2005 -0700 +++ b/mercurial/ui.py Mon Aug 29 10:31:41 2005 -0700 @@ -78,6 +78,17 @@ os.environ.get("USERNAME", "unknown")) + '@' + socket.getfqdn())) + def shortuser(self, user): + """Return a short representation of a user name or email address.""" + if not self.verbose: + f = user.find('@') + if f >= 0: + user = user[:f] + f = user.find('<') + if f >= 0: + user = user[f+1:] + return user + def expandpath(self, loc): paths = {} for name, path in self.configitems("paths"): diff -r 9061f79c6c6f -r d32b91ebad5d templates/map --- a/templates/map Mon Aug 29 10:05:49 2005 -0700 +++ b/templates/map Mon Aug 29 10:31:41 2005 -0700 @@ -35,7 +35,7 @@ changesettag = "tag:#tag#" filediffparent = "parent #rev#:#node|short#" filelogparent = "parent #rev#: #node|short#" -indexentry = "#name##shortdesc##author##email|obfuscate##lastupdate|age# agoRSS" +indexentry = "#name##shortdesc##contact|obfuscate##lastupdate|age# agoRSS" index = index.tmpl archiveentry = "#type# " notfound = notfound.tmpl diff -r 9061f79c6c6f -r d32b91ebad5d templates/notfound.tmpl --- a/templates/notfound.tmpl Mon Aug 29 10:05:49 2005 -0700 +++ b/templates/notfound.tmpl Mon Aug 29 10:31:41 2005 -0700 @@ -7,6 +7,6 @@ The specified repository "#repo#" is unknown, sorry. -Go back to main page, please click here +Please go back to the main repository list page. #footer# diff -r 9061f79c6c6f -r d32b91ebad5d tests/test-copy2 --- a/tests/test-copy2 Mon Aug 29 10:05:49 2005 -0700 +++ b/tests/test-copy2 Mon Aug 29 10:31:41 2005 -0700 @@ -8,11 +8,11 @@ echo "# should show copy" cp foo bar hg copy foo bar -hg debugstate +hg debugstate|grep ^copy echo "# shouldn't show copy" hg commit -m2 -d"0 0" -hg debugstate +hg debugstate|grep ^copy echo "# should match" hg debugindex .hg/data/foo.i @@ -28,7 +28,7 @@ cp foo bar hg copy foo bar echo "# should show copy" -hg debugstate +hg debugstate|grep ^copy hg commit -m3 -d"0 0" echo "# should show no parents for tip" @@ -38,4 +38,6 @@ hg debugrename bar echo "# should show no copies" -hg debugstate \ No newline at end of file +hg debugstate|grep ^copy + +exit 0 diff -r 9061f79c6c6f -r d32b91ebad5d tests/test-copy2.out --- a/tests/test-copy2.out Mon Aug 29 10:05:49 2005 -0700 +++ b/tests/test-copy2.out Mon Aug 29 10:31:41 2005 -0700 @@ -1,12 +1,6 @@ # should show copy -a 644 4 08/28/05 05:00:19 bar -n 644 4 08/28/05 05:00:19 foo - -foo -> bar +copy: foo -> bar # shouldn't show copy -n 644 4 08/28/05 05:00:19 bar -n 644 4 08/28/05 05:00:19 foo - # should match rev offset length base linkrev nodeid p1 p2 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000 @@ -14,10 +8,7 @@ # should not be renamed not renamed # should show copy -n 644 5 08/28/05 05:00:19 bar -n 644 6 08/28/05 05:00:19 foo - -foo -> bar +copy: foo -> bar # should show no parents for tip rev offset length base linkrev nodeid p1 p2 0 0 69 0 1 6ca237634e1f 000000000000 000000000000 @@ -29,6 +20,3 @@ 1 5 7 1 2 dd12c926cf16 2ed2a3912a0b 000000000000 renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17 # should show no copies -n 644 6 08/28/05 05:00:19 bar -n 644 6 08/28/05 05:00:19 foo - diff -r 9061f79c6c6f -r d32b91ebad5d tests/test-hup.out --- a/tests/test-hup.out Mon Aug 29 10:05:49 2005 -0700 +++ b/tests/test-hup.out Mon Aug 29 10:31:41 2005 -0700 @@ -7,4 +7,5 @@ 00changelog.d 00changelog.i data +hgrc journal.dirstate diff -r 9061f79c6c6f -r d32b91ebad5d tests/test-static-http --- a/tests/test-static-http Mon Aug 29 10:05:49 2005 -0700 +++ b/tests/test-static-http Mon Aug 29 10:31:41 2005 -0700 @@ -31,7 +31,7 @@ cd .. -hg clone old-http://localhost:20059/remote local +http_proxy= hg clone old-http://localhost:20059/remote local cd local hg verify