Mercurial > public > mercurial-scm > hg
comparison mercurial/rewriteutil.py @ 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 | 687b865b95ad |
children | 0a57ef4b3bdb |
comparison
equal
deleted
inserted
replaced
45121:b6269741ed42 | 45122:a391d0710f22 |
---|---|
51 """ | 51 """ |
52 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) | 52 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) |
53 if allowunstable: | 53 if allowunstable: |
54 return revset.baseset() | 54 return revset.baseset() |
55 return repo.revs(b"(%ld::) - %ld", revs, revs) | 55 return repo.revs(b"(%ld::) - %ld", revs, revs) |
56 | |
57 | |
58 def skip_empty_successor(ui, command): | |
59 empty_successor = ui.config(b'rewrite', b'empty-successor') | |
60 if empty_successor == b'skip': | |
61 return True | |
62 elif empty_successor == b'keep': | |
63 return False | |
64 else: | |
65 raise error.ConfigError( | |
66 _( | |
67 b"%s doesn't know how to handle config " | |
68 b"rewrite.empty-successor=%s (only 'skip' and 'keep' are " | |
69 b"supported)" | |
70 ) | |
71 % (command, empty_successor) | |
72 ) |