changeset 145:c1520aabcdd4

Avoid "No such file or directory: '<repo>/.hg/prompt/cache/outgoing'" Sometimes the commit is the first commit, so there might not be and outgoing cache
author IBBoard <dev@ibboard.co.uk>
date Sat, 15 Feb 2020 13:30:56 +0000
parents c12350209a5c
children c67c56b569d8
files prompt.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/prompt.py	Sun Jan 19 11:11:27 2020 +0000
+++ b/prompt.py	Sat Feb 15 13:30:56 2020 +0000
@@ -452,7 +452,10 @@
 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')
+    cache_dir = path.join(repo.root, CACHE_PATH)
+    cache = path.join(cache_dir, b'outgoing')
+    if not path.isdir(cache_dir):
+        os.makedirs(cache_dir)
     if not opts['amend']:
         with open(cache, 'a') as cache_file:
             new_commit = repo[b'tip']