comparison mercurial/localrepo.py @ 3425:d0459ec1455d

Add branch support to commit
author Matt Mackall <mpm@selenic.com>
date Tue, 17 Oct 2006 18:32:00 -0500
parents 5436c8fe0ff5
children a7ef6b6cc311
comparison
equal deleted inserted replaced
3424:5436c8fe0ff5 3425:d0459ec1455d
609 c1 = self.changelog.read(p1) 609 c1 = self.changelog.read(p1)
610 c2 = self.changelog.read(p2) 610 c2 = self.changelog.read(p2)
611 m1 = self.manifest.read(c1[0]).copy() 611 m1 = self.manifest.read(c1[0]).copy()
612 m2 = self.manifest.read(c2[0]) 612 m2 = self.manifest.read(c2[0])
613 613
614 if not commit and not remove and not force and p2 == nullid: 614 try:
615 branchname = self.opener("branch").read().rstrip()
616 except IOError:
617 branchname = ""
618 oldname = c1[5].get("branch", "")
619
620 if not commit and not remove and not force and p2 == nullid and \
621 branchname == oldname:
615 self.ui.status(_("nothing changed\n")) 622 self.ui.status(_("nothing changed\n"))
616 return None 623 return None
617 624
618 xp1 = hex(p1) 625 xp1 = hex(p1)
619 if p2 == nullid: xp2 = '' 626 if p2 == nullid: xp2 = ''
674 while lines and not lines[0]: 681 while lines and not lines[0]:
675 del lines[0] 682 del lines[0]
676 if not lines: 683 if not lines:
677 return None 684 return None
678 text = '\n'.join(lines) 685 text = '\n'.join(lines)
679 n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date) 686 extra = {}
687 if branchname:
688 extra["branch"] = branchname
689 n = self.changelog.add(mn, changed + remove, text, tr, p1, p2,
690 user, date, extra)
680 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, 691 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
681 parent2=xp2) 692 parent2=xp2)
682 tr.close() 693 tr.close()
683 694
684 self.dirstate.setparents(n) 695 self.dirstate.setparents(n)