1204 continue |
1204 continue |
1205 if fn not in copies.get(prev[fn], {}): |
1205 if fn not in copies.get(prev[fn], {}): |
1206 found = display(fn, rev, {}, state) or found |
1206 found = display(fn, rev, {}, state) or found |
1207 return (not found and 1) or 0 |
1207 return (not found and 1) or 0 |
1208 |
1208 |
1209 def heads(ui, repo, **opts): |
1209 def heads(ui, repo, *branchrevs, **opts): |
1210 """show current repository heads |
1210 """show current repository heads or show branch heads |
1211 |
1211 |
1212 Show all repository head changesets. |
1212 With no arguments, show all repository head changesets. |
1213 |
1213 |
1214 Repository "heads" are changesets that don't have children |
1214 If branch or revisions names are given this will show the heads of |
|
1215 the specified branches or the branches those revisions are tagged |
|
1216 with. |
|
1217 |
|
1218 Repository "heads" are changesets that don't have child |
1215 changesets. They are where development generally takes place and |
1219 changesets. They are where development generally takes place and |
1216 are the usual targets for update and merge operations. |
1220 are the usual targets for update and merge operations. |
|
1221 |
|
1222 Branch heads are changesets that have a given branch tag, but have |
|
1223 no child changesets with that tag. They are usually where |
|
1224 development on the given branch takes place. |
1217 """ |
1225 """ |
1218 if opts['rev']: |
1226 if opts['rev']: |
1219 heads = repo.heads(repo.lookup(opts['rev'])) |
1227 start = repo.lookup(opts['rev']) |
1220 else: |
1228 else: |
1221 heads = repo.heads() |
1229 start = None |
|
1230 if not branchrevs: |
|
1231 # Assume we're looking repo-wide heads if no revs were specified. |
|
1232 heads = repo.heads(start) |
|
1233 else: |
|
1234 heads = [] |
|
1235 visitedset = set() |
|
1236 displayer = cmdutil.show_changeset(ui, repo, opts) |
|
1237 for branchrev in branchrevs: |
|
1238 branch = repo.changectx(branchrev).branch() |
|
1239 if branch in visitedset: |
|
1240 continue |
|
1241 visitedset.add(branch) |
|
1242 bheads = repo.branchheads(branch, start) |
|
1243 if not bheads: |
|
1244 if branch != branchrev: |
|
1245 ui.warn(_("no changes on branch %s containing %s are " |
|
1246 "reachable from %s\n") |
|
1247 % (branch, branchrev, opts['rev'])) |
|
1248 else: |
|
1249 ui.warn(_("no changes on branch %s are reachable from %s\n") |
|
1250 % (branch, opts['rev'])) |
|
1251 heads.extend(bheads) |
|
1252 if not heads: |
|
1253 return 1 |
1222 displayer = cmdutil.show_changeset(ui, repo, opts) |
1254 displayer = cmdutil.show_changeset(ui, repo, opts) |
1223 for n in heads: |
1255 for n in heads: |
1224 displayer.show(changenode=n) |
1256 displayer.show(changenode=n) |
1225 |
1257 |
1226 def help_(ui, name=None, with_version=False): |
1258 def help_(ui, name=None, with_version=False): |
2788 "heads": |
2820 "heads": |
2789 (heads, |
2821 (heads, |
2790 [('', 'style', '', _('display using template map file')), |
2822 [('', 'style', '', _('display using template map file')), |
2791 ('r', 'rev', '', _('show only heads which are descendants of rev')), |
2823 ('r', 'rev', '', _('show only heads which are descendants of rev')), |
2792 ('', 'template', '', _('display with template'))], |
2824 ('', 'template', '', _('display with template'))], |
2793 _('hg heads [-r REV]')), |
2825 _('hg heads [-r REV] [REV]...')), |
2794 "help": (help_, [], _('hg help [COMMAND]')), |
2826 "help": (help_, [], _('hg help [COMMAND]')), |
2795 "identify|id": (identify, [], _('hg identify')), |
2827 "identify|id": (identify, [], _('hg identify')), |
2796 "import|patch": |
2828 "import|patch": |
2797 (import_, |
2829 (import_, |
2798 [('p', 'strip', 1, |
2830 [('p', 'strip', 1, |