477 and (2) the extension to allow filelog merging between the revision |
477 and (2) the extension to allow filelog merging between the revision |
478 and its ancestor by overriding "repo._filecommit". |
478 and its ancestor by overriding "repo._filecommit". |
479 |
479 |
480 $ cat > ../legacyrepo.py <<EOF |
480 $ cat > ../legacyrepo.py <<EOF |
481 > from __future__ import absolute_import |
481 > from __future__ import absolute_import |
482 > from mercurial import commit, error, extensions, node |
482 > from mercurial import commit, error, extensions |
483 > def _filecommit(orig, repo, fctx, manifest1, manifest2, |
483 > def _filecommit(orig, repo, fctx, manifest1, manifest2, |
484 > linkrev, tr, includecopymeta, ms): |
484 > linkrev, tr, includecopymeta, ms): |
485 > fname = fctx.path() |
485 > fname = fctx.path() |
486 > text = fctx.data() |
486 > text = fctx.data() |
487 > flog = repo.file(fname) |
487 > flog = repo.file(fname) |
488 > fparent1 = manifest1.get(fname, node.nullid) |
488 > fparent1 = manifest1.get(fname, repo.nullid) |
489 > fparent2 = manifest2.get(fname, node.nullid) |
489 > fparent2 = manifest2.get(fname, repo.nullid) |
490 > meta = {} |
490 > meta = {} |
491 > copy = fctx.copysource() |
491 > copy = fctx.copysource() |
492 > if copy and copy != fname: |
492 > if copy and copy != fname: |
493 > raise error.Abort('copying is not supported') |
493 > raise error.Abort('copying is not supported') |
494 > if fparent2 != node.nullid: |
494 > if fparent2 != repo.nullid: |
495 > return flog.add(text, meta, tr, linkrev, |
495 > return flog.add(text, meta, tr, linkrev, |
496 > fparent1, fparent2), 'modified' |
496 > fparent1, fparent2), 'modified' |
497 > raise error.Abort('only merging is supported') |
497 > raise error.Abort('only merging is supported') |
498 > def uisetup(ui): |
498 > def uisetup(ui): |
499 > extensions.wrapfunction(commit, '_filecommit', _filecommit) |
499 > extensions.wrapfunction(commit, '_filecommit', _filecommit) |