Skip to content

Commit

Permalink
Updating steps.Git to allow incremental fetch.
Browse files Browse the repository at this point in the history
  • Loading branch information
shareefj committed Apr 9, 2022
1 parent 25e4a5d commit 2e4e352
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
7 changes: 6 additions & 1 deletion master/buildbot/steps/source/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,12 @@ def _fetch(self, _):
rev = self.revision
else:
rev = 'FETCH_HEAD'
command = ['checkout', '-f', rev]

if self.mode == 'incremental':
command = ['checkout', rev]
else:
command = ['checkout', '-f', rev]

abandonOnFailure = not self.retryFetch and not self.clobberOnFailure
res = yield self._dovccmd(command, abandonOnFailure)

Expand Down
30 changes: 15 additions & 15 deletions master/buildbot/test/unit/steps/test_source_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ def test_mode_incremental_oldworker(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir', interrupt_signal='TERM',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir', interrupt_signal='TERM',
command=['git', 'rev-parse', 'HEAD'])
Expand Down Expand Up @@ -1546,7 +1546,7 @@ def test_mode_incremental(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'rev-parse', 'HEAD'])
Expand Down Expand Up @@ -1578,7 +1578,7 @@ def test_version_format(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'rev-parse', 'HEAD'])
Expand Down Expand Up @@ -1646,7 +1646,7 @@ def test_mode_incremental_branch(self):
'test-branch', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-B', 'test-branch'])
Expand Down Expand Up @@ -1695,7 +1695,7 @@ def test_mode_incremental_branch_ssh_key_2_10(self):
'test-branch', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-B', 'test-branch'])
Expand Down Expand Up @@ -1801,7 +1801,7 @@ def test_mode_incremental_given_revision(self):
command=['git', 'cat-file', '-e', 'abcdef01'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'abcdef01'])
command=['git', 'checkout', 'abcdef01'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'rev-parse', 'HEAD'])
Expand Down Expand Up @@ -1838,7 +1838,7 @@ def test_mode_incremental_given_revision_not_exists(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'abcdef01'])
command=['git', 'checkout', 'abcdef01'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'rev-parse', 'HEAD'])
Expand Down Expand Up @@ -2105,15 +2105,15 @@ def test_mode_incremental_retryFetch(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(1),
ExpectShell(workdir='wkdir',
command=['git', 'fetch', '-f', '-t',
'http://github.com/buildbot/buildbot.git',
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'rev-parse', 'HEAD'])
Expand Down Expand Up @@ -2146,15 +2146,15 @@ def test_mode_incremental_retryFetch_branch(self):
'test-branch', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(1),
ExpectShell(workdir='wkdir',
command=['git', 'fetch', '-f', '-t',
'http://github.com/buildbot/buildbot.git',
'test-branch', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-B', 'test-branch'])
Expand Down Expand Up @@ -2190,7 +2190,7 @@ def test_mode_incremental_clobberOnFailure(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(1),
ExpectRmdir(dir='wkdir', log_environ=True, timeout=1200)
.exit(0),
Expand Down Expand Up @@ -2230,7 +2230,7 @@ def test_mode_incremental_clobberOnFailure_branch(self):
'test-branch', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(1),
ExpectRmdir(dir='wkdir', log_environ=True, timeout=1200)
.exit(0),
Expand Down Expand Up @@ -2783,7 +2783,7 @@ def test_getDescription(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'rev-parse', 'HEAD'])
Expand Down Expand Up @@ -2830,7 +2830,7 @@ def test_getDescription_failed(self):
'HEAD', '--progress'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'checkout', '-f', 'FETCH_HEAD'])
command=['git', 'checkout', 'FETCH_HEAD'])
.exit(0),
ExpectShell(workdir='wkdir',
command=['git', 'rev-parse', 'HEAD'])
Expand Down

0 comments on commit 2e4e352

Please sign in to comment.