Mercurial > hg
comparison mercurial/context.py @ 23710:745e3b485632
context: add workingcommitctx for exact context to be committed
Before this patch, "workingctx" is also used for the context to be
committed. But "workingctx" works incorrectly in some cases.
For example, even when only some of changed files in the working
directory are committed, "status()" on "workingctx" object for
committing recognizes files not to be committed as changed, too.
As the preparation for fixing these issues, this patch chooses adding
new class "workingcommitctx" for exact context to be committed,
because switching by the flag (like "self._fixedstatus" or so) in some
code paths of "workingctx" is less readable and maintenancable.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 31 Dec 2014 17:55:43 +0900 |
parents | 33e5431684c0 |
children | 1e6fb8db666e |
comparison
equal
deleted
inserted
replaced
23709:33e5431684c0 | 23710:745e3b485632 |
---|---|
1620 | 1620 |
1621 def write(self, data, flags): | 1621 def write(self, data, flags): |
1622 """wraps repo.wwrite""" | 1622 """wraps repo.wwrite""" |
1623 self._repo.wwrite(self._path, data, flags) | 1623 self._repo.wwrite(self._path, data, flags) |
1624 | 1624 |
1625 class workingcommitctx(workingctx): | |
1626 """A workingcommitctx object makes access to data related to | |
1627 the revision being committed convenient. | |
1628 | |
1629 This hides changes in the working directory, if they aren't | |
1630 committed in this context. | |
1631 """ | |
1632 def __init__(self, repo, changes, | |
1633 text="", user=None, date=None, extra=None): | |
1634 super(workingctx, self).__init__(repo, text, user, date, extra, | |
1635 changes) | |
1636 | |
1625 class memctx(committablectx): | 1637 class memctx(committablectx): |
1626 """Use memctx to perform in-memory commits via localrepo.commitctx(). | 1638 """Use memctx to perform in-memory commits via localrepo.commitctx(). |
1627 | 1639 |
1628 Revision information is supplied at initialization time while | 1640 Revision information is supplied at initialization time while |
1629 related files data and is made available through a callback | 1641 related files data and is made available through a callback |