diff --git a/eden/scm/sapling/localrepo.py b/eden/scm/sapling/localrepo.py index d1e820fe28363..efc8d4088e51b 100644 --- a/eden/scm/sapling/localrepo.py +++ b/eden/scm/sapling/localrepo.py @@ -86,6 +86,8 @@ # - '' for svfs relative paths _cachedfiles = set() +SECONDS_IN_A_DAY = 60 * 60 * 24 + class _basefilecache(scmutil.filecache): """filecache usage on repo""" @@ -2872,6 +2874,8 @@ def commitctx(self, ctx, error=False): if diffnumber is not None: loginfo.update({"phabricator_diff_number": diffnumber}) + _set_public_base_age(self, p1, loginfo) + self.ui.log( "commit_info", node=hex(n), @@ -3387,3 +3391,14 @@ def _validate_committable_ctx(ui, ctx): % (len(ctx.files()), file_count_limit), hint=hint, ) + + +def _set_public_base_age(repo, ctx, loginfo): + if publicbase := scmutil.publicbase(repo, ctx): + age = int(time.time() - publicbase.date()[0]) / SECONDS_IN_A_DAY + loginfo.update( + { + "public_base": publicbase.hex(), + "public_base_age": age, + } + )