changeset 2545:cff57cb5631e

Merge with crew.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 30 Jun 2006 22:09:43 +0200
parents 0ab63318bc36 (diff) c49dc6f38a19 (current diff)
children 8cb894370514
files
diffstat 19 files changed, 201 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jun 30 21:35:22 2006 +0200
+++ b/Makefile	Fri Jun 30 22:09:43 2006 +0200
@@ -37,12 +37,20 @@
 	rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err
 	$(MAKE) -C doc clean
 
-install: all
+install: install-bin install-doc
+
+install-bin: build
 	$(PYTHON) setup.py install --prefix="$(PREFIX)" --force
+
+install-doc: doc
 	cd doc && $(MAKE) $(MFLAGS) install
 
-install-home: all
+install-home: install-home-bin install-home-doc
+
+install-home-bin: build
 	$(PYTHON) setup.py install --home="$(HOME)" --force
+
+install-home-doc: doc
 	cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
 
 dist:	tests dist-notests
@@ -57,5 +65,5 @@
 	cd tests && $(PYTHON) run-tests.py $@
 
 
-.PHONY: help all local build doc clean install install-home dist dist-notests tests
-
+.PHONY: help all local build doc clean install install-bin install-doc \
+	install-home install-home-bin install-home-doc dist dist-notests tests
--- a/hgext/mq.py	Fri Jun 30 21:35:22 2006 +0200
+++ b/hgext/mq.py	Fri Jun 30 22:09:43 2006 +0200
@@ -1083,6 +1083,7 @@
     return 0
 
 def commit(ui, repo, *pats, **opts):
+    """commit changes in the queue repository"""
     q = repomap[repo]
     r = q.qrepo()
     if not r: raise util.Abort('no queue repository')
@@ -1264,7 +1265,7 @@
          'hg qimport [-e] [-n NAME] [-f] FILE...'),
     "^qinit":
         (init,
-         [('c', 'create-repo', None, 'create patch repository')],
+         [('c', 'create-repo', None, 'create queue repository')],
          'hg qinit [-c]'),
     "qnew":
         (new,
--- a/mercurial/bdiff.c	Fri Jun 30 21:35:22 2006 +0200
+++ b/mercurial/bdiff.c	Fri Jun 30 22:09:43 2006 +0200
@@ -38,7 +38,7 @@
 #else
 #include <sys/types.h>
 #include <arpa/inet.h>
-#include <stdint.h>
+#include <inttypes.h>
 #endif
 
 struct line {
--- a/mercurial/commands.py	Fri Jun 30 21:35:22 2006 +0200
+++ b/mercurial/commands.py	Fri Jun 30 22:09:43 2006 +0200
@@ -3034,7 +3034,7 @@
           ('', 'remotecmd', '',
            _('specify hg command to run on the remote side'))],
          _('hg incoming [-p] [-n] [-M] [-r REV]...'
-           '[--bundle FILENAME] [SOURCE]')),
+           ' [--bundle FILENAME] [SOURCE]')),
     "^init": (init, [], _('hg init [DEST]')),
     "locate":
         (locate,
--- a/mercurial/hgweb/hgweb_mod.py	Fri Jun 30 21:35:22 2006 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Fri Jun 30 22:09:43 2006 +0200
@@ -650,13 +650,28 @@
             raise Exception("suspicious path")
         return p
 
-    def run(self, req):
+    def run(self):
+        if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
+            raise RuntimeError("This function is only intended to be called while running as a CGI script.")
+        import mercurial.hgweb.wsgicgi as wsgicgi
+        from request import wsgiapplication
+        def make_web_app():
+            return self
+        wsgicgi.launch(wsgiapplication(make_web_app))
+
+    def run_wsgi(self, req):
         def header(**map):
             header_file = cStringIO.StringIO(''.join(self.t("header", **map)))
             msg = mimetools.Message(header_file, 0)
             req.header(msg.items())
             yield header_file.read()
 
+        def rawfileheader(**map):
+            req.header([('Content-type', map['mimetype']),
+                        ('Content-disposition', 'filename=%s' % map['file']),
+                        ('Content-length', str(len(map['raw'])))])
+            yield ''
+
         def footer(**map):
             yield self.t("footer",
                          motd=self.repo.ui.config("web", "motd", ""),
@@ -714,6 +729,7 @@
                                                "repo": self.reponame,
                                                "header": header,
                                                "footer": footer,
+                                               "rawfileheader": rawfileheader,
                                                })
 
         if not req.form.has_key('cmd'):
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 21:35:22 2006 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 22:09:43 2006 +0200
@@ -46,7 +46,16 @@
                         self.repos.append((name.lstrip(os.sep), repo))
             self.repos.sort()
 
