changeset 109:9324a89dd84e

client: Be more permissive on the output of update (issue3892) Some extensions can add lines to the output, we now ignore them
author Benoit Allard <benoit@aeteurope.nl>
date Tue, 23 Apr 2013 22:11:26 +0200
parents 181d1a4115cf
children c635e6e7054f
files hglib/client.py tests/test-update.py
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hglib/client.py	Tue Apr 02 01:11:47 2013 -0500
+++ b/hglib/client.py	Tue Apr 23 22:11:26 2013 +0200
@@ -1505,11 +1505,8 @@
 
         out = self.rawcommand(args, eh=eh)
 
-        # filter out 'merging ...' lines
-        out = util.skiplines(out, 'merging ')
-
-        counters = out.rstrip().split(', ')
-        return tuple(int(s.split(' ', 1)[0]) for s in counters)
+        m = re.search(r'^(\d+).+, (\d+).+, (\d+).+, (\d+)', out, re.MULTILINE)
+        return tuple(map(int,list(m.groups())))
 
     @property
     def version(self):
--- a/tests/test-update.py	Tue Apr 02 01:11:47 2013 -0500
+++ b/tests/test-update.py	Tue Apr 23 22:11:26 2013 +0200
@@ -70,3 +70,19 @@
     def test_basic_plain(self):
         open('.hg/hgrc', 'a').write('[defaults]\nupdate=-v\n')
         self.test_basic()
+
+    def test_largefiles(self):
+        import os
+        open('.hg/hgrc', 'a').write('[extensions]\nlargefiles=\n')
+        self.append('b', 'a')
+        self.client.rawcommand(['add', 'b', '--large'])
+        rev2, node2 = self.client.commit('third')
+        # Go back to 0
+        self.client.rawcommand(['update', str(self.rev0)],
+                                # Keep the 'changed' version
+                               prompt=lambda s, d: 'c\n')
+        u, m, r, ur = self.client.update(rev2, clean=True)
+        self.assertEquals(u, 2)
+        self.assertEquals(m, 0)
+        self.assertEquals(r, 0)
+        self.assertEquals(ur, 0)