Show More
@@ -224,6 +224,8 b" configitem('repack', 'chainorphansbysize" | |||||
224 | configitem('packs', 'maxpacksize', default=0) |
|
224 | configitem('packs', 'maxpacksize', default=0) | |
225 | configitem('packs', 'maxchainlen', default=1000) |
|
225 | configitem('packs', 'maxchainlen', default=1000) | |
226 |
|
226 | |||
|
227 | configitem('devel', 'remotefilelog.ensurestart', default=False) | |||
|
228 | ||||
227 | # default TTL limit is 30 days |
|
229 | # default TTL limit is 30 days | |
228 | _defaultlimit = 60 * 60 * 24 * 30 |
|
230 | _defaultlimit = 60 * 60 * 24 * 30 | |
229 | configitem('remotefilelog', 'nodettl', default=_defaultlimit) |
|
231 | configitem('remotefilelog', 'nodettl', default=_defaultlimit) | |
@@ -949,19 +951,23 b' def pull(orig, ui, repo, *pats, **opts):' | |||||
949 | prefetchrevset = ui.config('remotefilelog', 'pullprefetch') |
|
951 | prefetchrevset = ui.config('remotefilelog', 'pullprefetch') | |
950 | bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack') |
|
952 | bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack') | |
951 | bgprefetch = repo.ui.configbool('remotefilelog', 'backgroundprefetch') |
|
953 | bgprefetch = repo.ui.configbool('remotefilelog', 'backgroundprefetch') | |
|
954 | ensurestart = repo.ui.configbool('devel', 'remotefilelog.ensurestart') | |||
952 |
|
955 | |||
953 | if prefetchrevset: |
|
956 | if prefetchrevset: | |
954 | ui.status(_("prefetching file contents\n")) |
|
957 | ui.status(_("prefetching file contents\n")) | |
955 | revs = scmutil.revrange(repo, [prefetchrevset]) |
|
958 | revs = scmutil.revrange(repo, [prefetchrevset]) | |
956 | base = repo['.'].rev() |
|
959 | base = repo['.'].rev() | |
957 | if bgprefetch: |
|
960 | if bgprefetch: | |
958 |
repo.backgroundprefetch(prefetchrevset, repack=bgrepack |
|
961 | repo.backgroundprefetch(prefetchrevset, repack=bgrepack, | |
|
962 | ensurestart=ensurestart) | |||
959 | else: |
|
963 | else: | |
960 | repo.prefetch(revs, base=base) |
|
964 | repo.prefetch(revs, base=base) | |
961 | if bgrepack: |
|
965 | if bgrepack: | |
962 |
repackmod.backgroundrepack(repo, incremental=True |
|
966 | repackmod.backgroundrepack(repo, incremental=True, | |
|
967 | ensurestart=ensurestart) | |||
963 | elif bgrepack: |
|
968 | elif bgrepack: | |
964 |
repackmod.backgroundrepack(repo, incremental=True |
|
969 | repackmod.backgroundrepack(repo, incremental=True, | |
|
970 | ensurestart=ensurestart) | |||
965 |
|
971 | |||
966 | return result |
|
972 | return result | |
967 |
|
973 | |||
@@ -1085,9 +1091,12 b' def prefetch(ui, repo, *pats, **opts):' | |||||
1085 | revs = scmutil.revrange(repo, opts.get('rev')) |
|
1091 | revs = scmutil.revrange(repo, opts.get('rev')) | |
1086 | repo.prefetch(revs, opts.get('base'), pats, opts) |
|
1092 | repo.prefetch(revs, opts.get('base'), pats, opts) | |
1087 |
|
1093 | |||
|
1094 | ensurestart = repo.ui.configbool('devel', 'remotefilelog.ensurestart') | |||
|
1095 | ||||
1088 | # Run repack in background |
|
1096 | # Run repack in background | |
1089 | if opts.get('repack'): |
|
1097 | if opts.get('repack'): | |
1090 |
repackmod.backgroundrepack(repo, incremental=True |
|
1098 | repackmod.backgroundrepack(repo, incremental=True, | |
|
1099 | ensurestart=ensurestart) | |||
1091 |
|
1100 | |||
1092 | @command('repack', [ |
|
1101 | @command('repack', [ | |
1093 | ('', 'background', None, _('run in a background process'), None), |
|
1102 | ('', 'background', None, _('run in a background process'), None), | |
@@ -1096,8 +1105,10 b' def prefetch(ui, repo, *pats, **opts):' | |||||
1096 | ], _('hg repack [OPTIONS]')) |
|
1105 | ], _('hg repack [OPTIONS]')) | |
1097 | def repack_(ui, repo, *pats, **opts): |
|
1106 | def repack_(ui, repo, *pats, **opts): | |
1098 | if opts.get(r'background'): |
|
1107 | if opts.get(r'background'): | |
|
1108 | ensurestart = repo.ui.configbool('devel', 'remotefilelog.ensurestart') | |||
1099 | repackmod.backgroundrepack(repo, incremental=opts.get(r'incremental'), |
|
1109 | repackmod.backgroundrepack(repo, incremental=opts.get(r'incremental'), | |
1100 |
packsonly=opts.get(r'packsonly', False) |
|
1110 | packsonly=opts.get(r'packsonly', False), | |
|
1111 | ensurestart=ensurestart) | |||
1101 | return |
|
1112 | return | |
1102 |
|
1113 | |||
1103 | options = {'packsonly': opts.get(r'packsonly')} |
|
1114 | options = {'packsonly': opts.get(r'packsonly')} |
@@ -34,7 +34,8 b" osutil = policy.importmod(r'osutil')" | |||||
34 | class RepackAlreadyRunning(error.Abort): |
|
34 | class RepackAlreadyRunning(error.Abort): | |
35 | pass |
|
35 | pass | |
36 |
|
36 | |||
37 |
def backgroundrepack(repo, incremental=True, packsonly=False |
|
37 | def backgroundrepack(repo, incremental=True, packsonly=False, | |
|
38 | ensurestart=False): | |||
38 | cmd = [procutil.hgexecutable(), '-R', repo.origroot, 'repack'] |
|
39 | cmd = [procutil.hgexecutable(), '-R', repo.origroot, 'repack'] | |
39 | msg = _("(running background repack)\n") |
|
40 | msg = _("(running background repack)\n") | |
40 | if incremental: |
|
41 | if incremental: | |
@@ -44,7 +45,7 b' def backgroundrepack(repo, incremental=T' | |||||
44 | cmd.append('--packsonly') |
|
45 | cmd.append('--packsonly') | |
45 | repo.ui.warn(msg) |
|
46 | repo.ui.warn(msg) | |
46 | # We know this command will find a binary, so don't block on it starting. |
|
47 | # We know this command will find a binary, so don't block on it starting. | |
47 |
procutil.runbgcommand(cmd, encoding.environ, ensurestart= |
|
48 | procutil.runbgcommand(cmd, encoding.environ, ensurestart=ensurestart) | |
48 |
|
49 | |||
49 | def fullrepack(repo, options=None): |
|
50 | def fullrepack(repo, options=None): | |
50 | """If ``packsonly`` is True, stores creating only loose objects are skipped. |
|
51 | """If ``packsonly`` is True, stores creating only loose objects are skipped. |
@@ -183,7 +183,7 b' def wraprepo(repo):' | |||||
183 | origctx=origctx) |
|
183 | origctx=origctx) | |
184 |
|
184 | |||
185 | def backgroundprefetch(self, revs, base=None, repack=False, pats=None, |
|
185 | def backgroundprefetch(self, revs, base=None, repack=False, pats=None, | |
186 | opts=None): |
|
186 | opts=None, ensurestart=False): | |
187 | """Runs prefetch in background with optional repack |
|
187 | """Runs prefetch in background with optional repack | |
188 | """ |
|
188 | """ | |
189 | cmd = [procutil.hgexecutable(), '-R', repo.origroot, 'prefetch'] |
|
189 | cmd = [procutil.hgexecutable(), '-R', repo.origroot, 'prefetch'] | |
@@ -193,7 +193,8 b' def wraprepo(repo):' | |||||
193 | cmd += ['-r', revs] |
|
193 | cmd += ['-r', revs] | |
194 | # We know this command will find a binary, so don't block |
|
194 | # We know this command will find a binary, so don't block | |
195 | # on it starting. |
|
195 | # on it starting. | |
196 |
procutil.runbgcommand(cmd, encoding.environ, |
|
196 | procutil.runbgcommand(cmd, encoding.environ, | |
|
197 | ensurestart=ensurestart) | |||
197 |
|
198 | |||
198 | def prefetch(self, revs, base=None, pats=None, opts=None): |
|
199 | def prefetch(self, revs, base=None, pats=None, opts=None): | |
199 | """Prefetches all the necessary file revisions for the given revs |
|
200 | """Prefetches all the necessary file revisions for the given revs |
@@ -1,6 +1,12 b'' | |||||
1 | #require no-windows |
|
1 | #require no-windows | |
2 |
|
2 | |||
3 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
3 | $ . "$TESTDIR/remotefilelog-library.sh" | |
|
4 | # devel.remotefilelog.ensurestart: reduce race condition with | |||
|
5 | # waiton{repack/prefetch} | |||
|
6 | $ cat >> $HGRCPATH <<EOF | |||
|
7 | > [devel] | |||
|
8 | > remotefilelog.ensurestart=True | |||
|
9 | > EOF | |||
4 |
|
10 | |||
5 | $ hg init master |
|
11 | $ hg init master | |
6 | $ cd master |
|
12 | $ cd master |
@@ -1,10 +1,13 b'' | |||||
1 | #require no-windows |
|
1 | #require no-windows | |
2 |
|
2 | |||
3 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
3 | $ . "$TESTDIR/remotefilelog-library.sh" | |
4 |
|
4 | # devel.remotefilelog.ensurestart: reduce race condition with | ||
|
5 | # waiton{repack/prefetch} | |||
5 | $ cat >> $HGRCPATH <<EOF |
|
6 | $ cat >> $HGRCPATH <<EOF | |
6 | > [remotefilelog] |
|
7 | > [remotefilelog] | |
7 | > fastdatapack=True |
|
8 | > fastdatapack=True | |
|
9 | > [devel] | |||
|
10 | > remotefilelog.ensurestart=True | |||
8 | > EOF |
|
11 | > EOF | |
9 |
|
12 | |||
10 | $ hg init master |
|
13 | $ hg init master |
@@ -1,6 +1,12 b'' | |||||
1 | #require no-windows |
|
1 | #require no-windows | |
2 |
|
2 | |||
3 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
3 | $ . "$TESTDIR/remotefilelog-library.sh" | |
|
4 | # devel.remotefilelog.ensurestart: reduce race condition with | |||
|
5 | # waiton{repack/prefetch} | |||
|
6 | $ cat >> $HGRCPATH <<EOF | |||
|
7 | > [devel] | |||
|
8 | > remotefilelog.ensurestart=True | |||
|
9 | > EOF | |||
4 |
|
10 | |||
5 | $ hg init master |
|
11 | $ hg init master | |
6 | $ cd master |
|
12 | $ cd master |
General Comments 0
You need to be logged in to leave comments.
Login now