Mercurial > hg
changeset 945:f15901d053e1
Merge with MPM.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 18 Aug 2005 12:32:15 -0800 |
parents | 1300271ba8de (diff) 41ca6bf19735 (current diff) |
children | 6d21a3488df9 |
files | contrib/bash_completion contrib/mercurial.el doc/hg.1.txt doc/hgrc.5.txt mercurial/commands.py mercurial/hgweb.py |
diffstat | 6 files changed, 93 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/bash_completion Thu Aug 18 12:27:57 2005 -0800 +++ b/contrib/bash_completion Thu Aug 18 12:32:15 2005 -0800 @@ -19,6 +19,12 @@ COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$paths" -- "$cur" )) } +_hg_status() +{ + local files="$( hg status -$1 | cut -b 3- )" + COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$files" -- "$cur" )) +} + _hg_tags() { local tags="$(hg tags | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')" @@ -104,6 +110,24 @@ paths) _hg_paths ;; + add) + _hg_status "u" + ;; + commit) + _hg_status "mra" + ;; + remove) + _hg_status "r" + ;; + forget) + _hg_status "a" + ;; + diff) + _hg_status "mra" + ;; + revert) + _hg_status "mra" + ;; clone) local count=$(_hg_count_non_option) if [ $count = 1 ]; then @@ -126,4 +150,4 @@ } -complete -o filenames -F _hg hg +complete -o default -F _hg hg
--- a/doc/hg.1.txt Thu Aug 18 12:27:57 2005 -0800 +++ b/doc/hg.1.txt Thu Aug 18 12:32:15 2005 -0800 @@ -203,6 +203,8 @@ Currently only local repositories are supported. + aliases: in + init [dest]:: Initialize a new repository in the given directory. If the given directory does not exist, it is created. @@ -262,6 +264,8 @@ default push repo. These are the changesets that would be pushed if a push was requested. + aliases: out + parents:: Print the working directory's parent revisions.
--- a/doc/hgrc.5.txt Thu Aug 18 12:27:57 2005 -0800 +++ b/doc/hgrc.5.txt Thu Aug 18 12:32:15 2005 -0800 @@ -110,6 +110,24 @@ verbose;; Increase the amount of output printed. True or False. Default is False. +web:: + Web interface configuration. + name;; + Repository name to use in the web interface. Default is current + working directory. + address;; + Interface address to bind to. Default is all. + port;; + Port to listen on. Default is 8000. + ipv6;; + Whether to use IPv6. Default is false. + accesslog;; + Where to output the access log. Default is stdout. + errorlog;; + Where to output the error log. Default is stderr. + templates;; + Where to find the HTML templates. Default is install path. + AUTHOR ------ Bryan O'Sullivan <bos@serpentine.com>.
--- a/mercurial/commands.py Thu Aug 18 12:27:57 2005 -0800 +++ b/mercurial/commands.py Thu Aug 18 12:32:15 2005 -0800 @@ -1087,16 +1087,9 @@ r = repo.addchangegroup(fin) respond("") - def openlog(opt, default): - if opts[opt] and opts[opt] != '-': - return open(opts[opt], 'w') - else: - return default - httpd = hgweb.create_server(repo.root, opts["name"], opts["templates"], opts["address"], opts["port"], opts["ipv6"], - openlog('accesslog', sys.stdout), - openlog('errorlog', sys.stderr)) + opts['accesslog'], opts['errorlog']) if ui.verbose: addr, port = httpd.socket.getsockname() if addr == '0.0.0.0': @@ -1319,7 +1312,7 @@ [('p', 'strip', 1, 'path strip'), ('b', 'base', "", 'base path')], "hg import [-p NUM] [-b BASE] PATCH..."), - "incoming": (incoming, [], 'hg incoming [SOURCE]'), + "incoming|in": (incoming, [], 'hg incoming [SOURCE]'), "^init": (init, [], 'hg init [DEST]'), "locate": (locate, @@ -1335,7 +1328,7 @@ ('p', 'patch', None, 'show patch')], 'hg log [-r REV1 [-r REV2]] [-p] [FILE]'), "manifest": (manifest, [], 'hg manifest [REV]'), - "outgoing": (outgoing, [], 'hg outgoing [DEST]'), + "outgoing|out": (outgoing, [], 'hg outgoing [DEST]'), "parents": (parents, [], 'hg parents [REV]'), "paths": (paths, [], 'hg paths [NAME]'), "^pull": @@ -1368,9 +1361,9 @@ (serve, [('A', 'accesslog', '', 'access log file'), ('E', 'errorlog', '', 'error log file'), - ('p', 'port', 8000, 'listen port'), + ('p', 'port', 0, 'listen port'), ('a', 'address', '', 'interface address'), - ('n', 'name', os.getcwd(), 'repository name'), + ('n', 'name', "", 'repository name'), ('', 'stdio', None, 'for remote clients'), ('t', 'templates', "", 'template map'), ('6', 'ipv6', None, 'use IPv6 in addition to IPv4')],
--- a/mercurial/hgweb.py Thu Aug 18 12:27:57 2005 -0800 +++ b/mercurial/hgweb.py Thu Aug 18 12:32:15 2005 -0800 @@ -119,7 +119,7 @@ maxfiles = 10 def __init__(self, path, name, templates = ""): - self.templates = templates or templatepath() + self.templates = templates self.reponame = name self.path = path self.mtime = -1 @@ -603,7 +603,9 @@ self.refresh() args = cgi.parse() - m = os.path.join(self.templates, "map") + t = self.templates or self.repo.ui.config("web", "templates", + templatepath()) + m = os.path.join(t, "map") if args.has_key('style'): b = os.path.basename("map-" + args['style'][0]) p = os.path.join(self.templates, b) @@ -615,16 +617,18 @@ if "?" in uri: uri = uri.split("?")[0] url = "http://%s%s%s" % (os.environ["SERVER_NAME"], port, uri) + name = self.reponame or self.repo.ui.config("web", "name", os.getcwd()) + self.t = templater(m, self.filters, {"url":url, - "repo":self.reponame, + "repo":name, "header":header, "footer":footer, }) if not args.has_key('cmd'): args['cmd'] = [self.t.cache['default'],] - + if args['cmd'][0] == 'changelog': c = self.repo.changelog.count() - 1 hi = c @@ -705,6 +709,25 @@ def create_server(path, name, templates, address, port, use_ipv6 = False, accesslog = sys.stdout, errorlog = sys.stderr): + def openlog(opt, default): + if opt and opt != '-': + return open(opt, 'w') + return default + + u = ui() + repo = repository(u, path) + if not address: + address = u.config("web", "address", "") + if not port: + port = int(u.config("web", "port", 8000)) + if not use_ipv6: + use_ipv6 = u.configbool("web", "ipv6") + + accesslog = openlog(accesslog or u.config("web", "accesslog", "-"), + sys.stdout) + errorlog = openlog(errorlog or u.config("web", "errorlog", "-"), + sys.stderr) + import BaseHTTPServer class IPv6HTTPServer(BaseHTTPServer.HTTPServer): @@ -720,7 +743,7 @@ errorlog.write("%s - - [%s] %s\n" % (self.address_string(), self.log_date_time_string(), format % args)) - + def log_message(self, format, *args): accesslog.write("%s - - [%s] %s\n" % (self.address_string(), self.log_date_time_string(),