# HG changeset patch # User IBBoard # Date 1579381283 0 # Node ID 13435b80c672230eeea062035c03544d2fd1fd0c # Parent f5dd593cc0188cf3e569fed99f0087b0d9fa2421 Replace c09729100dd2 with a wrapper hook implementation diff -r f5dd593cc018 -r 13435b80c672 prompt.py --- a/prompt.py Sat Jan 18 20:54:13 2020 +0000 +++ b/prompt.py Sat Jan 18 21:01:23 2020 +0000 @@ -283,8 +283,7 @@ 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 \ - or (kind == b'outgoing' and cache_time < datetime.fromtimestamp(os.stat('.hg/last-message.txt').st_mtime)): + if not cache_exists or cache_time < datetime.now() - CACHE_TIMEOUT: if not cache_exists: open(cache, 'w').close() subprocess.Popen(['hg', 'prompt', '--cache-%s' % kind.decode('ascii')]) @@ -450,6 +449,14 @@ ui.status(fs) +def _commit_with_cache(orig, ui, repo, *args, **opts): + """Wrap the commit command to fake an entry until we re-cache""" + res = orig(ui, repo, *args, **opts) + cache = path.join(repo.root, CACHE_PATH, b'outgoing') + if path.isfile(cache): + with open(cache, 'a') as cache_file: + cache_file.write('Local Commit\n') + def _pull_with_cache(orig, ui, repo, *args, **opts): """Wrap the pull command to delete the incoming cache as well.""" res = orig(ui, repo, *args, **opts) @@ -467,6 +474,7 @@ return res def uisetup(ui): + extensions.wrapcommand(commands.table, b'commit', _commit_with_cache) extensions.wrapcommand(commands.table, b'pull', _pull_with_cache) extensions.wrapcommand(commands.table, b'push', _push_with_cache) try: