# HG changeset patch # User Dirkjan Ochtman # Date 1212092613 -7200 # Node ID 1603bba96411ce4608d7653bc1f3d6058ddf2db2 # Parent d6b53b48943f4b3b4248a6bbf227c0f7762eb8ed# Parent a2b13cac0922a7a952d1e786a6eaa1234bfd3e80 merge from crew-stable diff -r d6b53b48943f -r 1603bba96411 mercurial/commands.py --- a/mercurial/commands.py Thu May 29 16:29:28 2008 +0200 +++ b/mercurial/commands.py Thu May 29 22:23:33 2008 +0200 @@ -373,30 +373,26 @@ List the repository's named branches, indicating which ones are inactive. If active is specified, only show active branches. - A branch is considered active if it contains unmerged heads. + A branch is considered active if it contains repository heads. Use the command 'hg update' to switch to an existing branch. """ - b = repo.branchtags() - heads = dict.fromkeys(repo.heads(), 1) - l = [((n in heads), repo.changelog.rev(n), n, t) for t, n in b.items()] - l.sort() - l.reverse() - for ishead, r, n, t in l: - if active and not ishead: - # If we're only displaying active branches, abort the loop on - # encountering the first inactive head - break - else: - hexfunc = ui.debugflag and hex or short + hexfunc = ui.debugflag and hex or short + activebranches = [util.tolocal(repo.changectx(n).branch()) + for n in repo.heads()] + branches = [(tag in activebranches, repo.changelog.rev(node), tag) + for tag, node in repo.branchtags().items()] + branches.sort(reverse=True) + + for isactive, node, tag in branches: + if (not active) or isactive: if ui.quiet: - ui.write("%s\n" % t) + ui.write("%s\n" % tag) else: - spaces = " " * (30 - util.locallen(t)) - # The code only gets here if inactive branches are being - # displayed or the branch is active. - isinactive = ((not ishead) and " (inactive)") or '' - ui.write("%s%s %s:%s%s\n" % (t, spaces, r, hexfunc(n), isinactive)) + rev = str(node).rjust(32 - util.locallen(tag)) + isinactive = ((not isactive) and " (inactive)") or '' + data = tag, rev, hexfunc(repo.lookup(node)), isinactive + ui.write("%s%s:%s%s\n" % data) def bundle(ui, repo, fname, dest=None, **opts): """create a changegroup file diff -r d6b53b48943f -r 1603bba96411 mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py Thu May 29 16:29:28 2008 +0200 +++ b/mercurial/hgweb/protocol.py Thu May 29 22:23:33 2008 +0200 @@ -224,5 +224,7 @@ os.unlink(tempname) def stream_out(web, req): + if not web.allowpull: + return req.respond(HTTP_OK, HGTYPE) streamclone.stream_out(web.repo, req, untrusted=True) diff -r d6b53b48943f -r 1603bba96411 tests/test-branches --- a/tests/test-branches Thu May 29 16:29:28 2008 +0200 +++ b/tests/test-branches Thu May 29 22:23:33 2008 +0200 @@ -31,6 +31,11 @@ hg branch c hg commit -d '5 0' -u test -m "Adding c branch" +echo 'd' >d +hg add d +hg branch d +hg commit -d '6 0' -u test -m "Adding d branch" + hg branches echo '-------' hg branches -a diff -r d6b53b48943f -r 1603bba96411 tests/test-branches.out --- a/tests/test-branches.out Thu May 29 16:29:28 2008 +0200 +++ b/tests/test-branches.out Thu May 29 22:23:33 2008 +0200 @@ -5,12 +5,15 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved created new head marked working directory as branch c -c 5:5ca481e59b8c +marked working directory as branch d +d 6:9c581c5ff105 +b 4:22df7444f7c1 a 1:dd6b440dd85a -b 4:22df7444f7c1 (inactive) +c 5:5ca481e59b8c (inactive) default 0:19709c5a4e75 (inactive) ------- -c 5:5ca481e59b8c +d 6:9c581c5ff105 +b 4:22df7444f7c1 a 1:dd6b440dd85a --- Branch a changeset: 1:dd6b440dd85a diff -r d6b53b48943f -r 1603bba96411 tests/test-convert-svn-branches.out --- a/tests/test-convert-svn-branches.out Thu May 29 16:29:28 2008 +0200 +++ b/tests/test-convert-svn-branches.out Thu May 29 22:23:33 2008 +0200 @@ -123,8 +123,8 @@ |/ o branch= 0 init projA files: -old3 11: -default 10: +old3 11: +default 10: old 9: old2 8: tip