1893 if len(nodes) <= maxnumnodes or repo.ui.verbose: |
1893 if len(nodes) <= maxnumnodes or repo.ui.verbose: |
1894 return ' '.join(short(h) for h in nodes) |
1894 return ' '.join(short(h) for h in nodes) |
1895 first = ' '.join(short(h) for h in nodes[:maxnumnodes]) |
1895 first = ' '.join(short(h) for h in nodes[:maxnumnodes]) |
1896 return _("%s and %d others") % (first, len(nodes) - maxnumnodes) |
1896 return _("%s and %d others") % (first, len(nodes) - maxnumnodes) |
1897 |
1897 |
1898 def enforcesinglehead(repo, tr, desc): |
1898 def enforcesinglehead(repo, tr, desc, accountclosed=False): |
1899 """check that no named branch has multiple heads""" |
1899 """check that no named branch has multiple heads""" |
1900 if desc in ('strip', 'repair'): |
1900 if desc in ('strip', 'repair'): |
1901 # skip the logic during strip |
1901 # skip the logic during strip |
1902 return |
1902 return |
1903 visible = repo.filtered('visible') |
1903 visible = repo.filtered('visible') |
1904 # possible improvement: we could restrict the check to affected branch |
1904 # possible improvement: we could restrict the check to affected branch |
1905 for name, heads in visible.branchmap().iteritems(): |
1905 bm = visible.branchmap() |
|
1906 for name in bm: |
|
1907 heads = bm.branchheads(name, closed=accountclosed) |
1906 if len(heads) > 1: |
1908 if len(heads) > 1: |
1907 msg = _('rejecting multiple heads on branch "%s"') |
1909 msg = _('rejecting multiple heads on branch "%s"') |
1908 msg %= name |
1910 msg %= name |
1909 hint = _('%d heads: %s') |
1911 hint = _('%d heads: %s') |
1910 hint %= (len(heads), nodesummaries(repo, heads)) |
1912 hint %= (len(heads), nodesummaries(repo, heads)) |