comparison mercurial/localrepo.py @ 2852:046a8b03ea59

Change remaining users of manifest flags
author Matt Mackall <mpm@selenic.com>
date Fri, 11 Aug 2006 10:57:42 -0500
parents e78cad1f6b1f
children e3fb4223e750
comparison
equal deleted inserted replaced
2851:b4f05ecf4ee8 2852:046a8b03ea59
468 orig_parent = self.dirstate.parents()[0] or nullid 468 orig_parent = self.dirstate.parents()[0] or nullid
469 p1 = p1 or self.dirstate.parents()[0] or nullid 469 p1 = p1 or self.dirstate.parents()[0] or nullid
470 p2 = p2 or self.dirstate.parents()[1] or nullid 470 p2 = p2 or self.dirstate.parents()[1] or nullid
471 c1 = self.changelog.read(p1) 471 c1 = self.changelog.read(p1)
472 c2 = self.changelog.read(p2) 472 c2 = self.changelog.read(p2)
473 m1 = self.manifest.read(c1[0]) 473 m1 = self.manifest.read(c1[0]).copy()
474 mf1 = self.manifest.readflags(c1[0])
475 m2 = self.manifest.read(c2[0]) 474 m2 = self.manifest.read(c2[0])
476 changed = [] 475 changed = []
477 476
478 if orig_parent == p1: 477 if orig_parent == p1:
479 update_dirstate = 1 478 update_dirstate = 1
482 481
483 if not wlock: 482 if not wlock:
484 wlock = self.wlock() 483 wlock = self.wlock()
485 l = self.lock() 484 l = self.lock()
486 tr = self.transaction() 485 tr = self.transaction()
487 mm = m1.copy()
488 mfm = mf1.copy()
489 linkrev = self.changelog.count() 486 linkrev = self.changelog.count()
490 for f in files: 487 for f in files:
491 try: 488 try:
492 t = self.wread(f) 489 t = self.wread(f)
493 mfm.set(f, util.is_exec(self.wjoin(f), mfm.execf(f))) 490 m1.set(f, util.is_exec(self.wjoin(f), m1.execf(f)))
494 r = self.file(f) 491 r = self.file(f)
495 492
496 (entry, fp1, fp2) = self.checkfilemerge(f, t, r, m1, m2) 493 (entry, fp1, fp2) = self.checkfilemerge(f, t, r, m1, m2)
497 if entry: 494 if entry:
498 mm[f] = entry 495 m1[f] = entry
499 continue 496 continue
500 497
501 mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) 498 m1[f] = r.add(t, {}, tr, linkrev, fp1, fp2)
502 changed.append(f) 499 changed.append(f)
503 if update_dirstate: 500 if update_dirstate:
504 self.dirstate.update([f], "n") 501 self.dirstate.update([f], "n")
505 except IOError: 502 except IOError:
506 try: 503 try:
507 del mm[f] 504 del m1[f]
508 del mfm[f] 505 del m1[f]
509 if update_dirstate: 506 if update_dirstate:
510 self.dirstate.forget([f]) 507 self.dirstate.forget([f])
511 except: 508 except:
512 # deleted from p2? 509 # deleted from p2?
513 pass 510 pass
514 511
515 mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0]) 512 mnode = self.manifest.add(m1, m1, tr, linkrev, c1[0], c2[0])
516 user = user or self.ui.username() 513 user = user or self.ui.username()
517 n = self.changelog.add(mnode, changed, text, tr, p1, p2, user, date) 514 n = self.changelog.add(mnode, changed, text, tr, p1, p2, user, date)
518 tr.close() 515 tr.close()
519 if update_dirstate: 516 if update_dirstate:
520 self.dirstate.setparents(n, nullid) 517 self.dirstate.setparents(n, nullid)
541 remove = removed 538 remove = removed
542 539
543 p1, p2 = self.dirstate.parents() 540 p1, p2 = self.dirstate.parents()
544 c1 = self.changelog.read(p1) 541 c1 = self.changelog.read(p1)
545 c2 = self.changelog.read(p2) 542 c2 = self.changelog.read(p2)
546 m1 = self.manifest.read(c1[0]) 543 m1 = self.manifest.read(c1[0]).copy()
547 mf1 = self.manifest.readflags(c1[0])
548 m2 = self.manifest.read(c2[0]) 544 m2 = self.manifest.read(c2[0])
549 545
550 if not commit and not remove and not force and p2 == nullid: 546 if not commit and not remove and not force and p2 == nullid:
551 self.ui.status(_("nothing changed\n")) 547 self.ui.status(_("nothing changed\n"))
552 return None 548 return None
568 linkrev = self.changelog.count() 564 linkrev = self.changelog.count()
569 commit.sort() 565 commit.sort()
570 for f in commit: 566 for f in commit:
571 self.ui.note(f + "\n") 567 self.ui.note(f + "\n")
572 try: 568 try:
573 mf1.set(f, util.is_exec(self.wjoin(f), mf1.execf(f))) 569 m1.set(f, util.is_exec(self.wjoin(f), m1.execf(f)))
574 t = self.wread(f) 570 t = self.wread(f)
575 except IOError: 571 except IOError:
576 self.ui.warn(_("trouble committing %s!\n") % f) 572 self.ui.warn(_("trouble committing %s!\n") % f)
577 raise 573 raise
578 574
595 # remember what we've added so that we can later calculate 591 # remember what we've added so that we can later calculate
596 # the files to pull from a set of changesets 592 # the files to pull from a set of changesets
597 changed.append(f) 593 changed.append(f)
598 594
599 # update manifest 595 # update manifest
600 m1 = m1.copy()
601 m1.update(new) 596 m1.update(new)
602 for f in remove: 597 for f in remove:
603 if f in m1: 598 if f in m1:
604 del m1[f] 599 del m1[f]
605 mn = self.manifest.add(m1, mf1, tr, linkrev, c1[0], c2[0], 600 mn = self.manifest.add(m1, m1, tr, linkrev, c1[0], c2[0],
606 (new, remove)) 601 (new, remove))
607 602
608 # add changeset 603 # add changeset
609 new = new.keys() 604 new = new.keys()
610 new.sort() 605 new.sort()
813 self.dirstate.update([f], "r") 808 self.dirstate.update([f], "r")
814 809
815 def undelete(self, list, wlock=None): 810 def undelete(self, list, wlock=None):
816 p = self.dirstate.parents()[0] 811 p = self.dirstate.parents()[0]
817 mn = self.changelog.read(p)[0] 812 mn = self.changelog.read(p)[0]
818 mf = self.manifest.readflags(mn)
819 m = self.manifest.read(mn) 813 m = self.manifest.read(mn)
820 if not wlock: 814 if not wlock:
821 wlock = self.wlock() 815 wlock = self.wlock()
822 for f in list: 816 for f in list:
823 if self.dirstate.state(f) not in "r": 817 if self.dirstate.state(f) not in "r":
824 self.ui.warn("%s not removed!\n" % f) 818 self.ui.warn("%s not removed!\n" % f)
825 else: 819 else:
826 t = self.file(f).read(m[f]) 820 t = self.file(f).read(m[f])
827 self.wwrite(f, t) 821 self.wwrite(f, t)
828 util.set_exec(self.wjoin(f), mf.execf(f)) 822 util.set_exec(self.wjoin(f), m.execf(f))
829 self.dirstate.update([f], "n") 823 self.dirstate.update([f], "n")
830 824
831 def copy(self, source, dest, wlock=None): 825 def copy(self, source, dest, wlock=None):
832 p = self.wjoin(dest) 826 p = self.wjoin(dest)
833 if not os.path.exists(p): 827 if not os.path.exists(p):