git cl replacing gnumbd: set correct committer timestamp.
BUG=642493
R=sergiyb@chromium.org
Change-Id: I5d8588f2b6f30368188aecab2d2c462a11aa6883
Reviewed-on: https://chromium-review.googlesource.com/414369
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 8c397ec..9177b55 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1066,9 +1066,17 @@
git_cl.main(['land'])
def test_land_rietveld_git_numberer(self):
- self._land_rietveld_common()
+ self._land_rietveld_common(debug_stdout=False)
self.mock(git_cl, 'ShouldGenerateGitNumberFooters',
lambda *a: self._mocked_call(['ShouldGenerateGitNumberFooters']))
+
+ # Special mocks to check validity of timestamp.
+ original_git_amend_head = git_cl._git_amend_head
+ def _git_amend_head_mock(msg, tstamp):
+ self._mocked_call(['git_amend_head committer timestamp', tstamp])
+ return original_git_amend_head(msg, tstamp)
+ self.mock(git_cl, '_git_amend_head', _git_amend_head_mock)
+
self.calls += [
((['git', 'config', 'rietveld.pending-ref-prefix'],), CERR1),
((['ShouldGenerateGitNumberFooters'],), True),
@@ -1078,7 +1086,12 @@
'\n'
'Cr-Commit-Position: refs/heads/master@{#543}\n'
'Cr-Branched-From: refs/svn/2014@{#2208}'),
+ ((['git', 'show', '-s', '--format=%ct', 'fake_ancestor_sha'],),
+ '1480022355'), # Committer's unix timestamp.
+ ((['git', 'show', '-s', '--format=%ct', 'HEAD'],),
+ '1480024000'),
+ ((['git_amend_head committer timestamp', 1480024000],), None),
((['git', 'commit', '--amend', '-m',
'Issue: 123\n\nR=john@chromium.org\n'
'\n'