[PATCH] more windows fixes: chomp

Fredrik Lundh fredrik at pythonware.com
Sat Apr 16 10:14:14 BST 2005


this fix makes revision-related bzr commands work on windows, also
after a commit.  it's also makes chomp a bit faster (about 2x according
to timeit).  however, it does change the semantics a bit (by stripping
away *all* line endings, except for only the last one), but I don't think
that should really matter for bzr...

enjoy! /F

*** modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py
+++ bzrlib/osutils.py
@@ -95,10 +95,7 @@


 def chomp(s):
-    if s and (s[-1] == '\n'):
-        return s[:-1]
-    else:
-        return s
+    return s.rstrip('\r\n')


 def sha_file(f):






More information about the bazaar mailing list