##// END OF EJS Templates
workingctx: move setparents() logic from localrepo to mirror overlayworkingctx...
Martin von Zweigbergk -
r44504:b74270da default
parent child Browse files
Show More
@@ -1528,6 +1528,23 b' class workingctx(committablectx):'
1528 for n in p
1528 for n in p
1529 ]
1529 ]
1530
1530
1531 def setparents(self, p1node, p2node=nullid):
1532 dirstate = self._repo.dirstate
1533 with dirstate.parentchange():
1534 copies = dirstate.setparents(p1node, p2node)
1535 pctx = self._repo[p1node]
1536 if copies:
1537 # Adjust copy records, the dirstate cannot do it, it
1538 # requires access to parents manifests. Preserve them
1539 # only for entries added to first parent.
1540 for f in copies:
1541 if f not in pctx and copies[f] in pctx:
1542 dirstate.copy(copies[f], f)
1543 if p2node == nullid:
1544 for f, s in sorted(dirstate.copies().items()):
1545 if f not in pctx and s not in pctx:
1546 dirstate.copy(None, f)
1547
1531 def _fileinfo(self, path):
1548 def _fileinfo(self, path):
1532 # populate __dict__['_manifest'] as workingctx has no _manifestdelta
1549 # populate __dict__['_manifest'] as workingctx has no _manifestdelta
1533 self._manifest
1550 self._manifest
@@ -1886,20 +1886,7 b' class localrepository(object):'
1886 return self.vfs.reljoin(self.root, f, *insidef)
1886 return self.vfs.reljoin(self.root, f, *insidef)
1887
1887
1888 def setparents(self, p1, p2=nullid):
1888 def setparents(self, p1, p2=nullid):
1889 with self.dirstate.parentchange():
1889 self[None].setparents(p1, p2)
1890 copies = self.dirstate.setparents(p1, p2)
1891 pctx = self[p1]
1892 if copies:
1893 # Adjust copy records, the dirstate cannot do it, it
1894 # requires access to parents manifests. Preserve them
1895 # only for entries added to first parent.
1896 for f in copies:
1897 if f not in pctx and copies[f] in pctx:
1898 self.dirstate.copy(copies[f], f)
1899 if p2 == nullid:
1900 for f, s in sorted(self.dirstate.copies().items()):
1901 if f not in pctx and s not in pctx:
1902 self.dirstate.copy(None, f)
1903
1890
1904 def filectx(self, path, changeid=None, fileid=None, changectx=None):
1891 def filectx(self, path, changeid=None, fileid=None, changectx=None):
1905 """changeid must be a changeset revision, if specified.
1892 """changeid must be a changeset revision, if specified.
General Comments 0
You need to be logged in to leave comments. Login now