-    def run(self, req):
+    def run(self):
+        if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
+            raise RuntimeError("This function is only intended to be called while running as a CGI script.")
+        import mercurial.hgweb.wsgicgi as wsgicgi
+        from request import wsgiapplication
+        def make_web_app():
+            return self
+        wsgicgi.launch(wsgiapplication(make_web_app))
+
+    def run_wsgi(self, req):
         def header(**map):
             header_file = cStringIO.StringIO(''.join(tmpl("header", **map)))
             msg = mimetools.Message(header_file, 0)
@@ -124,7 +133,7 @@
             real = dict(self.repos).get(virtual)
             if real:
                 try:
-                    hgweb(real).run(req)
+                    hgweb(real).run_wsgi(req)
                 except IOError, inst:
                     req.write(tmpl("error", error=inst.strerror))
                 except hg.RepoError, inst:
--- a/mercurial/hgweb/request.py	Fri Jun 30 21:35:22 2006 +0200
+++ b/mercurial/hgweb/request.py	Fri Jun 30 22:09:43 2006 +0200
@@ -48,7 +48,7 @@
         self.form = cgi.parse(self.inp, self.env, keep_blank_values=1)
         self.start_response = start_response
         self.headers = []
-        destination.run(self)
+        destination.run_wsgi(self)
 
     def __iter__(self):
         return iter([])
--- a/mercurial/mpatch.c	Fri Jun 30 21:35:22 2006 +0200
+++ b/mercurial/mpatch.c	Fri Jun 30 22:09:43 2006 +0200
@@ -43,7 +43,7 @@
 /* not windows */
 # include <sys/types.h>
 # include <arpa/inet.h>
-# include <stdint.h>
+# include <inttypes.h>
 #endif
 
 static char mpatch_doc[] = "Efficient binary patching.";
--- a/mercurial/templater.py	Fri Jun 30 21:35:22 2006 +0200
+++ b/mercurial/templater.py	Fri Jun 30 22:09:43 2006 +0200
@@ -202,7 +202,7 @@
     if para_re is None:
         para_re = re.compile('(\n\n|\n\\s*[-*]\\s*)', re.M)
         space_re = re.compile(r'  +')
-        
+
     def findparas():
         start = 0
         while True:
--- a/templates/map-raw	Fri Jun 30 21:35:22 2006 +0200
+++ b/templates/map-raw	Fri Jun 30 22:09:43 2006 +0200
@@ -8,7 +8,7 @@
 changesetparent = '# Parent #node#'
 changesetchild = '# Child #node#'
 filenodelink = ''
-filerevision = 'Content-Type: #mimetype#\nContent-Disposition: filename=#file#\n\n#raw#'
+filerevision = '#rawfileheader##raw#'
 fileline = '#line#'
 diffblock = '#lines#'
 filediff = filediff-raw.tmpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/get-with-headers.py	Fri Jun 30 22:09:43 2006 +0200
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+__doc__ = """This does HTTP get requests given a host:port and path and returns
+a subset of the headers plus the body of the result."""
+
+import httplib, sys
+headers = [h.lower() for h in sys.argv[3:]]
+conn = httplib.HTTPConnection(sys.argv[1])
+conn.request("GET", sys.argv[2])
+response = conn.getresponse()
+print response.status, response.reason
+for h in headers:
+    if response.getheader(h, None) is not None:
+        print "%s: %s" % (h, response.getheader(h))
+print
+sys.stdout.write(response.read())
--- a/tests/test-globalopts	Fri Jun 30 21:35:22 2006 +0200
+++ b/tests/test-globalopts	Fri Jun 30 22:09:43 2006 +0200
@@ -62,7 +62,7 @@
 hg --cwd a --time tip 2>&1 | grep '^Time:' | sed 's/[0-9][0-9]*/x/g'
 
 echo %% --version
-hg --version -q | sed 's/version \([a-f0-9+]*\|unknown\)/version xxx/'
+hg --version -q | sed 's/version [^)]*/version xxx/'
 
 echo %% -h/--help
 hg -h
--- a/tests/test-http-proxy	Fri Jun 30 21:35:22 2006 +0200
+++ b/tests/test-http-proxy	Fri Jun 30 22:09:43 2006 +0200
@@ -26,5 +26,5 @@
 echo %% bad host:port for proxy
 http_proxy=localhost:20061 hg clone --config http_proxy.always=True http://localhost:20059/ f
 
-kill $(cat proxy.pid a/hg.pid)
+kill `cat proxy.pid a/hg.pid`
 exit 0
--- a/tests/test-hup	Fri Jun 30 21:35:22 2006 +0200
+++ b/tests/test-hup	Fri Jun 30 22:09:43 2006 +0200
@@ -7,7 +7,7 @@
 P=$!
 (echo lock; echo addchangegroup; sleep 5) > p &
 Q=$!
