comparison mercurial/context.py @ 19699:9fbc193b2358

commitablectx: move markcommitted from workingctx
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 14 Aug 2013 16:40:27 -0500
parents 8d4a8f4eb404
children 8f48f5969b47
comparison
equal deleted inserted replaced
19698:8d4a8f4eb404 19699:9fbc193b2358
1041 def ancestors(self): 1041 def ancestors(self):
1042 for a in self._repo.changelog.ancestors( 1042 for a in self._repo.changelog.ancestors(
1043 [p.rev() for p in self._parents]): 1043 [p.rev() for p in self._parents]):
1044 yield changectx(self._repo, a) 1044 yield changectx(self._repo, a)
1045 1045
1046 def markcommitted(self, node):
1047 """Perform post-commit cleanup necessary after committing this ctx
1048
1049 Specifically, this updates backing stores this working context
1050 wraps to reflect the fact that the changes reflected by this
1051 workingctx have been committed. For example, it marks
1052 modified and added files as normal in the dirstate.
1053
1054 """
1055
1056 for f in self.modified() + self.added():
1057 self._repo.dirstate.normal(f)
1058 for f in self.removed():
1059 self._repo.dirstate.drop(f)
1060 self._repo.dirstate.setparents(node)
1061
1046 class workingctx(commitablectx): 1062 class workingctx(commitablectx):
1047 """A workingctx object makes access to data related to 1063 """A workingctx object makes access to data related to
1048 the current working directory convenient. 1064 the current working directory convenient.
1049 date - any valid date string or (unixtime, offset), or None. 1065 date - any valid date string or (unixtime, offset), or None.
1050 user - username string, or None. 1066 user - username string, or None.
1167 self._repo.dirstate.add(dest) 1183 self._repo.dirstate.add(dest)
1168 self._repo.dirstate.copy(source, dest) 1184 self._repo.dirstate.copy(source, dest)
1169 finally: 1185 finally:
1170 wlock.release() 1186 wlock.release()
1171 1187
1172 def markcommitted(self, node):
1173 """Perform post-commit cleanup necessary after committing this ctx
1174
1175 Specifically, this updates backing stores this working context
1176 wraps to reflect the fact that the changes reflected by this
1177 workingctx have been committed. For example, it marks
1178 modified and added files as normal in the dirstate.
1179
1180 """
1181
1182 for f in self.modified() + self.added():
1183 self._repo.dirstate.normal(f)
1184 for f in self.removed():
1185 self._repo.dirstate.drop(f)
1186 self._repo.dirstate.setparents(node)
1187
1188 def dirs(self): 1188 def dirs(self):
1189 return self._repo.dirstate.dirs() 1189 return self._repo.dirstate.dirs()
1190 1190
1191 class workingfilectx(basefilectx): 1191 class workingfilectx(basefilectx):
1192 """A workingfilectx object makes access to data related to a particular 1192 """A workingfilectx object makes access to data related to a particular