##// END OF EJS Templates
rawcommit dirstate tweak...
mpm@selenic.com -
r442:3e2aee6c default
parent child Browse files
Show More
@@ -477,19 +477,24 b' class localrepository:'
477 raise inst
477 raise inst
478
478
479 def rawcommit(self, files, text, user, date, p1=None, p2=None):
479 def rawcommit(self, files, text, user, date, p1=None, p2=None):
480 p1 = p1 or self.dirstate.parents()[0] or nullid
480 orig_parent = self.dirstate.parents()[0] or nullid
481 p2 = p2 or self.dirstate.parents()[1] or nullid
481 p1 = (p1 and self.lookup(p1)) or self.dirstate.parents()[0] or nullid
482 p2 = (p2 and self.lookup(p2)) or self.dirstate.parents()[1] or nullid
482 c1 = self.changelog.read(p1)
483 c1 = self.changelog.read(p1)
483 c2 = self.changelog.read(p2)
484 c2 = self.changelog.read(p2)
484 m1 = self.manifest.read(c1[0])
485 m1 = self.manifest.read(c1[0])
485 mf1 = self.manifest.readflags(c1[0])
486 mf1 = self.manifest.readflags(c1[0])
486 m2 = self.manifest.read(c2[0])
487 m2 = self.manifest.read(c2[0])
487
488
489 if orig_parent == p1:
490 update_dirstate = 1
491 else:
492 update_dirstate = 0
493
488 tr = self.transaction()
494 tr = self.transaction()
489 mm = m1.copy()
495 mm = m1.copy()
490 mfm = mf1.copy()
496 mfm = mf1.copy()
491 linkrev = self.changelog.count()
497 linkrev = self.changelog.count()
492 self.dirstate.setparents(p1, p2)
493 for f in files:
498 for f in files:
494 try:
499 try:
495 t = self.wfile(f).read()
500 t = self.wfile(f).read()
@@ -498,12 +503,14 b' class localrepository:'
498 mfm[f] = tm
503 mfm[f] = tm
499 mm[f] = r.add(t, {}, tr, linkrev,
504 mm[f] = r.add(t, {}, tr, linkrev,
500 m1.get(f, nullid), m2.get(f, nullid))
505 m1.get(f, nullid), m2.get(f, nullid))
501 self.dirstate.update([f], "n")
506 if update_dirstate:
507 self.dirstate.update([f], "n")
502 except IOError:
508 except IOError:
503 try:
509 try:
504 del mm[f]
510 del mm[f]
505 del mfm[f]
511 del mfm[f]
506 self.dirstate.forget([f])
512 if update_dirstate:
513 self.dirstate.forget([f])
507 except:
514 except:
508 # deleted from p2?
515 # deleted from p2?
509 pass
516 pass
@@ -511,6 +518,8 b' class localrepository:'
511 mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0])
518 mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0])
512 n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date)
519 n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date)
513 tr.close()
520 tr.close()
521 if update_dirstate:
522 self.dirstate.setparents(n, nullid)
514
523
515 def commit(self, files = None, text = "", user = None, date = None):
524 def commit(self, files = None, text = "", user = None, date = None):
516 commit = []
525 commit = []
General Comments 0
You need to be logged in to leave comments. Login now