Mercurial > hg
comparison mercurial/localrepo.py @ 30345:fa54f7ade491
manifest: remove manifest.add and add memmfctx.write
This removes one more dependency on the manifest class by moving the write
functionality onto the memmanifestctx classes and changing the one consumer to
use the new API.
By moving the write path to a manifestctx, we now give the individual manifests
control over how they're read and serialized. This will be useful in developing
new manifest formats and storage systems.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 08 Nov 2016 08:03:43 -0800 |
parents | 318a24b52eeb |
children | f84fc6a92817 |
comparison
equal
deleted
inserted
replaced
30344:362f6f651b2e | 30345:fa54f7ade491 |
---|---|
1698 try: | 1698 try: |
1699 tr = self.transaction("commit") | 1699 tr = self.transaction("commit") |
1700 trp = weakref.proxy(tr) | 1700 trp = weakref.proxy(tr) |
1701 | 1701 |
1702 if ctx.files(): | 1702 if ctx.files(): |
1703 m1 = p1.manifest() | 1703 m1ctx = p1.manifestctx() |
1704 m2 = p2.manifest() | 1704 m2ctx = p2.manifestctx() |
1705 m = m1.copy() | 1705 mctx = m1ctx.copy() |
1706 | |
1707 m = mctx.read() | |
1708 m1 = m1ctx.read() | |
1709 m2 = m2ctx.read() | |
1706 | 1710 |
1707 # check in files | 1711 # check in files |
1708 added = [] | 1712 added = [] |
1709 changed = [] | 1713 changed = [] |
1710 removed = list(ctx.removed()) | 1714 removed = list(ctx.removed()) |
1734 self.ui.note(_("committing manifest\n")) | 1738 self.ui.note(_("committing manifest\n")) |
1735 removed = [f for f in sorted(removed) if f in m1 or f in m2] | 1739 removed = [f for f in sorted(removed) if f in m1 or f in m2] |
1736 drop = [f for f in removed if f in m] | 1740 drop = [f for f in removed if f in m] |
1737 for f in drop: | 1741 for f in drop: |
1738 del m[f] | 1742 del m[f] |
1739 mn = self.manifestlog.add(m, trp, linkrev, | 1743 mn = mctx.write(trp, linkrev, |
1740 p1.manifestnode(), p2.manifestnode(), | 1744 p1.manifestnode(), p2.manifestnode(), |
1741 added, drop) | 1745 added, drop) |
1742 files = changed + removed | 1746 files = changed + removed |
1743 else: | 1747 else: |
1744 mn = p1.manifestnode() | 1748 mn = p1.manifestnode() |
1745 files = [] | 1749 files = [] |
1746 | 1750 |