Patchwork D1933: repair: invalidate volatile sets after stripping

login
register
mail settings
Submitter phabricator
Date Jan. 21, 2018, 6:41 p.m.
Message ID <differential-rev-PHID-DREV-o2sxhpf7zgo5zv7upj2l-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27023/
State Superseded
Headers show

Comments

phabricator - Jan. 21, 2018, 6:41 p.m.
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Matt Harbison reported that some tests were broken on Windows after
  https://phab.mercurial-scm.org/rHG1a09dad8b85a2c1f4aa99e112185a7dde2f4c115 (evolution: report new unstable changesets,
  2018-01-14). The failures were exactly as seen in this patch. The
  failures actually seemed correct, which made me wonder why they didn't
  fail the same way on Linux. It turned out to be a cache invalidation
  problem.
  
  The new orphan mentioned in the test case actually does get created
  when we're re-applying the temporary bundle that's created while
  stripping. However, without the invalidation, it appears that there
  was already an orphan before applying the temporary bundle.
  
  The warnings about unknown working parent appear because the
  aformentioned changeset means that we're now accessing the dirstate
  while it's invalid.
  
  We may want to suppress these messages that happen in the intermediate
  strip state, but they're technically correct (although confusing to
  the user), so I think just fixing the cache invalidation is fine for
  now.
  
  I haven't figured out why the caches seemed to get correctly
  invalidated on Windows.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1933

AFFECTED FILES
  mercurial/repair.py
  tests/test-histedit-obsolete.t
  tests/test-rebase-obsolete.t
  tests/test-single-head.t

CHANGE DETAILS




To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 21, 2018, 10:06 p.m.
quark added a comment.


  > I haven't figured out why the caches seemed to get correctly invalidated on Windows.
  
  I guess it's because filecache is a no-op on Windows. So things like `repo._filecache[x].refresh()` is doing nothing.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1933

To: martinvonz, durin42, #hg-reviewers
Cc: quark, mercurial-devel
phabricator - Jan. 21, 2018, 10:07 p.m.
mharbison72 added a comment.


  That worked for me, thanks.
  
  FWIW, a couple of years ago, there were test failures in evolve on Windows that was fixed by adding a `repo.invalidate()` in bookmarks.py.  I can't find the thread now, and that fix wasn't taken.  So Windows may not be getting it all correct either.  That said, I just ran the evolve tests, and it seems to have disappeared.  (Though I haven't figured out how to run the tests on the repo reliably since it started supporting enabling with `evolve=`.  It seems to want to use the pip installed code.)  There are now missing orphan messages similar to above, but these have 'remote:' prefixes, so it's probably an issue of not being flushed, rather than an actual problem.
  
  If you need to throw patches at me to trace through the Windows code to see what's different, feel free.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1933

To: martinvonz, durin42, #hg-reviewers
Cc: mharbison72, quark, mercurial-devel

Patch

diff --git a/tests/test-single-head.t b/tests/test-single-head.t
--- a/tests/test-single-head.t
+++ b/tests/test-single-head.t
@@ -200,4 +200,5 @@ 
 
   $ hg strip --config extensions.strip= --rev 'desc("c_dH0")'
   saved backup bundle to $TESTTMP/client/.hg/strip-backup/fe47ea669cea-a41bf5a9-backup.hg
+  warning: ignoring unknown working parent 49003e504178!
 
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -772,6 +772,7 @@ 
   1 new orphan changesets
   $ hg --hidden strip -r 'desc(B1)'
   saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
+  1 new orphan changesets
   $ hg log -G
   @  5:1a79b7535141 D
   |
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -71,6 +71,7 @@ 
   $ hg commit --amend -X . -m XXXXXX
   $ hg commit --amend -X . -m b2
   $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup
+  warning: ignoring unknown working parent aba7da937030!
   $ hg histedit --continue
   $ hg log -G
   @  8:273c1f3b8626 c
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -203,6 +203,7 @@ 
 
             deleteobsmarkers(repo.obsstore, stripobsidx)
             del repo.obsstore
+            repo.invalidatevolatilesets()
             repo._phasecache.filterunknown(repo)
 
         if tmpbundlefile: