diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -439,6 +439,7 @@ class localrepository: mm = m1.copy() mfm = mf1.copy() linkrev = self.changelog.count() + self.dirstate.setparents(p1, p2) for f in files: try: t = self.wfile(f).read() @@ -447,16 +448,19 @@ class localrepository: mfm[f] = tm mm[f] = r.add(t, tr, linkrev, m1.get(f, nullid), m2.get(f, nullid)) + self.dirstate.update([f], "n") except IOError: - del mm[f] - del mfm[f] + try: + del mm[f] + del mfm[f] + self.dirstate.forget([f]) + except: + # deleted from p2? + pass mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0]) n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date) tr.close() - self.dirstate.setparents(p1, p2) - self.dirstate.clear() - self.dirstate.update(files, "n") def commit(self, files = None, text = ""): commit = []