Mercurial > hg
comparison tests/test-rebase-inmemory.t @ 39127: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 |
comparison
equal
deleted
inserted
replaced
39126:e09fad982ef5 | 39127:95bd19f60957 |
---|---|
507 | b | 507 | b |
508 | | 508 | |
509 o 0:cb9a9f314b8b test | 509 o 0:cb9a9f314b8b test |
510 a | 510 a |
511 | 511 |
512 #if execbit | |
513 | |
514 Test a metadata-only in-memory merge | |
515 $ cd $TESTTMP | |
516 $ hg init no_exception | |
517 $ cd no_exception | |
518 # Produce the following graph: | |
519 # o 'add +x to foo.txt' | |
520 # | o r1 (adds bar.txt, just for something to rebase to) | |
521 # |/ | |
522 # o r0 (adds foo.txt, no +x) | |
523 $ echo hi > foo.txt | |
524 $ hg ci -qAm r0 | |
525 $ echo hi > bar.txt | |
526 $ hg ci -qAm r1 | |
527 $ hg co -qr ".^" | |
528 $ chmod +x foo.txt | |
529 $ hg ci -qAm 'add +x to foo.txt' | |
530 issue5960: this was raising an AttributeError exception | |
531 $ hg rebase -r . -d 1 | |
532 rebasing 2:539b93e77479 "add +x to foo.txt" (tip) | |
533 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob) | |
534 $ hg diff -c tip | |
535 diff --git a/foo.txt b/foo.txt | |
536 old mode 100644 | |
537 new mode 100755 | |
538 | |
539 #endif |