Mercurial > hg-stable
changeset 8717:e8de59577257
context: add a dirty method to detect modified contexts
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 04 Jun 2009 16:21:55 -0500 |
parents | f3322bb29a0e |
children | 3463b28681ee |
files | mercurial/context.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Thu Jun 04 16:21:09 2009 -0500 +++ b/mercurial/context.py Thu Jun 04 16:21:55 2009 -0500 @@ -618,6 +618,13 @@ def walk(self, match): return sorted(self._repo.dirstate.walk(match, True, False)) + def dirty(self, missing=False): + "check whether a working directory is modified" + + return (self.p2() or self.branch() != self.p1().branch() or + self.modified() or self.added() or self.removed() or + (missing and self.deleted())) + class workingfilectx(filectx): """A workingfilectx object makes access to data related to a particular file in the working directory convenient."""