changeset 139:c09729100dd2

Update outgoing cache when we commit Without this, we may wait 15 minutes until we see that we've got outgoing changes! There may be a better way to do this. And it still likely has a one prompt delay because of the time required to cache outgoing changes and recalculate. But it's better than nothing.
author IBBoard <dev@ibboard.co.uk>
date Sat, 18 Jan 2020 20:41:50 +0000
parents 920255137b9d
children f5dd593cc018
files prompt.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/prompt.py	Sat Jan 18 20:40:07 2020 +0000
+++ b/prompt.py	Sat Jan 18 20:41:50 2020 +0000
@@ -283,7 +283,8 @@
 
             cache_time = (datetime.fromtimestamp(os.stat(cache).st_mtime)
                           if cache_exists else None)
-            if not cache_exists or cache_time < datetime.now() - CACHE_TIMEOUT:
+            if not cache_exists or cache_time < datetime.now() - CACHE_TIMEOUT \
+                or (kind == b'outgoing' and cache_time < datetime.fromtimestamp(os.stat('.hg/last-message.txt').st_mtime)):
                 if not cache_exists:
                     open(cache, 'w').close()
                 subprocess.Popen(['hg', 'prompt', '--cache-%s' % kind.decode('ascii')])