[PATCH] client: Be more permissive on the output of update (issue3892)

Benoit Allard benoit.allard at gmx.de
Tue Apr 23 15:25:54 CDT 2013


# HG changeset patch
# User Benoit Allard <benoit at aeteurope.nl>
# Date 1366747886 -7200
# Node ID 9324a89dd84e1562b87556a3b2788fdf04ba8179
# Parent  181d1a4115cf7f9ab23f4db2647d3974803aa6db
client: Be more permissive on the output of update (issue3892)

Some extensions can add lines to the output, we now ignore them

diff -r 181d1a4115cf -r 9324a89dd84e hglib/client.py
--- 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):
diff -r 181d1a4115cf -r 9324a89dd84e tests/test-update.py
--- 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)


More information about the Mercurial-devel mailing list