Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.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 | 394cfc42c05c |
children | 7431f5ab0d2a |
comparison
equal
deleted
inserted
replaced
46992:5fa019ceb499 | 47012:d55b71393907 |
---|---|
14 import stat | 14 import stat |
15 | 15 |
16 from .i18n import _ | 16 from .i18n import _ |
17 from .node import ( | 17 from .node import ( |
18 hex, | 18 hex, |
19 nullhex, | 19 sha1nodeconstants, |
20 nullid, | |
21 short, | 20 short, |
22 ) | 21 ) |
23 from .pycompat import getattr | 22 from .pycompat import getattr |
24 | 23 |
25 from . import ( | 24 from . import ( |
770 { | 769 { |
771 b'key': b'0', | 770 b'key': b'0', |
772 }, | 771 }, |
773 ).result() | 772 ).result() |
774 | 773 |
775 if rootnode != nullid: | 774 if rootnode != sha1nodeconstants.nullid: |
776 sharepath = os.path.join(sharepool, hex(rootnode)) | 775 sharepath = os.path.join(sharepool, hex(rootnode)) |
777 else: | 776 else: |
778 ui.status( | 777 ui.status( |
779 _( | 778 _( |
780 b'(not using pooled storage: ' | 779 b'(not using pooled storage: ' |
881 _copycache(srcrepo, dstcachedir, cache) | 880 _copycache(srcrepo, dstcachedir, cache) |
882 | 881 |
883 # we need to re-init the repo after manually copying the data | 882 # we need to re-init the repo after manually copying the data |
884 # into it | 883 # into it |
885 destpeer = peer(srcrepo, peeropts, dest) | 884 destpeer = peer(srcrepo, peeropts, dest) |
886 srcrepo.hook(b'outgoing', source=b'clone', node=nullhex) | 885 srcrepo.hook( |
886 b'outgoing', source=b'clone', node=srcrepo.nodeconstants.nullhex | |
887 ) | |
887 else: | 888 else: |
888 try: | 889 try: |
889 # only pass ui when no srcrepo | 890 # only pass ui when no srcrepo |
890 destpeer = peer( | 891 destpeer = peer( |
891 srcrepo or ui, | 892 srcrepo or ui, |
1327 chlist.reverse() | 1328 chlist.reverse() |
1328 count = 0 | 1329 count = 0 |
1329 for n in chlist: | 1330 for n in chlist: |
1330 if limit is not None and count >= limit: | 1331 if limit is not None and count >= limit: |
1331 break | 1332 break |
1332 parents = [p for p in other.changelog.parents(n) if p != nullid] | 1333 parents = [ |
1334 p for p in other.changelog.parents(n) if p != repo.nullid | |
1335 ] | |
1333 if opts.get(b'no_merges') and len(parents) == 2: | 1336 if opts.get(b'no_merges') and len(parents) == 2: |
1334 continue | 1337 continue |
1335 count += 1 | 1338 count += 1 |
1336 displayer.show(other[n]) | 1339 displayer.show(other[n]) |
1337 | 1340 |
1404 count = 0 | 1407 count = 0 |
1405 cl = repo.changelog | 1408 cl = repo.changelog |
1406 for n in revs: | 1409 for n in revs: |
1407 if limit is not None and count >= limit: | 1410 if limit is not None and count >= limit: |
1408 break | 1411 break |
1409 parents = [p for p in cl.parents(n) if p != nullid] | 1412 parents = [p for p in cl.parents(n) if p != repo.nullid] |
1410 if no_merges and len(parents) == 2: | 1413 if no_merges and len(parents) == 2: |
1411 continue | 1414 continue |
1412 count += 1 | 1415 count += 1 |
1413 yield n | 1416 yield n |
1414 | 1417 |