##// END OF EJS Templates
remotefilelog: return expected type from copies overrides...
Martin von Zweigbergk -
r42286:b287ed6e default
parent child Browse files
Show More
@@ -1,1142 +1,1142
1 1 # __init__.py - remotefilelog extension
2 2 #
3 3 # Copyright 2013 Facebook, Inc.
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7 """remotefilelog causes Mercurial to lazilly fetch file contents (EXPERIMENTAL)
8 8
9 9 This extension is HIGHLY EXPERIMENTAL. There are NO BACKWARDS COMPATIBILITY
10 10 GUARANTEES. This means that repositories created with this extension may
11 11 only be usable with the exact version of this extension/Mercurial that was
12 12 used. The extension attempts to enforce this in order to prevent repository
13 13 corruption.
14 14
15 15 remotefilelog works by fetching file contents lazily and storing them
16 16 in a cache on the client rather than in revlogs. This allows enormous
17 17 histories to be transferred only partially, making them easier to
18 18 operate on.
19 19
20 20 Configs:
21 21
22 22 ``packs.maxchainlen`` specifies the maximum delta chain length in pack files
23 23
24 24 ``packs.maxpacksize`` specifies the maximum pack file size
25 25
26 26 ``packs.maxpackfilecount`` specifies the maximum number of packs in the
27 27 shared cache (trees only for now)
28 28
29 29 ``remotefilelog.backgroundprefetch`` runs prefetch in background when True
30 30
31 31 ``remotefilelog.bgprefetchrevs`` specifies revisions to fetch on commit and
32 32 update, and on other commands that use them. Different from pullprefetch.
33 33
34 34 ``remotefilelog.gcrepack`` does garbage collection during repack when True
35 35
36 36 ``remotefilelog.nodettl`` specifies maximum TTL of a node in seconds before
37 37 it is garbage collected
38 38
39 39 ``remotefilelog.repackonhggc`` runs repack on hg gc when True
40 40
41 41 ``remotefilelog.prefetchdays`` specifies the maximum age of a commit in
42 42 days after which it is no longer prefetched.
43 43
44 44 ``remotefilelog.prefetchdelay`` specifies delay between background
45 45 prefetches in seconds after operations that change the working copy parent
46 46
47 47 ``remotefilelog.data.gencountlimit`` constraints the minimum number of data
48 48 pack files required to be considered part of a generation. In particular,
49 49 minimum number of packs files > gencountlimit.
50 50
51 51 ``remotefilelog.data.generations`` list for specifying the lower bound of
52 52 each generation of the data pack files. For example, list ['100MB','1MB']
53 53 or ['1MB', '100MB'] will lead to three generations: [0, 1MB), [
54 54 1MB, 100MB) and [100MB, infinity).
55 55
56 56 ``remotefilelog.data.maxrepackpacks`` the maximum number of pack files to
57 57 include in an incremental data repack.
58 58
59 59 ``remotefilelog.data.repackmaxpacksize`` the maximum size of a pack file for
60 60 it to be considered for an incremental data repack.
61 61
62 62 ``remotefilelog.data.repacksizelimit`` the maximum total size of pack files
63 63 to include in an incremental data repack.
64 64
65 65 ``remotefilelog.history.gencountlimit`` constraints the minimum number of
66 66 history pack files required to be considered part of a generation. In
67 67 particular, minimum number of packs files > gencountlimit.
68 68
69 69 ``remotefilelog.history.generations`` list for specifying the lower bound of
70 70 each generation of the history pack files. For example, list [
71 71 '100MB', '1MB'] or ['1MB', '100MB'] will lead to three generations: [
72 72 0, 1MB), [1MB, 100MB) and [100MB, infinity).
73 73
74 74 ``remotefilelog.history.maxrepackpacks`` the maximum number of pack files to
75 75 include in an incremental history repack.
76 76
77 77 ``remotefilelog.history.repackmaxpacksize`` the maximum size of a pack file
78 78 for it to be considered for an incremental history repack.
79 79
80 80 ``remotefilelog.history.repacksizelimit`` the maximum total size of pack
81 81 files to include in an incremental history repack.
82 82
83 83 ``remotefilelog.backgroundrepack`` automatically consolidate packs in the
84 84 background
85 85
86 86 ``remotefilelog.cachepath`` path to cache
87 87
88 88 ``remotefilelog.cachegroup`` if set, make cache directory sgid to this
89 89 group
90 90
91 91 ``remotefilelog.cacheprocess`` binary to invoke for fetching file data
92 92
93 93 ``remotefilelog.debug`` turn on remotefilelog-specific debug output
94 94
95 95 ``remotefilelog.excludepattern`` pattern of files to exclude from pulls
96 96
97 97 ``remotefilelog.includepattern`` pattern of files to include in pulls
98 98
99 99 ``remotefilelog.fetchwarning``: message to print when too many
100 100 single-file fetches occur
101 101
102 102 ``remotefilelog.getfilesstep`` number of files to request in a single RPC
103 103
104 104 ``remotefilelog.getfilestype`` if set to 'threaded' use threads to fetch
105 105 files, otherwise use optimistic fetching
106 106
107 107 ``remotefilelog.pullprefetch`` revset for selecting files that should be
108 108 eagerly downloaded rather than lazily
109 109
110 110 ``remotefilelog.reponame`` name of the repo. If set, used to partition
111 111 data from other repos in a shared store.
112 112
113 113 ``remotefilelog.server`` if true, enable server-side functionality
114 114
115 115 ``remotefilelog.servercachepath`` path for caching blobs on the server
116 116
117 117 ``remotefilelog.serverexpiration`` number of days to keep cached server
118 118 blobs
119 119
120 120 ``remotefilelog.validatecache`` if set, check cache entries for corruption
121 121 before returning blobs
122 122
123 123 ``remotefilelog.validatecachelog`` if set, check cache entries for
124 124 corruption before returning metadata
125 125
126 126 """
127 127 from __future__ import absolute_import
128 128
129 129 import os
130 130 import time
131 131 import traceback
132 132
133 133 from mercurial.node import hex
134 134 from mercurial.i18n import _
135 135 from mercurial import (
136 136 changegroup,
137 137 changelog,
138 138 cmdutil,
139 139 commands,
140 140 configitems,
141 141 context,
142 142 copies,
143 143 debugcommands as hgdebugcommands,
144 144 dispatch,
145 145 error,
146 146 exchange,
147 147 extensions,
148 148 hg,
149 149 localrepo,
150 150 match,
151 151 merge,
152 152 node as nodemod,
153 153 patch,
154 154 pycompat,
155 155 registrar,
156 156 repair,
157 157 repoview,
158 158 revset,
159 159 scmutil,
160 160 smartset,
161 161 streamclone,
162 162 util,
163 163 )
164 164 from . import (
165 165 constants,
166 166 debugcommands,
167 167 fileserverclient,
168 168 remotefilectx,
169 169 remotefilelog,
170 170 remotefilelogserver,
171 171 repack as repackmod,
172 172 shallowbundle,
173 173 shallowrepo,
174 174 shallowstore,
175 175 shallowutil,
176 176 shallowverifier,
177 177 )
178 178
179 179 # ensures debug commands are registered
180 180 hgdebugcommands.command
181 181
182 182 cmdtable = {}
183 183 command = registrar.command(cmdtable)
184 184
185 185 configtable = {}
186 186 configitem = registrar.configitem(configtable)
187 187
188 188 configitem('remotefilelog', 'debug', default=False)
189 189
190 190 configitem('remotefilelog', 'reponame', default='')
191 191 configitem('remotefilelog', 'cachepath', default=None)
192 192 configitem('remotefilelog', 'cachegroup', default=None)
193 193 configitem('remotefilelog', 'cacheprocess', default=None)
194 194 configitem('remotefilelog', 'cacheprocess.includepath', default=None)
195 195 configitem("remotefilelog", "cachelimit", default="1000 GB")
196 196
197 197 configitem('remotefilelog', 'fallbackpath', default=configitems.dynamicdefault,
198 198 alias=[('remotefilelog', 'fallbackrepo')])
199 199
200 200 configitem('remotefilelog', 'validatecachelog', default=None)
201 201 configitem('remotefilelog', 'validatecache', default='on')
202 202 configitem('remotefilelog', 'server', default=None)
203 203 configitem('remotefilelog', 'servercachepath', default=None)
204 204 configitem("remotefilelog", "serverexpiration", default=30)
205 205 configitem('remotefilelog', 'backgroundrepack', default=False)
206 206 configitem('remotefilelog', 'bgprefetchrevs', default=None)
207 207 configitem('remotefilelog', 'pullprefetch', default=None)
208 208 configitem('remotefilelog', 'backgroundprefetch', default=False)
209 209 configitem('remotefilelog', 'prefetchdelay', default=120)
210 210 configitem('remotefilelog', 'prefetchdays', default=14)
211 211
212 212 configitem('remotefilelog', 'getfilesstep', default=10000)
213 213 configitem('remotefilelog', 'getfilestype', default='optimistic')
214 214 configitem('remotefilelog', 'batchsize', configitems.dynamicdefault)
215 215 configitem('remotefilelog', 'fetchwarning', default='')
216 216
217 217 configitem('remotefilelog', 'includepattern', default=None)
218 218 configitem('remotefilelog', 'excludepattern', default=None)
219 219
220 220 configitem('remotefilelog', 'gcrepack', default=False)
221 221 configitem('remotefilelog', 'repackonhggc', default=False)
222 222 configitem('repack', 'chainorphansbysize', default=True)
223 223
224 224 configitem('packs', 'maxpacksize', default=0)
225 225 configitem('packs', 'maxchainlen', default=1000)
226 226
227 227 # default TTL limit is 30 days
228 228 _defaultlimit = 60 * 60 * 24 * 30
229 229 configitem('remotefilelog', 'nodettl', default=_defaultlimit)
230 230
231 231 configitem('remotefilelog', 'data.gencountlimit', default=2),
232 232 configitem('remotefilelog', 'data.generations',
233 233 default=['1GB', '100MB', '1MB'])
234 234 configitem('remotefilelog', 'data.maxrepackpacks', default=50)
235 235 configitem('remotefilelog', 'data.repackmaxpacksize', default='4GB')
236 236 configitem('remotefilelog', 'data.repacksizelimit', default='100MB')
237 237
238 238 configitem('remotefilelog', 'history.gencountlimit', default=2),
239 239 configitem('remotefilelog', 'history.generations', default=['100MB'])
240 240 configitem('remotefilelog', 'history.maxrepackpacks', default=50)
241 241 configitem('remotefilelog', 'history.repackmaxpacksize', default='400MB')
242 242 configitem('remotefilelog', 'history.repacksizelimit', default='100MB')
243 243
244 244 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
245 245 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
246 246 # be specifying the version(s) of Mercurial they are tested with, or
247 247 # leave the attribute unspecified.
248 248 testedwith = 'ships-with-hg-core'
249 249
250 250 repoclass = localrepo.localrepository
251 251 repoclass._basesupported.add(constants.SHALLOWREPO_REQUIREMENT)
252 252
253 253 isenabled = shallowutil.isenabled
254 254
255 255 def uisetup(ui):
256 256 """Wraps user facing Mercurial commands to swap them out with shallow
257 257 versions.
258 258 """
259 259 hg.wirepeersetupfuncs.append(fileserverclient.peersetup)
260 260
261 261 entry = extensions.wrapcommand(commands.table, 'clone', cloneshallow)
262 262 entry[1].append(('', 'shallow', None,
263 263 _("create a shallow clone which uses remote file "
264 264 "history")))
265 265
266 266 extensions.wrapcommand(commands.table, 'debugindex',
267 267 debugcommands.debugindex)
268 268 extensions.wrapcommand(commands.table, 'debugindexdot',
269 269 debugcommands.debugindexdot)
270 270 extensions.wrapcommand(commands.table, 'log', log)
271 271 extensions.wrapcommand(commands.table, 'pull', pull)
272 272
273 273 # Prevent 'hg manifest --all'
274 274 def _manifest(orig, ui, repo, *args, **opts):
275 275 if (isenabled(repo) and opts.get(r'all')):
276 276 raise error.Abort(_("--all is not supported in a shallow repo"))
277 277
278 278 return orig(ui, repo, *args, **opts)
279 279 extensions.wrapcommand(commands.table, "manifest", _manifest)
280 280
281 281 # Wrap remotefilelog with lfs code
282 282 def _lfsloaded(loaded=False):
283 283 lfsmod = None
284 284 try:
285 285 lfsmod = extensions.find('lfs')
286 286 except KeyError:
287 287 pass
288 288 if lfsmod:
289 289 lfsmod.wrapfilelog(remotefilelog.remotefilelog)
290 290 fileserverclient._lfsmod = lfsmod
291 291 extensions.afterloaded('lfs', _lfsloaded)
292 292
293 293 # debugdata needs remotefilelog.len to work
294 294 extensions.wrapcommand(commands.table, 'debugdata', debugdatashallow)
295 295
296 296 def cloneshallow(orig, ui, repo, *args, **opts):
297 297 if opts.get(r'shallow'):
298 298 repos = []
299 299 def pull_shallow(orig, self, *args, **kwargs):
300 300 if not isenabled(self):
301 301 repos.append(self.unfiltered())
302 302 # set up the client hooks so the post-clone update works
303 303 setupclient(self.ui, self.unfiltered())
304 304
305 305 # setupclient fixed the class on the repo itself
306 306 # but we also need to fix it on the repoview
307 307 if isinstance(self, repoview.repoview):
308 308 self.__class__.__bases__ = (self.__class__.__bases__[0],
309 309 self.unfiltered().__class__)
310 310 self.requirements.add(constants.SHALLOWREPO_REQUIREMENT)
311 311 self._writerequirements()
312 312
313 313 # Since setupclient hadn't been called, exchange.pull was not
314 314 # wrapped. So we need to manually invoke our version of it.
315 315 return exchangepull(orig, self, *args, **kwargs)
316 316 else:
317 317 return orig(self, *args, **kwargs)
318 318 extensions.wrapfunction(exchange, 'pull', pull_shallow)
319 319
320 320 # Wrap the stream logic to add requirements and to pass include/exclude
321 321 # patterns around.
322 322 def setup_streamout(repo, remote):
323 323 # Replace remote.stream_out with a version that sends file
324 324 # patterns.
325 325 def stream_out_shallow(orig):
326 326 caps = remote.capabilities()
327 327 if constants.NETWORK_CAP_LEGACY_SSH_GETFILES in caps:
328 328 opts = {}
329 329 if repo.includepattern:
330 330 opts[r'includepattern'] = '\0'.join(repo.includepattern)
331 331 if repo.excludepattern:
332 332 opts[r'excludepattern'] = '\0'.join(repo.excludepattern)
333 333 return remote._callstream('stream_out_shallow', **opts)
334 334 else:
335 335 return orig()
336 336 extensions.wrapfunction(remote, 'stream_out', stream_out_shallow)
337 337 def stream_wrap(orig, op):
338 338 setup_streamout(op.repo, op.remote)
339 339 return orig(op)
340 340 extensions.wrapfunction(
341 341 streamclone, 'maybeperformlegacystreamclone', stream_wrap)
342 342
343 343 def canperformstreamclone(orig, pullop, bundle2=False):
344 344 # remotefilelog is currently incompatible with the
345 345 # bundle2 flavor of streamclones, so force us to use
346 346 # v1 instead.
347 347 if 'v2' in pullop.remotebundle2caps.get('stream', []):
348 348 pullop.remotebundle2caps['stream'] = [
349 349 c for c in pullop.remotebundle2caps['stream']
350 350 if c != 'v2']
351 351 if bundle2:
352 352 return False, None
353 353 supported, requirements = orig(pullop, bundle2=bundle2)
354 354 if requirements is not None:
355 355 requirements.add(constants.SHALLOWREPO_REQUIREMENT)
356 356 return supported, requirements
357 357 extensions.wrapfunction(
358 358 streamclone, 'canperformstreamclone', canperformstreamclone)
359 359
360 360 try:
361 361 orig(ui, repo, *args, **opts)
362 362 finally:
363 363 if opts.get(r'shallow'):
364 364 for r in repos:
365 365 if util.safehasattr(r, 'fileservice'):
366 366 r.fileservice.close()
367 367
368 368 def debugdatashallow(orig, *args, **kwds):
369 369 oldlen = remotefilelog.remotefilelog.__len__
370 370 try:
371 371 remotefilelog.remotefilelog.__len__ = lambda x: 1
372 372 return orig(*args, **kwds)
373 373 finally:
374 374 remotefilelog.remotefilelog.__len__ = oldlen
375 375
376 376 def reposetup(ui, repo):
377 377 if not repo.local():
378 378 return
379 379
380 380 # put here intentionally bc doesnt work in uisetup
381 381 ui.setconfig('hooks', 'update.prefetch', wcpprefetch)
382 382 ui.setconfig('hooks', 'commit.prefetch', wcpprefetch)
383 383
384 384 isserverenabled = ui.configbool('remotefilelog', 'server')
385 385 isshallowclient = isenabled(repo)
386 386
387 387 if isserverenabled and isshallowclient:
388 388 raise RuntimeError("Cannot be both a server and shallow client.")
389 389
390 390 if isshallowclient:
391 391 setupclient(ui, repo)
392 392
393 393 if isserverenabled:
394 394 remotefilelogserver.setupserver(ui, repo)
395 395
396 396 def setupclient(ui, repo):
397 397 if not isinstance(repo, localrepo.localrepository):
398 398 return
399 399
400 400 # Even clients get the server setup since they need to have the
401 401 # wireprotocol endpoints registered.
402 402 remotefilelogserver.onetimesetup(ui)
403 403 onetimeclientsetup(ui)
404 404
405 405 shallowrepo.wraprepo(repo)
406 406 repo.store = shallowstore.wrapstore(repo.store)
407 407
408 408 clientonetime = False
409 409 def onetimeclientsetup(ui):
410 410 global clientonetime
411 411 if clientonetime:
412 412 return
413 413 clientonetime = True
414 414
415 415 changegroup.cgpacker = shallowbundle.shallowcg1packer
416 416
417 417 extensions.wrapfunction(changegroup, '_addchangegroupfiles',
418 418 shallowbundle.addchangegroupfiles)
419 419 extensions.wrapfunction(
420 420 changegroup, 'makechangegroup', shallowbundle.makechangegroup)
421 421
422 422 def storewrapper(orig, requirements, path, vfstype):
423 423 s = orig(requirements, path, vfstype)
424 424 if constants.SHALLOWREPO_REQUIREMENT in requirements:
425 425 s = shallowstore.wrapstore(s)
426 426
427 427 return s
428 428 extensions.wrapfunction(localrepo, 'makestore', storewrapper)
429 429
430 430 extensions.wrapfunction(exchange, 'pull', exchangepull)
431 431
432 432 # prefetch files before update
433 433 def applyupdates(orig, repo, actions, wctx, mctx, overwrite, labels=None):
434 434 if isenabled(repo):
435 435 manifest = mctx.manifest()
436 436 files = []
437 437 for f, args, msg in actions['g']:
438 438 files.append((f, hex(manifest[f])))
439 439 # batch fetch the needed files from the server
440 440 repo.fileservice.prefetch(files)
441 441 return orig(repo, actions, wctx, mctx, overwrite, labels=labels)
442 442 extensions.wrapfunction(merge, 'applyupdates', applyupdates)
443 443
444 444 # Prefetch merge checkunknownfiles
445 445 def checkunknownfiles(orig, repo, wctx, mctx, force, actions,
446 446 *args, **kwargs):
447 447 if isenabled(repo):
448 448 files = []
449 449 sparsematch = repo.maybesparsematch(mctx.rev())
450 450 for f, (m, actionargs, msg) in actions.iteritems():
451 451 if sparsematch and not sparsematch(f):
452 452 continue
453 453 if m in ('c', 'dc', 'cm'):
454 454 files.append((f, hex(mctx.filenode(f))))
455 455 elif m == 'dg':
456 456 f2 = actionargs[0]
457 457 files.append((f2, hex(mctx.filenode(f2))))
458 458 # batch fetch the needed files from the server
459 459 repo.fileservice.prefetch(files)
460 460 return orig(repo, wctx, mctx, force, actions, *args, **kwargs)
461 461 extensions.wrapfunction(merge, '_checkunknownfiles', checkunknownfiles)
462 462
463 463 # Prefetch files before status attempts to look at their size and contents
464 464 def checklookup(orig, self, files):
465 465 repo = self._repo
466 466 if isenabled(repo):
467 467 prefetchfiles = []
468 468 for parent in self._parents:
469 469 for f in files:
470 470 if f in parent:
471 471 prefetchfiles.append((f, hex(parent.filenode(f))))
472 472 # batch fetch the needed files from the server
473 473 repo.fileservice.prefetch(prefetchfiles)
474 474 return orig(self, files)
475 475 extensions.wrapfunction(context.workingctx, '_checklookup', checklookup)
476 476
477 477 # Prefetch the logic that compares added and removed files for renames
478 478 def findrenames(orig, repo, matcher, added, removed, *args, **kwargs):
479 479 if isenabled(repo):
480 480 files = []
481 481 pmf = repo['.'].manifest()
482 482 for f in removed:
483 483 if f in pmf:
484 484 files.append((f, hex(pmf[f])))
485 485 # batch fetch the needed files from the server
486 486 repo.fileservice.prefetch(files)
487 487 return orig(repo, matcher, added, removed, *args, **kwargs)
488 488 extensions.wrapfunction(scmutil, '_findrenames', findrenames)
489 489
490 490 # prefetch files before mergecopies check
491 491 def computenonoverlap(orig, repo, c1, c2, *args, **kwargs):
492 492 u1, u2 = orig(repo, c1, c2, *args, **kwargs)
493 493 if isenabled(repo):
494 494 m1 = c1.manifest()
495 495 m2 = c2.manifest()
496 496 files = []
497 497
498 498 sparsematch1 = repo.maybesparsematch(c1.rev())
499 499 if sparsematch1:
500 sparseu1 = []
500 sparseu1 = set()
501 501 for f in u1:
502 502 if sparsematch1(f):
503 503 files.append((f, hex(m1[f])))
504 sparseu1.append(f)
504 sparseu1.add(f)
505 505 u1 = sparseu1
506 506
507 507 sparsematch2 = repo.maybesparsematch(c2.rev())
508 508 if sparsematch2:
509 sparseu2 = []
509 sparseu2 = set()
510 510 for f in u2:
511 511 if sparsematch2(f):
512 512 files.append((f, hex(m2[f])))
513 sparseu2.append(f)
513 sparseu2.add(f)
514 514 u2 = sparseu2
515 515
516 516 # batch fetch the needed files from the server
517 517 repo.fileservice.prefetch(files)
518 518 return u1, u2
519 519 extensions.wrapfunction(copies, '_computenonoverlap', computenonoverlap)
520 520
521 521 # prefetch files before pathcopies check
522 522 def computeforwardmissing(orig, a, b, match=None):
523 missing = list(orig(a, b, match=match))
523 missing = orig(a, b, match=match)
524 524 repo = a._repo
525 525 if isenabled(repo):
526 526 mb = b.manifest()
527 527
528 528 files = []
529 529 sparsematch = repo.maybesparsematch(b.rev())
530 530 if sparsematch:
531 sparsemissing = []
531 sparsemissing = set()
532 532 for f in missing:
533 533 if sparsematch(f):
534 534 files.append((f, hex(mb[f])))
535 sparsemissing.append(f)
535 sparsemissing.add(f)
536 536 missing = sparsemissing
537 537
538 538 # batch fetch the needed files from the server
539 539 repo.fileservice.prefetch(files)
540 540 return missing
541 541 extensions.wrapfunction(copies, '_computeforwardmissing',
542 542 computeforwardmissing)
543 543
544 544 # close cache miss server connection after the command has finished
545 545 def runcommand(orig, lui, repo, *args, **kwargs):
546 546 fileservice = None
547 547 # repo can be None when running in chg:
548 548 # - at startup, reposetup was called because serve is not norepo
549 549 # - a norepo command like "help" is called
550 550 if repo and isenabled(repo):
551 551 fileservice = repo.fileservice
552 552 try:
553 553 return orig(lui, repo, *args, **kwargs)
554 554 finally:
555 555 if fileservice:
556 556 fileservice.close()
557 557 extensions.wrapfunction(dispatch, 'runcommand', runcommand)
558 558
559 559 # disappointing hacks below
560 560 scmutil.getrenamedfn = getrenamedfn
561 561 extensions.wrapfunction(revset, 'filelog', filelogrevset)
562 562 revset.symbols['filelog'] = revset.filelog
563 563 extensions.wrapfunction(cmdutil, 'walkfilerevs', walkfilerevs)
564 564
565 565 # prevent strip from stripping remotefilelogs
566 566 def _collectbrokencsets(orig, repo, files, striprev):
567 567 if isenabled(repo):
568 568 files = list([f for f in files if not repo.shallowmatch(f)])
569 569 return orig(repo, files, striprev)
570 570 extensions.wrapfunction(repair, '_collectbrokencsets', _collectbrokencsets)
571 571
572 572 # Don't commit filelogs until we know the commit hash, since the hash
573 573 # is present in the filelog blob.
574 574 # This violates Mercurial's filelog->manifest->changelog write order,
575 575 # but is generally fine for client repos.
576 576 pendingfilecommits = []
577 577 def addrawrevision(orig, self, rawtext, transaction, link, p1, p2, node,
578 578 flags, cachedelta=None, _metatuple=None):
579 579 if isinstance(link, int):
580 580 pendingfilecommits.append(
581 581 (self, rawtext, transaction, link, p1, p2, node, flags,
582 582 cachedelta, _metatuple))
583 583 return node
584 584 else:
585 585 return orig(self, rawtext, transaction, link, p1, p2, node, flags,
586 586 cachedelta, _metatuple=_metatuple)
587 587 extensions.wrapfunction(
588 588 remotefilelog.remotefilelog, 'addrawrevision', addrawrevision)
589 589
590 590 def changelogadd(orig, self, *args):
591 591 oldlen = len(self)
592 592 node = orig(self, *args)
593 593 newlen = len(self)
594 594 if oldlen != newlen:
595 595 for oldargs in pendingfilecommits:
596 596 log, rt, tr, link, p1, p2, n, fl, c, m = oldargs
597 597 linknode = self.node(link)
598 598 if linknode == node:
599 599 log.addrawrevision(rt, tr, linknode, p1, p2, n, fl, c, m)
600 600 else:
601 601 raise error.ProgrammingError(
602 602 'pending multiple integer revisions are not supported')
603 603 else:
604 604 # "link" is actually wrong here (it is set to len(changelog))
605 605 # if changelog remains unchanged, skip writing file revisions
606 606 # but still do a sanity check about pending multiple revisions
607 607 if len(set(x[3] for x in pendingfilecommits)) > 1:
608 608 raise error.ProgrammingError(
609 609 'pending multiple integer revisions are not supported')
610 610 del pendingfilecommits[:]
611 611 return node
612 612 extensions.wrapfunction(changelog.changelog, 'add', changelogadd)
613 613
614 614 # changectx wrappers
615 615 def filectx(orig, self, path, fileid=None, filelog=None):
616 616 if fileid is None:
617 617 fileid = self.filenode(path)
618 618 if (isenabled(self._repo) and self._repo.shallowmatch(path)):
619 619 return remotefilectx.remotefilectx(self._repo, path,
620 620 fileid=fileid, changectx=self, filelog=filelog)
621 621 return orig(self, path, fileid=fileid, filelog=filelog)
622 622 extensions.wrapfunction(context.changectx, 'filectx', filectx)
623 623
624 624 def workingfilectx(orig, self, path, filelog=None):
625 625 if (isenabled(self._repo) and self._repo.shallowmatch(path)):
626 626 return remotefilectx.remoteworkingfilectx(self._repo,
627 627 path, workingctx=self, filelog=filelog)
628 628 return orig(self, path, filelog=filelog)
629 629 extensions.wrapfunction(context.workingctx, 'filectx', workingfilectx)
630 630
631 631 # prefetch required revisions before a diff
632 632 def trydiff(orig, repo, revs, ctx1, ctx2, modified, added, removed,
633 633 copy, getfilectx, *args, **kwargs):
634 634 if isenabled(repo):
635 635 prefetch = []
636 636 mf1 = ctx1.manifest()
637 637 for fname in modified + added + removed:
638 638 if fname in mf1:
639 639 fnode = getfilectx(fname, ctx1).filenode()
640 640 # fnode can be None if it's a edited working ctx file
641 641 if fnode:
642 642 prefetch.append((fname, hex(fnode)))
643 643 if fname not in removed:
644 644 fnode = getfilectx(fname, ctx2).filenode()
645 645 if fnode:
646 646 prefetch.append((fname, hex(fnode)))
647 647
648 648 repo.fileservice.prefetch(prefetch)
649 649
650 650 return orig(repo, revs, ctx1, ctx2, modified, added, removed,
651 651 copy, getfilectx, *args, **kwargs)
652 652 extensions.wrapfunction(patch, 'trydiff', trydiff)
653 653
654 654 # Prevent verify from processing files
655 655 # a stub for mercurial.hg.verify()
656 656 def _verify(orig, repo):
657 657 lock = repo.lock()
658 658 try:
659 659 return shallowverifier.shallowverifier(repo).verify()
660 660 finally:
661 661 lock.release()
662 662
663 663 extensions.wrapfunction(hg, 'verify', _verify)
664 664
665 665 scmutil.fileprefetchhooks.add('remotefilelog', _fileprefetchhook)
666 666
667 667 def getrenamedfn(repo, endrev=None):
668 668 rcache = {}
669 669
670 670 def getrenamed(fn, rev):
671 671 '''looks up all renames for a file (up to endrev) the first
672 672 time the file is given. It indexes on the changerev and only
673 673 parses the manifest if linkrev != changerev.
674 674 Returns rename info for fn at changerev rev.'''
675 675 if rev in rcache.setdefault(fn, {}):
676 676 return rcache[fn][rev]
677 677
678 678 try:
679 679 fctx = repo[rev].filectx(fn)
680 680 for ancestor in fctx.ancestors():
681 681 if ancestor.path() == fn:
682 682 renamed = ancestor.renamed()
683 683 rcache[fn][ancestor.rev()] = renamed and renamed[0]
684 684
685 685 renamed = fctx.renamed()
686 686 return renamed and renamed[0]
687 687 except error.LookupError:
688 688 return None
689 689
690 690 return getrenamed
691 691
692 692 def walkfilerevs(orig, repo, match, follow, revs, fncache):
693 693 if not isenabled(repo):
694 694 return orig(repo, match, follow, revs, fncache)
695 695
696 696 # remotefilelog's can't be walked in rev order, so throw.
697 697 # The caller will see the exception and walk the commit tree instead.
698 698 if not follow:
699 699 raise cmdutil.FileWalkError("Cannot walk via filelog")
700 700
701 701 wanted = set()
702 702 minrev, maxrev = min(revs), max(revs)
703 703
704 704 pctx = repo['.']
705 705 for filename in match.files():
706 706 if filename not in pctx:
707 707 raise error.Abort(_('cannot follow file not in parent '
708 708 'revision: "%s"') % filename)
709 709 fctx = pctx[filename]
710 710
711 711 linkrev = fctx.linkrev()
712 712 if linkrev >= minrev and linkrev <= maxrev:
713 713 fncache.setdefault(linkrev, []).append(filename)
714 714 wanted.add(linkrev)
715 715
716 716 for ancestor in fctx.ancestors():
717 717 linkrev = ancestor.linkrev()
718 718 if linkrev >= minrev and linkrev <= maxrev:
719 719 fncache.setdefault(linkrev, []).append(ancestor.path())
720 720 wanted.add(linkrev)
721 721
722 722 return wanted
723 723
724 724 def filelogrevset(orig, repo, subset, x):
725 725 """``filelog(pattern)``
726 726 Changesets connected to the specified filelog.
727 727
728 728 For performance reasons, ``filelog()`` does not show every changeset
729 729 that affects the requested file(s). See :hg:`help log` for details. For
730 730 a slower, more accurate result, use ``file()``.
731 731 """
732 732
733 733 if not isenabled(repo):
734 734 return orig(repo, subset, x)
735 735
736 736 # i18n: "filelog" is a keyword
737 737 pat = revset.getstring(x, _("filelog requires a pattern"))
738 738 m = match.match(repo.root, repo.getcwd(), [pat], default='relpath',
739 739 ctx=repo[None])
740 740 s = set()
741 741
742 742 if not match.patkind(pat):
743 743 # slow
744 744 for r in subset:
745 745 ctx = repo[r]
746 746 cfiles = ctx.files()
747 747 for f in m.files():
748 748 if f in cfiles:
749 749 s.add(ctx.rev())
750 750 break
751 751 else:
752 752 # partial
753 753 files = (f for f in repo[None] if m(f))
754 754 for f in files:
755 755 fctx = repo[None].filectx(f)
756 756 s.add(fctx.linkrev())
757 757 for actx in fctx.ancestors():
758 758 s.add(actx.linkrev())
759 759
760 760 return smartset.baseset([r for r in subset if r in s])
761 761
762 762 @command('gc', [], _('hg gc [REPO...]'), norepo=True)
763 763 def gc(ui, *args, **opts):
764 764 '''garbage collect the client and server filelog caches
765 765 '''
766 766 cachepaths = set()
767 767
768 768 # get the system client cache
769 769 systemcache = shallowutil.getcachepath(ui, allowempty=True)
770 770 if systemcache:
771 771 cachepaths.add(systemcache)
772 772
773 773 # get repo client and server cache
774 774 repopaths = []
775 775 pwd = ui.environ.get('PWD')
776 776 if pwd:
777 777 repopaths.append(pwd)
778 778
779 779 repopaths.extend(args)
780 780 repos = []
781 781 for repopath in repopaths:
782 782 try:
783 783 repo = hg.peer(ui, {}, repopath)
784 784 repos.append(repo)
785 785
786 786 repocache = shallowutil.getcachepath(repo.ui, allowempty=True)
787 787 if repocache:
788 788 cachepaths.add(repocache)
789 789 except error.RepoError:
790 790 pass
791 791
792 792 # gc client cache
793 793 for cachepath in cachepaths:
794 794 gcclient(ui, cachepath)
795 795
796 796 # gc server cache
797 797 for repo in repos:
798 798 remotefilelogserver.gcserver(ui, repo._repo)
799 799
800 800 def gcclient(ui, cachepath):
801 801 # get list of repos that use this cache
802 802 repospath = os.path.join(cachepath, 'repos')
803 803 if not os.path.exists(repospath):
804 804 ui.warn(_("no known cache at %s\n") % cachepath)
805 805 return
806 806
807 807 reposfile = open(repospath, 'rb')
808 808 repos = {r[:-1] for r in reposfile.readlines()}
809 809 reposfile.close()
810 810
811 811 # build list of useful files
812 812 validrepos = []
813 813 keepkeys = set()
814 814
815 815 sharedcache = None
816 816 filesrepacked = False
817 817
818 818 count = 0
819 819 progress = ui.makeprogress(_("analyzing repositories"), unit="repos",
820 820 total=len(repos))
821 821 for path in repos:
822 822 progress.update(count)
823 823 count += 1
824 824 try:
825 825 path = ui.expandpath(os.path.normpath(path))
826 826 except TypeError as e:
827 827 ui.warn(_("warning: malformed path: %r:%s\n") % (path, e))
828 828 traceback.print_exc()
829 829 continue
830 830 try:
831 831 peer = hg.peer(ui, {}, path)
832 832 repo = peer._repo
833 833 except error.RepoError:
834 834 continue
835 835
836 836 validrepos.append(path)
837 837
838 838 # Protect against any repo or config changes that have happened since
839 839 # this repo was added to the repos file. We'd rather this loop succeed
840 840 # and too much be deleted, than the loop fail and nothing gets deleted.
841 841 if not isenabled(repo):
842 842 continue
843 843
844 844 if not util.safehasattr(repo, 'name'):
845 845 ui.warn(_("repo %s is a misconfigured remotefilelog repo\n") % path)
846 846 continue
847 847
848 848 # If garbage collection on repack and repack on hg gc are enabled
849 849 # then loose files are repacked and garbage collected.
850 850 # Otherwise regular garbage collection is performed.
851 851 repackonhggc = repo.ui.configbool('remotefilelog', 'repackonhggc')
852 852 gcrepack = repo.ui.configbool('remotefilelog', 'gcrepack')
853 853 if repackonhggc and gcrepack:
854 854 try:
855 855 repackmod.incrementalrepack(repo)
856 856 filesrepacked = True
857 857 continue
858 858 except (IOError, repackmod.RepackAlreadyRunning):
859 859 # If repack cannot be performed due to not enough disk space
860 860 # continue doing garbage collection of loose files w/o repack
861 861 pass
862 862
863 863 reponame = repo.name
864 864 if not sharedcache:
865 865 sharedcache = repo.sharedstore
866 866
867 867 # Compute a keepset which is not garbage collected
868 868 def keyfn(fname, fnode):
869 869 return fileserverclient.getcachekey(reponame, fname, hex(fnode))
870 870 keepkeys = repackmod.keepset(repo, keyfn=keyfn, lastkeepkeys=keepkeys)
871 871
872 872 progress.complete()
873 873
874 874 # write list of valid repos back
875 875 oldumask = os.umask(0o002)
876 876 try:
877 877 reposfile = open(repospath, 'wb')
878 878 reposfile.writelines([("%s\n" % r) for r in validrepos])
879 879 reposfile.close()
880 880 finally:
881 881 os.umask(oldumask)
882 882
883 883 # prune cache
884 884 if sharedcache is not None:
885 885 sharedcache.gc(keepkeys)
886 886 elif not filesrepacked:
887 887 ui.warn(_("warning: no valid repos in repofile\n"))
888 888
889 889 def log(orig, ui, repo, *pats, **opts):
890 890 if not isenabled(repo):
891 891 return orig(ui, repo, *pats, **opts)
892 892
893 893 follow = opts.get(r'follow')
894 894 revs = opts.get(r'rev')
895 895 if pats:
896 896 # Force slowpath for non-follow patterns and follows that start from
897 897 # non-working-copy-parent revs.
898 898 if not follow or revs:
899 899 # This forces the slowpath
900 900 opts[r'removed'] = True
901 901
902 902 # If this is a non-follow log without any revs specified, recommend that
903 903 # the user add -f to speed it up.
904 904 if not follow and not revs:
905 905 match = scmutil.match(repo['.'], pats, pycompat.byteskwargs(opts))
906 906 isfile = not match.anypats()
907 907 if isfile:
908 908 for file in match.files():
909 909 if not os.path.isfile(repo.wjoin(file)):
910 910 isfile = False
911 911 break
912 912
913 913 if isfile:
914 914 ui.warn(_("warning: file log can be slow on large repos - " +
915 915 "use -f to speed it up\n"))
916 916
917 917 return orig(ui, repo, *pats, **opts)
918 918
919 919 def revdatelimit(ui, revset):
920 920 """Update revset so that only changesets no older than 'prefetchdays' days
921 921 are included. The default value is set to 14 days. If 'prefetchdays' is set
922 922 to zero or negative value then date restriction is not applied.
923 923 """
924 924 days = ui.configint('remotefilelog', 'prefetchdays')
925 925 if days > 0:
926 926 revset = '(%s) & date(-%s)' % (revset, days)
927 927 return revset
928 928
929 929 def readytofetch(repo):
930 930 """Check that enough time has passed since the last background prefetch.
931 931 This only relates to prefetches after operations that change the working
932 932 copy parent. Default delay between background prefetches is 2 minutes.
933 933 """
934 934 timeout = repo.ui.configint('remotefilelog', 'prefetchdelay')
935 935 fname = repo.vfs.join('lastprefetch')
936 936
937 937 ready = False
938 938 with open(fname, 'a'):
939 939 # the with construct above is used to avoid race conditions
940 940 modtime = os.path.getmtime(fname)
941 941 if (time.time() - modtime) > timeout:
942 942 os.utime(fname, None)
943 943 ready = True
944 944
945 945 return ready
946 946
947 947 def wcpprefetch(ui, repo, **kwargs):
948 948 """Prefetches in background revisions specified by bgprefetchrevs revset.
949 949 Does background repack if backgroundrepack flag is set in config.
950 950 """
951 951 shallow = isenabled(repo)
952 952 bgprefetchrevs = ui.config('remotefilelog', 'bgprefetchrevs')
953 953 isready = readytofetch(repo)
954 954
955 955 if not (shallow and bgprefetchrevs and isready):
956 956 return
957 957
958 958 bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack')
959 959 # update a revset with a date limit
960 960 bgprefetchrevs = revdatelimit(ui, bgprefetchrevs)
961 961
962 962 def anon():
963 963 if util.safehasattr(repo, 'ranprefetch') and repo.ranprefetch:
964 964 return
965 965 repo.ranprefetch = True
966 966 repo.backgroundprefetch(bgprefetchrevs, repack=bgrepack)
967 967
968 968 repo._afterlock(anon)
969 969
970 970 def pull(orig, ui, repo, *pats, **opts):
971 971 result = orig(ui, repo, *pats, **opts)
972 972
973 973 if isenabled(repo):
974 974 # prefetch if it's configured
975 975 prefetchrevset = ui.config('remotefilelog', 'pullprefetch')
976 976 bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack')
977 977 bgprefetch = repo.ui.configbool('remotefilelog', 'backgroundprefetch')
978 978
979 979 if prefetchrevset:
980 980 ui.status(_("prefetching file contents\n"))
981 981 revs = scmutil.revrange(repo, [prefetchrevset])
982 982 base = repo['.'].rev()
983 983 if bgprefetch:
984 984 repo.backgroundprefetch(prefetchrevset, repack=bgrepack)
985 985 else:
986 986 repo.prefetch(revs, base=base)
987 987 if bgrepack:
988 988 repackmod.backgroundrepack(repo, incremental=True)
989 989 elif bgrepack:
990 990 repackmod.backgroundrepack(repo, incremental=True)
991 991
992 992 return result
993 993
994 994 def exchangepull(orig, repo, remote, *args, **kwargs):
995 995 # Hook into the callstream/getbundle to insert bundle capabilities
996 996 # during a pull.
997 997 def localgetbundle(orig, source, heads=None, common=None, bundlecaps=None,
998 998 **kwargs):
999 999 if not bundlecaps:
1000 1000 bundlecaps = set()
1001 1001 bundlecaps.add(constants.BUNDLE2_CAPABLITY)
1002 1002 return orig(source, heads=heads, common=common, bundlecaps=bundlecaps,
1003 1003 **kwargs)
1004 1004
1005 1005 if util.safehasattr(remote, '_callstream'):
1006 1006 remote._localrepo = repo
1007 1007 elif util.safehasattr(remote, 'getbundle'):
1008 1008 extensions.wrapfunction(remote, 'getbundle', localgetbundle)
1009 1009
1010 1010 return orig(repo, remote, *args, **kwargs)
1011 1011
1012 1012 def _fileprefetchhook(repo, revs, match):
1013 1013 if isenabled(repo):
1014 1014 allfiles = []
1015 1015 for rev in revs:
1016 1016 if rev == nodemod.wdirrev or rev is None:
1017 1017 continue
1018 1018 ctx = repo[rev]
1019 1019 mf = ctx.manifest()
1020 1020 sparsematch = repo.maybesparsematch(ctx.rev())
1021 1021 for path in ctx.walk(match):
1022 1022 if path.endswith('/'):
1023 1023 # Tree manifest that's being excluded as part of narrow
1024 1024 continue
1025 1025 if (not sparsematch or sparsematch(path)) and path in mf:
1026 1026 allfiles.append((path, hex(mf[path])))
1027 1027 repo.fileservice.prefetch(allfiles)
1028 1028
1029 1029 @command('debugremotefilelog', [
1030 1030 ('d', 'decompress', None, _('decompress the filelog first')),
1031 1031 ], _('hg debugremotefilelog <path>'), norepo=True)
1032 1032 def debugremotefilelog(ui, path, **opts):
1033 1033 return debugcommands.debugremotefilelog(ui, path, **opts)
1034 1034
1035 1035 @command('verifyremotefilelog', [
1036 1036 ('d', 'decompress', None, _('decompress the filelogs first')),
1037 1037 ], _('hg verifyremotefilelogs <directory>'), norepo=True)
1038 1038 def verifyremotefilelog(ui, path, **opts):
1039 1039 return debugcommands.verifyremotefilelog(ui, path, **opts)
1040 1040
1041 1041 @command('debugdatapack', [
1042 1042 ('', 'long', None, _('print the long hashes')),
1043 1043 ('', 'node', '', _('dump the contents of node'), 'NODE'),
1044 1044 ], _('hg debugdatapack <paths>'), norepo=True)
1045 1045 def debugdatapack(ui, *paths, **opts):
1046 1046 return debugcommands.debugdatapack(ui, *paths, **opts)
1047 1047
1048 1048 @command('debughistorypack', [
1049 1049 ], _('hg debughistorypack <path>'), norepo=True)
1050 1050 def debughistorypack(ui, path, **opts):
1051 1051 return debugcommands.debughistorypack(ui, path)
1052 1052
1053 1053 @command('debugkeepset', [
1054 1054 ], _('hg debugkeepset'))
1055 1055 def debugkeepset(ui, repo, **opts):
1056 1056 # The command is used to measure keepset computation time
1057 1057 def keyfn(fname, fnode):
1058 1058 return fileserverclient.getcachekey(repo.name, fname, hex(fnode))
1059 1059 repackmod.keepset(repo, keyfn)
1060 1060 return
1061 1061
1062 1062 @command('debugwaitonrepack', [
1063 1063 ], _('hg debugwaitonrepack'))
1064 1064 def debugwaitonrepack(ui, repo, **opts):
1065 1065 return debugcommands.debugwaitonrepack(repo)
1066 1066
1067 1067 @command('debugwaitonprefetch', [
1068 1068 ], _('hg debugwaitonprefetch'))
1069 1069 def debugwaitonprefetch(ui, repo, **opts):
1070 1070 return debugcommands.debugwaitonprefetch(repo)
1071 1071
1072 1072 def resolveprefetchopts(ui, opts):
1073 1073 if not opts.get('rev'):
1074 1074 revset = ['.', 'draft()']
1075 1075
1076 1076 prefetchrevset = ui.config('remotefilelog', 'pullprefetch', None)
1077 1077 if prefetchrevset:
1078 1078 revset.append('(%s)' % prefetchrevset)
1079 1079 bgprefetchrevs = ui.config('remotefilelog', 'bgprefetchrevs', None)
1080 1080 if bgprefetchrevs:
1081 1081 revset.append('(%s)' % bgprefetchrevs)
1082 1082 revset = '+'.join(revset)
1083 1083
1084 1084 # update a revset with a date limit
1085 1085 revset = revdatelimit(ui, revset)
1086 1086
1087 1087 opts['rev'] = [revset]
1088 1088
1089 1089 if not opts.get('base'):
1090 1090 opts['base'] = None
1091 1091
1092 1092 return opts
1093 1093
1094 1094 @command('prefetch', [
1095 1095 ('r', 'rev', [], _('prefetch the specified revisions'), _('REV')),
1096 1096 ('', 'repack', False, _('run repack after prefetch')),
1097 1097 ('b', 'base', '', _("rev that is assumed to already be local")),
1098 1098 ] + commands.walkopts, _('hg prefetch [OPTIONS] [FILE...]'))
1099 1099 def prefetch(ui, repo, *pats, **opts):
1100 1100 """prefetch file revisions from the server
1101 1101
1102 1102 Prefetchs file revisions for the specified revs and stores them in the
1103 1103 local remotefilelog cache. If no rev is specified, the default rev is
1104 1104 used which is the union of dot, draft, pullprefetch and bgprefetchrev.
1105 1105 File names or patterns can be used to limit which files are downloaded.
1106 1106
1107 1107 Return 0 on success.
1108 1108 """
1109 1109 opts = pycompat.byteskwargs(opts)
1110 1110 if not isenabled(repo):
1111 1111 raise error.Abort(_("repo is not shallow"))
1112 1112
1113 1113 opts = resolveprefetchopts(ui, opts)
1114 1114 revs = scmutil.revrange(repo, opts.get('rev'))
1115 1115 repo.prefetch(revs, opts.get('base'), pats, opts)
1116 1116
1117 1117 # Run repack in background
1118 1118 if opts.get('repack'):
1119 1119 repackmod.backgroundrepack(repo, incremental=True)
1120 1120
1121 1121 @command('repack', [
1122 1122 ('', 'background', None, _('run in a background process'), None),
1123 1123 ('', 'incremental', None, _('do an incremental repack'), None),
1124 1124 ('', 'packsonly', None, _('only repack packs (skip loose objects)'), None),
1125 1125 ], _('hg repack [OPTIONS]'))
1126 1126 def repack_(ui, repo, *pats, **opts):
1127 1127 if opts.get(r'background'):
1128 1128 repackmod.backgroundrepack(repo, incremental=opts.get(r'incremental'),
1129 1129 packsonly=opts.get(r'packsonly', False))
1130 1130 return
1131 1131
1132 1132 options = {'packsonly': opts.get(r'packsonly')}
1133 1133
1134 1134 try:
1135 1135 if opts.get(r'incremental'):
1136 1136 repackmod.incrementalrepack(repo, options=options)
1137 1137 else:
1138 1138 repackmod.fullrepack(repo, options=options)
1139 1139 except repackmod.RepackAlreadyRunning as ex:
1140 1140 # Don't propogate the exception if the repack is already in
1141 1141 # progress, since we want the command to exit 0.
1142 1142 repo.ui.warn('%s\n' % ex)
General Comments 0
You need to be logged in to leave comments. Login now