hgext3rd/evolve/stablerangecache.py
changeset 4055 555028f992eb
parent 4029 a01783a0468c
child 4089 ecd90548a10d
--- a/hgext3rd/evolve/stablerangecache.py	Fri Aug 31 14:26:37 2018 +0200
+++ b/hgext3rd/evolve/stablerangecache.py	Thu Aug 30 22:50:26 2018 +0200
@@ -31,6 +31,33 @@
 
 eh = exthelper.exthelper()
 
+LONG_WARNING_TIME = 60
+
+LONG_MESSAGE = """Stable range cache is taking a while to load
+
+Your repository is probably big.
+
+Stable range are used for discovery missing osbsolescence markers during
+exchange. While the algorithm we use can scale well for large repositories, the
+naive python implementation that you are using is not very efficient, the
+storage backend for that cache neither.
+
+This computation will finish in a finite amount of time, even for repositories
+with millions of revision and many merges. However It might take multiple tens
+of minutes to complete in such case.
+
+In the future, better implementation of the algorithm in a more appropriate
+language than Python will make it much faster. This data should also get
+exchanged between server and clients removing recomputation needs.
+
+In the mean time, got take a break while this cache is warming.
+
+See `hg help -e evolve` for details about how to control obsmarkers discovery and
+the update of related cache.
+
+--- Sorry for the delay ---
+"""
+
 class stablerangeondiskbase(stablerange.stablerangecached,
                             genericcaches.changelogsourcebase):
     """combine the generic stablerange cache usage with generic changelog one
@@ -56,7 +83,8 @@
         # progress report is showing up in the profile for small and fast
         # repository so we only update it every so often
         progress_each = 100
-        progress_last = time.time()
+        initial_time = progress_last = time.time()
+        warned_long = False
         heapify(rangeheap)
         while rangeheap:
             rangeid = heappop(rangeheap)
@@ -64,6 +92,8 @@
                 if not seen % progress_each:
                     # if a lot of time passed, report more often
                     progress_new = time.time()
+                    if not warned_long and LONG_WARNING_TIME < (progress_new - initial_time):
+                        repo.ui.warn(LONG_MESSAGE)
                     if (1 < progress_each) and (0.1 < progress_new - progress_last):
                         progress_each /= 10
                     ui.progress(_("filling stablerange cache"), seen,