diff --git a/tests/test-treemanifest-treeonly.t b/tests/test-treemanifest-treeonly.t --- a/tests/test-treemanifest-treeonly.t +++ b/tests/test-treemanifest-treeonly.t @@ -425,20 +425,35 @@ > [treemanifest] > treeonly=False > EOF + $ cp .hg/store/00manifest.i .hg/store/00manifest.i.bak + $ cp .hg/store/00changelog.i .hg/store/00changelog.i.bak + +- Auto-backfill on pull $ hg pull + backfilling missing flat manifests + adding changesets + adding manifests + adding file changes + added 0 changesets with 0 changes to 0 files pulling from ssh://user@dummy/master searching for changes adding changesets adding manifests - transaction abort! - rollback completed - abort: 00manifest.i@d9920715ba88: unknown parent! - [255] + adding file changes + added 1 changesets with 0 changes to 0 files (+1 heads) + new changesets 4f84204095e0 + (run 'hg heads .' to see heads, 'hg merge' to merge) + + $ cp .hg/store/00manifest.i.bak .hg/store/00manifest.i + $ cp .hg/store/00changelog.i.bak .hg/store/00changelog.i + +- Manually backfill via command $ hg backfillmanifestrevlog adding changesets adding manifests adding file changes added 0 changesets with 0 changes to 0 files + $ hg pull pulling from ssh://user@dummy/master searching for changes diff --git a/treemanifest/__init__.py b/treemanifest/__init__.py --- a/treemanifest/__init__.py +++ b/treemanifest/__init__.py @@ -1272,6 +1272,18 @@ return repo.ui.config('paths', 'default') def pull(orig, ui, repo, *pats, **opts): + # If we're not in treeonly mode, and we're missing public commits from the + # revlog, backfill them. + if not ui.configbool('treemanifest', 'treeonly'): + tippublicrevs = repo.revs('last(public())') + if tippublicrevs: + ctx = repo[tippublicrevs.first()] + mfnode = ctx.manifestnode() + mfrevlog = repo.manifestlog._revlog + if mfnode not in mfrevlog.nodemap: + ui.status(_("backfilling missing flat manifests\n")) + backfillmanifestrevlog(ui, repo) + # If special arguments were passed, we can't reuse the pull connection if opts.get('ssh') or opts.get('remotecmd'): return orig(ui, repo, *pats, **opts)