##// END OF EJS Templates
teach commit about dirstate.parents()...
mpm@selenic.com -
r229:1b11da6e default
parent child Browse files
Show More
@@ -413,9 +413,7 b' class localrepository:'
413 self.dirstate.clear()
413 self.dirstate.clear()
414 self.dirstate.update(mmap.keys(), "n")
414 self.dirstate.update(mmap.keys(), "n")
415
415
416 def commit(self, parent, files = None, text = ""):
416 def commit(self, files = None, text = ""):
417 self.lock()
418
419 commit = []
417 commit = []
420 remove = []
418 remove = []
421 if files:
419 if files:
@@ -436,6 +434,11 b' class localrepository:'
436 self.ui.status("nothing changed\n")
434 self.ui.status("nothing changed\n")
437 return
435 return
438
436
437 p1, p2 = self.dirstate.parents()
438 c1 = self.changelog.read(p1)
439 c2 = self.changelog.read(p2)
440 m1 = self.manifest.read(c1[0])
441 m2 = self.manifest.read(c2[0])
439 lock = self.lock()
442 lock = self.lock()
440 tr = self.transaction()
443 tr = self.transaction()
441
444
@@ -452,28 +455,28 b' class localrepository:'
452 raise
455 raise
453
456
454 r = self.file(f)
457 r = self.file(f)
455 new[f] = r.add(t, tr, linkrev)
458 fp1 = m1.get(f, nullid)
459 fp2 = m2.get(f, nullid)
460 new[f] = r.add(t, tr, linkrev, fp1, fp2)
456
461
457 # update manifest
462 # update manifest
458 mmap = self.manifest.read(self.manifest.tip())
463 m1.update(new)
459 mmap.update(new)
464 for f in remove: del m1[f]
460 for f in remove:
465 mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0])
461 del mmap[f]
462 mnode = self.manifest.add(mmap, tr, linkrev)
463
466
464 # add changeset
467 # add changeset
465 new = new.keys()
468 new = new.keys()
466 new.sort()
469 new.sort()
467
470
468 edittext = text + "\n" + "HG: manifest hash %s\n" % hex(mnode)
471 edittext = text + "\n" + "HG: manifest hash %s\n" % hex(mn)
469 edittext += "".join(["HG: changed %s\n" % f for f in new])
472 edittext += "".join(["HG: changed %s\n" % f for f in new])
470 edittext += "".join(["HG: removed %s\n" % f for f in remove])
473 edittext += "".join(["HG: removed %s\n" % f for f in remove])
471 edittext = self.ui.edit(edittext)
474 edittext = self.ui.edit(edittext)
472
475
473 n = self.changelog.add(mnode, new, edittext, tr)
476 n = self.changelog.add(mn, new, edittext, tr, p1, p2)
474 tr.close()
477 tr.close()
475
478
476 self.setcurrent(n)
479 self.dirstate.setparents(n)
477 self.dirstate.update(new, "n")
480 self.dirstate.update(new, "n")
478 self.dirstate.forget(remove)
481 self.dirstate.forget(remove)
479
482
General Comments 0
You need to be logged in to leave comments. Login now