comparison prompt.py @ 144:c12350209a5c

Make sure prompt logs changes from commit, even when no cache Also uses the "change context" to put a better message in the cache. But we don't want to do it when we're amending commits or else we will double-count
author IBBoard <dev@ibboard.co.uk>
date Sun, 19 Jan 2020 11:11:27 +0000
parents 51d857786c5a
children c1520aabcdd4
comparison
equal deleted inserted replaced
143:51d857786c5a 144:c12350209a5c
451 451
452 def _commit_with_cache(orig, ui, repo, *args, **opts): 452 def _commit_with_cache(orig, ui, repo, *args, **opts):
453 """Wrap the commit command to fake an entry until we re-cache""" 453 """Wrap the commit command to fake an entry until we re-cache"""
454 res = orig(ui, repo, *args, **opts) 454 res = orig(ui, repo, *args, **opts)
455 cache = path.join(repo.root, CACHE_PATH, b'outgoing') 455 cache = path.join(repo.root, CACHE_PATH, b'outgoing')
456 if path.isfile(cache): 456 if not opts['amend']:
457 with open(cache, 'a') as cache_file: 457 with open(cache, 'a') as cache_file:
458 cache_file.write('Local Commit\n') 458 new_commit = repo[b'tip']
459 cache_file.write('{}:{}\n'.format(new_commit.rev(), new_commit.hex().decode('utf-8')))
459 460
460 def _pull_with_cache(orig, ui, repo, *args, **opts): 461 def _pull_with_cache(orig, ui, repo, *args, **opts):
461 """Wrap the pull command to delete the incoming cache as well.""" 462 """Wrap the pull command to delete the incoming cache as well."""
462 res = orig(ui, repo, *args, **opts) 463 res = orig(ui, repo, *args, **opts)
463 cache = path.join(repo.root, CACHE_PATH, b'incoming') 464 cache = path.join(repo.root, CACHE_PATH, b'incoming')