Mercurial > public > mercurial-scm > hg-stable
diff tests/test-rebase-inmemory.t @ 39164:95bd19f60957
overlayworkingctx: fix exception in metadata-only inmemory merges (issue5960)
If there was a metadata-only mutation, such as +x or -x on a file, we would
create a cache entry with None for data, and this would cause problems later on
when some code tried to run fctx.data() or similar, and was expecting a string.
My original fix for this involved passing data=self._wrappedctx[path].data() in
setflags(), but this version seems slightly better - this way, if we ever call
write() and then call setflags(), we don't destroy the data that we wrote that's
in the cache. I haven't verified that other fields aren't destroyed, such as
date or flags :)
Differential Revision: https://phab.mercurial-scm.org/D4287
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Wed, 15 Aug 2018 17:40:21 -0700 |
parents | b3d0c97a0820 |
children | 0600d09764df |
line wrap: on
line diff
--- a/tests/test-rebase-inmemory.t Tue Aug 14 22:20:28 2018 +0900 +++ b/tests/test-rebase-inmemory.t Wed Aug 15 17:40:21 2018 -0700 @@ -509,3 +509,31 @@ o 0:cb9a9f314b8b test a +#if execbit + +Test a metadata-only in-memory merge + $ cd $TESTTMP + $ hg init no_exception + $ cd no_exception +# Produce the following graph: +# o 'add +x to foo.txt' +# | o r1 (adds bar.txt, just for something to rebase to) +# |/ +# o r0 (adds foo.txt, no +x) + $ echo hi > foo.txt + $ hg ci -qAm r0 + $ echo hi > bar.txt + $ hg ci -qAm r1 + $ hg co -qr ".^" + $ chmod +x foo.txt + $ hg ci -qAm 'add +x to foo.txt' +issue5960: this was raising an AttributeError exception + $ hg rebase -r . -d 1 + rebasing 2:539b93e77479 "add +x to foo.txt" (tip) + saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob) + $ hg diff -c tip + diff --git a/foo.txt b/foo.txt + old mode 100644 + new mode 100755 + +#endif