Modified: trunk/Tools/CISupport/ews-build/steps.py (292234 => 292235)
--- trunk/Tools/CISupport/ews-build/steps.py 2022-04-01 21:21:57 UTC (rev 292234)
+++ trunk/Tools/CISupport/ews-build/steps.py 2022-04-01 21:29:44 UTC (rev 292235)
@@ -4828,8 +4828,9 @@
descriptionDone = ['Canonicalize Commit']
haltOnFailure = True
- def __init__(self, **kwargs):
+ def __init__(self, rebase_enabled=True, **kwargs):
super(Canonicalize, self).__init__(logEnviron=False, timeout=300, **kwargs)
+ self.rebase_enabled = rebase_enabled
def run(self):
self.commands = []
@@ -4837,11 +4838,16 @@
base_ref = self.getProperty('github.base.ref', DEFAULT_BRANCH)
head_ref = self.getProperty('github.head.ref', DEFAULT_BRANCH)
- for command in [
- ['git', 'pull', 'origin', base_ref],
- ['git', 'branch', '-f', base_ref, head_ref],
- ['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
- ]:
+ commands = []
+ if self.rebase_enabled:
+ commands = [
+ ['git', 'pull', 'origin', base_ref],
+ ['git', 'branch', '-f', base_ref, head_ref],
+ ['git', 'checkout', base_ref],
+ ]
+ commands.append(['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'])
+
+ for command in commands:
self.commands.append(util.ShellArg(command=command, logname='stdio', haltOnFailure=True))
return super(Canonicalize, self).run()
Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (292234 => 292235)
--- trunk/Tools/CISupport/ews-build/steps_unittest.py 2022-04-01 21:21:57 UTC (rev 292234)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py 2022-04-01 21:29:44 UTC (rev 292235)
@@ -6008,6 +6008,11 @@
workdir='wkdir',
timeout=300,
logEnviron=False,
+ command=['git', 'checkout', 'main'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=300,
+ logEnviron=False,
command=['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
) + 0,
)
@@ -6014,6 +6019,23 @@
self.expectOutcome(result=SUCCESS, state_string='Canonicalized commit')
return self.runStep()
+ def test_success_no_rebase(self):
+ self.setupStep(Canonicalize(rebase_enabled=False))
+ self.setProperty('github.number', '1234')
+ self.setProperty('github.base.ref', 'main')
+ self.setProperty('github.head.ref', 'eng/pull-request-branch')
+
+ self.expectRemoteCommands(
+ ExpectShell(
+ workdir='wkdir',
+ timeout=300,
+ logEnviron=False,
+ command=['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
+ ) + 0,
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Canonicalized commit')
+ return self.runStep()
+
def test_failure(self):
self.setupStep(Canonicalize())
self.setProperty('github.number', '1234')
@@ -6035,6 +6057,11 @@
workdir='wkdir',
timeout=300,
logEnviron=False,
+ command=['git', 'checkout', 'main'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=300,
+ logEnviron=False,
command=['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
) + 1,
)