-sleep 1
+sleep 3
 kill -HUP $P
 wait
 ls .hg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-oldcgi	Fri Jun 30 22:09:43 2006 +0200
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+hg init test
+
+cat >hgweb.cgi <<HGWEB
+#!/usr/bin/env python
+#
+# An example CGI script to use hgweb, edit as necessary
+
+import cgitb, os, sys
+cgitb.enable()
+
+# sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
+from mercurial import hgweb
+
+h = hgweb.hgweb("test", "Empty test repository")
+h.run()
+HGWEB
+chmod 755 hgweb.cgi
+
+cat >hgweb.config <<HGWEBDIRCONF
+[paths]
+test = test
+HGWEBDIRCONF
+
+cat >hgwebdir.cgi <<HGWEBDIR
+#!/usr/bin/env python
+#
+# An example CGI script to export multiple hgweb repos, edit as necessary
+
+import cgitb, sys
+cgitb.enable()
+
+# sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
+from mercurial import hgweb
+
+# The config file looks like this.  You can have paths to individual
+# repos, collections of repos in a directory tree, or both.
+#
+# [paths]
+# virtual/path = /real/path
+# virtual/path = /real/path
+#
+# [collections]
+# /prefix/to/strip/off = /root/of/tree/full/of/repos
+#
+# collections example: say directory tree /foo contains repos /foo/bar,
+# /foo/quux/baz.  Give this config section:
+#   [collections]
+#   /foo = /foo
+# Then repos will list as bar and quux/baz.
+
+# 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()
+HGWEBDIR
+chmod 755 hgwebdir.cgi
+
+DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
+GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
+HTTP_ACCEPT="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; export HTTP_ACCEPT
+HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
+HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
+HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
+HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
+HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
+HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
+HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
+HTTP_USER_AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Firefox/1.5.0.4"; export HTTP_USER_AGENT
+PATH_INFO="/"; export PATH_INFO
+PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
+QUERY_STRING=""; export QUERY_STRING
+REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
+REMOTE_PORT="44703"; export REMOTE_PORT
+REQUEST_METHOD="GET"; export REQUEST_METHOD
+REQUEST_URI="/test/"; export REQUEST_URI
+SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
+SCRIPT_NAME="/test"; export SCRIPT_NAME
+SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
+SCRIPT_URL="/test/"; export SCRIPT_URL
+SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
+SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
+SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
+SERVER_PORT="80"; export SERVER_PORT
+SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
+SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>\; export SERVER_SIGNATURE
+"
+SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
+./hgweb.cgi >page1 2>&1 ; echo $?
+./hgwebdir.cgi >page2 2>&1 ; echo $?
+PATH_INFO="/test/"
+PATH_TRANSLATED="/var/something/test.cgi"
+REQUEST_URI="/test/test/"
+SCRIPT_URI="http://hg.omnifarious.org/test/test/"
+SCRIPT_URL="/test/test/"
+./hgwebdir.cgi >page3 2>&1 ; echo $?
+fgrep -i error page1 page2 page3 && exit 1
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-oldcgi.out	Fri Jun 30 22:09:43 2006 +0200
@@ -0,0 +1,3 @@
+0
+0
+0
--- a/tests/test-pull-pull-corruption2	Fri Jun 30 21:35:22 2006 +0200
+++ b/tests/test-pull-pull-corruption2	Fri Jun 30 22:09:43 2006 +0200
@@ -20,5 +20,6 @@
 sleep 1
 
 hg clone --pull -U version2 corrupted
+wait
 hg -R corrupted verify
 hg -R version2 verify
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-webraw	Fri Jun 30 22:09:43 2006 +0200
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+hg init test
+cd test
+cat >sometext.txt <<ENDSOME
+This is just some random text
+that will go inside the file and take a few lines.
+It is very boring to read, but computers don't
+care about things like that.
+ENDSOME
+hg add sometext.txt
+hg commit -d "1 0" -m "Just some text"
+hg serve -p 20059 -A access.log -E error.log -d --pid-file=hg.pid
+("$TESTDIR/get-with-headers.py" localhost:20059 '/?f=f165dc289438;file=sometext.txt;style=raw' content-type content-length content-disposition) >getoutput.txt &
+
+sleep 5
+kill `cat hg.pid`
+sleep 1 # wait for server to scream and die
+cat getoutput.txt
+cat access.log error.log | sed 's/^\([^[]*\[\)[^]]*\(\].*\)$/\1date\2/g'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-webraw.out	Fri Jun 30 22:09:43 2006 +0200
@@ -0,0 +1,10 @@
+200 Script output follows
+content-type: text/plain
+content-length: 157
+content-disposition: filename=sometext.txt
+
+This is just some random text
+that will go inside the file and take a few lines.
+It is very boring to read, but computers don't
+care about things like that.
+localhost - - [date] "GET /?f=f165dc289438;file=sometext.txt;style=raw HTTP/1.1" 200 -