Mercurial > repos > other > linux
comparison prompt.py @ 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 | 7718e4d9a019 |
comparison
equal
deleted
inserted
replaced
144:c12350209a5c | 145:c1520aabcdd4 |
---|---|
450 ui.status(fs) | 450 ui.status(fs) |
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_dir = path.join(repo.root, CACHE_PATH) |
456 cache = path.join(cache_dir, b'outgoing') | |
457 if not path.isdir(cache_dir): | |
458 os.makedirs(cache_dir) | |
456 if not opts['amend']: | 459 if not opts['amend']: |
457 with open(cache, 'a') as cache_file: | 460 with open(cache, 'a') as cache_file: |
458 new_commit = repo[b'tip'] | 461 new_commit = repo[b'tip'] |
459 cache_file.write('{}:{}\n'.format(new_commit.rev(), new_commit.hex().decode('utf-8'))) | 462 cache_file.write('{}:{}\n'.format(new_commit.rev(), new_commit.hex().decode('utf-8'))) |
460 | 463 |