comparison mercurial/context.py @ 18661:4fb92f14a97a

commit: factor out post-commit cleanup into workingctx This pulls some of the logic for the cleanup that needs to happen after a commit has been made otu of localrepo.commit and into workingctx. This is part of a larger refactoring effort that will eventually allow us to perform some types of merges in-memory.
author David Schleimer <dschleimer@fb.com>
date Fri, 08 Feb 2013 05:36:08 -0800
parents 3e92772d5383
children f02045645d12
comparison
equal deleted inserted replaced
18660:7e6946ed5756 18661:4fb92f14a97a
1136 self._repo.dirstate.add(dest) 1136 self._repo.dirstate.add(dest)
1137 self._repo.dirstate.copy(source, dest) 1137 self._repo.dirstate.copy(source, dest)
1138 finally: 1138 finally:
1139 wlock.release() 1139 wlock.release()
1140 1140
1141 def markcommitted(self, node):
1142 """Perform post-commit cleanup necessary after commiting this workingctx
1143
1144 Specifically, this updates backing stores this working context
1145 wraps to reflect the fact that the changes reflected by this
1146 workingctx have been committed. For example, it marks
1147 modified and added files as normal in the dirstate.
1148
1149 """
1150
1151 for f in self.modified() + self.added():
1152 self._repo.dirstate.normal(f)
1153 for f in self.removed():
1154 self._repo.dirstate.drop(f)
1155 self._repo.dirstate.setparents(node)
1156
1141 def dirs(self): 1157 def dirs(self):
1142 return set(self._repo.dirstate.dirs()) 1158 return set(self._repo.dirstate.dirs())
1143 1159
1144 class workingfilectx(filectx): 1160 class workingfilectx(filectx):
1145 """A workingfilectx object makes access to data related to a particular 1161 """A workingfilectx object makes access to data related to a particular