/** * Prepare branch descriptors for existing configuration * * @param target the target * @param roots the vcs root * @return the list of branch descriptors * @throws VcsException in case of error */ private List<BranchDescriptor> prepareBranchDescriptors( BranchConfiguration target, List<VirtualFile> roots) throws VcsException { Map<String, String> map = target == null ? Collections.<String, String>emptyMap() : target.getReferences(); List<BranchDescriptor> rc = new ArrayList<BranchDescriptor>(); for (VirtualFile root : roots) { BranchDescriptor d = new BranchDescriptor(); d.root = root; d.storedReference = map.remove(root.getPath()); if (d.storedReference != null) { d.storedRoot = d.root.getPath(); } d.currentReference = myConfig.describeRoot(root); if (d.storedReference != null && !myModify) { d.referenceToCheckout = d.storedReference; } else { d.referenceToCheckout = d.currentReference; } Branch.listAsStrings(myProject, root, false, true, d.existingBranches, null); Branch.listAsStrings(myProject, root, true, true, d.referencesToSelect, null); d.updateStatus(); rc.add(d); } for (Map.Entry<String, String> m : map.entrySet()) { String root = m.getKey(); String ref = m.getValue(); BranchDescriptor d = new BranchDescriptor(); d.storedReference = ref; d.storedRoot = root; d.referenceToCheckout = ref; d.updateStatus(); rc.add(d); } return rc; }