# HG changeset patch # User Pierre-Yves David # Date 1535362389 -7200 # Node ID 4c2fcd53c601380bc59c46180f1470166c0499ef # Parent c58362473bd48a35cdbd56e4d9be41c1800556c7 sqlite: fast path when nothing to save If we have no new data to save, we should try to do anything. Doing something concurrently is hard enough. If we can avoid doing it at all that would be great. diff -r c58362473bd4 -r 4c2fcd53c601 hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 11:27:04 2018 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 11:33:09 2018 +0200 @@ -573,6 +573,8 @@ repo.ui.warn(msg) def _save(self, repo): + if not self._new: + return try: return self._trysave(repo) except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc: diff -r c58362473bd4 -r 4c2fcd53c601 hgext3rd/evolve/stablerangecache.py --- a/hgext3rd/evolve/stablerangecache.py Mon Aug 27 11:27:04 2018 +0200 +++ b/hgext3rd/evolve/stablerangecache.py Mon Aug 27 11:33:09 2018 +0200 @@ -223,6 +223,8 @@ return con def _save(self, repo): + if not self._unsavedsubranges: + return try: return self._trysave(repo) except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc: diff -r c58362473bd4 -r 4c2fcd53c601 tests/test-discovery-obshashrange.t --- a/tests/test-discovery-obshashrange.t Mon Aug 27 11:27:04 2018 +0200 +++ b/tests/test-discovery-obshashrange.t Mon Aug 27 11:33:09 2018 +0200 @@ -445,8 +445,8 @@ * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obscache in *.???? seconds (0r, 1o) (glob) * @0000000000000000000000000000000000000000 (*)> -R ../server debugobsolete bbbbbbb2222222222bbbbbbbbbbbbb2222222222 bebd167eb94d257ace0e814aeb98e6972ed2970d exited 0 after *.?? seconds (glob) * @0000000000000000000000000000000000000000 (*)> -R server serve --stdio (glob) - 1970/01/01 00:00:00 * @0000000000000000000000000000000000000000 (*)> obshashcache clean - new markers affect 2 changeset and cached ranges (glob) - * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obshashrange in *.???? seconds (0r, 2o) (glob) + 1970/01/01 00:00:00 * @0000000000000000000000000000000000000000 (*)> obshashcache clean - new markers affect 3 changeset and cached ranges (glob) + * @0000000000000000000000000000000000000000 (*)> updated evo-ext-obshashrange in *.???? seconds (0r, 4o) (glob) * @0000000000000000000000000000000000000000 (*)> -R server serve --stdio exited 0 after *.?? seconds (glob) * @0000000000000000000000000000000000000000 (*)> -R ../server blackbox (glob) $ rm ../server/.hg/blackbox.log