Mercurial > hg
changeset 45122:a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sun, 12 Jul 2020 06:06:06 +0200 |
parents | b6269741ed42 |
children | 1efbfa9b36a7 |
files | mercurial/rewriteutil.py |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/rewriteutil.py Sat Jul 11 23:53:27 2020 +0200 +++ b/mercurial/rewriteutil.py Sun Jul 12 06:06:06 2020 +0200 @@ -53,3 +53,20 @@ if allowunstable: return revset.baseset() return repo.revs(b"(%ld::) - %ld", revs, revs) + + +def skip_empty_successor(ui, command): + empty_successor = ui.config(b'rewrite', b'empty-successor') + if empty_successor == b'skip': + return True + elif empty_successor == b'keep': + return False + else: + raise error.ConfigError( + _( + b"%s doesn't know how to handle config " + b"rewrite.empty-successor=%s (only 'skip' and 'keep' are " + b"supported)" + ) + % (command, empty_successor) + )