Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 22073:0c48bc3d0eb2
workingfilectx: add remove and write methods
This patch will allow abstracting localrepo.remove / write method to refactor
working directory code.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Wed, 02 Jul 2014 14:01:01 -0500 |
parents | 443ef664fb55 |
children | fbe967b027bd |
comparison
equal
deleted
inserted
replaced
22072:443ef664fb55 | 22073:0c48bc3d0eb2 |
---|---|
1554 """ | 1554 """ |
1555 # fctx should be a filectx (not a workingfilectx) | 1555 # fctx should be a filectx (not a workingfilectx) |
1556 # invert comparison to reuse the same code path | 1556 # invert comparison to reuse the same code path |
1557 return fctx.cmp(self) | 1557 return fctx.cmp(self) |
1558 | 1558 |
1559 def remove(self, ignoremissing=False): | |
1560 """wraps unlink for a repo's working directory""" | |
1561 util.unlinkpath(self._repo.wjoin(self._path), ignoremissing) | |
1562 | |
1563 def write(self, data, flags): | |
1564 """wraps repo.wwrite""" | |
1565 self._repo.wwrite(self._path, data, flags) | |
1566 | |
1559 class memctx(committablectx): | 1567 class memctx(committablectx): |
1560 """Use memctx to perform in-memory commits via localrepo.commitctx(). | 1568 """Use memctx to perform in-memory commits via localrepo.commitctx(). |
1561 | 1569 |
1562 Revision information is supplied at initialization time while | 1570 Revision information is supplied at initialization time while |
1563 related files data and is made available through a callback | 1571 related files data and is made available through a callback |