Bug 1633494 - Augment `hg` command used to get commit time r=glandium

`hg` gives us some additional levers to tweak when determining which commits are public and non-public. All the better, because `hg`'s default behavior under a rebase is to preserve the original commit time, so if you rebase a month-old commit on the latest version of central, you might still get the "revision too old" error despite your tree actually being completely up-to-date. Here we replace the original logic with something a little bit more robust to that scenario.

As before, this is a best-effort check that might have false positives or false negatives; this commit doesn't change that, but hopefully it decreases the amount of false positives under `hg`.

Differential Revision: https://phabricator.services.mozilla.com/D74745
This commit is contained in:
Ricky Stewart 2020-05-12 15:53:14 +00:00
Родитель 079bf2d83a
Коммит 853de17575
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -323,7 +323,8 @@ class HgRepository(Repository):
def get_commit_time(self): def get_commit_time(self):
return int(self._run( return int(self._run(
'parent', '--template', '{word(0, date|hgdate)}').strip()) 'log', '--rev', 'heads(ancestors(.) and not draft())',
'--template', '{word(0, date|hgdate)}', '--limit', '1').strip())
def sparse_checkout_present(self): def sparse_checkout_present(self):
# We assume a sparse checkout is enabled if the .hg/sparse file # We assume a sparse checkout is enabled if the .hg/sparse file