##// END OF EJS Templates
commands: don't do too much work for error messages
Dirkjan Ochtman -
r10346:e2db50ca default
parent child Browse files
Show More
@@ -1422,26 +1422,27 b' def heads(ui, repo, *branchrevs, **opts)'
1422 heads = repo.heads(start)
1422 heads = repo.heads(start)
1423
1423
1424 else:
1424 else:
1425
1425 if hideinactive:
1426 if hideinactive:
1426 dagheads = repo.heads(start)
1427 dagheads = repo.heads(start)
1427 decode, encode = encoding.fromlocal, encoding.tolocal
1428 decode, encode = encoding.fromlocal, encoding.tolocal
1428 branches = set(repo[decode(br)].branch() for br in branchrevs)
1429 branches = set(repo[decode(br)].branch() for br in branchrevs)
1429 heads = []
1430 heads = []
1430 visitedset = set()
1431
1431 for b in branches:
1432 for b in branches:
1432 bheads = repo.branchheads(b, start, closed=closed)
1433 bheads = repo.branchheads(b, start, closed=closed)
1433 if not bheads:
1434 encodedbranch = encode(b)
1435 if not opts.get('rev'):
1436 ui.warn(_("no open branch heads on branch %s\n")
1437 % encodedbranch)
1438 else:
1439 ui.warn(_("no changes on branch %s are reachable from %s\n")
1440 % (encodedbranch, opts.get('rev')))
1441 if hideinactive:
1434 if hideinactive:
1442 bheads = [bhead for bhead in bheads if bhead in dagheads]
1435 bheads = [bhead for bhead in bheads if bhead in dagheads]
1443 heads.extend(bheads)
1436 heads.extend(bheads)
1444
1437
1438 haveheads = set(repo[h].branch() for h in heads)
1439 if branches - haveheads:
1440 headless = ', '.join(encode(b) for b in branches - haveheads)
1441 msg = _('no open branch heads found on branches %s')
1442 if opts.get('rev'):
1443 msg += _(' (started at %s)' % opts['rev'])
1444 ui.warn((msg + '\n') % headless)
1445
1445 if not heads:
1446 if not heads:
1446 return 1
1447 return 1
1447
1448
@@ -56,7 +56,7 b' 1: Adding a branch'
56 -------
56 -------
57 7: Adding c branch
57 7: Adding c branch
58 =======
58 =======
59 no changes on branch c are reachable from 3
59 no open branch heads found on branches c (started at 3)
60 1
60 1
61 -------
61 -------
62 7: Adding c branch
62 7: Adding c branch
@@ -72,7 +72,7 b' 6: Merging b branch head 2 and b branch '
72 3: Adding b branch head 1
72 3: Adding b branch head 1
73 0
73 0
74 -------
74 -------
75 no changes on branch b are reachable from 7
75 no open branch heads found on branches b (started at 7)
76 1
76 1
77 =======
77 =======
78 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
78 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
@@ -117,7 +117,7 b' c 6:589736a'
117 a 5:d8cbc61dbaa6 (inactive)
117 a 5:d8cbc61dbaa6 (inactive)
118 default 0:19709c5a4e75 (inactive)
118 default 0:19709c5a4e75 (inactive)
119 a branch name much longer than the default justification used by branches 7:10ff5895aa57
119 a branch name much longer than the default justification used by branches 7:10ff5895aa57
120 no open branch heads on branch b
120 no open branch heads found on branches b
121 changeset: 12:2da6583810df
121 changeset: 12:2da6583810df
122 branch: b
122 branch: b
123 tag: tip
123 tag: tip
@@ -169,6 +169,7 b' user: test'
169 date: Thu Jan 01 00:00:04 1970 +0000
169 date: Thu Jan 01 00:00:04 1970 +0000
170 summary: Adding b branch head 2
170 summary: Adding b branch head 2
171
171
172 no open branch heads found on branches a
172 % branch b
173 % branch b
173 changeset: 13:6ac12926b8c3
174 changeset: 13:6ac12926b8c3
174 branch: b
175 branch: b
General Comments 0
You need to be logged in to leave comments. Login now