comparison mercurial/context.py @ 19667:40040e4015f9

commitablectx: move __nonzero__ from workingctx
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 14 Aug 2013 15:28:43 -0500
parents 09459edfb48b
children 9d56a3359011
comparison
equal deleted inserted replaced
19666:09459edfb48b 19667:40040e4015f9
857 self._extra['branch'] = 'default' 857 self._extra['branch'] = 'default'
858 858
859 def __str__(self): 859 def __str__(self):
860 return str(self._parents[0]) + "+" 860 return str(self._parents[0]) + "+"
861 861
862 def __nonzero__(self):
863 return True
864
862 class workingctx(commitablectx): 865 class workingctx(commitablectx):
863 """A workingctx object makes access to data related to 866 """A workingctx object makes access to data related to
864 the current working directory convenient. 867 the current working directory convenient.
865 date - any valid date string or (unixtime, offset), or None. 868 date - any valid date string or (unixtime, offset), or None.
866 user - username string, or None. 869 user - username string, or None.
869 or None to use the repository status. 872 or None to use the repository status.
870 """ 873 """
871 def __init__(self, repo, text="", user=None, date=None, extra=None, 874 def __init__(self, repo, text="", user=None, date=None, extra=None,
872 changes=None): 875 changes=None):
873 super(workingctx, self).__init__(repo, text, user, date, extra, changes) 876 super(workingctx, self).__init__(repo, text, user, date, extra, changes)
874
875 def __nonzero__(self):
876 return True
877 877
878 def __contains__(self, key): 878 def __contains__(self, key):
879 return self._repo.dirstate[key] not in "?r" 879 return self._repo.dirstate[key] not in "?r"
880 880
881 def _buildflagfunc(self): 881 def _buildflagfunc(self):