# HG changeset patch # User Pierre-Yves David # Date 1575890986 -3600 # Node ID 612b4b63fb2267320f18655c0fa8a675f8fe3939 # Parent 4f40dc190f63df76d02cd5e8d55d4a883e748d40 remotefilelog: remove the `ensurestart` usage The option does not seems to do what we want since it does not wait on the background process actually starting (eg: taking the lock). And the race have been dealt with another way anyway. This effectively back out changeset 2c74337e6483. Differential Revision: https://phab.mercurial-scm.org/D7590 diff -r 4f40dc190f63 -r 612b4b63fb22 hgext/remotefilelog/__init__.py --- a/hgext/remotefilelog/__init__.py Mon Dec 09 11:26:53 2019 +0100 +++ b/hgext/remotefilelog/__init__.py Mon Dec 09 12:29:46 2019 +0100 @@ -229,7 +229,6 @@ configitem(b'packs', b'maxpacksize', default=0) 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 @@ -1085,26 +1084,19 @@ prefetchrevset = ui.config(b'remotefilelog', b'pullprefetch') bgrepack = repo.ui.configbool(b'remotefilelog', b'backgroundrepack') bgprefetch = repo.ui.configbool(b'remotefilelog', b'backgroundprefetch') - ensurestart = repo.ui.configbool(b'devel', b'remotefilelog.ensurestart') if prefetchrevset: ui.status(_(b"prefetching file contents\n")) revs = scmutil.revrange(repo, [prefetchrevset]) base = repo[b'.'].rev() if bgprefetch: - repo.backgroundprefetch( - prefetchrevset, repack=bgrepack, ensurestart=ensurestart - ) + repo.backgroundprefetch(prefetchrevset, repack=bgrepack) else: repo.prefetch(revs, base=base) if bgrepack: - repackmod.backgroundrepack( - repo, incremental=True, ensurestart=ensurestart - ) + repackmod.backgroundrepack(repo, incremental=True) elif bgrepack: - repackmod.backgroundrepack( - repo, incremental=True, ensurestart=ensurestart - ) + repackmod.backgroundrepack(repo, incremental=True) return result @@ -1255,13 +1247,9 @@ revs = scmutil.revrange(repo, opts.get(b'rev')) repo.prefetch(revs, opts.get(b'base'), pats, opts) - ensurestart = repo.ui.configbool(b'devel', b'remotefilelog.ensurestart') - # Run repack in background if opts.get(b'repack'): - repackmod.backgroundrepack( - repo, incremental=True, ensurestart=ensurestart - ) + repackmod.backgroundrepack(repo, incremental=True) @command( @@ -1281,12 +1269,10 @@ ) def repack_(ui, repo, *pats, **opts): if opts.get(r'background'): - ensurestart = repo.ui.configbool(b'devel', b'remotefilelog.ensurestart') repackmod.backgroundrepack( repo, incremental=opts.get(r'incremental'), packsonly=opts.get(r'packsonly', False), - ensurestart=ensurestart, ) return diff -r 4f40dc190f63 -r 612b4b63fb22 hgext/remotefilelog/repack.py --- a/hgext/remotefilelog/repack.py Mon Dec 09 11:26:53 2019 +0100 +++ b/hgext/remotefilelog/repack.py Mon Dec 09 12:29:46 2019 +0100 @@ -36,9 +36,7 @@ pass -def backgroundrepack( - repo, incremental=True, packsonly=False, ensurestart=False -): +def backgroundrepack(repo, incremental=True, packsonly=False): cmd = [procutil.hgexecutable(), b'-R', repo.origroot, b'repack'] msg = _(b"(running background repack)\n") if incremental: @@ -52,9 +50,7 @@ if repo.ui.configbool(b'devel', b'remotefilelog.bg-wait'): kwargs['record_wait'] = repo.ui.atexit - procutil.runbgcommand( - cmd, encoding.environ, ensurestart=ensurestart, **kwargs - ) + procutil.runbgcommand(cmd, encoding.environ, ensurestart=False, **kwargs) def fullrepack(repo, options=None): diff -r 4f40dc190f63 -r 612b4b63fb22 hgext/remotefilelog/shallowrepo.py --- a/hgext/remotefilelog/shallowrepo.py Mon Dec 09 11:26:53 2019 +0100 +++ b/hgext/remotefilelog/shallowrepo.py Mon Dec 09 12:29:46 2019 +0100 @@ -215,13 +215,7 @@ ) def backgroundprefetch( - self, - revs, - base=None, - repack=False, - pats=None, - opts=None, - ensurestart=False, + self, revs, base=None, repack=False, pats=None, opts=None ): """Runs prefetch in background with optional repack """ @@ -237,7 +231,7 @@ kwargs['record_wait'] = repo.ui.atexit procutil.runbgcommand( - cmd, encoding.environ, ensurestart=ensurestart, **kwargs + cmd, encoding.environ, ensurestart=False, **kwargs ) def prefetch(self, revs, base=None, pats=None, opts=None): diff -r 4f40dc190f63 -r 612b4b63fb22 tests/test-remotefilelog-bgprefetch.t --- a/tests/test-remotefilelog-bgprefetch.t Mon Dec 09 11:26:53 2019 +0100 +++ b/tests/test-remotefilelog-bgprefetch.t Mon Dec 09 12:29:46 2019 +0100 @@ -1,11 +1,8 @@ #require no-windows $ . "$TESTDIR/remotefilelog-library.sh" -# devel.remotefilelog.ensurestart: reduce race condition with -# waiton{repack/prefetch} $ cat >> $HGRCPATH < [devel] - > remotefilelog.ensurestart=True > remotefilelog.bg-wait=True > EOF diff -r 4f40dc190f63 -r 612b4b63fb22 tests/test-remotefilelog-repack-fast.t --- a/tests/test-remotefilelog-repack-fast.t Mon Dec 09 11:26:53 2019 +0100 +++ b/tests/test-remotefilelog-repack-fast.t Mon Dec 09 12:29:46 2019 +0100 @@ -1,13 +1,11 @@ #require no-windows $ . "$TESTDIR/remotefilelog-library.sh" -# devel.remotefilelog.ensurestart: reduce race condition with -# waiton{repack/prefetch} + $ cat >> $HGRCPATH < [remotefilelog] > fastdatapack=True > [devel] - > remotefilelog.ensurestart=True > remotefilelog.bg-wait=True > EOF diff -r 4f40dc190f63 -r 612b4b63fb22 tests/test-remotefilelog-repack.t --- a/tests/test-remotefilelog-repack.t Mon Dec 09 11:26:53 2019 +0100 +++ b/tests/test-remotefilelog-repack.t Mon Dec 09 12:29:46 2019 +0100 @@ -1,11 +1,8 @@ #require no-windows $ . "$TESTDIR/remotefilelog-library.sh" -# devel.remotefilelog.ensurestart: reduce race condition with -# waiton{repack/prefetch} $ cat >> $HGRCPATH < [devel] - > remotefilelog.ensurestart=True > remotefilelog.bg-wait=True > EOF