rebase: fix in-memory rebasing of copy of empty file
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 24 Jun 2019 16:01:22 -0700
changeset 42535 e079e001d536
parent 42534 4a6826868625
child 42536 5f2f6912c9e6
rebase: fix in-memory rebasing of copy of empty file Classic Python mistake of unintentionally treating None and empty string the same. Differential Revision: https://phab.mercurial-scm.org/D6570
mercurial/context.py
tests/test-rebase-inmemory.t
--- a/mercurial/context.py	Mon Jun 24 16:07:59 2019 -0700
+++ b/mercurial/context.py	Mon Jun 24 16:01:22 2019 -0700
@@ -2159,7 +2159,9 @@
         # the file is marked as existing.
         if exists and data is None:
             oldentry = self._cache.get(path) or {}
-            data = oldentry.get('data') or self._wrappedctx[path].data()
+            data = oldentry.get('data')
+            if data is None:
+                data = self._wrappedctx[path].data()
 
         self._cache[path] = {
             'exists': exists,
--- a/tests/test-rebase-inmemory.t	Mon Jun 24 16:07:59 2019 -0700
+++ b/tests/test-rebase-inmemory.t	Mon Jun 24 16:01:22 2019 -0700
@@ -795,12 +795,10 @@
   $ hg co -q 0
   $ hg mv a b
   $ hg ci -qm 'rename a to b'
-BROKEN: shouldn't crash
   $ hg rebase -d 1
   rebasing 2:b977edf6f839 "rename a to b" (tip)
   merging a and b to b
-  abort: b@c71e275f666f: not found in manifest!
-  [255]
+  saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
   $ hg st --copies --change .
   A b
     a