comparison mercurial/localrepo.py @ 7655:cce37dab7ad6

branch closing: mark closed branches with a 'close' extra Adds a --close-branch option to commit. When --close-branch is present the commit will mark the changeset with close=1 in the changeset extras field. If a regular changeset is added on top of a closed head the branch is no longer considered closed, and thus re-opened.
author John Mulligan <phlogistonjohn@asynchrono.us>
date Wed, 14 Jan 2009 21:47:38 -0500
parents 816b708f23af
children 6a24fb994701
comparison
equal deleted inserted replaced
7654:816b708f23af 7655:cce37dab7ad6
761 761
762 def commit(self, files=None, text="", user=None, date=None, 762 def commit(self, files=None, text="", user=None, date=None,
763 match=None, force=False, force_editor=False, 763 match=None, force=False, force_editor=False,
764 p1=None, p2=None, extra={}, empty_ok=False): 764 p1=None, p2=None, extra={}, empty_ok=False):
765 wlock = lock = None 765 wlock = lock = None
766 if extra.get("close"):
767 force = True
766 if files: 768 if files:
767 files = util.unique(files) 769 files = util.unique(files)
768 try: 770 try:
769 wlock = self.wlock() 771 wlock = self.wlock()
770 lock = self.lock() 772 lock = self.lock()
835 extra = wctx.extra().copy() 837 extra = wctx.extra().copy()
836 branchname = extra['branch'] 838 branchname = extra['branch']
837 user = wctx.user() 839 user = wctx.user()
838 text = wctx.description() 840 text = wctx.description()
839 841
842 if branchname == 'default' and extra.get('close'):
843 raise util.Abort(_('closing the default branch is invalid'))
840 p1, p2 = [p.node() for p in wctx.parents()] 844 p1, p2 = [p.node() for p in wctx.parents()]
841 c1 = self.changelog.read(p1) 845 c1 = self.changelog.read(p1)
842 c2 = self.changelog.read(p2) 846 c2 = self.changelog.read(p2)
843 m1 = self.manifest.read(c1[0]).copy() 847 m1 = self.manifest.read(c1[0]).copy()
844 m2 = self.manifest.read(c2[0]) 848 m2 = self.manifest.read(c2[0])