Source:
private void display() throws Failure { if (showTree && (showBranch != null)) { throw new UnloggedFailure(1, "fatal: --tree and --show-branch options are not compatible."); } final PrintWriter stdout = toPrintWriter(out); TreeMap<String, TreeNode> treeMap = null; if (showTree) { treeMap = new TreeMap<String, TreeNode>(); } try { for (final Project.NameKey projectName : projectCache.all()) { if (projectName.equals(wildProject)) { continue; } final ProjectState e = projectCache.get(projectName); if (e == null) { continue; } final ProjectControl pctl = e.controlFor(currentUser); final Project p = pctl.getProject(); if (!showTree) { if (!pctl.isVisible()) { continue; } if (showBranch != null) { final Ref ref = getBranchRef(projectName); if (ref == null || ref.getObjectId() == null || !pctl.controlForRef(ref.getLeaf().getName()).isVisible()) { continue; } stdout.print(ref.getObjectId().name()); stdout.print(' '); } stdout.print(p.getName() + "\n"); } else { treeMap.put(p.getName(), new TreeNode(p, pctl.isVisible())); } } if (showTree && treeMap.size() > 0) { final List<TreeNode> sortedNodes = new ArrayList<TreeNode>(); for (final TreeNode key : treeMap.values()) { final String parentName = key.getParentName(); if (parentName != null) { final TreeNode node = treeMap.get(parentName); if (node != null) { node.addChild(key); } else { sortedNodes.add(key); } } else { sortedNodes.add(key); } } final TreeNode fakeRoot = new TreeNode(null, sortedNodes, false); printElement(stdout, fakeRoot, -1, false, sortedNodes.get(sortedNodes.size() - 1)); stdout.flush(); } } finally { stdout.flush(); } }

Target:
private void display() throws Failure { if (showTree && (showBranch != null)) { throw new UnloggedFailure(1, "fatal: --tree and --show-branch options are not compatible."); } final PrintWriter stdout = toPrintWriter(out); TreeMap<String, TreeNode> treeMap = null; if (showTree) { treeMap = new TreeMap<String, TreeNode>(); } try { for (final Project.NameKey projectName : projectCache.all()) { if (projectName.equals(wildProject)) { continue; } final ProjectState e = projectCache.get(projectName); if (e == null) { continue; } final ProjectControl pctl = e.controlFor(currentUser); if (!showTree) { if (!pctl.isVisible()) { continue; } if (showBranch != null) { final Ref ref = getBranchRef(projectName); if (ref == null || ref.getObjectId() == null || !pctl.controlForRef(ref.getLeaf().getName()).isVisible()) { continue; } stdout.print(ref.getObjectId().name()); stdout.print(' '); } stdout.print(projectName.get() + "\n"); } else { treeMap.put(projectName.get(), new TreeNode(pctl.getProject(), pctl.isVisible())); } } if (showTree && treeMap.size() > 0) { final List<TreeNode> sortedNodes = new ArrayList<TreeNode>(); for (final TreeNode key : treeMap.values()) { final String parentName = key.getParentName(); if (parentName != null) { final TreeNode node = treeMap.get(parentName); if (node != null) { node.addChild(key); } else { sortedNodes.add(key); } } else { sortedNodes.add(key); } } final TreeNode fakeRoot = new TreeNode(null, sortedNodes, false); printElement(stdout, fakeRoot, -1, false, sortedNodes.get(sortedNodes.size() - 1)); stdout.flush(); } } finally { stdout.flush(); } }