##// END OF EJS Templates
node: introduce nodeconstants class...
Joerg Sonnenberger -
r47538:6266d195 default
parent child Browse files
Show More
@@ -3672,7 +3672,7 b' def perfloadmarkers(ui, repo):'
3672 Result is the number of markers in the repo."""
3672 Result is the number of markers in the repo."""
3673 timer, fm = gettimer(ui)
3673 timer, fm = gettimer(ui)
3674 svfs = getsvfs(repo)
3674 svfs = getsvfs(repo)
3675 timer(lambda: len(obsolete.obsstore(svfs)))
3675 timer(lambda: len(obsolete.obsstore(repo, svfs)))
3676 fm.end()
3676 fm.end()
3677
3677
3678
3678
@@ -102,6 +102,9 b' class nullui(object):'
102 class emptyfilecontext(object):
102 class emptyfilecontext(object):
103 """minimal filecontext representing an empty file"""
103 """minimal filecontext representing an empty file"""
104
104
105 def __init__(self, repo):
106 self._repo = repo
107
105 def data(self):
108 def data(self):
106 return b''
109 return b''
107
110
@@ -212,7 +215,7 b' def getfilestack(stack, path, seenfctxs='
212 if path in pctx:
215 if path in pctx:
213 fctxs.append(pctx[path])
216 fctxs.append(pctx[path])
214 else:
217 else:
215 fctxs.append(emptyfilecontext())
218 fctxs.append(emptyfilecontext(pctx.repo()))
216
219
217 fctxs.reverse()
220 fctxs.reverse()
218 # note: we rely on a property of hg: filerev is not reused for linear
221 # note: we rely on a property of hg: filerev is not reused for linear
@@ -8,6 +8,7 b' from mercurial.node import ('
8 nullhex,
8 nullhex,
9 nullid,
9 nullid,
10 nullrev,
10 nullrev,
11 sha1nodeconstants,
11 wdirhex,
12 wdirhex,
12 )
13 )
13 from mercurial import (
14 from mercurial import (
@@ -422,6 +423,8 b' class changelog(baselog):'
422
423
423
424
424 class manifestlog(baselog):
425 class manifestlog(baselog):
426 nodeconstants = sha1nodeconstants
427
425 def __getitem__(self, node):
428 def __getitem__(self, node):
426 return self.get(b'', node)
429 return self.get(b'', node)
427
430
@@ -206,6 +206,7 b' def openlfdirstate(ui, repo, create=True'
206 repo.root,
206 repo.root,
207 repo.dirstate._validate,
207 repo.dirstate._validate,
208 lambda: sparse.matcher(repo),
208 lambda: sparse.matcher(repo),
209 repo.nodeconstants,
209 )
210 )
210
211
211 # If the largefiles dirstate does not exist, populate and create
212 # If the largefiles dirstate does not exist, populate and create
@@ -54,6 +54,7 b' from mercurial.i18n import _'
54 from mercurial.node import (
54 from mercurial.node import (
55 nullid,
55 nullid,
56 nullrev,
56 nullrev,
57 sha1nodeconstants,
57 short,
58 short,
58 )
59 )
59 from mercurial.thirdparty import attr
60 from mercurial.thirdparty import attr
@@ -305,6 +306,7 b' class sqlitefilestore(object):'
305 """Implements storage for an individual tracked path."""
306 """Implements storage for an individual tracked path."""
306
307
307 def __init__(self, db, path, compression):
308 def __init__(self, db, path, compression):
309 self.nullid = sha1nodeconstants.nullid
308 self._db = db
310 self._db = db
309 self._path = path
311 self._path = path
310
312
@@ -623,7 +623,7 b' def unhexlifybookmarks(marks):'
623 _binaryentry = struct.Struct(b'>20sH')
623 _binaryentry = struct.Struct(b'>20sH')
624
624
625
625
626 def binaryencode(bookmarks):
626 def binaryencode(repo, bookmarks):
627 """encode a '(bookmark, node)' iterable into a binary stream
627 """encode a '(bookmark, node)' iterable into a binary stream
628
628
629 the binary format is:
629 the binary format is:
@@ -645,7 +645,7 b' def binaryencode(bookmarks):'
645 return b''.join(binarydata)
645 return b''.join(binarydata)
646
646
647
647
648 def binarydecode(stream):
648 def binarydecode(repo, stream):
649 """decode a binary stream into an '(bookmark, node)' iterable
649 """decode a binary stream into an '(bookmark, node)' iterable
650
650
651 the binary format is:
651 the binary format is:
@@ -97,7 +97,7 b' class BranchMapCache(object):'
97 revs.extend(r for r in extrarevs if r <= bcache.tiprev)
97 revs.extend(r for r in extrarevs if r <= bcache.tiprev)
98 else:
98 else:
99 # nothing to fall back on, start empty.
99 # nothing to fall back on, start empty.
100 bcache = branchcache()
100 bcache = branchcache(repo)
101
101
102 revs.extend(cl.revs(start=bcache.tiprev + 1))
102 revs.extend(cl.revs(start=bcache.tiprev + 1))
103 if revs:
103 if revs:
@@ -129,6 +129,7 b' class BranchMapCache(object):'
129 if rbheads:
129 if rbheads:
130 rtiprev = max((int(clrev(node)) for node in rbheads))
130 rtiprev = max((int(clrev(node)) for node in rbheads))
131 cache = branchcache(
131 cache = branchcache(
132 repo,
132 remotebranchmap,
133 remotebranchmap,
133 repo[rtiprev].node(),
134 repo[rtiprev].node(),
134 rtiprev,
135 rtiprev,
@@ -184,6 +185,7 b' class branchcache(object):'
184
185
185 def __init__(
186 def __init__(
186 self,
187 self,
188 repo,
187 entries=(),
189 entries=(),
188 tipnode=nullid,
190 tipnode=nullid,
189 tiprev=nullrev,
191 tiprev=nullrev,
@@ -195,6 +197,7 b' class branchcache(object):'
195 """hasnode is a function which can be used to verify whether changelog
197 """hasnode is a function which can be used to verify whether changelog
196 has a given node or not. If it's not provided, we assume that every node
198 has a given node or not. If it's not provided, we assume that every node
197 we have exists in changelog"""
199 we have exists in changelog"""
200 self._repo = repo
198 self.tipnode = tipnode
201 self.tipnode = tipnode
199 self.tiprev = tiprev
202 self.tiprev = tiprev
200 self.filteredhash = filteredhash
203 self.filteredhash = filteredhash
@@ -280,6 +283,7 b' class branchcache(object):'
280 if len(cachekey) > 2:
283 if len(cachekey) > 2:
281 filteredhash = bin(cachekey[2])
284 filteredhash = bin(cachekey[2])
282 bcache = cls(
285 bcache = cls(
286 repo,
283 tipnode=last,
287 tipnode=last,
284 tiprev=lrev,
288 tiprev=lrev,
285 filteredhash=filteredhash,
289 filteredhash=filteredhash,
@@ -388,6 +392,7 b' class branchcache(object):'
388 def copy(self):
392 def copy(self):
389 """return an deep copy of the branchcache object"""
393 """return an deep copy of the branchcache object"""
390 return type(self)(
394 return type(self)(
395 self._repo,
391 self._entries,
396 self._entries,
392 self.tipnode,
397 self.tipnode,
393 self.tiprev,
398 self.tiprev,
@@ -2146,7 +2146,7 b' def handlecheckbookmarks(op, inpart):'
2146 contains binary encoded (bookmark, node) tuple. If the local state does
2146 contains binary encoded (bookmark, node) tuple. If the local state does
2147 not marks the one in the part, a PushRaced exception is raised
2147 not marks the one in the part, a PushRaced exception is raised
2148 """
2148 """
2149 bookdata = bookmarks.binarydecode(inpart)
2149 bookdata = bookmarks.binarydecode(op.repo, inpart)
2150
2150
2151 msgstandard = (
2151 msgstandard = (
2152 b'remote repository changed while pushing - please try again '
2152 b'remote repository changed while pushing - please try again '
@@ -2376,7 +2376,7 b' def handlebookmark(op, inpart):'
2376 When mode is 'records', the information is recorded into the 'bookmarks'
2376 When mode is 'records', the information is recorded into the 'bookmarks'
2377 records of the bundle operation. This behavior is suitable for pulling.
2377 records of the bundle operation. This behavior is suitable for pulling.
2378 """
2378 """
2379 changes = bookmarks.binarydecode(inpart)
2379 changes = bookmarks.binarydecode(op.repo, inpart)
2380
2380
2381 pushkeycompat = op.repo.ui.configbool(
2381 pushkeycompat = op.repo.ui.configbool(
2382 b'server', b'bookmarks-pushkey-compat'
2382 b'server', b'bookmarks-pushkey-compat'
@@ -175,9 +175,15 b' class bundlechangelog(bundlerevlog, chan'
175
175
176 class bundlemanifest(bundlerevlog, manifest.manifestrevlog):
176 class bundlemanifest(bundlerevlog, manifest.manifestrevlog):
177 def __init__(
177 def __init__(
178 self, opener, cgunpacker, linkmapper, dirlogstarts=None, dir=b''
178 self,
179 nodeconstants,
180 opener,
181 cgunpacker,
182 linkmapper,
183 dirlogstarts=None,
184 dir=b'',
179 ):
185 ):
180 manifest.manifestrevlog.__init__(self, opener, tree=dir)
186 manifest.manifestrevlog.__init__(self, nodeconstants, opener, tree=dir)
181 bundlerevlog.__init__(
187 bundlerevlog.__init__(
182 self, opener, self.indexfile, cgunpacker, linkmapper
188 self, opener, self.indexfile, cgunpacker, linkmapper
183 )
189 )
@@ -192,6 +198,7 b' class bundlemanifest(bundlerevlog, manif'
192 if d in self._dirlogstarts:
198 if d in self._dirlogstarts:
193 self.bundle.seek(self._dirlogstarts[d])
199 self.bundle.seek(self._dirlogstarts[d])
194 return bundlemanifest(
200 return bundlemanifest(
201 self.nodeconstants,
195 self.opener,
202 self.opener,
196 self.bundle,
203 self.bundle,
197 self._linkmapper,
204 self._linkmapper,
@@ -368,7 +375,9 b' class bundlerepository(object):'
368 # consume the header if it exists
375 # consume the header if it exists
369 self._cgunpacker.manifestheader()
376 self._cgunpacker.manifestheader()
370 linkmapper = self.unfiltered().changelog.rev
377 linkmapper = self.unfiltered().changelog.rev
371 rootstore = bundlemanifest(self.svfs, self._cgunpacker, linkmapper)
378 rootstore = bundlemanifest(
379 self.nodeconstants, self.svfs, self._cgunpacker, linkmapper
380 )
372 self.filestart = self._cgunpacker.tell()
381 self.filestart = self._cgunpacker.tell()
373
382
374 return manifest.manifestlog(
383 return manifest.manifestlog(
@@ -662,7 +662,7 b' class headerlessfixup(object):'
662 return readexactly(self._fh, n)
662 return readexactly(self._fh, n)
663
663
664
664
665 def _revisiondeltatochunks(delta, headerfn):
665 def _revisiondeltatochunks(repo, delta, headerfn):
666 """Serialize a revisiondelta to changegroup chunks."""
666 """Serialize a revisiondelta to changegroup chunks."""
667
667
668 # The captured revision delta may be encoded as a delta against
668 # The captured revision delta may be encoded as a delta against
@@ -1065,7 +1065,9 b' class cgpacker(object):'
1065 sidedata_helpers=sidedata_helpers,
1065 sidedata_helpers=sidedata_helpers,
1066 )
1066 )
1067 for delta in deltas:
1067 for delta in deltas:
1068 for chunk in _revisiondeltatochunks(delta, self._builddeltaheader):
1068 for chunk in _revisiondeltatochunks(
1069 self._repo, delta, self._builddeltaheader
1070 ):
1069 size += len(chunk)
1071 size += len(chunk)
1070 yield chunk
1072 yield chunk
1071
1073
@@ -1121,7 +1123,9 b' class cgpacker(object):'
1121 yield chunk
1123 yield chunk
1122
1124
1123 for delta in deltas:
1125 for delta in deltas:
1124 chunks = _revisiondeltatochunks(delta, self._builddeltaheader)
1126 chunks = _revisiondeltatochunks(
1127 self._repo, delta, self._builddeltaheader
1128 )
1125 for chunk in chunks:
1129 for chunk in chunks:
1126 size += len(chunk)
1130 size += len(chunk)
1127 yield chunk
1131 yield chunk
@@ -1160,7 +1164,9 b' class cgpacker(object):'
1160 yield h
1164 yield h
1161
1165
1162 for delta in deltas:
1166 for delta in deltas:
1163 chunks = _revisiondeltatochunks(delta, self._builddeltaheader)
1167 chunks = _revisiondeltatochunks(
1168 self._repo, delta, self._builddeltaheader
1169 )
1164 for chunk in chunks:
1170 for chunk in chunks:
1165 size += len(chunk)
1171 size += len(chunk)
1166 yield chunk
1172 yield chunk
@@ -191,7 +191,7 b' class _changelogrevision(object):'
191 # Extensions might modify _defaultextra, so let the constructor below pass
191 # Extensions might modify _defaultextra, so let the constructor below pass
192 # it in
192 # it in
193 extra = attr.ib()
193 extra = attr.ib()
194 manifest = attr.ib(default=nullid)
194 manifest = attr.ib()
195 user = attr.ib(default=b'')
195 user = attr.ib(default=b'')
196 date = attr.ib(default=(0, 0))
196 date = attr.ib(default=(0, 0))
197 files = attr.ib(default=attr.Factory(list))
197 files = attr.ib(default=attr.Factory(list))
@@ -219,9 +219,9 b' class changelogrevision(object):'
219 '_changes',
219 '_changes',
220 )
220 )
221
221
222 def __new__(cls, text, sidedata, cpsd):
222 def __new__(cls, cl, text, sidedata, cpsd):
223 if not text:
223 if not text:
224 return _changelogrevision(extra=_defaultextra)
224 return _changelogrevision(extra=_defaultextra, manifest=nullid)
225
225
226 self = super(changelogrevision, cls).__new__(cls)
226 self = super(changelogrevision, cls).__new__(cls)
227 # We could return here and implement the following as an __init__.
227 # We could return here and implement the following as an __init__.
@@ -526,7 +526,7 b' class changelog(revlog.revlog):'
526 """
526 """
527 d, s = self._revisiondata(nodeorrev)
527 d, s = self._revisiondata(nodeorrev)
528 c = changelogrevision(
528 c = changelogrevision(
529 d, s, self._copiesstorage == b'changeset-sidedata'
529 self, d, s, self._copiesstorage == b'changeset-sidedata'
530 )
530 )
531 return (c.manifest, c.user, c.date, c.files, c.description, c.extra)
531 return (c.manifest, c.user, c.date, c.files, c.description, c.extra)
532
532
@@ -534,7 +534,7 b' class changelog(revlog.revlog):'
534 """Obtain a ``changelogrevision`` for a node or revision."""
534 """Obtain a ``changelogrevision`` for a node or revision."""
535 text, sidedata = self._revisiondata(nodeorrev)
535 text, sidedata = self._revisiondata(nodeorrev)
536 return changelogrevision(
536 return changelogrevision(
537 text, sidedata, self._copiesstorage == b'changeset-sidedata'
537 self, text, sidedata, self._copiesstorage == b'changeset-sidedata'
538 )
538 )
539
539
540 def readfiles(self, nodeorrev):
540 def readfiles(self, nodeorrev):
@@ -73,13 +73,16 b' def _getfsnow(vfs):'
73
73
74 @interfaceutil.implementer(intdirstate.idirstate)
74 @interfaceutil.implementer(intdirstate.idirstate)
75 class dirstate(object):
75 class dirstate(object):
76 def __init__(self, opener, ui, root, validate, sparsematchfn):
76 def __init__(
77 self, opener, ui, root, validate, sparsematchfn, nodeconstants
78 ):
77 """Create a new dirstate object.
79 """Create a new dirstate object.
78
80
79 opener is an open()-like callable that can be used to open the
81 opener is an open()-like callable that can be used to open the
80 dirstate file; root is the root of the directory tracked by
82 dirstate file; root is the root of the directory tracked by
81 the dirstate.
83 the dirstate.
82 """
84 """
85 self._nodeconstants = nodeconstants
83 self._opener = opener
86 self._opener = opener
84 self._validate = validate
87 self._validate = validate
85 self._root = root
88 self._root = root
@@ -136,7 +139,9 b' class dirstate(object):'
136 @propertycache
139 @propertycache
137 def _map(self):
140 def _map(self):
138 """Return the dirstate contents (see documentation for dirstatemap)."""
141 """Return the dirstate contents (see documentation for dirstatemap)."""
139 self._map = self._mapcls(self._ui, self._opener, self._root)
142 self._map = self._mapcls(
143 self._ui, self._opener, self._root, self._nodeconstants
144 )
140 return self._map
145 return self._map
141
146
142 @property
147 @property
@@ -1420,12 +1425,13 b' class dirstatemap(object):'
1420 denormalized form that they appear as in the dirstate.
1425 denormalized form that they appear as in the dirstate.
1421 """
1426 """
1422
1427
1423 def __init__(self, ui, opener, root):
1428 def __init__(self, ui, opener, root, nodeconstants):
1424 self._ui = ui
1429 self._ui = ui
1425 self._opener = opener
1430 self._opener = opener
1426 self._root = root
1431 self._root = root
1427 self._filename = b'dirstate'
1432 self._filename = b'dirstate'
1428 self._nodelen = 20
1433 self._nodelen = 20
1434 self._nodeconstants = nodeconstants
1429
1435
1430 self._parents = None
1436 self._parents = None
1431 self._dirtyparents = False
1437 self._dirtyparents = False
@@ -1724,7 +1730,8 b' class dirstatemap(object):'
1724 if rustmod is not None:
1730 if rustmod is not None:
1725
1731
1726 class dirstatemap(object):
1732 class dirstatemap(object):
1727 def __init__(self, ui, opener, root):
1733 def __init__(self, ui, opener, root, nodeconstants):
1734 self._nodeconstants = nodeconstants
1728 self._ui = ui
1735 self._ui = ui
1729 self._opener = opener
1736 self._opener = opener
1730 self._root = root
1737 self._root = root
@@ -270,9 +270,12 b' def _headssummary(pushop):'
270 # C. Update newmap with outgoing changes.
270 # C. Update newmap with outgoing changes.
271 # This will possibly add new heads and remove existing ones.
271 # This will possibly add new heads and remove existing ones.
272 newmap = branchmap.remotebranchcache(
272 newmap = branchmap.remotebranchcache(
273 (branch, heads[1])
273 repo,
274 for branch, heads in pycompat.iteritems(headssum)
274 (
275 if heads[0] is not None
275 (branch, heads[1])
276 for branch, heads in pycompat.iteritems(headssum)
277 if heads[0] is not None
278 ),
276 )
279 )
277 newmap.update(repo, (ctx.rev() for ctx in missingctx))
280 newmap.update(repo, (ctx.rev() for ctx in missingctx))
278 for branch, newheads in pycompat.iteritems(newmap):
281 for branch, newheads in pycompat.iteritems(newmap):
@@ -827,7 +827,7 b' def _pushb2checkbookmarks(pushop, bundle'
827 data = []
827 data = []
828 for book, old, new in pushop.outbookmarks:
828 for book, old, new in pushop.outbookmarks:
829 data.append((book, old))
829 data.append((book, old))
830 checkdata = bookmod.binaryencode(data)
830 checkdata = bookmod.binaryencode(pushop.repo, data)
831 bundler.newpart(b'check:bookmarks', data=checkdata)
831 bundler.newpart(b'check:bookmarks', data=checkdata)
832
832
833
833
@@ -1027,7 +1027,7 b' def _pushb2bookmarkspart(pushop, bundler'
1027 _abortonsecretctx(pushop, new, book)
1027 _abortonsecretctx(pushop, new, book)
1028 data.append((book, new))
1028 data.append((book, new))
1029 allactions.append((book, _bmaction(old, new)))
1029 allactions.append((book, _bmaction(old, new)))
1030 checkdata = bookmod.binaryencode(data)
1030 checkdata = bookmod.binaryencode(pushop.repo, data)
1031 bundler.newpart(b'bookmarks', data=checkdata)
1031 bundler.newpart(b'bookmarks', data=checkdata)
1032
1032
1033 def handlereply(op):
1033 def handlereply(op):
@@ -2455,7 +2455,7 b' def _getbundlebookmarkpart('
2455 if not b2caps or b'bookmarks' not in b2caps:
2455 if not b2caps or b'bookmarks' not in b2caps:
2456 raise error.Abort(_(b'no common bookmarks exchange method'))
2456 raise error.Abort(_(b'no common bookmarks exchange method'))
2457 books = bookmod.listbinbookmarks(repo)
2457 books = bookmod.listbinbookmarks(repo)
2458 data = bookmod.binaryencode(books)
2458 data = bookmod.binaryencode(repo, books)
2459 if data:
2459 if data:
2460 bundler.newpart(b'bookmarks', data=data)
2460 bundler.newpart(b'bookmarks', data=data)
2461
2461
@@ -33,6 +33,7 b' class filelog(object):'
33 # Used by LFS.
33 # Used by LFS.
34 self._revlog.filename = path
34 self._revlog.filename = path
35 self._revlog.revlog_kind = b'filelog'
35 self._revlog.revlog_kind = b'filelog'
36 self.nullid = self._revlog.nullid
36
37
37 def __len__(self):
38 def __len__(self):
38 return len(self._revlog)
39 return len(self._revlog)
@@ -8,7 +8,7 b' from . import util as interfaceutil'
8
8
9
9
10 class idirstate(interfaceutil.Interface):
10 class idirstate(interfaceutil.Interface):
11 def __init__(opener, ui, root, validate, sparsematchfn):
11 def __init__(opener, ui, root, validate, sparsematchfn, nodeconstants):
12 """Create a new dirstate object.
12 """Create a new dirstate object.
13
13
14 opener is an open()-like callable that can be used to open the
14 opener is an open()-like callable that can be used to open the
@@ -523,6 +523,10 b' class ifileindex(interfaceutil.Interface'
523 * Metadata to facilitate storage.
523 * Metadata to facilitate storage.
524 """
524 """
525
525
526 nullid = interfaceutil.Attribute(
527 """node for the null revision for use as delta base."""
528 )
529
526 def __len__():
530 def __len__():
527 """Obtain the number of revisions stored for this file."""
531 """Obtain the number of revisions stored for this file."""
528
532
@@ -1143,6 +1147,10 b' class imanifestrevisionwritable(imanifes'
1143 class imanifeststorage(interfaceutil.Interface):
1147 class imanifeststorage(interfaceutil.Interface):
1144 """Storage interface for manifest data."""
1148 """Storage interface for manifest data."""
1145
1149
1150 nodeconstants = interfaceutil.Attribute(
1151 """nodeconstants used by the current repository."""
1152 )
1153
1146 tree = interfaceutil.Attribute(
1154 tree = interfaceutil.Attribute(
1147 """The path to the directory this manifest tracks.
1155 """The path to the directory this manifest tracks.
1148
1156
@@ -1366,6 +1374,10 b' class imanifestlog(interfaceutil.Interfa'
1366 tree manifests.
1374 tree manifests.
1367 """
1375 """
1368
1376
1377 nodeconstants = interfaceutil.Attribute(
1378 """nodeconstants used by the current repository."""
1379 )
1380
1369 def __getitem__(node):
1381 def __getitem__(node):
1370 """Obtain a manifest instance for a given binary node.
1382 """Obtain a manifest instance for a given binary node.
1371
1383
@@ -1434,6 +1446,13 b' class ilocalrepositorymain(interfaceutil'
1434 This currently captures the reality of things - not how things should be.
1446 This currently captures the reality of things - not how things should be.
1435 """
1447 """
1436
1448
1449 nodeconstants = interfaceutil.Attribute(
1450 """Constant nodes matching the hash function used by the repository."""
1451 )
1452 nullid = interfaceutil.Attribute(
1453 """null revision for the hash function used by the repository."""
1454 )
1455
1437 supportedformats = interfaceutil.Attribute(
1456 supportedformats = interfaceutil.Attribute(
1438 """Set of requirements that apply to stream clone.
1457 """Set of requirements that apply to stream clone.
1439
1458
@@ -21,6 +21,7 b' from .node import ('
21 hex,
21 hex,
22 nullid,
22 nullid,
23 nullrev,
23 nullrev,
24 sha1nodeconstants,
24 short,
25 short,
25 )
26 )
26 from .pycompat import (
27 from .pycompat import (
@@ -1330,6 +1331,8 b' class localrepository(object):'
1330 self.vfs = hgvfs
1331 self.vfs = hgvfs
1331 self.path = hgvfs.base
1332 self.path = hgvfs.base
1332 self.requirements = requirements
1333 self.requirements = requirements
1334 self.nodeconstants = sha1nodeconstants
1335 self.nullid = self.nodeconstants.nullid
1333 self.supported = supportedrequirements
1336 self.supported = supportedrequirements
1334 self.sharedpath = sharedpath
1337 self.sharedpath = sharedpath
1335 self.store = store
1338 self.store = store
@@ -1676,7 +1679,12 b' class localrepository(object):'
1676 sparsematchfn = lambda: sparse.matcher(self)
1679 sparsematchfn = lambda: sparse.matcher(self)
1677
1680
1678 return dirstate.dirstate(
1681 return dirstate.dirstate(
1679 self.vfs, self.ui, self.root, self._dirstatevalidate, sparsematchfn
1682 self.vfs,
1683 self.ui,
1684 self.root,
1685 self._dirstatevalidate,
1686 sparsematchfn,
1687 self.nodeconstants,
1680 )
1688 )
1681
1689
1682 def _dirstatevalidate(self, node):
1690 def _dirstatevalidate(self, node):
@@ -792,8 +792,9 b' def _splittopdir(f):'
792
792
793 @interfaceutil.implementer(repository.imanifestdict)
793 @interfaceutil.implementer(repository.imanifestdict)
794 class treemanifest(object):
794 class treemanifest(object):
795 def __init__(self, dir=b'', text=b''):
795 def __init__(self, nodeconstants, dir=b'', text=b''):
796 self._dir = dir
796 self._dir = dir
797 self.nodeconstants = nodeconstants
797 self._node = nullid
798 self._node = nullid
798 self._loadfunc = _noop
799 self._loadfunc = _noop
799 self._copyfunc = _noop
800 self._copyfunc = _noop
@@ -1051,7 +1052,9 b' class treemanifest(object):'
1051 if dir:
1052 if dir:
1052 self._loadlazy(dir)
1053 self._loadlazy(dir)
1053 if dir not in self._dirs:
1054 if dir not in self._dirs:
1054 self._dirs[dir] = treemanifest(self._subpath(dir))
1055 self._dirs[dir] = treemanifest(
1056 self.nodeconstants, self._subpath(dir)
1057 )
1055 self._dirs[dir].__setitem__(subpath, n)
1058 self._dirs[dir].__setitem__(subpath, n)
1056 else:
1059 else:
1057 # manifest nodes are either 20 bytes or 32 bytes,
1060 # manifest nodes are either 20 bytes or 32 bytes,
@@ -1078,14 +1081,16 b' class treemanifest(object):'
1078 if dir:
1081 if dir:
1079 self._loadlazy(dir)
1082 self._loadlazy(dir)
1080 if dir not in self._dirs:
1083 if dir not in self._dirs:
1081 self._dirs[dir] = treemanifest(self._subpath(dir))
1084 self._dirs[dir] = treemanifest(
1085 self.nodeconstants, self._subpath(dir)
1086 )
1082 self._dirs[dir].setflag(subpath, flags)
1087 self._dirs[dir].setflag(subpath, flags)
1083 else:
1088 else:
1084 self._flags[f] = flags
1089 self._flags[f] = flags
1085 self._dirty = True
1090 self._dirty = True
1086
1091
1087 def copy(self):
1092 def copy(self):
1088 copy = treemanifest(self._dir)
1093 copy = treemanifest(self.nodeconstants, self._dir)
1089 copy._node = self._node
1094 copy._node = self._node
1090 copy._dirty = self._dirty
1095 copy._dirty = self._dirty
1091 if self._copyfunc is _noop:
1096 if self._copyfunc is _noop:
@@ -1215,7 +1220,7 b' class treemanifest(object):'
1215 visit = match.visitchildrenset(self._dir[:-1])
1220 visit = match.visitchildrenset(self._dir[:-1])
1216 if visit == b'all':
1221 if visit == b'all':
1217 return self.copy()
1222 return self.copy()
1218 ret = treemanifest(self._dir)
1223 ret = treemanifest(self.nodeconstants, self._dir)
1219 if not visit:
1224 if not visit:
1220 return ret
1225 return ret
1221
1226
@@ -1272,7 +1277,7 b' class treemanifest(object):'
1272 m2 = m2._matches(match)
1277 m2 = m2._matches(match)
1273 return m1.diff(m2, clean=clean)
1278 return m1.diff(m2, clean=clean)
1274 result = {}
1279 result = {}
1275 emptytree = treemanifest()
1280 emptytree = treemanifest(self.nodeconstants)
1276
1281
1277 def _iterativediff(t1, t2, stack):
1282 def _iterativediff(t1, t2, stack):
1278 """compares two tree manifests and append new tree-manifests which
1283 """compares two tree manifests and append new tree-manifests which
@@ -1368,7 +1373,7 b' class treemanifest(object):'
1368 self._load() # for consistency; should never have any effect here
1373 self._load() # for consistency; should never have any effect here
1369 m1._load()
1374 m1._load()
1370 m2._load()
1375 m2._load()
1371 emptytree = treemanifest()
1376 emptytree = treemanifest(self.nodeconstants)
1372
1377
1373 def getnode(m, d):
1378 def getnode(m, d):
1374 ld = m._lazydirs.get(d)
1379 ld = m._lazydirs.get(d)
@@ -1551,6 +1556,7 b' class manifestrevlog(object):'
1551
1556
1552 def __init__(
1557 def __init__(
1553 self,
1558 self,
1559 nodeconstants,
1554 opener,
1560 opener,
1555 tree=b'',
1561 tree=b'',
1556 dirlogcache=None,
1562 dirlogcache=None,
@@ -1567,6 +1573,7 b' class manifestrevlog(object):'
1567 option takes precedence, so if it is set to True, we ignore whatever
1573 option takes precedence, so if it is set to True, we ignore whatever
1568 value is passed in to the constructor.
1574 value is passed in to the constructor.
1569 """
1575 """
1576 self.nodeconstants = nodeconstants
1570 # During normal operations, we expect to deal with not more than four
1577 # During normal operations, we expect to deal with not more than four
1571 # revs at a time (such as during commit --amend). When rebasing large
1578 # revs at a time (such as during commit --amend). When rebasing large
1572 # stacks of commits, the number can go up, hence the config knob below.
1579 # stacks of commits, the number can go up, hence the config knob below.
@@ -1654,7 +1661,11 b' class manifestrevlog(object):'
1654 assert self._treeondisk
1661 assert self._treeondisk
1655 if d not in self._dirlogcache:
1662 if d not in self._dirlogcache:
1656 mfrevlog = manifestrevlog(
1663 mfrevlog = manifestrevlog(
1657 self.opener, d, self._dirlogcache, treemanifest=self._treeondisk
1664 self.nodeconstants,
1665 self.opener,
1666 d,
1667 self._dirlogcache,
1668 treemanifest=self._treeondisk,
1658 )
1669 )
1659 self._dirlogcache[d] = mfrevlog
1670 self._dirlogcache[d] = mfrevlog
1660 return self._dirlogcache[d]
1671 return self._dirlogcache[d]
@@ -1917,6 +1928,7 b' class manifestlog(object):'
1917 they receive (i.e. tree or flat or lazily loaded, etc)."""
1928 they receive (i.e. tree or flat or lazily loaded, etc)."""
1918
1929
1919 def __init__(self, opener, repo, rootstore, narrowmatch):
1930 def __init__(self, opener, repo, rootstore, narrowmatch):
1931 self.nodeconstants = repo.nodeconstants
1920 usetreemanifest = False
1932 usetreemanifest = False
1921 cachesize = 4
1933 cachesize = 4
1922
1934
@@ -1955,7 +1967,7 b' class manifestlog(object):'
1955
1967
1956 if not self._narrowmatch.always():
1968 if not self._narrowmatch.always():
1957 if not self._narrowmatch.visitdir(tree[:-1]):
1969 if not self._narrowmatch.visitdir(tree[:-1]):
1958 return excludeddirmanifestctx(tree, node)
1970 return excludeddirmanifestctx(self.nodeconstants, tree, node)
1959 if tree:
1971 if tree:
1960 if self._rootstore._treeondisk:
1972 if self._rootstore._treeondisk:
1961 if verify:
1973 if verify:
@@ -2118,7 +2130,7 b' class memtreemanifestctx(object):'
2118 def __init__(self, manifestlog, dir=b''):
2130 def __init__(self, manifestlog, dir=b''):
2119 self._manifestlog = manifestlog
2131 self._manifestlog = manifestlog
2120 self._dir = dir
2132 self._dir = dir
2121 self._treemanifest = treemanifest()
2133 self._treemanifest = treemanifest(manifestlog.nodeconstants)
2122
2134
2123 def _storage(self):
2135 def _storage(self):
2124 return self._manifestlog.getstorage(b'')
2136 return self._manifestlog.getstorage(b'')
@@ -2168,17 +2180,19 b' class treemanifestctx(object):'
2168 narrowmatch = self._manifestlog._narrowmatch
2180 narrowmatch = self._manifestlog._narrowmatch
2169 if not narrowmatch.always():
2181 if not narrowmatch.always():
2170 if not narrowmatch.visitdir(self._dir[:-1]):
2182 if not narrowmatch.visitdir(self._dir[:-1]):
2171 return excludedmanifestrevlog(self._dir)
2183 return excludedmanifestrevlog(
2184 self._manifestlog.nodeconstants, self._dir
2185 )
2172 return self._manifestlog.getstorage(self._dir)
2186 return self._manifestlog.getstorage(self._dir)
2173
2187
2174 def read(self):
2188 def read(self):
2175 if self._data is None:
2189 if self._data is None:
2176 store = self._storage()
2190 store = self._storage()
2177 if self._node == nullid:
2191 if self._node == nullid:
2178 self._data = treemanifest()
2192 self._data = treemanifest(self._manifestlog.nodeconstants)
2179 # TODO accessing non-public API
2193 # TODO accessing non-public API
2180 elif store._treeondisk:
2194 elif store._treeondisk:
2181 m = treemanifest(dir=self._dir)
2195 m = treemanifest(self._manifestlog.nodeconstants, dir=self._dir)
2182
2196
2183 def gettext():
2197 def gettext():
2184 return store.revision(self._node)
2198 return store.revision(self._node)
@@ -2198,7 +2212,9 b' class treemanifestctx(object):'
2198 text = store.revision(self._node)
2212 text = store.revision(self._node)
2199 arraytext = bytearray(text)
2213 arraytext = bytearray(text)
2200 store.fulltextcache[self._node] = arraytext
2214 store.fulltextcache[self._node] = arraytext
2201 self._data = treemanifest(dir=self._dir, text=text)
2215 self._data = treemanifest(
2216 self._manifestlog.nodeconstants, dir=self._dir, text=text
2217 )
2202
2218
2203 return self._data
2219 return self._data
2204
2220
@@ -2235,7 +2251,7 b' class treemanifestctx(object):'
2235 r0 = store.deltaparent(store.rev(self._node))
2251 r0 = store.deltaparent(store.rev(self._node))
2236 m0 = self._manifestlog.get(self._dir, store.node(r0)).read()
2252 m0 = self._manifestlog.get(self._dir, store.node(r0)).read()
2237 m1 = self.read()
2253 m1 = self.read()
2238 md = treemanifest(dir=self._dir)
2254 md = treemanifest(self._manifestlog.nodeconstants, dir=self._dir)
2239 for f, ((n0, fl0), (n1, fl1)) in pycompat.iteritems(m0.diff(m1)):
2255 for f, ((n0, fl0), (n1, fl1)) in pycompat.iteritems(m0.diff(m1)):
2240 if n1:
2256 if n1:
2241 md[f] = n1
2257 md[f] = n1
@@ -2278,8 +2294,8 b' class excludeddir(treemanifest):'
2278 whose contents are unknown.
2294 whose contents are unknown.
2279 """
2295 """
2280
2296
2281 def __init__(self, dir, node):
2297 def __init__(self, nodeconstants, dir, node):
2282 super(excludeddir, self).__init__(dir)
2298 super(excludeddir, self).__init__(nodeconstants, dir)
2283 self._node = node
2299 self._node = node
2284 # Add an empty file, which will be included by iterators and such,
2300 # Add an empty file, which will be included by iterators and such,
2285 # appearing as the directory itself (i.e. something like "dir/")
2301 # appearing as the directory itself (i.e. something like "dir/")
@@ -2298,12 +2314,13 b' class excludeddir(treemanifest):'
2298 class excludeddirmanifestctx(treemanifestctx):
2314 class excludeddirmanifestctx(treemanifestctx):
2299 """context wrapper for excludeddir - see that docstring for rationale"""
2315 """context wrapper for excludeddir - see that docstring for rationale"""
2300
2316
2301 def __init__(self, dir, node):
2317 def __init__(self, nodeconstants, dir, node):
2318 self.nodeconstants = nodeconstants
2302 self._dir = dir
2319 self._dir = dir
2303 self._node = node
2320 self._node = node
2304
2321
2305 def read(self):
2322 def read(self):
2306 return excludeddir(self._dir, self._node)
2323 return excludeddir(self.nodeconstants, self._dir, self._node)
2307
2324
2308 def readfast(self, shallow=False):
2325 def readfast(self, shallow=False):
2309 # special version of readfast since we don't have underlying storage
2326 # special version of readfast since we don't have underlying storage
@@ -2325,7 +2342,8 b' class excludedmanifestrevlog(manifestrev'
2325 outside the narrowspec.
2342 outside the narrowspec.
2326 """
2343 """
2327
2344
2328 def __init__(self, dir):
2345 def __init__(self, nodeconstants, dir):
2346 self.nodeconstants = nodeconstants
2329 self._dir = dir
2347 self._dir = dir
2330
2348
2331 def __len__(self):
2349 def __len__(self):
@@ -21,29 +21,48 b' def bin(s):'
21 raise TypeError(e)
21 raise TypeError(e)
22
22
23
23
24 nullrev = -1
24 def short(node):
25 # In hex, this is '0000000000000000000000000000000000000000'
25 return hex(node[:6])
26 nullid = b"\0" * 20
26
27 nullhex = hex(nullid)
28
27
29 # Phony node value to stand-in for new files in some uses of
28 nullrev = -1
30 # manifests.
31 # In hex, this is '2121212121212121212121212121212121212121'
32 newnodeid = b'!!!!!!!!!!!!!!!!!!!!'
33 # In hex, this is '3030303030303030303030303030306164646564'
34 addednodeid = b'000000000000000added'
35 # In hex, this is '3030303030303030303030306d6f646966696564'
36 modifiednodeid = b'000000000000modified'
37
29
38 wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid}
30 # pseudo identifier for working directory
39
31 # (experimental, so don't add too many dependencies on it)
40 # pseudo identifiers for working directory
41 # (they are experimental, so don't add too many dependencies on them)
42 wdirrev = 0x7FFFFFFF
32 wdirrev = 0x7FFFFFFF
43 # In hex, this is 'ffffffffffffffffffffffffffffffffffffffff'
44 wdirid = b"\xff" * 20
45 wdirhex = hex(wdirid)
46
33
47
34
48 def short(node):
35 class sha1nodeconstants(object):
49 return hex(node[:6])
36 nodelen = 20
37
38 # In hex, this is '0000000000000000000000000000000000000000'
39 nullid = b"\0" * nodelen
40 nullhex = hex(nullid)
41
42 # Phony node value to stand-in for new files in some uses of
43 # manifests.
44 # In hex, this is '2121212121212121212121212121212121212121'
45 newnodeid = b'!!!!!!!!!!!!!!!!!!!!'
46 # In hex, this is '3030303030303030303030303030306164646564'
47 addednodeid = b'000000000000000added'
48 # In hex, this is '3030303030303030303030306d6f646966696564'
49 modifiednodeid = b'000000000000modified'
50
51 wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid}
52
53 # pseudo identifier for working directory
54 # (experimental, so don't add too many dependencies on it)
55 # In hex, this is 'ffffffffffffffffffffffffffffffffffffffff'
56 wdirid = b"\xff" * nodelen
57 wdirhex = hex(wdirid)
58
59
60 # legacy starting point for porting modules
61 nullid = sha1nodeconstants.nullid
62 nullhex = sha1nodeconstants.nullhex
63 newnodeid = sha1nodeconstants.newnodeid
64 addednodeid = sha1nodeconstants.addednodeid
65 modifiednodeid = sha1nodeconstants.modifiednodeid
66 wdirfilenodeids = sha1nodeconstants.wdirfilenodeids
67 wdirid = sha1nodeconstants.wdirid
68 wdirhex = sha1nodeconstants.wdirhex
@@ -560,10 +560,11 b' class obsstore(object):'
560 # parents: (tuple of nodeid) or None, parents of predecessors
560 # parents: (tuple of nodeid) or None, parents of predecessors
561 # None is used when no data has been recorded
561 # None is used when no data has been recorded
562
562
563 def __init__(self, svfs, defaultformat=_fm1version, readonly=False):
563 def __init__(self, repo, svfs, defaultformat=_fm1version, readonly=False):
564 # caches for various obsolescence related cache
564 # caches for various obsolescence related cache
565 self.caches = {}
565 self.caches = {}
566 self.svfs = svfs
566 self.svfs = svfs
567 self.repo = repo
567 self._defaultformat = defaultformat
568 self._defaultformat = defaultformat
568 self._readonly = readonly
569 self._readonly = readonly
569
570
@@ -806,7 +807,7 b' def makestore(ui, repo):'
806 if defaultformat is not None:
807 if defaultformat is not None:
807 kwargs['defaultformat'] = defaultformat
808 kwargs['defaultformat'] = defaultformat
808 readonly = not isenabled(repo, createmarkersopt)
809 readonly = not isenabled(repo, createmarkersopt)
809 store = obsstore(repo.svfs, readonly=readonly, **kwargs)
810 store = obsstore(repo, repo.svfs, readonly=readonly, **kwargs)
810 if store and readonly:
811 if store and readonly:
811 ui.warn(
812 ui.warn(
812 _(b'obsolete feature not enabled but %i markers found!\n')
813 _(b'obsolete feature not enabled but %i markers found!\n')
@@ -28,6 +28,7 b' from .node import ('
28 nullhex,
28 nullhex,
29 nullid,
29 nullid,
30 nullrev,
30 nullrev,
31 sha1nodeconstants,
31 short,
32 short,
32 wdirfilenodeids,
33 wdirfilenodeids,
33 wdirhex,
34 wdirhex,
@@ -651,6 +652,10 b' class revlog(object):'
651 raise error.RevlogError(
652 raise error.RevlogError(
652 _(b'unknown version (%d) in revlog %s') % (fmt, self.indexfile)
653 _(b'unknown version (%d) in revlog %s') % (fmt, self.indexfile)
653 )
654 )
655
656 self.nodeconstants = sha1nodeconstants
657 self.nullid = self.nodeconstants.nullid
658
654 # sparse-revlog can't be on without general-delta (issue6056)
659 # sparse-revlog can't be on without general-delta (issue6056)
655 if not self._generaldelta:
660 if not self._generaldelta:
656 self._sparserevlog = False
661 self._sparserevlog = False
@@ -12,6 +12,7 b' from __future__ import absolute_import'
12 import errno
12 import errno
13
13
14 from .i18n import _
14 from .i18n import _
15 from .node import sha1nodeconstants
15 from . import (
16 from . import (
16 branchmap,
17 branchmap,
17 changelog,
18 changelog,
@@ -198,6 +199,8 b' class statichttprepository('
198 requirements, supportedrequirements
199 requirements, supportedrequirements
199 )
200 )
200 localrepo.ensurerequirementscompatible(ui, requirements)
201 localrepo.ensurerequirementscompatible(ui, requirements)
202 self.nodeconstants = sha1nodeconstants
203 self.nullid = self.nodeconstants.nullid
201
204
202 # setup store
205 # setup store
203 self.store = localrepo.makestore(requirements, self.path, vfsclass)
206 self.store = localrepo.makestore(requirements, self.path, vfsclass)
@@ -207,7 +210,7 b' class statichttprepository('
207 self._filecache = {}
210 self._filecache = {}
208 self.requirements = requirements
211 self.requirements = requirements
209
212
210 rootmanifest = manifest.manifestrevlog(self.svfs)
213 rootmanifest = manifest.manifestrevlog(self.nodeconstants, self.svfs)
211 self.manifestlog = manifest.manifestlog(
214 self.manifestlog = manifest.manifestlog(
212 self.svfs, self, rootmanifest, self.narrowmatch()
215 self.svfs, self, rootmanifest, self.narrowmatch()
213 )
216 )
@@ -441,7 +441,7 b' class basicstore(object):'
441 )
441 )
442
442
443 def manifestlog(self, repo, storenarrowmatch):
443 def manifestlog(self, repo, storenarrowmatch):
444 rootstore = manifest.manifestrevlog(self.vfs)
444 rootstore = manifest.manifestrevlog(repo.nodeconstants, self.vfs)
445 return manifest.manifestlog(self.vfs, repo, rootstore, storenarrowmatch)
445 return manifest.manifestlog(self.vfs, repo, rootstore, storenarrowmatch)
446
446
447 def datafiles(self, matcher=None):
447 def datafiles(self, matcher=None):
@@ -153,9 +153,9 b' class unionchangelog(unionrevlog, change'
153
153
154
154
155 class unionmanifest(unionrevlog, manifest.manifestrevlog):
155 class unionmanifest(unionrevlog, manifest.manifestrevlog):
156 def __init__(self, opener, opener2, linkmapper):
156 def __init__(self, nodeconstants, opener, opener2, linkmapper):
157 manifest.manifestrevlog.__init__(self, opener)
157 manifest.manifestrevlog.__init__(self, nodeconstants, opener)
158 manifest2 = manifest.manifestrevlog(opener2)
158 manifest2 = manifest.manifestrevlog(nodeconstants, opener2)
159 unionrevlog.__init__(
159 unionrevlog.__init__(
160 self, opener, self.indexfile, manifest2, linkmapper
160 self, opener, self.indexfile, manifest2, linkmapper
161 )
161 )
@@ -205,7 +205,10 b' class unionrepository(object):'
205 @localrepo.unfilteredpropertycache
205 @localrepo.unfilteredpropertycache
206 def manifestlog(self):
206 def manifestlog(self):
207 rootstore = unionmanifest(
207 rootstore = unionmanifest(
208 self.svfs, self.repo2.svfs, self.unfiltered()._clrev
208 self.nodeconstants,
209 self.svfs,
210 self.repo2.svfs,
211 self.unfiltered()._clrev,
209 )
212 )
210 return manifest.manifestlog(
213 return manifest.manifestlog(
211 self.svfs, self, rootstore, self.narrowmatch()
214 self.svfs, self, rootstore, self.narrowmatch()
@@ -36,7 +36,9 b' def _revlogfrompath(repo, path):'
36 return changelog.changelog(repo.svfs)
36 return changelog.changelog(repo.svfs)
37 elif path.endswith(b'00manifest.i'):
37 elif path.endswith(b'00manifest.i'):
38 mandir = path[: -len(b'00manifest.i')]
38 mandir = path[: -len(b'00manifest.i')]
39 return manifest.manifestrevlog(repo.svfs, tree=mandir)
39 return manifest.manifestrevlog(
40 repo.nodeconstants, repo.svfs, tree=mandir
41 )
40 else:
42 else:
41 # reverse of "/".join(("data", path + ".i"))
43 # reverse of "/".join(("data", path + ".i"))
42 return filelog.filelog(repo.svfs, path[5:-2])
44 return filelog.filelog(repo.svfs, path[5:-2])
@@ -43,3 +43,7 b''
43 now get a revision number as argument instead of a node.
43 now get a revision number as argument instead of a node.
44
44
45 * revlog.addrevision returns the revision number instead of the node.
45 * revlog.addrevision returns the revision number instead of the node.
46
47 * `nodes.nullid` and related constants are being phased out as part of
48 the deprecation of SHA1. Repository instances and related classes
49 provide access via `nodeconstants` and in some cases `nullid` attributes.
@@ -106,7 +106,9 b' class filestorage(object):'
106
106
107 _flagserrorclass = simplestoreerror
107 _flagserrorclass = simplestoreerror
108
108
109 def __init__(self, svfs, path):
109 def __init__(self, repo, svfs, path):
110 self.nullid = repo.nullid
111 self._repo = repo
110 self._svfs = svfs
112 self._svfs = svfs
111 self._path = path
113 self._path = path
112
114
@@ -689,7 +691,7 b' def reposetup(ui, repo):'
689
691
690 class simplestorerepo(repo.__class__):
692 class simplestorerepo(repo.__class__):
691 def file(self, f):
693 def file(self, f):
692 return filestorage(self.svfs, f)
694 return filestorage(repo, self.svfs, f)
693
695
694 repo.__class__ = simplestorerepo
696 repo.__class__ = simplestorerepo
695
697
@@ -248,7 +248,10 b' def main():'
248
248
249 # Conforms to imanifestlog.
249 # Conforms to imanifestlog.
250 ml = manifest.manifestlog(
250 ml = manifest.manifestlog(
251 vfs, repo, manifest.manifestrevlog(repo.svfs), repo.narrowmatch()
251 vfs,
252 repo,
253 manifest.manifestrevlog(repo.nodeconstants, repo.svfs),
254 repo.narrowmatch(),
252 )
255 )
253 checkzobject(ml)
256 checkzobject(ml)
254 checkzobject(repo.manifestlog)
257 checkzobject(repo.manifestlog)
@@ -263,7 +266,7 b' def main():'
263 # Conforms to imanifestdict.
266 # Conforms to imanifestdict.
264 checkzobject(mctx.read())
267 checkzobject(mctx.read())
265
268
266 mrl = manifest.manifestrevlog(vfs)
269 mrl = manifest.manifestrevlog(repo.nodeconstants, vfs)
267 checkzobject(mrl)
270 checkzobject(mrl)
268
271
269 ziverify.verifyClass(repository.irevisiondelta, revlog.revlogrevisiondelta)
272 ziverify.verifyClass(repository.irevisiondelta, revlog.revlogrevisiondelta)
@@ -6,6 +6,8 b' import silenttestrunner'
6 import unittest
6 import unittest
7 import zlib
7 import zlib
8
8
9 from mercurial.node import sha1nodeconstants
10
9 from mercurial import (
11 from mercurial import (
10 manifest as manifestmod,
12 manifest as manifestmod,
11 match as matchmod,
13 match as matchmod,
@@ -436,7 +438,7 b' class testmanifestdict(unittest.TestCase'
436
438
437 class testtreemanifest(unittest.TestCase, basemanifesttests):
439 class testtreemanifest(unittest.TestCase, basemanifesttests):
438 def parsemanifest(self, text):
440 def parsemanifest(self, text):
439 return manifestmod.treemanifest(b'', text)
441 return manifestmod.treemanifest(sha1nodeconstants, b'', text)
440
442
441 def testWalkSubtrees(self):
443 def testWalkSubtrees(self):
442 m = self.parsemanifest(A_DEEPER_MANIFEST)
444 m = self.parsemanifest(A_DEEPER_MANIFEST)
General Comments 0
You need to be logged in to leave comments. Login now