List of usage examples for org.eclipse.jgit.transport RefSpec isWildcard
public boolean isWildcard()
From source file:org.eclipse.egit.ui.internal.components.RefSpecPanel.java
License:Open Source License
private String validateSpec(final RefSpec spec) { final String src = spec.getSource(); final String dst = spec.getDestination(); final boolean wildcard = spec.isWildcard(); // check src/*from w w w. j a v a2 s .c o m*/ if (pushSpecs) { if (!isDeleteRefSpec(spec)) { if (src.length() == 0) return UIText.RefSpecPanel_validationSrcUpdateRequired; else if (!wildcard && !isLocalRef(src)) return NLS.bind(UIText.RefSpecPanel_validationRefInvalidLocal, src); else if (wildcard && !isValidRefExpression(src)) return NLS.bind(UIText.RefSpecPanel_validationRefInvalidExpression, src); // ignore non-matching wildcard specs } } else { if (src == null || src.length() == 0) return UIText.RefSpecPanel_validationSrcUpdateRequired; else if (!wildcard && !isRemoteRef(src)) return NLS.bind(UIText.RefSpecPanel_validationRefNonExistingRemote, src); // ignore non-matching wildcard specs } // check dst if (dst == null || dst.length() == 0) { if (isDeleteRefSpec(spec)) return UIText.RefSpecPanel_validationRefDeleteRequired; return UIText.RefSpecPanel_validationDstRequired; } else if (!isValidRefExpression(dst)) return NLS.bind(UIText.RefSpecPanel_validationRefInvalidExpression, dst); else if (isDeleteRefSpec(spec) && !isRemoteRef(dst)) return NLS.bind(UIText.RefSpecPanel_validationRefNonExistingRemoteDelete, dst); return null; }
From source file:org.eclipse.egit.ui.internal.components.RefSpecPanel.java
License:Open Source License
private void validateSpecsCrossDst() { final Map<String, RefSpec> dstsSpecsMap = new HashMap<String, RefSpec>(); try {//from w ww . jav a 2 s . c o m for (final RefSpec spec : specs) { if (!spec.isWildcard()) { if (!tryAddDestination(dstsSpecsMap, spec.getDestination(), spec)) return; } else { final Collection<String> srcNames; if (pushSpecs) srcNames = localRefNames; else srcNames = remoteRefNames; for (final String src : srcNames) { if (spec.matchSource(src)) { final String dst = spec.expandFromSource(src).getDestination(); if (!tryAddDestination(dstsSpecsMap, dst, spec)) return; } } } } } finally { matchingAnyRefs = !dstsSpecsMap.isEmpty(); } }