changeset 4134:9dc64c8414ca

Merge with crew-stable
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 04 Mar 2007 09:03:21 -0300
parents b9dcee25be8e (current diff) a9ee6c53af8d (diff)
children 6cb6cfe43c5d
files hgext/mq.py mercurial/bdiff.c mercurial/hgweb/server.py mercurial/httprepo.py mercurial/localrepo.py mercurial/streamclone.py mercurial/util.py
diffstat 11 files changed, 38 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Sat Mar 03 18:59:54 2007 -0800
+++ b/hgext/mq.py	Sun Mar 04 09:03:21 2007 -0300
@@ -1738,7 +1738,10 @@
     if patch is None:
         raise util.Abort(_('no patch to work with'))
     if args or opts['none']:
-        q.set_guards(q.find_series(patch), args)
+        idx = q.find_series(patch)
+        if idx is None:
+            raise util.Abort(_('no patch named %s') % patch)
+        q.set_guards(idx, args)
         q.save_dirty()
     else:
         status(q.series.index(q.lookup(patch)))
--- a/mercurial/bdiff.c	Sat Mar 03 18:59:54 2007 -0800
+++ b/mercurial/bdiff.c	Sun Mar 04 09:03:21 2007 -0300
@@ -255,8 +255,8 @@
 	if (pos && l.base && t) {
 		/* generate the matching block list */
 		recurse(a, b, pos, 0, an, 0, bn, &l);
-		l.head->a1 = an;
-		l.head->b1 = bn;
+		l.head->a1 = l.head->a2 = an;
+		l.head->b1 = l.head->b2 = bn;
 		l.head++;
 	}
 
--- a/mercurial/hgweb/server.py	Sat Mar 03 18:59:54 2007 -0800
+++ b/mercurial/hgweb/server.py	Sun Mar 04 09:03:21 2007 -0300
@@ -197,6 +197,11 @@
                 pass
 
     class MercurialHTTPServer(object, _mixin, BaseHTTPServer.HTTPServer):
+        
+        # SO_REUSEADDR has broken semantics on windows
+        if os.name == 'nt':
+            allow_reuse_address = 0
+    
         def __init__(self, *args, **kargs):
             BaseHTTPServer.HTTPServer.__init__(self, *args, **kargs)
             self.accesslog = accesslog
--- a/mercurial/httprepo.py	Sat Mar 03 18:59:54 2007 -0800
+++ b/mercurial/httprepo.py	Sun Mar 04 09:03:21 2007 -0300
@@ -126,6 +126,7 @@
     def __init__(self, ui, path):
         self.path = path
         self.caps = None
+        self.handler = None
         scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
         if query or frag:
             raise util.Abort(_('unsupported URL component: "%s"') %
@@ -140,7 +141,8 @@
 
         proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy')
         # XXX proxyauthinfo = None
-        handlers = [httphandler()]
+        self.handler = httphandler()
+        handlers = [self.handler]
 
         if proxyurl:
             # proxy can be proper url or host[:port]
@@ -198,6 +200,11 @@
         # 1.0 here is the _protocol_ version
         opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
         urllib2.install_opener(opener)
+    
+    def __del__(self):
+        if self.handler:
+            self.handler.close_all()
+            self.handler = None
 
     def url(self):
         return self.path
--- a/mercurial/localrepo.py	Sat Mar 03 18:59:54 2007 -0800
+++ b/mercurial/localrepo.py	Sun Mar 04 09:03:21 2007 -0300
@@ -1880,6 +1880,8 @@
                 ofp.write(chunk)
             ofp.close()
         elapsed = time.time() - start
+        if elapsed <= 0:
+            elapsed = 0.001
         self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
                        (util.bytecount(total_bytes), elapsed,
                         util.bytecount(total_bytes / elapsed)))
--- a/mercurial/streamclone.py	Sat Mar 03 18:59:54 2007 -0800
+++ b/mercurial/streamclone.py	Sun Mar 04 09:03:21 2007 -0300
@@ -78,7 +78,7 @@
     entries = []
     total_bytes = 0
     for name, size in walkrepo(repo.spath):
-        name = util.pconvert(repo.decodefn(name))
+        name = repo.decodefn(util.pconvert(name))
         entries.append((name, size))
         total_bytes += size
     repolock.release()
--- a/mercurial/util.py	Sat Mar 03 18:59:54 2007 -0800
+++ b/mercurial/util.py	Sun Mar 04 09:03:21 2007 -0300
@@ -790,6 +790,14 @@
                 if inst.errno != 0: raise
                 self.close()
                 raise IOError(errno.EPIPE, 'Broken pipe')
+                
+        def flush(self):
+            try:
+                return self.fp.flush()
+            except IOError, inst:
+                if inst.errno != errno.EINVAL: raise
+                self.close()
+                raise IOError(errno.EPIPE, 'Broken pipe')
 
     sys.stdout = winstdout(sys.stdout)
 
--- a/tests/test-http	Sat Mar 03 18:59:54 2007 -0800
+++ b/tests/test-http	Sun Mar 04 09:03:21 2007 -0300
@@ -6,6 +6,8 @@
 hg commit -A -d '0 0' -m 1
 hg --config server.uncompressed=True serve -p 20059 -d --pid-file=../hg1.pid
 hg serve -p 20060 -d --pid-file=../hg2.pid
+# Test server address cannot be reused
+hg serve -p 20060 2>&1 | sed -e 's/abort: cannot start server:.*/abort: cannot start server:/'
 cd ..
 cat hg1.pid hg2.pid >> $DAEMON_PIDS
 
--- a/tests/test-http.out	Sat Mar 03 18:59:54 2007 -0800
+++ b/tests/test-http.out	Sun Mar 04 09:03:21 2007 -0300
@@ -1,4 +1,5 @@
 adding foo
+abort: cannot start server:
 % clone via stream
 streaming all changes
 XXX files to transfer, XXX bytes of data
--- a/tests/test-mq-guards	Sat Mar 03 18:59:54 2007 -0800
+++ b/tests/test-mq-guards	Sun Mar 04 09:03:21 2007 -0300
@@ -27,6 +27,9 @@
 hg qpop -a
 
 echo % should fail
+hg qguard does-not-exist.patch +bleh
+
+echo % should fail
 hg qguard +fail
 
 hg qpush
--- a/tests/test-mq-guards.out	Sat Mar 03 18:59:54 2007 -0800
+++ b/tests/test-mq-guards.out	Sun Mar 04 09:03:21 2007 -0300
@@ -1,6 +1,8 @@
 adding x
 Patch queue now empty
 % should fail
+abort: no patch named does-not-exist.patch
+% should fail
 abort: no patches applied
 applying a.patch
 Now at: a.patch