475 self.ui.warn("waiting for lock held by %s\n" % inst.args[0]) |
475 self.ui.warn("waiting for lock held by %s\n" % inst.args[0]) |
476 return lock.lock(self.join("lock"), wait) |
476 return lock.lock(self.join("lock"), wait) |
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() |
496 tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) |
501 tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) |
497 r = self.file(f) |
502 r = self.file(f) |
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 |
510 |
517 |
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 = [] |
517 remove = [] |
526 remove = [] |
518 if files: |
527 if files: |