Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG60eb35b0c11c: remotefilelog: remove function that was described as deprecated
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/remotefilelog/extutil.py (12 lines) | |||
M | hgext/remotefilelog/repack.py (4 lines) | |||
M | hgext/remotefilelog/shallowrepo.py (4 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Augie Fackler | Oct 3 2018, 1:54 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
returncode = 255 | returncode = 255 | ||||
except Exception: | except Exception: | ||||
returncode = 255 | returncode = 255 | ||||
finally: | finally: | ||||
# mission accomplished, this child needs to exit and not | # mission accomplished, this child needs to exit and not | ||||
# continue the hg process here. | # continue the hg process here. | ||||
os._exit(returncode) | os._exit(returncode) | ||||
def runshellcommand(script, env): | |||||
''' | |||||
Run a shell command in the background. | |||||
This spawns the command and returns before it completes. | |||||
Prefer using runbgcommand() instead of this function. This function should | |||||
be discouraged in new code. Running commands through a subshell requires | |||||
you to be very careful about correctly escaping arguments, and you need to | |||||
make sure your command works with both Windows and Unix shells. | |||||
''' | |||||
runbgcommand(script, env=env, shell=True) | |||||
@contextlib.contextmanager | @contextlib.contextmanager | ||||
def flock(lockpath, description, timeout=-1): | def flock(lockpath, description, timeout=-1): | ||||
"""A flock based lock object. Currently it is always non-blocking. | """A flock based lock object. Currently it is always non-blocking. | ||||
Note that since it is flock based, you can accidentally take it multiple | Note that since it is flock based, you can accidentally take it multiple | ||||
times within one process and the first one to be released will release all | times within one process and the first one to be released will release all | ||||
of them. So the caller needs to be careful to not create more than one | of them. So the caller needs to be careful to not create more than one | ||||
instance per lock. | instance per lock. |
def backgroundrepack(repo, incremental=True, packsonly=False): | def backgroundrepack(repo, incremental=True, packsonly=False): | ||||
cmd = [_hgexecutable(), '-R', repo.origroot, 'repack'] | cmd = [_hgexecutable(), '-R', repo.origroot, 'repack'] | ||||
msg = _("(running background repack)\n") | msg = _("(running background repack)\n") | ||||
if incremental: | if incremental: | ||||
cmd.append('--incremental') | cmd.append('--incremental') | ||||
msg = _("(running background incremental repack)\n") | msg = _("(running background incremental repack)\n") | ||||
if packsonly: | if packsonly: | ||||
cmd.append('--packsonly') | cmd.append('--packsonly') | ||||
cmd = ' '.join(map(procutil.shellquote, cmd)) | |||||
repo.ui.warn(msg) | repo.ui.warn(msg) | ||||
extutil.runshellcommand(cmd, encoding.environ) | extutil.runbgcommand(cmd, encoding.environ) | ||||
def fullrepack(repo, options=None): | def fullrepack(repo, options=None): | ||||
"""If ``packsonly`` is True, stores creating only loose objects are skipped. | """If ``packsonly`` is True, stores creating only loose objects are skipped. | ||||
""" | """ | ||||
if util.safehasattr(repo, 'shareddatastores'): | if util.safehasattr(repo, 'shareddatastores'): | ||||
datasource = contentstore.unioncontentstore( | datasource = contentstore.unioncontentstore( | ||||
*repo.shareddatastores) | *repo.shareddatastores) | ||||
historysource = metadatastore.unionmetadatastore( | historysource = metadatastore.unionmetadatastore( |
opts=None): | opts=None): | ||||
"""Runs prefetch in background with optional repack | """Runs prefetch in background with optional repack | ||||
""" | """ | ||||
cmd = [_hgexecutable(), '-R', repo.origroot, 'prefetch'] | cmd = [_hgexecutable(), '-R', repo.origroot, 'prefetch'] | ||||
if repack: | if repack: | ||||
cmd.append('--repack') | cmd.append('--repack') | ||||
if revs: | if revs: | ||||
cmd += ['-r', revs] | cmd += ['-r', revs] | ||||
cmd = ' '.join(map(procutil.shellquote, cmd)) | extutil.runbgcommand(cmd, encoding.environ) | ||||
extutil.runshellcommand(cmd, encoding.environ) | |||||
def prefetch(self, revs, base=None, pats=None, opts=None): | def prefetch(self, revs, base=None, pats=None, opts=None): | ||||
"""Prefetches all the necessary file revisions for the given revs | """Prefetches all the necessary file revisions for the given revs | ||||
Optionally runs repack in background | Optionally runs repack in background | ||||
""" | """ | ||||
with repo._lock(repo.svfs, 'prefetchlock', True, None, None, | with repo._lock(repo.svfs, 'prefetchlock', True, None, None, | ||||
_('prefetching in %s') % repo.origroot): | _('prefetching in %s') % repo.origroot): | ||||
self._prefetch(revs, base, pats, opts) | self._prefetch(revs, base, pats, opts) |