[PATCH 2 of 2] workingctx: use member variables to store ignored and clean
steve at borho.org
steve at borho.org
Tue May 4 15:25:04 CDT 2010
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1273003375 18000
# Node ID 836cc8253725e9ff9318cf7943b3002494f2fb00
# Parent 9239ffe508f4b75e56808cd4021c751b57c0ede7
workingctx: use member variables to store ignored and clean
If some code tries to query ignored or clean files without first
calling the explicit status() method to query them, it will raise
an exception (indicating a software bug).
diff -r 9239ffe508f4 -r 836cc8253725 mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -556,7 +556,12 @@
if user:
self._user = user
if changes:
- self._status = list(changes)
+ self._status = list(changes[:5])
+ self._ignored = changes[5]
+ self._clean = changes[6]
+ else:
+ self._ignored = None
+ self._clean = None
self._extra = {}
if extra:
@@ -616,7 +621,7 @@
@propertycache
def _status(self):
- return self._repo.status(unknown=True)
+ return self._repo.status(unknown=True)[:5]
@propertycache
def _user(self):
@@ -639,8 +644,10 @@
Unless this method is used to query the working copy status, the
_status property will implicitly read the status using its default
arguments."""
- self._status = self._repo.status(ignored=ignored, clean=clean,
- unknown=unknown)
+ stat = self._repo.status(ignored=ignored, clean=clean, unknown=unknown)
+ self._ignored = ignored and stat[5] or None
+ self._clean = clean and stat[6] or None
+ self._status = stat[:5]
return self._status
def manifest(self):
@@ -665,9 +672,13 @@
def unknown(self):
return self._status[4]
def ignored(self):
- return self._status[5]
+ if self._ignored is None:
+ raise util.Abort(_("Ignored files requested without prior query\n"))
+ return self._ignored
def clean(self):
- return self._status[6]
+ if self._clean is None:
+ raise util.Abort(_("Clean files requested without prior query\n"))
+ return self._clean
def branch(self):
return self._extra['branch']
def extra(self):
More information about the Mercurial-devel
mailing list