Mercurial > hg
comparison mercurial/phases.py @ 47012:d55b71393907
node: replace nullid and friends with nodeconstants class
The introduction of 256bit hashes require changes to nullid and other
constant magic values. Start pushing them down from repository and
revlog where sensible.
Differential Revision: https://phab.mercurial-scm.org/D9465
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Mon, 29 Mar 2021 01:52:06 +0200 |
parents | 77e129be10de |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
46992:5fa019ceb499 | 47012:d55b71393907 |
---|---|
107 | 107 |
108 from .i18n import _ | 108 from .i18n import _ |
109 from .node import ( | 109 from .node import ( |
110 bin, | 110 bin, |
111 hex, | 111 hex, |
112 nullid, | |
113 nullrev, | 112 nullrev, |
114 short, | 113 short, |
115 wdirrev, | 114 wdirrev, |
116 ) | 115 ) |
117 from .pycompat import ( | 116 from .pycompat import ( |
860 if nhex == b'publishing': # ignore data related to publish option | 859 if nhex == b'publishing': # ignore data related to publish option |
861 continue | 860 continue |
862 node = bin(nhex) | 861 node = bin(nhex) |
863 phase = int(phase) | 862 phase = int(phase) |
864 if phase == public: | 863 if phase == public: |
865 if node != nullid: | 864 if node != repo.nullid: |
866 repo.ui.warn( | 865 repo.ui.warn( |
867 _( | 866 _( |
868 b'ignoring inconsistent public root' | 867 b'ignoring inconsistent public root' |
869 b' from remote: %s\n' | 868 b' from remote: %s\n' |
870 ) | 869 ) |
917 repo = repo.unfiltered() | 916 repo = repo.unfiltered() |
918 cl = repo.changelog | 917 cl = repo.changelog |
919 rev = cl.index.get_rev | 918 rev = cl.index.get_rev |
920 if not roots: | 919 if not roots: |
921 return heads | 920 return heads |
922 if not heads or heads == [nullid]: | 921 if not heads or heads == [repo.nullid]: |
923 return [] | 922 return [] |
924 # The logic operated on revisions, convert arguments early for convenience | 923 # The logic operated on revisions, convert arguments early for convenience |
925 new_heads = {rev(n) for n in heads if n != nullid} | 924 new_heads = {rev(n) for n in heads if n != repo.nullid} |
926 roots = [rev(n) for n in roots] | 925 roots = [rev(n) for n in roots] |
927 # compute the area we need to remove | 926 # compute the area we need to remove |
928 affected_zone = repo.revs(b"(%ld::%ld)", roots, new_heads) | 927 affected_zone = repo.revs(b"(%ld::%ld)", roots, new_heads) |
929 # heads in the area are no longer heads | 928 # heads in the area are no longer heads |
930 new_heads.difference_update(affected_zone) | 929 new_heads.difference_update(affected_zone) |