[PATCH 1 of 3] status: remove flag to support kbfiles

8 views
Skip to first unread message

Yuya Nishihara

unread,
May 31, 2014, 8:32:52 AM5/31/14
to thg...@googlegroups.com
# HG changeset patch
# User Yuya Nishihara <yu...@tcha.org>
# Date 1401533170 -32400
# Sat May 31 19:46:10 2014 +0900
# Node ID d34eda8278fbcec0849b9dccb60caae09c926ed7
# Parent a3eaa706ee681f94cc90f501baf5f259eb3520c7
status: remove flag to support kbfiles

Since e5814c65a783, kbfiles extension was no longer be supported.

diff --git a/tortoisehg/hgqt/purge.py b/tortoisehg/hgqt/purge.py
--- a/tortoisehg/hgqt/purge.py
+++ b/tortoisehg/hgqt/purge.py
@@ -105,10 +105,8 @@ class PurgeDialog(QDialog):

def run(self):
try:
- repo.bfstatus = True
repo.lfstatus = True
stat = repo.status(ignored=True, unknown=True)
- repo.bfstatus = False
repo.lfstatus = False
trashcan = repo.join('Trashcan')
if os.path.isdir(trashcan):
@@ -230,11 +228,9 @@ class PurgeThread(QThread):
self.showMessage.emit('')
match = scmutil.matchall(repo)
match.explicitdir = match.traversedir = directories.append
- repo.bfstatus = True
repo.lfstatus = True
status = repo.status(match=match, ignored=opts['ignored'],
unknown=opts['unknown'], clean=False)
- repo.bfstatus = False
repo.lfstatus = False
files = status[4] + status[5]

diff --git a/tortoisehg/hgqt/quickop.py b/tortoisehg/hgqt/quickop.py
--- a/tortoisehg/hgqt/quickop.py
+++ b/tortoisehg/hgqt/quickop.py
@@ -185,10 +185,8 @@ class QuickOpDialog(QDialog):
_('No operation to perform'),
parent=self)
return
- self.repo.bfstatus = True
self.repo.lfstatus = True
repostate = self.repo.status()
- self.repo.bfstatus = False
self.repo.lfstatus = False
if self.command == 'remove':
if not self.chk.isChecked():
diff --git a/tortoisehg/hgqt/status.py b/tortoisehg/hgqt/status.py
--- a/tortoisehg/hgqt/status.py
+++ b/tortoisehg/hgqt/status.py
@@ -580,10 +580,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.bfstatus = True
self.repo.lfstatus = True
status = self.repo.status(match=m, **stopts)
- self.repo.bfstatus = False
self.repo.lfstatus = False
# Record all matched files as initially checked
for i, stat in enumerate(StatusType.preferredOrder):
@@ -596,18 +594,14 @@ class StatusThread(QThread):
wctx = context.workingctx(self.repo, changes=status)
self.patchecked = patchecked
elif self.pctx:
- self.repo.bfstatus = True
self.repo.lfstatus = True
status = self.repo.status(node1=self.pctx.p1().node(), **stopts)
- self.repo.bfstatus = False
self.repo.lfstatus = False
wctx = context.workingctx(self.repo, changes=status)
else:
wctx = self.repo[None]
- self.repo.bfstatus = True
self.repo.lfstatus = True
wctx.status(**stopts)
- self.repo.bfstatus = False
self.repo.lfstatus = False
self.wctx = wctx

diff --git a/tortoisehg/util/shlib.py b/tortoisehg/util/shlib.py
--- a/tortoisehg/util/shlib.py
+++ b/tortoisehg/util/shlib.py
@@ -94,10 +94,8 @@ if os.name == 'nt':
time.sleep(tdelta)

repo = hg.repository(ui, root) # a fresh repo object is needed
- repo.bfstatus = True
repo.lfstatus = True
repostate = repo.status() # will update .hg/dirstate as a side effect
- repo.bfstatus = False
repo.lfstatus = False
modified, added, removed, deleted = repostate[:4]

Yuya Nishihara

unread,
May 31, 2014, 8:32:54 AM5/31/14
to thg...@googlegroups.com
# HG changeset patch
# User Yuya Nishihara <yu...@tcha.org>
# Date 1401534470 -32400
# Sat May 31 20:07:50 2014 +0900
# Node ID 27523460b429c134a30b621f59a162784a83077a
# Parent d34eda8278fbcec0849b9dccb60caae09c926ed7
hgignore: list unknown files without using wctx.status (hg aca692aa0712)

context.status() API has changed since Mercurial aca692aa0712.

Here we just want the list of unknown files, we can used repo.status() in
place.

