You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Nicklas Norling <ex...@exinor.net> on 2005/01/11 14:49:00 UTC

Re: mailer.py now should work on Windows - soliciting testers (furtherinformation)

> Nicklas Norling wrote:
>>> Max Bowsher wrote:
<snip>
>> AttributeError: 'module' object has no attribute
>> 'argv_to_command_string'
>>
>> I have created a test repo Test1 at the path E:\Svnrepo\Test1. I've just
>> committed revision 19 to it before I ran the script.
>> I realize I probably did something silly but can't understand what.
>
> No, that would be my fault. Thanks for testing and discovering my
> oversight.
>
> Fix applied in r12670.
>
> Max.
>

Ok, gave that a try with the same setup etc. as before:

E:\Svnrepo\Test1\hooks>mailer.py commit "E:\Svnrepo\Test1" 19
Traceback (most recent call last):
  File "D:\Program Files\Subversion\bin\mailer.py", line 793, in ?
    author, propname)
  File "D:\Python\lib\site-packages\svn\core.py", line 33, in run_app
    return apply(func, (pool,) + args, kw)
  File "D:\Program Files\Subversion\bin\mailer.py", line 50, in main
    messenger.generate()
  File "D:\Program Files\Subversion\bin\mailer.py", line 361, in generate
    group, params, subpool)
  File "D:\Program Files\Subversion\bin\mailer.py", line 416, in
generate_content
    generate_diff(output, cfg, repos, date, change, group, params, pool)
  File "D:\Program Files\Subversion\bin\mailer.py", line 576, in
generate_diff
    output.run(cfg.get_diff_cmd({
  File "D:\Program Files\Subversion\bin\mailer.py", line 170, in run
    pipe_ob.wait()
AttributeError: Popen4 instance has no attribute 'wait'

/Nicke

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows

Posted by Norbert Unterberg <ne...@gmx.net>.
Mark Therieau schrieb:

> I saw the same extra lines in the emailed diffs.  I don't know if this is
> the correct fix or not, but changing the popen2/popen4 modes to text
> instead of binary worked for me...

Thank you, that patch fixes it for me, too!

Norbert


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows

Posted by Norbert Unterberg <ne...@gmx.net>.
Max Bowsher schrieb:

> The strange thing is that the Python smtplib normalizes newlines. So, I 
> don't see how the weirdness you describe could occur, unless the 
> GnuWin32 diff.exe was emitting bizarre newline combinations.

I have some new info on this:

The additinal new lines happen when you check in text files on Windows 
that do not have the svn:eol-style property set. These files are checked 
in with CRLF (windows) line endings. As soon as I set the svn:eol-style 
property to native, the diff in the commit e-mail looks nice.

There seems to be some problems with converting/interpreting line 
endings on the server side in the hook script?

Norbert


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows

Posted by Norbert Unterberg <ne...@gmx.net>.
Max Bowsher schrieb:

> Are you using sendmail or SMTP output mode?

Yes, I think so. At least the mail_command config option is not set.

> Could either of you add "print repr(self.buffer.getvalue())" to the 
> end of SMTPOutput.finish, to see what the newlines look like at this 
> stage?

Very strange, it mixes all kind of line endings.

The beginning of the diff part of the mail looks like this (I added line 
breaks for readability, but the \r\n marks are from the print output):

==============================================================================\n
--- testproj/trunk/file2.txt\t(original)\r\n
+++ testproj/trunk/file2.txt\tSat Jan 29 00:53:50 2005\r\n
@@ -1,16 +1,9 @@\r\n
 file2.txt \r\r\n
-\r\r\n
-c:/svn/repo1 @ 23 \r\r\n
-c:/svn/repo1 @ 24 \r\r\n
-c:/svn/repo1 @ 25 \r\r\n
-c:/svn/repo1 @ 26 \r\r\n
+line2\r\r\n
+line3\r\r\n
+line4\r\r\n
+line5\r\r\n


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows

Posted by Max Bowsher <ma...@ukf.net>.
Mark Therieau wrote:
> Norbert Unterberg <nepo <at> gmx.net> writes:
>> There remains an issue with the DIFFs. I have setup a diff.exe from the
>> GnuWin32 tools which works with the command line from
>> mailer.conf.example. The diffs are added to the commit mails.
>> BUT: Each line from the diff contains an extra CRLF pair.
>
> I saw the same extra lines in the emailed diffs.  I don't know if this is
> the correct fix or not, but changing the popen2/popen4 modes to text
> instead of binary worked for me...

I'm rather confused.

Are you using sendmail or SMTP output mode?
I assume SMTP, since that would be far easier on Windows.

The strange thing is that the Python smtplib normalizes newlines. So, I 
don't see how the weirdness you describe could occur, unless the GnuWin32 
diff.exe was emitting bizarre newline combinations.

Could either of you add "print repr(self.buffer.getvalue())" to the end of 
SMTPOutput.finish, to see what the newlines look like at this stage?

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows

Posted by Mark Therieau <ma...@covergence.com>.
Norbert Unterberg <nepo <at> gmx.net> writes:
> There remains an issue with the DIFFs. I have setup a diff.exe from the 
> GnuWin32 tools which works with the command line from 
> mailer.conf.example. The diffs are added to the commit mails.
> BUT: Each line from the diff contains an extra CRLF pair.

I saw the same extra lines in the emailed diffs.  I don't know if this is
the correct fix or not, but changing the popen2/popen4 modes to text
instead of binary worked for me...

regards,
markt

Index: mailer.py
===================================================================
--- mailer.py   (revision 12828)
+++ mailer.py   (working copy)
@@ -107,9 +107,9 @@
         cmd = argv_to_command_string(cmd)
       if capturestderr:
         self.fromchild, self.tochild, self.childerr \
-            = popen2.popen3(cmd, mode='b')
+            = popen2.popen3(cmd, mode='t')
       else:
-        self.fromchild, self.tochild = popen2.popen2(cmd, mode='b')
+        self.fromchild, self.tochild = popen2.popen2(cmd, mode='t')
         self.childerr = None

     def wait(self):
@@ -123,7 +123,7 @@
     def __init__(self, cmd):
       if type(cmd) != types.StringType:
         cmd = argv_to_command_string(cmd)
-      self.fromchild, self.tochild = popen2.popen4(cmd, mode='b')
+      self.fromchild, self.tochild = popen2.popen4(cmd, mode='t')

     def wait(self):
       rv = self.fromchild.close()



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows

Posted by Norbert Unterberg <ne...@gmx.net>.
Max Bowsher schrieb:

> Fixed in r12672.

I am also trying to run the mailer.py on windows. After some trying and 
finding the "1.1.x-mailer.py" branch (it is not in the 1.1.3 release, 
isn't it?) I now managed to send commit e-mails. Thanks a lot!

There remains an issue with the DIFFs. I have setup a diff.exe from the 
GnuWin32 tools which works with the command line from 
mailer.conf.example. The diffs are added to the commit mails.
BUT: Each line from the diff contains an extra CRLF pair. So the diff 
looks like this:

Modified: testproj/trunk/file2.txt
==============================================================================
--- testproj/trunk/file2.txt	(original)
+++ testproj/trunk/file2.txt	Sun Jan 23 00:39:13 2005
@@ -3,5 +3,14 @@
  Test Line 1

  Test Line 2

  Test Line 3

+c:/svn/repo1 @ 23

+c:/svn/repo1 @ 24

+c:/svn/repo1 @ 25

...

My guess is that the diff on windows outputs the lines with CR/LF line 
endings, which are somewhere in the script converted into LF/LF, which 
in turn is converted into CR/LF/CR/LF... But that is just a guess (I 
don't speak Python).

Any ideas?

Norbert


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows - soliciting testers (furtherinformation)

Posted by Max Bowsher <ma...@ukf.net>.
Nicklas Norling wrote:
> Ohh, and another question/suggestion.
>
> I ended up finding GnuDiff and after installing it in D:\Program Files\...
> I realized that I needed to follow this doc (at the top of the example 
> file)
> to get white space to work.
>
> # This is not passed to the shell, so do not use shell metacharacters.
> # The command is split around whitespace, so if you want to include
> # whitespace in the command, then ### something ###
>
> What on earth does "### something ###" mean??? My guess is that that part
> isn't finished yet right? Anyway, I have no idea how to get it kicking and
> my guess is that the doc should probably by changed into something human
> readble ;)

Quite. For now, move your diff program into a path without spaces.

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows - soliciting testers (furtherinformation)

Posted by Nicklas Norling <ex...@exinor.net>.
Ohh, and another question/suggestion.

I ended up finding GnuDiff and after installing it in D:\Program Files\...
I realized that I needed to follow this doc (at the top of the example file)
to get white space to work.

# This is not passed to the shell, so do not use shell metacharacters.
# The command is split around whitespace, so if you want to include
# whitespace in the command, then ### something ###

What on earth does "### something ###" mean??? My guess is that that part
isn't finished yet right? Anyway, I have no idea how to get it kicking and
my guess is that the doc should probably by changed into something human
readble ;)

/Nicke

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows - soliciting testers (furtherinformation)

Posted by Nicklas Norling <ex...@exinor.net>.
> Nicklas Norling wrote:
>> Traceback (most recent call last):
> ...
>> AttributeError: Popen4 instance has no attribute 'wait'
>
> Fixed in r12672.
>
> Thankyou very much for your testing.
> My lack of a Windows set-up to test this in has been showing rather badly.
>
> Max.

Ok, I tested this again and the script now works without any problems.
Hurray!
Still the script and config example comes down with naughty squares in
notepad. Don't forget to set eol-style=native later. I've cutted and
pasted from IE's view of the code so all my testing is done on files with
win32 eol style (in case you are worried about setting it).

The mail itself contains an error line (path not found) since
/usr/bin/diff doesn't exist on a win system, in fact diff doesn't exist at
all. Hmm... Guess I have to do without diff's on win32?

Anyway, happy to be able to help out. Let me know if you need any more
testing.

Thanks!
/Nicke

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mailer.py now should work on Windows - soliciting testers (furtherinformation)

Posted by Max Bowsher <ma...@ukf.net>.
Nicklas Norling wrote:
>> Nicklas Norling wrote:
>>>> Max Bowsher wrote:
> <snip>
>>> AttributeError: 'module' object has no attribute
>>> 'argv_to_command_string'
>>>
>>> I have created a test repo Test1 at the path E:\Svnrepo\Test1. I've just
>>> committed revision 19 to it before I ran the script.
>>> I realize I probably did something silly but can't understand what.
>>
>> No, that would be my fault. Thanks for testing and discovering my
>> oversight.
>>
>> Fix applied in r12670.
>>
>> Max.
>>
>
> Ok, gave that a try with the same setup etc. as before:
>
> E:\Svnrepo\Test1\hooks>mailer.py commit "E:\Svnrepo\Test1" 19
> Traceback (most recent call last):
...
> AttributeError: Popen4 instance has no attribute 'wait'

I'm afraid that's my fault *again*.

Apparently I botched the merge of one of the changes, and lost a few lines 
of code.

Fixed in r12672.

Thankyou very much for your testing.
My lack of a Windows set-up to test this in has been showing rather badly.

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org