changeset 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
files prompt.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/prompt.py	Sun Jan 19 10:57:21 2020 +0000
+++ b/prompt.py	Sun Jan 19 11:11:27 2020 +0000
@@ -453,9 +453,10 @@
     """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):
+    if not opts['amend']:
         with open(cache, 'a') as cache_file:
-            cache_file.write('Local Commit\n')
+            new_commit = repo[b'tip']
+            cache_file.write('{}:{}\n'.format(new_commit.rev(), new_commit.hex().decode('utf-8')))
 
 def _pull_with_cache(orig, ui, repo, *args, **opts):
     """Wrap the pull command to delete the incoming cache as well."""