comparison mercurial/context.py @ 19696:210cc42a8ac2

commitablectx: move ancestor from workingctx
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 14 Aug 2013 16:37:01 -0500
parents 6c52adcaba0e
children 8c95e74857c6
comparison
equal deleted inserted replaced
19695:6c52adcaba0e 19696:210cc42a8ac2
1028 try: 1028 try:
1029 return self._flagfunc(path) 1029 return self._flagfunc(path)
1030 except OSError: 1030 except OSError:
1031 return '' 1031 return ''
1032 1032
1033 def ancestor(self, c2):
1034 """return the ancestor context of self and c2"""
1035 return self._parents[0].ancestor(c2) # punt on two parents for now
1036
1033 class workingctx(commitablectx): 1037 class workingctx(commitablectx):
1034 """A workingctx object makes access to data related to 1038 """A workingctx object makes access to data related to
1035 the current working directory convenient. 1039 the current working directory convenient.
1036 date - any valid date string or (unixtime, offset), or None. 1040 date - any valid date string or (unixtime, offset), or None.
1037 user - username string, or None. 1041 user - username string, or None.
1058 1062
1059 def filectx(self, path, filelog=None): 1063 def filectx(self, path, filelog=None):
1060 """get a file context from the working directory""" 1064 """get a file context from the working directory"""
1061 return workingfilectx(self._repo, path, workingctx=self, 1065 return workingfilectx(self._repo, path, workingctx=self,
1062 filelog=filelog) 1066 filelog=filelog)
1063
1064 def ancestor(self, c2):
1065 """return the ancestor context of self and c2"""
1066 return self._parents[0].ancestor(c2) # punt on two parents for now
1067 1067
1068 def walk(self, match): 1068 def walk(self, match):
1069 return sorted(self._repo.dirstate.walk(match, sorted(self.substate), 1069 return sorted(self._repo.dirstate.walk(match, sorted(self.substate),
1070 True, False)) 1070 True, False))
1071 1071