comparison mercurial/context.py @ 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 4ddffb793d18
children 859f841937d0
comparison
equal deleted inserted replaced
8716:f3322bb29a0e 8717:e8de59577257
616 return self._parents[0].ancestor(c2) # punt on two parents for now 616 return self._parents[0].ancestor(c2) # punt on two parents for now
617 617
618 def walk(self, match): 618 def walk(self, match):
619 return sorted(self._repo.dirstate.walk(match, True, False)) 619 return sorted(self._repo.dirstate.walk(match, True, False))
620 620
621 def dirty(self, missing=False):
622 "check whether a working directory is modified"
623
624 return (self.p2() or self.branch() != self.p1().branch() or
625 self.modified() or self.added() or self.removed() or
626 (missing and self.deleted()))
627
621 class workingfilectx(filectx): 628 class workingfilectx(filectx):
622 """A workingfilectx object makes access to data related to a particular 629 """A workingfilectx object makes access to data related to a particular
623 file in the working directory convenient.""" 630 file in the working directory convenient."""
624 def __init__(self, repo, path, filelog=None, workingctx=None): 631 def __init__(self, repo, path, filelog=None, workingctx=None):
625 """changeid can be a changeset revision, node, or tag. 632 """changeid can be a changeset revision, node, or tag.