Two small hg problems: test-bad-pull, --dry-run

Alexis S. L. Carvalho alexis at cecm.usp.br
Fri Jun 16 08:31:10 CDT 2006


Thus spake Thomas Arendsen Hein:
> 1. In 2f5dbc24874a you changed the test output, but I still get the
> old output, so the test fails for me.

(ITYM a765f853439d)

urlgrabber bug, fixed in current CVS.  See patch below, also pullable
from http://www.cecm.usp.br/~alexis/cgi-bin/hgwebdir.cgi/out

> 2. You added -n/--dry-run to some commands, but external tools like
> tailor don't set this in **opts, and so "not opts['dry_run']"
> will fail. Using opts.get('dry_run') helps here.

Instead of opts.get(...), I'd rather have an official interface for
external tools to call the command functions from commands.py (e.g.
commands.execute("add", ui, repo, *args, **opts) where opts would
override the default arguments), or at least a function to get a
dictionary with the default arguments to the command function.

Alexis

# HG changeset patch
# User Alexis S. L. Carvalho <alexis at cecm.usp.br>
# Date 1150462837 10800
# Node ID 5eb02f9ed80449fe0dd72e5e794f6a727b2b8ef7
# Parent  c660691fb45d2cc1a411556e877e796c5a80b84c
Update keepalive.py to current CVS version of urlgrabber.

This fixes a bug where the output of test-bad-pull would differ
between python 2.3 and 2.4.  Also update the expected output of
this test.

diff -r c660691fb45d -r 5eb02f9ed804 mercurial/keepalive.py
--- a/mercurial/keepalive.py	Thu Jun 15 17:07:30 2006 -0700
+++ b/mercurial/keepalive.py	Fri Jun 16 10:00:37 2006 -0300
@@ -99,7 +99,7 @@ EXTRA ATTRIBUTES AND METHODS
 
 """
 
-# $Id: keepalive.py,v 1.13 2005/10/22 21:57:28 mstenner Exp $
+# $Id: keepalive.py,v 1.14 2006/04/04 21:00:32 mstenner Exp $
 
 import urllib2
 import httplib
@@ -249,12 +249,14 @@ class HTTPHandler(urllib2.HTTPHandler):
         r._url = req.get_full_url()
         r._connection = h
         r.code = r.status
+        r.headers = r.msg
+        r.msg = r.reason
         
         if r.status == 200 or not HANDLE_ERRORS:
             return r
         else:
-            return self.parent.error('http', req, r, r.status, r.reason, r.msg)
-
+            return self.parent.error('http', req, r,
+                                     r.status, r.msg, r.headers)
 
     def _reuse_connection(self, h, req, host):
         """start the transaction with a re-used connection
@@ -371,7 +373,7 @@ class HTTPResponse(httplib.HTTPResponse)
         self.close()
         
     def info(self):
-        return self.msg
+        return self.headers
 
     def geturl(self):
         return self._url
diff -r c660691fb45d -r 5eb02f9ed804 tests/test-bad-pull.out
--- a/tests/test-bad-pull.out	Thu Jun 15 17:07:30 2006 -0700
+++ b/tests/test-bad-pull.out	Fri Jun 16 10:00:37 2006 -0300
@@ -2,8 +2,4 @@ 255
 255
 copy: No such file or directory
 abort: HTTP Error 404
-Date:
-Content-Type: text/html
-Connection: close
-
 0


More information about the Mercurial mailing list