sapling/ctreemanifest
Durham Goode 95eacecbfc treemanifest: fix incorrect tree creation for empty manifests
Summary:
There was a bug where if a commit had an empty manifest (i.e. same contents as
it's parents, but different p1/p2) and it resulted in a
non-empty-but-still-a-noop delta in the revlog (i.e. a delta that deletes a line
and replaces it with the same content), this resulted in a no-op set to the tree
manifest. When the tree was serialized, it noticed that the set was a no-op, so
it didn't serialize that particular tree, but the parent didn't get notified it
was a no-op, so we serialized parent directories with pointers to sub trees that
did not exist.

The fix is to not store new sub-tree nodes on parents when the sub-tree contents
are the same. Now we just store the original sub-tree node. So we no longer
accidentally reference non-existent trees.

Unfortunately I'm not sure how Mercurial can get into this situation (how do you
produce a delta that has content, but the content is a no-op?), so I'm not sure
how to test it. The tree verification command in another patch can catch this
exception though.

Test Plan:
Ran 'hg debuggentrees' on a repo that has a manifest entry that
exhibits this problem. Verified via the debugger that only one tree (the root
node) was generated from adding that manifest.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4724539

Signature: t1:4724539:1489789531:02a9a75a85aa2a0a6e4c16e163867bd5a6f55670
2017-03-18 19:40:15 -07:00
..
convert.h cstore: implement UnionDatapackStore.getdeltachain() 2017-02-23 14:03:03 -08:00
manifest_entry.cpp ctreemanifest: remove PythonObj from manifest data structures 2017-02-23 14:03:03 -08:00
manifest_entry.h ctreemanifest: remove PythonObj from manifest data structures 2017-02-23 14:03:03 -08:00
manifest_fetcher.cpp ctreemanifest: remove PythonObj from manifest data structures 2017-02-23 14:03:03 -08:00
manifest_fetcher.h ctreemanifest: remove PythonObj from manifest data structures 2017-02-23 14:03:03 -08:00
manifest.cpp ctreemanifest: remove PythonObj from manifest data structures 2017-02-23 14:03:03 -08:00
manifest.h ctreemanifest: remove PythonObj from manifest data structures 2017-02-23 14:03:03 -08:00
treemanifest.cpp treemanifest: fix incorrect tree creation for empty manifests 2017-03-18 19:40:15 -07:00
treemanifest.h treemanifest: support matcher in diff 2017-03-12 12:49:18 -07:00