simplestore: back up index when adding a revision
This ensures that transaction rollback reverts the index to its
previous state. This fixed a few test failures due to `hg verify`
complaining about a reference to an undefined changeset revision.
Differential Revision: https://phab.mercurial-scm.org/D3104
--- a/tests/simplestorerepo.py Wed Apr 04 16:00:50 2018 -0700
+++ b/tests/simplestorerepo.py Wed Apr 04 17:53:45 2018 -0700
@@ -405,6 +405,8 @@
return 0, 0
def add(self, text, meta, transaction, linkrev, p1, p2):
+ transaction.addbackup(self._indexpath)
+
if meta or text.startswith(b'\1\n'):
text = filelog.packmeta(meta, text)
--- a/tests/test-clone.t Wed Apr 04 16:00:50 2018 -0700
+++ b/tests/test-clone.t Wed Apr 04 17:53:45 2018 -0700
@@ -104,7 +104,8 @@
linking: 15 (reposimplestore !)
linking: 16 (reposimplestore !)
linking: 17 (reposimplestore !)
- linked 17 files (reposimplestore !)
+ linking: 18 (reposimplestore !)
+ linked 18 files (reposimplestore !)
#else
$ hg --debug clone -U . ../c --config progress.debug=true
linking: 1
@@ -125,7 +126,8 @@
copying: 15 (reposimplestore !)
copying: 16 (reposimplestore !)
copying: 17 (reposimplestore !)
- copied 17 files (reposimplestore !)
+ copying: 18 (reposimplestore !)
+ copied 18 files (reposimplestore !)
#endif
$ cd ../c
--- a/tests/test-subrepo-recursion.t Wed Apr 04 16:00:50 2018 -0700
+++ b/tests/test-subrepo-recursion.t Wed Apr 04 17:53:45 2018 -0700
@@ -466,6 +466,7 @@
linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !)
linking [ <=> ] 11\r (no-eol) (esc) (reposimplestore !)
linking [ <=> ] 12\r (no-eol) (esc) (reposimplestore !)
+ linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !)
\r (no-eol) (esc)
#else
$ hg clone -U . ../empty
@@ -497,6 +498,8 @@
linking [ <=> ] 12\r (no-eol) (esc) (reposimplestore !)
linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !)
linking [ <=> ] 14\r (no-eol) (esc) (reposimplestore !)
+ linking [ <=> ] 15\r (no-eol) (esc) (reposimplestore !)
+ linking [ <=> ] 16\r (no-eol) (esc) (reposimplestore !)
\r (no-eol) (esc)
\r (no-eol) (esc)
archiving (foo) [ ] 0/3\r (no-eol) (esc)
@@ -513,6 +516,7 @@
linking [ <=> ] 6\r (no-eol) (esc)
linking [ <=> ] 7\r (no-eol) (esc) (reposimplestore !)
linking [ <=> ] 8\r (no-eol) (esc) (reposimplestore !)
+ linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !)
\r (no-eol) (esc)
\r (no-eol) (esc)
archiving (foo/bar) [ ] 0/1\r (no-eol) (esc)