changeset 35:1e33bbea23e5

client: handle spaces correctly in status()
author Idan Kamara <idankk86@gmail.com>
date Sun, 14 Aug 2011 00:56:33 +0300
parents f6e1d9a6e0cd
children 00bb0701323a
files hglib/client.py tests/test-status.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hglib/client.py	Sun Aug 14 00:51:15 2011 +0300
+++ b/hglib/client.py	Sun Aug 14 00:56:33 2011 +0300
@@ -546,7 +546,10 @@
 
         for entry in out.split('\0'):
             if entry:
-                l.append(tuple(entry.rsplit(' ', 1)))
+                if entry[0] == ' ':
+                    l.append((' ', entry[2:]))
+                else:
+                    l.append(tuple(entry.split(' ', 1)))
 
         return l
 
--- a/tests/test-status.py	Sun Aug 14 00:51:15 2011 +0300
+++ b/tests/test-status.py	Sun Aug 14 00:56:33 2011 +0300
@@ -39,3 +39,10 @@
         self.client.copy('source', 'dest')
         l = [('A', 'dest'), (' ', 'source')]
         self.assertEquals(self.client.status(copies=True), l)
+
+    def test_copy_origin_space(self):
+        self.append('s ource', 'a')
+        self.client.commit('first', addremove=True)
+        self.client.copy('s ource', 'dest')
+        l = [('A', 'dest'), (' ', 's ource')]
+        self.assertEquals(self.client.status(copies=True), l)