##// END OF EJS Templates
mq: migrate to context manager for changing dirstate parents
Augie Fackler -
r32347:f4aee989 default
parent child Browse files
Show More
@@ -932,14 +932,13 b' class queue(object):'
932 merged.append(f)
932 merged.append(f)
933 else:
933 else:
934 removed.append(f)
934 removed.append(f)
935 repo.dirstate.beginparentchange()
935 with repo.dirstate.parentchange():
936 for f in removed:
936 for f in removed:
937 repo.dirstate.remove(f)
937 repo.dirstate.remove(f)
938 for f in merged:
938 for f in merged:
939 repo.dirstate.merge(f)
939 repo.dirstate.merge(f)
940 p1, p2 = repo.dirstate.parents()
940 p1, p2 = repo.dirstate.parents()
941 repo.setparents(p1, merge)
941 repo.setparents(p1, merge)
942 repo.dirstate.endparentchange()
943
942
944 if all_files and '.hgsubstate' in all_files:
943 if all_files and '.hgsubstate' in all_files:
945 wctx = repo[None]
944 wctx = repo[None]
@@ -1580,16 +1579,15 b' class queue(object):'
1580 if keepchanges and tobackup:
1579 if keepchanges and tobackup:
1581 raise error.Abort(_("local changes found, qrefresh first"))
1580 raise error.Abort(_("local changes found, qrefresh first"))
1582 self.backup(repo, tobackup)
1581 self.backup(repo, tobackup)
1583 repo.dirstate.beginparentchange()
1582 with repo.dirstate.parentchange():
1584 for f in a:
1583 for f in a:
1585 repo.wvfs.unlinkpath(f, ignoremissing=True)
1584 repo.wvfs.unlinkpath(f, ignoremissing=True)
1586 repo.dirstate.drop(f)
1585 repo.dirstate.drop(f)
1587 for f in m + r:
1586 for f in m + r:
1588 fctx = ctx[f]
1587 fctx = ctx[f]
1589 repo.wwrite(f, fctx.data(), fctx.flags())
1588 repo.wwrite(f, fctx.data(), fctx.flags())
1590 repo.dirstate.normal(f)
1589 repo.dirstate.normal(f)
1591 repo.setparents(qp, nullid)
1590 repo.setparents(qp, nullid)
1592 repo.dirstate.endparentchange()
1593 for patch in reversed(self.applied[start:end]):
1591 for patch in reversed(self.applied[start:end]):
1594 self.ui.status(_("popping %s\n") % patch.name)
1592 self.ui.status(_("popping %s\n") % patch.name)
1595 del self.applied[start:end]
1593 del self.applied[start:end]
General Comments 0
You need to be logged in to leave comments. Login now