Mercurial > hg
comparison tests/test-fastannotate-hg.t @ 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 | 037e88d453fa |
children | 12966768595a |
comparison
equal
deleted
inserted
replaced
46992:5fa019ceb499 | 47012:d55b71393907 |
---|---|
480 and (2) the extension to allow filelog merging between the revision | 480 and (2) the extension to allow filelog merging between the revision |
481 and its ancestor by overriding "repo._filecommit". | 481 and its ancestor by overriding "repo._filecommit". |
482 | 482 |
483 $ cat > ../legacyrepo.py <<EOF | 483 $ cat > ../legacyrepo.py <<EOF |
484 > from __future__ import absolute_import | 484 > from __future__ import absolute_import |
485 > from mercurial import commit, error, extensions, node | 485 > from mercurial import commit, error, extensions |
486 > def _filecommit(orig, repo, fctx, manifest1, manifest2, | 486 > def _filecommit(orig, repo, fctx, manifest1, manifest2, |
487 > linkrev, tr, includecopymeta, ms): | 487 > linkrev, tr, includecopymeta, ms): |
488 > fname = fctx.path() | 488 > fname = fctx.path() |
489 > text = fctx.data() | 489 > text = fctx.data() |
490 > flog = repo.file(fname) | 490 > flog = repo.file(fname) |
491 > fparent1 = manifest1.get(fname, node.nullid) | 491 > fparent1 = manifest1.get(fname, repo.nullid) |
492 > fparent2 = manifest2.get(fname, node.nullid) | 492 > fparent2 = manifest2.get(fname, repo.nullid) |
493 > meta = {} | 493 > meta = {} |
494 > copy = fctx.copysource() | 494 > copy = fctx.copysource() |
495 > if copy and copy != fname: | 495 > if copy and copy != fname: |
496 > raise error.Abort('copying is not supported') | 496 > raise error.Abort('copying is not supported') |
497 > if fparent2 != node.nullid: | 497 > if fparent2 != repo.nullid: |
498 > return flog.add(text, meta, tr, linkrev, | 498 > return flog.add(text, meta, tr, linkrev, |
499 > fparent1, fparent2), 'modified' | 499 > fparent1, fparent2), 'modified' |
500 > raise error.Abort('only merging is supported') | 500 > raise error.Abort('only merging is supported') |
501 > def uisetup(ui): | 501 > def uisetup(ui): |
502 > extensions.wrapfunction(commit, '_filecommit', _filecommit) | 502 > extensions.wrapfunction(commit, '_filecommit', _filecommit) |