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) |