From patchwork Thu Sep 5 20:07:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [42,of,48,RFC] commitablectx: move markcommitted from workingctx From: Sean Farley X-Patchwork-Id: 2380 Message-Id: <2ce3f8546d756db6b937.1378411656@laptop.local> To: mercurial-devel@selenic.com Date: Thu, 05 Sep 2013 15:07:36 -0500 # HG changeset patch # User Sean Farley # Date 1376516427 18000 # Wed Aug 14 16:40:27 2013 -0500 # Node ID 2ce3f8546d756db6b937ff22c6a53308bd7a0724 # Parent a4bead02a7e17acb828bd9f5fb7f3439efd21417 commitablectx: move markcommitted from workingctx diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1041,10 +1041,26 @@ def ancestors(self): for a in self._repo.changelog.ancestors( [p.rev() for p in self._parents]): yield changectx(self._repo, a) + def markcommitted(self, node): + """Perform post-commit cleanup necessary after committing this ctx + + Specifically, this updates backing stores this working context + wraps to reflect the fact that the changes reflected by this + workingctx have been committed. For example, it marks + modified and added files as normal in the dirstate. + + """ + + for f in self.modified() + self.added(): + self._repo.dirstate.normal(f) + for f in self.removed(): + self._repo.dirstate.drop(f) + self._repo.dirstate.setparents(node) + class workingctx(commitablectx): """A workingctx object makes access to data related to the current working directory convenient. date - any valid date string or (unixtime, offset), or None. user - username string, or None. @@ -1167,26 +1183,10 @@ self._repo.dirstate.add(dest) self._repo.dirstate.copy(source, dest) finally: wlock.release() - def markcommitted(self, node): - """Perform post-commit cleanup necessary after committing this ctx - - Specifically, this updates backing stores this working context - wraps to reflect the fact that the changes reflected by this - workingctx have been committed. For example, it marks - modified and added files as normal in the dirstate. - - """ - - for f in self.modified() + self.added(): - self._repo.dirstate.normal(f) - for f in self.removed(): - self._repo.dirstate.drop(f) - self._repo.dirstate.setparents(node) - def dirs(self): return self._repo.dirstate.dirs() class workingfilectx(basefilectx): """A workingfilectx object makes access to data related to a particular