This instance was upgraded to Heptapod 0.21.0 (final) today

Commit ba11dc41 authored by Matt Harbison's avatar Matt Harbison

largefiles: use the `lfstatus` context manager introduced in 5.3

Since hg 73e6d3346e4f.
parent 3d57e688aee2
......@@ -38,6 +38,10 @@ from .qtgui import (
QVBoxLayout,
)
from hgext.largefiles import (
lfutil,
)
from mercurial import (
hg,
patch,
......@@ -203,10 +207,9 @@ class DetectRenameDialog(QDialog):
def refresh(self):
self.repo.thginvalidate()
self.repo.lfstatus = True
wctx = self.repo[None]
ws = wctx.status(listunknown=True)
self.repo.lfstatus = False
with lfutil.lfstatus(self.repo):
wctx = self.repo[None]
ws = wctx.status(listunknown=True)
self.unrevlist.clear()
dests = []
for u in ws.unknown:
......
......@@ -33,6 +33,10 @@ from .qtgui import (
QVBoxLayout,
)
from hgext.largefiles import (
lfutil,
)
from mercurial import (
commands,
error,
......@@ -289,9 +293,8 @@ class HgignoreDialog(QDialog):
try:
self.repo.thginvalidate()
self.repo.lfstatus = True
self.lclunknowns = self.repo.status(unknown=True).unknown
self.repo.lfstatus = False
with lfutil.lfstatus(self.repo):
self.lclunknowns = self.repo.status(unknown=True).unknown
except (EnvironmentError, error.RepoError) as e:
qtlib.WarningMsgBox(_('Unable to read repository status'),
uni(str(e)), parent=self)
......
......@@ -28,6 +28,10 @@ from .qtgui import (
QIcon,
)
from hgext.largefiles import (
lfutil,
)
from mercurial import (
error,
match as matchmod,
......@@ -609,11 +613,10 @@ def _populaterepo(roote, repo, nodeop, statusfilter, match):
ctx = roote.ctx
pctx = roote.pctx
repo.lfstatus = True
try:
with lfutil.lfstatus(repo):
stat = repo.status(pctx, ctx, match, clean='C' in statusfilter)
finally:
repo.lfstatus = False
for st, files in zip('MAR!?IC', stat):
if st not in statusfilter:
continue
......
......@@ -27,6 +27,10 @@ from .qtgui import (
qApp,
)
from hgext.largefiles import (
lfutil,
)
from mercurial import (
hg,
scmutil,
......@@ -126,9 +130,8 @@ class PurgeDialog(QDialog):
def run(self):
try:
repo.lfstatus = True
stat = repo.status(ignored=True, unknown=True)
repo.lfstatus = False
with lfutil.lfstatus(repo):
stat = repo.status(ignored=True, unknown=True)
trashcan = repo.vfs.join(b'Trashcan')
if os.path.isdir(trashcan):
trash = os.listdir(trashcan)
......@@ -249,10 +252,9 @@ class PurgeThread(QThread):
self.showMessage.emit('')
match = scmutil.matchall(repo)
match.explicitdir = match.traversedir = directories.append
repo.lfstatus = True
status = repo.status(match=match, ignored=opts['ignored'],
unknown=opts['unknown'], clean=False)
repo.lfstatus = False
with lfutil.lfstatus(repo):
status = repo.status(match=match, ignored=opts['ignored'],
unknown=opts['unknown'], clean=False)
files = []
if opts['unknown']:
files.extend(status.unknown)
......
......@@ -27,6 +27,10 @@ from .qtgui import (
QVBoxLayout,
)
from hgext.largefiles import (
lfutil,
)
from mercurial import (
error,
pycompat,
......@@ -217,15 +221,14 @@ class QuickOpDialog(QDialog):
parent=self)
return
if self.command == 'remove':
self.repo.lfstatus = True
try:
repostate = self.repo.status()
except (EnvironmentError, error.Abort) as e:
qtlib.WarningMsgBox(_('Unable to read repository status'),
hglib.tounicode(str(e)), parent=self)
return
finally:
self.repo.lfstatus = False
with lfutil.lfstatus(self.repo):
try:
repostate = self.repo.status()
except (EnvironmentError, error.Abort) as e:
qtlib.WarningMsgBox(_('Unable to read repository status'),
hglib.tounicode(str(e)), parent=self)
return
if not self.chk.isChecked():
selmodified = []
for wfile in files:
......
......@@ -48,6 +48,10 @@ from .qtgui import (
QWidget,
)
from hgext.largefiles import (
lfutil,
)
from mercurial import (
context,
error,
......@@ -711,9 +715,8 @@ class StatusThread(QThread):
# status and commit only pre-check MAR files
precheckfn = lambda x: x < 4
m = scmutil.match(self.repo[None], self.pats)
self.repo.lfstatus = True
status = self.repo.status(match=m, **stopts)
self.repo.lfstatus = False
with lfutil.lfstatus(self.repo):
status = self.repo.status(match=m, **stopts)
# Record all matched files as initially checked
for i, stat in enumerate(StatusType.preferredOrder):
if stat == 'S':
......@@ -726,9 +729,8 @@ class StatusThread(QThread):
wctx = context.workingctx(self.repo, changes=status)
self.patchecked = patchecked
elif self.pctx:
self.repo.lfstatus = True
status = self.repo.status(node1=self.pctx.p1().node(), **stopts)
self.repo.lfstatus = False
with lfutil.lfstatus(self.repo):
status = self.repo.status(node1=self.pctx.p1().node(), **stopts)
# Even though `clean` isn't requested in the status call,
# the dirty files in wdir that are clean against p1('.') are in
......@@ -738,9 +740,8 @@ class StatusThread(QThread):
wctx = context.workingctx(self.repo, changes=status)
else:
self.repo.lfstatus = True
status = self.repo.status(**stopts)
self.repo.lfstatus = False
with lfutil.lfstatus(self.repo):
status = self.repo.status(**stopts)
wctx = context.workingctx(self.repo, changes=status)
self.wctx = wctx
self.wstatus = status
......
......@@ -10,6 +10,11 @@ import os
import sys
import time
import threading
from hgext.largefiles import (
lfutil,
)
from mercurial import (
hg,
pycompat,
......@@ -97,9 +102,8 @@ if os.name == 'nt':
time.sleep(tdelta)
repo = hg.repository(ui, root) # a fresh repo object is needed
repo.lfstatus = True
repostate = repo.status() # will update .hg/dirstate as a side effect
repo.lfstatus = False
with lfutil.lfstatus(repo):
repostate = repo.status() # will update dirstate as a side effect
dirstatus = {}
def dirname(f):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment