##// END OF EJS Templates
branch closing: mark closed branches with a 'close' extra...
John Mulligan -
r7655:cce37dab default
parent child Browse files
Show More
@@ -613,9 +613,13 b' def commit(ui, repo, *pats, **opts):'
613
613
614 See 'hg help dates' for a list of formats valid for -d/--date.
614 See 'hg help dates' for a list of formats valid for -d/--date.
615 """
615 """
616 extra = {}
617 if opts.get('close_branch'):
618 extra['close'] = 1
616 def commitfunc(ui, repo, message, match, opts):
619 def commitfunc(ui, repo, message, match, opts):
617 return repo.commit(match.files(), message, opts.get('user'), opts.get('date'),
620 return repo.commit(match.files(), message, opts.get('user'),
618 match, force_editor=opts.get('force_editor'))
621 opts.get('date'), match, force_editor=opts.get('force_editor'),
622 extra=extra)
619
623
620 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
624 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
621 if not node:
625 if not node:
@@ -3134,6 +3138,8 b' table = {'
3134 (commit,
3138 (commit,
3135 [('A', 'addremove', None,
3139 [('A', 'addremove', None,
3136 _('mark new/missing files as added/removed before committing')),
3140 _('mark new/missing files as added/removed before committing')),
3141 ('', 'close-branch', None,
3142 _('mark a branch as closed, hiding it from the branch list')),
3137 ] + walkopts + commitopts + commitopts2,
3143 ] + walkopts + commitopts + commitopts2,
3138 _('[OPTION]... [FILE]...')),
3144 _('[OPTION]... [FILE]...')),
3139 "copy|cp":
3145 "copy|cp":
@@ -763,6 +763,8 b' class localrepository(repo.repository):'
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:
@@ -837,6 +839,8 b' class localrepository(repo.repository):'
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)
General Comments 0
You need to be logged in to leave comments. Login now