diff --git a/tortoisehg/hgqt/hgignore.py b/tortoisehg/hgqt/hgignore.py
--- a/tortoisehg/hgqt/hgignore.py
+++ b/tortoisehg/hgqt/hgignore.py
@@ -254,8 +254,7 @@ class HgignoreDialog(QDialog):
try:
self.repo.thginvalidate()
self.repo.lfstatus = True
- wctx = self.repo[None]
- wctx.status(unknown=True)
+ self.lclunknowns = self.repo.status(unknown=True)[4]
self.repo.lfstatus = False
except (EnvironmentError, error.RepoError), e:
qtlib.WarningMsgBox(_('Unable to read repository status'),
@@ -276,7 +275,6 @@ class HgignoreDialog(QDialog):
for i in self.unknownlist.selectedIndexes()]
except IndexError:
self.pats = []
- self.lclunknowns = wctx.unknown()
self.unknownlist.clear()
self.unknownlist.addItems([uni(u) for u in self.lclunknowns])
for i, u in enumerate(self.lclunknowns):

Yuya Nishihara

unread,
May 31, 2014, 8:32:57 AM5/31/14
to thg...@googlegroups.com
# HG changeset patch
# User Yuya Nishihara <yu...@tcha.org>
# Date 1401537077 -32400
# Sat May 31 20:51:17 2014 +0900
# Node ID 5873188df4cac2152f4a318e7c5e883fac89d3df
# Parent 27523460b429c134a30b621f59a162784a83077a
status: wrap wctx.status with arguments by compat function (hg aca692aa0712)

context.status() API has changed since Mercurial aca692aa0712.

As of Mercurial 9c35f3a8cac4, unknown files are listed as deleted. This is
probably a bug of Mercurial.

diff --git a/tortoisehg/hgqt/guess.py b/tortoisehg/hgqt/guess.py
--- a/tortoisehg/hgqt/guess.py
+++ b/tortoisehg/hgqt/guess.py
@@ -166,7 +166,7 @@ class DetectRenameDialog(QDialog):
self.repo.thginvalidate()
self.repo.lfstatus = True
wctx = self.repo[None]
- wctx.status(unknown=True)
+ hglib.querywctxstatus(wctx, unknown=True)
self.repo.lfstatus = False
self.unrevlist.clear()
dests = []
@@ -436,7 +436,7 @@ class RenameSearchThread(QThread):
wctx = repo[None]
pctx = repo['.']
if self.copies:
- wctx.status(clean=True)
+ hglib.querywctxstatus(wctx, clean=True)
srcs = wctx.removed() + wctx.deleted()
srcs += wctx.modified() + wctx.clean()
else:
diff --git a/tortoisehg/hgqt/status.py b/tortoisehg/hgqt/status.py
--- a/tortoisehg/hgqt/status.py
+++ b/tortoisehg/hgqt/status.py
@@ -601,7 +601,7 @@ class StatusThread(QThread):
else:
wctx = self.repo[None]
self.repo.lfstatus = True
- wctx.status(**stopts)
+ hglib.querywctxstatus(wctx, **stopts)
self.repo.lfstatus = False
self.wctx = wctx

diff --git a/tortoisehg/util/hglib.py b/tortoisehg/util/hglib.py
--- a/tortoisehg/util/hglib.py
+++ b/tortoisehg/util/hglib.py
@@ -140,6 +140,14 @@ def getrevisionlabel(repo, rev):

return str(rev)

+def querywctxstatus(wctx, ignored=False, clean=False, unknown=False):
+ """Do expensive status query to update corresponding attributes"""
+ try:
+ wctx.status(listignored=ignored, listclean=clean, listunknown=unknown)
+ except TypeError:
+ # hg<3.1 (aca692aa0712)
+ wctx.status(ignored=ignored, clean=clean, unknown=unknown)
+
def getmqpatchtags(repo):
'''Returns all tag names used by MQ patches, or []'''
if hasattr(repo, 'mq'):

Yuya Nishihara

unread,
Jun 3, 2014, 8:18:49 AM6/3/14
to thg...@googlegroups.com
On Sat, 31 May 2014 21:32:42 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yu...@tcha.org>
> # Date 1401537077 -32400
> # Sat May 31 20:51:17 2014 +0900
> # Node ID 5873188df4cac2152f4a318e7c5e883fac89d3df
> # Parent 27523460b429c134a30b621f59a162784a83077a
> status: wrap wctx.status with arguments by compat function (hg aca692aa0712)
>
> context.status() API has changed since Mercurial aca692aa0712.

Pushed to default.

> As of Mercurial 9c35f3a8cac4, unknown files are listed as deleted. This is
> probably a bug of Mercurial.

It's http://patchwork.serpentine.com/patch/4903/
Reply all
Reply to author
Forward
0 new messages