Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 11173:5b48d819d5f9
commit: note new branch heads rather than topological heads
Move to using contexts while we're at it.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 13 May 2010 17:24:21 -0500 |
parents | 3d0a9c8d7184 |
children | 6a64813276ed |
comparison
equal
deleted
inserted
replaced
11172:e9226eb3af2a | 11173:5b48d819d5f9 |
---|---|
728 | 728 |
729 def commitfunc(ui, repo, message, match, opts): | 729 def commitfunc(ui, repo, message, match, opts): |
730 return repo.commit(message, opts.get('user'), opts.get('date'), match, | 730 return repo.commit(message, opts.get('user'), opts.get('date'), match, |
731 editor=e, extra=extra) | 731 editor=e, extra=extra) |
732 | 732 |
733 branch = repo[None].branch() | |
734 bheads = repo.branchheads(branch) | |
735 | |
733 node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | 736 node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
734 if not node: | 737 if not node: |
735 ui.status(_("nothing changed\n")) | 738 ui.status(_("nothing changed\n")) |
736 return | 739 return |
737 cl = repo.changelog | 740 |
738 rev = cl.rev(node) | 741 ctx = repo[node] |
739 parents = cl.parentrevs(rev) | 742 parents = ctx.parents() |
740 if rev - 1 in parents: | 743 |
741 # one of the parents was the old tip | 744 if bheads and [x for x in parents if x.node() not in bheads]: |
742 pass | |
743 elif (parents == (nullrev, nullrev) or | |
744 len(cl.heads(cl.node(parents[0]))) > 1 and | |
745 (parents[1] == nullrev or len(cl.heads(cl.node(parents[1]))) > 1)): | |
746 ui.status(_('created new head\n')) | 745 ui.status(_('created new head\n')) |
747 | 746 |
748 if not opts.get('close_branch'): | 747 if not opts.get('close_branch'): |
749 for r in parents: | 748 for r in parents: |
750 if repo[r].extra().get('close'): | 749 if r.extra().get('close'): |
751 ui.status(_('reopening closed branch head %d\n') % r) | 750 ui.status(_('reopening closed branch head %d\n') % r) |
752 | 751 |
753 if ui.debugflag: | 752 if ui.debugflag: |
754 ui.write(_('committed changeset %d:%s\n') % (rev, hex(node))) | 753 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex())) |
755 elif ui.verbose: | 754 elif ui.verbose: |
756 ui.write(_('committed changeset %d:%s\n') % (rev, short(node))) | 755 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx)) |
757 | 756 |
758 def copy(ui, repo, *pats, **opts): | 757 def copy(ui, repo, *pats, **opts): |
759 """mark files as copied for the next commit | 758 """mark files as copied for the next commit |
760 | 759 |
761 Mark dest as having copies of source files. If dest is a | 760 Mark dest as having copies of source files. If dest is a |