# HG changeset patch # User Pierre-Yves David # Date 1535362389 -7200 # Node ID f59b262400fb33b2aaf75031fe8a8039dd8fa44c # Parent 082b591260996bd7e47688f91dec7d73c9636570 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 082b59126099 -r f59b262400fb 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 @@ -568,6 +568,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 082b59126099 -r f59b262400fb 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 @@ -224,6 +224,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 082b59126099 -r f59b262400fb 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