Repository: buildbot/buildbot

Issue:
Change tuple to list, and fix logic error which should use '<' operator.
Fixes Python 3 error:
TypeError: '>' not supported between instances of 'tuple' and 'list'



Discussion:

Resolving patch:
diff --git a/master/buildbot/steps/source/git.py b/master/buildbot/steps/source/git.py
--- a/master/buildbot/steps/source/git.py
+++ b/master/buildbot/steps/source/git.py
@@ -237,10 +237,12 @@ def clean(self):
         d.addCallback(self._cleanSubmodule)
         return d
 
+    @defer.inlineCallbacks
     def clobber(self):
-        d = self._doClobber()
-        d.addCallback(lambda _: self._fullClone(shallowClone=self.shallow))
-        return d
+        yield self._doClobber()
+        res = yield self._fullClone(shallowClone=self.shallow)
+        if res != 0:
+            raise buildstep.BuildStepFailed
 
     def fresh(self):
         command = ['clean', '-f', '-f', '-d', '-x']
@@ -444,23 +446,29 @@ def _retry(res):
             d.addCallback(_retry)
         return d
 
+    @defer.inlineCallbacks
     def _fullClone(self, shallowClone=False):
         """Perform full clone and checkout to the revision if specified
            In the case of shallow clones if any of the step fail abort whole build step.
         """
-        d = self._clone(shallowClone)
+        res = yield self._clone(shallowClone)
+        if res != 0:
+            defer.returnValue(res)
+            return
+
         # If revision specified checkout that revision
         if self.revision:
-            d.addCallback(lambda _: self._dovccmd(['reset', '--hard',
-                                                   self.revision, '--'],
-                                                  shallowClone))
+            res = yield self._dovccmd(['reset', '--hard',
+                                 self.revision, '--'],
+                                 shallowClone)
         # init and update submodules, recurisively. If there's not recursion
         # it will not do it.
         if self.submodules:
-            d.addCallback(lambda _: self._dovccmd(['submodule', 'update',
-                                                   '--init', '--recursive'],
-                                                  shallowClone))
-        return d
+            res = yield self._dovccmd(['submodule', 'update',
+                                 '--init', '--recursive'],
+                                 shallowClone)
+
+        defer.returnValue(res)
 
     def _fullCloneOrFallback(self):
         """Wrapper for _fullClone(). In the case of failure, if clobberOnFailure


Test patch:
diff --git a/master/buildbot/test/unit/test_steps_source_git.py b/master/buildbot/test/unit/test_steps_source_git.py
--- a/master/buildbot/test/unit/test_steps_source_git.py
+++ b/master/buildbot/test/unit/test_steps_source_git.py
@@ -490,7 +490,7 @@ def test_mode_full_clobber(self):
                         command=['git', 'clone',
                                  'http://github.com/buildbot/buildbot.git',
                                  '.', '--progress'])
-            + 1,
+            + 0,
             ExpectShell(workdir='wkdir',
                         command=['git', 'rev-parse', 'HEAD'])
             + ExpectShell.log('stdio',
@@ -501,6 +501,34 @@ def test_mode_full_clobber(self):
         self.expectProperty('got_revision', 'f6ad368298bd941e934a41f3babc827b2aa95a1d', 'Git')
         return self.runStep()
 
+    def test_mode_full_clone_fails(self):
+        self.setupStep(
+            git.Git(repourl='http://github.com/buildbot/buildbot.git',
+                    mode='full', method='clobber', progress=True))
+
+        self.expectCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['git', '--version'])
+            + ExpectShell.log('stdio',
+                              stdout='git version 1.7.5')
+            + 0,
+            Expect('stat', dict(file='wkdir/.buildbot-patched',
+                                logEnviron=True))
+            + 1,
+            Expect('rmdir', dict(dir='wkdir',
+                                 logEnviron=True,
+                                 timeout=1200))
+            + 0,
+            ExpectShell(workdir='wkdir',
+                        command=['git', 'clone',
+                                 'http://github.com/buildbot/buildbot.git',
+                                 '.', '--progress'])
+            + 1,  # clone fails
+        )
+        self.expectOutcome(result=FAILURE, status_text=["updating"])
+        self.expectNoProperty('got_revision')
+        return self.runStep()
+
     def test_mode_full_clobber_branch(self):
         self.setupStep(
             git.Git(repourl='http://github.com/buildbot/buildbot.git',