Patchwork D7585: remotefilelog: add a developer option to wait for background processes

login
register
mail settings
Submitter phabricator
Date Dec. 11, 2019, 5:28 p.m.
Message ID <794ae4ae8877fda29527efbf5aa8e0fb@localhost.localdomain>
Download mbox | patch
Permalink /patch/43716/
State Not Applicable
Headers show

Comments

phabricator - Dec. 11, 2019, 5:28 p.m.
Closed by commit rHG63bb6dc62f24: remotefilelog: add a developer option to wait for background processes (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7585?vs=18550&id=18610

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7585/new/

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

AFFECTED FILES
  hgext/remotefilelog/__init__.py
  hgext/remotefilelog/repack.py
  hgext/remotefilelog/shallowrepo.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: durin42, mercurial-devel

Patch

diff --git a/hgext/remotefilelog/shallowrepo.py b/hgext/remotefilelog/shallowrepo.py
--- a/hgext/remotefilelog/shallowrepo.py
+++ b/hgext/remotefilelog/shallowrepo.py
@@ -232,8 +232,12 @@ 
                 cmd += [b'-r', revs]
             # We know this command will find a binary, so don't block
             # on it starting.
+            kwargs = {}
+            if repo.ui.configbool(b'devel', b'remotefilelog.bg-wait'):
+                kwargs['record_wait'] = repo.ui.atexit
+
             procutil.runbgcommand(
-                cmd, encoding.environ, ensurestart=ensurestart
+                cmd, encoding.environ, ensurestart=ensurestart, **kwargs
             )
 
         def prefetch(self, revs, base=None, pats=None, opts=None):
diff --git a/hgext/remotefilelog/repack.py b/hgext/remotefilelog/repack.py
--- a/hgext/remotefilelog/repack.py
+++ b/hgext/remotefilelog/repack.py
@@ -48,7 +48,13 @@ 
         cmd.append(b'--packsonly')
     repo.ui.warn(msg)
     # We know this command will find a binary, so don't block on it starting.
-    procutil.runbgcommand(cmd, encoding.environ, ensurestart=ensurestart)
+    kwargs = {}
+    if repo.ui.configbool(b'devel', b'remotefilelog.bg-wait'):
+        kwargs['record_wait'] = repo.ui.atexit
+
+    procutil.runbgcommand(
+        cmd, encoding.environ, ensurestart=ensurestart, **kwargs
+    )
 
 
 def fullrepack(repo, options=None):
diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py
--- a/hgext/remotefilelog/__init__.py
+++ b/hgext/remotefilelog/__init__.py
@@ -230,6 +230,7 @@ 
 configitem(b'packs', b'maxchainlen', default=1000)
 
 configitem(b'devel', b'remotefilelog.ensurestart', default=False)
+configitem(b'devel', b'remotefilelog.bg-wait', default=False)
 
 #  default TTL limit is 30 days
 _defaultlimit = 60 * 60 * 24 * 30