[patch] small fix for 'hg tags' on windows

Christian Boos cboos at neuf.fr
Wed May 10 02:59:10 CDT 2006


Hi,

I've found a bug on Windows (win32api),
when I tried to use local tags.

Steps to reproduce:

$ hg tag -l -r0 start
$ hg tags
Traceback (most recent call last):
  ...
  File "C:\Program 
Files\ActiveState\Python-2.4\Lib\site-packages\mercurial\localrepo.py", 
line 198, in tags
    for l in f:
TypeError: iteration over non-sequence

(with hg running tip, i.e. 2228:8b106ff5b8a9)


The proposed patch might even fix other similar bugs,
whenever direct iteration on an posixfile is performed.

-- Christian

-------------- next part --------------
# HG changeset patch
# User cboos at cblaptop.bct-tech.local
# Node ID e6ed2d89abe2e1c597ea77906e5e5e0f1c21a2da
# Parent  8b106ff5b8a980b1d76a8ee66461a4b6a35243a0
The posixfile implemented using the win32 API should be iterable.

diff -r 8b106ff5b8a9 -r e6ed2d89abe2 mercurial/util_win32.py
--- a/mercurial/util_win32.py	Mon May 08 14:20:37 2006 -0700
+++ b/mercurial/util_win32.py	Wed May 10 09:51:29 2006 +0200
@@ -220,6 +220,10 @@ class posixfile(object):
         self.name = name
         self.mode = mode
 
+    def __iter__(self):
+        for line in self.read().split('\n'):
+            yield line
+            
     def read(self, count=-1):
         try:
             cs = cStringIO.StringIO()


More information about the Mercurial mailing list