comparison prompt.py @ 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 f71524147eb4
children 13435b80c672
comparison
equal deleted inserted replaced
138:920255137b9d 139:c09729100dd2
281 281
282 cache_exists = path.isfile(cache) 282 cache_exists = path.isfile(cache)
283 283
284 cache_time = (datetime.fromtimestamp(os.stat(cache).st_mtime) 284 cache_time = (datetime.fromtimestamp(os.stat(cache).st_mtime)
285 if cache_exists else None) 285 if cache_exists else None)
286 if not cache_exists or cache_time < datetime.now() - CACHE_TIMEOUT: 286 if not cache_exists or cache_time < datetime.now() - CACHE_TIMEOUT \
287 or (kind == b'outgoing' and cache_time < datetime.fromtimestamp(os.stat('.hg/last-message.txt').st_mtime)):
287 if not cache_exists: 288 if not cache_exists:
288 open(cache, 'w').close() 289 open(cache, 'w').close()
289 subprocess.Popen(['hg', 'prompt', '--cache-%s' % kind.decode('ascii')]) 290 subprocess.Popen(['hg', 'prompt', '--cache-%s' % kind.decode('ascii')])
290 291
291 if cache_exists: 292 if cache_exists: