From d31e2ec441c559982d748987cf254bf347723654 Mon Sep 17 00:00:00 2001 From: Durham Goode Date: Wed, 21 Jun 2017 16:59:44 -0700 Subject: [PATCH] treemanifest: fix pack transaction closing Summary: When adding manifests, we keep the mutable packs open for the duration of the transaction. The old code had a bug where it didn't realize the pack files were already open and it would open new ones. This meant only the last pack file was finalized and the rest were left open as unfinished temp files. This patch fixes it and adds a test. Test Plan: Added a test Reviewers: #mercurial, quark Reviewed By: quark Subscribers: medson, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D5297004 Signature: t1:5297004:1498086398:5cbe6e6c78d02f09d341417ec3a745853dac9849 --- fastmanifest/implementation.py | 2 +- tests/test-treemanifest.t | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/fastmanifest/implementation.py b/fastmanifest/implementation.py index c601e9114f..878c740c67 100644 --- a/fastmanifest/implementation.py +++ b/fastmanifest/implementation.py @@ -987,7 +987,7 @@ class manifestfactory(object): fflag = m.flags(filename) newtree.set(filename, fnode, fflag) - if not util.safehasattr(transaction, 'treepack'): + if not util.safehasattr(transaction, 'treedatapack'): packpath = shallowutil.getlocalpackpath( origself.opener.vfs.base, 'manifests') diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t index 1113b3818e..b9c128a20d 100644 --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -103,3 +103,34 @@ Test config validation $ hg log -r . --config extensions.treemanifest=! abort: fastmanifest.usetree cannot be enabled without enabling treemanifest [255] + +Test rebasing a stack of commits results in a pack with all the trees + + $ echo >> subdir/y + $ hg commit -qAm 'modify subdir/y' + $ echo >> subdir/y + $ hg commit -Am 'modify subdir/y again' + $ hg rebase -d 0 -s '.^' + rebasing 3:6a2476258ba5 "modify subdir/y" + rebasing 4:f096b21e165f "modify subdir/y again" (tip) + saved backup bundle to $TESTTMP/client/.hg/strip-backup/6a2476258ba5-a90056a1-backup.hg (glob) + $ hg log -r '.^::.' -T '{manifest}\n' + 3:0d05c20bb7eb + 4:8289b85c6a30 + $ hg debugdatapack .hg/store/packs/manifests/5a5fb42e99986c90ac86b57d184561c44238b7b7.datapack + + subdir + Node Delta Base Delta Length + a4e2f032ee0f 000000000000 43 + + + Node Delta Base Delta Length + 0d05c20bb7eb 000000000000 92 + + subdir + Node Delta Base Delta Length + ad0a48a2ec1e 000000000000 43 + + + Node Delta Base Delta Length + 8289b85c6a30 000000000000 92