Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/commands.py Thu May 13 11:33:11 2010 -0500 +++ b/mercurial/commands.py Thu May 13 17:24:21 2010 -0500 @@ -730,30 +730,29 @@ return repo.commit(message, opts.get('user'), opts.get('date'), match, editor=e, extra=extra) + branch = repo[None].branch() + bheads = repo.branchheads(branch) + node = cmdutil.commit(ui, repo, commitfunc, pats, opts) if not node: ui.status(_("nothing changed\n")) return - cl = repo.changelog - rev = cl.rev(node) - parents = cl.parentrevs(rev) - if rev - 1 in parents: - # one of the parents was the old tip - pass - elif (parents == (nullrev, nullrev) or - len(cl.heads(cl.node(parents[0]))) > 1 and - (parents[1] == nullrev or len(cl.heads(cl.node(parents[1]))) > 1)): + + ctx = repo[node] + parents = ctx.parents() + + if bheads and [x for x in parents if x.node() not in bheads]: ui.status(_('created new head\n')) if not opts.get('close_branch'): for r in parents: - if repo[r].extra().get('close'): + if r.extra().get('close'): ui.status(_('reopening closed branch head %d\n') % r) if ui.debugflag: - ui.write(_('committed changeset %d:%s\n') % (rev, hex(node))) + ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex())) elif ui.verbose: - ui.write(_('committed changeset %d:%s\n') % (rev, short(node))) + ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx)) def copy(ui, repo, *pats, **opts): """mark files as copied for the next commit