848 |
848 |
849 def changectx(self, changeid): |
849 def changectx(self, changeid): |
850 return self[changeid] |
850 return self[changeid] |
851 |
851 |
852 def setparents(self, p1, p2=nullid): |
852 def setparents(self, p1, p2=nullid): |
853 self.dirstate.beginparentchange() |
853 with self.dirstate.parentchange(): |
854 copies = self.dirstate.setparents(p1, p2) |
854 copies = self.dirstate.setparents(p1, p2) |
855 pctx = self[p1] |
855 pctx = self[p1] |
856 if copies: |
856 if copies: |
857 # Adjust copy records, the dirstate cannot do it, it |
857 # Adjust copy records, the dirstate cannot do it, it |
858 # requires access to parents manifests. Preserve them |
858 # requires access to parents manifests. Preserve them |
859 # only for entries added to first parent. |
859 # only for entries added to first parent. |
860 for f in copies: |
860 for f in copies: |
861 if f not in pctx and copies[f] in pctx: |
861 if f not in pctx and copies[f] in pctx: |
862 self.dirstate.copy(copies[f], f) |
862 self.dirstate.copy(copies[f], f) |
863 if p2 == nullid: |
863 if p2 == nullid: |
864 for f, s in sorted(self.dirstate.copies().items()): |
864 for f, s in sorted(self.dirstate.copies().items()): |
865 if f not in pctx and s not in pctx: |
865 if f not in pctx and s not in pctx: |
866 self.dirstate.copy(None, f) |
866 self.dirstate.copy(None, f) |
867 self.dirstate.endparentchange() |
|
868 |
867 |
869 def filectx(self, path, changeid=None, fileid=None): |
868 def filectx(self, path, changeid=None, fileid=None): |
870 """changeid can be a changeset revision, node, or tag. |
869 """changeid can be a changeset revision, node, or tag. |
871 fileid can be a file revision or node.""" |
870 fileid can be a file revision or node.""" |
872 return context.filectx(self, path, changeid, fileid) |
871 return context.filectx(self, path, changeid, fileid) |