[PATCH 8 of 8 hglib] client: handle spaces correctly in status()

Idan Kamara idankk86 at gmail.com
Sat Aug 13 16:58:39 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1313272593 -10800
# Node ID 6c416115fd3cb32a89f722959e003fbe781945f9
# Parent  1a2181061a10bb44121a62cca432e0d6b751b6a0
client: handle spaces correctly in status()

diff -r 1a2181061a10 -r 6c416115fd3c hglib/client.py
--- 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
 
diff -r 1a2181061a10 -r 6c416115fd3c tests/test-status.py
--- 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)


More information about the Mercurial-devel mailing list