Mercurial > hg
changeset 30208:87a7c0d403ff
copies: improve assertions during copy recombination
- Make sure there is nothing to recombine in non-graftlike scenarios
- More pythonic assert syntax
author | Gábor Stefanik <gabor.stefanik@nng.com> |
---|---|
date | Tue, 18 Oct 2016 02:09:08 +0200 |
parents | abe723002509 |
children | 9d06b65c5df2 |
files | mercurial/copies.py |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/copies.py Mon Oct 17 16:12:12 2016 -0700 +++ b/mercurial/copies.py Tue Oct 18 02:09:08 2016 +0200 @@ -447,6 +447,7 @@ % "\n ".join(bothnew)) bothdiverge = {} bothincompletediverge = {} + remainder = {} both1 = {'copy': {}, 'fullcopy': {}, 'incomplete': {}, @@ -463,13 +464,19 @@ _checkcopies(c1, f, m1, m2, base, tca, dirtyc1, limit, both1) _checkcopies(c2, f, m2, m1, base, tca, dirtyc2, limit, both2) if dirtyc1: - assert both2['incomplete'] == {} + # incomplete copies may only be found on the "dirty" side for bothnew + assert not both2['incomplete'] remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge, bothincompletediverge) + elif dirtyc2: + assert not both1['incomplete'] + remainder = _combinecopies({}, both2['incomplete'], copy, bothdiverge, + bothincompletediverge) else: - assert both1['incomplete'] == {} - remainder = _combinecopies({}, both2['incomplete'], copy, bothdiverge, - bothincompletediverge) + # incomplete copies and divergences can't happen outside grafts + assert not both1['incomplete'] + assert not both2['incomplete'] + assert not bothincompletediverge for f in remainder: assert f not in bothdiverge ic = remainder[f]