297 "hg debugsetparents" to merge without ancestor check by "hg merge", |
297 "hg debugsetparents" to merge without ancestor check by "hg merge", |
298 and (2) the extension to allow filelog merging between the revision |
298 and (2) the extension to allow filelog merging between the revision |
299 and its ancestor by overriding "repo._filecommit". |
299 and its ancestor by overriding "repo._filecommit". |
300 |
300 |
301 $ cat > ../legacyrepo.py <<EOF |
301 $ cat > ../legacyrepo.py <<EOF |
302 > from mercurial import node, util |
302 > from mercurial import node, error |
303 > def reposetup(ui, repo): |
303 > def reposetup(ui, repo): |
304 > class legacyrepo(repo.__class__): |
304 > class legacyrepo(repo.__class__): |
305 > def _filecommit(self, fctx, manifest1, manifest2, |
305 > def _filecommit(self, fctx, manifest1, manifest2, |
306 > linkrev, tr, changelist): |
306 > linkrev, tr, changelist): |
307 > fname = fctx.path() |
307 > fname = fctx.path() |
310 > fparent1 = manifest1.get(fname, node.nullid) |
310 > fparent1 = manifest1.get(fname, node.nullid) |
311 > fparent2 = manifest2.get(fname, node.nullid) |
311 > fparent2 = manifest2.get(fname, node.nullid) |
312 > meta = {} |
312 > meta = {} |
313 > copy = fctx.renamed() |
313 > copy = fctx.renamed() |
314 > if copy and copy[0] != fname: |
314 > if copy and copy[0] != fname: |
315 > raise util.Abort('copying is not supported') |
315 > raise error.Abort('copying is not supported') |
316 > if fparent2 != node.nullid: |
316 > if fparent2 != node.nullid: |
317 > changelist.append(fname) |
317 > changelist.append(fname) |
318 > return flog.add(text, meta, tr, linkrev, |
318 > return flog.add(text, meta, tr, linkrev, |
319 > fparent1, fparent2) |
319 > fparent1, fparent2) |
320 > raise util.Abort('only merging is supported') |
320 > raise error.Abort('only merging is supported') |
321 > repo.__class__ = legacyrepo |
321 > repo.__class__ = legacyrepo |
322 > EOF |
322 > EOF |
323 |
323 |
324 $ cat > baz <<EOF |
324 $ cat > baz <<EOF |
325 > 1 |
325 > 1 |