Repository: buildbot/buildbot

Issue:
Mercurial Source steps completed
Documentation is little unclear because of my sucky English. Any help with that will be greatly appreciated. 



Discussion:
Great!  I'll make a number of comments inline.

Don't worry about docs - your English is better than most Americans' English.  I'll edit where I see the need.


Resolving patch:
diff --git a/master/buildbot/steps/source/svn.py b/master/buildbot/steps/source/svn.py
--- a/master/buildbot/steps/source/svn.py
+++ b/master/buildbot/steps/source/svn.py
@@ -279,8 +279,7 @@ def parseGotRevision(self, _):
         svnversion_dir = self.workdir
         if self.mode == 'full' and self.method == 'export':
             svnversion_dir = 'source'
-
-        cmd = buildstep.RemoteShellCommand(svnversion_dir, ['svnversion'],
+        cmd = buildstep.RemoteShellCommand(svnversion_dir, ['svn', 'info'],
                                            env=self.env,
                                            logEnviron=self.logEnviron,
                                            timeout=self.timeout,
@@ -288,12 +287,11 @@ def parseGotRevision(self, _):
         cmd.useLog(self.stdio_log, False)
         d = self.runCommand(cmd)
         def _setrev(_):
-            stdout = cmd.stdout.strip()
-            revision = stdout.rstrip('MSP')
-            revision = revision.split(':')[-1]
+            stdout = cmd.stdout
+            match = re.search('Revision:(.+?)\n', stdout)
             try:
-                int(revision)
-            except ValueError:
+                revision = int(match.group(1))
+            except (AttributeError, ValueError):
                 msg =("SVN.parseGotRevision unable to parse output "
                       "of svnversion: '%s'" % stdout)
                 log.msg(msg)


Test patch:
diff --git a/master/buildbot/test/unit/test_steps_source_svn.py b/master/buildbot/test/unit/test_steps_source_svn.py
--- a/master/buildbot/test/unit/test_steps_source_svn.py
+++ b/master/buildbot/test/unit/test_steps_source_svn.py
@@ -48,6 +48,17 @@ class TestSVN(sourcesteps.SourceStepMixin, unittest.TestCase):
                           <target path=".">
                           </target>
                           </status>"""
+    svn_info_stdout = textwrap.dedent("""Path: .
+                         URL: https://svn.example.com/svn/trunk
+                         Repository Root: https://svn.example.com/svn
+                         Repository UUID: 21b45634-0984-11de-b025-799c3e7cca98
+                         Revision: 100
+                         Node Kind: directory
+                         Schedule: normal
+                         Last Changed Author: reiern70
+                         Last Changed Rev: 100
+                         Last Changed Date: 2012-01-19 16:41:47 +0530 (Thu, 19 Jan 2012)
+                      """)
     def setUp(self):
         return self.setUpSourceStep()
 
@@ -96,9 +107,9 @@ def test_mode_incremental(self):
                                  '--password', 'pass', '--random'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -134,9 +145,9 @@ def test_mode_incremental_timeout(self):
             + 0,
             ExpectShell(workdir='wkdir',
                         timeout=1,
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -164,9 +175,9 @@ def test_mode_incremental_repourl_renderable(self):
                                  '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -190,9 +201,9 @@ def test_mode_incremental_repourl_not_updatable(self):
                                  '.', '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -222,9 +233,9 @@ def test_mode_incremental_repourl_not_updatable_svninfo_mismatch(self):
                                  '.', '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -254,9 +265,9 @@ def test_mode_incremental_given_revision(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -279,9 +290,9 @@ def test_mode_full_clobber(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -307,9 +318,9 @@ def test_mode_full_clobber_given_revision(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -345,8 +356,8 @@ def test_mode_full_fresh(self):
                                  '--non-interactive', '--no-auth-cache', '--depth', 'infinite'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + ExpectShell.log('stdio', stdout='\n')
             + 0,
         )
@@ -385,8 +396,8 @@ def test_mode_full_fresh_given_revision(self):
                                  '--non-interactive', '--no-auth-cache', '--depth', 'infinite'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + ExpectShell.log('stdio', stdout='\n')
             + 0,
         )
@@ -428,8 +439,8 @@ def test_mode_full_fresh_keep_on_purge(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100\n')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -464,8 +475,8 @@ def test_mode_full_clean(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100\n')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -502,8 +513,8 @@ def test_mode_full_clean_given_revision(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100\n')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -527,8 +538,8 @@ def test_mode_full_not_updatable(self):
                                  '.', '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -555,8 +566,8 @@ def test_mode_full_not_updatable_given_revision(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -600,8 +611,8 @@ def test_mode_full_clean_old_rmdir(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -643,8 +654,8 @@ def test_mode_full_clean_new_rmdir(self):
                                  '--non-interactive', '--no-auth-cache'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
-            + ExpectShell.log('stdio', stdout='100')
+                        command=['svn', 'info'])
+            + ExpectShell.log('stdio', stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -679,9 +690,9 @@ def test_mode_full_copy(self):
                              'logEnviron': True})
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -718,9 +729,9 @@ def test_mode_full_copy_given_revision(self):
                              'logEnviron': True})
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -754,9 +765,9 @@ def test_mode_full_export(self):
                         command=['svn', 'export', 'source', 'wkdir'])
             + 0,
             ExpectShell(workdir='source',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -796,9 +807,9 @@ def test_mode_full_export_timeout(self):
             + 0,
             ExpectShell(workdir='source',
                         timeout=1,
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -835,9 +846,9 @@ def test_mode_full_export_given_revision(self):
                                  'source', 'wkdir'])
             + 0,
             ExpectShell(workdir='source',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -872,10 +883,10 @@ def test_mode_incremental_with_env(self):
                         env={'abc': '123'})
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'],
+                        command=['svn', 'info'],
                         env={'abc': '123'})
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -910,10 +921,10 @@ def test_mode_incremental_logEnviron(self):
                         logEnviron=False)
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'],
+                        command=['svn', 'info'],
                         logEnviron=False)
             + ExpectShell.log('stdio',
-                stdout='100')
+                stdout=self.svn_info_stdout)
             + 0,
         )
         self.expectOutcome(result=SUCCESS, status_text=["update"])
@@ -973,7 +984,7 @@ def test_bogus_svnversion(self):
                                  '--password', 'pass', '--random'])
             + 0,
             ExpectShell(workdir='wkdir',
-                        command=['svnversion'])
+                        command=['svn', 'info'])
             + ExpectShell.log('stdio',
                 stdout='1x0y0')
             + 0,